The `string` is the type of each argument.
The `...` indicates that it is an array of that type, like
`function (string ...$classNames)` also would indicate.
Update code to PHPStan Level 3
Added ReturnTypeWillChange
Fix return type for Expression
Add type hints for returned variables
Add generic parameter for delimted list
Fixing type hints
Ignore co-variance error
Remove TODO - it already must always be a Node
Ignore error
Add missing types
Update phpstan to level 3
Add phpstan to dev reqs
No need to install phpstan independently
Do not override unary expression operand
It seems to me that the operand can be any expression
Added token to operand types -- should this be MissingToken?
Include tokens in return types
ExpressionStatement => EchoStatement
It seems this is always an EchoStatement not an ExpressionStatement
unaryExpressionOrHigher can return a ThrowExpression
Remove overridden property
Add Token to union
Remove QualifiedName and rename local variable
Remove unused import
Add return types
Remove trailing whitespace
Add MissingToken type
Ignore "should not happen" statement
Bump to level 4
Remove !is_null conditional branch - it always returns Node
NamespaceUseDeclaration#useClauses is technically nullable
NamespaceUseGroupCluase#functionOrConst can be NULL
Add TODO
Removed redundant condition (check)
Add return type
Add retutn type, remove inaccurate docblock
Fix bug with get string literal text, as it returned the quotes
Ignore assumed false-positive from PHPStan
If allowEmptyElements if `false`...
... then it MUST be true in the right hand side of ||
backslash can be NULL
BinaryExpresionOrHigher can return MIssingToken
Ignoring error to be safe (as commented) and more type hints
Set level to 4
Add explanation
Added ReturnTypeWillChange
Fix return type for Expression
Add type hints for returned variables
Add generic parameter for delimted list
Fixing type hints
Ignore co-variance error
Remove TODO - it already must always be a Node
Ignore error
Add missing types
Update phpstan to level 3
Add phpstan to dev reqs
No need to install phpstan independently
Do not override unary expression operand
It seems to me that the operand can be any expression
Added token to operand types -- should this be MissingToken?
Include tokens in return types
ExpressionStatement => EchoStatement
It seems this is always an EchoStatement not an ExpressionStatement
unaryExpressionOrHigher can return a ThrowExpression
Remove overridden property
Add Token to union
Remove QualifiedName and rename local variable
Remove unused import
Add return types
Remove trailing whitespace
Add MissingToken type
The `string` is the type of each argument.
The `...` indicates that it is an array of that type, like
`function (string ...$classNames)` also would indicate.
https://www.php.net/manual/en/function.halt-compiler.php can be used to
embed data in php scripts from the outermost scope.
In inner scope, it is parsed in php-src only for the sake of error
messages about it needing to be in the outermost scope, so treat it as
an unexpected token in other contexts.
(In an inner `{...}` scope, the call to `token_get_all()` will still
stop after `__halt_compiler();`, returning T_INLINE_HTML,
so the remaining statements can't be parsed, anyway)
Additionally, `__halt_compiler` can't be used as a name, a member name
(e.g. method name), etc, so calling it `TokenKind::Name` seems
incorrect. (`__COMPILER_HALT_OFFSET__` is already properly a Name)
Closes#381
1. We're parsing thousands of files and there are many tokens per file.
The overhead of all the assert statements is noticeable.
Optimizing out the check speeds this up 3x from 90 seconds to 30 seconds.
2. Don't write files only to unlink them later.
Instead, save the failed file only on test suite failure
Similar to 'void', it's a compile time error to use void as a
parameter/property type, not a parse time error.
But `static` is a parse error.
(It can also be used in union types)
Remove redundant tokens added to merged returnTypeDeclarationTokens
Closes#373Closes#372
Support php 8.2's Disjunctive Normal Form Types
(allowing parenthesized intersection types of 2 or more types in union types)
https://wiki.php.net/rfc/dnf_typesCloses#372
Any expression can be used as of 8.0 without an unexpected syntax error.
In encapsulated strings,
`"${a->prop}"` is equivalent to `"{${(a->prop)}}"` in php 8.0 and a
syntax error in previous php versions.
(Get the property `prop` of the global constant `a` (constants can be
objects in php 8.1), then get the variable with the name equal to that
string)