Skip to content

Fix inconsistencies in last deprecation notices #542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions performance/JWE/EncryptionBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ abstract class EncryptionBench
{
private AlgorithmManager $algorithmsManager;

private CompressionMethodManager $compressionMethodsManager;

private JWESerializerManager $serializerManager;

public function init(): void
Expand Down Expand Up @@ -96,7 +94,7 @@ public function init(): void
*/
public function encryption(array $params): void
{
$jweBuilder = new JWEBuilder($this->getAlgorithmsManager(), $this->getCompressionMethodsManager());
$jweBuilder = new JWEBuilder($this->getAlgorithmsManager());
$jweBuilder
->withPayload($params['payload'])
->withAAD($this->getAAD())
Expand All @@ -113,7 +111,7 @@ public function encryption(array $params): void
*/
public function decryption(array $params): void
{
$jweLoader = new JWEDecrypter($this->getAlgorithmsManager(), $this->getCompressionMethodsManager());
$jweLoader = new JWEDecrypter($this->getAlgorithmsManager());
$jwe = $this->serializerManager->unserialize($params['input']);
$keyset = JWKSet::createFromKeyData($params['recipient_keys']);
$jweLoader->decryptUsingKeySet($jwe, $keyset, 0);
Expand All @@ -138,9 +136,4 @@ private function getAlgorithmsManager(): AlgorithmManager
{
return $this->algorithmsManager;
}

private function getCompressionMethodsManager(): CompressionMethodManager
{
return $this->compressionMethodsManager;
}
}
64 changes: 12 additions & 52 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ parameters:
path: src/Bundle/Helper/ConfigurationHelper.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Helper\\\\ConfigurationHelper\\:\\:addJWEBuilder\\(\\) has parameter \\$keyEncryptionAlgorithm with no value type specified in iterable type array\\.$#"
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Helper\\\\ConfigurationHelper\\:\\:addJWEBuilder\\(\\) has parameter \\$encryptionAlgorithm with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Helper/ConfigurationHelper.php

Expand All @@ -771,7 +771,7 @@ parameters:
path: src/Bundle/Helper/ConfigurationHelper.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Helper\\\\ConfigurationHelper\\:\\:addJWEDecrypter\\(\\) has parameter \\$keyEncryptionAlgorithm with no value type specified in iterable type array\\.$#"
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Helper\\\\ConfigurationHelper\\:\\:addJWEDecrypter\\(\\) has parameter \\$encryptionAlgorithm with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Helper/ConfigurationHelper.php

Expand Down Expand Up @@ -1095,21 +1095,6 @@ parameters:
count: 1
path: src/Bundle/Services/JWEDecrypter.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWEDecrypterFactory\\:\\:create\\(\\) has parameter \\$compressionMethods with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/JWEDecrypterFactory.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWEDecrypterFactory\\:\\:create\\(\\) has parameter \\$contentEncryptionAlgorithms with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/JWEDecrypterFactory.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWEDecrypterFactory\\:\\:create\\(\\) has parameter \\$keyEncryptionAlgorithms with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/JWEDecrypterFactory.php

-
message: """
#^Parameter \\$compressionMethodManagerFactory of method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWEDecrypterFactory\\:\\:__construct\\(\\) has typehint with deprecated class Jose\\\\Component\\\\Encryption\\\\Compression\\\\CompressionMethodManagerFactory\\:
Expand All @@ -1123,31 +1108,6 @@ parameters:
count: 1
path: src/Bundle/Services/JWELoader.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWELoaderFactory\\:\\:create\\(\\) has parameter \\$compressionMethods with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/JWELoaderFactory.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWELoaderFactory\\:\\:create\\(\\) has parameter \\$contentEncryptionAlgorithms with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/JWELoaderFactory.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWELoaderFactory\\:\\:create\\(\\) has parameter \\$headerCheckers with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/JWELoaderFactory.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWELoaderFactory\\:\\:create\\(\\) has parameter \\$keyEncryptionAlgorithms with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/JWELoaderFactory.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\JWELoaderFactory\\:\\:create\\(\\) has parameter \\$serializers with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/JWELoaderFactory.php

-
message: "#^Parameter \\#4 \\$signature of class Jose\\\\Bundle\\\\JoseFramework\\\\Event\\\\JWSLoadingSuccessEvent constructor expects int, int\\|null given\\.$#"
count: 1
Expand Down Expand Up @@ -1189,17 +1149,17 @@ parameters:
path: src/Bundle/Services/NestedTokenBuilderFactory.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenBuilderFactory\\:\\:create\\(\\) has parameter \\$jwe_serializers with no value type specified in iterable type array\\.$#"
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenBuilderFactory\\:\\:create\\(\\) has parameter \\$encryptionAlgorithms with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/NestedTokenBuilderFactory.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenBuilderFactory\\:\\:create\\(\\) has parameter \\$jws_serializers with no value type specified in iterable type array\\.$#"
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenBuilderFactory\\:\\:create\\(\\) has parameter \\$jwe_serializers with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/NestedTokenBuilderFactory.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenBuilderFactory\\:\\:create\\(\\) has parameter \\$keyEncryptionAlgorithms with no value type specified in iterable type array\\.$#"
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenBuilderFactory\\:\\:create\\(\\) has parameter \\$jws_serializers with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/NestedTokenBuilderFactory.php

Expand All @@ -1224,27 +1184,27 @@ parameters:
path: src/Bundle/Services/NestedTokenLoaderFactory.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenLoaderFactory\\:\\:create\\(\\) has parameter \\$jweHeaderCheckers with no value type specified in iterable type array\\.$#"
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenLoaderFactory\\:\\:create\\(\\) has parameter \\$encryptionAlgorithms with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/NestedTokenLoaderFactory.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenLoaderFactory\\:\\:create\\(\\) has parameter \\$jweSerializers with no value type specified in iterable type array\\.$#"
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenLoaderFactory\\:\\:create\\(\\) has parameter \\$jweHeaderCheckers with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/NestedTokenLoaderFactory.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenLoaderFactory\\:\\:create\\(\\) has parameter \\$jwsHeaderCheckers with no value type specified in iterable type array\\.$#"
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenLoaderFactory\\:\\:create\\(\\) has parameter \\$jweSerializers with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/NestedTokenLoaderFactory.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenLoaderFactory\\:\\:create\\(\\) has parameter \\$jwsSerializers with no value type specified in iterable type array\\.$#"
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenLoaderFactory\\:\\:create\\(\\) has parameter \\$jwsHeaderCheckers with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/NestedTokenLoaderFactory.php

-
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenLoaderFactory\\:\\:create\\(\\) has parameter \\$keyEncryptionAlgorithms with no value type specified in iterable type array\\.$#"
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Services\\\\NestedTokenLoaderFactory\\:\\:create\\(\\) has parameter \\$jwsSerializers with no value type specified in iterable type array\\.$#"
count: 1
path: src/Bundle/Services/NestedTokenLoaderFactory.php

Expand Down Expand Up @@ -1779,12 +1739,12 @@ parameters:
path: src/Library/Encryption/JWELoaderFactory.php

-
message: "#^Method Jose\\\\Component\\\\Encryption\\\\JWELoaderFactory\\:\\:create\\(\\) has parameter \\$headerCheckers with no value type specified in iterable type array\\.$#"
message: "#^Method Jose\\\\Component\\\\Encryption\\\\JWELoaderFactory\\:\\:create\\(\\) has parameter \\$encryptionAlgorithms with no value type specified in iterable type array\\.$#"
count: 1
path: src/Library/Encryption/JWELoaderFactory.php

-
message: "#^Method Jose\\\\Component\\\\Encryption\\\\JWELoaderFactory\\:\\:create\\(\\) has parameter \\$keyEncryptionAlgorithms with no value type specified in iterable type array\\.$#"
message: "#^Method Jose\\\\Component\\\\Encryption\\\\JWELoaderFactory\\:\\:create\\(\\) has parameter \\$headerCheckers with no value type specified in iterable type array\\.$#"
count: 1
path: src/Library/Encryption/JWELoaderFactory.php

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,18 @@ public function getNodeDefinition(NodeDefinition $node): void
->arrayNode('content_encryption_algorithms')
->info('A list of supported content encryption algorithms.')
->useAttributeAsKey('name')
->isRequired()
->requiresAtLeastOneElement()
->treatNullLike([])
->treatFalseLike([])
->defaultValue([])
->scalarPrototype()
->end()
->end()
->arrayNode('compression_methods')
->info('A list of supported compression methods.')
->useAttributeAsKey('name')
->defaultValue(['DEF'])
->treatNullLike([])
->treatFalseLike([])
->defaultValue([])
->scalarPrototype()
->end()
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public function load(array $configs, ContainerBuilder $container): void
->setFactory([new Reference(JWEBuilderFactory::class), 'create'])
->setArguments([
$itemConfig['key_encryption_algorithms'],
$itemConfig['content_encryption_algorithms'],
$itemConfig['compression_methods'],
$itemConfig['content_encryption_algorithms'] === [] ? null : $itemConfig['content_encryption_algorithms'],
$itemConfig['compression_methods'] === [] ? null : $itemConfig['compression_methods'],
])
->addTag('jose.jwe_builder')
->setPublic($itemConfig['is_public']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public function load(array $configs, ContainerBuilder $container): void
->setFactory([new Reference(JWEDecrypterFactory::class), 'create'])
->setArguments([
$itemConfig['key_encryption_algorithms'],
$itemConfig['content_encryption_algorithms'],
$itemConfig['compression_methods'],
$itemConfig['content_encryption_algorithms'] === [] ? null : $itemConfig['content_encryption_algorithms'],
$itemConfig['compression_methods'] === [] ? null : $itemConfig['compression_methods'],
])
->addTag('jose.jwe_decrypter')
->setPublic($itemConfig['is_public']);
Expand Down
12 changes: 8 additions & 4 deletions src/Bundle/DependencyInjection/Source/Encryption/JWELoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public function load(array $configs, ContainerBuilder $container): void
->setArguments([
$itemConfig['serializers'],
$itemConfig['key_encryption_algorithms'],
$itemConfig['content_encryption_algorithms'],
$itemConfig['compression_methods'],
$itemConfig['content_encryption_algorithms'] === [] ? null : $itemConfig['content_encryption_algorithms'],
$itemConfig['compression_methods'] === [] ? null : $itemConfig['compression_methods'],
$itemConfig['header_checkers'],
])
->addTag('jose.jwe_loader')
Expand Down Expand Up @@ -67,14 +67,18 @@ public function getNodeDefinition(NodeDefinition $node): void
->arrayNode('content_encryption_algorithms')
->info('A list of key encryption algorithm aliases.')
->useAttributeAsKey('name')
->isRequired()
->treatNullLike([])
->treatFalseLike([])
->defaultValue([])
->scalarPrototype()
->end()
->end()
->arrayNode('compression_methods')
->info('A list of compression method aliases.')
->useAttributeAsKey('name')
->defaultValue(['DEF'])
->treatNullLike([])
->treatFalseLike([])
->defaultValue([])
->scalarPrototype()
->end()
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public function load(array $configs, ContainerBuilder $container): void
->setArguments([
$itemConfig['jwe_serializers'],
$itemConfig['key_encryption_algorithms'],
$itemConfig['content_encryption_algorithms'],
$itemConfig['compression_methods'],
$itemConfig['content_encryption_algorithms'] === [] ? null : $itemConfig['content_encryption_algorithms'],
$itemConfig['compression_methods'] === [] ? null : $itemConfig['compression_methods'],
$itemConfig['jws_serializers'],
$itemConfig['signature_algorithms'],
])
Expand Down Expand Up @@ -74,14 +74,18 @@ public function getNodeDefinition(NodeDefinition $node): void
->arrayNode('content_encryption_algorithms')
->info('A list of key encryption algorithm aliases.')
->useAttributeAsKey('name')
->isRequired()
->treatNullLike([])
->treatFalseLike([])
->defaultValue([])
->scalarPrototype()
->end()
->end()
->arrayNode('compression_methods')
->info('A list of compression method aliases.')
->useAttributeAsKey('name')
->defaultValue(['DEF'])
->treatNullLike([])
->treatFalseLike([])
->defaultValue([])
->scalarPrototype()
->end()
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public function load(array $configs, ContainerBuilder $container): void
->setArguments([
$itemConfig['jwe_serializers'],
$itemConfig['key_encryption_algorithms'],
$itemConfig['content_encryption_algorithms'],
$itemConfig['compression_methods'],
$itemConfig['content_encryption_algorithms'] === [] ? null : $itemConfig['content_encryption_algorithms'],
$itemConfig['compression_methods'] === [] ? null : $itemConfig['compression_methods'],
$itemConfig['jwe_header_checkers'],
$itemConfig['jws_serializers'],
$itemConfig['signature_algorithms'],
Expand Down Expand Up @@ -76,14 +76,18 @@ public function getNodeDefinition(NodeDefinition $node): void
->arrayNode('content_encryption_algorithms')
->info('A list of key encryption algorithm aliases.')
->useAttributeAsKey('name')
->isRequired()
->treatNullLike([])
->treatFalseLike([])
->defaultValue([])
->scalarPrototype()
->end()
->end()
->arrayNode('compression_methods')
->info('A list of compression method aliases.')
->useAttributeAsKey('name')
->defaultValue(['DEF'])
->treatNullLike([])
->treatFalseLike([])
->defaultValue([])
->scalarPrototype()
->end()
->end()
Expand Down
Loading