Skip to content

Commit cd91991

Browse files
authored
Adds php82 support (#3)
* Adds PHP 8.2 support Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
1 parent f13d761 commit cd91991

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

.github/workflows/tests.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
matrix:
1111
os: [ubuntu-latest]
12-
php-version: ['8.0', '8.1']
12+
php-version: ['8.0', '8.1', '8.2']
1313
max-parallel: 4
1414
steps:
1515
- name: Checkout
@@ -18,11 +18,18 @@ jobs:
1818
uses: shivammathur/setup-php@v2
1919
with:
2020
php-version: ${{ matrix.php-version }}
21-
extensions: redis, pdo, pdo_mysql, bcmath, swoole
21+
extensions: redis, pdo, pdo_mysql, bcmath
2222
tools: phpize
2323
coverage: none
2424
- name: Setup Packages
2525
run: composer update -o
26+
- name: Run Cs Fixer
27+
run: |
28+
if [ "${{ matrix.php-version }}" == "8.2" ]; then
29+
PHP_CS_FIXER_IGNORE_ENV=true ./vendor/bin/php-cs-fixer fix $1 --dry-run --diff --verbose --show-progress=dots
30+
else
31+
./vendor/bin/php-cs-fixer fix $1 --dry-run --diff --verbose --show-progress=dots
32+
fi
2633
- name: Run Analyse
2734
run: |
2835
composer analyse src

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
vendor
2-
composer.lock
2+
composer.lock
3+
.bashrc

.php-cs-fixer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848
'author',
4949
],
5050
],
51+
'global_namespace_import' => [
52+
'import_classes' => true,
53+
'import_constants' => true,
54+
'import_functions' => null,
55+
],
5156
'ordered_imports' => [
5257
'imports_order' => [
5358
'class', 'function', 'const',

src/Console/ListCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function handle()
8484
public function transformActionToString($action)
8585
{
8686
if ($action instanceof Closure) {
87-
$action = \Closure::class;
87+
$action = Closure::class;
8888
} elseif (is_object($action)) {
8989
$action = $action::class;
9090
} elseif (is_array($action)) {

src/Trigger.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111
namespace Huangdijia\Trigger;
1212

13+
use Closure;
1314
use Exception;
1415
use Illuminate\Container\Container;
1516
use Illuminate\Contracts\Queue\ShouldQueue;
@@ -210,7 +211,7 @@ public function clearCurrent()
210211
/**
211212
* Bind events.
212213
*/
213-
public function on(string $table, array|string $eventType, array|callable|\Closure|string $action = null): void
214+
public function on(string $table, array|string $eventType, array|callable|Closure|string $action = null): void
214215
{
215216
// table as db.tb1,db.tb2,...
216217
if (str_contains($table, ',')) {
@@ -230,7 +231,7 @@ public function on(string $table, array|string $eventType, array|callable|\Closu
230231
// default database
231232
$table = ltrim($table, '.');
232233
if (! str_contains($table, '.')) { // table to database.table
233-
$table = sprintf('%s.%s', ($this->config['databases'][0] ?? '*'), $table);
234+
$table = sprintf('%s.%s', $this->config['databases'][0] ?? '*', $table);
234235
} elseif (substr($table, -1) == '.') { // database. to database.*
235236
$table .= '*';
236237
}

0 commit comments

Comments
 (0)