Skip to content

Commit

Permalink
chore: 🤖 Drop support for stale versions
Browse files Browse the repository at this point in the history
  • Loading branch information
mpyw committed Mar 13, 2023
1 parent 314c28f commit 458fbaf
Show file tree
Hide file tree
Showing 19 changed files with 57 additions and 130 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,15 @@ 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
Expand All @@ -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

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.idea/
/vendor/
.php_cs.cache
.phpunit.result.cache
/.phpunit.cache/
composer.lock
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Null Guard for Laravel. Designed for Middleware-based authentication and testing

## 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
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
}
},
"require": {
"php": "^7.3 || ^8.0",
"illuminate/auth": "^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/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
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>
10 changes: 3 additions & 7 deletions src/Concerns/GuardsNothing.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,24 @@
namespace Mpyw\NullAuth\Concerns;

use Illuminate\Auth\GuardHelpers;
use Illuminate\Contracts\Auth\Authenticatable;

trait GuardsNothing
{
use GuardHelpers;

/**
* Get the currently authenticated user.
*
* @return null|\Illuminate\Contracts\Auth\Authenticatable
*/
public function user()
public function user(): ?Authenticatable
{
return $this->user;
}

/**
* Validate a user's credentials.
*
* @param array $credentials
* @return bool
*/
public function validate(array $credentials = [])
public function validate(array $credentials = []): bool
{
return false;
}
Expand Down
8 changes: 2 additions & 6 deletions src/Concerns/HasEloquentIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,16 @@ trait HasEloquentIdentifier
{
/**
* Get the name of the unique identifier for the user.
*
* @return string
*/
public function getAuthIdentifierName()
public function getAuthIdentifierName(): string
{
return $this->getKeyName();
}

/**
* Get the unique identifier for the user.
*
* @return mixed
*/
public function getAuthIdentifier()
public function getAuthIdentifier(): mixed
{
return $this->{$this->getKeyName()};
}
Expand Down
4 changes: 1 addition & 3 deletions src/Concerns/HasEloquentPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ trait HasEloquentPassword
{
/**
* Get the unique identifier for the user.
*
* @return mixed
*/
public function getAuthPassword()
public function getAuthPassword(): mixed
{
return $this->getAttribute('password');
}
Expand Down
29 changes: 9 additions & 20 deletions src/Concerns/ProvidesNothing.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,56 +9,45 @@ trait ProvidesNothing
/**
* Retrieve a user by their unique identifier.
*
* @param mixed $identifier
* @return null|\Illuminate\Contracts\Auth\Authenticatable
* @param mixed $identifier
*/
public function retrieveById($identifier)
public function retrieveById($identifier): ?Authenticatable
{
return null;
}

/**
* Retrieve a user by their unique identifier and "remember me" token.
*
* @param mixed $identifier
* @param string $token
* @return null|\Illuminate\Contracts\Auth\Authenticatable
* @param mixed $identifier
* @param string $token
*/
public function retrieveByToken($identifier, $token)
public function retrieveByToken($identifier, $token): ?Authenticatable
{
return null;
}

/**
* Update the "remember me" token for the given user in storage.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param string $token
* @return void
* @param string $token
*/
public function updateRememberToken(Authenticatable $user, $token)
public function updateRememberToken(Authenticatable $user, $token): void
{
}

/**
* Retrieve a user by the given credentials.
*
* @param array $credentials
* @return null|\Illuminate\Contracts\Auth\Authenticatable
*/
public function retrieveByCredentials(array $credentials)
public function retrieveByCredentials(array $credentials): ?Authenticatable
{
return null;
}

/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Contracts\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(Authenticatable $user, array $credentials)
public function validateCredentials(Authenticatable $user, array $credentials): bool
{
return false;
}
Expand Down
8 changes: 2 additions & 6 deletions src/Concerns/RequiresIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@ trait RequiresIdentifier
{
/**
* Get the name of the unique identifier for the user.
*
* @return string
*/
abstract public function getAuthIdentifierName();
abstract public function getAuthIdentifierName(): string;

/**
* Get the unique identifier for the user.
*
* @return mixed
*/
abstract public function getAuthIdentifier();
abstract public function getAuthIdentifier(): mixed;
}
17 changes: 5 additions & 12 deletions src/GenericNullAuthenticatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,33 @@ trait GenericNullAuthenticatable

/**
* Get the password for the user.
*
* @return string
*/
public function getAuthPassword()
public function getAuthPassword(): string
{
return '';
}

/**
* Get the token value for the "remember me" session.
*
* @return string
*/
public function getRememberToken()
public function getRememberToken(): string
{
return '';
}

/**
* Set the token value for the "remember me" session.
*
* @param string $value
* @return void
* @param string $value
*/
public function setRememberToken($value)
public function setRememberToken($value): void
{
}

/**
* Get the column name for the "remember me" token.
*
* @return string
*/
public function getRememberTokenName()
public function getRememberTokenName(): string
{
return '';
}
Expand Down
12 changes: 4 additions & 8 deletions src/GenericStrictNullAuthenticatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,16 @@ trait GenericStrictNullAuthenticatable

/**
* Get the password for the user.
*
* @return string
*/
public function getAuthPassword()
public function getAuthPassword(): string
{
throw new BadMethodCallException('Not implemented');
}

/**
* Get the token value for the "remember me" session.
*
* @return string
*/
public function getRememberToken()
public function getRememberToken(): string
{
throw new BadMethodCallException('Not implemented');
}
Expand All @@ -33,7 +29,7 @@ public function getRememberToken()
*
* @param string $value
*/
public function setRememberToken($value)
public function setRememberToken($value): void
{
throw new BadMethodCallException('Not implemented');
}
Expand All @@ -43,7 +39,7 @@ public function setRememberToken($value)
*
* @return string
*/
public function getRememberTokenName()
public function getRememberTokenName(): string
{
throw new BadMethodCallException('Not implemented');
}
Expand Down
13 changes: 2 additions & 11 deletions src/NullAuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,15 @@

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

/**
* @return void
*/
public function register()
public function register(): void
{
/* @noinspection PhpUnhandledExceptionInspection */
$this->app->resolved(AuthManager::class)
? static::extendComponents($this->app->make(AuthManager::class)) // @codeCoverageIgnore
: $this->app->afterResolving(AuthManager::class, Closure::fromCallable([$this, 'extendComponents']));
}

/**
* @param \Illuminate\Auth\AuthManager $auth
* @return void
*/
protected function extendComponents(AuthManager $auth)
protected function extendComponents(AuthManager $auth): void
{
$auth->extend('null', function (Container $app, string $name, array $config) use ($auth) {
$guard = new NullGuard();
Expand Down
2 changes: 1 addition & 1 deletion src/UnsetsUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait UnsetsUser
*
* @return $this
*/
public function unsetUser()
public function unsetUser(): static
{
$this->user = null;

Expand Down
5 changes: 2 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
class TestCase extends BaseTestCase
{
/**
* @param \Illuminate\Foundation\Application $app
* @return array
* @param \Illuminate\Foundation\Application $app
*/
protected function getPackageProviders($app)
protected function getPackageProviders($app): array
{
return [
NullAuthServiceProvider::class,
Expand Down
Loading

0 comments on commit 458fbaf

Please sign in to comment.