Skip to content

Commit afee4ad

Browse files
authored
Refactor command help text definitions for Symfony Console compatibility (#645)
1 parent 067cabf commit afee4ad

15 files changed

+140
-73
lines changed

.ci-tools/phpstan-baseline.neon

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -600,12 +600,6 @@ parameters:
600600
count: 1
601601
path: ../src/Bundle/DependencyInjection/JoseFrameworkExtension.php
602602

603-
-
604-
rawMessage: 'Method Jose\Bundle\JoseFramework\DependencyInjection\JoseFrameworkExtension::getAlias() has Symfony\Component\DependencyInjection\Exception\BadMethodCallException in PHPDoc @throws tag but it''s not thrown.'
605-
identifier: throws.unusedType
606-
count: 1
607-
path: ../src/Bundle/DependencyInjection/JoseFrameworkExtension.php
608-
609603
-
610604
rawMessage: 'Method Jose\Bundle\JoseFramework\DependencyInjection\JoseFrameworkExtension::getConfiguration() has a parameter $container with a type declaration of Symfony\Component\DependencyInjection\ContainerBuilder, but containers should not be injected.'
611605
identifier: ergebnis.noParameterWithContainerTypeDeclaration
@@ -5370,12 +5364,6 @@ parameters:
53705364
count: 1
53715365
path: ../src/Bundle/Resources/config/analyzers.php
53725366

5373-
-
5374-
rawMessage: 'Method Jose\Bundle\JoseFramework\Routing\JWKSetLoader::load() has Exception in PHPDoc @throws tag but it''s not thrown.'
5375-
identifier: throws.unusedType
5376-
count: 1
5377-
path: ../src/Bundle/Routing/JWKSetLoader.php
5378-
53795367
-
53805368
rawMessage: 'Method Jose\Bundle\JoseFramework\Routing\JWKSetLoader::load() has parameter $type with a nullable type declaration.'
53815369
identifier: ergebnis.noParameterWithNullableTypeDeclaration
@@ -5466,12 +5454,6 @@ parameters:
54665454
count: 1
54675455
path: ../src/Bundle/Serializer/JWESerializer.php
54685456

5469-
-
5470-
rawMessage: 'Method Jose\Bundle\JoseFramework\Serializer\JWESerializer::denormalize() has Symfony\Component\Serializer\Exception\ExceptionInterface in PHPDoc @throws tag but it''s not thrown.'
5471-
identifier: throws.unusedType
5472-
count: 1
5473-
path: ../src/Bundle/Serializer/JWESerializer.php
5474-
54755457
-
54765458
rawMessage: 'Method Jose\Bundle\JoseFramework\Serializer\JWESerializer::denormalize() has parameter $format with a nullable type declaration.'
54775459
identifier: ergebnis.noParameterWithNullableTypeDeclaration
@@ -5574,12 +5556,6 @@ parameters:
55745556
count: 1
55755557
path: ../src/Bundle/Serializer/JWSSerializer.php
55765558

5577-
-
5578-
rawMessage: 'Method Jose\Bundle\JoseFramework\Serializer\JWSSerializer::denormalize() has Symfony\Component\Serializer\Exception\ExceptionInterface in PHPDoc @throws tag but it''s not thrown.'
5579-
identifier: throws.unusedType
5580-
count: 1
5581-
path: ../src/Bundle/Serializer/JWSSerializer.php
5582-
55835559
-
55845560
rawMessage: 'Method Jose\Bundle\JoseFramework\Serializer\JWSSerializer::denormalize() has parameter $format with a nullable type declaration.'
55855561
identifier: ergebnis.noParameterWithNullableTypeDeclaration
@@ -9720,12 +9696,6 @@ parameters:
97209696
count: 1
97219697
path: ../src/Library/KeyManagement/KeyConverter/KeyConverter.php
97229698

9723-
-
9724-
rawMessage: 'Parameter #1 $certificate of static method Jose\Component\KeyManagement\KeyConverter\KeyConverter::loadKeyFromCertificate() expects string, mixed given.'
9725-
identifier: argument.type
9726-
count: 1
9727-
path: ../src/Library/KeyManagement/KeyConverter/KeyConverter.php
9728-
97299699
-
97309700
rawMessage: 'Parameter #1 $details of static method Jose\Component\KeyManagement\KeyConverter\KeyConverter::tryToLoadECKey() expects array{type: int, key: string}, non-empty-array given.'
97319701
identifier: argument.type

.ci-tools/phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<server name="APP_ENV" value="test" force="true" />
1919
<server name="SHELL_VERBOSITY" value="-1" />
2020
</php>
21-
<source>
21+
<source ignoreIndirectDeprecations="true">
2222
<include>
2323
<directory>./../src</directory>
2424
</include>

.github/workflows/ci.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
name: "0️⃣ Pre-checks"
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@v5
2020

2121
- name: "Check file permissions"
2222
run: |
@@ -43,7 +43,7 @@ jobs:
4343
outputs:
4444
cache-key: ${{ steps.cache-key-generator.outputs.key }}
4545
steps:
46-
- uses: actions/checkout@v4
46+
- uses: actions/checkout@v5
4747

4848
- id: cache-key-generator
4949
run: echo "key=composer-${{ runner.os }}-${{ hashFiles('composer.lock') }}" >> $GITHUB_OUTPUT
@@ -69,7 +69,7 @@ jobs:
6969
container:
7070
image: ghcr.io/spomky-labs/phpqa:8.4
7171
steps:
72-
- uses: actions/checkout@v4
72+
- uses: actions/checkout@v5
7373
- uses: actions/cache@v4
7474
with:
7575
path: |
@@ -85,7 +85,7 @@ jobs:
8585
container:
8686
image: ghcr.io/spomky-labs/phpqa:8.4
8787
steps:
88-
- uses: actions/checkout@v4
88+
- uses: actions/checkout@v5
8989
- uses: actions/cache@v4
9090
with:
9191
path: |
@@ -101,7 +101,7 @@ jobs:
101101
container:
102102
image: ghcr.io/spomky-labs/phpqa:8.4
103103
steps:
104-
- uses: actions/checkout@v4
104+
- uses: actions/checkout@v5
105105
- uses: actions/cache@v4
106106
with:
107107
path: |
@@ -117,7 +117,7 @@ jobs:
117117
container:
118118
image: ghcr.io/spomky-labs/phpqa:8.4
119119
steps:
120-
- uses: actions/checkout@v4
120+
- uses: actions/checkout@v5
121121
- uses: actions/cache@v4
122122
with:
123123
path: |
@@ -136,7 +136,7 @@ jobs:
136136
container:
137137
image: ghcr.io/spomky-labs/phpqa:8.4
138138
steps:
139-
- uses: actions/checkout@v4
139+
- uses: actions/checkout@v5
140140
- run: composer exec -- parallel-lint src tests
141141

142142
check_licenses:
@@ -146,7 +146,7 @@ jobs:
146146
container:
147147
image: ghcr.io/spomky-labs/phpqa:8.4
148148
steps:
149-
- uses: actions/checkout@v4
149+
- uses: actions/checkout@v5
150150
- run: castor check-licenses
151151

152152
deptrac:
@@ -156,7 +156,7 @@ jobs:
156156
container:
157157
image: ghcr.io/spomky-labs/phpqa:8.4
158158
steps:
159-
- uses: actions/checkout@v4
159+
- uses: actions/checkout@v5
160160
- uses: actions/cache@v4
161161
with:
162162
path: |
@@ -166,7 +166,7 @@ jobs:
166166
- run: castor deptrac
167167

168168
tests:
169-
name: "8️⃣ Unit & Functional Tests (PHP ${{ matrix.php-version }}${{ matrix.lowest-deps && ' --prefer-lowest' || '' }})"
169+
name: "🧪 Unit & Functional Tests (PHP ${{ matrix.php-version }}${{ matrix.lowest-deps && ' - Lowest Deps' || '' }})"
170170
needs:
171171
- prepare_dependencies
172172
- phpstan
@@ -177,27 +177,33 @@ jobs:
177177
- check_licenses
178178
- deptrac
179179
runs-on: ubuntu-latest
180+
continue-on-error: ${{ matrix.experimental || false }}
180181
strategy:
182+
fail-fast: false
181183
matrix:
182184
include:
185+
- php-version: '8.2'
186+
lowest-deps: true
183187
- php-version: '8.2'
184188
- php-version: '8.3'
185189
- php-version: '8.4'
190+
- php-version: '8.5'
191+
experimental: true
186192
container:
187193
image: ghcr.io/spomky-labs/phpqa:${{ matrix.php-version }}
188194
env:
189195
XDEBUG_MODE: coverage
190196
PHP_VERSION: ${{ matrix.php-version }}
191197
steps:
192-
- uses: actions/checkout@v4
198+
- uses: actions/checkout@v5
193199
- name: Install dependencies
194200
run: |
195201
if [ "${{ matrix.lowest-deps || 'false' }}" = "true" ]; then
196202
composer update --prefer-lowest --no-interaction --no-progress
197203
else
198204
composer install --no-interaction --no-progress
199205
fi
200-
206+
201207
- name: Run PHPUnit
202208
run: castor phpunit
203209

@@ -211,7 +217,7 @@ jobs:
211217
env:
212218
XDEBUG_MODE: coverage
213219
steps:
214-
- uses: actions/checkout@v4
220+
- uses: actions/checkout@v5
215221
- name: Execute Infection
216222
run: castor infect
217223

@@ -220,7 +226,7 @@ jobs:
220226
needs: [prepare_dependencies]
221227
runs-on: ubuntu-latest
222228
steps:
223-
- uses: actions/checkout@v4
229+
- uses: actions/checkout@v5
224230
- name: Check exported files
225231
run: |
226232
EXPECTED=".gitsplit.yml,CODE_OF_CONDUCT.md,LICENSE,README.md,SECURITY.md,castor.php,composer.json"

castor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ function phpunit(): void
218218
{
219219
phpqa(
220220
[
221-
'composer', 'exec', '--', 'phpunit',
221+
'composer', 'exec', '--', 'phpunit-11',
222222
'--coverage-xml', '.ci-tools/coverage',
223223
'--log-junit=.ci-tools/coverage/junit.xml',
224224
'--configuration', '.ci-tools/phpunit.xml.dist',

src/Library/Console/AddKeyIntoKeysetCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@
1616
use function is_array;
1717
use function is_string;
1818

19-
#[AsCommand(name: 'keyset:add:key', description: 'Add a key into a key set.', help: <<<'TXT'
20-
This command adds a key at the end of a key set.
21-
TXT)]
19+
#[AsCommand(name: 'keyset:add:key', description: 'Add a key into a key set.')]
2220
final class AddKeyIntoKeysetCommand extends ObjectOutputCommand
2321
{
2422
#[Override]
2523
protected function configure(): void
2624
{
2725
parent::configure();
2826
$this
27+
->setHelp('This command adds a key at the end of a key set.')
2928
->addArgument('jwkset', InputArgument::REQUIRED, 'The JWKSet object')
3029
->addArgument('jwk', InputArgument::REQUIRED, 'The new JWK object');
3130
}

src/Library/Console/JKULoaderCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
use Symfony\Component\Console\Output\OutputInterface;
1414
use function is_string;
1515

16-
#[AsCommand(name: 'keyset:load:jku', description: 'Loads a key set from an url.', help: <<<'TXT'
17-
This command will try to get a key set from an URL. The distant key set is a JWKSet.
18-
TXT)]
16+
#[AsCommand(name: 'keyset:load:jku', description: 'Loads a key set from an url.')]
1917
final class JKULoaderCommand extends ObjectOutputCommand
2018
{
2119
public function __construct(
@@ -30,6 +28,7 @@ protected function configure(): void
3028
{
3129
parent::configure();
3230
$this
31+
->setHelp('This command will try to get a key set from an URL. The distant key set is a JWKSet.')
3332
->addArgument('url', InputArgument::REQUIRED, 'The URL');
3433
}
3534

src/Library/Console/KeyAnalyzerCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
use function is_array;
1919
use function is_string;
2020

21-
#[AsCommand(name: 'key:analyze', description: 'JWK quality analyzer.', help: <<<'TXT'
22-
This command will analyze a JWK object and find security issues.
23-
TXT)]
21+
#[AsCommand(name: 'key:analyze', description: 'JWK quality analyzer.')]
2422
final class KeyAnalyzerCommand extends Command
2523
{
2624
public function __construct(
@@ -35,6 +33,7 @@ protected function configure(): void
3533
{
3634
parent::configure();
3735
$this
36+
->setHelp('This command will analyze a JWK object and find security issues.')
3837
->addArgument('jwk', InputArgument::REQUIRED, 'The JWK object');
3938
}
4039

src/Library/Console/KeysetAnalyzerCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
use function is_string;
2222
use function sprintf;
2323

24-
#[AsCommand(name: 'keyset:analyze', description: 'JWKSet quality analyzer.', help: <<<'TXT'
25-
This command will analyze a JWKSet object and find security issues.
26-
TXT)]
24+
#[AsCommand(name: 'keyset:analyze', description: 'JWKSet quality analyzer.')]
2725
final class KeysetAnalyzerCommand extends Command
2826
{
2927
public function __construct(
@@ -39,6 +37,7 @@ protected function configure(): void
3937
{
4038
parent::configure();
4139
$this
40+
->setHelp('This command will analyze a JWKSet object and find security issues.')
4241
->addArgument('jwkset', InputArgument::REQUIRED, 'The JWKSet object');
4342
}
4443

src/Library/Console/MergeKeysetCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@
1414
use Symfony\Component\Console\Output\OutputInterface;
1515
use function is_array;
1616

17-
#[AsCommand(name: 'keyset:merge', description: 'Merge several key sets into one.', help: <<<'TXT'
18-
This command merges several key sets into one. It is very useful when you generate e.g. RSA, EC and OKP keys and you want only one key set to rule them all.
19-
TXT)]
17+
#[AsCommand(name: 'keyset:merge', description: 'Merge several key sets into one.')]
2018
final class MergeKeysetCommand extends ObjectOutputCommand
2119
{
2220
#[Override]
2321
protected function configure(): void
2422
{
2523
parent::configure();
2624
$this
25+
->setHelp(
26+
'This command merges several key sets into one. It is very useful when you generate e.g. RSA, EC and OKP keys and you want only one key set to rule them all.'
27+
)
2728
->addArgument('jwksets', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'The JWKSet objects');
2829
}
2930

src/Library/Console/PublicKeyCommand.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
#[AsCommand(
1919
name: 'key:convert:public',
2020
description: 'Convert a private key into public key. Symmetric keys (shared keys) are not changed.',
21-
help: <<<'TXT'
22-
This command converts a private key into a public key.
23-
TXT
2421
)]
2522
final class PublicKeyCommand extends ObjectOutputCommand
2623
{
@@ -29,6 +26,7 @@ protected function configure(): void
2926
{
3027
parent::configure();
3128
$this
29+
->setHelp('This command converts a private key into a public key.')
3230
->addArgument('jwk', InputArgument::REQUIRED, 'The JWK object');
3331
}
3432

0 commit comments

Comments
 (0)