Skip to content

fix(config): point the phpcs registration at BSUPhpLint - #15

Merged
kodyhagen-gh merged 1 commit into
releasefrom
fix/point-at-BSUPhpLint
Aug 20, 2026
Merged

kodyhagen-gh merged 1 commit into
releasefrom
fix/point-at-BSUPhpLint

Conversation

@kodyhagen-gh

Copy link
Copy Markdown
Contributor

The BSU phpcs standard was renamed again, from @bsu/bsu-phplint to @bsu/BSUPhpLint, so the directory this package registers by relative path changed with it.

The earlier name could not work. PHPCS builds the key for every per-sniff setting from the sniff's file PATH, but reports at runtime under the autoload NAMESPACE. A hyphen is illegal in a PHP namespace, so bsu-phplint forced an explicit namespace attribute — and that made the two names disagree, which silently disabled exclude-pattern, severity, properties and message throughout the ruleset. BSUPhpLint is a legal namespace on its own, so no attribute is needed and both halves agree again.

  • bin/register-bsu-phplint.php becomes bin/register-BSUPhpLint.php, with $bsu_path now '../../../../BSUPhpLint'.
  • composer.json invokes it by filename from both post-install-cmd and post-update-cmd, so both were updated.
  • vendor/squizlabs/php_codesniffer/CodeSniffer.conf was regenerated by running composer install, not hand-edited. The dealerdirect plugin rewrites that file on every install and registers only composer-installed standards, so a hand edit would survive until the next composer update and then silently revert.

Typed as a fix rather than a feat, so this stays a patch. It corrects a same-day defect rather than adding anything.

Verification

--config-show is not a valid check: PHPCS drops an unresolvable installed_paths entry silently and still prints it. Verified by running the chain instead:

  • composer install — exit 0, hook reported Registered BSUPhpLint in phpcs installed_paths.
  • phpcs -i — lists BSUPhpLint
  • A live sniff run emits BSUPhpLint.Functions.GetTemplateDirectory.GetTemplateDirectory
  • The per-sniff exclusions work again. An identical file reports 2 colour/inline-style warnings outside tests/ and 0 inside it, which is the behaviour the previous name had silently broken.

Consumer note

The BSUPhpLint pin and this package's pin must move in the same commit. Taking one without the other leaves a dangling installed_paths entry — dropped without warning, surfacing later as a confusing "coding standard is not installed".

@kodyhagen-gh
kodyhagen-gh merged commit bfd2e6c into release Aug 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant