Fix silently-swallowed CI failures + resolve pre-existing PHPStan errors - #4
Merged
miguelcolmenares merged 2 commits intoAug 17, 2026
Merged
Conversation
- SettingsPage::render_settings_page(): remove dead truthy-check —
wp_count_posts() always returns an object per its own stub, never
false, so the guard could never be false.
- CptRegistrar::register_graphql_meta_fields(): add the missing
function_exists('register_graphql_field') guard (only
register_graphql_object_type was checked, even though both are
called) — WPGraphQL always registers both together, so this was
never a runtime risk, but PHPStan can't know that without its own
explicit check.
- Same method: refactor the PHP-type -> GraphQL-scalar mapping from an
array + `??` fallback to a match expression. The array fallback was
provably unreachable (every current META_FIELDS value is a mapped
key) but still had real defensive value for a future entry using an
unmapped type — a match's default arm preserves that behavior
without PHPStan being able to prove it dead, so no ignore comment is
needed either way.
Verified: 0 PHPCS and 0 PHPStan errors in community-listings; the
other two sub-plugins already reported 0.
- install/install-dev/build targets had the same for-loop-swallows- failure bug just fixed in phpcs/phpstan (found by a pre-PR review pass) — same fix applied. - phpcs target now calls vendor/bin/phpcs --warning-severity=0 directly instead of composer run phpcs. The two behaved differently: composer's bare `phpcs` script has no --warning-severity flag, so once exit codes were no longer swallowed, make phpcs started failing on pre-existing warnings (discouraged json_encode()/file_get_contents() calls, a missing nonce-verification annotation) that CI's own PHPCS step is explicitly configured to ignore. Local and CI now agree. Verified: make test (install-dev + phpcs + phpstan) and make build both exit 0 across all three sub-plugins.
miguelcolmenares
deleted the
fix/phpstan-errors-and-makefile-enforcement
branch
August 17, 2026 07:43
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related fixes found while investigating why 3 real PHPStan errors in
community-listingsnever failed CI:The 3 PHPStan errors themselves, resolved via real refactors (no
@phpstan-ignoresuppressions):SettingsPage::render_settings_page(): removed a dead-code truthy check —wp_count_posts()always returns an object per its own stub, neverfalse.CptRegistrar::register_graphql_meta_fields(): added the missingfunction_exists('register_graphql_field')guard (onlyregister_graphql_object_typewas checked, even though both are called — WPGraphQL always registers both together in practice, so this was never a runtime risk, but PHPStan can't know that without its own explicit check).array+??fallback to amatchexpression. The array fallback was provably unreachable (every currentMETA_FIELDSvalue is a mapped key) but had real defensive value for a future entry using an unmapped type — amatchdefault arm preserves that behavior without PHPStan being able to prove it dead.The Makefile bug that hid them.
phpcs/phpstan/install/install-dev/buildall loopedfor plugin in $(PLUGINS)without checking each iteration's exit status — only the last plugin's result reached Make. Sincegraphql-shortcode-support(last in$(PLUGINS)) always passed,community-listings' real PHPStan failures were silently swallowed. Confirmed via a CI log from before this fix: the PHPStan step printedFound 3 errorsandreturned with error code 1forcommunity-listings, then kept going and the job still reported success. Same root-cause class as therun-quality-checks.sherrexit bug found during the wp-coding-standards portfolio rollout.While fixing this, also found
make phpcs(viacomposer run phpcs) disagreed with CI's own PHPCS step (which passes--warning-severity=0) — once exit codes stopped being swallowed,make phpcsstarted failing on pre-existing warnings CI is configured to ignore.make phpcsnow callsvendor/bin/phpcs --warning-severity=0directly, matching CI exactly.Verified
make test(install-dev + phpcs + phpstan) andmake buildboth exit 0 across all three sub-pluginscommunity-listings)core-reviewpass (read-only subagent) confirmed no dangling references to the removed$type_mapvariable, semantic equivalence of thematchrefactor against everyMETA_FIELDSvalue, and valid Make/shell semantics for the exit-status propagation — it's what caughtinstall/install-dev/buildsharing the same bug, since my first pass only touchedphpcs/phpstanCHANGELOG
Also backfills
[Unreleased]entries for #2 (Provider Listings meta box) and #3 (coding-standards adoption), which hadn't been documented yet, alongside this fix.