Skip to content

Add PHPStan static analysis#34

Merged
GaryJones merged 3 commits into
mainfrom
GaryJones/phpstan
Jun 11, 2026
Merged

Add PHPStan static analysis#34
GaryJones merged 3 commits into
mainfrom
GaryJones/phpstan

Conversation

@GaryJones

@GaryJones GaryJones commented Jun 11, 2026

Copy link
Copy Markdown
Owner

The boilerplate has lacked static analysis since an earlier Psalm setup was removed (a stray psalm.xml export-ignore is all that remains). This adds PHPStan with the WordPress extension, auto-registered through phpstan/extension-installer, plus a composer phpstan script. Analysis runs at level 8 with no baseline and no ignores. Level 9 would add checkExplicitMixed, which rejects the untyped boundary of config-driven code — the BrightNucleus Config accessors return mixed by design — so 8 is the honest ceiling, with the reasoning recorded in the config. The views/ and config/ templates are excluded as they rely on variables injected into their scope at runtime. The change is cleanly declinable. This PR is stacked on #40 (both touch adjacent composer.json lines, so the conflict is resolved here in a merge commit); it retargets to main automatically once #40 merges.

The boilerplate showcases plugin tooling best practice but has had no
static analysis since an earlier Psalm setup was removed, leaving only
a stray export-ignore behind. Add PHPStan with the WordPress extension
(auto-registered via phpstan/extension-installer) and a composer
"phpstan" script.

Analysis covers src/ and the main plugin file at the highest level,
passing with no baseline and no ignores. The views/ and config/
templates are excluded because they depend on variables injected into
their scope at runtime, which PHPStan cannot see.
Level 9's checkExplicitMixed rejects the untyped boundary of
config-driven code: the BrightNucleus Config accessors return mixed by
design, so the settings registration landing in the plugin-correctness
branch would fail at max. Level 8 keeps every other strictness and the
reasoning is recorded in the config for future revisiting.
@GaryJones GaryJones changed the title Add PHPStan static analysis at level max Add PHPStan static analysis Jun 11, 2026
…GaryJones/phpstan

# Conflicts:
#	composer.json
@GaryJones GaryJones changed the base branch from main to GaryJones/testing-refresh June 11, 2026 11:42
Base automatically changed from GaryJones/testing-refresh to main June 11, 2026 18:11
@GaryJones GaryJones merged commit cb38a0a into main Jun 11, 2026
3 checks passed
@GaryJones GaryJones deleted the GaryJones/phpstan branch June 11, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant