Skip to content

Commit f2673b3

Browse files
committed
update stan
1 parent 3583745 commit f2673b3

8 files changed

+11
-71
lines changed

Diff for: .phive/phars.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="phpstan" version="1.11.9" installed="1.11.9" location="./tools/phpstan" copy="false"/>
4-
<phar name="psalm" version="5.25.0" installed="5.25.0" location="./tools/psalm" copy="false"/>
3+
<phar name="phpstan" version="2.0.1" installed="2.0.1" location="./tools/phpstan" copy="false"/>
4+
<phar name="psalm" version="5.26.1" installed="5.26.1" location="./tools/psalm" copy="false"/>
55
</phive>

Diff for: phpstan-baseline.neon

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Strict comparison using \\=\\=\\= between string and false will always evaluate to false\\.$#"
4+
message: '#^Strict comparison using \=\=\= between string and false will always evaluate to false\.$#'
5+
identifier: identical.alwaysFalse
56
count: 1
67
path: src/Authenticator/HttpDigestAuthenticator.php

Diff for: psalm-baseline.xml

+1-63
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,2 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="5.20.0@3f284e96c9d9be6fe6b15c79416e1d1903dcfef4">
3-
<file src="src/AuthenticationService.php">
4-
<RiskyTruthyFalsyComparison>
5-
<code><![CDATA[empty($parsed['host'])]]></code>
6-
<code><![CDATA[empty($parsed['scheme'])]]></code>
7-
</RiskyTruthyFalsyComparison>
8-
</file>
9-
<file src="src/Authenticator/CookieAuthenticator.php">
10-
<RiskyTruthyFalsyComparison>
11-
<code>empty($identity)</code>
12-
</RiskyTruthyFalsyComparison>
13-
</file>
14-
<file src="src/Authenticator/EnvironmentAuthenticator.php">
15-
<RiskyTruthyFalsyComparison>
16-
<code>empty($data)</code>
17-
<code>empty($user)</code>
18-
</RiskyTruthyFalsyComparison>
19-
</file>
20-
<file src="src/Authenticator/FormAuthenticator.php">
21-
<RiskyTruthyFalsyComparison>
22-
<code>empty($user)</code>
23-
</RiskyTruthyFalsyComparison>
24-
</file>
25-
<file src="src/Authenticator/HttpDigestAuthenticator.php">
26-
<RiskyTruthyFalsyComparison>
27-
<code>empty($digest)</code>
28-
<code>empty($user)</code>
29-
</RiskyTruthyFalsyComparison>
30-
</file>
31-
<file src="src/Authenticator/JwtAuthenticator.php">
32-
<RiskyTruthyFalsyComparison>
33-
<code>empty($user)</code>
34-
</RiskyTruthyFalsyComparison>
35-
</file>
36-
<file src="src/Authenticator/Result.php">
37-
<RiskyTruthyFalsyComparison>
38-
<code>empty($data)</code>
39-
</RiskyTruthyFalsyComparison>
40-
</file>
41-
<file src="src/Authenticator/SessionAuthenticator.php">
42-
<RiskyTruthyFalsyComparison>
43-
<code>empty($user)</code>
44-
<code>empty($user)</code>
45-
</RiskyTruthyFalsyComparison>
46-
</file>
47-
<file src="src/Authenticator/TokenAuthenticator.php">
48-
<RiskyTruthyFalsyComparison>
49-
<code>empty($headerLine)</code>
50-
<code>empty($queryParam)</code>
51-
<code>empty($user)</code>
52-
</RiskyTruthyFalsyComparison>
53-
</file>
54-
<file src="src/Identifier/IdentifierCollection.php">
55-
<RiskyTruthyFalsyComparison>
56-
<code>$result</code>
57-
</RiskyTruthyFalsyComparison>
58-
</file>
59-
<file src="src/Middleware/AuthenticationMiddleware.php">
60-
<RiskyTruthyFalsyComparison>
61-
<code>$url</code>
62-
</RiskyTruthyFalsyComparison>
63-
</file>
64-
</files>
2+
<files psalm-version="5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0"/>

Diff for: psalm.xml

+1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727

2828
<InvalidStringClass errorLevel="info" />
2929
<MissingClassConstType errorLevel="info" />
30+
<RiskyTruthyFalsyComparison errorLevel="info" />
3031
</issueHandlers>
3132
</psalm>

Diff for: src/AuthenticationService.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,10 @@ public function isImpersonating(ServerRequestInterface $request): bool
492492
*/
493493
protected function getImpersonationProvider(): ImpersonationInterface
494494
{
495-
/** @var \Authentication\Authenticator\ImpersonationInterface $provider */
496495
$provider = $this->getAuthenticationProvider();
496+
if ($provider === null) {
497+
throw new InvalidArgumentException('No AuthenticationProvider present.');
498+
}
497499
if (!($provider instanceof ImpersonationInterface)) {
498500
$className = get_class($provider);
499501
throw new InvalidArgumentException(

Diff for: src/Authenticator/CookieAuthenticator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ protected function _createPlainToken(ArrayAccess|array $identity): string
184184
*
185185
* @param \ArrayAccess|array $identity Identity data.
186186
* @return string
187+
* @throws \JsonException
187188
*/
188189
protected function _createToken(ArrayAccess|array $identity): string
189190
{
@@ -192,8 +193,7 @@ protected function _createToken(ArrayAccess|array $identity): string
192193

193194
$usernameField = $this->getConfig('fields.username');
194195

195-
/** @var string */
196-
return json_encode([$identity[$usernameField], $hash]);
196+
return json_encode([$identity[$usernameField], $hash], JSON_THROW_ON_ERROR);
197197
}
198198

199199
/**

Diff for: src/Identity.php

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class Identity implements IdentityInterface
5252
*
5353
* @param \ArrayAccess|array $data Identity data
5454
* @param array $config Config options
55-
* @throws \InvalidArgumentException When invalid identity data is passed.
5655
*/
5756
public function __construct(ArrayAccess|array $data, array $config = [])
5857
{

Diff for: src/Middleware/AuthenticationMiddleware.php

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class AuthenticationMiddleware implements MiddlewareInterface
5656
*
5757
* @param \Authentication\AuthenticationServiceInterface|\Authentication\AuthenticationServiceProviderInterface $subject Authentication service or application instance.
5858
* @param \Cake\Core\ContainerInterface|null $container The container instance from the application.
59-
* @throws \InvalidArgumentException When invalid subject has been passed.
6059
*/
6160
public function __construct(
6261
AuthenticationServiceInterface|AuthenticationServiceProviderInterface $subject,

0 commit comments

Comments
 (0)