diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50cab43..f39ca0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,26 +8,18 @@ jobs: strategy: matrix: - php: [7.3, 7.4, '8.0', 8.1] + php: ['8.0', 8.1, 8.2] lib: + - { laravel: ^11.0 } - { laravel: ^10.0 } - { laravel: ^9.0 } - - { laravel: ^8.0 } - - { laravel: ^7.0 } - - { laravel: ^6.0 } - - { laravel: ^6.0, flags: --prefer-lowest } exclude: - - { php: 8.1, lib: { laravel: ^7.0 } } - - { php: 8.1, lib: { laravel: ^6.0 } } - - { php: 8.1, lib: { laravel: ^6.0, flags: --prefer-lowest } } - { php: 8.0, lib: { laravel: ^10.0 } } - - { php: 7.4, lib: { laravel: ^10.0 } } - - { php: 7.4, lib: { laravel: ^9.0 } } - - { php: 7.3, lib: { laravel: ^10.0 } } - - { php: 7.3, lib: { laravel: ^9.0 } } + - { php: 8.0, lib: { laravel: ^11.0 } } + - { php: 8.1, lib: { laravel: ^11.0 } } steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -35,7 +27,7 @@ jobs: php-version: ${{ matrix.php }} coverage: xdebug - - run: composer require "laravel/framework:${{ matrix.lib.laravel }}" --dev ${{ matrix.lib.flags }} + - run: composer require "laravel/framework:${{ matrix.lib.laravel }}" --dev - run: mkdir -p build/logs - run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml diff --git a/.gitignore b/.gitignore index 1c09582..8eba03e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ +/.idea/ /vendor/ .php_cs.cache -.phpunit.result.cache +/.phpunit.cache/ composer.lock .php_cs phpunit.xml diff --git a/README.md b/README.md index b8f8f61..dfc93f2 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ Apply specific scope for user authentication. ## Requirements -- PHP: `^7.3 || ^8.0` -- Laravel: `^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0` +- PHP: `^8.0` +- Laravel: `^9.0 || ^10.0` ## Installing diff --git a/composer.json b/composer.json index cb0c72b..4136d8f 100644 --- a/composer.json +++ b/composer.json @@ -21,15 +21,15 @@ } }, "require": { - "php": "^7.3 || ^8.0", - "illuminate/auth": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0", - "illuminate/database": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0", - "illuminate/contracts": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0", - "illuminate/support": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0" + "php": "^8.0", + "illuminate/auth": "^9.0 || ^10.0 || ^11.0", + "illuminate/database": "^9.0 || ^10.0 || ^11.0", + "illuminate/contracts": "^9.0 || ^10.0 || ^11.0", + "illuminate/support": "^9.0 || ^10.0 || ^11.0" }, "require-dev": { "orchestra/testbench": "*", - "orchestra/testbench-core": "^4.9 || ^5.9 || >=6.6", + "orchestra/testbench-core": ">=7.0", "phpunit/phpunit": ">=9.5", "mockery/mockery": "^1.3.3 || ^1.4.2" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f3db8cf..e0e3371 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,13 @@ - + + + + src + + ./tests/ - - - src - - diff --git a/src/AuthScopable.php b/src/AuthScopable.php index 8b36518..7da31ad 100644 --- a/src/AuthScopable.php +++ b/src/AuthScopable.php @@ -8,9 +8,6 @@ interface AuthScopable { /** * Add a scope for authentication. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder */ public function scopeForAuthentication(Builder $query): Builder; } diff --git a/src/ScopedAuthServiceProvider.php b/src/ScopedAuthServiceProvider.php index 3bbde2f..10aa69e 100644 --- a/src/ScopedAuthServiceProvider.php +++ b/src/ScopedAuthServiceProvider.php @@ -9,12 +9,7 @@ class ScopedAuthServiceProvider extends ServiceProvider { - /** @noinspection PhpDocMissingThrowsInspection */ - - /** - * @return void - */ - public function register() + public function register(): void { /* @noinspection PhpUnhandledExceptionInspection */ $this->app->resolved(AuthManager::class) @@ -22,11 +17,7 @@ public function register() : $this->app->afterResolving(AuthManager::class, Closure::fromCallable([$this, 'overrideEloquentUserProvider'])); } - /** - * @param \Illuminate\Auth\AuthManager $auth - * @return void - */ - protected function overrideEloquentUserProvider(AuthManager $auth) + protected function overrideEloquentUserProvider(AuthManager $auth): void { $auth->provider('eloquent', function (Container $app, array $config) { return $app->make(ScopedEloquentUserProvider::class, [ diff --git a/src/ScopedEloquentUserProvider.php b/src/ScopedEloquentUserProvider.php index 973ddef..89fbde1 100644 --- a/src/ScopedEloquentUserProvider.php +++ b/src/ScopedEloquentUserProvider.php @@ -3,14 +3,14 @@ namespace Mpyw\ScopedAuth; use Illuminate\Auth\EloquentUserProvider; +use Illuminate\Database\Eloquent\Builder; class ScopedEloquentUserProvider extends EloquentUserProvider { /** - * @param null|\Illuminate\Database\Eloquent\Model $model - * @return \Illuminate\Database\Eloquent\Builder + * @param null|\Illuminate\Database\Eloquent\Model $model */ - public function newModelQuery($model = null) + public function newModelQuery($model = null): Builder { $query = parent::newModelQuery($model); diff --git a/tests/TestCase.php b/tests/TestCase.php index 94e9791..a13cb56 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -11,7 +11,7 @@ class TestCase extends BaseTestCase * @param \Illuminate\Foundation\Application $app * @return array */ - protected function getPackageProviders($app) + protected function getPackageProviders($app): array { return [ ScopedAuthServiceProvider::class,