Skip to content

Require Delayed for conditions that read the admin screen - #166

Merged
schlessera merged 2 commits into
mainfrom
fix/161-screen-delay
Oct 23, 2026
Merged

schlessera merged 2 commits into
mainfrom
fix/161-screen-delay

Conversation

@schlessera

Copy link
Copy Markdown
Member

Closes #161

What changed

architecture.queryContextNeedsDelay now also reports a Conditional whose is_needed() directly calls a configured screen function, get_current_screen by default, without implementing Delayed. The new queryContextNeedsDelay.screenFunctions list is set in phpstan.neon.dist, validated in tests/php/PHPStan/rules.neon, and an empty list turns the screen check off. Screen calls get their own message naming current_screen, since wp does not fire in admin requests. Query function messages are unchanged. The docs and the "I need a service only in some requests" pattern cover the screen case.

Why this shape

A second list on the same rule keeps one identifier and one Delayed check, and only the message differs. A separate rule would duplicate the scope checks for no gain.

Proof

The new test (test_screen_conditions_require_delayed) was written first and failed before the change: no diagnostic was reported for the get_current_screen() fixture. After the change it passes, together with the delayed fixture, the empty-list case and the unchanged query cases.

composer test   # OK (575 tests, 3384 assertions), PHP 8.3
composer lint   # phpcs, phpstan, psalm clean; rule tests OK (132 tests)

Checklist

  • composer test and composer lint pass locally, and CI is green on the current head.
  • Every acceptance criterion from the issue is met, or the gap is named below.
  • Nothing a generated plugin relies on changed, or the issue carries breaking and a ruling.
  • Docs and inline comments reflect the change, or nothing documented moved.

Anything left open

Nothing.

@schlessera schlessera added type: fix Something is broken and must behave the way it is documented. area: tooling composer.json, PHPCS, PHPStan, Psalm and Rector configuration. labels Oct 23, 2026
@schlessera
schlessera force-pushed the fix/161-screen-delay branch from dd781b3 to 1e4cd95 Compare October 23, 2026 19:36
@schlessera
schlessera merged commit 0e56aa5 into main Oct 23, 2026
5 checks passed
schlessera added a commit to mwpd/content-freshness that referenced this pull request Oct 23, 2026
Ported from mwpd/basic-scaffold@0e56aa5 (mwpd/basic-scaffold#166).

The post age column already waits for current_screen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tooling composer.json, PHPCS, PHPStan, Psalm and Rector configuration. type: fix Something is broken and must behave the way it is documented.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tooling: queryContextNeedsDelay misses conditions on the admin screen

1 participant