Skip to content
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
52 changes: 44 additions & 8 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
parameters:
ignoreErrors:
-
message: '#^Method Patchlevel\\Hydrator\\Cryptography\\Cipher\\OpensslCipher\:\:encrypt\(\) should return non\-empty\-string but returns string\.$#'
message: '#^Method Patchlevel\\Hydrator\\Extension\\Cryptography\\Cipher\\OpensslCipher\:\:encrypt\(\) should return non\-empty\-string but returns string\.$#'
identifier: return.type
count: 1
path: src/Cryptography/Cipher/OpensslCipher.php
path: src/Extension/Cryptography/Cipher/OpensslCipher.php

-
message: '#^Parameter \#1 \$key of class Patchlevel\\Hydrator\\Cryptography\\Cipher\\CipherKey constructor expects non\-empty\-string, string given\.$#'
message: '#^Parameter \#1 \$key of class Patchlevel\\Hydrator\\Extension\\Cryptography\\Cipher\\CipherKey constructor expects non\-empty\-string, string given\.$#'
identifier: argument.type
count: 1
path: src/Cryptography/Cipher/OpensslCipherKeyFactory.php
path: src/Extension/Cryptography/Cipher/OpensslCipherKeyFactory.php

-
message: '#^Parameter \#3 \$iv of class Patchlevel\\Hydrator\\Cryptography\\Cipher\\CipherKey constructor expects non\-empty\-string, string given\.$#'
message: '#^Parameter \#3 \$iv of class Patchlevel\\Hydrator\\Extension\\Cryptography\\Cipher\\CipherKey constructor expects non\-empty\-string, string given\.$#'
identifier: argument.type
count: 1
path: src/Cryptography/Cipher/OpensslCipherKeyFactory.php
path: src/Extension/Cryptography/Cipher/OpensslCipherKeyFactory.php

-
message: '#^Method Patchlevel\\Hydrator\\Guesser\\BuiltInGuesser\:\:guess\(\) has parameter \$type with generic class Symfony\\Component\\TypeInfo\\Type\\ObjectType but does not specify its types\: T$#'
Expand Down Expand Up @@ -91,10 +91,46 @@ parameters:
path: src/Normalizer/ObjectNormalizer.php

-
message: '#^Property Patchlevel\\Hydrator\\Tests\\Unit\\Fixture\\ChildWithSensitiveDataWithIdentifierDto\:\:\$email is never read, only written\.$#'
message: '#^Call to method clear\(\) on an unknown class Patchlevel\\Hydrator\\Cryptography\\Store\\InMemoryCipherKeyStore\.$#'
identifier: class.notFound
count: 1
path: tests/Benchmark/HydratorWithCryptographyBench.php

-
message: '#^Call to static method createWithOpenssl\(\) on an unknown class Patchlevel\\Hydrator\\Cryptography\\BaseCryptographer\.$#'
identifier: class.notFound
count: 1
path: tests/Benchmark/HydratorWithCryptographyBench.php

-
message: '#^Instantiated class Patchlevel\\Hydrator\\Cryptography\\CryptographyExtension not found\.$#'
identifier: class.notFound
count: 1
path: tests/Benchmark/HydratorWithCryptographyBench.php

-
message: '#^Instantiated class Patchlevel\\Hydrator\\Cryptography\\Store\\InMemoryCipherKeyStore not found\.$#'
identifier: class.notFound
count: 1
path: tests/Benchmark/HydratorWithCryptographyBench.php

-
message: '#^Parameter \#1 \$extension of method Patchlevel\\Hydrator\\HydratorBuilder\:\:useExtension\(\) expects Patchlevel\\Hydrator\\Extension, Patchlevel\\Hydrator\\Cryptography\\CryptographyExtension given\.$#'
identifier: argument.type
count: 1
path: tests/Benchmark/HydratorWithCryptographyBench.php

-
message: '#^Property Patchlevel\\Hydrator\\Tests\\Benchmark\\HydratorWithCryptographyBench\:\:\$store has unknown class Patchlevel\\Hydrator\\Cryptography\\Store\\InMemoryCipherKeyStore as its type\.$#'
identifier: class.notFound
count: 1
path: tests/Benchmark/HydratorWithCryptographyBench.php

-
message: '#^Property Patchlevel\\Hydrator\\Tests\\Unit\\Extension\\Cryptography\\Fixture\\ChildWithSensitiveDataWithIdentifierDto\:\:\$email is never read, only written\.$#'
identifier: property.onlyWritten
count: 1
path: tests/Unit/Fixture/ChildWithSensitiveDataWithIdentifierDto.php
path: tests/Unit/Extension/Cryptography/Fixture/ChildWithSensitiveDataWithIdentifierDto.php

-
message: '#^Property Patchlevel\\Hydrator\\Tests\\Unit\\Fixture\\IdNormalizer\:\:\$idClass \(class\-string\<Patchlevel\\Hydrator\\Tests\\Unit\\Fixture\\Id\>\|null\) does not accept string\.$#'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Attribute;
namespace Patchlevel\Hydrator\Extension\Cryptography\Attribute;

use Attribute;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Attribute;
namespace Patchlevel\Hydrator\Extension\Cryptography\Attribute;

use Attribute;
use InvalidArgumentException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography;
namespace Patchlevel\Hydrator\Extension\Cryptography;

use Patchlevel\Hydrator\Cryptography\Cipher\Cipher;
use Patchlevel\Hydrator\Cryptography\Cipher\CipherKey;
use Patchlevel\Hydrator\Cryptography\Cipher\CipherKeyFactory;
use Patchlevel\Hydrator\Cryptography\Cipher\DecryptionFailed;
use Patchlevel\Hydrator\Cryptography\Cipher\EncryptionFailed;
use Patchlevel\Hydrator\Cryptography\Cipher\OpensslCipher;
use Patchlevel\Hydrator\Cryptography\Cipher\OpensslCipherKeyFactory;
use Patchlevel\Hydrator\Cryptography\Store\CipherKeyNotExists;
use Patchlevel\Hydrator\Cryptography\Store\CipherKeyStore;
use Patchlevel\Hydrator\Extension\Cryptography\Cipher\Cipher;
use Patchlevel\Hydrator\Extension\Cryptography\Cipher\CipherKey;
use Patchlevel\Hydrator\Extension\Cryptography\Cipher\CipherKeyFactory;
use Patchlevel\Hydrator\Extension\Cryptography\Cipher\DecryptionFailed;
use Patchlevel\Hydrator\Extension\Cryptography\Cipher\EncryptionFailed;
use Patchlevel\Hydrator\Extension\Cryptography\Cipher\OpensslCipher;
use Patchlevel\Hydrator\Extension\Cryptography\Cipher\OpensslCipherKeyFactory;
use Patchlevel\Hydrator\Extension\Cryptography\Store\CipherKeyNotExists;
use Patchlevel\Hydrator\Extension\Cryptography\Store\CipherKeyStore;

use function array_key_exists;
use function is_array;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography\Cipher;
namespace Patchlevel\Hydrator\Extension\Cryptography\Cipher;

interface Cipher
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography\Cipher;
namespace Patchlevel\Hydrator\Extension\Cryptography\Cipher;

final class CipherKey
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography\Cipher;
namespace Patchlevel\Hydrator\Extension\Cryptography\Cipher;

interface CipherKeyFactory
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography\Cipher;
namespace Patchlevel\Hydrator\Extension\Cryptography\Cipher;

use Patchlevel\Hydrator\HydratorException;
use RuntimeException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography\Cipher;
namespace Patchlevel\Hydrator\Extension\Cryptography\Cipher;

use Patchlevel\Hydrator\HydratorException;
use RuntimeException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography\Cipher;
namespace Patchlevel\Hydrator\Extension\Cryptography\Cipher;

use Patchlevel\Hydrator\HydratorException;
use RuntimeException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography\Cipher;
namespace Patchlevel\Hydrator\Extension\Cryptography\Cipher;

use Patchlevel\Hydrator\HydratorException;
use RuntimeException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography\Cipher;
namespace Patchlevel\Hydrator\Extension\Cryptography\Cipher;

use JsonException;

Expand Down Expand Up @@ -63,6 +63,6 @@

private function dataDecode(string $data): mixed
{
return json_decode($data, true, 512, JSON_THROW_ON_ERROR);

Check warning on line 66 in src/Extension/Cryptography/Cipher/OpensslCipher.php

View workflow job for this annotation

GitHub Actions / Mutation tests (locked, 8.5, ubuntu-latest)

Escaped Mutant for Mutator "DecrementInteger": @@ @@ private function dataDecode(string $data): mixed { - return json_decode($data, true, 512, JSON_THROW_ON_ERROR); + return json_decode($data, true, 511, JSON_THROW_ON_ERROR); } }

Check warning on line 66 in src/Extension/Cryptography/Cipher/OpensslCipher.php

View workflow job for this annotation

GitHub Actions / Mutation tests (locked, 8.5, ubuntu-latest)

Escaped Mutant for Mutator "IncrementInteger": @@ @@ private function dataDecode(string $data): mixed { - return json_decode($data, true, 512, JSON_THROW_ON_ERROR); + return json_decode($data, true, 513, JSON_THROW_ON_ERROR); } }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography\Cipher;
namespace Patchlevel\Hydrator\Extension\Cryptography\Cipher;

use function function_exists;
use function in_array;
Expand All @@ -24,12 +24,12 @@
private readonly string $method = self::DEFAULT_METHOD,
) {
if (!self::methodSupported($this->method)) {
throw new MethodNotSupported($this->method);

Check warning on line 27 in src/Extension/Cryptography/Cipher/OpensslCipherKeyFactory.php

View workflow job for this annotation

GitHub Actions / Mutation tests (locked, 8.5, ubuntu-latest)

Escaped Mutant for Mutator "Throw_": @@ @@ private readonly string $method = self::DEFAULT_METHOD, ) { if (!self::methodSupported($this->method)) { - throw new MethodNotSupported($this->method); + new MethodNotSupported($this->method); } $keyLength = 16;
}

$keyLength = 16;

Check warning on line 30 in src/Extension/Cryptography/Cipher/OpensslCipherKeyFactory.php

View workflow job for this annotation

GitHub Actions / Mutation tests (locked, 8.5, ubuntu-latest)

Escaped Mutant for Mutator "IncrementInteger": @@ @@ throw new MethodNotSupported($this->method); } - $keyLength = 16; + $keyLength = 17; if (function_exists('openssl_cipher_key_length')) { $keyLength = @openssl_cipher_key_length($this->method);

if (function_exists('openssl_cipher_key_length')) {

Check warning on line 32 in src/Extension/Cryptography/Cipher/OpensslCipherKeyFactory.php

View workflow job for this annotation

GitHub Actions / Mutation tests (locked, 8.5, ubuntu-latest)

Escaped Mutant for Mutator "IfNegation": @@ @@ $keyLength = 16; - if (function_exists('openssl_cipher_key_length')) { + if (!function_exists('openssl_cipher_key_length')) { $keyLength = @openssl_cipher_key_length($this->method); }
$keyLength = @openssl_cipher_key_length($this->method);
}

Expand All @@ -53,12 +53,12 @@
}

/** @return list<string> */
public static function supportedMethods(): array

Check warning on line 56 in src/Extension/Cryptography/Cipher/OpensslCipherKeyFactory.php

View workflow job for this annotation

GitHub Actions / Mutation tests (locked, 8.5, ubuntu-latest)

Escaped Mutant for Mutator "PublicVisibility": @@ @@ } /** @return list<string> */ - public static function supportedMethods(): array + protected static function supportedMethods(): array { return openssl_get_cipher_methods(true); }
{
return openssl_get_cipher_methods(true);
}

public static function methodSupported(string $method): bool

Check warning on line 61 in src/Extension/Cryptography/Cipher/OpensslCipherKeyFactory.php

View workflow job for this annotation

GitHub Actions / Mutation tests (locked, 8.5, ubuntu-latest)

Escaped Mutant for Mutator "PublicVisibility": @@ @@ return openssl_get_cipher_methods(true); } - public static function methodSupported(string $method): bool + protected static function methodSupported(string $method): bool { return in_array($method, self::supportedMethods(), true); }
{
return in_array($method, self::supportedMethods(), true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography;
namespace Patchlevel\Hydrator\Extension\Cryptography;

use Patchlevel\Hydrator\Cryptography\Cipher\DecryptionFailed;
use Patchlevel\Hydrator\Cryptography\Cipher\EncryptionFailed;
use Patchlevel\Hydrator\Cryptography\Store\CipherKeyNotExists;
use Patchlevel\Hydrator\Extension\Cryptography\Cipher\DecryptionFailed;
use Patchlevel\Hydrator\Extension\Cryptography\Cipher\EncryptionFailed;
use Patchlevel\Hydrator\Extension\Cryptography\Store\CipherKeyNotExists;

interface Cryptographer
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography;
namespace Patchlevel\Hydrator\Extension\Cryptography;

use Patchlevel\Hydrator\Extension;
use Patchlevel\Hydrator\HydratorBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography;
namespace Patchlevel\Hydrator\Extension\Cryptography;

use Patchlevel\Hydrator\Attribute\DataSubjectId;
use Patchlevel\Hydrator\Attribute\SensitiveData;
use Patchlevel\Hydrator\Extension\Cryptography\Attribute\DataSubjectId;
use Patchlevel\Hydrator\Extension\Cryptography\Attribute\SensitiveData;
use Patchlevel\Hydrator\Metadata\ClassMetadata;
use Patchlevel\Hydrator\Metadata\MetadataEnricher;
use ReflectionProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography;
namespace Patchlevel\Hydrator\Extension\Cryptography;

use Closure;
use Patchlevel\Hydrator\Cryptography\Cipher\DecryptionFailed;
use Patchlevel\Hydrator\Cryptography\Store\CipherKeyNotExists;
use Patchlevel\Hydrator\Extension\Cryptography\Cipher\DecryptionFailed;
use Patchlevel\Hydrator\Extension\Cryptography\Store\CipherKeyNotExists;
use Patchlevel\Hydrator\Metadata\ClassMetadata;
use Patchlevel\Hydrator\Middleware\Middleware;
use Patchlevel\Hydrator\Middleware\Stack;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography;
namespace Patchlevel\Hydrator\Extension\Cryptography;

use Patchlevel\Hydrator\Metadata\MetadataException;
use RuntimeException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography;
namespace Patchlevel\Hydrator\Extension\Cryptography;

use Patchlevel\Hydrator\HydratorException;
use RuntimeException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography;
namespace Patchlevel\Hydrator\Extension\Cryptography;

use Patchlevel\Hydrator\HydratorException;
use RuntimeException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography;
namespace Patchlevel\Hydrator\Extension\Cryptography;

final class SensitiveDataInfo
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography\Store;
namespace Patchlevel\Hydrator\Extension\Cryptography\Store;

use Patchlevel\Hydrator\HydratorException;
use RuntimeException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography\Store;
namespace Patchlevel\Hydrator\Extension\Cryptography\Store;

use Patchlevel\Hydrator\Cryptography\Cipher\CipherKey;
use Patchlevel\Hydrator\Extension\Cryptography\Cipher\CipherKey;

interface CipherKeyStore
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography\Store;
namespace Patchlevel\Hydrator\Extension\Cryptography\Store;

use Patchlevel\Hydrator\Cryptography\Cipher\CipherKey;
use Patchlevel\Hydrator\Extension\Cryptography\Cipher\CipherKey;

final class InMemoryCipherKeyStore implements CipherKeyStore
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography;
namespace Patchlevel\Hydrator\Extension\Cryptography;

use Patchlevel\Hydrator\Metadata\MetadataException;
use RuntimeException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography;
namespace Patchlevel\Hydrator\Extension\Cryptography;

final class SubjectIdFieldMapping
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography;
namespace Patchlevel\Hydrator\Extension\Cryptography;

use function array_merge;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Patchlevel\Hydrator\Cryptography;
namespace Patchlevel\Hydrator\Extension\Cryptography;

use Patchlevel\Hydrator\HydratorException;
use RuntimeException;
Expand Down
4 changes: 2 additions & 2 deletions tests/Benchmark/Fixture/ProfileCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Patchlevel\Hydrator\Tests\Benchmark\Fixture;

use Patchlevel\Hydrator\Attribute\DataSubjectId;
use Patchlevel\Hydrator\Attribute\SensitiveData;
use Patchlevel\Hydrator\Extension\Cryptography\Attribute\DataSubjectId;
use Patchlevel\Hydrator\Extension\Cryptography\Attribute\SensitiveData;

final class ProfileCreated
{
Expand Down
6 changes: 3 additions & 3 deletions tests/Benchmark/HydratorWithCryptographyBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
namespace Patchlevel\Hydrator\Tests\Benchmark;

use Patchlevel\Hydrator\CoreExtension;
use Patchlevel\Hydrator\Cryptography\BaseCryptographer;
use Patchlevel\Hydrator\Cryptography\CryptographyExtension;
use Patchlevel\Hydrator\Cryptography\Store\InMemoryCipherKeyStore;
use Patchlevel\Hydrator\Extension\Cryptography\BaseCryptographer;
use Patchlevel\Hydrator\Extension\Cryptography\CryptographyExtension;
use Patchlevel\Hydrator\Extension\Cryptography\Store\InMemoryCipherKeyStore;
use Patchlevel\Hydrator\Hydrator;
use Patchlevel\Hydrator\HydratorBuilder;
use Patchlevel\Hydrator\Tests\Benchmark\Fixture\ProfileCreated;
Expand Down
Loading
Loading