Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 26 additions & 38 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,27 @@ jobs:
- name: PHP syntax checker 7.2
uses: prestashop/github-action-php-lint/7.2@master

- name: PHP syntax checker 7.3
uses: prestashop/github-action-php-lint/7.3@master

- name: PHP syntax checker 7.4
uses: prestashop/github-action-php-lint/7.4@master

- name: PHP syntax checker 8.0
uses: prestashop/github-action-php-lint/8.0@master

- name: PHP syntax checker 8.1
uses: prestashop/github-action-php-lint/8.1@master

- name: PHP syntax checker 8.2
uses: prestashop/github-action-php-lint/8.2@master

- name: PHP syntax checker 8.3
uses: prestashop/github-action-php-lint/8.3@master

- name: PHP syntax checker 8.4
uses: prestashop/github-action-php-lint/8.4@master

- name: PHP syntax checker 8.5
uses: prestashop/github-action-php-lint/8.5@master

Expand All @@ -36,7 +51,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
presta_version: ['8.1.7', '8.2.x']
presta_version: ['8.2.x']
php_version: ['7.4', '8.1']
fail-fast: false
env:
Expand Down Expand Up @@ -66,48 +81,21 @@ jobs:
phpstan-version: '^0.12'
composer-version: '2.2.18'

# Run PHPStan against the module (PHP 8.1 – 8.4)
phpstan-80-84:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why remove those?

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.

ok @jolelievre good point, re-added it using the 9.0.3 tag instead of the deleted 9.0.x branch: presta_version: ['9.0.3', '9.1.x', 'develop'] + matching phpstan-9.0.3.neon.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

According to source of truth here PrestaShop/PrestaShop#41648
9.0.3 is not supported, only 9.1.x and develop

name: PHPStan (PHP 8.1 - 8.4 )
runs-on: ubuntu-latest
strategy:
matrix:
presta_version: ['9.0.x']
php_version: ['8.1', '8.4']
fail-fast: false
env:
PHPRC: ${{ github.workspace }}/${{ github.event.repository.name }}/.phpstan-php-ini
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
path: ${{ github.event.repository.name }}

- name: Prepare PHP env for PrestaShop 9.0.x (define constants before any bootstrap)
run: |
mkdir -p ${{ github.event.repository.name }}/.phpstan-php-ini
{
echo "auto_prepend_file=$GITHUB_WORKSPACE/${{ github.event.repository.name }}/tests/php/phpstan/prepend-constants.php"
echo "memory_limit=512M"
} > ${{ github.event.repository.name }}/.phpstan-php-ini/php.ini

- name: Run PHPStan
uses: PrestaShop/.github/.github/actions/php-ci/phpstan@master
with:
php-version: ${{ matrix.php_version }}
presta-version: ${{ matrix.presta_version }}
module-name: ${{ github.event.repository.name }}
phpstan-level: '5'
phpstan-config: tests/php/phpstan/phpstan-${{ matrix.presta_version }}.neon

# Run PHPStan against the module (PHP 8.1 – 8.5)
phpstan:
name: PHPStan (PHP 8.1 - 8.5)
runs-on: ubuntu-latest
strategy:
matrix:
presta_version: ['9.1.x', 'develop']
php_version: ['8.1', '8.5']
include:
# PrestaShop 9.0.x supports PHP 8.1 up to 8.4 (8.5 is not supported)
- { presta_version: '9.0.3', php_version: '8.1' }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please use matrix style

presta_version: ['9.1.x', 'develop']
php_version: ['8.1', '8.5']

@mattgoud mattgoud Jun 11, 2026

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.

hello @jf-viguier, We need to test tag 9.0.3 (because the 9.0.x branch no longer exists). I've forwarded your comment to the team to be sure. The goal is to keep the modules up-to-date without any gaps, because even shops on 9.0.x may need to upgrade their modules. Therefore, it was decided to adopt and maintain a compatibility range for the modules.

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.

@jf-viguier, for the matrix, we can't use the previous style because, as we're testing 9.0.3, this version doesn't support PHP 8.5 (hence the need for a more atomic approach using the "includes" attribute).

- { presta_version: '9.0.3', php_version: '8.4' }
# PrestaShop 9.1.x and develop support PHP 8.1 up to 8.5
- { presta_version: '9.1.x', php_version: '8.1' }
- { presta_version: '9.1.x', php_version: '8.5' }
- { presta_version: 'develop', php_version: '8.1' }
- { presta_version: 'develop', php_version: '8.5' }
fail-fast: false
env:
PHPRC: ${{ github.workspace }}/${{ github.event.repository.name }}/.phpstan-php-ini
Expand All @@ -117,7 +105,7 @@ jobs:
with:
path: ${{ github.event.repository.name }}

- name: Prepare PHP env for PrestaShop 9.1.x and later (define constants before any bootstrap)
- name: Prepare PHP env for PrestaShop ${{ matrix.presta_version }} (define constants before any bootstrap)
run: |
mkdir -p ${{ github.event.repository.name }}/.phpstan-php-ini
{
Expand Down
2 changes: 1 addition & 1 deletion classes/Hook/HookDisplayBeforeBodyClosingTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private function renderSearch()
/**
* This method renders tracking code for product listings, like category pages.
*/
private function renderCartpage()
private function renderCartPage()
{
// Check if we are on cart page
if ($this->context->controller->php_self != 'cart') {
Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>ps_googleanalytics</name>
<displayName><![CDATA[Google Analytics]]></displayName>
<version><![CDATA[5.0.3]]></version>
<version><![CDATA[6.0.0]]></version>
<description><![CDATA[Gain clear insights into important metrics about your customers, using Google Analytics]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[analytics_stats]]></tab>
Expand Down
4 changes: 2 additions & 2 deletions ps_googleanalytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public function __construct()
{
$this->name = 'ps_googleanalytics';
$this->tab = 'analytics_stats';
$this->version = '5.0.3';
$this->ps_versions_compliancy = ['min' => '8.1.0', 'max' => _PS_VERSION_];
$this->version = '6.0.0';
$this->ps_versions_compliancy = ['min' => '8.2.0', 'max' => _PS_VERSION_];
$this->author = 'PrestaShop';
$this->module_key = 'fd2aaefea84ac1bb512e6f1878d990b8';
$this->bootstrap = true;
Expand Down
9 changes: 0 additions & 9 deletions tests/php/phpstan/phpstan-1.7.7.neon

This file was deleted.

8 changes: 0 additions & 8 deletions tests/php/phpstan/phpstan-1.7.8.neon

This file was deleted.

8 changes: 0 additions & 8 deletions tests/php/phpstan/phpstan-8.0.neon

This file was deleted.

7 changes: 6 additions & 1 deletion tests/php/phpstan/phpstan-8.2.x.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ includes:

parameters:
ignoreErrors:
# Framework / structural limitations that cannot be fixed in module code:
# - uninstallModule() calls parent::uninstall() through a closure rebound to the
# target module via Closure::bindTo(), a pattern PHPStan cannot statically resolve.
# - Cookie uses magic __get/__set, so its dynamic properties are undefined to PHPStan.
# - HookInterface mandates the constructor signature (Ps_Googleanalytics $module, Context),
# so $module must be stored even in hooks that never read it back.
- '#PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler::uninstallModule\(\) calls parent::uninstall\(\) but PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler does not extend any class.#'
- '#Access to an undefined property Cookie\:\:\$ga_admin_order.#'
- '#Access to an undefined property Cookie\:\:\$ga_admin_refund.#'
- '#Property PrestaShop\\Module\\Ps_Googleanalytics\\Hooks\\HookActionValidateOrder::\$module is never read, only written\.#'
- '#Method PrestaShop\\Module\\Ps_Googleanalytics\\Hooks\\HookDisplayBeforeBodyClosingTag::renderCartpage\(\) is unused\.#'
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ includes:

parameters:
ignoreErrors:
# Framework / structural limitations that cannot be fixed in module code:
# - uninstallModule() calls parent::uninstall() through a closure rebound to the
# target module via Closure::bindTo(), a pattern PHPStan cannot statically resolve.
# - Cookie uses magic __get/__set, so its dynamic properties are undefined to PHPStan.
# - HookInterface mandates the constructor signature (Ps_Googleanalytics $module, Context),
# so $module must be stored even in hooks that never read it back.
- '#PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler::uninstallModule\(\) calls parent::uninstall\(\) but PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler does not extend any class.#'
- '#Access to an undefined property Cookie\:\:\$ga_admin_order.#'
- '#Access to an undefined property Cookie\:\:\$ga_admin_refund.#'
- '#Property PrestaShop\\Module\\Ps_Googleanalytics\\Hooks\\HookActionValidateOrder::\$module is never read, only written\.#'
- '#Method PrestaShop\\Module\\Ps_Googleanalytics\\Hooks\\HookDisplayBeforeBodyClosingTag::renderCartpage\(\) is unused\.#'
9 changes: 0 additions & 9 deletions tests/php/phpstan/phpstan-9.0.x.neon

This file was deleted.

8 changes: 7 additions & 1 deletion tests/php/phpstan/phpstan-9.1.x.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ includes:

parameters:
ignoreErrors:
# Framework / structural limitations that cannot be fixed in module code:
# - uninstallModule() calls parent::uninstall() through a closure rebound to the
# target module via Closure::bindTo(), a pattern PHPStan cannot statically resolve.
# - Cookie uses magic __get/__set, so its dynamic properties are undefined to PHPStan.
# - HookInterface mandates the constructor signature (Ps_Googleanalytics $module, Context),
# so $module must be stored even in hooks that never read it back.
- '#PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler::uninstallModule\(\) calls parent::uninstall\(\) but PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler does not extend any class.#'
- '#Access to an undefined property Cookie\:\:\$ga_admin_order.#'
- '#Access to an undefined property Cookie\:\:\$ga_admin_refund.#'
- '#Property PrestaShop\\Module\\Ps_Googleanalytics\\Hooks\\HookActionValidateOrder::\$module is never read, only written\.#'
- '#Property PrestaShop\\Module\\Ps_Googleanalytics\\Hooks\\HookActionValidateOrder::\$module is never read, only written\.#'
8 changes: 7 additions & 1 deletion tests/php/phpstan/phpstan-develop.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ includes:

parameters:
ignoreErrors:
# Framework / structural limitations that cannot be fixed in module code:
# - uninstallModule() calls parent::uninstall() through a closure rebound to the
# target module via Closure::bindTo(), a pattern PHPStan cannot statically resolve.
# - Cookie uses magic __get/__set, so its dynamic properties are undefined to PHPStan.
# - HookInterface mandates the constructor signature (Ps_Googleanalytics $module, Context),
# so $module must be stored even in hooks that never read it back.
- '#PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler::uninstallModule\(\) calls parent::uninstall\(\) but PrestaShop\\Module\\Ps_Googleanalytics\\Handler\\ModuleHandler does not extend any class.#'
- '#Access to an undefined property Cookie\:\:\$ga_admin_order.#'
- '#Access to an undefined property Cookie\:\:\$ga_admin_refund.#'
- '#Property PrestaShop\\Module\\Ps_Googleanalytics\\Hooks\\HookActionValidateOrder::\$module is never read, only written\.#'
- '#Property PrestaShop\\Module\\Ps_Googleanalytics\\Hooks\\HookActionValidateOrder::\$module is never read, only written\.#'
8 changes: 0 additions & 8 deletions tests/php/phpstan/phpstan-latest.neon

This file was deleted.

Loading