Skip to content

Commit ecdcf08

Browse files
Merge pull request #1401 from buckaroo-it/BP-5064-Add-support-for-PHP-8.4
add support for php 8.4
2 parents cfea2a7 + b295986 commit ecdcf08

File tree

574 files changed

+6605
-5614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

574 files changed

+6605
-5614
lines changed

.github/workflows/coding-standard.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ jobs:
77
runs-on: ubuntu-latest
88
continue-on-error: true
99
steps:
10-
- uses: actions/checkout@v2
11-
- uses: extdn/github-actions-m2/magento-coding-standard/8.1@master
10+
- uses: actions/checkout@v4
11+
- uses: extdn/github-actions-m2/magento-coding-standard@master
1212
with:
1313
phpcs_severity: 10
1414
phpcs_report: full
@@ -18,15 +18,15 @@ jobs:
1818
runs-on: ubuntu-latest
1919
continue-on-error: true
2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v4
2222
- uses: extdn/github-actions-m2/magento-mess-detector@master
2323

2424
phpstan:
2525
name: M2 PHPStan
2626
runs-on: ubuntu-latest
2727
continue-on-error: true
2828
steps:
29-
- uses: actions/checkout@v2
30-
- uses: extdn/github-actions-m2/magento-phpstan@master
29+
- uses: actions/checkout@v4
30+
- uses: extdn/github-actions-m2/magento-phpstan/8.4@master
3131
with:
3232
composer_name: buckaroo/magento2

.github/workflows/integration.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,28 @@ jobs:
1111
runs-on: ubuntu-latest
1212
services:
1313
mysql:
14-
image: mysql:5.7
14+
image: mysql:8.0
1515
env:
1616
MYSQL_ROOT_PASSWORD: root
1717
ports:
1818
- 3306:3306
1919
options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
2020
es:
21-
image: docker.io/wardenenv/elasticsearch:7.8
21+
image: opensearchproject/opensearch:2.5.0
2222
ports:
2323
- 9200:9200
2424
env:
25-
'discovery.type': single-node
26-
'xpack.security.enabled': false
27-
ES_JAVA_OPTS: "-Xms64m -Xmx512m"
28-
options: --health-cmd="curl localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=3
25+
discovery.type: single-node
26+
plugins.security.disabled: true
27+
OPENSEARCH_JAVA_OPTS: "-Xms512m -Xmx512m"
28+
DISABLE_INSTALL_DEMO_CONFIG: true
29+
compatibility.override_main_response_version: true
30+
options: --health-cmd="curl -f localhost:9200/_cluster/health?wait_for_status=yellow&timeout=60s" --health-interval=10s --health-timeout=5s --health-retries=5
2931
steps:
30-
- uses: actions/checkout@v2
31-
- name: M2 Integration Tests with Magento 2 (Php 7.4)
32-
uses: extdn/github-actions-m2/magento-integration-tests/7.4@master
32+
- uses: actions/checkout@v4
33+
- name: M2 Integration Tests with Magento 2.4.8-p3 (PHP 8.3)
34+
uses: extdn/github-actions-m2/magento-integration-tests/8.3@master
3335
with:
3436
module_name: Buckaroo_Magento2
3537
composer_name: buckaroo/magento2
36-
ce_version: '2.4.0'
38+
ce_version: '2.4.8-p3'

.github/workflows/main.yml

Lines changed: 58 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,82 @@
11
name: Module checks
2+
23
on:
34
push:
45
branches: [ develop ]
56
pull_request:
67
branches: [ develop ]
78
workflow_dispatch:
9+
810
jobs:
911
build:
1012
runs-on: ubuntu-latest
13+
1114
steps:
12-
- name: setup php
15+
- name: Setup PHP 8.4
1316
uses: shivammathur/setup-php@v2
1417
with:
15-
php-version: 7.3
16-
tools: composer:v2
17-
- uses: actions/checkout@v2
18-
- name: validate composer json
18+
php-version: '8.4'
19+
tools: composer:v2, phpunit, phpcs
20+
coverage: none
21+
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Validate composer.json
1926
run: composer validate
27+
2028
- name: Cache Composer packages
2129
id: composer-cache
22-
uses: actions/cache@v2
30+
uses: actions/cache@v4
2331
with:
2432
path: ${{ github.workspace }}/${{ env.namespace }}-source/vendor
25-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
33+
key: ${{ runner.os }}-php84-${{ hashFiles('**/composer.lock') }}
2634
restore-keys: |
27-
${{ runner.os }}-php-
28-
- name: PHPUnit and PHPCS
35+
${{ runner.os }}-php84-
36+
37+
- name: Prepare auth for Magento repo
38+
run: |
39+
printf '%s\n' \
40+
'{' \
41+
' "http-basic": {' \
42+
' "repo.magento.com": {' \
43+
' "username": "${{ secrets.REPO_USERNAME }}",' \
44+
' "password": "${{ secrets.REPO_PASS }}"' \
45+
' }' \
46+
' }' \
47+
'}' > auth.json
48+
49+
- name: Determine changed files (PR only)
50+
if: ${{ github.event_name == 'pull_request' }}
2951
run: |
3052
pull_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
31-
url="https://api.github.com/repos/buckaroo-it/Magento2/pulls/$pull_number/files"
32-
echo $url
33-
curl $url > files_changed
34-
cat files_changed | grep '"filename"' | sed 's/\"filename\"\: \"//' | sed 's/\",//' | xargs ls
35-
echo '{"http-basic": {"repo.magento.com": {"username": "${{ secrets.REPO_USERNAME }}","password": "${{ secrets.REPO_PASS }}"}}}' > auth.json
36-
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.3.6 m23
37-
mkdir -p m23/app/code/Buckaroo/Magento2/
38-
rsync -r --exclude='m23' ./ m23/app/code/Buckaroo/Magento2/
39-
cat files_changed | grep '"filename"' | sed 's/\"filename\"\: \"//' | sed 's/\",//' | xargs ./m23/vendor/bin/phpcs --standard=Magento2
40-
cd m23
53+
url="https://api.github.com/repos/${{ github.repository }}/pulls/$pull_number/files"
54+
echo "$url"
55+
curl -sS "$url" > files_changed
56+
cat files_changed | grep '"filename"' | sed 's/\"filename\"\: \"//' | sed 's/\",//' | xargs -r ls -la
57+
58+
- name: Create Magento 2.4.8-p3 project
59+
run: |
60+
composer create-project --repository-url=https://repo.magento.com/ \
61+
magento/project-community-edition=2.4.8-p3 m248
62+
63+
- name: Copy module into Magento
64+
run: |
65+
mkdir -p m248/app/code/Buckaroo/Magento2/
66+
rsync -r --exclude='m248' ./ m248/app/code/Buckaroo/Magento2/
67+
68+
- name: Run PHPCS against changed files (PR) or whole module (push)
69+
run: |
70+
if [ -f files_changed ]; then
71+
cat files_changed | grep '"filename"' | sed 's/\"filename\"\: \"//' | sed 's/\",//' \
72+
| xargs -r ./m248/vendor/bin/phpcs --standard=Magento2
73+
else
74+
./m248/vendor/bin/phpcs --standard=Magento2 m248/app/code/Buckaroo/Magento2
75+
fi
76+
77+
- name: Compile and run unit tests
78+
working-directory: m248
79+
run: |
4180
bin/magento module:enable --all
4281
bin/magento setup:di:compile
4382
vendor/phpunit/phpunit/phpunit -c dev/tests/unit/phpunit.xml.dist app/code/Buckaroo/Magento2

.github/workflows/rename-icons.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
// phpcs:ignore Magento2.Functions.DiscouragedFunction.Discouraged
23
$path = realpath('./');
34

45
$di = new RecursiveIteratorIterator(
@@ -7,8 +8,10 @@
78
);
89

910
foreach ($di as $name => $fio) {
10-
$newname = $fio->getPath() . DIRECTORY_SEPARATOR . strtolower(str_replace(" ","",str_replace("&","-",$fio->getFilename())));
11+
// phpcs:ignore Generic.Files.LineLength.TooLong
12+
$newname = $fio->getPath() . DIRECTORY_SEPARATOR . strtolower(str_replace(" ", "", str_replace("&", "-", $fio->getFilename())));
1113
// phpcs:ignore Magento2.Security.LanguageConstruct.DirectOutput
1214
echo $newname, "\r\n";
15+
// phpcs:ignore Magento2.Functions.DiscouragedFunction.Discouraged
1316
rename($name, $newname);
1417
}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
Build
22
.DS_Store
33
.idea/
4+
vendor/
5+
# Local testing files (keep for development only)
6+
phpstan.neon
7+
composer.lock

.php-cs-fixer.dist.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$finder = PhpCsFixer\Finder::create()
6+
->in(__DIR__)
7+
->exclude(['vendor', 'var', 'Test'])
8+
->notPath('registration.php');
9+
10+
return (new PhpCsFixer\Config())
11+
->setRules([
12+
'@PHP84Migration' => true,
13+
'@PSR12' => true,
14+
'nullable_type_declaration_for_default_null_value' => true,
15+
'modernize_types_casting' => true,
16+
'visibility_required' => true,
17+
'array_syntax' => ['syntax' => 'short'],
18+
'trailing_comma_in_multiline' => true,
19+
'no_unused_imports' => true,
20+
])
21+
->setFinder($finder)
22+
->setRiskyAllowed(true);

Api/CertificateRepositoryInterface.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* NOTICE OF LICENSE
45
*
@@ -17,6 +18,7 @@
1718
* @copyright Copyright (c) Buckaroo B.V.
1819
* @license https://tldrlegal.com/license/mit-license
1920
*/
21+
2022
namespace Buckaroo\Magento2\Api;
2123

2224
use Magento\Framework\Api\SearchCriteria;
@@ -29,37 +31,37 @@
2931
interface CertificateRepositoryInterface
3032
{
3133
/**
32-
* @param CertificateInterface $certificate
33-
* @return CertificateInterface
34+
* @param CertificateInterface $certificate
3435
* @throws CouldNotSaveException
36+
* @return CertificateInterface
3537
*/
3638
public function save(CertificateInterface $certificate);
3739

3840
/**
39-
* @param int|string $certificateId
40-
* @return CertificateInterface
41+
* @param int|string $certificateId
4142
* @throws NoSuchEntityException
43+
* @return CertificateInterface
4244
*/
4345
public function getById($certificateId);
4446

4547
/**
46-
* @param SearchCriteria $searchCriteria
48+
* @param SearchCriteria $searchCriteria
4749
* @return SearchResultsInterface
4850
*/
4951
public function getList(SearchCriteria $searchCriteria);
5052

5153
/**
52-
* @param CertificateInterface $certificate
53-
* @return bool
54+
* @param CertificateInterface $certificate
5455
* @throws CouldNotDeleteException
56+
* @return bool
5557
*/
5658
public function delete(CertificateInterface $certificate);
5759

5860
/**
59-
* @param $certificateId
60-
* @return bool
61+
* @param $certificateId
6162
* @throws CouldNotDeleteException
6263
* @throws NoSuchEntityException
64+
* @return bool
6365
*/
6466
public function deleteById($certificateId);
6567
}

Api/Data/BreakdownItemInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* NOTICE OF LICENSE
45
*
@@ -17,6 +18,7 @@
1718
* @copyright Copyright (c) Buckaroo B.V.
1819
* @license https://tldrlegal.com/license/mit-license
1920
*/
21+
2022
namespace Buckaroo\Magento2\Api\Data;
2123

2224
interface BreakdownItemInterface
@@ -34,4 +36,4 @@ public function getCurrencyCode();
3436
* @return string
3537
*/
3638
public function getValue();
37-
}
39+
}

Api/Data/BuckarooRestOrderDataInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ interface BuckarooRestOrderDataInterface
2727
* @return \Buckaroo\Magento2\Api\Data\Giftcard\TransactionResponseInterface[]
2828
*/
2929
public function getGroupTransactions();
30-
}
30+
}

Api/Data/CertificateInterface.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* NOTICE OF LICENSE
45
*
@@ -17,12 +18,13 @@
1718
* @copyright Copyright (c) Buckaroo B.V.
1819
* @license https://tldrlegal.com/license/mit-license
1920
*/
21+
2022
namespace Buckaroo\Magento2\Api\Data;
2123

2224
interface CertificateInterface
2325
{
2426
/**
25-
* @param string $certificate
27+
* @param string $certificate
2628
* @return $this
2729
*/
2830
public function setCertificate($certificate);
@@ -33,7 +35,7 @@ public function setCertificate($certificate);
3335
public function getCertificate();
3436

3537
/**
36-
* @param string $name
38+
* @param string $name
3739
* @return $this
3840
*/
3941
public function setName($name);
@@ -44,7 +46,7 @@ public function setName($name);
4446
public function getName();
4547

4648
/**
47-
* @param string $createdAt
49+
* @param string $createdAt
4850
* @return $this
4951
*/
5052
public function setCreatedAt($createdAt);

0 commit comments

Comments
 (0)