Skip to content

fix(stubs): generate code that passes phpstan and pint - #52

Merged
danielebarbaro merged 9 commits into
mainfrom
fix/generated-code-quality
Nov 16, 2026
Merged

danielebarbaro merged 9 commits into
mainfrom
fix/generated-code-quality

Conversation

@danielebarbaro

@danielebarbaro danielebarbaro commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #51, merge that first.

I ran the package on a Laravel 13 app with PHPStan level 7 (Larastan) and Pint, and the generated code needed manual fixes before it could be committed. This PR fixes that.

PHPStan. The classes written by clean-arch:install had 19 errors at level 7. The stubs now have proper array shapes, generics, return and parameter types. The other generators got the same cleanup.

Pint. Generated files had trailing spaces, missing final newlines, missing trailing commas and unsorted or unused imports. The stubs are fixed and the generators now sort imports the way Pint does. phparkitect.php is also Pint clean now, so regenerating it with --force no longer dirties the diff.

Smaller fixes:

  • CLEAN_ARCHITECTURE.md is now formatted the way Prettier expects.
  • clean-arch:install pointed to a README.md it never writes and suggested a plural domain name (Users). It now mentions CLEAN_ARCHITECTURE.md and suggests Product.
  • clean-arch:make-arch-rules only tells you to install phparkitect when it's actually missing.

Docs. README and Boost skill now explain:

  • where domain exceptions go (an Exceptions folder next to the model, extending DomainException)
  • that boost:update only offers new packages in an interactive terminal, so in CI you add the package to boost.json by hand
  • when not to use a generator: if the class isn't part of a CRUD on a model, just use php artisan make:class

New tests run the real Pint and PHPStan level 7 on everything the generators produce.

Generated files change in types, docblocks, import order and whitespace, but no public class or method is removed. Patch release.

One thing left out on purpose: the three exceptions install puts in Infrastructure/Exceptions can't be thrown from an action without breaking the layer rules. Moving them would affect existing projects, so for now the skill just says not to throw them from actions or models.

@danielebarbaro
danielebarbaro force-pushed the docs/boost-class-placement branch from e9ef55b to 3441652 Compare November 16, 2026 13:09
@danielebarbaro
danielebarbaro force-pushed the fix/generated-code-quality branch from 8f8e1bf to 6951c39 Compare November 16, 2026 13:09
Base automatically changed from docs/boost-class-placement to main November 16, 2026 13:19
@danielebarbaro
danielebarbaro merged commit 6951c39 into main Nov 16, 2026
8 of 16 checks passed
@danielebarbaro
danielebarbaro deleted the fix/generated-code-quality branch November 16, 2026 13:23
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