Skip to content

Commit 0fb9eb4

Browse files
committed
Psalm fixes
1 parent 2e01633 commit 0fb9eb4

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Domain/SecurityIdentityRetrievalStrategy.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public function __construct(RoleHierarchyInterface $roleHierarchy, Authenticatio
3939

4040
/**
4141
* {@inheritdoc}
42+
*
43+
* @return RoleSecurityIdentity[]
4244
*/
4345
public function getSecurityIdentities(?TokenInterface $token)
4446
{

Tests/Domain/SecurityIdentityRetrievalStrategyTest.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,27 +47,24 @@ public function testGetSecurityIdentities($user, array $roles, string $authentic
4747
->method('getRoleNames')
4848
->willReturn(['foo'])
4949
;
50-
}
51-
52-
$strategy = $this->getStrategy($roles, $authenticationStatus);
5350

54-
if ('anonymous' !== $authenticationStatus) {
5551
$token
5652
->expects($this->once())
5753
->method('getUser')
5854
->willReturn($user)
5955
;
6056
}
6157

58+
$strategy = $this->getStrategy($roles, $authenticationStatus);
6259
$extractedSids = $strategy->getSecurityIdentities($token);
6360

6461
foreach ($extractedSids as $index => $extractedSid) {
6562
if (!isset($sids[$index])) {
66-
$this->fail(sprintf('Expected SID at index %d, but there was none.', true));
63+
$this->fail(sprintf('Expected SID at index %d, but there was none.', $index));
6764
}
6865

6966
if (false === $sids[$index]->equals($extractedSid)) {
70-
$this->fail(sprintf('Index: %d, expected SID "%s", but got "%s".', $index, $sids[$index], $extractedSid));
67+
$this->fail(sprintf('Index: %d, expected SID "%s", but got "%s".', $index, $sids[$index], (string) $extractedSid));
7168
}
7269
}
7370
}
@@ -122,11 +119,11 @@ public function testDeprecatedGetSecurityIdentities($user, array $roles, string
122119

123120
foreach ($extractedSids as $index => $extractedSid) {
124121
if (!isset($sids[$index])) {
125-
$this->fail(sprintf('Expected SID at index %d, but there was none.', true));
122+
$this->fail(sprintf('Expected SID at index %d, but there was none.', $index));
126123
}
127124

128125
if (false === $sids[$index]->equals($extractedSid)) {
129-
$this->fail(sprintf('Index: %d, expected SID "%s", but got "%s".', $index, $sids[$index], $extractedSid));
126+
$this->fail(sprintf('Index: %d, expected SID "%s", but got "%s".', $index, $sids[$index], (string) $extractedSid));
130127
}
131128
}
132129
}

0 commit comments

Comments
 (0)