From 7e2b98083db0341a45f46f6e416d48b60f2fc3c4 Mon Sep 17 00:00:00 2001 From: KonstantinPopov Date: Mon, 3 Jul 2023 10:32:43 +0200 Subject: [PATCH] Added support Laravel 10 framework and php8.1 added support laravel 10 added support phpunit 10 added requires php8.1|8.2 --- .gitignore | 2 +- composer.json | 3 +- phpunit.xml.dist | 14 ++++------ src/Laravel/SessionGuard.php | 54 ++++++------------------------------ 4 files changed, 17 insertions(+), 56 deletions(-) diff --git a/.gitignore b/.gitignore index 539a1df..04f7120 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ composer.lock tests/Fixtures/Symfony/cache tests/Fixtures/Symfony/logs tests/Fixtures/Symfony/var -.phpunit.result.cache +.phpunit.cache diff --git a/composer.json b/composer.json index af1935c..33139bf 100644 --- a/composer.json +++ b/composer.json @@ -3,13 +3,14 @@ "description": "PHP-PM adapter for Symfony HTTPKernel.", "license": "MIT", "require": { + "php": "^8.1|^8.2", "php-pm/php-pm": "^2.0", "symfony/http-foundation": "^4.2.12|^5.0.4|^6.0", "symfony/http-kernel": "^4.0|^5.1.5|^6.0", "guzzlehttp/psr7": "^1.5|^2.0" }, "require-dev": { - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^9.5|^10.2", "symfony/framework-bundle": "^4.1.12|^5.0|^6.0", "symfony/yaml": "^4.0|^5.0|^6.0", "doctrine/annotations": "^1.6" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6bb5742..647a8f3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,19 +1,17 @@ - - tests/ - - \ No newline at end of file + diff --git a/src/Laravel/SessionGuard.php b/src/Laravel/SessionGuard.php index ccdf17e..db283d4 100644 --- a/src/Laravel/SessionGuard.php +++ b/src/Laravel/SessionGuard.php @@ -9,45 +9,22 @@ class SessionGuard extends \Illuminate\Auth\SessionGuard { + protected Application $app; - /** - * App instance - * - * @var mixed|\Illuminate\Foundation\Application $app - */ - protected $app; - - /** - * Create a new authentication guard. - * - * @param string $name - * @param \Illuminate\Contracts\Auth\UserProvider $provider - * @param \Illuminate\Contracts\Session\Session $session - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Illuminate\Foundation\Application $app - * @return void - */ public function __construct( - $name, + public readonly string $name, UserProvider $provider, Session $session, Request $request = null, Application $app ) { - $this->name = $name; $this->session = $session; $this->request = $request; $this->provider = $provider; $this->app = $app; } - /** - * Set the current request instance. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @return $this - */ - public function setRequest(Request $request) + public function setRequest(Request $request): self { // reset the current state $this->reset(); @@ -57,33 +34,18 @@ public function setRequest(Request $request) return parent::setRequest($request); } - - /** - * Get a unique identifier for the auth session value. - * - * @return string - */ - public function getName() + + public function getName(): string { return 'login_'.$this->name.'_'.sha1(parent::class); } - /** - * Get the name of the cookie used to store the "recaller". - * - * @return string - */ - public function getRecallerName() + public function getRecallerName(): string { return 'remember_'.$this->name.'_'.sha1(parent::class); } - - /** - * Reset the state of current class instance. - * - * @return void - */ - protected function reset() + + protected function reset(): void { $this->user = null; $this->lastAttempted = null;