-
Notifications
You must be signed in to change notification settings - Fork 154
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
AC-1895: Avoid having duplicated issues in magento-coding-standard #362
AC-1895: Avoid having duplicated issues in magento-coding-standard #362
Conversation
@@ -16,11 +16,6 @@ | |||
<exclude-pattern>*\.phtml$</exclude-pattern> | |||
<exclude-pattern>*\.xml$</exclude-pattern> | |||
</rule> | |||
<rule ref="Generic.PHP.DeprecatedFunctions"> |
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.
This only catches deprecations and, due to it using get_defined_functions()
to get deprecated methods, its coverage is not as good as the solution from PHPCompatibility because it doesn't include functions coming from extensions or deprecations from different PHP versions than the one which is running the sniff.
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.
@svera can you please add information describing which sniff was excluded/removed in favour to which sniff, what are the difference between them and pros/cons. This should help to understand this decision better. Thank you!
@sivaschenko adressed in PR description |
Grouped excluded |
@magento import pr to magento-commerce/magento-coding-standard |
@sivaschenko the Pull Request is successfully imported. |
@sivaschenko any idea while I still got
On my IDE |
@tuyennn I'm also having this issue. Did you manage to resolve this? |
@tuyennn @rafafortes I believe you need to register PHPCompatibility standard: For example from magento project root That is handled for Magento by |
@sivaschenko it resolved the issue through the CLI but PHPStorm still complains about it, that's odd. |
I'm running into the same issue @rafafortes. <?php
$phpCodeSnifferConfig = array (
'installed_paths' => '../../magento/magento-coding-standard,../../phpcompatibility/php-compatibility',
)
?> I've checked that PHPStorm is indeed running the sniff from the Magento base directory as the current working directory (just like when running it from the command line). Do you have any other ideas what might be causing the difference between running EDIT: I opened a new issue about this: #390 |
@Vinai I've tried things like adding more installed_paths and different phpcs binaries (from OS, Docker containers) and none of this resolved the issue so far. The PHPStorm debug messages don't help also so I'm running out of ideas |
@rafafortes here how I resolved the annoying PHPStorm errors with new magento codding standard. 1 . From project I remove the current require-dev magento codding standard. We aim to use the external magento codding standard outside project because the one from vendor was always deprecated, since we cannot keep the one from vendor run along with external up-to-date magento codding standard source
For example
|
@rafafortes To debug I've added a |
Thanks for the tip, @Vinai. I'm able to debug it when running phpcs from CLI only. Did you manage to trigger the debug when inspecting code from PHPStorm UI? |
I don't remember. Will have to check again. Using a PHP interpreter config with XDEBUG and starting the debug listener in PHPStorm should work, but I am not sure. |
Thank you @Vinai . The old and good var_dump helped me out! I realized the $resolvedInstalledPaths array was missing the path: '/opt/project/vendor/phpcompatibility/php-compatibility/PHPCompatibility'; As a quick fix I ended up adding the missing path manually to the array as follows: // vendor/squizlabs/php_codesniffer/src/Util/Standards.php |
There are a couple of sniffs duplicated between PHPCS and PHP Compatibility. I've picked the ones with better coverage after doing some tests.
get_defined_functions()
to get deprecated methods, it doesn't include functions coming from extensions or deprecations from different PHP versions than the one which is running the sniff.