-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
This issue is automatically created based on existing pull request: #35807: Removed a fixed version phpcs dependency from the project
Description (*)
This Pull Request removes a PHP Code Sniffer fixed version dependency from the project's main composer.json file.
The reason for that is for purposes of maintaining a Magento 2 project's code quality, phpcs alone is almost useless. M2 has its own phpcs coding standard, which should be used, and which (obviously) also lists phpcs among its dependencies. The coding standard is also included in the project's main composer.json file so can be considered an integral part of the platform. The coding standard is also the only part of the platform that developers working on Magento projects will use phpcs with.
We should also assume that if any Magento 2 project should use a different coding standard, that coding standard will also list phpcs among its dependencies.
Therefore, the conclusion is that Magento2 itself should NOT manage PHP Code Sniffer's version. It should only be managed by the installed coding standard.
At the point of writing this text, if you remove phpcs from composer.json manually and you run the following command:
composer require magento/magento-coding-standard --dev --ignore-platform-reqs --with-dependencies
The output will contain this:
- Upgrading squizlabs/php_codesniffer (3.6.2 => 3.7.1)
This means that - for no reason - the main composer.json file prohibits the coding standard from using the latest phpcs version with which it was already marked as compatible.
Additionally, keeping that version there limits the extensibility. For example, if you choose to use the MRM Coding Standard (which also requires and uses the Magento Coding Standard), you need to manually remove the phpcs from the main composer.json before you run the following command:
composer require mrm-commerce/magento-coding-standard-phpcs:3.0.0-RC1 --dev --ignore-platform-reqs --with-dependencies
That's because it requires phpcs version to be at least 3.7.1, which is compatible with Magento Coding Standard, but not with the version required by the main composer.json.
So again, there is no reason for limiting 3rd party coding standards from being used when they're 100% compatible with the Magento Coding Standard.
Manual testing scenarios (*)
- Remove "squizlabs/php_codesniffer" from the "require-dev" part of composer json manually
- Run
composer require magento/magento-coding-standard --dev --ignore-platform-reqs --with-dependencies
- Access composer.lock
- Notice that squizlabs/php_codesniffer is there, and even in a newer version
Contribution checklist (*)
- Pull request has a meaningful description of its purpose
- All commits are accompanied by meaningful commit messages
- All new or changed code is covered with unit/integration tests (if applicable)
- README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
- All automated tests passed successfully (all builds are green)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status