Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[DependencyInjection] Add types to private properties#41928
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/DependencyInjection/Compiler/AliasDeprecatedPublicServicesPass.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
stof commentedJul 1, 2021
for the Psalm false positive, I reported the bug atvimeo/psalm#6027 |
| privatefunctiongetExpressionLanguage():ExpressionLanguage | ||
| { | ||
| if (null ===$this->expressionLanguage) { | ||
| if (!isset($this->expressionLanguage)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
why not nullable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
the private scope confused me. But from#41924 i figured this lazy loading tactic is probably slightly preferred, as we dont need to give in on type info.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Right.null was previously used for lazy initialization only and I'd like to avoid making properties nullable. If someone accesses this property before initialization, they made a mistake and PHP will raise an exception for us. This is a good thing.
This PR was merged into the 4.4 branch.Discussion----------[DependencyInjection] Fix doc blocks| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets | N/A| License | MIT| Doc PR | N/ATwo small backports from#41928.Commits-------950b2e7 [DependencyInjection] Fix doc blocks
| $this->getEnv->setAccessible(true); | ||
| $this->getEnv =$this->getEnv->getClosure($this); | ||
| } | ||
| $this->getEnv ??= \Closure::fromCallable([$this,__FUNCTION__]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
psalm bug here, it's not able to compute__FUNCTION__ correctly
let's use 'getEnv' instead
…nto a constant (derrabus)This PR was merged into the 4.4 branch.Discussion----------[DependencyInjection] Turn $defaultDeprecationTemplate into a constant| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | no| New feature? | no| Deprecations? | no| Tickets |#41928 (comment)| License | MIT| Doc PR | N/ACommits-------936e399 [DependencyInjection] Turn $defaultDeprecationTemplate into a constant
…nto a constant (derrabus)This PR was merged into the 4.4 branch.Discussion----------[DependencyInjection] Turn $defaultDeprecationTemplate into a constant| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | no| New feature? | no| Deprecations? | no| Tickets |symfony/symfony#41928 (comment)| License | MIT| Doc PR | N/ACommits-------936e399ff9 [DependencyInjection] Turn $defaultDeprecationTemplate into a constant
7b7588a to069da20Comparenicolas-grekas commentedJul 3, 2021
Thank you@derrabus. |
Same procedure as#41924, but on a more complex component.