Repository navigation
Conversation
|
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! |
Hlavtox
left a comment
There was a problem hiding this comment.
It would be best to add types to the methods. Since the minimum php version is now 7.2, we can. :-)
|
@Hlavtox good point, thanks! I’ve updated |
|
QA: validated on The one regression risk in a signature tightening is a caller that can pass a non-array (which would turn the old silent
So |
LameuleFR
left a comment
There was a problem hiding this comment.
The guard was indeed unreachable: both callers start from $orderProducts = [] and only reassign it from prepareItemListFromProductList(), which returns an array on every path. Not blocking: could you update the description so it mentions the native types added by the second commit (and clear the stray F in "Fixed ticket?")?
|
@LameuleFR I've updated the PR description to mention the native types added in the second commit and removed the stray |
is_array()check inGoogleAnalyticsTools::renderPurchaseEvent().Both callers initialize
$orderProductsas an array and only reassign it usingprepareItemListFromProductList(), which always returns an array. Therefore, the check is unnecessary, and PHPStan correctly reports:Call to function is_array() with array will always evaluate to true.Additionally, native parameter and return types have been added to the methods in
GoogleAnalyticsTools, taking advantage of the minimum supported PHP version (7.2).The issue is reproducible directly on the current
devbranch. The removal of the redundant check does not change the existing behavior.developjob passes without reporting:Call to function is_array() with array will always evaluate to true.