Skip to content

Fix redundant array check in purchase event - #185

Open
Codencode wants to merge 2 commits into
PrestaShop:devfrom
Codencode:fix-phpstan-render-purchase-event
Open

Codencode wants to merge 2 commits into
PrestaShop:devfrom
Codencode:fix-phpstan-render-purchase-event

Conversation

@Codencode

Copy link
Copy Markdown
Member
Questions Answers
Description? This PR removes a redundant is_array() check in GoogleAnalyticsTools::renderPurchaseEvent().

$orderProducts is already declared as an array in the method PHPDoc, so PHPStan correctly reports:

Call to function is_array() with array will always evaluate to true.

The issue is reproducible directly on the current dev branch and is unrelated to any functional change.

Type? bug fix
BC breaks? no
Deprecations? no
Fixed ticket? F
Related to #170 (comment)
Sponsor company Codencode snc
How to test? Run the PHPStan checks and verify that the develop job passes without reporting: Call to function is_array() with array will always evaluate to true.

@Codencode Codencode added this to the 6.0.1 milestone Sep 6, 2026
@ps-jarvis

Copy link
Copy Markdown

Hello @Codencode!

This is your first pull request on ps_googleanalytics repository of the PrestaShop project.

Thank you, and welcome to this Open Source community!

@github-project-automation github-project-automation Bot moved this to Ready for review in PR Dashboard Sep 6, 2026
@Codencode Codencode mentioned this pull request Sep 6, 2026

@Hlavtox Hlavtox left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would be best to add types to the methods. Since the minimum php version is now 7.2, we can. :-)

@Codencode

Copy link
Copy Markdown
Member Author

@Hlavtox good point, thanks!

I’ve updated GoogleAnalyticsTools to use native parameter and return types across the class.

@Codencode
Codencode requested a review from Hlavtox September 6, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for review

Development

Successfully merging this pull request may close these issues.

3 participants