You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Class constants are supported in PHP 5+. Using "const" outside of a class as an alternative to using "define" requires PHP 5.3+. However, all uses of "const" are treated as requiring PHP 5.3.
I had a look at the keyword sniff, and I'm not sure what the best way would be to detect the different uses of this keyword. Perhaps a new sniff would have to be created to handle the different uses.
The following is a class constant, which is compatible with PHP 5+.
Sounds like a perfect example for using the PHP_CodeSniffer_Standards_AbstractScopeSniff class as a base and applying different tests to inside and outside (class) scope.
jrfnl
added a commit
to jrfnl/PHPCompatibility
that referenced
this issue
Aug 6, 2016
Class constants are supported in PHP 5+. Using "const" outside of a class as an alternative to using "define" requires PHP 5.3+. However, all uses of "const" are treated as requiring PHP 5.3.
I had a look at the keyword sniff, and I'm not sure what the best way would be to detect the different uses of this keyword. Perhaps a new sniff would have to be created to handle the different uses.
The following is a class constant, which is compatible with PHP 5+.
The following is a global constant defined using the "const" keyword, which is compatible with PHP 5.3+.
The text was updated successfully, but these errors were encountered: