1.2.924. PHP 8.1 New Types

This rule reports usage of the new PHP 8.1 types. This is the never type.

This type is actually only available in return types in methods. This type is not available before version 8.1: as it was not a reserved keyword, it might be used with a class.

<?php

function foo() : never {
     die();
}

?>

1.2.924.1. Specs

Short name

Php/Php81NewTypes

Rulesets

All, Changed Behavior, CompatibilityPHP53, CompatibilityPHP54, CompatibilityPHP55, CompatibilityPHP56, CompatibilityPHP70, CompatibilityPHP71, CompatibilityPHP72, CompatibilityPHP73, CompatibilityPHP74, CompatibilityPHP80, CompatibilityPHP81

Exakat since

2.6.6

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Available in

Entreprise Edition, Exakat Cloud