Skip to content

Api2: cleanup getNode#5607

Merged
sreichel merged 2 commits into
OpenMage:mainfrom
Hanmac:api2getNode
May 22, 2026
Merged

Api2: cleanup getNode#5607
sreichel merged 2 commits into
OpenMage:mainfrom
Hanmac:api2getNode

Conversation

@Hanmac
Copy link
Copy Markdown
Contributor

@Hanmac Hanmac commented May 22, 2026

Description (*)

Related Pull Requests

Fixed Issues (if relevant)

  • fixes OpenMage/magento-lts#<issue_number>

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

composer phpstan:baseline doesn't work for me, so i need to ask github again

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All automated tests passed successfully (all builds are green, SonarCloud checks are not required to merge)

@Hanmac Hanmac requested a review from sreichel May 22, 2026 13:12
@github-actions github-actions Bot added the Component: Api2 Relates to Mage_Api2 label May 22, 2026
@sreichel sreichel added the chore label May 22, 2026
@sonarqubecloud
Copy link
Copy Markdown

@Hanmac Hanmac marked this pull request as ready for review May 22, 2026 13:45
@sreichel sreichel merged commit baba932 into OpenMage:main May 22, 2026
21 checks passed
@sreichel sreichel requested a review from Copilot May 22, 2026 14:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refines API2 helper logic around reading XML config nodes (getNode()), aiming to make return types predictable and remove PHPStan baseline suppressions related to those paths.

Changes:

  • Tightened type handling in Mage_Api2_Helper_Data when reading auth adapter and user type configuration nodes, plus stricter in_array() usage.
  • Updated an ACL resource method docblock return type to be more precise (false instead of bool).
  • Removed multiple PHPStan baseline entries that should no longer be needed after the helper cleanup.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
app/code/core/Mage/Api2/Model/Resource/Acl/Filter/Attribute.php Narrows the documented return type of getAllowedAttributes() to match actual DB adapter behavior.
app/code/core/Mage/Api2/Helper/Data.php Adds stronger type checks around getNode()/asArray() results and strict comparisons in in_array().
.phpstan.dist.baselines/variable.undefined.php Removes an ignore that was masking $adapters undefined cases.
.phpstan.dist.baselines/return.type.php Removes an ignore for getAuthAdapters() return-type mismatch.
.phpstan.dist.baselines/method.nonObject.php Removes an ignore for calling getNode() on possibly-null config.
.phpstan.dist.baselines/if.condNotBoolean.php Removes an ignore related to non-boolean if conditions in the helper.
.phpstan.dist.baselines/function.strict.php Removes an ignore requiring strict in_array() usage.
.phpstan.dist.baselines/foreach.nonIterable.php Removes an ignore for iterating over a non-iterable return from config parsing.
.phpstan.dist.baselines/booleanNot.exprNotBoolean.php Removes an ignore for negating a non-boolean expression from config parsing.
.phpstan.dist.baselines/argument.type.php Removes ignores for invalid argument types reaching uasort() / other functions.

Comment on lines +56 to 60
$adapters = Mage::getConfig()?->getNode(self::XML_PATH_AUTH_ADAPTERS);

if (!$adapters) {
if (!$adapters instanceof Varien_Simplexml_Element) {
return [];
}
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.

@sreichel i'm pretty sure copilot is wrong there

Comment on lines +84 to +88
$types = Mage::getConfig()?->getNode(self::XML_PATH_USER_TYPES);

if (!$types instanceof Varien_Simplexml_Element) {
return [];
}
@Hanmac Hanmac deleted the api2getNode branch May 22, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants