Closed (fixed)
Project:
Coder
Version:
8.x-3.x-dev
Component:
Coder Sniffer
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
29 Oct 2018 at 15:28 UTC
Updated:
23 Feb 2022 at 11:54 UTC
Jump to comment: Most recent
Comments
Comment #2
damienmckennaComment #3
liam morlandComment #4
pfrenssenThis already exists in https://github.com/slevomat/coding-standard/#slevomatcodingstandardcontr...
Comment #5
alexpottComment #6
alexpottAdded link to PR to issue summary - https://github.com/pfrenssen/coder/pull/147
Comment #7
klausiChecked the pull request and left a comment there, I think we should do more than just adding the dependency.
Comment #9
klausiCommitted, thanks! This bumps Coder's PHP minimum version to 7.1, but I think that is fine (PHP 7.0 has been end of life for 3 years now). Users with older PHP versions can still use the previous Coder version.
Please open new issues to enable and configure more sniffs for the selvomat coding standard. Please also add minimal test cases to bad.php so that we know the inclusion actually works.
Comment #10
m.stentaWe use PHP Codesniffer + Coder in our automated testing workflow to check coding standards, and today
phpcshas started failing with:Referenced sniff "SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" does not existI found this issue while trying to investigate... is it related? Has anyone else encountered this?
Comment #11
jeqq commentedFacing the same issue:
ERROR: Referenced sniff "SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" does not existComment #12
jribeiro commentedThe same error as #10 and #11
Comment #13
aron novakExperimenting with
No luck so far.
Comment #14
arkener commentedThis issue occurs when the Coder standards are loaded, but the Slevomat standard isn't. We're currently using
dealerdirect/phpcodesniffer-composer-installerto automatically set theinstalled_pathson Composer install. When using Composer 2.2 or higher, Composer will ask for your permission to allow this plugin to execute code. For this plugin to be functional, permission needs to be granted. Which will result in the following config in thecomposer.jsonThis issue will also occur when
phpcs --config-set installed_pathsis executed after the composer install without including the Slevomat standard, as it will overwrite the automatically set installed_paths.The workaround of #13 will also fix this issue, but make sure to use absolute paths, as
~will only work on the first standard. So taking the previous example, use:Comment #15
aczietlow commentedJust confirming that #13 and #14 worked to resolve the issue identified in #10
ERROR: Referenced sniff "SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" does not exist1) Even though it's a dependency ensure that slevomat is installed
composer require slevomat/coding-standard:^7.02) Update the config sets loaded
phpcs --config-set installed_paths /var/www/vendor/drupal/coder/coder_sniffer,/var/www/vendor/slevomat/coding-standard3) code sniff & profit
phpcs --standard=Drupal --extensions='inc,php,module' --error-severity=1 --warning-severity=8 web/modules/custom -sComment #16
yas@aczietlow
Thank you for summarizing the points. It helped and worked for me resolving the same error. Thanks!
Comment #17
JeremyFrench commentedThe explanation here makes sense, but I wonder if it should have been classed as a breaking change and therefor a major update.
This issue was flagged for me when dependabot tried to do an upgrade of coder. I'm not sure if I would expect a minor upgrade to require a change to the build script.
It's too late now, but perhaps worth considering in future.
Comment #18
dpiI found removing an extra
<config name="installed_paths"in my phpcs.xml resolved the issue.dealerdirect/phpcodesniffer-composer-installerwas already included in the project, and added to theallow-pluginsentry.Comment #19
hitesh.koliAdding the correct `installed_paths ` from #15 worked for me.
Comment #20
marciaibanezComment #21
marciaibanez