1.2.768. Never Keyword¶
Never becomes a PHP keyword. It is used for typing functions which never returns anything (either dies or throw an exception).
It should be avoided in namespaces, classes, traits and interfaces. Methods, constants and functions are OK.
<?php
// This is OK
function never() { }
// This is no OK
class never { }
?>
See also never and PHP RFC: noreturn type.
1.2.768.2. Connex PHP features¶
1.2.768.2.1. Suggestions¶
Rename the classes, traits and interfaces with a different name.
1.2.768.2.2. Specs¶
Short name |
Php/NeverKeyword |
Rulesets |
|
Exakat since |
2.3.0 |
PHP Version |
With PHP 8.1 and older |
Severity |
Major |
Time To Fix |
Slow (1 hour) |
Changed Behavior |
PHP 8.1 |
Precision |
Very high |
Available in |