1.2.723. Mixed Type Usage¶
Usage of the mixed
type. The mixed
type represents all the available types. It is the same as leaving the type empty, except that the intention to use any type is now explicit.
<?php
function foo() : mixed {
switch(rand(0, 3)) {
case 0:
return false;
case 1:
return 'a';
case 2:
return [];
default:
return null;
}
}
?>
See also Type declarations.
1.2.723.1. Connex PHP features¶
1.2.723.1.1. Specs¶
Short name |
Php/MixedUsage |
Rulesets |
|
Exakat since |
2.3.0 |
PHP Version |
With PHP 8.1 and more recent |
Severity |
|
Time To Fix |
|
Precision |
Very high |
Available in |