Skip to content

Commit

Permalink
BREAKING CHANGE: upgrade to PHP 8.0 and PHP-Casbin 4.0 (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobmod authored Oct 28, 2024
1 parent 434ee80 commit a050a9c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 82 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,73 +27,7 @@ jobs:
# laravel: [ ]
# stability: [ prefer-lowest, prefer-stable ]
include:
# Laravel 5.5
- php: 7.1
laravel: 5.5.*
phpunit: ~6.0
- php: 7.2
laravel: 5.5.*
phpunit: ~6.0
- php: 7.3
laravel: 5.5.*
phpunit: ~6.0

# Laravel 5.6
- php: 7.1
laravel: 5.6.*
phpunit: ~7.0
- php: 7.2
laravel: 5.6.*
phpunit: ~7.0
- php: 7.3
laravel: 5.6.*
phpunit: ~7.0

# Laravel 5.7
- php: 7.1
laravel: 5.7.*
phpunit: ~7.5
- php: 7.2
laravel: 5.7.*
phpunit: ~7.5
- php: 7.3
laravel: 5.7.*
phpunit: ~7.5

# Laravel 5.8
- php: 7.1
laravel: 5.8.*
phpunit: ~7.5
- php: 7.2
laravel: 5.8.*
phpunit: ~8.0
- php: 7.3
laravel: 5.8.*
phpunit: ~8.0

# Laravel 6.x
- php: 7.2
laravel: 6.*
phpunit: ~8.0
- php: 7.3
laravel: 6.*
phpunit: ~8.0

# Laravel 7.x
- php: 7.3
laravel: 7.*
phpunit: ~9.0
- php: 7.4
laravel: 7.*
phpunit: ~9.0

# Laravel 8.x
- php: 7.3
laravel: 8.*
phpunit: ~9.0
- php: 7.4
laravel: 8.*
phpunit: ~9.0
- php: 8.0
laravel: 8.*
phpunit: ~9.0
Expand Down
17 changes: 8 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@
],
"license": "Apache-2.0",
"require": {
"php": ">=7.1.0",
"illuminate/support": "~5.5|~6.0|~7.0|~8.0|~9.0|~10.0|~11.0",
"illuminate/database": "~5.5|~6.0|~7.0|~8.0|~9.0|~10.0|~11.0",
"illuminate/console": "~5.5|~6.0|~7.0|~8.0|~9.0|~10.0|~11.0",
"casbin/casbin": "~3.1",
"casbin/psr3-bridge": "^1.1"
"php": ">=8.0",
"illuminate/support": "~8.0|~9.0|~10.0|~11.0",
"illuminate/database": "~8.0|~9.0|~10.0|~11.0",
"illuminate/console": "~8.0|~9.0|~10.0|~11.0",
"casbin/casbin": "~4.0"
},
"require-dev": {
"phpunit/phpunit": "~7.0|~8.0|~9.0|~10.5",
"php-coveralls/php-coveralls": "^2.4",
"phpunit/phpunit": "~9.0|~10.5",
"php-coveralls/php-coveralls": "^2.7",
"mockery/mockery": "^1.0",
"laravel/laravel": "~5.5|~6.0|~7.0|~8.0|~9.0|~10.0|~11.0"
"laravel/laravel": "~9.0|~10.0|~11.0"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 4 additions & 4 deletions src/EnforcerManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Lauthz;

use Casbin\Bridge\Logger\LoggerBridge;
use Casbin\Enforcer;
use Casbin\Model\Model;
use Casbin\Log\Log;
use Casbin\Log\Logger\DefaultLogger;
use Lauthz\Contracts\Factory;
use Lauthz\Models\Rule;
use Illuminate\Support\Arr;
Expand Down Expand Up @@ -80,10 +80,10 @@ protected function resolve($name)

if ($logger = Arr::get($config, 'log.logger')) {
if (is_string($logger)) {
$logger = $this->app->make($logger);
$logger = new DefaultLogger($this->app->make($logger));
}

Log::setLogger(new LoggerBridge($logger));
Log::setLogger($logger);
}

$model = new Model();
Expand All @@ -98,7 +98,7 @@ protected function resolve($name)
]);
}

return new Enforcer($model, $adapter, Arr::get($config, 'log.enabled', false));
return new Enforcer($model, $adapter, $logger, Arr::get($config, 'log.enabled', false));
}

/**
Expand Down
4 changes: 1 addition & 3 deletions tests/DatabaseAdapterForCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

namespace Lauthz\Tests;

use Enforcer;
use Lauthz\Models\Rule;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Casbin\Persist\Adapters\Filter;
use Casbin\Exceptions\InvalidFilterTypeException;
use Lauthz\Facades\Enforcer;

class DatabaseAdapterForCacheTest extends TestCase
{
Expand Down

0 comments on commit a050a9c

Please sign in to comment.