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
As can be seen in the table below, misplaced null causes a compile error, whereas keywords (or language constructs) cause parse errors.
Naming
with any keyword
with null
class
E_PARSE
E_COMPILE_ERROR
constant
E_PARSE *
E_NOTICE
function
E_PARSE
✔️
method
✔️
✔️
namespace
E_PARSE
✔️
trait
E_PARSE
E_COMPILE_ERROR
variable
✔️
✔️
* Fails on the direct access, i. e., without constant().
So I think Prism should categorize null as a constant, not as a keyword. This is unlikely to adversely affect backward compatibility, because constant is also a well‑known class, which is already supported by most of the themes.
false and true are also constants
false and true are also case‑insensitive predefined constants and have all the same features that null has. Thus, they should get the same additional classes.
Solution
Remove null from the keyword regex. Add the following code:
null
is not a keywordnull
is a case‑insensitive predefined constant (see https://secure.php.net/manual/en/reserved.constants.php).As can be seen in the table below, misplaced
null
causes a compile error, whereas keywords (or language constructs) cause parse errors.null
E_PARSE
E_COMPILE_ERROR
E_PARSE
*E_NOTICE
E_PARSE
E_PARSE
E_PARSE
E_COMPILE_ERROR
* Fails on the direct access, i. e., without
constant()
.So I think Prism should categorize
null
as a constant, not as a keyword. This is unlikely to adversely affect backward compatibility, becauseconstant
is also a well‑known class, which is already supported by most of the themes.false
andtrue
are also constantsfalse
andtrue
are also case‑insensitive predefined constants and have all the same features thatnull
has. Thus, they should get the same additional classes.Solution
Remove
null
from thekeyword
regex. Add the following code:Redefine the
boolean
regex, which is inherited fromclike
:Expected results
false
andtrue
token boolean
token boolean constant predefined-constant
null
token keyword
token null constant predefined-constant
The text was updated successfully, but these errors were encountered: