Conversation
|
|
||
| $this->processStmtNodesInternal($stmt, $classLikeStatements, $classScope, $storage, $classStatementsGatherer, $context); | ||
| foreach ($stmt->stmts as $classLikeStmt) { | ||
| if (!$classLikeStmt instanceof Node\Stmt\ClassConst || !$classLikeStmt->isPublic()) { |
There was a problem hiding this comment.
Please also add a test when the constant is private:
I wonder why this works before the PR already
There was a problem hiding this comment.
I'm gonna add a few more tests with fixes. Also, I think I've accidentally fixed this:
I'm not sure if this was supposed to be fixed? It would make sense, though. Now it correctly resolves to 42 and the *ERROR* assertion fails.
I wonder why this works before the PR already
phpstan.org/r/5e8b0fd5-fa52-4787-bcd5-cb25eed12508
It doesn't look like working to me. It prints Dumped type: Closure(int): array, it should print Dumped type: Closure(int): array{num: int}.
| } | ||
|
|
||
| foreach ($classLikeStmt->consts as $const) { | ||
| $scope = $scope->assignExpression( |
There was a problem hiding this comment.
I wonder why we don't know the full closure type, whereever it is assigned/calculated before this PR
There was a problem hiding this comment.
We already inferred it, but scope transitions dropped ClassConstFetch/self::CONST info, so lookup fell back to reflection and lost shape precision.
|
Pushed some more tests and changes. Oh well, it seems this broke some things in the legacy resolver... |
Fixes phpstan/phpstan#14105.