Skip to content

Commit 37fe599

Browse files
committed
drop PHP 8.1 and below, add PHP 8.5 support, allow Tagging 9
Raise the minimum PHP version to 8.2 and allow nosto/module-nostotagging ^9.0 alongside ^8.0. Source: - Make seven implicitly nullable parameters explicit (deprecated since PHP 8.4): Helper/Data.php (isCategorySortingEnabled, isAllCategoriesMapEnabled, getFallbackSorting, getMaxProductLimit, getStoreConfig), Exception/CmpException.php and Exception/SessionCreationException.php Dependencies: - Require php >=8.2 (was >=7.4); set platform php to 8.2.0 - Allow nosto/module-nostotagging ^8.0 || ^9.0, so the module installs on both Tagging majors (every Tagging API this module uses is unchanged between 8.1.8 and 9.0.0) - Narrow nosto/php-sdk from >=5.5.0 to ^7.7 || ^8.0. This has to span both majors: Tagging 8.x pins the SDK to 7.7.7 and Tagging 9.x pins it to 8.0.0, so a narrower constraint would make the ^8.0 Tagging path unsatisfiable - Bump the Magento dev modules to their 2.4.8 versions (module-store 101.1.8, module-layered-navigation 100.4.8, module-catalog-graph-ql 100.4.8) - Upgrade tooling: phan 5.3 -> ^6.0, magento-coding-standard ^5.0 -> ^38, magento-ecg 3.* -> ^4.5, phing 2.* -> ^3.0, php_codesniffer ^3.5 -> ^3.13, phpmd ^2.6 -> ^2.15; add phpcompatibility/php-compatibility - Remove sebastian/phpcpd (abandoned) and mridang/pmd-annotations (requires php ^7.0, so it cannot install on 8.2; not referenced by any workflow) CI / analysis: - Bump workflows to PHP 8.2; Magento install 2.4.5 -> 2.4.8 (2.4.5 caps at 8.1) - actions/checkout v1 -> v4; replace the deprecated ::set-output with $GITHUB_OUTPUT; drop --no-suggest (no-op in Composer 2) - Add a PHP 8.2-8.5 compatibility job and ruleset-phpcompat.xml - Set phan target_php_version 8.5 / minimum_target_php_version 8.2 - Drop the hardcoded installed_paths from ruleset.xml; the phpcodesniffer-composer-installer plugin registers EcgM2, Magento2 and PHPCompatibility, and hardcoding the path prevented the standards resolving - Use cs2pr --graceful-warnings, since coding-standard ^38 is far stricter than ^5.0 and reports many warnings Bump version to 6.0.0: dropping PHP 8.1 is a breaking change. Verified: parses clean on 8.2/8.3/8.4/8.5; PHPCompatibility 8.2- reports no violations; installs into Magento 2.4.8 alongside Tagging 9.0.0 with setup:di:compile succeeding and Nosto\Cmp\Helper\Data resolving through DI.
1 parent 76907f2 commit 37fe599

11 files changed

Lines changed: 175 additions & 53 deletions

File tree

.github/workflows/action.yml

Lines changed: 65 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ jobs:
88
name: Code Sniffer
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v1
11+
- uses: actions/checkout@v4
1212

1313
############################################################################
1414
- name: Set up PHP
1515
uses: shivammathur/setup-php@v2
1616
with:
17-
php-version: '7.4'
17+
php-version: '8.2'
1818
tools: composer:v2
1919
extensions: ast, bcmath, gd
2020
coverage: none
@@ -24,7 +24,7 @@ jobs:
2424
id: composer-cache
2525
run: |
2626
composer config cache-files-dir
27-
echo "::set-output name=dir::$(composer config cache-files-dir)"
27+
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
2828
- uses: actions/cache@v4
2929
with:
3030
path: ${{ steps.composer-cache.outputs.dir }}
@@ -39,7 +39,7 @@ jobs:
3939
run: |
4040
composer config repositories.0 composer https://repo.magento.com
4141
composer config http-basic.repo.magento.com "$REPO_USR" "$REPO_PSW"
42-
composer install --prefer-dist --no-progress --no-suggest
42+
composer install --prefer-dist --no-progress
4343
############################################################################
4444

4545
- name: Run the sniffer
@@ -56,19 +56,19 @@ jobs:
5656

5757
- name: Report annotations
5858
id: report-annotations
59-
run: ./vendor/bin/cs2pr chkphpcs.xml
59+
run: ./vendor/bin/cs2pr --graceful-warnings chkphpcs.xml
6060

6161
phpmd:
6262
name: Mess Detect
6363
runs-on: ubuntu-latest
6464
steps:
65-
- uses: actions/checkout@v1
65+
- uses: actions/checkout@v4
6666

6767
############################################################################
6868
- name: Set up PHP
6969
uses: shivammathur/setup-php@v2
7070
with:
71-
php-version: '7.4'
71+
php-version: '8.2'
7272
tools: composer:v2
7373
extensions: ast, bcmath, gd
7474
coverage: none
@@ -78,7 +78,7 @@ jobs:
7878
id: composer-cache
7979
run: |
8080
composer config cache-files-dir
81-
echo "::set-output name=dir::$(composer config cache-files-dir)"
81+
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
8282
- uses: actions/cache@v4
8383
with:
8484
path: ${{ steps.composer-cache.outputs.dir }}
@@ -93,7 +93,7 @@ jobs:
9393
run: |
9494
composer config repositories.0 composer https://repo.magento.com
9595
composer config http-basic.repo.magento.com "$REPO_USR" "$REPO_PSW"
96-
composer install --prefer-dist --no-progress --no-suggest
96+
composer install --prefer-dist --no-progress
9797
############################################################################
9898

9999
- name: Run the mess detector
@@ -113,13 +113,13 @@ jobs:
113113
name: Package
114114
runs-on: ubuntu-latest
115115
steps:
116-
- uses: actions/checkout@v1
116+
- uses: actions/checkout@v4
117117

118118
############################################################################
119119
- name: Set up PHP
120120
uses: shivammathur/setup-php@v2
121121
with:
122-
php-version: '7.4'
122+
php-version: '8.2'
123123
tools: composer:v2.1.14, pecl
124124
extensions: ast, bcmath, gd
125125
coverage: none
@@ -128,7 +128,7 @@ jobs:
128128
- name: Cache composer packages
129129
id: composer-cache
130130
run: |
131-
echo "::set-output name=dir::$(composer config cache-files-dir)"
131+
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
132132
- uses: actions/cache@v4
133133
with:
134134
path: ${{ steps.composer-cache.outputs.dir }}
@@ -146,7 +146,7 @@ jobs:
146146
composer require --no-update nosto/module-nostotagging:@stable
147147
composer require --no-update nosto/module-nosto-msi:@stable
148148
composer require --no-update nosto/module-nosto-itp:@stable
149-
composer install --prefer-dist --no-progress --no-suggest
149+
composer install --prefer-dist --no-progress
150150
############################################################################
151151

152152
- name: Build archive using composer
@@ -157,3 +157,55 @@ jobs:
157157
with:
158158
name: composer-zip-archive
159159
path: archive.zip
160+
161+
# Magento 2.4.8 pins php to ~8.2.0||~8.3.0||~8.4.0, so a normal install cannot
162+
# run on 8.5 yet. This lane installs with the platform requirement ignored and
163+
# only runs PHPCompatibility, which parses source and never executes Magento,
164+
# so the module stays verified 8.5-clean ahead of Magento allowing 8.5.
165+
php-compat:
166+
name: PHP 8.2-8.5 Compatibility
167+
runs-on: ubuntu-latest
168+
steps:
169+
- uses: actions/checkout@v4
170+
171+
- name: Set up PHP
172+
uses: shivammathur/setup-php@v2
173+
with:
174+
php-version: '8.5'
175+
tools: composer:v2
176+
coverage: none
177+
178+
- name: Cache composer packages
179+
id: composer-cache
180+
run: |
181+
composer config cache-files-dir
182+
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
183+
- uses: actions/cache@v4
184+
with:
185+
path: ${{ steps.composer-cache.outputs.dir }}
186+
key: ${{ runner.os }}-composer-phpcompat-${{ hashFiles('**/composer.json') }}
187+
restore-keys: |
188+
${{ runner.os }}-composer-phpcompat-
189+
190+
- name: Install dependencies
191+
env:
192+
REPO_USR: ${{ secrets.REPO_USR }}
193+
REPO_PSW: ${{ secrets.REPO_PSW }}
194+
run: |
195+
composer config http-basic.repo.magento.com "$REPO_USR" "$REPO_PSW"
196+
composer install --prefer-dist --no-progress --ignore-platform-req=php
197+
198+
- name: Lint every source file under PHP 8.5
199+
run: |
200+
find . -path ./vendor -prune -o \( -name '*.php' -o -name '*.phtml' \) -print0 \
201+
| xargs -0 -n1 -P4 php -l > /dev/null
202+
203+
- name: Run the compatibility sniffs
204+
run: |
205+
./vendor/bin/phpcs --standard=ruleset-phpcompat.xml \
206+
--report=checkstyle --report-file=chkphpcompat.xml || true
207+
./vendor/bin/phpcs --standard=ruleset-phpcompat.xml --report=full
208+
209+
- name: Report annotations
210+
if: always() && hashFiles('chkphpcompat.xml') != ''
211+
run: ./vendor/bin/cs2pr chkphpcompat.xml

.github/workflows/ide.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v1
12+
- uses: actions/checkout@v4
1313

1414
############################################################################
1515
- name: Set up PHP
1616
uses: shivammathur/setup-php@v2
1717
with:
18-
php-version: '7.4'
18+
php-version: '8.2'
1919
tools: composer:v2, pecl
2020
extensions: bcmath, gd, pdo_mysql, soap, zip, ast
2121
coverage: none
@@ -25,7 +25,7 @@ jobs:
2525
id: composer-cache
2626
run: |
2727
composer config cache-files-dir
28-
echo "::set-output name=dir::$(composer config cache-files-dir)"
28+
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
2929
- uses: actions/cache@v4
3030
with:
3131
path: ${{ steps.composer-cache.outputs.dir }}
@@ -40,13 +40,13 @@ jobs:
4040
run: |
4141
composer config repositories.0 composer https://repo.magento.com
4242
composer config http-basic.repo.magento.com "$REPO_USR" "$REPO_PSW"
43-
composer install --prefer-dist --no-progress --no-suggest
43+
composer install --prefer-dist --no-progress
4444
############################################################################
4545

4646
- name: Install Magento
4747
id: install-magento
4848
run: |
49-
composer create-project magento/community-edition=2.4.5 magento --no-dev
49+
composer create-project magento/community-edition=2.4.8 magento --no-dev
5050
cd magento
5151
composer config minimum-stability dev
5252
composer config prefer-stable true

.github/workflows/phan.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v1
12+
- uses: actions/checkout@v4
1313

1414
############################################################################
1515
- name: Set up PHP
1616
uses: shivammathur/setup-php@v2
1717
with:
18-
php-version: '7.4'
18+
php-version: '8.2'
1919
tools: composer:v2, pecl
2020
extensions: ast, bcmath, gd, pdo_mysql, soap, zip
2121
coverage: none
@@ -24,7 +24,7 @@ jobs:
2424
id: composer-cache
2525
run: |
2626
composer config cache-files-dir
27-
echo "::set-output name=dir::$(composer config cache-files-dir)"
27+
echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
2828
- uses: actions/cache@v4
2929
with:
3030
path: ${{ steps.composer-cache.outputs.dir }}
@@ -39,13 +39,13 @@ jobs:
3939
run: |
4040
composer config repositories.0 composer https://repo.magento.com
4141
composer config http-basic.repo.magento.com "$REPO_USR" "$REPO_PSW"
42-
composer install --prefer-dist --no-progress --no-suggest
42+
composer install --prefer-dist --no-progress
4343
############################################################################
4444

4545
- name: Install Magento
4646
id: install-magento
4747
run: |
48-
composer create-project magento/community-edition=2.4.5 magento --no-dev
48+
composer create-project magento/community-edition=2.4.8 magento --no-dev
4949
cd magento
5050
composer config minimum-stability dev
5151
composer config prefer-stable true
@@ -73,4 +73,4 @@ jobs:
7373

7474
- name: Report annotations
7575
id: report-annotations
76-
run: ./vendor/bin/cs2pr chkphan.xml
76+
run: ./vendor/bin/cs2pr --graceful-warnings chkphan.xml

Exception/CmpException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ abstract class CmpException extends Exception
4848
* @param int $code
4949
* @param Throwable|null $previous
5050
*/
51-
public function __construct(Store $store, $message, $code = 0, Throwable $previous = null)
51+
public function __construct(Store $store, $message, $code = 0, ?Throwable $previous = null)
5252
{
5353
parent::__construct($this->buildMessage($store, $message), $code, $previous);
5454
}

Exception/SessionCreationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class SessionCreationException extends CmpException
4747
* @param Store $store
4848
* @param Throwable|null $previous
4949
*/
50-
public function __construct(Store $store, Throwable $previous = null)
50+
public function __construct(Store $store, ?Throwable $previous = null)
5151
{
5252
parent::__construct($store, self::DEFAULT_MESSAGE, 0, $previous);
5353
}

Helper/Data.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function __construct(
9595
* @param Store|null $store the store model or null.
9696
* @return bool the configuration value
9797
*/
98-
public function isCategorySortingEnabled(Store $store = null)
98+
public function isCategorySortingEnabled(?Store $store = null)
9999
{
100100
return (bool)$this->getStoreConfig(self::XML_PATH_CATEGORY_SORTING, $store);
101101
}
@@ -106,7 +106,7 @@ public function isCategorySortingEnabled(Store $store = null)
106106
* @param Store|null $store the store model or null.
107107
* @return bool the configuration value
108108
*/
109-
public function isAllCategoriesMapEnabled(Store $store = null)
109+
public function isAllCategoriesMapEnabled(?Store $store = null)
110110
{
111111
return (bool)$this->getStoreConfig(self::XML_PATH_CATEGORY_MAPPING, $store);
112112
}
@@ -117,7 +117,7 @@ public function isAllCategoriesMapEnabled(Store $store = null)
117117
* @param Store|null $store the store model or null.
118118
* @return string
119119
*/
120-
public function getFallbackSorting(Store $store = null)
120+
public function getFallbackSorting(?Store $store = null)
121121
{
122122
return $this->getStoreConfig(self::XML_PATH_FALLBACK_SORTING, $store);
123123
}
@@ -128,7 +128,7 @@ public function getFallbackSorting(Store $store = null)
128128
* @param Store|null $store the store model or null.
129129
* @return integer
130130
*/
131-
public function getMaxProductLimit(Store $store = null)
131+
public function getMaxProductLimit(?Store $store = null)
132132
{
133133
return (int)$this->getStoreConfig(self::XML_PATH_CATEGORY_MAX_PRODUCT_LIMIT, $store);
134134
}
@@ -138,7 +138,7 @@ public function getMaxProductLimit(Store $store = null)
138138
* @param Store|null $store
139139
* @return mixed|null
140140
*/
141-
public function getStoreConfig(string $path, Store $store = null)
141+
public function getStoreConfig(string $path, ?Store $store = null)
142142
{
143143
if ($store === null) {
144144
$store = $this->nostoHelperScope->getStore(true);

composer.json

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,31 @@
22
"name": "nosto/module-nostocmp",
33
"description": "Nosto Category Merchandising extension for Magento 2",
44
"type": "magento2-module",
5-
"version": "5.3.2",
5+
"version": "6.0.0",
66
"require-dev": {
7-
"magento-ecg/coding-standard": "3.*",
8-
"magento/module-store": "101.1.2",
7+
"magento-ecg/coding-standard": "^4.5",
8+
"magento/module-store": "101.1.8",
99
"magento/zendframework1": "1.14.3",
10-
"mridang/pmd-annotations": "^0.0.2",
1110
"staabm/annotate-pull-request-from-checkstyle": "^1.1",
12-
"magento/magento-coding-standard": "^5.0",
13-
"phan/phan": "5.3.0",
14-
"phpmd/phpmd": "^2.6",
15-
"sebastian/phpcpd": "4.1.0",
16-
"drenso/phan-extensions": "3.5.1",
17-
"phing/phing": "2.*",
18-
"squizlabs/php_codesniffer": "^3.5",
19-
"magento/module-layered-navigation": "100.4.2",
20-
"magento/module-catalog-graph-ql": "100.4.2",
11+
"magento/magento-coding-standard": "^38",
12+
"phan/phan": "^6.0",
13+
"phpmd/phpmd": "^2.15",
14+
"phpcompatibility/php-compatibility": "^10.0@alpha",
15+
"drenso/phan-extensions": "^3.5",
16+
"phing/phing": "^3.0",
17+
"squizlabs/php_codesniffer": "^3.13",
18+
"magento/module-layered-navigation": "100.4.8",
19+
"magento/module-catalog-graph-ql": "100.4.8",
2120
"magento/module-elasticsearch": "*"
2221
},
2322
"license": [
2423
"OSL-3.0"
2524
],
2625
"minimum-stability": "dev",
2726
"require": {
28-
"nosto/module-nostotagging": "^8.0",
29-
"nosto/php-sdk": ">=5.5.0",
30-
"php": ">=7.4",
27+
"nosto/module-nostotagging": "^8.0 || ^9.0",
28+
"nosto/php-sdk": "^7.7 || ^8.0",
29+
"php": ">=8.2",
3130
"ext-json": "*"
3231
},
3332
"repositories": [
@@ -46,10 +45,33 @@
4645
]
4746
},
4847
"archive": {
49-
"exclude": ["Jenkinsfile", "Dockerfile", ".DS_STORE", ".idea", ".phan", ".docker", "ruleset.xml", "phan.*", ".gitignore", "build.xml", ".github", "supervisord.conf", "entrypoint.sh", "/magento"]
48+
"exclude": [
49+
"Jenkinsfile",
50+
"Dockerfile",
51+
".DS_STORE",
52+
".idea",
53+
".phan",
54+
".docker",
55+
"ruleset.xml",
56+
"ruleset-phpcompat.xml",
57+
"phan.*",
58+
".gitignore",
59+
".gitea",
60+
"build.xml",
61+
".github",
62+
"supervisord.conf",
63+
"entrypoint.sh",
64+
"/magento"
65+
]
5066
},
5167
"config": {
52-
"process-timeout":3600
68+
"process-timeout": 3600,
69+
"platform": {
70+
"php": "8.2.0"
71+
},
72+
"allow-plugins": {
73+
"dealerdirect/phpcodesniffer-composer-installer": true
74+
}
5375
},
5476
"scripts": {
5577
"di:compile": "./compile.sh",

0 commit comments

Comments
 (0)