1.2.808. No Magic Method For Enum¶
Enumeration cannot have magic methods, nor a constructor. Enumeration cases are created as needed, and magic methods are interfering with the default behavior of enumerations.
<?php
enum a {
function __construct($a) {}
}
?>
See also Enumeration Methods.
1.2.808.1. Suggestions¶
Remove the method
1.2.808.2. Specs¶
Short name |
Enums/NoMagicMethod |
Rulesets |
|
Exakat since |
2.4.2 |
PHP Version |
With PHP 8.1 and more recent |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Features |
enumeration, magic-method |
Note |
This issue may lint but will not run |
Available in |