Skip to content

feat(rules): report classes outside the layers - #49

Merged
danielebarbaro merged 1 commit into
mainfrom
feat/no-classes-outside-layers
Nov 16, 2026
Merged

danielebarbaro merged 1 commit into
mainfrom
feat/no-classes-outside-layers

Conversation

@danielebarbaro

@danielebarbaro danielebarbaro commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

The phparkitect rules only look inside the three layer folders. Anything left in app/Http, app/Models, app/Actions or app/Filament is never checked, so phparkitect check passes even on an app that is only half migrated.

This adds an opt in rule, validation.rules.no_classes_outside_layers. When it's on, every class under App has to live in one of the layers. A few namespaces can stay outside through validation.outside_layers_allowed, which defaults to ['Providers'] because that's where Laravel keeps service providers.

A few details:

  • With the rule on, the generated file scans app/ once instead of each layer, so nothing is checked twice. With it off, the output is unchanged.
  • clean-arch:make-arch-rules refuses to write the file if the layers don't share a top level folder, or if the allow list has an invalid entry.
  • Config stub, README, Boost docs, CHANGELOG and tests are updated. The tests run a real phparkitect check on a small fixture.

Nothing changes unless you turn the rule on. Minor release.

@danielebarbaro
danielebarbaro force-pushed the feat/no-classes-outside-layers branch from 768e2cf to d0f8999 Compare November 16, 2026 13:09
@danielebarbaro
danielebarbaro merged commit d0f8999 into main Nov 16, 2026
8 checks passed
@danielebarbaro
danielebarbaro deleted the feat/no-classes-outside-layers branch November 16, 2026 13:17
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