Drop a null coalesce phpstan proved unreachable - #183
Merged
Conversation
Unrelated to this branch's feature work, but it fails static analysis on every pull request so it blocks this one. get_plugin_data() fills every header key, defaulting to an empty string, so the Version index is always set. Newer WordPress stubs describe that, which makes the coalesce dead code. Behaviour is unchanged; the guard on is_installed() above still covers the null return the docblock promises. The underlying cause is that composer.lock is untracked and the analysis workflow resolves dependency-versions: highest, so any stub release can surface a latent finding like this on an unrelated pull request. Claude-Session: https://claude.ai/code/session_019G9uUzMJSWzoFatSxvzGoW
d4mation
previously approved these changes
Jul 27, 2026
d4mation
left a comment
Collaborator
There was a problem hiding this comment.
This particular PR I think could be merged directly to main now that #180 is out :)
Any upcoming release(s) would include this change and get QA'd accordingly.
The issue we had before with #181 merging to main was because it was a larger change and could conflict with #180. But this change, now that the already QA'd #180 release is merged, won't impact anything going to main.
d4mation
approved these changes
Jul 27, 2026
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.
Pulled out of #181 at @d4mation's request — it is unrelated to that feature and was only in there to get CI green.
What
Features/Types/Plugin.phpreturned$plugin_data['Version'] ?? null.get_plugin_data()fills every header key, defaulting to an empty string, so theVersionindex is always set and the coalesce never applied. Newer WordPress stubs describe that, so phpstan now reports it as unreachable.Behaviour is unchanged. The
is_installed()guard above still covers thenullreturn the docblock promises.Why it started failing now
composer.lockis untracked and.github/workflows/static-analysis.ymlresolvesdependency-versions: highest, with loose constraints (phpstan/phpstan: ^2,szepeviktor/phpstan-wordpress: >=1.0). Every run therefore picks up the newest matching releases, and a stub release surfaced this latent finding on pull requests that never touched the file.This is not specific to any one branch — it fails on any PR until fixed, which is why @d4mation hit it while preparing #180 too.
Worth a separate ticket for the underlying cause: while dependencies float like this, an upstream release can redden an unrelated PR at any time. Tracking the lock, or pinning the analysis dependencies, would stop it.
Base
Targeting
bucket/activation-flow-apirather thanmain, since release/1.5.1 (#180) is mid-merge.