-
Notifications
You must be signed in to change notification settings - Fork 9.4k
PHPStan add support of magic methods of Data Object. #27905
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
PHPStan add support of magic methods of Data Object. #27905
Conversation
Add support of magic mathods of Session Manager (which uses Data Object as a container). Increase PHPStan level to 1. Add tests to test DataObjectReflectionExtension.
Add new line.
Hi @swnsma. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
Fix static tests.
….com:swnsma/magento2-1 into PHPStan-support-of-Data-Object-magic-methods
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.
Hi @swnsma
Thank you for your contribution
Increasing the PHPStan level from 0 to 1 involves activation next additional rules and checks:
parameters:
checkMaybeUndefinedVariables: true
checkExtraArguments: true
reportMagicMethods: true
reportMagicProperties: true
conditionalTags:
PHPStan\Rules\Variables\VariableCertaintyNullCoalesceRule:
phpstan.rules.rule: %featureToggles.nullCoalesce%
rules:
- PHPStan\Rules\Classes\UnusedConstructorParametersRule
- PHPStan\Rules\Constants\ConstantRule
- PHPStan\Rules\Functions\UnusedClosureUsesRule
- PHPStan\Rules\Variables\VariableCertaintyInIssetRule
services:
-
class: PHPStan\Rules\Variables\VariableCertaintyNullCoalesceRule
Can you run PHPStan check using level 1 on CE/EE/B2B Magento codebase and compare results with level 0 (create a diff) ?
Please, make sure that all reported errors can be fixed when Magento developers will face them in their PRs. Or, possibly, some files should be added in blacklist at once.
Also, please check if new PHPStan checks intersect with PHPMD and PHPCS checks. We should avoid double suppression (like unused method argument etc.).
Hi, @viktym! Please find the diff: https://www.diffchecker.com/rHxwkJVM
From all these violations, I see problems with constants (most of the problems are related to tests).
What do you think about this? |
@swnsma great job! |
Hi @swnsma Also, I recommend to ignore constants from 4 using pattern: Number 5 you can add in blacklist:
Please proceed with implementation of these recommendations and fix the failed Integrity test as well:
|
Expand blacklist, add exceptions, fix integrity tests.
Hi @viktym! |
Hi @swnsma |
...tests/static/framework/Magento/PhpStan/Reflection/Php/DataObjectClassReflectionExtension.php
Outdated
Show resolved
Hide resolved
Get rid of magic numbers.
….com:swnsma/magento2-1 into PHPStan-support-of-Data-Object-magic-methods
@magento run all tests |
@magento run all tests |
@magento run all tests |
@magento run all tests |
HI @swnsma, could you please look through a failed static tests? |
Fixed. BTW. |
@magento run all tests |
@magento run all tests |
Hi @swnsma, thank you for your contribution! |
Q:
Resolved issues: