From 5aa952b4e0647542396895f6f340cc9019b7d975 Mon Sep 17 00:00:00 2001 From: Dobando <1692898084@qq.com> Date: Tue, 29 Oct 2024 14:21:41 +0800 Subject: [PATCH] BREAKING CHANGE: upgrade to PHP 8.0 and PHP-Casbin 4.0 --- .github/workflows/build.yml | 2 +- composer.json | 9 +++++---- src/Adapter.php | 14 +++++++------- tests/DebugStackLogger.php | 1 - 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f5985a9..d6c1a48 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: true matrix: - php: [ 7.1, 7.2, 7.3, 7.4, 8.0 ] + php: [ 8.0, 8.1, 8.2, 8.3 ] stability: [ prefer-lowest, prefer-stable ] name: PHP ${{ matrix.php }} - ${{ matrix.stability }} diff --git a/composer.json b/composer.json index f8eb2f1..4927c19 100644 --- a/composer.json +++ b/composer.json @@ -18,12 +18,13 @@ ], "license": "Apache-2.0", "require": { - "casbin/casbin": "^3.0", - "doctrine/dbal": "^2.9|^3.0|^4.0" + "php": ">=8.0", + "casbin/casbin": "^4.0", + "doctrine/dbal": "^3.9|^4.0" }, "require-dev": { - "phpunit/phpunit": "~7.0|~8.0", - "php-coveralls/php-coveralls": "^2.1" + "phpunit/phpunit": "~9.0", + "php-coveralls/php-coveralls": "^2.7" }, "autoload": { "psr-4": { diff --git a/src/Adapter.php b/src/Adapter.php index 4edd087..17ffcf3 100644 --- a/src/Adapter.php +++ b/src/Adapter.php @@ -102,13 +102,13 @@ public function initTable() $schema = new Schema(); $table = $schema->createTable($this->policyTableName); $table->addColumn('id', 'integer', array('autoincrement' => true)); - $table->addColumn('p_type', 'string', ['notnull' => false]); - $table->addColumn('v0', 'string', ['notnull' => false]); - $table->addColumn('v1', 'string', ['notnull' => false]); - $table->addColumn('v2', 'string', ['notnull' => false]); - $table->addColumn('v3', 'string', ['notnull' => false]); - $table->addColumn('v4', 'string', ['notnull' => false]); - $table->addColumn('v5', 'string', ['notnull' => false]); + $table->addColumn('p_type', 'string', ['notnull' => false, 'length' => 32]); + $table->addColumn('v0', 'string', ['notnull' => false, 'length' => 255]); + $table->addColumn('v1', 'string', ['notnull' => false, 'length' => 255]); + $table->addColumn('v2', 'string', ['notnull' => false, 'length' => 255]); + $table->addColumn('v3', 'string', ['notnull' => false, 'length' => 255]); + $table->addColumn('v4', 'string', ['notnull' => false, 'length' => 255]); + $table->addColumn('v5', 'string', ['notnull' => false, 'length' => 255]); $table->setPrimaryKey(['id']); $sm->createTable($table); } diff --git a/tests/DebugStackLogger.php b/tests/DebugStackLogger.php index 3959c69..18be40d 100644 --- a/tests/DebugStackLogger.php +++ b/tests/DebugStackLogger.php @@ -3,7 +3,6 @@ namespace CasbinAdapter\DBAL\Tests; -use Doctrine\DBAL\Logging\DebugStack; use Doctrine\DBAL\Logging\SQLLogger; class DebugStackLogger implements SQLLogger