Skip to content

Fix most errors from PHPCS and PHPStan#466

Open
chuckadams wants to merge 18 commits intodevelopmentfrom
lint_fixes
Open

Fix most errors from PHPCS and PHPStan#466
chuckadams wants to merge 18 commits intodevelopmentfrom
lint_fixes

Conversation

@chuckadams
Copy link
Copy Markdown
Contributor

Not all issues are fixed yet, but I've left warnings enabled and the baseline disabled so they can keep failing in CI til we fix them here. The FIXME comment in inc/packages/admin/namespace.php suggests there's probably a genuine bug in that code path.

johnbillion and others added 12 commits February 12, 2026 14:08
Signed-off-by: John Blackbourn <john@johnblackbourn.com>
Signed-off-by: Andy Fragen <andy@thefragens.com>
Signed-off-by: Carrie Dils <carriedils@gmail.com>
Signed-off-by: Norcross <andrew.norcross@gmail.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: joedolson <joedolson@users.noreply.github.com>
Signed-off-by: Joe Dolson <design@joedolson.com>
Signed-off-by: Shadi Sharaf <shady@sharaf.me>
Co-authored-by: Chuck Adams <chaz@chaz.works>
Co-authored-by: Andy Fragen <andy@thefragens.com>
Co-authored-by: Norcross <andrew.norcross@gmail.com>
Co-authored-by: Carrie Dils <cdils@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: rmccue <21655+rmccue@users.noreply.github.com>
Co-authored-by: cdils <3099408+cdils@users.noreply.github.com>
Co-authored-by: joedolson <joedolson@users.noreply.github.com>
Co-authored-by: Joe Dolson <design@joedolson.com>
Co-authored-by: Shady Sharaf <shady@sharaf.me>
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Mika Ipstenu Epstein <ipstenu@halfelf.org>
Signed-off-by: Ipstenu (Mika Epstein) <Ipstenu@users.noreply.github.com>
Signed-off-by: Mika <ipstenu@halfelf.org>
Signed-off-by: Mika Ipstenu Epstein <ipstenu@halfelf.org>
Signed-off-by: Mika Epstein <ipstenu@halfelf.org>
Signed-off-by: Andy Fragen <andy@thefragens.com>
Signed-off-by: Marc Armengou <83702259+marcarmengou@users.noreply.github.com>
Co-authored-by: Carrie Dils <cdils@users.noreply.github.com>
Co-authored-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
@chuckadams chuckadams requested review from afragen and costdev April 6, 2026 20:09
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 6, 2026

@chuckadams chuckadams added the help wanted Extra attention is needed label Apr 6, 2026
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
Comment thread inc/icons/svg.php
return $color;
}

return null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understand this? Why return null? Why not just return '' as in line 20?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm just replicating the behavior of the WP function which falls off the end, thus implicitly returning null. phpstan is just forcing us to be explicit about that. Frankly I'm not sure why it's not just using the WP function, but it's only used in one place anyway, so 🤷

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not just return an empty string if it falls off instead of null?

return $result;
}

// FIXME: Updater\Updater has neither a constructor nor a run() method.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well, they both existed in 1.3.0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

FAIR\Updater\Updater has nothing but static functions, so maybe it's just using the wrong class? Fair\Updater\Package does take a $did argument (but also requires a second arg of $filepath). I'm not familiar enough with this part of the code to know what's right, though my IDE does mark the surrounding function as unused...

Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
Signed-off-by: Chuck Adams <chaz@chaz.works>
@chuckadams
Copy link
Copy Markdown
Contributor Author

I've now fixed or suppressed the remaining warnings and errors, except for the one phpstan error that's a legit bug, and that needs someone who knows the code better.

@chuckadams chuckadams requested a review from afragen April 7, 2026 15:58
@cdils cdils added this to the Plugin Adjacent milestone Apr 9, 2026
Base automatically changed from release_1.4.0 to development April 13, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants