Repository navigation
Clear the non-BC Mago findings in Container, Adapter and ResultSet - #253
Open
simon-mundy wants to merge 2 commits into
Open
simon-mundy wants to merge 2 commits into
simon-mundy wants to merge 2 commits into
Conversation
Give the config arrays and factory options precise docblock types, document the container exceptions each factory can raise, drop the redundant @var casts on built services, replace isset/empty in canCreate() with an equivalent is_array check, and mark the unused delegator $options parameter as expected. AdapterInterfaceFactory now throws ContainerException::forMissingDriver() when the adapter configuration has no driver, matching the abstract factory, instead of passing null to ServiceManager::build() and failing with a TypeError. Remove the baseline entries these changes clear.
Mark the rows read for field counting as mixed, drop the @var object casts the analyzer already infers in toArray(), and have RowPrototypeResultSet::toArray() iterate through current(), whose nullable return type makes the null-row passthrough explicit rather than a redundant instanceof check. Document the exceptions that iteration can raise. Remove the baseline entries these changes clear.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Problem
About 55 Mago findings in
src/Container,src/ConfigProvider.php,src/Adapterandsrc/ResultSetsit in the baselines. They cover:@throws;isset()/empty()use.Fix
__set_state()'s state and theConfigProviderarrays.@throwsfor the container exceptions each factory andcanCreate()can raise.@vardocblocks are removed from built services and result-set rows. One of them was wrong (ResultSetInterface|null).canCreate()uses an equivalentis_array()/[] !==check instead ofisset()/empty().RowPrototypeResultSet::toArray()iterates through its nullablecurrent(). The analyzer flagged the oldinstanceofcheck as redundant, but null rows really do occur, so the null-row passthrough is now typed instead.AdapterInterfaceFactoryreports a missingdriverwithContainerException::forMissingDriver(), as the abstract factory already does, instead of aTypeErrorfromServiceManager::build().What stays the same
@apiclasses and interfaces;AbstractPdo::getResultPrototype()'s nullability.Verification
mago format --check,lint,analyzeandguardexit 0 on PHP 8.3, 8.4 and 8.5.srcline is covered.canCreate()rejects;toArray().