-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix callable phpdoc for twig elements #3856
Conversation
Maybe that's something we want to deprecate? |
@fabpot Isn't it a requirement for lazy loading? |
Why would we want to deprecate it ? this is what supports the runtime feature, enabling lazy-loading. |
Are you sure is a class-string and not a service id? |
Thank you @VincentLanglet. |
Yes @jordisala1991, the signature is |
@fabpot Thanks for the merge. Currently, all phpstan-bleeding-edge users will have static analysis build failing since this PR is currently not release. |
Sorry for the delay @VincentLanglet; this one fell through the cracks. I've just made a new release. |
This PR was merged into the 3.x branch. Discussion ---------- Fix callable phpdoc for twig elements Hi `@fabpot` I made a stupid mistake in #3856 The correct phpdoc is `array{class-string, string}` and not `array<class-string, string>`. Code is used this way ``` $compiler->raw(sprintf('$this->env->getRuntime(\'%s\')->%s', $callable[0], $callable[1])); ``` which means the key 0 is a class string, and the key 1 is a string. `array{class-string, string}` is same as `array{0: class-string, 1: string}` `array<class-string, string>` is saying all the keys are class-string, and values are string. Commits ------- 1b58589 Fix callable phpdoc
Hi @fabpot
is not a valid callable in PHP 8 https://3v4l.org/tWqPs
But this syntax is supported because twig has a special behavior
The PHPDoc should be updated in order to reflect the real behavior and solve static analysis errors.
A phpstan discussion can be found here: phpstan/phpstan#9567