Skip to content

Commit 8e495aa

Browse files
committed
Issue #415: Increased PHPStan level to 8
Signed-off-by: alexmerlin <[email protected]>
1 parent b7ca5ac commit 8e495aa

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

src/Core/src/Security/src/Entity/OAuthAccessToken.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class OAuthAccessToken implements AccessTokenEntityInterface
3838
#[ORM\Column(name: 'user_id', type: 'string', length: 25, nullable: true)]
3939
private ?string $userId;
4040

41+
/** @var non-empty-string $token */
4142
#[ORM\Column(name: 'token', type: 'string', length: 100)]
4243
private string $token;
4344

@@ -87,11 +88,17 @@ public function getClient(): ClientEntityInterface
8788
return $this->client;
8889
}
8990

91+
/**
92+
* @return non-empty-string
93+
*/
9094
public function getToken(): string
9195
{
9296
return $this->token;
9397
}
9498

99+
/**
100+
* @param non-empty-string $token
101+
*/
95102
public function setToken(string $token): self
96103
{
97104
$this->token = $token;
@@ -118,6 +125,9 @@ public function revoke(): self
118125
return $this;
119126
}
120127

128+
/**
129+
* @return non-empty-string
130+
*/
121131
public function getIdentifier(): string
122132
{
123133
return $this->getToken();
@@ -202,12 +212,13 @@ public function initJwtConfiguration(): self
202212
throw new RuntimeException('Unable to init JWT without private key');
203213
}
204214

215+
/** @var non-empty-string $keyContents */
216+
$keyContents = $this->privateKey->getKeyContents();
217+
$passphrase = (string) $this->privateKey->getPassPhrase();
218+
205219
$this->jwtConfiguration = Configuration::forAsymmetricSigner(
206220
new Sha256(),
207-
InMemory::plainText(
208-
$this->privateKey->getKeyContents(),
209-
$this->privateKey->getPassPhrase() ?? ''
210-
),
221+
InMemory::plainText($keyContents, $passphrase),
211222
InMemory::plainText('/')
212223
);
213224

src/Core/src/Security/src/Entity/OAuthClient.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ class OAuthClient implements ClientEntityInterface
2525
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'uuid', nullable: true)]
2626
private ?User $user = null;
2727

28+
/** @var non-empty-string $name */
2829
#[ORM\Column(name: 'name', type: 'string', length: 40)]
29-
private string $name = '';
30+
private string $name;
3031

3132
#[ORM\Column(name: 'secret', type: 'string', length: 100, nullable: true)]
3233
private ?string $secret = null;
@@ -69,18 +70,27 @@ public function getIdentity(): string
6970
return $this->getName();
7071
}
7172

73+
/**
74+
* @return non-empty-string
75+
*/
7276
public function getIdentifier(): string
7377
{
7478
return $this->getName();
7579
}
7680

81+
/**
82+
* @param non-empty-string $name
83+
*/
7784
public function setName(string $name): self
7885
{
7986
$this->name = $name;
8087

8188
return $this;
8289
}
8390

91+
/**
92+
* @return non-empty-string
93+
*/
8494
public function getName(): string
8595
{
8696
return $this->name;

0 commit comments

Comments
 (0)