Skip to content

Commit a7970ab

Browse files
Add support for Laravel 9 and PHP 8.1
1 parent 01d6e2e commit a7970ab

File tree

10 files changed

+86
-252
lines changed

10 files changed

+86
-252
lines changed

.github/workflows/main.yml

Lines changed: 61 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,36 @@ name: Build
22

33
on:
44
push:
5-
branches:
6-
- master
7-
- release/*
8-
- issue-*
5+
paths-ignore: ['*.md']
96
pull_request:
10-
branches:
11-
- master
12-
schedule:
13-
- cron: 0 7 * * 1
7+
paths-ignore: ['*.md']
8+
branches: [master]
149

1510
jobs:
1611
analysis:
1712
runs-on: ubuntu-latest
1813
strategy:
1914
matrix:
20-
php: [7.4]
15+
php: [8.0]
2116
steps:
2217
- uses: actions/checkout@v1
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: ${{ matrix.php }}
22+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
23+
coverage: none
2324
- name: Cache composer dependencies
2425
uses: actions/cache@v2
2526
env:
26-
cache-name: cache-gcr-worker-laravel-latest
27+
cache-name: laravel-gcr-worker-analysis
2728
with:
2829
path: ~/.composer
29-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
30+
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
3031
restore-keys: |
31-
${{ runner.os }}-build-${{ env.cache-name }}-
32-
${{ runner.os }}-build-
33-
${{ runner.os }}-
34-
- name: Setup PHP
35-
uses: shivammathur/setup-php@v2
36-
with:
37-
php-version: ${{ matrix.php }}
38-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
39-
coverage: none
32+
php-${{ matrix.php }}-build-${{ env.cache-name }}-
33+
php-${{ matrix.php }}-build-
34+
php-${{ matrix.php }}-
4035
- name: Install composer dependencies
4136
run: composer install --prefer-dist
4237
- name: Run phpstan analysis
@@ -45,115 +40,73 @@ jobs:
4540
run: composer phpmd-analysis
4641
- name: Run phpcpd analysis
4742
run: vendor/bin/phpcpd --min-lines=3 --min-tokens=36 src/
48-
laravel57:
49-
needs: [ analysis ]
50-
runs-on: ubuntu-latest
51-
strategy:
52-
matrix:
53-
php: [ 7.2, 7.3, 7.4 ]
54-
steps:
55-
- uses: actions/checkout@v1
56-
- name: Setup PHP
57-
uses: shivammathur/setup-php@v2
58-
with:
59-
php-version: ${{ matrix.php }}
60-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
61-
coverage: none
62-
- name: Update laravel version
63-
run: composer require "laravel/framework:5.7.*" "orchestra/testbench:3.7.*" --no-update
64-
- name: Remove some dev dependencies
65-
run: composer remove "ekino/phpstan-banned-code" "nunomaduro/larastan" "phpmd/phpmd" "phpstan/phpstan-deprecation-rules" "sebastian/phpcpd" --dev --no-update
66-
- name: Install composer dependencies
67-
run: composer install --prefer-dist
68-
- name: Run the test suite
69-
run: phpdbg -qrr -dmemory_limit=3G vendor/bin/phpunit
70-
laravel58:
71-
needs: [ analysis ]
43+
laravel8:
44+
needs: [analysis]
7245
runs-on: ubuntu-latest
7346
strategy:
7447
matrix:
75-
php: [ 7.2, 7.3, 7.4 ]
48+
php: [7.4, 8.0, 8.1]
7649
steps:
7750
- uses: actions/checkout@v1
7851
- name: Setup PHP
7952
uses: shivammathur/setup-php@v2
8053
with:
8154
php-version: ${{ matrix.php }}
82-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
55+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
8356
coverage: none
84-
- name: Update laravel version
85-
run: composer require "laravel/framework:5.8.*" "orchestra/testbench:3.8.*" --no-update
57+
- name: Force update laravel version
58+
run: composer require "laravel/framework:^8.0" "orchestra/testbench:^6.0" --no-update
8659
- name: Remove some dev dependencies
8760
run: composer remove "ekino/phpstan-banned-code" "nunomaduro/larastan" "phpmd/phpmd" "phpstan/phpstan-deprecation-rules" "sebastian/phpcpd" --dev --no-update
88-
- name: Install composer dependencies
89-
run: composer install --prefer-dist
90-
- name: Run the test suite
91-
run: phpdbg -qrr -dmemory_limit=3G vendor/bin/phpunit
92-
laravel6:
93-
needs: [ analysis ]
94-
runs-on: ubuntu-latest
95-
strategy:
96-
matrix:
97-
php: [ 7.2, 7.3, 7.4 ]
98-
steps:
99-
- uses: actions/checkout@v1
100-
- name: Setup PHP
101-
uses: shivammathur/setup-php@v2
61+
- name: Cache composer dependencies
62+
uses: actions/cache@v2
63+
env:
64+
cache-name: laravel-gcr-worker-laravel8
10265
with:
103-
php-version: ${{ matrix.php }}
104-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
105-
coverage: none
106-
- name: Update laravel version
107-
run: composer require "laravel/framework:^6.0" "orchestra/testbench:^4.0" --no-update
108-
- name: Remove some dev dependencies
109-
run: composer remove "ekino/phpstan-banned-code" "nunomaduro/larastan" "phpmd/phpmd" "phpstan/phpstan-deprecation-rules" "sebastian/phpcpd" --dev --no-update
66+
path: ~/.composer
67+
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
68+
restore-keys: |
69+
php-${{ matrix.php }}-build-${{ env.cache-name }}-
70+
php-${{ matrix.php }}-build-
71+
php-${{ matrix.php }}-
11072
- name: Install composer dependencies
11173
run: composer install --prefer-dist
11274
- name: Run the test suite
11375
run: phpdbg -qrr -dmemory_limit=3G vendor/bin/phpunit
114-
laravel7:
76+
laravel9:
11577
needs: [ analysis ]
11678
runs-on: ubuntu-latest
11779
strategy:
11880
matrix:
119-
php: [ 7.2, 7.3, 7.4 ]
81+
php: [ 8.1 ]
12082
steps:
12183
- uses: actions/checkout@v1
12284
- name: Setup PHP
12385
uses: shivammathur/setup-php@v2
12486
with:
12587
php-version: ${{ matrix.php }}
126-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
88+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
12789
coverage: none
128-
- name: Update laravel version
129-
run: composer require "laravel/framework:^7.0" "orchestra/testbench:^5.0" --no-update
90+
- name: Force update laravel version
91+
run: composer require "laravel/framework:^9.0" "orchestra/testbench:^7.0" --no-update
13092
- name: Remove some dev dependencies
13193
run: composer remove "ekino/phpstan-banned-code" "nunomaduro/larastan" "phpmd/phpmd" "phpstan/phpstan-deprecation-rules" "sebastian/phpcpd" --dev --no-update
132-
- name: Install composer dependencies
133-
run: composer install --prefer-dist
134-
- name: Run the test suite
135-
run: phpdbg -qrr -dmemory_limit=3G vendor/bin/phpunit
136-
laravel8:
137-
needs: [analysis]
138-
runs-on: ubuntu-latest
139-
strategy:
140-
matrix:
141-
php: [7.4]
142-
steps:
143-
- uses: actions/checkout@v1
144-
- name: Setup PHP
145-
uses: shivammathur/setup-php@v2
94+
- name: Cache composer dependencies
95+
uses: actions/cache@v2
96+
env:
97+
cache-name: laravel-gcr-worker-laravel9
14698
with:
147-
php-version: ${{ matrix.php }}
148-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
149-
coverage: none
150-
- name: Remove some dev dependencies
151-
run: composer remove "ekino/phpstan-banned-code" "nunomaduro/larastan" "phpmd/phpmd" "phpstan/phpstan-deprecation-rules" "sebastian/phpcpd" --dev --no-update
99+
path: ~/.composer
100+
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
101+
restore-keys: |
102+
php-${{ matrix.php }}-build-${{ env.cache-name }}-
103+
php-${{ matrix.php }}-build-
104+
php-${{ matrix.php }}-
152105
- name: Install composer dependencies
153106
run: composer install --prefer-dist
154107
- name: Run the test suite
155108
run: phpdbg -qrr -dmemory_limit=3G vendor/bin/phpunit
156-
laravel8-cov:
109+
laravel9-cov:
157110
needs: [ analysis ]
158111
runs-on: ubuntu-latest
159112
strategy:
@@ -176,8 +129,21 @@ jobs:
176129
uses: shivammathur/setup-php@v2
177130
with:
178131
php-version: ${{ matrix.php }}
179-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
132+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
180133
coverage: none
134+
- name: Force update laravel version
135+
run: composer require "laravel/framework:^9.0" "orchestra/testbench:^7.0" --no-update
136+
- name: Cache composer dependencies
137+
uses: actions/cache@v2
138+
env:
139+
cache-name: laravel-gcr-worker-laravel9cov
140+
with:
141+
path: ~/.composer
142+
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
143+
restore-keys: |
144+
php-${{ matrix.php }}-build-${{ env.cache-name }}-
145+
php-${{ matrix.php }}-build-
146+
php-${{ matrix.php }}-
181147
- name: Install composer dependencies
182148
run: composer install --prefer-dist
183149
- name: Run the Coverage test suite

.phpmd.cleancode.xml

Lines changed: 1 addition & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -67,134 +67,4 @@ class Foo
6767
]]>
6868
</example>
6969
</rule>
70-
71-
<rule name="IfStatementAssignment"
72-
since="2.7.0"
73-
message="Avoid assigning values to variables in if clauses and the like (line '{0}', column '{1}')."
74-
class="PHPMD\Rule\CleanCode\IfStatementAssignment"
75-
externalInfoUrl="http://phpmd.org/rules/cleancode.html#ifstatementassignment">
76-
<description>
77-
<![CDATA[
78-
Assignments in if clauses and the like are considered a code smell.
79-
Assignments in PHP return the right operand as their result.
80-
In many cases, this is an expected behavior, but can lead
81-
to many difficult to spot bugs, especially when the right
82-
operand could result in zero, null or an empty string and the like.
83-
]]>
84-
</description>
85-
<priority>1</priority>
86-
<properties></properties>
87-
<example>
88-
<![CDATA[
89-
class Foo
90-
{
91-
public function bar($flag)
92-
{
93-
if ($foo = 'bar') { // possible typo
94-
// ...
95-
}
96-
if ($baz = 0) { // always false
97-
// ...
98-
}
99-
}
100-
}
101-
]]>
102-
</example>
103-
</rule>
104-
105-
<rule name="DuplicatedArrayKey"
106-
message="Duplicated array key {0}, first declared at line {1}."
107-
class="PHPMD\Rule\CleanCode\DuplicatedArrayKey"
108-
externalInfoUrl="http://phpmd.org/rules/cleancode.html#duplicatedarraykey">
109-
<description>
110-
<![CDATA[
111-
Defining another value for the same key in an array literal overrides the previous key/value,
112-
which makes it effectively an unused code. If it's known from the beginning that the key
113-
will have different value, there is usually no point in defining first one.
114-
]]>
115-
</description>
116-
<priority>2</priority>
117-
<example>
118-
<![CDATA[
119-
function createArray() {
120-
return [
121-
'non-associative 0element', // not applied
122-
0 => 'associative 0-element', // applied
123-
false => 'associative 0-element', // applied
124-
'foo' => 'bar', // not applied
125-
"foo" => 'baz', // applied
126-
];
127-
}
128-
]]>
129-
</example>
130-
</rule>
131-
132-
<rule name="ErrorControlOperator"
133-
message="Remove error control operator '@' on line {0}."
134-
class="PHPMD\Rule\CleanCode\ErrorControlOperator"
135-
externalInfoUrl="http://phpmd.org/rules/cleancode.html#errorcontroloperator">
136-
<description>
137-
<![CDATA[
138-
Error suppression should be avoided if possible as it doesn't just suppress the error, that
139-
you are trying to stop, but will also suppress errors that you didn't predict would ever occur.
140-
Consider changing error_reporting() level and/or setting up your own error handler.
141-
]]>
142-
</description>
143-
<priority>1</priority>
144-
<example>
145-
<![CDATA[
146-
function foo($filePath) {
147-
$file = @fopen($filPath); // hides exceptions
148-
$key = @$array[$notExistingKey]; // assigns null to $key
149-
}
150-
]]>
151-
</example>
152-
</rule>
153-
154-
<rule name="MissingImport"
155-
since="2.7.0"
156-
message="Missing class import via use statement (line '{0}', column '{1}')."
157-
class="PHPMD\Rule\CleanCode\MissingImport"
158-
externalInfoUrl="http://phpmd.org/rules/cleancode.html#MissingImport">
159-
<description>
160-
<![CDATA[
161-
Importing all external classes in a file through use statements makes them clearly visible.
162-
]]>
163-
</description>
164-
<priority>1</priority>
165-
<properties>
166-
<property name="ignore-global" value="false" description="Ignore classes in the global namespace" />
167-
</properties>
168-
<example>
169-
<![CDATA[
170-
function make() {
171-
return new \stdClass();
172-
}
173-
]]>
174-
</example>
175-
</rule>
176-
177-
<rule name="UndefinedVariable"
178-
since="2.8.0"
179-
message="Avoid using undefined variables such as '{0}' which will lead to PHP notices."
180-
class="PHPMD\Rule\CleanCode\UndefinedVariable"
181-
externalInfoUrl="https://phpmd.org/rules/cleancode.html#undefinedvariable">
182-
<description>
183-
Detects when a variable is used that has not been defined before.
184-
</description>
185-
<priority>3</priority>
186-
<example>
187-
<![CDATA[
188-
class Foo
189-
{
190-
private function bar()
191-
{
192-
// $message is undefined
193-
echo $message;
194-
}
195-
}
196-
]]>
197-
</example>
198-
</rule>
199-
200-
</ruleset>
70+
</ruleset>

composer.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,20 @@
1919
"source": "https://github.com/richan-fongdasen/laravel-gcr-worker"
2020
},
2121
"require": {
22-
"php": "^7.2|^8.0",
23-
"illuminate/queue": "5.7.* || 5.8.* || ^6.0 || ^7.0 || ^8.0",
24-
"illuminate/support": "5.7.* || 5.8.* || ^6.0 || ^7.0 || ^8.0",
25-
"kainxspirits/laravel-pubsub-queue": "^0.6"
22+
"php": "^7.4|^8.0",
23+
"illuminate/queue": "^8.0|^9.0",
24+
"illuminate/support": "^8.0|^9.0",
25+
"kainxspirits/laravel-pubsub-queue": "^0.6|^0.7"
2626
},
2727
"require-dev": {
28-
"ekino/phpstan-banned-code": "^0.5",
29-
"mockery/mockery": "^1.3",
30-
"nunomaduro/larastan": "^0.6.1",
31-
"orchestra/testbench": "^6.0 || ^5.0 || ^4.0 || 3.8.* || 3.7.*",
32-
"phpmd/phpmd": "^2.8",
33-
"phpstan/phpstan-deprecation-rules": "^0.12.2",
34-
"phpunit/phpunit": "^9.0 || ^8.0 || ^7.0",
28+
"ekino/phpstan-banned-code": "^1.0",
29+
"mockery/mockery": "^1.4",
30+
"nunomaduro/larastan": "^1.0|^2.0",
31+
"orchestra/testbench": "^6.0|^7.0",
32+
"phpmd/phpmd": "^2.11",
33+
"phpstan/phpstan-deprecation-rules": "^1.0",
34+
"phpstan/phpstan-strict-rules": "^1.0",
35+
"phpunit/phpunit": "^9.5",
3536
"sebastian/phpcpd": "^6.0"
3637
},
3738
"config": {

0 commit comments

Comments
 (0)