Skip to content

Commit

Permalink
chore: 🤖 Drop support for stale version
Browse files Browse the repository at this point in the history
  • Loading branch information
mpyw committed Mar 13, 2023
1 parent 0bf9ba7 commit 25ef1eb
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 56 deletions.
20 changes: 6 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,26 @@ 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
with:
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

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/.idea/
/vendor/
.php_cs.cache
.phpunit.result.cache
/.phpunit.cache/
composer.lock
.php_cs
phpunit.xml
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
21 changes: 6 additions & 15 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
bootstrap="vendor/autoload.php"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
3 changes: 0 additions & 3 deletions src/AuthScopable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
13 changes: 2 additions & 11 deletions src/ScopedAuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,15 @@

class ScopedAuthServiceProvider extends ServiceProvider
{
/** @noinspection PhpDocMissingThrowsInspection */

/**
* @return void
*/
public function register()
public function register(): void
{
/* @noinspection PhpUnhandledExceptionInspection */
$this->app->resolved(AuthManager::class)
? static::overrideEloquentUserProvider($this->app->make(AuthManager::class)) // @codeCoverageIgnore
: $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, [
Expand Down
6 changes: 3 additions & 3 deletions src/ScopedEloquentUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 25ef1eb

Please sign in to comment.