Repository navigation
Fix the real phpstan findings, shrink the baseline - #327
Merged
Merged
Conversation
- DisplayController (admin and site): return what display() returns (also on the early return) and default $urlparams to [] like Joomla's BaseController, instead of false - HtblockController::cancel() returns true, as FormController::cancel() - HtblockModel::getItem() returns an object, as AdminModel::getItem() - Settings toolbar: no formId false for ToolbarHelper::custom() - DnsHelper::readName(): document $next as int|null - LoggerHelper: drop the never read property $maxBytes 13 entries of phpstan-baseline.neon go away; what is left are the imprecise types of Joomla's own API (getModel() returning bool|Model, CMSApplicationInterface without getUserState() etc., FormRule::test() documented as bool) and two defensive checks. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFJFMQAPCNVx27UwnZRmTY
entry() reads the clock, so the pruning tests that built the "new" entry again for the comparison failed whenever a second boundary fell between the two calls (seen in CI: ...:22 vs ...:23). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFJFMQAPCNVx27UwnZRmTY
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.
What
Went through the findings listed in
phpstan-baseline.neon(phpstan level 5 against Joomla 6.2.0), fixed the ones that point at real defects and removed their entries (66 → 53 findings, 50 entries).Fixed
DisplayController::display()(admin and site): returns what it should (also on the early return), and$urlparamsdefaults to[]like Joomla'sBaseController, notfalseHtblockController::cancel(): returnstrue, asFormController::cancel()HtblockModel::getItem(): returns an object, asAdminModel::getItem()(nothing reads the array)falseas$formIdofToolbarHelper::custom()DnsHelper::readName():$nextdocumented asint|null(3 findings)LoggerHelper: dropped the never read property$maxBytesLeft in the baseline (not relevant)
getModel()returningbool|BaseDatabaseModel(controllers and views),CMSApplicationInterfacewithoutgetUserState(),getDocument(),getClientId(),setHeader(),allowCache(),getMessageQueue($clear)getForm()returningfalseon failure (what Joomla's core models do, althoughFormModelInterfacedocumentsForm)FormRule::test()returning anUnexpectedValueException(Joomla's way to carry the message, documented asbool)QueryInterface::returning(): only called for PostgreSQLis_array()ofapache_request_headers(): a defensive checkTest plan
phpstan analysepasses with the new baselinephp -lof the changed filesGenerated by Claude Code