Skip to content

Commit 1a96f28

Browse files
committed
use PHPUnit attributes instead of annotations
1 parent d12c036 commit 1a96f28

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

Command/OidcTokenGenerateCommand.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ protected function configure(): void
4444
;
4545
}
4646

47-
4847
/**
4948
* @params array<string, list<string>> $algorithms
5049
* @params array<string, list<string>> $issuers
@@ -80,19 +79,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8079

8180
private function getGenerator(?string $firewall): OidcTokenGenerator
8281
{
83-
if (0 === count($this->generators)) {
82+
if (0 === \count($this->generators)) {
8483
throw new \InvalidArgumentException('No OIDC token generator configured.');
8584
}
8685

8786
if ($firewall) {
88-
return $this->generators[$firewall] ?? throw new \InvalidArgumentException(sprintf('Invalid firewall. Available firewalls: "%s".', implode('", "', array_keys($this->generators))));
87+
return $this->generators[$firewall] ?? throw new \InvalidArgumentException(\sprintf('Invalid firewall. Available firewalls: "%s".', implode('", "', array_keys($this->generators))));
8988
}
9089

91-
if (1 === count($this->generators)) {
90+
if (1 === \count($this->generators)) {
9291
return end($this->generators);
9392
}
9493

95-
throw new \InvalidArgumentException(sprintf('Please choose an firewall. Available firewalls: "%s".', implode('", "', array_keys($this->generators))));
94+
throw new \InvalidArgumentException(\sprintf('Please choose an firewall. Available firewalls: "%s".', implode('", "', array_keys($this->generators))));
9695
}
9796

9897
public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
@@ -103,13 +102,13 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
103102

104103
if ($input->mustSuggestOptionValuesFor('algorithm')) {
105104
foreach ($this->algorithms as $algorithm => $firewalls) {
106-
$suggestions->suggestValue(new Suggestion($algorithm, sprintf('Available firewalls: "%s".', implode('", "', $firewalls))));
105+
$suggestions->suggestValue(new Suggestion($algorithm, \sprintf('Available firewalls: "%s".', implode('", "', $firewalls))));
107106
}
108107
}
109108

110109
if ($input->mustSuggestOptionValuesFor('issuer')) {
111110
foreach ($this->issuers as $issuer => $firewalls) {
112-
$suggestions->suggestValue(new Suggestion($issuer, sprintf('Available firewalls: "%s".', implode('", "', $firewalls))));
111+
$suggestions->suggestValue(new Suggestion($issuer, \sprintf('Available firewalls: "%s".', implode('", "', $firewalls))));
113112
}
114113
}
115114
}

Tests/AccessToken/Oidc/OidcTokenGeneratorTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,21 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace AccessToken\Oidc;
12+
namespace Symfony\Component\Security\Http\Tests\AccessToken\Oidc;
1313

1414
use Jose\Component\Core\AlgorithmManager;
1515
use Jose\Component\Core\JWK;
1616
use Jose\Component\Core\JWKSet;
1717
use Jose\Component\Signature\Algorithm\ES256;
1818
use Jose\Component\Signature\Algorithm\ES512;
1919
use PHPUnit\Framework\Attributes\DataProvider;
20+
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
2021
use PHPUnit\Framework\TestCase;
2122
use Symfony\Component\Clock\MockClock;
2223
use Symfony\Component\Security\Http\AccessToken\Oidc\OidcTokenGenerator;
2324
use Symfony\Component\Security\Http\AccessToken\Oidc\OidcTokenHandler;
2425

25-
/**
26-
* @requires extension openssl
27-
*/
26+
#[RequiresPhpExtension('openssl')]
2827
class OidcTokenGeneratorTest extends TestCase
2928
{
3029
public function testGenerate()

0 commit comments

Comments
 (0)