Skip to content

Add StructArmed to QA#398

Open
samsonasik wants to merge 7 commits into
cakephp:5.xfrom
samsonasik:add-structarmed-to-qa
Open

Add StructArmed to QA#398
samsonasik wants to merge 7 commits into
cakephp:5.xfrom
samsonasik:add-structarmed-to-qa

Conversation

@samsonasik
Copy link
Copy Markdown
Contributor

This PR adds StructArmed to QA

https://github.com/boundwize/structarmed

For starter, use PSR4 preset, and already catch some PSR4 violations and already included in this PR.

@samsonasik
Copy link
Copy Markdown
Contributor Author

@LordSimal ready to merge 👍

@LordSimal
Copy link
Copy Markdown
Contributor

@samsonasik thanks for introducing this new tool, i wasn't aware this existed at all.

Couldn't we adjust that 1 test file so we don't have to skip?

@samsonasik
Copy link
Copy Markdown
Contributor Author

@LordSimal yes 👍 , I've:

  • moved no-namespace/cake stub namespace to stubs directory and register to composer.json classmap
  • clean up skip config in structarmed.php

Ready for merge 👍

@LordSimal
Copy link
Copy Markdown
Contributor

As far as I can understand - your package makes sure, that all the classes are actually following the defined PSR naming conventions for autoloading, right?

This is usually reported by composer anyway as far as I know when doing composer install but I guess not for all files/namespaces. Or am I wrong?

@samsonasik
Copy link
Copy Markdown
Contributor Author

samsonasik commented May 24, 2026

StructArmed is not only about PSR autoloading or naming conventions. That is just one possible preset/rule set.

Also, afaik, composer usually only gives a warning for PSR-4 mismatch; it does not enforce it as a project rule.

The bigger purpose of StructArmed is architecture and structure enforcement. It can detect when a class, namespace, or layer uses something it should not use from another namespace or layer.

For example, you can define that one layer must not access another layer, and make that fail in CI when violated.

You can take a look at this more complex real-world example from CodeIgniter 4:

https://github.com/codeigniter4/CodeIgniter4/blob/develop/structarmed.php

It shows practical usage in a GitHub workflow, where StructArmed helps detect layer-boundary violations, not just PSR-4 naming issues.

This PR is for starter, you can configure more to enforce more on architecture of code ;)

@LordSimal
Copy link
Copy Markdown
Contributor

LordSimal commented May 24, 2026

Thanks for the explenation! Will have to talk with the rest of the core team about this, as its a fairly new/fresh package + how we truly want to utilize its features (especially if we can use it for our other packages as well)

Will keep this open for now till this has been discussed.

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