From 8edb09c1f03789e2b0e55db4e3069aa141fe14fa Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Sun, 21 Jun 2026 00:10:54 -0400 Subject: [PATCH 01/10] allow to use league/oauth2-google without leafs/leaf --- src/Auth.php | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/Auth.php b/src/Auth.php index 2d4b3ee..32765b2 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -99,21 +99,36 @@ public function __construct() } if ( - class_exists('League\OAuth2\Client\Provider\Google') && - _env('GOOGLE_AUTH_CLIENT_ID') && - _env('GOOGLE_AUTH_CLIENT_SECRET') + $this->env('GOOGLE_AUTH_CLIENT_ID') + && $this->env('GOOGLE_AUTH_CLIENT_SECRET') + && class_exists(Google::class) ) { $this->withGoogle( - _env('GOOGLE_AUTH_CLIENT_ID'), - _env('GOOGLE_AUTH_CLIENT_SECRET'), + $this->env('GOOGLE_AUTH_CLIENT_ID'), + $this->env('GOOGLE_AUTH_CLIENT_SECRET'), [ 'name' => 'google', - 'redirectUri' => _env('GOOGLE_AUTH_REDIRECT_URI', _env('APP_URL') . '/auth/register/google'), + 'redirectUri' => $this->env( + 'GOOGLE_AUTH_REDIRECT_URI', + $this->env('APP_URL') . '/auth/register/google' + ), ] ); } } + /** @return mixed Returns the value of the environment variable by using Leaf's `_env` primarily */ + private function env(string $name, $default = false) + { + // If `_env` function of Leaf is defined, use it. + if (function_exists('_env')) { + return _env($name, $default); + } + + // Return the value if found, otherwise false like getenv(). + return $_ENV[$name] ?? $default; + } + /** * Connect leaf auth to the database * @param array{ @@ -171,7 +186,7 @@ public function dbConnection(PDO $connection) * @param array{ * name?: string, * redirectUri?: string, - * } $options + * } $options If `$options['redirectUri']` is not set, it will default to `$_ENV['APP_URL']/auth/google/callback` * @return static */ public function withGoogle( @@ -184,7 +199,7 @@ public function withGoogle( unset($options['name']); if (!isset($options['redirectUri'])) { - $options['redirectUri'] = _env('APP_URL') . '/auth/google/callback'; + $options['redirectUri'] = $this->env('APP_URL') . '/auth/google/callback'; } $this->withProvider($clientName, new Google(array_merge([ From 6f20141468689bb65aebffe0c251e48797acc253 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Sun, 21 Jun 2026 10:17:04 -0400 Subject: [PATCH 02/10] improve Auth@withGoogle $options param docblock Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/Auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Auth.php b/src/Auth.php index 32765b2..096791f 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -186,7 +186,7 @@ public function dbConnection(PDO $connection) * @param array{ * name?: string, * redirectUri?: string, - * } $options If `$options['redirectUri']` is not set, it will default to `$_ENV['APP_URL']/auth/google/callback` + * } $options If `$options['redirectUri']` is not set, it will default to the value of `APP_URL` (as resolved by this class's environment helper) with `/auth/google/callback` appended; if `APP_URL` is unset or empty, the default will be `/auth/google/callback`. * @return static */ public function withGoogle( From 1b2e05beef05ff2f09a1656f35e713ac22bfaea6 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Sun, 21 Jun 2026 10:20:47 -0400 Subject: [PATCH 03/10] update Auth@env return comment --- src/Auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Auth.php b/src/Auth.php index 096791f..0549615 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -125,7 +125,7 @@ private function env(string $name, $default = false) return _env($name, $default); } - // Return the value if found, otherwise false like getenv(). + // Return the value if found, otherwise $default. return $_ENV[$name] ?? $default; } From e2e928c1f0ca23919d005b3ac0dfe1becb0c6ec4 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Sun, 21 Jun 2026 10:59:35 -0400 Subject: [PATCH 04/10] ignore sublime text files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 536447e..2feccb3 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,9 @@ Thumbs.db # phpstorm .idea/* +# sublime text +*.sublime-* + # Alchemy .alchemy .phpunit.result.cache From 9db70c72fb5216212697c9b7ec88081732f7bfa6 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Sun, 21 Jun 2026 11:03:34 -0400 Subject: [PATCH 05/10] exclude tests in phpstan --- phpstan-baseline.neon | 475 ------------------------------------------ phpstan.dist.neon | 4 +- 2 files changed, 3 insertions(+), 476 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index b7260f7..e69de29 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,475 +0,0 @@ -parameters: - ignoreErrors: - - - rawMessage: Access to an undefined property Leaf\Auth\User::$email. - identifier: property.notFound - count: 1 - path: src/Auth.php - - - - rawMessage: 'Variable $credentials in isset() is never defined.' - identifier: isset.variable - count: 2 - path: src/Auth.php - - - - rawMessage: 'Function createTableForUsers() has parameter $table with no type specified.' - identifier: missingType.parameter - count: 1 - path: tests/Pest.php - - - - rawMessage: 'Function deleteUser() has no return type specified.' - identifier: missingType.return - count: 1 - path: tests/Pest.php - - - - rawMessage: 'Function deleteUser() has parameter $table with no type specified.' - identifier: missingType.parameter - count: 1 - path: tests/Pest.php - - - - rawMessage: 'Function getDatabaseConnection() return type has no value type specified in iterable type array.' - identifier: missingType.iterableValue - count: 1 - path: tests/Pest.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::not().' - identifier: method.notFound - count: 1 - path: tests/login.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBe().' - identifier: method.notFound - count: 4 - path: tests/login.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeFalse().' - identifier: method.notFound - count: 2 - path: tests/login.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeInstanceOf().' - identifier: method.notFound - count: 2 - path: tests/login.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeNull().' - identifier: method.notFound - count: 2 - path: tests/login.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeString().' - identifier: method.notFound - count: 2 - path: tests/login.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeTrue().' - identifier: method.notFound - count: 3 - path: tests/login.test.php - - - - rawMessage: 'Call to method not() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 1 - path: tests/login.test.php - - - - rawMessage: 'Call to method toBe() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 4 - path: tests/login.test.php - - - - rawMessage: 'Call to method toBeFalse() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 2 - path: tests/login.test.php - - - - rawMessage: 'Call to method toBeInstanceOf() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 2 - path: tests/login.test.php - - - - rawMessage: 'Call to method toBeNull() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 2 - path: tests/login.test.php - - - - rawMessage: 'Call to method toBeNull() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 1 - path: tests/login.test.php - - - - rawMessage: 'Call to method toBeString() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 2 - path: tests/login.test.php - - - - rawMessage: 'Call to method toBeTrue() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 3 - path: tests/login.test.php - - - - rawMessage: Cannot access property $accessToken on object|null. - identifier: property.nonObject - count: 1 - path: tests/login.test.php - - - - rawMessage: Cannot access property $refreshToken on object|null. - identifier: property.nonObject - count: 1 - path: tests/login.test.php - - - - rawMessage: Cannot access property $username on Leaf\Auth\User|null. - identifier: property.nonObject - count: 2 - path: tests/login.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::not().' - identifier: method.notFound - count: 1 - path: tests/register.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBe().' - identifier: method.notFound - count: 3 - path: tests/register.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeFalse().' - identifier: method.notFound - count: 1 - path: tests/register.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeInstanceOf().' - identifier: method.notFound - count: 2 - path: tests/register.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeTrue().' - identifier: method.notFound - count: 6 - path: tests/register.test.php - - - - rawMessage: 'Call to method not() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 1 - path: tests/register.test.php - - - - rawMessage: 'Call to method toBe() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 3 - path: tests/register.test.php - - - - rawMessage: 'Call to method toBe() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 1 - path: tests/register.test.php - - - - rawMessage: 'Call to method toBeFalse() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 1 - path: tests/register.test.php - - - - rawMessage: 'Call to method toBeInstanceOf() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 2 - path: tests/register.test.php - - - - rawMessage: 'Call to method toBeTrue() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 6 - path: tests/register.test.php - - - - rawMessage: Cannot access property $password on Leaf\Auth\User|null. - identifier: property.nonObject - count: 2 - path: tests/register.test.php - - - - rawMessage: Cannot access property $username on Leaf\Auth\User|null. - identifier: property.nonObject - count: 2 - path: tests/register.test.php - - - - rawMessage: 'Undefined variable: $this' - identifier: variable.undefined - count: 1 - path: tests/register.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::not().' - identifier: method.notFound - count: 1 - path: tests/session.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBe().' - identifier: method.notFound - count: 20 - path: tests/session.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeGreaterThan().' - identifier: method.notFound - count: 1 - path: tests/session.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeInstanceOf().' - identifier: method.notFound - count: 8 - path: tests/session.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeNull().' - identifier: method.notFound - count: 6 - path: tests/session.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeTrue().' - identifier: method.notFound - count: 8 - path: tests/session.test.php - - - - rawMessage: 'Call to method not() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 1 - path: tests/session.test.php - - - - rawMessage: 'Call to method toBe() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 20 - path: tests/session.test.php - - - - rawMessage: 'Call to method toBe() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 1 - path: tests/session.test.php - - - - rawMessage: 'Call to method toBeGreaterThan() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 1 - path: tests/session.test.php - - - - rawMessage: 'Call to method toBeInstanceOf() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 8 - path: tests/session.test.php - - - - rawMessage: 'Call to method toBeNull() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 6 - path: tests/session.test.php - - - - rawMessage: 'Call to method toBeTrue() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 8 - path: tests/session.test.php - - - - rawMessage: Cannot access property $username on Leaf\Auth\User|null. - identifier: property.nonObject - count: 6 - path: tests/session.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBe().' - identifier: method.notFound - count: 5 - path: tests/table.test.php - - - - rawMessage: 'Call to method toBe() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 5 - path: tests/table.test.php - - - - rawMessage: Cannot access offset 'user' on bool. - identifier: offsetAccess.nonOffsetAccessible - count: 3 - path: tests/table.test.php - - - - rawMessage: Cannot access property $username on Leaf\Auth\User|null. - identifier: property.nonObject - count: 2 - path: tests/table.test.php - - - - rawMessage: Function createUsersTable not found. - identifier: function.notFound - count: 1 - path: tests/table.test.php - - - - rawMessage: 'Undefined variable: $this' - identifier: variable.undefined - count: 5 - path: tests/table.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::not().' - identifier: method.notFound - count: 2 - path: tests/update.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBe().' - identifier: method.notFound - count: 3 - path: tests/update.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeFalse().' - identifier: method.notFound - count: 1 - path: tests/update.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeTrue().' - identifier: method.notFound - count: 1 - path: tests/update.test.php - - - - rawMessage: 'Call to method not() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 2 - path: tests/update.test.php - - - - rawMessage: 'Call to method toBe() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 3 - path: tests/update.test.php - - - - rawMessage: 'Call to method toBe() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 2 - path: tests/update.test.php - - - - rawMessage: 'Call to method toBeFalse() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 1 - path: tests/update.test.php - - - - rawMessage: 'Call to method toBeTrue() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 1 - path: tests/update.test.php - - - - rawMessage: Cannot access property $username on Leaf\Auth\User|null. - identifier: property.nonObject - count: 2 - path: tests/update.test.php - - - - rawMessage: 'Undefined variable: $this' - identifier: variable.undefined - count: 7 - path: tests/update.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBe().' - identifier: method.notFound - count: 2 - path: tests/user.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeInstanceOf().' - identifier: method.notFound - count: 3 - path: tests/user.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeNull().' - identifier: method.notFound - count: 1 - path: tests/user.test.php - - - - rawMessage: 'Call to an undefined method Pest\Expectation|Pest\Support\Extendable::toBeTrue().' - identifier: method.notFound - count: 2 - path: tests/user.test.php - - - - rawMessage: 'Call to method toBe() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 2 - path: tests/user.test.php - - - - rawMessage: 'Call to method toBeInstanceOf() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 3 - path: tests/user.test.php - - - - rawMessage: 'Call to method toBeNull() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 1 - path: tests/user.test.php - - - - rawMessage: 'Call to method toBeTrue() of internal class Pest\Expectation from outside its root namespace Pest.' - identifier: method.internalClass - count: 2 - path: tests/user.test.php - - - - rawMessage: Cannot access property $username on Leaf\Auth\User|null. - identifier: property.nonObject - count: 2 - path: tests/user.test.php - - - - rawMessage: 'Undefined variable: $this' - identifier: variable.undefined - count: 2 - path: tests/user.test.php diff --git a/phpstan.dist.neon b/phpstan.dist.neon index c275599..059070d 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -3,8 +3,10 @@ includes: - phpstan-baseline.neon parameters: + excludePaths: + - tests level: 8 paths: - src - - tests + reportUnmatchedIgnoredErrors: true treatPhpDocTypesAsCertain: false From 20bd1141b8344f4de01afa105328fcaddd18f8e9 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Sun, 21 Jun 2026 11:03:58 -0400 Subject: [PATCH 06/10] add tests for google client without app --- tests/google.test.php | 96 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 tests/google.test.php diff --git a/tests/google.test.php b/tests/google.test.php new file mode 100644 index 0000000..e007b2f --- /dev/null +++ b/tests/google.test.php @@ -0,0 +1,96 @@ + '{google-auth-client-id}', + 'GOOGLE_AUTH_CLIENT_SECRET' => '{google-auth-client-secret}', + 'GOOGLE_AUTH_REDIRECT_URI' => '{google-auth-redirect-uri}', + 'APP_URL' => 'http://localhost', + ]; + + $auth = new Auth(); + $google = $auth->client('google'); + assert($google instanceof Google); + + $reflectionClass = new ReflectionClass(Google::class); + $clientId = $reflectionClass->getProperty('clientId'); + $clientSecret = $reflectionClass->getProperty('clientSecret'); + $redirectUri = $reflectionClass->getProperty('redirectUri'); + + $clientId->setAccessible(true); + $clientSecret->setAccessible(true); + $redirectUri->setAccessible(true); + + expect($clientId->getValue($google)) + ->toBe($_ENV['GOOGLE_AUTH_CLIENT_ID']); + + expect($clientSecret->getValue($google)) + ->toBe($_ENV['GOOGLE_AUTH_CLIENT_SECRET']); + + expect($redirectUri->getValue($google)) + ->toBe($_ENV['GOOGLE_AUTH_REDIRECT_URI']); + }); + + test('use APP_URL in __construct', function (): void { + $_ENV = [ + 'GOOGLE_AUTH_CLIENT_ID' => '{google-auth-client-id}', + 'GOOGLE_AUTH_CLIENT_SECRET' => '{google-auth-client-secret}', + 'APP_URL' => 'http://localhost', + ]; + + $auth = new Auth(); + $google = $auth->client('google'); + assert($google instanceof Google); + + $reflectionClass = new ReflectionClass(Google::class); + $redirectUri = $reflectionClass->getProperty('redirectUri'); + + $redirectUri->setAccessible(true); + + expect($redirectUri->getValue($google)) + ->toBe("{$_ENV['APP_URL']}/auth/register/google"); + }); + + test('use APP_URL in withGoogle without redirectUri', function (): void { + $_ENV = [ + 'APP_URL' => 'http://localhost', + ]; + + $auth = new Auth(); + $google = $auth->withGoogle('', '')->client('google'); + assert($google instanceof Google); + + $reflectionClass = new ReflectionClass(Google::class); + $redirectUri = $reflectionClass->getProperty('redirectUri'); + + $redirectUri->setAccessible(true); + + expect($redirectUri->getValue($google)) + ->toBe("{$_ENV['APP_URL']}/auth/google/callback"); + }); +} From 87208f7869150368b207a4fcc0f10a76e5ccdad0 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Sun, 21 Jun 2026 11:06:53 -0400 Subject: [PATCH 07/10] add typehint to Auth@env $default param --- src/Auth.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Auth.php b/src/Auth.php index 0549615..77f01ec 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -117,7 +117,10 @@ public function __construct() } } - /** @return mixed Returns the value of the environment variable by using Leaf's `_env` primarily */ + /** + * @param mixed $default + * @return mixed Returns the value of the environment variable by using Leaf's `_env` primarily + */ private function env(string $name, $default = false) { // If `_env` function of Leaf is defined, use it. From bfb692e104658f93fb0de8ec210721e5bed838f2 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Sun, 21 Jun 2026 11:14:27 -0400 Subject: [PATCH 08/10] add return type to \Tests\expect Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- tests/google.test.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/google.test.php b/tests/google.test.php index e007b2f..4939298 100644 --- a/tests/google.test.php +++ b/tests/google.test.php @@ -13,7 +13,8 @@ * * @return Expectation */ - function expect($value = null) { + function expect($value = null): Expectation + { return \expect($value); } } From f7a85889fa9af978cfa191653031b32ecd8d54d3 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Sun, 21 Jun 2026 11:19:36 -0400 Subject: [PATCH 09/10] remove assert --- tests/google.test.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/google.test.php b/tests/google.test.php index 4939298..ce1d7f6 100644 --- a/tests/google.test.php +++ b/tests/google.test.php @@ -22,6 +22,7 @@ function expect($value = null): Expectation namespace { use Leaf\Auth; + use League\OAuth2\Client\Provider\AbstractProvider; use League\OAuth2\Client\Provider\Google; use function Tests\expect; @@ -35,8 +36,11 @@ function expect($value = null): Expectation ]; $auth = new Auth(); + + /** @var Google|AbstractProvider|null */ $google = $auth->client('google'); - assert($google instanceof Google); + + expect($google)->toBeInstanceOf(Google::class); $reflectionClass = new ReflectionClass(Google::class); $clientId = $reflectionClass->getProperty('clientId'); @@ -65,8 +69,10 @@ function expect($value = null): Expectation ]; $auth = new Auth(); + /** @var Google|AbstractProvider|null */ $google = $auth->client('google'); - assert($google instanceof Google); + + expect($google)->toBeInstanceOf(Google::class); $reflectionClass = new ReflectionClass(Google::class); $redirectUri = $reflectionClass->getProperty('redirectUri'); @@ -83,8 +89,10 @@ function expect($value = null): Expectation ]; $auth = new Auth(); + /** @var Google|AbstractProvider|null */ $google = $auth->withGoogle('', '')->client('google'); - assert($google instanceof Google); + + expect($google)->toBeInstanceOf(Google::class); $reflectionClass = new ReflectionClass(Google::class); $redirectUri = $reflectionClass->getProperty('redirectUri'); From 88253c12f2d9d58112fae63f5a450331715257f5 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Sun, 21 Jun 2026 11:22:21 -0400 Subject: [PATCH 10/10] withou -> without --- tests/google.test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/google.test.php b/tests/google.test.php index ce1d7f6..a857434 100644 --- a/tests/google.test.php +++ b/tests/google.test.php @@ -27,7 +27,7 @@ function expect($value = null): Expectation use function Tests\expect; - test('initializes google withou leafs/leaf', function (): void { + test('initializes google without leafs/leaf', function (): void { $_ENV = [ 'GOOGLE_AUTH_CLIENT_ID' => '{google-auth-client-id}', 'GOOGLE_AUTH_CLIENT_SECRET' => '{google-auth-client-secret}',