Repository navigation
Conversation
| /** | ||
| * @var Ps_Googleanalytics | ||
| */ | ||
| public $module; |
There was a problem hiding this comment.
Is this necessary? I think it should be automatic when you are extending ModuleFrontController.
There was a problem hiding this comment.
No, it's not necessary; I added it to make the type explicit, i.e., "Ps_Googleanalytics", so that there are no warnings in the editor.
However, if you consider it "redundant", I can remove it.
There was a problem hiding this comment.
Just remove this please, your IDE complains because it lacks the context of a parent class. :-)
Hlavtox
left a comment
There was a problem hiding this comment.
Block to prevent accidental merge, I want to check and test it. 👍
|
@Hlavtox, |
|
awesome, waiting for merge |
|
@Hlavtox, have you had a chance to review this PR? Also, if it's okay, I could create a second PR with the changes related to updating the product list (e.g., on the category page when filtering). Thanks, and sorry for bothering you. |
Hlavtox
left a comment
There was a problem hiding this comment.
One comment but I think its good.
ping @kpodemski for check
| /** | ||
| * @var Ps_Googleanalytics | ||
| */ | ||
| public $module; |
There was a problem hiding this comment.
Just remove this please, your IDE complains because it lacks the context of a parent class. :-)
|
@Hlavtox, Initially, I had added the type declaration in the class definition like this (since my IDE suggested it): /**
* @var Ps_Googleanalytics
*/
public $module;But you rightly advised me to remove it (#170 (comment)). I'd like to fix these issues since I'm preparing videos to demonstrate the functionality - this way we can work toward closing this PR. Thanks! |
|
Open up this file - https://github.com/PrestaShop/ps_googleanalytics/blob/dev/tests/phpstan/phpstan-8.0.neon And add this to
And probably the same for https://github.com/PrestaShop/ps_googleanalytics/blob/dev/tests/phpstan/phpstan-latest.neon, not sure. Should work 🎉 |
55b954c to
07dd3d0
Compare
|
@Hlavtox, I also had to modify:
After several attempts, I finally got it working 😄 I think it should be good now. Thanks a lot! |
|
@paulnoelcholot, were you able to run the tests in the end? |
|
ping @PrestaShop/qa-functional |
|
@Hlavtox @kpodemski, I think testing this change is a bit 'complicated.' I tried my best to explain how to do it and even added some videos. Do you have any suggestions? I'm afraid these changes won't get merged, and that's a shame. |
|
Hello @Codencode The CI is fixed can you check conflicts and i ask @PrestaShop/qa-functional for QA by dev |
|
@Touxten yes, I think it's the best thing, because I couldn't get the test done, probably I wasn't good at making myself understood. |
07dd3d0 to
0933fc7
Compare
|
You must delete the old .neon files and add the errors to the new ones. |
0933fc7 to
4821491
Compare
|
@Touxten I think I did everything, right? |
|
QA against Without this PR the bug is still there. An AJAX add-to-cart writes one row into With the four code files applied on top of Why it is CONFLICTING. Every conflict is inside
That makes the rebase mechanical:
An alternative that touches no config file at all is to narrow the property at the call site in /** @var Ps_Googleanalytics $module */
$module = $this->module;
$output = $module->getDataHandler()->readData();
$module->getDataHandler()->deleteData();I only checked that construct under PHPStan 1.12, and CI here runs One gap in the change itself. |
JavaScript events considered: - updateCart - changedCheckoutStep - updatedProduct - updateProductList
Co-authored-by: Nicolas Lœuillet <nicolas@loeuillet.org>
4821491 to
2ac4bae
Compare
|
Thanks for testing this so thoroughly and for the detailed feedback. I’ve rebased the PR on the latest For the I also added the There is still one PHPStan failure that seems unrelated to this PR. Thanks again for the very helpful review. |
|
The split is the right call, and I checked the part of #185 that could bite rather than just the PHPStan line. Removing the
So the guard is dead code at both sites, and the declared The one thing worth a line in #185's description: it is a public method, so third-party code outside the org calling it with a non-array moves from a silent On the sequencing, no objection: land #185, rebase this one on |
|
@boo-code That makes sense. I’ll keep the fix separated in #185 and add a note to the PR description about the behavioral change for external callers passing non-array values. Once #185 is merged, I’ll rebase #170 on |
JavaScript events considered:
Additional context
renderPurchaseEvent()was already documented to receive an array, and all current callers in this repository pass an array.This change makes that contract explicit in the method signature and removes the redundant runtime check.
As a consequence, any external caller passing a non-array value will now get a
TypeErrorinstead of the method silently returning.