Skip to content

Check the quality of generated PHP code - #1116

Open
josbeir wants to merge 5 commits into
feature/attribute-routingfrom
feature/generated-code-quality
Open

josbeir wants to merge 5 commits into
feature/attribute-routingfrom
feature/generated-code-quality

Conversation

@josbeir

@josbeir josbeir commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #1115.

What this adds

Checks freshly generated PHP as part of the existing PHPUnit suite.

Check What it catches
PHP lint Invalid PHP syntax in files registered by the generation tests
PHPCS CakePHP coding-standard violations in freshly baked code
Rector dry-run Generated code that needs changes under the project's Rector rules

The new integration tests bake common classes, complete CRUD stacks, and plugin skeletons, covering attribute routing, legacy routing, and prefixed controllers. Rector only reports required changes; it does not rewrite the generated files. Rector is added as a development dependency so these checks are available in normal test runs.

Template fixes

Fixes the issues these checks found: unused imports, missing type hints, and plugin skeleton formatting. Generated view(), edit(), and delete() actions require an int|string ID, supporting numeric IDs and strings such as UUIDs. Expected-output fixtures are updated accordingly.

Validation

  • PHPUnit: 409 tests, 2,249 assertions, no failures or errors (7 skipped, 4 incomplete).
  • PHPCS, Rector dry-run, PHPStan, and Composer validation pass.

@josbeir
josbeir added this pull request to stack #1117 October 18, 2026 08:01
Comment thread templates/bake/element/Controller/edit.twig Outdated
@markstory markstory added this to the 4.x (CakePHP 6) milestone Oct 18, 2026
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link https://cakephp.org CakePHP(tm) Project
* @since 0.1.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @since 0.1.0
* @since 4.0.0

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.

3 participants