Skip to content

Enforce imported class references in the CakePHP preset - #2

Merged
ADmad merged 1 commit into
mainfrom
fix/enforce-class-imports
Oct 3, 2026
Merged

ADmad merged 1 commit into
mainfrom
fix/enforce-class-imports

Conversation

@josbeir

@josbeir josbeir commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

The CakePHP preset currently accepts fully qualified class references because Mago's no-fully-qualified-global-class-like rule is disabled by default. Enable the native rule at error severity so consumers using extends must use class imports, consistent with CakePHP's previous SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly checks.

The installed-consumer regression verifies rejection through the default preset, exact automatic imports for namespaced and global classes, unchanged PHPDoc, and idempotent fixes. The README documents enforcement and the native fix command. No custom extension rule is added.

Validation:

  • composer run cs-check
  • composer test — 12 tests, 20 assertions
  • composer run validate-extension
  • composer run lint-corpus
  • composer run test-fixes
  • composer run test-formatter
  • composer run test-consumer
  • scripts/check-cakephp-6.sh --workspace /home/josbeir/Sites/cakephp
  • git diff --check

@ADmad
ADmad merged commit 66e7cda into main Oct 3, 2026
6 checks passed
@josbeir
josbeir deleted the fix/enforce-class-imports branch October 6, 2026 06:01
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.

2 participants