diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index d48729e..b554687 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -8,27 +8,22 @@ $config = new PhpCsFixer\Config(); return $config->setRules([ - '@PSR12' => true, - 'array_syntax' => ['syntax' => 'short'], - - // imports + '@PER-CS2.0' => true, + '@PER-CS2.0:risky' => true, 'fully_qualified_strict_types' => true, 'global_namespace_import' => [ 'import_classes' => false, 'import_constants' => false, 'import_functions' => false, ], - 'no_leading_import_slash' => true, 'no_unneeded_import_alias' => true, 'no_unused_imports' => true, 'ordered_imports' => [ 'sort_algorithm' => 'alpha', - 'imports_order' => ['const', 'class', 'function'] + 'imports_order' => ['class', 'function', 'const'] ], - 'single_line_after_imports' => true, - 'no_useless_else' => true, - 'no_useless_return' => true, 'declare_strict_types' => true, + 'native_function_invocation' => ['include' => ['@compiler_optimized']], 'header_comment' => [ 'header' => <<other = []; } - if (!array_key_exists($key, $this->other)) { + if (!\array_key_exists($key, $this->other)) { throw new MetadataNotFoundException($key); } @@ -172,7 +172,7 @@ public function delete(string $key): void Constants::FILE_MODIFICATION_TIME => $this->modificationTime = null, Constants::MEDIA_WIDTH => $this->width = null, Constants::MEDIA_HEIGHT => $this->height = null, - default => $this->unsetOther($key) + default => $this->unsetOther($key), }; } @@ -187,6 +187,6 @@ public function merge(iterable $metadata): void #[\Override] public function count(): int { - return count($this->getOthers()) + 6; + return \count($this->getOthers()) + 6; } } diff --git a/packages/file-association-entity/src/FileCollection.php b/packages/file-association-entity/src/FileCollection.php index e0183bf..f3cb027 100644 --- a/packages/file-association-entity/src/FileCollection.php +++ b/packages/file-association-entity/src/FileCollection.php @@ -39,7 +39,7 @@ final class FileCollection extends CollectionDecorator implements DirectoryInter */ public function __construct( Collection $files, - private readonly null|string|(TranslatableInterface&\Stringable) $name = null + private readonly null|string|(TranslatableInterface&\Stringable) $name = null, ) { parent::__construct($files); } diff --git a/packages/file-association-entity/src/FileDecorator.php b/packages/file-association-entity/src/FileDecorator.php index 097bf79..ead454c 100644 --- a/packages/file-association-entity/src/FileDecorator.php +++ b/packages/file-association-entity/src/FileDecorator.php @@ -31,7 +31,7 @@ class FileDecorator implements FileInterface public static function getFile( ?FileInterface $file, - EmbeddedMetadata $metadata + EmbeddedMetadata $metadata, ): ?FileInterface { if ($metadata->isFilePresent() === false) { // metadata says the file does not exist, and the file does not @@ -70,7 +70,7 @@ public static function getFile( public static function setFile( ?FileInterface $input, ?FileInterface &$file, - EmbeddedMetadata $metadata + EmbeddedMetadata $metadata, ): void { $metadata->clear(); @@ -87,7 +87,7 @@ public static function setFile( public static function setFileMandatory( FileInterface $input, FileInterface &$file, - EmbeddedMetadata $metadata + EmbeddedMetadata $metadata, ): void { $metadata->clear(); $file = $input; @@ -100,9 +100,8 @@ public static function setFileMandatory( private function __construct( private FileInterface $file, - private EmbeddedMetadata $metadata - ) { - } + private EmbeddedMetadata $metadata, + ) {} // // other methods @@ -115,13 +114,13 @@ public static function syncMetadata(FileInterface $file): void { if (!$file instanceof self) { throw new \InvalidArgumentException( - sprintf('"syncMetadata()" only accepts %s', static::class) + \sprintf('"syncMetadata()" only accepts %s', static::class), ); } $file->metadata->clear(); $file->metadata->merge( - $file->file->get(RawMetadataInterface::class) ?? [] + $file->file->get(RawMetadataInterface::class) ?? [], ); } @@ -143,7 +142,7 @@ public function get(string $id) /** @psalm-suppress MixedReturnStatement */ return MetadataFactory::create( - $this->get(RawMetadataInterface::class) ?? new RawMetadata() + $this->get(RawMetadataInterface::class) ?? new RawMetadata(), ) ->get($id); } diff --git a/packages/file-association-entity/src/FileMetadataDecorator.php b/packages/file-association-entity/src/FileMetadataDecorator.php index 0efacdf..f364f1f 100644 --- a/packages/file-association-entity/src/FileMetadataDecorator.php +++ b/packages/file-association-entity/src/FileMetadataDecorator.php @@ -27,8 +27,7 @@ class FileMetadataDecorator implements RawMetadataInterface, \IteratorAggregate public function __construct( private readonly RawMetadataInterface $embeddedMetadata, private readonly RawMetadataInterface $fileMetadata, - ) { - } + ) {} #[\Override] public function getIterator(): \Traversable diff --git a/packages/file-association-entity/src/ReadableFileCollection.php b/packages/file-association-entity/src/ReadableFileCollection.php index 74df912..736f644 100644 --- a/packages/file-association-entity/src/ReadableFileCollection.php +++ b/packages/file-association-entity/src/ReadableFileCollection.php @@ -39,7 +39,7 @@ final class ReadableFileCollection extends ReadableCollectionDecorator implement */ public function __construct( ReadableCollection $files, - private readonly null|string|(TranslatableInterface&\Stringable) $name = null + private readonly null|string|(TranslatableInterface&\Stringable) $name = null, ) { parent::__construct($files); } diff --git a/packages/file-association-entity/src/UnsetFile.php b/packages/file-association-entity/src/UnsetFile.php index 2934e20..c6bc1e8 100644 --- a/packages/file-association-entity/src/UnsetFile.php +++ b/packages/file-association-entity/src/UnsetFile.php @@ -33,11 +33,11 @@ class UnsetFile extends \Exception implements NullFileInterface */ public function __construct(string $className, string $propertyName) { - parent::__construct(sprintf( + parent::__construct(\sprintf( 'File property "%s" in class "%s" is unset. This might be caused by the use of `AbstractQuery::toIterable()`. If that is the case, you can: 1. stop involving "%s" in the query; 2. pre-hydrate the file entities before the query; or 3. use other means to iterate the query.', $propertyName, $className, - $className + $className, )); } diff --git a/packages/file-association/src/Attribute/AsFileAssociation.php b/packages/file-association/src/Attribute/AsFileAssociation.php index e2645a3..554065f 100644 --- a/packages/file-association/src/Attribute/AsFileAssociation.php +++ b/packages/file-association/src/Attribute/AsFileAssociation.php @@ -27,7 +27,7 @@ class AsFileAssociation public function __construct( string $fetch = 'EAGER', ) { - if (!in_array($fetch, ['EAGER', 'LAZY'])) { + if (!\in_array($fetch, ['EAGER', 'LAZY'])) { throw new \InvalidArgumentException('Fetch mode can only be EAGER or LAZY.'); } diff --git a/packages/file-association/src/Attribute/WithFileAssociation.php b/packages/file-association/src/Attribute/WithFileAssociation.php index e9c59e1..e5c4174 100644 --- a/packages/file-association/src/Attribute/WithFileAssociation.php +++ b/packages/file-association/src/Attribute/WithFileAssociation.php @@ -14,6 +14,4 @@ namespace Rekalogika\File\Association\Attribute; #[\Attribute(\Attribute::TARGET_CLASS)] -class WithFileAssociation -{ -} +class WithFileAssociation {} diff --git a/packages/file-association/src/Contracts/FileLocationResolverInterface.php b/packages/file-association/src/Contracts/FileLocationResolverInterface.php index b72e0c4..a918f8b 100644 --- a/packages/file-association/src/Contracts/FileLocationResolverInterface.php +++ b/packages/file-association/src/Contracts/FileLocationResolverInterface.php @@ -26,6 +26,6 @@ interface FileLocationResolverInterface { public function getFileLocation( object $object, - string $propertyName + string $propertyName, ): FilePointerInterface; } diff --git a/packages/file-association/src/Exception/FileAssociationException.php b/packages/file-association/src/Exception/FileAssociationException.php index 1004df8..de5b3c3 100644 --- a/packages/file-association/src/Exception/FileAssociationException.php +++ b/packages/file-association/src/Exception/FileAssociationException.php @@ -13,6 +13,4 @@ namespace Rekalogika\File\Association\Exception; -abstract class FileAssociationException extends \Exception -{ -} +abstract class FileAssociationException extends \Exception {} diff --git a/packages/file-association/src/Exception/FileLocationResolver/ChainedObjectNotSupportedException.php b/packages/file-association/src/Exception/FileLocationResolver/ChainedObjectNotSupportedException.php index d4c1fe1..ce2004f 100644 --- a/packages/file-association/src/Exception/FileLocationResolver/ChainedObjectNotSupportedException.php +++ b/packages/file-association/src/Exception/FileLocationResolver/ChainedObjectNotSupportedException.php @@ -21,7 +21,7 @@ class ChainedObjectNotSupportedException extends FileLocationResolverException public function __construct( object $object, private readonly iterable $exceptions, - \Throwable $previous = null + \Throwable $previous = null, ) { \Exception::__construct( \sprintf( @@ -29,7 +29,7 @@ public function __construct( $object::class, ), 0, - $previous + $previous, ); } diff --git a/packages/file-association/src/Exception/FileLocationResolver/FileLocationResolverException.php b/packages/file-association/src/Exception/FileLocationResolver/FileLocationResolverException.php index 93a4382..417fc8b 100644 --- a/packages/file-association/src/Exception/FileLocationResolver/FileLocationResolverException.php +++ b/packages/file-association/src/Exception/FileLocationResolver/FileLocationResolverException.php @@ -15,6 +15,4 @@ use Rekalogika\File\Association\Exception\FileAssociationException; -class FileLocationResolverException extends FileAssociationException -{ -} +class FileLocationResolverException extends FileAssociationException {} diff --git a/packages/file-association/src/Exception/FileLocationResolver/ObjectNotSupportedException.php b/packages/file-association/src/Exception/FileLocationResolver/ObjectNotSupportedException.php index 3801286..fa5a822 100644 --- a/packages/file-association/src/Exception/FileLocationResolver/ObjectNotSupportedException.php +++ b/packages/file-association/src/Exception/FileLocationResolver/ObjectNotSupportedException.php @@ -24,17 +24,17 @@ public function __construct( string $class, object $object, string $message, - \Throwable $previous = null + \Throwable $previous = null, ) { parent::__construct( \sprintf( 'File location resolver "%s" does not support object "%s": %s', $class, $object::class, - $message + $message, ), 0, - $previous + $previous, ); } } diff --git a/packages/file-association/src/Exception/ObjectIdResolver/ChainedObjectIdResolverException.php b/packages/file-association/src/Exception/ObjectIdResolver/ChainedObjectIdResolverException.php index e8de223..1af6d3d 100644 --- a/packages/file-association/src/Exception/ObjectIdResolver/ChainedObjectIdResolverException.php +++ b/packages/file-association/src/Exception/ObjectIdResolver/ChainedObjectIdResolverException.php @@ -21,7 +21,7 @@ class ChainedObjectIdResolverException extends ObjectIdResolverException public function __construct( object $object, private readonly iterable $exceptions, - \Throwable $previous = null + \Throwable $previous = null, ) { \Exception::__construct( \sprintf( @@ -29,7 +29,7 @@ public function __construct( $object::class, ), 0, - $previous + $previous, ); } diff --git a/packages/file-association/src/Exception/ObjectIdResolver/EmptyIdException.php b/packages/file-association/src/Exception/ObjectIdResolver/EmptyIdException.php index f99b6e7..dd5b038 100644 --- a/packages/file-association/src/Exception/ObjectIdResolver/EmptyIdException.php +++ b/packages/file-association/src/Exception/ObjectIdResolver/EmptyIdException.php @@ -18,16 +18,16 @@ class EmptyIdException extends ObjectIdResolverException public function __construct( object $object, string $method, - \Throwable $previous = null + \Throwable $previous = null, ) { parent::__construct( \sprintf( "Method '%s' in object '%s' returned an empty id", $method, - $object::class + $object::class, ), 0, - $previous + $previous, ); } } diff --git a/packages/file-association/src/Exception/ObjectIdResolver/IdNotSupportedException.php b/packages/file-association/src/Exception/ObjectIdResolver/IdNotSupportedException.php index 87ad671..132afa4 100644 --- a/packages/file-association/src/Exception/ObjectIdResolver/IdNotSupportedException.php +++ b/packages/file-association/src/Exception/ObjectIdResolver/IdNotSupportedException.php @@ -19,17 +19,17 @@ public function __construct( object $object, string $method, mixed $id, - \Throwable $previous = null + \Throwable $previous = null, ) { parent::__construct( \sprintf( 'Method "%s" of object "%s" returned an unsupported identifier "%s"', $method, $object::class, - \get_debug_type($id) + get_debug_type($id), ), 0, - $previous + $previous, ); } } diff --git a/packages/file-association/src/Exception/ObjectIdResolver/MethodNotFoundException.php b/packages/file-association/src/Exception/ObjectIdResolver/MethodNotFoundException.php index 7e00952..d956681 100644 --- a/packages/file-association/src/Exception/ObjectIdResolver/MethodNotFoundException.php +++ b/packages/file-association/src/Exception/ObjectIdResolver/MethodNotFoundException.php @@ -18,16 +18,16 @@ class MethodNotFoundException extends ObjectIdResolverException public function __construct( object $object, string $method, - \Throwable $previous = null + \Throwable $previous = null, ) { parent::__construct( \sprintf( "Method '%s' not found in object '%s'", $method, - $object::class + $object::class, ), 0, - $previous + $previous, ); } } diff --git a/packages/file-association/src/Exception/ObjectIdResolver/ObjectIdResolverException.php b/packages/file-association/src/Exception/ObjectIdResolver/ObjectIdResolverException.php index 39ab4f3..a188a56 100644 --- a/packages/file-association/src/Exception/ObjectIdResolver/ObjectIdResolverException.php +++ b/packages/file-association/src/Exception/ObjectIdResolver/ObjectIdResolverException.php @@ -15,6 +15,4 @@ use Rekalogika\File\Association\Exception\FileAssociationException; -class ObjectIdResolverException extends FileAssociationException -{ -} +class ObjectIdResolverException extends FileAssociationException {} diff --git a/packages/file-association/src/Exception/ObjectIdResolver/ObjectNotSupportedException.php b/packages/file-association/src/Exception/ObjectIdResolver/ObjectNotSupportedException.php index de1f262..cd8c9fa 100644 --- a/packages/file-association/src/Exception/ObjectIdResolver/ObjectNotSupportedException.php +++ b/packages/file-association/src/Exception/ObjectIdResolver/ObjectNotSupportedException.php @@ -17,7 +17,7 @@ class ObjectNotSupportedException extends ObjectIdResolverException { public function __construct( object $object, - \Throwable $previous = null + \Throwable $previous = null, ) { parent::__construct( \sprintf( @@ -25,7 +25,7 @@ public function __construct( $object::class, ), 0, - $previous + $previous, ); } } diff --git a/packages/file-association/src/Exception/PropertyInspector/MissingPropertyException.php b/packages/file-association/src/Exception/PropertyInspector/MissingPropertyException.php index c2d37a8..d7e07d2 100644 --- a/packages/file-association/src/Exception/PropertyInspector/MissingPropertyException.php +++ b/packages/file-association/src/Exception/PropertyInspector/MissingPropertyException.php @@ -20,7 +20,7 @@ public function __construct( object $object, ) { parent::__construct( - sprintf( + \sprintf( 'Property "%s" not found in object "%s"', $propertyName, $object::class, diff --git a/packages/file-association/src/Exception/PropertyInspector/PropertyInspectorException.php b/packages/file-association/src/Exception/PropertyInspector/PropertyInspectorException.php index 009eec0..a61b541 100644 --- a/packages/file-association/src/Exception/PropertyInspector/PropertyInspectorException.php +++ b/packages/file-association/src/Exception/PropertyInspector/PropertyInspectorException.php @@ -15,6 +15,4 @@ use Rekalogika\File\Association\Exception\FileAssociationException; -abstract class PropertyInspectorException extends FileAssociationException -{ -} +abstract class PropertyInspectorException extends FileAssociationException {} diff --git a/packages/file-association/src/Exception/PropertyReader/PropertyReaderException.php b/packages/file-association/src/Exception/PropertyReader/PropertyReaderException.php index 5ca8a1d..0dfec13 100644 --- a/packages/file-association/src/Exception/PropertyReader/PropertyReaderException.php +++ b/packages/file-association/src/Exception/PropertyReader/PropertyReaderException.php @@ -20,9 +20,9 @@ class PropertyReaderException extends FileAssociationException public function __construct( object $object, string $property, - \Throwable $previous = null + \Throwable $previous = null, ) { - $message = sprintf('Unable to read property "%s" in object "%s"', $property, \get_debug_type($object)); + $message = \sprintf('Unable to read property "%s" in object "%s"', $property, get_debug_type($object)); parent::__construct($message, 0, $previous); } diff --git a/packages/file-association/src/Exception/PropertyWriter/PropertyWriterException.php b/packages/file-association/src/Exception/PropertyWriter/PropertyWriterException.php index 5e8046d..9f02ae6 100644 --- a/packages/file-association/src/Exception/PropertyWriter/PropertyWriterException.php +++ b/packages/file-association/src/Exception/PropertyWriter/PropertyWriterException.php @@ -24,9 +24,9 @@ public function __construct( object|array $object, string $property, mixed $value, - \Throwable $previous = null + \Throwable $previous = null, ) { - $message = sprintf('Unable to write "%s" to property "%s" in object "%s"', \get_debug_type($value), $property, \get_debug_type($object)); + $message = \sprintf('Unable to write "%s" to property "%s" in object "%s"', get_debug_type($value), $property, get_debug_type($object)); parent::__construct($message, 0, $previous); } diff --git a/packages/file-association/src/FileAssociationManager.php b/packages/file-association/src/FileAssociationManager.php index 69db798..5031624 100644 --- a/packages/file-association/src/FileAssociationManager.php +++ b/packages/file-association/src/FileAssociationManager.php @@ -31,8 +31,7 @@ public function __construct( private readonly PropertyWriterInterface $writer, private readonly PropertyInspectorInterface $inspector, private readonly FileLocationResolverInterface $fileLocationResolver, - ) { - } + ) {} /** * Called when the object is saved @@ -69,10 +68,10 @@ public function load(object $object): void */ private function saveProperty( object $object, - string $propertyName + string $propertyName, ): void { $currentFile = $this->reader->read($object, $propertyName); - assert($currentFile instanceof FileInterface || null === $currentFile); + \assert($currentFile instanceof FileInterface || null === $currentFile); if ($currentFile instanceof FileInterface) { $filePointer = $this->fileLocationResolver @@ -90,12 +89,12 @@ private function saveProperty( $this->removeProperty($object, $propertyName); } else { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'Property "%s" on object "%s" is not a %s instance', $propertyName, $object::class, - FileInterface::class - ) + FileInterface::class, + ), ); } } @@ -105,7 +104,7 @@ private function saveProperty( */ private function removeProperty( object $object, - string $propertyName + string $propertyName, ): void { $filePointer = $this->fileLocationResolver ->getFileLocation($object, $propertyName); @@ -117,7 +116,7 @@ private function removeProperty( */ private function loadProperty( object $object, - string $propertyName + string $propertyName, ): void { $inspectorResult = $this->inspector->inspect($object, $propertyName); $filePointer = $this->fileLocationResolver @@ -129,19 +128,19 @@ private function loadProperty( if ($file === null && $inspectorResult->isMandatory()) { $file = new MissingFile( $filePointer->getFilesystemIdentifier(), - $filePointer->getKey() + $filePointer->getKey(), ); } } elseif ($inspectorResult->getFetch() === 'LAZY') { $file = $this->fileRepository->getReference($filePointer); } else { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'Unknown fetch mode "%s" on property "%s" of object "%s"', $inspectorResult->getFetch(), $propertyName, - $object::class - ) + $object::class, + ), ); } diff --git a/packages/file-association/src/FileLocationResolver/ChainedFileLocationResolver.php b/packages/file-association/src/FileLocationResolver/ChainedFileLocationResolver.php index 2c2ac54..afec9c2 100644 --- a/packages/file-association/src/FileLocationResolver/ChainedFileLocationResolver.php +++ b/packages/file-association/src/FileLocationResolver/ChainedFileLocationResolver.php @@ -25,13 +25,12 @@ class ChainedFileLocationResolver implements FileLocationResolverInterface */ public function __construct( private readonly iterable $fileLocationResolvers, - ) { - } + ) {} #[\Override] public function getFileLocation( object $object, - string $propertyName + string $propertyName, ): FilePointerInterface { $exceptions = []; diff --git a/packages/file-association/src/FileLocationResolver/DefaultFileLocationResolver.php b/packages/file-association/src/FileLocationResolver/DefaultFileLocationResolver.php index f8c6a51..ba83650 100644 --- a/packages/file-association/src/FileLocationResolver/DefaultFileLocationResolver.php +++ b/packages/file-association/src/FileLocationResolver/DefaultFileLocationResolver.php @@ -25,22 +25,21 @@ public function __construct( private readonly string $filesystemIdentifier = 'default', private readonly string $prefix = 'entity', private readonly int $hashLevel = 4, - ) { - } + ) {} #[\Override] public function getFileLocation( object $object, - string $propertyName + string $propertyName, ): FilePointerInterface { $id = $this->objectIdResolver->getObjectId($object); $splittedHash = str_split(sha1($id), 2); - $hash = implode('/', array_slice($splittedHash, 0, $this->hashLevel)); + $hash = implode('/', \array_slice($splittedHash, 0, $this->hashLevel)); $classHash = sha1($object::class); - $key = sprintf( + $key = \sprintf( '%s/%s/%s/%s/%s', $this->prefix, $classHash, @@ -50,7 +49,7 @@ public function getFileLocation( ); $key = preg_replace('/\/+/', '/', $key); - assert(is_string($key)); + \assert(\is_string($key)); return new FilePointer($this->filesystemIdentifier, $key); } diff --git a/packages/file-association/src/Model/FilePointer.php b/packages/file-association/src/Model/FilePointer.php index 5947ef2..d431e78 100644 --- a/packages/file-association/src/Model/FilePointer.php +++ b/packages/file-association/src/Model/FilePointer.php @@ -27,8 +27,7 @@ class FilePointer implements FilePointerInterface public function __construct( private ?string $filesystemIdentifier, private string $key, - ) { - } + ) {} #[\Override] public function getFilesystemIdentifier(): ?string diff --git a/packages/file-association/src/Model/MissingFile.php b/packages/file-association/src/Model/MissingFile.php index 82c4808..b13c487 100644 --- a/packages/file-association/src/Model/MissingFile.php +++ b/packages/file-association/src/Model/MissingFile.php @@ -33,15 +33,15 @@ public function __construct( private string $key, ) { if ($filesystemIdentifier === null) { - parent::__construct(sprintf( + parent::__construct(\sprintf( 'File with key "%s" is missing in the local filesystem', $key, )); } else { - parent::__construct(sprintf( + parent::__construct(\sprintf( 'File with key "%s" is missing in filesystem "%s"', $key, - $filesystemIdentifier + $filesystemIdentifier, )); } } diff --git a/packages/file-association/src/Model/PropertyInspectorResult.php b/packages/file-association/src/Model/PropertyInspectorResult.php index a52a0b1..03bbcbf 100644 --- a/packages/file-association/src/Model/PropertyInspectorResult.php +++ b/packages/file-association/src/Model/PropertyInspectorResult.php @@ -25,7 +25,7 @@ public function __construct( private readonly bool $mandatory, private readonly string $fetch, ) { - if (!in_array($fetch, ['EAGER', 'LAZY'])) { + if (!\in_array($fetch, ['EAGER', 'LAZY'])) { throw new \InvalidArgumentException('Fetch mode can only be EAGER or LAZY.'); } } diff --git a/packages/file-association/src/ObjectIdResolver/ChainedObjectIdResolver.php b/packages/file-association/src/ObjectIdResolver/ChainedObjectIdResolver.php index ff80605..c80e685 100644 --- a/packages/file-association/src/ObjectIdResolver/ChainedObjectIdResolver.php +++ b/packages/file-association/src/ObjectIdResolver/ChainedObjectIdResolver.php @@ -28,7 +28,7 @@ class ChainedObjectIdResolver implements ObjectIdResolverInterface * @param iterable $objectIdResolvers */ public function __construct( - private readonly iterable $objectIdResolvers + private readonly iterable $objectIdResolvers, ) { /** @var \WeakMap */ $map = new \WeakMap(); diff --git a/packages/file-association/src/ObjectIdResolver/DefaultObjectIdResolver.php b/packages/file-association/src/ObjectIdResolver/DefaultObjectIdResolver.php index 423facb..a51a34a 100644 --- a/packages/file-association/src/ObjectIdResolver/DefaultObjectIdResolver.php +++ b/packages/file-association/src/ObjectIdResolver/DefaultObjectIdResolver.php @@ -22,20 +22,19 @@ class DefaultObjectIdResolver implements ObjectIdResolverInterface { public function __construct( private readonly string $method = 'getId', - ) { - } + ) {} #[\Override] public function getObjectId(object $object): string { - if (\method_exists($object, $this->method)) { + if (method_exists($object, $this->method)) { /** @var mixed */ $id = $object->{$this->method}(); } else { throw new MethodNotFoundException($object, $this->method); } - if (!is_string($id) && !is_int($id) && !$id instanceof \Stringable) { + if (!\is_string($id) && !\is_int($id) && !$id instanceof \Stringable) { throw new IdNotSupportedException($object, $this->method, $id); } diff --git a/packages/file-association/src/ObjectIdResolver/DoctrineObjectIdResolver.php b/packages/file-association/src/ObjectIdResolver/DoctrineObjectIdResolver.php index 0865991..b682d23 100644 --- a/packages/file-association/src/ObjectIdResolver/DoctrineObjectIdResolver.php +++ b/packages/file-association/src/ObjectIdResolver/DoctrineObjectIdResolver.php @@ -27,8 +27,7 @@ class DoctrineObjectIdResolver implements ObjectIdResolverInterface { public function __construct( private readonly ManagerRegistry $managerRegistry, - ) { - } + ) {} #[\Override] public function getObjectId(object $object): string @@ -40,7 +39,7 @@ public function getObjectId(object $object): string throw new ObjectNotSupportedException($object); } - if (\method_exists($objectManager, 'getUnitOfWork')) { + if (method_exists($objectManager, 'getUnitOfWork')) { /** @var UnitOfWork */ $unitOfWork = $objectManager->getUnitOfWork(); if (!$unitOfWork instanceof UnitOfWork) { @@ -61,7 +60,7 @@ public function getObjectId(object $object): string $stringIds = []; foreach ($ids as $id) { - if (!is_scalar($id) && !$id instanceof \Stringable) { + if (!\is_scalar($id) && !$id instanceof \Stringable) { throw new ObjectNotSupportedException($object); } diff --git a/packages/file-association/src/PropertyLister/AttributesPropertyLister.php b/packages/file-association/src/PropertyLister/AttributesPropertyLister.php index ee690f0..011170a 100644 --- a/packages/file-association/src/PropertyLister/AttributesPropertyLister.php +++ b/packages/file-association/src/PropertyLister/AttributesPropertyLister.php @@ -71,13 +71,13 @@ private function getReflectionProperties(string $class): iterable */ private function getReflectionPropertiesWithAttribute( string $class, - string $attribute + string $attribute, ): iterable { foreach ($this->getReflectionProperties($class) as $reflectionProperty) { $attributes = $reflectionProperty ->getAttributes($attribute); - if (count($attributes) === 1) { + if (\count($attributes) === 1) { yield $reflectionProperty; } } diff --git a/packages/file-association/src/PropertyLister/ChainPropertyLister.php b/packages/file-association/src/PropertyLister/ChainPropertyLister.php index b6a3e29..ea2be4c 100644 --- a/packages/file-association/src/PropertyLister/ChainPropertyLister.php +++ b/packages/file-association/src/PropertyLister/ChainPropertyLister.php @@ -25,8 +25,7 @@ class ChainPropertyLister implements PropertyListerInterface */ public function __construct( private readonly iterable $propertyListers, - ) { - } + ) {} #[\Override] public function getFileProperties(object $object): iterable @@ -35,7 +34,7 @@ public function getFileProperties(object $object): iterable foreach ($this->propertyListers as $propertyLister) { $newProperties = $propertyLister->getFileProperties($object); - $newProperties = is_array($newProperties) ? $newProperties : iterator_to_array($newProperties); + $newProperties = \is_array($newProperties) ? $newProperties : iterator_to_array($newProperties); $properties = array_merge($properties, $newProperties); } diff --git a/packages/file-association/src/PropertyReaderWriter/SymfonyPropertyAccessorBridge.php b/packages/file-association/src/PropertyReaderWriter/SymfonyPropertyAccessorBridge.php index d6b57bd..088715e 100644 --- a/packages/file-association/src/PropertyReaderWriter/SymfonyPropertyAccessorBridge.php +++ b/packages/file-association/src/PropertyReaderWriter/SymfonyPropertyAccessorBridge.php @@ -28,8 +28,7 @@ class SymfonyPropertyAccessorBridge implements { public function __construct( private readonly SymfonyPropertyAccessorInterface $propertyAccessor, - ) { - } + ) {} #[\Override] public function write(object $object, string $propertyName, mixed $value): void diff --git a/packages/file-association/src/Reconstitutor/AttributeReconstitutor.php b/packages/file-association/src/Reconstitutor/AttributeReconstitutor.php index d60287c..745f51c 100644 --- a/packages/file-association/src/Reconstitutor/AttributeReconstitutor.php +++ b/packages/file-association/src/Reconstitutor/AttributeReconstitutor.php @@ -23,9 +23,8 @@ class AttributeReconstitutor implements AttributeReconstitutorInterface { public function __construct( - private readonly FileAssociationManager $fileAssociationManager - ) { - } + private readonly FileAssociationManager $fileAssociationManager, + ) {} #[\Override] public static function getAttributeClass(): string @@ -52,7 +51,5 @@ public function onLoad(object $object): void } #[\Override] - public function onCreate(object $object): void - { - } + public function onCreate(object $object): void {} } diff --git a/packages/file-association/src/Reconstitutor/InterfaceReconstitutor.php b/packages/file-association/src/Reconstitutor/InterfaceReconstitutor.php index 797dd7a..b8814f7 100644 --- a/packages/file-association/src/Reconstitutor/InterfaceReconstitutor.php +++ b/packages/file-association/src/Reconstitutor/InterfaceReconstitutor.php @@ -25,9 +25,8 @@ class InterfaceReconstitutor implements ClassReconstitutorInterface { public function __construct( - private readonly FileAssociationManager $fileAssociationService - ) { - } + private readonly FileAssociationManager $fileAssociationService, + ) {} #[\Override] public static function getClass(): string @@ -54,7 +53,5 @@ public function onLoad(object $object): void } #[\Override] - public function onCreate(object $object): void - { - } + public function onCreate(object $object): void {} } diff --git a/packages/file-bundle/config/file-association.php b/packages/file-bundle/config/file-association.php index aec8f03..7dc652d 100644 --- a/packages/file-bundle/config/file-association.php +++ b/packages/file-bundle/config/file-association.php @@ -77,7 +77,7 @@ $services->alias( ObjectIdResolverInterface::class, - ChainedObjectIdResolver::class + ChainedObjectIdResolver::class, ); $services->set(ChainedObjectIdResolver::class) @@ -106,7 +106,7 @@ $services->alias( FileLocationResolverInterface::class, - ChainedFileLocationResolver::class + ChainedFileLocationResolver::class, ); $services->set(ChainedFileLocationResolver::class) @@ -150,12 +150,12 @@ $services->alias( PropertyReaderInterface::class, - SymfonyPropertyAccessorBridge::class + SymfonyPropertyAccessorBridge::class, ); $services->alias( PropertyWriterInterface::class, - SymfonyPropertyAccessorBridge::class + SymfonyPropertyAccessorBridge::class, ); // diff --git a/packages/file-bundle/config/file-zip.php b/packages/file-bundle/config/file-zip.php index 1c838cf..72e1bf8 100644 --- a/packages/file-bundle/config/file-zip.php +++ b/packages/file-bundle/config/file-zip.php @@ -26,7 +26,7 @@ $services->set(FileZip::class) ->args([ service(ZipDirectory::class), - service(TranslatorInterface::class) + service(TranslatorInterface::class), ]); $services->set(ZipDirectory::class) diff --git a/packages/file-bundle/src/DefaultFilesystemFactory.php b/packages/file-bundle/src/DefaultFilesystemFactory.php index af3d14a..56460c0 100644 --- a/packages/file-bundle/src/DefaultFilesystemFactory.php +++ b/packages/file-bundle/src/DefaultFilesystemFactory.php @@ -25,9 +25,7 @@ class DefaultFilesystemFactory { private ?FilesystemOperator $filesystem = null; - public function __construct(private readonly string $directory) - { - } + public function __construct(private readonly string $directory) {} public function getDefaultFilesystem(): FilesystemOperator { diff --git a/packages/file-bundle/src/DependencyInjection/FilterPass.php b/packages/file-bundle/src/DependencyInjection/FilterPass.php index e7dbe12..974106a 100644 --- a/packages/file-bundle/src/DependencyInjection/FilterPass.php +++ b/packages/file-bundle/src/DependencyInjection/FilterPass.php @@ -34,16 +34,16 @@ public function process(ContainerBuilder $container): void $class = $definition->getClass(); if ($class === null) { - throw new \InvalidArgumentException(sprintf('Service "%s" has no class', $id)); + throw new \InvalidArgumentException(\sprintf('Service "%s" has no class', $id)); } $reflection = $container->getReflectionClass($class); if ($reflection === null) { - throw new \InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); + throw new \InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); } if (!$reflection->isSubclassOf(FileFilterInterface::class)) { - throw new \InvalidArgumentException(sprintf('Service %s is not %s', $id, FileFilterInterface::class)); + throw new \InvalidArgumentException(\sprintf('Service %s is not %s', $id, FileFilterInterface::class)); } $definition diff --git a/packages/file-bundle/src/DependencyInjection/RekalogikaFileExtension.php b/packages/file-bundle/src/DependencyInjection/RekalogikaFileExtension.php index cdc23f0..b0f47f5 100644 --- a/packages/file-bundle/src/DependencyInjection/RekalogikaFileExtension.php +++ b/packages/file-bundle/src/DependencyInjection/RekalogikaFileExtension.php @@ -39,7 +39,7 @@ public function load(array $configs, ContainerBuilder $container): void { $loader = new PhpFileLoader( $container, - new FileLocator(__DIR__ . '/../../config') + new FileLocator(__DIR__ . '/../../config'), ); // @@ -90,9 +90,9 @@ public function load(array $configs, ContainerBuilder $container): void /** @var array */ $filesystems = $config['filesystems'] ?? []; - if (count($filesystems) === 0) { + if (\count($filesystems) === 0) { $filesystems = [ - 'default' => 'rekalogika.file.default_filesystem' + 'default' => 'rekalogika.file.default_filesystem', ]; } @@ -138,7 +138,7 @@ class_exists(EmbeddedMetadata::class) throw new \RuntimeException('Unable to get path of EmbeddedMetadata class'); } - $configDir = realpath(dirname($path, 2) . '/config/doctrine'); + $configDir = realpath(\dirname($path, 2) . '/config/doctrine'); if (false === $configDir) { throw new \RuntimeException('Unable to get path of EmbeddedMetadata class'); } diff --git a/packages/file-contracts/src/Exception/File/DerivationNotSupportedException.php b/packages/file-contracts/src/Exception/File/DerivationNotSupportedException.php index 5c3b173..6978431 100644 --- a/packages/file-contracts/src/Exception/File/DerivationNotSupportedException.php +++ b/packages/file-contracts/src/Exception/File/DerivationNotSupportedException.php @@ -13,6 +13,4 @@ namespace Rekalogika\Contracts\File\Exception\File; -class DerivationNotSupportedException extends FileException -{ -} +class DerivationNotSupportedException extends FileException {} diff --git a/packages/file-contracts/src/Exception/File/FatalErrorException.php b/packages/file-contracts/src/Exception/File/FatalErrorException.php index 3f39e8d..c835e3a 100644 --- a/packages/file-contracts/src/Exception/File/FatalErrorException.php +++ b/packages/file-contracts/src/Exception/File/FatalErrorException.php @@ -13,6 +13,4 @@ namespace Rekalogika\Contracts\File\Exception\File; -class FatalErrorException extends FileException -{ -} +class FatalErrorException extends FileException {} diff --git a/packages/file-contracts/src/Exception/File/FileException.php b/packages/file-contracts/src/Exception/File/FileException.php index a379777..04c20e1 100644 --- a/packages/file-contracts/src/Exception/File/FileException.php +++ b/packages/file-contracts/src/Exception/File/FileException.php @@ -15,6 +15,4 @@ use Rekalogika\Contracts\File\Exception\FileException as ExceptionFileException; -abstract class FileException extends ExceptionFileException -{ -} +abstract class FileException extends ExceptionFileException {} diff --git a/packages/file-contracts/src/Exception/File/FileNotFoundException.php b/packages/file-contracts/src/Exception/File/FileNotFoundException.php index cc52218..088ee65 100644 --- a/packages/file-contracts/src/Exception/File/FileNotFoundException.php +++ b/packages/file-contracts/src/Exception/File/FileNotFoundException.php @@ -18,26 +18,26 @@ class FileNotFoundException extends FileException public function __construct( string $key, ?string $filesystemId = null, - \Throwable $previous = null + \Throwable $previous = null, ) { if ($filesystemId !== null) { parent::__construct( - sprintf( + \sprintf( 'File "%s" in filesystem "%s" does not exist.', $key, $filesystemId, ), 0, - $previous + $previous, ); } else { parent::__construct( - sprintf( + \sprintf( 'File "%s" does not exist.', $key, ), 0, - $previous + $previous, ); } } diff --git a/packages/file-contracts/src/Exception/File/LocalTemporaryFileException.php b/packages/file-contracts/src/Exception/File/LocalTemporaryFileException.php index 1af3fb7..617b3a9 100644 --- a/packages/file-contracts/src/Exception/File/LocalTemporaryFileException.php +++ b/packages/file-contracts/src/Exception/File/LocalTemporaryFileException.php @@ -13,6 +13,4 @@ namespace Rekalogika\Contracts\File\Exception\File; -class LocalTemporaryFileException extends FileException -{ -} +class LocalTemporaryFileException extends FileException {} diff --git a/packages/file-contracts/src/Exception/File/NullFileOperationException.php b/packages/file-contracts/src/Exception/File/NullFileOperationException.php index 957ecac..80acbfd 100644 --- a/packages/file-contracts/src/Exception/File/NullFileOperationException.php +++ b/packages/file-contracts/src/Exception/File/NullFileOperationException.php @@ -18,6 +18,4 @@ * involving a null file that will potentially cause a side effect should throw * this exception. */ -class NullFileOperationException extends FileException -{ -} +class NullFileOperationException extends FileException {} diff --git a/packages/file-contracts/src/Exception/File/TemporaryFileException.php b/packages/file-contracts/src/Exception/File/TemporaryFileException.php index 7175e3a..cc5da00 100644 --- a/packages/file-contracts/src/Exception/File/TemporaryFileException.php +++ b/packages/file-contracts/src/Exception/File/TemporaryFileException.php @@ -18,26 +18,26 @@ class TemporaryFileException extends FileException public function __construct( string $prefix, ?string $filesystemId = null, - \Throwable $previous = null + \Throwable $previous = null, ) { if ($filesystemId !== null) { parent::__construct( - sprintf( + \sprintf( 'Cannot create a temporary file with prefix "%s" in filesystem "%s"', $prefix, $filesystemId, ), 0, - $previous + $previous, ); } else { parent::__construct( - sprintf( + \sprintf( 'Cannot create a temporary file with prefix "%s" in the local filesystem.', $prefix, ), 0, - $previous + $previous, ); } } diff --git a/packages/file-contracts/src/Exception/FileException.php b/packages/file-contracts/src/Exception/FileException.php index 009e214..102604a 100644 --- a/packages/file-contracts/src/Exception/FileException.php +++ b/packages/file-contracts/src/Exception/FileException.php @@ -13,6 +13,4 @@ namespace Rekalogika\Contracts\File\Exception; -abstract class FileException extends \Exception -{ -} +abstract class FileException extends \Exception {} diff --git a/packages/file-contracts/src/Exception/FileRepository/AdHocFilesystemException.php b/packages/file-contracts/src/Exception/FileRepository/AdHocFilesystemException.php index f40c69d..2f0a83c 100644 --- a/packages/file-contracts/src/Exception/FileRepository/AdHocFilesystemException.php +++ b/packages/file-contracts/src/Exception/FileRepository/AdHocFilesystemException.php @@ -19,12 +19,12 @@ class AdHocFilesystemException extends FileRepositoryException { public function __construct( FileInterface $file, - \Throwable $previous = null + \Throwable $previous = null, ) { - parent::__construct(sprintf( + parent::__construct(\sprintf( 'File with key "%s" has an ad-hoc filesystem "%s", but the function you are using in the file repository is unable work with such a file.', $file->getKey(), - $file->getFilesystemIdentifier() ?? 'null' + $file->getFilesystemIdentifier() ?? 'null', ), 0, $previous); } } diff --git a/packages/file-contracts/src/Exception/FileRepository/FileRepositoryException.php b/packages/file-contracts/src/Exception/FileRepository/FileRepositoryException.php index e1731cd..397f62e 100644 --- a/packages/file-contracts/src/Exception/FileRepository/FileRepositoryException.php +++ b/packages/file-contracts/src/Exception/FileRepository/FileRepositoryException.php @@ -15,6 +15,4 @@ use Rekalogika\Contracts\File\Exception\FileException; -abstract class FileRepositoryException extends FileException -{ -} +abstract class FileRepositoryException extends FileException {} diff --git a/packages/file-contracts/src/Exception/MetadataNotFoundException.php b/packages/file-contracts/src/Exception/MetadataNotFoundException.php index e7817ca..13b4f59 100644 --- a/packages/file-contracts/src/Exception/MetadataNotFoundException.php +++ b/packages/file-contracts/src/Exception/MetadataNotFoundException.php @@ -18,9 +18,9 @@ class MetadataNotFoundException extends \Exception public function __construct(string $metadataName, \Throwable $previous = null) { parent::__construct( - sprintf('Metadata "%s" is not found', $metadataName), + \sprintf('Metadata "%s" is not found', $metadataName), 0, - $previous + $previous, ); } } diff --git a/packages/file-contracts/src/FileProxy.php b/packages/file-contracts/src/FileProxy.php index 3fa74ce..4633c4a 100644 --- a/packages/file-contracts/src/FileProxy.php +++ b/packages/file-contracts/src/FileProxy.php @@ -28,7 +28,7 @@ final class FileProxy implements FileInterface // public static function getFile( - FileInterface|null $file + FileInterface|null $file, ): FileInterface|null { if ($file instanceof self) { try { @@ -58,8 +58,7 @@ public static function getFile( public function __construct( private FilePointerInterface $filePointer, private FileRepositoryInterface $fileRepository, - ) { - } + ) {} // // proxy related methods diff --git a/packages/file-contracts/src/FileRepositoryInterface.php b/packages/file-contracts/src/FileRepositoryInterface.php index 5f1cc98..86b2905 100644 --- a/packages/file-contracts/src/FileRepositoryInterface.php +++ b/packages/file-contracts/src/FileRepositoryInterface.php @@ -52,7 +52,7 @@ public function clear(): void; public function createFromString( FilePointerInterface $filePointer, string $contents, - iterable $metadata = [] + iterable $metadata = [], ): FileInterface; /** @@ -64,7 +64,7 @@ public function createFromString( public function createFromStream( FilePointerInterface $filePointer, mixed $stream, - iterable $metadata = [] + iterable $metadata = [], ): FileInterface; /** @@ -73,7 +73,7 @@ public function createFromStream( public function createFromLocalFile( FilePointerInterface $filePointer, string $localFilePath, - iterable $metadata = [] + iterable $metadata = [], ): FileInterface; /** @@ -96,7 +96,7 @@ public function delete(FilePointerInterface $filePointer): void; */ public function copy( FilePointerInterface|FileInterface $source, - FilePointerInterface|FileInterface $destination + FilePointerInterface|FileInterface $destination, ): FileInterface; /** @@ -104,6 +104,6 @@ public function copy( */ public function move( FilePointerInterface|FileInterface $source, - FilePointerInterface|FileInterface $destination + FilePointerInterface|FileInterface $destination, ): FileInterface; } diff --git a/packages/file-contracts/src/NodeInterface.php b/packages/file-contracts/src/NodeInterface.php index 932e14b..1c585c7 100644 --- a/packages/file-contracts/src/NodeInterface.php +++ b/packages/file-contracts/src/NodeInterface.php @@ -16,6 +16,4 @@ /** * Represents a file, a file pointer, or directory */ -interface NodeInterface -{ -} +interface NodeInterface {} diff --git a/packages/file-contracts/src/NullFileInterface.php b/packages/file-contracts/src/NullFileInterface.php index cb3bc7b..bf5fab2 100644 --- a/packages/file-contracts/src/NullFileInterface.php +++ b/packages/file-contracts/src/NullFileInterface.php @@ -16,6 +16,4 @@ /** * Marker interface for a null file object. */ -interface NullFileInterface extends FileInterface -{ -} +interface NullFileInterface extends FileInterface {} diff --git a/packages/file-contracts/src/NullFilePointerInterface.php b/packages/file-contracts/src/NullFilePointerInterface.php index 7a6af2d..8c5d1e1 100644 --- a/packages/file-contracts/src/NullFilePointerInterface.php +++ b/packages/file-contracts/src/NullFilePointerInterface.php @@ -16,6 +16,4 @@ /** * Marker interface for a null file pointer object. */ -interface NullFilePointerInterface extends FilePointerInterface -{ -} +interface NullFilePointerInterface extends FilePointerInterface {} diff --git a/packages/file-derivation/src/Filter/AbstractFileFilter.php b/packages/file-derivation/src/Filter/AbstractFileFilter.php index 7bd498e..daea89d 100644 --- a/packages/file-derivation/src/Filter/AbstractFileFilter.php +++ b/packages/file-derivation/src/Filter/AbstractFileFilter.php @@ -29,7 +29,7 @@ abstract class AbstractFileFilter implements FileFilterInterface */ #[\Override] final public function setFileRepository( - FileRepositoryInterface $fileRepository + FileRepositoryInterface $fileRepository, ): void { $this->fileRepository = $fileRepository; } @@ -43,7 +43,7 @@ final public function getFileRepository(): FileRepositoryInterface * Caller must call this method to set the source file */ final public function take( - FileInterface $sourceFile + FileInterface $sourceFile, ): static { $clone = clone $this; $clone->sourceFile = $sourceFile; @@ -95,7 +95,7 @@ public function getResult(): FileInterface { if (!isset($this->sourceFile)) { throw new \LogicException( - 'Call "take()" first before calling "getResult()"' + 'Call "take()" first before calling "getResult()"', ); } diff --git a/packages/file-derivation/src/Filter/FileFilterInterface.php b/packages/file-derivation/src/Filter/FileFilterInterface.php index e91e1ab..8c93433 100644 --- a/packages/file-derivation/src/Filter/FileFilterInterface.php +++ b/packages/file-derivation/src/Filter/FileFilterInterface.php @@ -18,6 +18,6 @@ interface FileFilterInterface { public function setFileRepository( - FileRepositoryInterface $fileRepository + FileRepositoryInterface $fileRepository, ): void; } diff --git a/packages/file-filepond/src/DependencyInjection/RekalogikaFileFilePondExtension.php b/packages/file-filepond/src/DependencyInjection/RekalogikaFileFilePondExtension.php index 205946e..ed9b30e 100644 --- a/packages/file-filepond/src/DependencyInjection/RekalogikaFileFilePondExtension.php +++ b/packages/file-filepond/src/DependencyInjection/RekalogikaFileFilePondExtension.php @@ -35,7 +35,7 @@ public function load(array $configs, ContainerBuilder $container): void public function prepend(ContainerBuilder $container): void { $container->prependExtensionConfig('twig', [ - 'form_themes' => ['@RekalogikaFileFilePond/filepond_form_theme.html.twig'] + 'form_themes' => ['@RekalogikaFileFilePond/filepond_form_theme.html.twig'], ]); if ($this->isAssetMapperAvailable($container)) { diff --git a/packages/file-filepond/src/FilePondCollectionType.php b/packages/file-filepond/src/FilePondCollectionType.php index b6a1a88..f3e4673 100644 --- a/packages/file-filepond/src/FilePondCollectionType.php +++ b/packages/file-filepond/src/FilePondCollectionType.php @@ -38,7 +38,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $builder ->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($options): void { $incomingFiles = $event->getData(); - if (!is_array($incomingFiles)) { + if (!\is_array($incomingFiles)) { throw new \InvalidArgumentException('Incoming files must be an array'); } @@ -51,7 +51,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void if ($options['allow_delete'] === true) { foreach (array_keys($newData) as $key) { - if (!in_array((string) $key, $incomingFiles, true)) { + if (!\in_array((string) $key, $incomingFiles, true)) { unset($newData[$key]); } } diff --git a/packages/file-filepond/src/FilePondFileEncodeAdapter.php b/packages/file-filepond/src/FilePondFileEncodeAdapter.php index 67d3385..dc33615 100644 --- a/packages/file-filepond/src/FilePondFileEncodeAdapter.php +++ b/packages/file-filepond/src/FilePondFileEncodeAdapter.php @@ -29,22 +29,22 @@ class FilePondFileEncodeAdapter public static function adaptFromArray(array $input): FileInterface { $data = $input['data'] ?? null; - if (!is_string($data)) { + if (!\is_string($data)) { throw new \UnexpectedValueException('Invalid FilePond input. Expecting "data" containing a Base64 string.'); } - $data = \base64_decode($data, true); + $data = base64_decode($data, true); if ($data === false) { throw new \UnexpectedValueException('Invalid Base64 string.'); } $name = $input['name'] ?? null; - if (!is_string($name)) { + if (!\is_string($name)) { throw new \UnexpectedValueException('Invalid FilePond input. Expecting "name" containing a string.'); } $type = $input['type'] ?? null; - if (!is_string($type)) { + if (!\is_string($type)) { throw new \UnexpectedValueException('Invalid FilePond input. Expecting "type" containing a string.'); } @@ -59,8 +59,8 @@ public static function adaptFromArray(array $input): FileInterface public static function adaptFromString(string $jsonInput): FileInterface { - $input = \json_decode($jsonInput, true, 512, JSON_THROW_ON_ERROR); - if (!is_array($input)) { + $input = json_decode($jsonInput, true, 512, JSON_THROW_ON_ERROR); + if (!\is_array($input)) { throw new \JsonException('Expecting JSON data in object type'); } diff --git a/packages/file-image/src/ImageResizer.php b/packages/file-image/src/ImageResizer.php index b9409a9..818d580 100644 --- a/packages/file-image/src/ImageResizer.php +++ b/packages/file-image/src/ImageResizer.php @@ -42,7 +42,7 @@ class ImageResizer extends AbstractFileFilter public function resize( int $maxWidthOrHeight = 512, - string $aspect = self::ASPECTRATIO_ORIGINAL + string $aspect = self::ASPECTRATIO_ORIGINAL, ): self { $this->maxWidthOrHeight = $maxWidthOrHeight; $this->aspect = $aspect; @@ -62,7 +62,7 @@ public function createThumbnail(): self #[\Override] protected function getDerivationId(): string { - return sprintf('%s-%s', $this->aspect, $this->maxWidthOrHeight); + return \sprintf('%s-%s', $this->aspect, $this->maxWidthOrHeight); } #[\Override] @@ -87,9 +87,9 @@ protected function process(): FileInterface } elseif ($this->aspect === self::ASPECTRATIO_ORIGINAL) { $ratio = $w / $h; } else { - throw new \InvalidArgumentException(sprintf( + throw new \InvalidArgumentException(\sprintf( 'Unknown aspect ratio "%s"', - $this->aspect + $this->aspect, )); } diff --git a/packages/file-image/src/ImageTwigExtension.php b/packages/file-image/src/ImageTwigExtension.php index 3a75dab..4f935af 100644 --- a/packages/file-image/src/ImageTwigExtension.php +++ b/packages/file-image/src/ImageTwigExtension.php @@ -41,7 +41,7 @@ public function setContainer(ContainerInterface $container): void private function getImageResizer(): ImageResizer { $resizer = $this->container->get(ImageResizer::class); - assert($resizer instanceof ImageResizer); + \assert($resizer instanceof ImageResizer); return $resizer; } @@ -50,14 +50,14 @@ private function getImageResizer(): ImageResizer public function getFilters(): array { return [ - new TwigFilter('image_resize', $this->fileImageResize(...)) + new TwigFilter('image_resize', $this->fileImageResize(...)), ]; } public function fileImageResize( ?FileInterface $file, int $maxWidthOrHeight = 512, - string $aspect = ImageResizer::ASPECTRATIO_ORIGINAL + string $aspect = ImageResizer::ASPECTRATIO_ORIGINAL, ): ?FileInterface { if ($file === null) { return null; diff --git a/packages/file-metadata/src/Metadata/AbstractMetadata.php b/packages/file-metadata/src/Metadata/AbstractMetadata.php index bb93317..d66803c 100644 --- a/packages/file-metadata/src/Metadata/AbstractMetadata.php +++ b/packages/file-metadata/src/Metadata/AbstractMetadata.php @@ -18,6 +18,6 @@ abstract class AbstractMetadata { abstract public static function create( - RawMetadataInterface $metadata + RawMetadataInterface $metadata, ): ?static; } diff --git a/packages/file-metadata/src/Metadata/FileMetadata.php b/packages/file-metadata/src/Metadata/FileMetadata.php index 7e228af..38ee0a3 100644 --- a/packages/file-metadata/src/Metadata/FileMetadata.php +++ b/packages/file-metadata/src/Metadata/FileMetadata.php @@ -25,15 +25,14 @@ final class FileMetadata extends AbstractMetadata implements FileMetadataInterfa { #[\Override] public static function create( - RawMetadataInterface $metadata + RawMetadataInterface $metadata, ): static { return new self($metadata); } private function __construct( - private readonly RawMetadataInterface $metadata - ) { - } + private readonly RawMetadataInterface $metadata, + ) {} #[\Override] public function getName(): FileNameInterface @@ -73,7 +72,7 @@ public function getSize(): int { $size = $this->metadata->tryGet(Constants::FILE_SIZE) ?? 0; - if (!is_int($size)) { + if (!\is_int($size)) { $size = (int) $size; } @@ -109,7 +108,7 @@ public function getModificationTime(): \DateTimeInterface $modificationTime = new \DateTimeImmutable(); $this->metadata->set( Constants::FILE_MODIFICATION_TIME, - $modificationTime->getTimestamp() + $modificationTime->getTimestamp(), ); return $modificationTime; diff --git a/packages/file-metadata/src/Metadata/HttpMetadata.php b/packages/file-metadata/src/Metadata/HttpMetadata.php index 0a6de86..51954b2 100644 --- a/packages/file-metadata/src/Metadata/HttpMetadata.php +++ b/packages/file-metadata/src/Metadata/HttpMetadata.php @@ -23,15 +23,14 @@ final class HttpMetadata extends AbstractMetadata implements { #[\Override] public static function create( - RawMetadataInterface $metadata + RawMetadataInterface $metadata, ): static { return new self($metadata); } private function __construct( - private readonly RawMetadataInterface $metadata - ) { - } + private readonly RawMetadataInterface $metadata, + ) {} public function getDate(): string { diff --git a/packages/file-metadata/src/Metadata/ImageMetadata.php b/packages/file-metadata/src/Metadata/ImageMetadata.php index ffe470d..ce4e245 100644 --- a/packages/file-metadata/src/Metadata/ImageMetadata.php +++ b/packages/file-metadata/src/Metadata/ImageMetadata.php @@ -22,7 +22,7 @@ final class ImageMetadata extends AbstractMetadata implements { #[\Override] public static function create( - RawMetadataInterface $metadata + RawMetadataInterface $metadata, ): ?static { if (!((bool) $metadata->tryGet(Constants::MEDIA_WIDTH))) { return null; @@ -32,9 +32,8 @@ public static function create( } private function __construct( - private readonly RawMetadataInterface $metadata - ) { - } + private readonly RawMetadataInterface $metadata, + ) {} #[\Override] public function getWidth(): int diff --git a/packages/file-metadata/src/MetadataFactory.php b/packages/file-metadata/src/MetadataFactory.php index ef31ee8..7cd30db 100644 --- a/packages/file-metadata/src/MetadataFactory.php +++ b/packages/file-metadata/src/MetadataFactory.php @@ -30,9 +30,8 @@ public static function create(RawMetadataInterface $metadata): self } private function __construct( - private readonly RawMetadataInterface $metadata - ) { - } + private readonly RawMetadataInterface $metadata, + ) {} /** * @template T of AbstractMetadata diff --git a/packages/file-metadata/src/Model/FileName.php b/packages/file-metadata/src/Model/FileName.php index 14e5e90..5b2fe9f 100644 --- a/packages/file-metadata/src/Model/FileName.php +++ b/packages/file-metadata/src/Model/FileName.php @@ -25,7 +25,7 @@ final class FileName implements FileNameInterface public function __construct( ?string $filename, - ?string $forceExtension = null + ?string $forceExtension = null, ) { if ($filename !== null) { $this->parse($filename); @@ -64,7 +64,7 @@ public function trans(TranslatorInterface $translator, ?string $locale = null): { if ($this->name === null) { $full = $this->getFull(); - assert($full instanceof TranslatableInterface); + \assert($full instanceof TranslatableInterface); return $full->trans($translator, $locale); } @@ -82,7 +82,7 @@ public function getFull(): \Stringable&TranslatableInterface 'Untitled.{extension}', [ '{extension}' => $this->extension, - ] + ], ); } @@ -97,7 +97,7 @@ public function getFull(): \Stringable&TranslatableInterface [ '{name}' => $this->name, '{extension}' => $this->extension, - ] + ], ); } @@ -106,7 +106,7 @@ public function getFull(): \Stringable&TranslatableInterface '{name}', [ '{name}' => $this->name, - ] + ], ); } @@ -129,7 +129,7 @@ public function getBase(): \Stringable&TranslatableInterface '{name}', [ '{name}' => $this->name, - ] + ], ); } diff --git a/packages/file-metadata/src/Model/MimeMapFileTypeAdapter.php b/packages/file-metadata/src/Model/MimeMapFileTypeAdapter.php index 920da3f..863f2f0 100644 --- a/packages/file-metadata/src/Model/MimeMapFileTypeAdapter.php +++ b/packages/file-metadata/src/Model/MimeMapFileTypeAdapter.php @@ -28,7 +28,7 @@ final class MimeMapFileTypeAdapter implements FileTypeInterface public function __construct(string $type) { $type = strtolower($type); - $type = \trim($type); + $type = trim($type); $this->type = $type; } @@ -98,10 +98,10 @@ public function getDescription(): \Stringable&TranslatableInterface ); } catch (MappingException) { return new TranslatableMessage( - sprintf('Unknown file type (%s)', $this->type), + \sprintf('Unknown file type (%s)', $this->type), 'Unknown file type ({type})', [ - '{type}' => $this->type + '{type}' => $this->type, ], ); } diff --git a/packages/file-metadata/src/Model/TranslatableFileName.php b/packages/file-metadata/src/Model/TranslatableFileName.php index ab8c5ad..28e3538 100644 --- a/packages/file-metadata/src/Model/TranslatableFileName.php +++ b/packages/file-metadata/src/Model/TranslatableFileName.php @@ -24,9 +24,8 @@ final class TranslatableFileName implements FileNameInterface { public function __construct( private readonly TranslatableInterface&\Stringable $base, - private ?string $extension = null - ) { - } + private ?string $extension = null, + ) {} #[\Override] public function __toString(): string @@ -45,12 +44,12 @@ public function getFull(): \Stringable&TranslatableInterface { if ($this->extension !== null && $this->extension !== '') { return new TranslatableMessage( - sprintf('%s.%s', (string) $this->base, $this->extension), + \sprintf('%s.%s', (string) $this->base, $this->extension), '{name}.{extension}', [ '{name}' => $this->base, '{extension}' => $this->extension, - ] + ], ); } @@ -59,7 +58,7 @@ public function getFull(): \Stringable&TranslatableInterface '{name}', [ '{name}' => $this->base, - ] + ], ); } diff --git a/packages/file-metadata/src/Model/TranslatableMessage.php b/packages/file-metadata/src/Model/TranslatableMessage.php index 9ee95d8..c9284b8 100644 --- a/packages/file-metadata/src/Model/TranslatableMessage.php +++ b/packages/file-metadata/src/Model/TranslatableMessage.php @@ -27,9 +27,8 @@ final class TranslatableMessage implements TranslatableInterface, \Stringable public function __construct( private readonly string $stringName, private readonly string $translationId, - private readonly array $parameters = [] - ) { - } + private readonly array $parameters = [], + ) {} #[\Override] public function __toString(): string @@ -40,13 +39,13 @@ public function __toString(): string #[\Override] public function trans( TranslatorInterface $translator, - ?string $locale = null + ?string $locale = null, ): string { return $translator->trans( $this->translationId, $this->parameters, 'rekalogika_file', - $locale + $locale, ); } } diff --git a/packages/file-null/src/InvalidFile.php b/packages/file-null/src/InvalidFile.php index 9b64aec..1181d00 100644 --- a/packages/file-null/src/InvalidFile.php +++ b/packages/file-null/src/InvalidFile.php @@ -27,8 +27,7 @@ class InvalidFile extends \Exception implements NullFileInterface public function __construct( private ?string $filesystemIdentifier = null, private ?string $key = null, - ) { - } + ) {} #[\Override] public function getFilesystemIdentifier(): ?string diff --git a/packages/file-null/src/NullFile.php b/packages/file-null/src/NullFile.php index a8f531e..1746e4a 100644 --- a/packages/file-null/src/NullFile.php +++ b/packages/file-null/src/NullFile.php @@ -27,8 +27,7 @@ class NullFile implements NullFileInterface public function __construct( private ?string $filesystemIdentifier = null, private ?string $key = null, - ) { - } + ) {} #[\Override] public function getFilesystemIdentifier(): ?string diff --git a/packages/file-null/src/NullFileTrait.php b/packages/file-null/src/NullFileTrait.php index db0526c..ef363fe 100644 --- a/packages/file-null/src/NullFileTrait.php +++ b/packages/file-null/src/NullFileTrait.php @@ -121,7 +121,5 @@ public function get(string $id): mixed return null; } - public function flush(): void - { - } + public function flush(): void {} } diff --git a/packages/file-null/src/NullName.php b/packages/file-null/src/NullName.php index 8ec1592..44dfa6d 100644 --- a/packages/file-null/src/NullName.php +++ b/packages/file-null/src/NullName.php @@ -21,9 +21,8 @@ class NullName implements FileNameInterface { public function __construct( private readonly string $name, - private readonly string $translationDomain - ) { - } + private readonly string $translationDomain, + ) {} #[\Override] public function getFull(): \Stringable&TranslatableInterface @@ -32,23 +31,19 @@ public function getFull(): \Stringable&TranslatableInterface } #[\Override] - public function setFull(string $name): void - { - } + public function setFull(string $name): void {} #[\Override] public function getBase(): \Stringable&TranslatableInterface { return new TranslatableMessage( $this->name, - $this->translationDomain + $this->translationDomain, ); } #[\Override] - public function setBase(string $name): void - { - } + public function setBase(string $name): void {} #[\Override] public function getExtension(): ?string @@ -57,9 +52,7 @@ public function getExtension(): ?string } #[\Override] - public function setExtension(?string $extension): void - { - } + public function setExtension(?string $extension): void {} #[\Override] public function hasExtension(): bool diff --git a/packages/file-null/src/NullType.php b/packages/file-null/src/NullType.php index e70e454..2aa20c3 100644 --- a/packages/file-null/src/NullType.php +++ b/packages/file-null/src/NullType.php @@ -20,9 +20,8 @@ class NullType implements FileTypeInterface { public function __construct( private readonly string $description, - private readonly string $translationDomain - ) { - } + private readonly string $translationDomain, + ) {} #[\Override] public function getName(): string @@ -59,7 +58,7 @@ public function getDescription(): \Stringable&TranslatableInterface { return new TranslatableMessage( $this->description, - $this->translationDomain + $this->translationDomain, ); } diff --git a/packages/file-null/src/TranslatableMessage.php b/packages/file-null/src/TranslatableMessage.php index 711ae51..29b35aa 100644 --- a/packages/file-null/src/TranslatableMessage.php +++ b/packages/file-null/src/TranslatableMessage.php @@ -20,9 +20,8 @@ class TranslatableMessage implements \Stringable, TranslatableInterface { public function __construct( private readonly string $name, - private readonly string $translationDomain - ) { - } + private readonly string $translationDomain, + ) {} #[\Override] public function __toString(): string @@ -33,13 +32,13 @@ public function __toString(): string #[\Override] public function trans( TranslatorInterface $translator, - ?string $locale = null + ?string $locale = null, ): string { return $translator->trans( $this->name, [], $this->translationDomain, - $locale + $locale, ); } } diff --git a/packages/file-oneup-uploader-bridge/src/FromOneUpUploaderFileAdapter.php b/packages/file-oneup-uploader-bridge/src/FromOneUpUploaderFileAdapter.php index cc307cd..5201006 100644 --- a/packages/file-oneup-uploader-bridge/src/FromOneUpUploaderFileAdapter.php +++ b/packages/file-oneup-uploader-bridge/src/FromOneUpUploaderFileAdapter.php @@ -26,14 +26,14 @@ class FromOneUpUploaderFileAdapter extends File private function __construct(TheirFileInterface $file) { $filesystem = $file->getFileSystem(); - assert($filesystem === null || $filesystem instanceof FilesystemOperator); + \assert($filesystem === null || $filesystem instanceof FilesystemOperator); if ($filesystem === null) { $ourFilesystem = null; } elseif (class_exists(FilesystemOperator::class) && $filesystem instanceof FilesystemOperator) { $ourFilesystem = $filesystem; } else { - throw new \InvalidArgumentException('Unsupported filesystem type: ' . \get_debug_type($filesystem)); + throw new \InvalidArgumentException('Unsupported filesystem type: ' . get_debug_type($filesystem)); } parent::__construct($file->getPathname(), $ourFilesystem); diff --git a/packages/file-server/src/FileInterfaceResourceServer.php b/packages/file-server/src/FileInterfaceResourceServer.php index 802235d..c45cd21 100644 --- a/packages/file-server/src/FileInterfaceResourceServer.php +++ b/packages/file-server/src/FileInterfaceResourceServer.php @@ -25,8 +25,7 @@ class FileInterfaceResourceServer { public function __construct( private readonly FileRepositoryInterface $fileRepository, - ) { - } + ) {} #[AsTemporaryUrlResourceTransformer] public function transform(FileInterface $file): FilePointerInterface diff --git a/packages/file-symfony-bridge/src/Constraints/File.php b/packages/file-symfony-bridge/src/Constraints/File.php index 6e1f7a3..d416464 100644 --- a/packages/file-symfony-bridge/src/Constraints/File.php +++ b/packages/file-symfony-bridge/src/Constraints/File.php @@ -16,6 +16,4 @@ use Symfony\Component\Validator\Constraints\File as SymfonyFile; #[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] -class File extends SymfonyFile -{ -} +class File extends SymfonyFile {} diff --git a/packages/file-symfony-bridge/src/Constraints/Image.php b/packages/file-symfony-bridge/src/Constraints/Image.php index de668e9..d45fecf 100644 --- a/packages/file-symfony-bridge/src/Constraints/Image.php +++ b/packages/file-symfony-bridge/src/Constraints/Image.php @@ -16,6 +16,4 @@ use Symfony\Component\Validator\Constraints\Image as SymfonyImage; #[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] -class Image extends SymfonyImage -{ -} +class Image extends SymfonyImage {} diff --git a/packages/file-symfony-bridge/src/Form/FileTransformer.php b/packages/file-symfony-bridge/src/Form/FileTransformer.php index 24bd717..5333d41 100644 --- a/packages/file-symfony-bridge/src/Form/FileTransformer.php +++ b/packages/file-symfony-bridge/src/Form/FileTransformer.php @@ -44,10 +44,10 @@ public function transform($value): ?File } if (!$value instanceof FileInterface) { - throw new TransformationFailedException(sprintf( + throw new TransformationFailedException(\sprintf( 'Expecting "%s", but getting "%s" instead.', FileInterface::class, - \get_debug_type($value), + get_debug_type($value), )); } @@ -72,10 +72,10 @@ public function reverseTransform(mixed $value): ?FileInterface } if (!$value instanceof File) { - throw new TransformationFailedException(sprintf( + throw new TransformationFailedException(\sprintf( 'Expecting "%s", but getting "%s" instead.', File::class, - \get_debug_type($value), + get_debug_type($value), )); } diff --git a/packages/file-symfony-bridge/src/HttpFoundation/FileResponse.php b/packages/file-symfony-bridge/src/HttpFoundation/FileResponse.php index 20740d7..ce5083d 100644 --- a/packages/file-symfony-bridge/src/HttpFoundation/FileResponse.php +++ b/packages/file-symfony-bridge/src/HttpFoundation/FileResponse.php @@ -33,7 +33,7 @@ public function __construct( ?->getHeaders($disposition) ?? []; if ($headersFromMetadata instanceof \Traversable) { - $headersFromMetadata = \iterator_to_array($headersFromMetadata); + $headersFromMetadata = iterator_to_array($headersFromMetadata); } $responseHeaders = [ @@ -42,7 +42,7 @@ public function __construct( ]; $inputStream = $file->getContentAsStream()->detach(); - assert($inputStream !== null); + \assert($inputStream !== null); $callback = function () use ($inputStream): void { $outputStream = fopen('php://output', 'wb'); diff --git a/packages/file-symfony-bridge/src/HttpFoundation/ToHttpFoundationFileAdapter.php b/packages/file-symfony-bridge/src/HttpFoundation/ToHttpFoundationFileAdapter.php index 655a5dd..b8e0ef0 100644 --- a/packages/file-symfony-bridge/src/HttpFoundation/ToHttpFoundationFileAdapter.php +++ b/packages/file-symfony-bridge/src/HttpFoundation/ToHttpFoundationFileAdapter.php @@ -37,9 +37,7 @@ class ToHttpFoundationFileAdapter extends HttpFoundationFile */ private ?HttpFoundationFile $httpFoundationFile = null; - private function __construct(private readonly FileInterface $file) - { - } + private function __construct(private readonly FileInterface $file) {} public static function adapt(FileInterface $file): HttpFoundationFile { @@ -64,7 +62,7 @@ private function getHttpFoundationFile(): HttpFoundationFile $this->localTemporaryFile = $this->file->createLocalTemporaryFile(); $this->httpFoundationFile = new HttpFoundationFile( - $this->localTemporaryFile->getPathname() + $this->localTemporaryFile->getPathname(), ); return $this->httpFoundationFile; @@ -267,7 +265,7 @@ public function isWritable(): bool public function openFile( string $mode = 'r', bool $useIncludePath = false, - $context = null + $context = null, ): \SplFileObject { return $this->getHttpFoundationFile() ->openFile($mode, $useIncludePath, $context); diff --git a/packages/file-zip/src/DirectoryResourceServer.php b/packages/file-zip/src/DirectoryResourceServer.php index a126d1b..b52da5a 100644 --- a/packages/file-zip/src/DirectoryResourceServer.php +++ b/packages/file-zip/src/DirectoryResourceServer.php @@ -26,8 +26,7 @@ final class DirectoryResourceServer public function __construct( private readonly FileZip $fileZip, private readonly TranslatorInterface $translator, - ) { - } + ) {} /** * @param DirectoryInterface $files diff --git a/packages/file-zip/src/FileZip.php b/packages/file-zip/src/FileZip.php index 304077f..7d29f0e 100644 --- a/packages/file-zip/src/FileZip.php +++ b/packages/file-zip/src/FileZip.php @@ -26,8 +26,7 @@ final class FileZip public function __construct( private readonly ZipDirectory $zipDirectory, private readonly TranslatorInterface $translator, - ) { - } + ) {} /** * @param DirectoryInterface $directory diff --git a/packages/file-zip/src/Model/Directory.php b/packages/file-zip/src/Model/Directory.php index 19d7544..39d2764 100644 --- a/packages/file-zip/src/Model/Directory.php +++ b/packages/file-zip/src/Model/Directory.php @@ -32,9 +32,8 @@ final class Directory implements DirectoryInterface, \IteratorAggregate public function __construct( private readonly ?string $name = null, - private readonly ?Directory $parent = null - ) { - } + private readonly ?Directory $parent = null, + ) {} #[\Override] public function getIterator(): \Traversable @@ -51,7 +50,7 @@ public function getName(): FileNameInterface #[\Override] public function count(): int { - return count($this->entries); + return \count($this->entries); } public function getContainingDirectory(): ?Directory diff --git a/packages/file-zip/src/Model/FilePointer.php b/packages/file-zip/src/Model/FilePointer.php index 76f43ff..39ad02f 100644 --- a/packages/file-zip/src/Model/FilePointer.php +++ b/packages/file-zip/src/Model/FilePointer.php @@ -22,21 +22,20 @@ final class FilePointer implements FilePointerInterface public static function createFromInterface( FilePointerInterface $filePointer, - Directory $directory + Directory $directory, ): self { return new self( $filePointer->getFilesystemIdentifier(), $filePointer->getKey(), - $directory + $directory, ); } public function __construct( private ?string $filesystemIdentifier, private string $key, - private ?Directory $directory = null - ) { - } + private ?Directory $directory = null, + ) {} #[\Override] public function getFilesystemIdentifier(): ?string diff --git a/packages/file-zip/src/ZipDirectory.php b/packages/file-zip/src/ZipDirectory.php index e3f797f..96b7c3b 100644 --- a/packages/file-zip/src/ZipDirectory.php +++ b/packages/file-zip/src/ZipDirectory.php @@ -48,8 +48,7 @@ final class ZipDirectory public function __construct( private FileRepositoryInterface $fileRepository, private ?TranslatorInterface $translator = null, - ) { - } + ) {} /** * @param DirectoryInterface $directory @@ -142,10 +141,10 @@ public function getDirectoryPath(): string } if ($this->parent !== null) { - $result = sprintf( + $result = \sprintf( '%s/%s/', $this->parent->getDirectoryPath(), - $this->directoryName + $this->directoryName, ); } else { $result = $this->directoryName . '/'; diff --git a/packages/file/src/Contracts/FilesystemRepositoryInterface.php b/packages/file/src/Contracts/FilesystemRepositoryInterface.php index 898c8ec..04d0e73 100644 --- a/packages/file/src/Contracts/FilesystemRepositoryInterface.php +++ b/packages/file/src/Contracts/FilesystemRepositoryInterface.php @@ -31,7 +31,7 @@ interface FilesystemRepositoryInterface * @throws FilesystemNotFoundException */ public function getFilesystem( - ?string $identifier + ?string $identifier, ): MetadataAwareFilesystemOperator; /** @@ -41,6 +41,6 @@ public function getFilesystem( */ public function addFilesystem( string $identifier, - FilesystemOperator $filesystem + FilesystemOperator $filesystem, ): void; } diff --git a/packages/file/src/Contracts/MetadataAwareFilesystemOperator.php b/packages/file/src/Contracts/MetadataAwareFilesystemOperator.php index 3747ee8..7d72a1a 100644 --- a/packages/file/src/Contracts/MetadataAwareFilesystemOperator.php +++ b/packages/file/src/Contracts/MetadataAwareFilesystemOperator.php @@ -18,6 +18,4 @@ interface MetadataAwareFilesystemOperator extends FilesystemOperator, MetadataAwareFilesystemReader, - MetadataAwareFilesystemWriter -{ -} + MetadataAwareFilesystemWriter {} diff --git a/packages/file/src/Directory.php b/packages/file/src/Directory.php index ff5d799..62abb40 100644 --- a/packages/file/src/Directory.php +++ b/packages/file/src/Directory.php @@ -33,9 +33,8 @@ class Directory implements DirectoryInterface, \IteratorAggregate */ public function __construct( private readonly string $name, - private readonly array $entries = [] - ) { - } + private readonly array $entries = [], + ) {} #[\Override] public function getIterator(): \Traversable @@ -52,6 +51,6 @@ public function getName(): FileNameInterface #[\Override] public function count(): int { - return count($this->entries); + return \count($this->entries); } } diff --git a/packages/file/src/Exception/FilesystemRepository/FilesystemAlreadyExistsException.php b/packages/file/src/Exception/FilesystemRepository/FilesystemAlreadyExistsException.php index b42b7f0..aa2279b 100644 --- a/packages/file/src/Exception/FilesystemRepository/FilesystemAlreadyExistsException.php +++ b/packages/file/src/Exception/FilesystemRepository/FilesystemAlreadyExistsException.php @@ -17,6 +17,6 @@ class FilesystemAlreadyExistsException extends FilesystemRepositoryException { public function __construct(string $filesystemId) { - parent::__construct(sprintf('Filesystem with identifier "%s" is already exists', $filesystemId)); + parent::__construct(\sprintf('Filesystem with identifier "%s" is already exists', $filesystemId)); } } diff --git a/packages/file/src/Exception/FilesystemRepository/FilesystemNotFoundException.php b/packages/file/src/Exception/FilesystemRepository/FilesystemNotFoundException.php index ea71c77..79a65e5 100644 --- a/packages/file/src/Exception/FilesystemRepository/FilesystemNotFoundException.php +++ b/packages/file/src/Exception/FilesystemRepository/FilesystemNotFoundException.php @@ -17,6 +17,6 @@ class FilesystemNotFoundException extends FilesystemRepositoryException { public function __construct(string $filesystemId) { - parent::__construct(sprintf('Filesystem with identifier "%s" is not found', $filesystemId)); + parent::__construct(\sprintf('Filesystem with identifier "%s" is not found', $filesystemId)); } } diff --git a/packages/file/src/Exception/FilesystemRepository/FilesystemRepositoryException.php b/packages/file/src/Exception/FilesystemRepository/FilesystemRepositoryException.php index 3760a14..1fe6be5 100644 --- a/packages/file/src/Exception/FilesystemRepository/FilesystemRepositoryException.php +++ b/packages/file/src/Exception/FilesystemRepository/FilesystemRepositoryException.php @@ -13,6 +13,4 @@ namespace Rekalogika\File\Exception\FilesystemRepository; -class FilesystemRepositoryException extends \Exception -{ -} +class FilesystemRepositoryException extends \Exception {} diff --git a/packages/file/src/File.php b/packages/file/src/File.php index 563e7cf..c22a1ea 100644 --- a/packages/file/src/File.php +++ b/packages/file/src/File.php @@ -87,7 +87,7 @@ public function __construct( throw new FileNotFoundException($key); } - if (!\file_exists($realpath)) { + if (!file_exists($realpath)) { throw new FileNotFoundException($key); } @@ -111,7 +111,7 @@ public function getPointer(): FilePointerInterface { return new FilePointer( $this->getFilesystemIdentifier(), - $this->key + $this->key, ); } @@ -269,15 +269,15 @@ public function getDerivation(string $derivationId): FilePointerInterface throw new DerivationNotSupportedException('It is not allowed to create derivation from a file in an ad-hoc filesystem.'); } - if ((bool)preg_match('/^[a-zA-Z0-9_-]+$/', $derivationId) === false) { + if ((bool) preg_match('/^[a-zA-Z0-9_-]+$/', $derivationId) === false) { throw new \InvalidArgumentException('Derivation ID must consist of alphanumeric characters, dash, or underscore only.'); } - $derivationKey = sprintf('%s.d/%s', $this->key, $derivationId); + $derivationKey = \sprintf('%s.d/%s', $this->key, $derivationId); return new FilePointer( $this->getFilesystemIdentifier(), - $derivationKey + $derivationKey, ); } diff --git a/packages/file/src/FileAdapter.php b/packages/file/src/FileAdapter.php index d5d8d66..dfb609a 100644 --- a/packages/file/src/FileAdapter.php +++ b/packages/file/src/FileAdapter.php @@ -25,13 +25,11 @@ */ class FileAdapter { - private function __construct() - { - } + private function __construct() {} public static function adapt(string|object $source): FileInterface { - if (is_string($source)) { + if (\is_string($source)) { return new File($source); } elseif ($source instanceof FileInterface) { return $source; @@ -43,9 +41,9 @@ public static function adapt(string|object $source): FileInterface return FromOneUpUploaderFileAdapter::adapt($source); } - throw new \InvalidArgumentException(sprintf( + throw new \InvalidArgumentException(\sprintf( 'Converting "%s" to a "%s" is not supported', - \get_debug_type($source), + get_debug_type($source), FileInterface::class, )); } diff --git a/packages/file/src/FileFactory.php b/packages/file/src/FileFactory.php index bde407b..8b63273 100644 --- a/packages/file/src/FileFactory.php +++ b/packages/file/src/FileFactory.php @@ -118,7 +118,7 @@ public function setFilesystems(iterable $filesystems): self public function addFilesystem( string $identifier, - FilesystemOperator $filesystem + FilesystemOperator $filesystem, ): self { $this->filesystems[$identifier] = $filesystem; @@ -126,7 +126,7 @@ public function addFilesystem( } public function setDefaultFilesystemIdForTemporaryFile( - ?string $defaultFilesystemIdForTemporaryFile + ?string $defaultFilesystemIdForTemporaryFile, ): self { $this->defaultFilesystemIdForTemporaryFile = $defaultFilesystemIdForTemporaryFile; diff --git a/packages/file/src/FilePointer.php b/packages/file/src/FilePointer.php index 433cd6e..6997c64 100644 --- a/packages/file/src/FilePointer.php +++ b/packages/file/src/FilePointer.php @@ -23,8 +23,7 @@ class FilePointer implements FilePointerInterface public function __construct( private ?string $filesystemIdentifier, private string $key, - ) { - } + ) {} #[\Override] public function getFilesystemIdentifier(): ?string diff --git a/packages/file/src/Filesystem/LocalFilesystemDecorator.php b/packages/file/src/Filesystem/LocalFilesystemDecorator.php index 2de04de..cfb3637 100644 --- a/packages/file/src/Filesystem/LocalFilesystemDecorator.php +++ b/packages/file/src/Filesystem/LocalFilesystemDecorator.php @@ -24,8 +24,7 @@ class LocalFilesystemDecorator implements MetadataAwareFilesystemOperator { public function __construct( private readonly FilesystemOperator $wrapped, - ) { - } + ) {} // // implementations @@ -40,7 +39,7 @@ private function getImageSize(string $location): array $temporaryFile = tempnam( sys_get_temp_dir(), - 'metadata_aware_filesystem_operator_decorator_' + 'metadata_aware_filesystem_operator_decorator_', ); if ($temporaryFile === false) { @@ -157,7 +156,7 @@ public function publicUrl(string $path, $config = []): string public function temporaryUrl( string $path, \DateTimeInterface $expiresAt, - $config = [] + $config = [], ): string { return $this->wrapped->temporaryUrl($path, $expiresAt, $config); } diff --git a/packages/file/src/Filesystem/RemoteFilesystemDecorator.php b/packages/file/src/Filesystem/RemoteFilesystemDecorator.php index cb4b30d..9bdf51c 100644 --- a/packages/file/src/Filesystem/RemoteFilesystemDecorator.php +++ b/packages/file/src/Filesystem/RemoteFilesystemDecorator.php @@ -39,8 +39,7 @@ public function __construct( private readonly MetadataSerializerInterface $serializer, private readonly MetadataGeneratorInterface $metadataGenerator, private readonly string $suffix = '.metadata', - ) { - } + ) {} public function withFilesystem(FilesystemOperator $filesystem): self { @@ -64,7 +63,7 @@ private function getWrapped(): FilesystemOperator // private function getMetadataFromSidecarFile( - string $location + string $location, ): ?RawMetadata { try { $serialized = $this->getWrapped() @@ -89,7 +88,7 @@ private function getMetadataKey(string $location): string private function generateMetadataFromStoredData( RawMetadataInterface $rawMetadata, - string $location + string $location, ): void { $input = $this->getWrapped()->readStream($location); @@ -163,7 +162,7 @@ public function setMetadata(string $location, iterable $metadata): void */ private function saveMetadata( string $location, - iterable $metadata + iterable $metadata, ): void { if (!$metadata instanceof RawMetadata) { $metadata = new RawMetadata($metadata); @@ -184,7 +183,7 @@ private function saveMetadata( public function write( string $location, string $contents, - array $config = [] + array $config = [], ): void { $rawMetadata = $this->getMetadataFromSidecarFile($location) ?? new RawMetadata(); @@ -209,9 +208,9 @@ public function write( public function writeStream( string $location, mixed $contents, - array $config = [] + array $config = [], ): void { - assert(\is_resource($contents)); + \assert(\is_resource($contents)); $rawMetadata = $this->getMetadataFromSidecarFile($location) ?? new RawMetadata(); @@ -307,7 +306,7 @@ public function publicUrl(string $path, $config = []): string public function temporaryUrl( string $path, \DateTimeInterface $expiresAt, - $config = [] + $config = [], ): string { return $this->getWrapped()->temporaryUrl($path, $expiresAt, $config); } diff --git a/packages/file/src/LocalTemporaryFile.php b/packages/file/src/LocalTemporaryFile.php index 3d6683c..cb6df48 100644 --- a/packages/file/src/LocalTemporaryFile.php +++ b/packages/file/src/LocalTemporaryFile.php @@ -36,7 +36,7 @@ private function __construct(string $file) #[\Override] public function __toString(): string { - \trigger_deprecation('rekalogika/file', 'latest', 'LocalTemporaryFile should not be cast to string. Use getPathname() instead.'); + trigger_deprecation('rekalogika/file', 'latest', 'LocalTemporaryFile should not be cast to string. Use getPathname() instead.'); return parent::__toString(); // disable this for now @@ -56,7 +56,7 @@ final public static function create(?string $prefix = null): self $path = tempnam(sys_get_temp_dir(), $prefix); if ($path === false) { - throw new LocalTemporaryFileException(sprintf( + throw new LocalTemporaryFileException(\sprintf( 'Cannot create a temporary file with prefix "%s" in system temporary directory.', $prefix, )); @@ -72,18 +72,18 @@ final public static function create(?string $prefix = null): self final public static function createFromExisting( mixed $file, ): self { - if (!is_string($file)) { + if (!\is_string($file)) { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'File must be a string, "%s" given', - \get_debug_type($file) - ) + get_debug_type($file), + ), ); } - if (!\file_exists($file)) { + if (!file_exists($file)) { throw new LocalTemporaryFileException( - sprintf('File "%s" does not exist', $file) + \sprintf('File "%s" does not exist', $file), ); } diff --git a/packages/file/src/MetadataGenerator/MetadataGenerator.php b/packages/file/src/MetadataGenerator/MetadataGenerator.php index 3b54699..0d1405a 100644 --- a/packages/file/src/MetadataGenerator/MetadataGenerator.php +++ b/packages/file/src/MetadataGenerator/MetadataGenerator.php @@ -25,7 +25,7 @@ final class MetadataGenerator implements MetadataGeneratorInterface private readonly MimeTypeDetector $mimeTypeDetector; public function __construct( - ?MimeTypeDetector $mimeTypeDetector = null + ?MimeTypeDetector $mimeTypeDetector = null, ) { $this->mimeTypeDetector = $mimeTypeDetector ?? new FinfoMimeTypeDetector(); } @@ -44,7 +44,7 @@ public function generateMetadataFromFile( Constants::FILE_TYPE, $this->mimeTypeDetector ->detectMimeTypeFromFile($path) - ?? 'application/octet-stream' + ?? 'application/octet-stream', ); $imagesize = $this->getImageSize($path); @@ -73,7 +73,7 @@ public function generateMetadataFromFile( #[\Override] public function generateMetadataFromString( RawMetadataInterface $rawMetadata, - string $content + string $content, ): void { $tempFile = $this->createTemporaryFileFromString($content); diff --git a/packages/file/src/MetadataGenerator/MetadataGeneratorInterface.php b/packages/file/src/MetadataGenerator/MetadataGeneratorInterface.php index 9c91a9f..f3e047d 100644 --- a/packages/file/src/MetadataGenerator/MetadataGeneratorInterface.php +++ b/packages/file/src/MetadataGenerator/MetadataGeneratorInterface.php @@ -25,7 +25,7 @@ interface MetadataGeneratorInterface */ public function generateMetadataFromFile( RawMetadataInterface $rawMetadata, - string|\SplFileInfo $file + string|\SplFileInfo $file, ): void; /** @@ -33,7 +33,7 @@ public function generateMetadataFromFile( */ public function generateMetadataFromString( RawMetadataInterface $rawMetadata, - string $content + string $content, ): void; /** diff --git a/packages/file/src/MetadataSerializer/MetadataSerializer.php b/packages/file/src/MetadataSerializer/MetadataSerializer.php index b8b1c4e..1dcaa0f 100644 --- a/packages/file/src/MetadataSerializer/MetadataSerializer.php +++ b/packages/file/src/MetadataSerializer/MetadataSerializer.php @@ -22,7 +22,7 @@ class MetadataSerializer implements MetadataSerializerInterface #[\Override] public function serialize(RawMetadataInterface $metadata): string { - $array = \iterator_to_array($metadata); + $array = iterator_to_array($metadata); return json_encode($array, \JSON_FORCE_OBJECT | \JSON_THROW_ON_ERROR | \JSON_UNESCAPED_UNICODE | \JSON_UNESCAPED_SLASHES); } @@ -32,7 +32,7 @@ public function deserialize(string $serialized): RawMetadataInterface { $array = json_decode($serialized, true, 512, \JSON_THROW_ON_ERROR); - if (!is_array($array)) { + if (!\is_array($array)) { return new RawMetadata(); } @@ -53,18 +53,18 @@ private function convertLegacyData(array $inputArray): array $newArray = []; foreach ($inputArray as $key => $value) { - if (is_string($key) && (is_string($value) || is_bool($value) || is_int($value) || is_null($value))) { + if (\is_string($key) && (\is_string($value) || \is_bool($value) || \is_int($value) || \is_null($value))) { $newArray[$key] = $value; } } - if (!is_array($legacyMetadata)) { + if (!\is_array($legacyMetadata)) { return $newArray; } /** @psalm-suppress MixedAssignment */ foreach ($legacyMetadata as $key => $value) { - if (!is_string($value) && !is_null($value) && !is_int($value)) { + if (!\is_string($value) && !\is_null($value) && !\is_int($value)) { continue; } @@ -75,7 +75,7 @@ private function convertLegacyData(array $inputArray): array case 'file-name': $file = $value; - if (!is_string($file) && !is_null($file)) { + if (!\is_string($file) && !\is_null($file)) { $file = null; } @@ -83,7 +83,7 @@ private function convertLegacyData(array $inputArray): array break; case 'content-length': - if (!is_int($value)) { + if (!\is_int($value)) { continue 2; } @@ -95,7 +95,7 @@ private function convertLegacyData(array $inputArray): array break; case 'last-modified': - if (!is_string($value)) { + if (!\is_string($value)) { continue 2; } @@ -104,7 +104,7 @@ private function convertLegacyData(array $inputArray): array // no break case 'width': - if (!is_int($value)) { + if (!\is_int($value)) { continue 2; } @@ -112,7 +112,7 @@ private function convertLegacyData(array $inputArray): array break; case 'height': - if (!is_int($value)) { + if (!\is_int($value)) { continue 2; } diff --git a/packages/file/src/RawMetadata.php b/packages/file/src/RawMetadata.php index 8ac80ac..fa20d1d 100644 --- a/packages/file/src/RawMetadata.php +++ b/packages/file/src/RawMetadata.php @@ -43,7 +43,7 @@ public function getIterator(): \Traversable #[\Override] public function get(string $key): int|string|bool|null { - if (!array_key_exists($key, $this->metadata)) { + if (!\array_key_exists($key, $this->metadata)) { throw new MetadataNotFoundException($key); } diff --git a/packages/file/src/Repository/FileRepository.php b/packages/file/src/Repository/FileRepository.php index b5fe2ce..e738f86 100644 --- a/packages/file/src/Repository/FileRepository.php +++ b/packages/file/src/Repository/FileRepository.php @@ -42,9 +42,8 @@ class FileRepository implements FileRepositoryInterface public function __construct( private readonly FilesystemRepositoryInterface $filesystemRepository, private readonly MetadataGeneratorInterface $metadataGenerator, - private readonly ?string $defaultFilesystemIdForTemporaryFile = null - ) { - } + private readonly ?string $defaultFilesystemIdForTemporaryFile = null, + ) {} #[\Override] public function clear(): void @@ -53,7 +52,7 @@ public function clear(): void } private function getFilesystemFromPointerOrFile( - FilePointerInterface|FileInterface $file + FilePointerInterface|FileInterface $file, ): FilesystemOperator { try { $identifier = $file->getFilesystemIdentifier(); @@ -72,7 +71,7 @@ private function getFilesystemFromPointerOrFile( public function createFromString( FilePointerInterface $filePointer, string $contents, - iterable $metadata = [] + iterable $metadata = [], ): FileInterface { $this->getFilesystemFromPointerOrFile($filePointer) ->write($filePointer->getKey(), $contents, [ @@ -86,7 +85,7 @@ public function createFromString( public function createFromStream( FilePointerInterface $filePointer, mixed $stream, - iterable $metadata = [] + iterable $metadata = [], ): FileInterface { if ($stream instanceof StreamInterface) { $stream = $stream->detach(); @@ -108,7 +107,7 @@ public function createFromStream( public function createFromLocalFile( FilePointerInterface $filePointer, string $localFilePath, - iterable $metadata = [] + iterable $metadata = [], ): FileInterface { $newMetadata = new RawMetadata(); @@ -141,7 +140,7 @@ public function get(FilePointerInterface $filePointer): FileInterface if (!$filesystem->fileExists($filePointer->getKey())) { throw new FileNotFoundException( $filePointer->getKey(), - $filePointer->getFilesystemIdentifier() + $filePointer->getFilesystemIdentifier(), ); } @@ -177,17 +176,17 @@ public function getReference(FilePointerInterface $filePointer): FileInterface } private function getMetadata( - FilePointerInterface|FileInterface $file + FilePointerInterface|FileInterface $file, ): RawMetadataInterface { if ($file instanceof FileInterface) { $metadata = $file->get(RawMetadataInterface::class); if (!$metadata) { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'File "%s" does not have metadata', - $file->getKey() - ) + $file->getKey(), + ), ); } @@ -204,7 +203,7 @@ private function getMetadata( throw new FileNotFoundException( $file->getKey(), - $file->getFilesystemIdentifier() + $file->getFilesystemIdentifier(), ); } @@ -213,7 +212,7 @@ private function getMetadata( */ private function setMetadata( FilePointerInterface|FileInterface $file, - iterable $metadata + iterable $metadata, ): void { $filesystem = $this->getFilesystemFromPointerOrFile($file); @@ -234,14 +233,14 @@ public function delete(FilePointerInterface $filePointer): void #[\Override] public function copy( FilePointerInterface|FileInterface $source, - FilePointerInterface|FileInterface $destination + FilePointerInterface|FileInterface $destination, ): FileInterface { if ($source->isEqualTo($destination)) { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'Source and destination file pointers are the same: %s', - $source->getKey() - ) + $source->getKey(), + ), ); } @@ -249,7 +248,7 @@ public function copy( $this->getFilesystemFromPointerOrFile($source) ->copy( $source->getKey(), - $destination->getKey() + $destination->getKey(), ); } else { if ($source instanceof FilePointerInterface) { @@ -257,7 +256,7 @@ public function copy( } $sourceStream = $source->getContentAsStream()->detach(); - assert(is_resource($sourceStream)); + \assert(\is_resource($sourceStream)); $this->getFilesystemFromPointerOrFile($destination) ->writeStream( @@ -284,14 +283,14 @@ public function copy( #[\Override] public function move( FilePointerInterface|FileInterface $source, - FilePointerInterface|FileInterface $destination + FilePointerInterface|FileInterface $destination, ): FileInterface { if ($source->isEqualTo($destination)) { throw new \InvalidArgumentException( - sprintf( + \sprintf( 'Source and destination file pointers are the same: %s', - $source->getKey() - ) + $source->getKey(), + ), ); } @@ -303,7 +302,7 @@ public function move( $this->getFilesystemFromPointerOrFile($source) ->move( $source->getKey(), - $destination->getKey() + $destination->getKey(), ); } else { if ($source instanceof FilePointerInterface) { @@ -311,7 +310,7 @@ public function move( } $sourceStream = $source->getContentAsStream()->detach(); - assert(is_resource($sourceStream)); + \assert(\is_resource($sourceStream)); $this->getFilesystemFromPointerOrFile($destination) ->writeStream( @@ -342,30 +341,30 @@ public function move( } private function getFilePointerHash( - FilePointerInterface $filePointer + FilePointerInterface $filePointer, ): string { return sha1( - ($filePointer->getFilesystemIdentifier() ?? '') . $filePointer->getKey() + ($filePointer->getFilesystemIdentifier() ?? '') . $filePointer->getKey(), ); } #[\Override] public function createTemporaryFile( ?string $prefix = null, - ?string $filesystemId = null + ?string $filesystemId = null, ): FileInterface { $filesystemId ??= $this->defaultFilesystemIdForTemporaryFile; if ($filesystemId === null) { $tmpDir = sys_get_temp_dir(); - $tmpFile = \tempnam($tmpDir, $prefix ?? 'rekalogika-file-'); + $tmpFile = tempnam($tmpDir, $prefix ?? 'rekalogika-file-'); if ($tmpFile === false) { throw new \RuntimeException( - sprintf( + \sprintf( 'Failed to create temporary file in %s', - $tmpDir - ) + $tmpDir, + ), ); } @@ -377,7 +376,7 @@ public function createTemporaryFile( $filesystem = $this->filesystemRepository ->getFilesystem($filesystemId); - $key = $prefix . \bin2hex(\random_bytes(16)); + $key = $prefix . bin2hex(random_bytes(16)); $filesystem->write($key, ''); diff --git a/packages/file/src/Repository/FilesystemRepository.php b/packages/file/src/Repository/FilesystemRepository.php index a82fa17..1b17647 100644 --- a/packages/file/src/Repository/FilesystemRepository.php +++ b/packages/file/src/Repository/FilesystemRepository.php @@ -56,16 +56,16 @@ public static function getLocalFilesystem(): MetadataAwareFilesystemOperator new Filesystem( new LocalFilesystemAdapter( '/', - mimeTypeDetector: $mimeTypeDetector - ) - ) + mimeTypeDetector: $mimeTypeDetector, + ), + ), ); } #[\Override] public function addFilesystem( string $identifier, - FilesystemOperator $filesystem + FilesystemOperator $filesystem, ): void { if (isset($this->filesystems[$identifier])) { throw new FilesystemAlreadyExistsException($identifier); @@ -81,7 +81,7 @@ public function addFilesystem( #[\Override] public function getFilesystem( - ?string $identifier + ?string $identifier, ): MetadataAwareFilesystemOperator { if (null === $identifier) { return self::getLocalFilesystem(); diff --git a/packages/file/src/Repository/LocalFilesystemAdapter.php b/packages/file/src/Repository/LocalFilesystemAdapter.php index fbb21f4..824ad56 100644 --- a/packages/file/src/Repository/LocalFilesystemAdapter.php +++ b/packages/file/src/Repository/LocalFilesystemAdapter.php @@ -18,7 +18,5 @@ class LocalFilesystemAdapter extends FlysystemLocalFilesystemAdapter { #[\Override] - protected function ensureDirectoryExists(string $dirname, int $visibility): void - { - } + protected function ensureDirectoryExists(string $dirname, int $visibility): void {} } diff --git a/packages/file/src/TemporaryFile.php b/packages/file/src/TemporaryFile.php index f1f9ee6..5e7afa6 100644 --- a/packages/file/src/TemporaryFile.php +++ b/packages/file/src/TemporaryFile.php @@ -35,7 +35,7 @@ public function __destruct() * Creates a temporary file in the local filesystem */ final public static function create( - string $prefix = null + string $prefix = null, ): self { $prefix ??= 'temporaryfile-'; $path = tempnam(sys_get_temp_dir(), $prefix); @@ -55,7 +55,7 @@ final public static function create( */ final public static function createFromString( string $content, - string $prefix = null + string $prefix = null, ): self { $file = self::create($prefix); $file->setContent($content); diff --git a/tests/File/FileFactory.php b/tests/File/FileFactory.php index 5c5a53b..fa0c7f9 100644 --- a/tests/File/FileFactory.php +++ b/tests/File/FileFactory.php @@ -27,9 +27,7 @@ class FileFactory { - private function __construct() - { - } + private function __construct() {} private static ?MetadataGeneratorInterface $metadataGenerator = null; @@ -38,7 +36,7 @@ public static function createFilesystemRepository(): FilesystemRepository $metadataSerializer = new MetadataSerializer(); $metadataSidecarDecorator = new RemoteFilesystemDecorator( $metadataSerializer, - self::createMetadataGenerator() + self::createMetadataGenerator(), ); return new FilesystemRepository($metadataSidecarDecorator); @@ -63,20 +61,20 @@ public static function createFilesystemRepositoryWithDefaultFilesystems(): Files $repository->addFilesystem( 'local', new Filesystem( - new LocalFilesystemAdapter(__DIR__ . '/../../var/test') - ) + new LocalFilesystemAdapter(__DIR__ . '/../../var/test'), + ), ); // in memory filesystem $repository->addFilesystem( 'inmemory', - new Filesystem(new InMemoryFilesystemAdapter()) + new Filesystem(new InMemoryFilesystemAdapter()), ); // another in memory filesystem $repository->addFilesystem( 'inmemory2', - new Filesystem(new InMemoryFilesystemAdapter()) + new Filesystem(new InMemoryFilesystemAdapter()), ); return $repository; diff --git a/tests/File/FileRepositoryTest.php b/tests/File/FileRepositoryTest.php index e285f18..6f5782d 100644 --- a/tests/File/FileRepositoryTest.php +++ b/tests/File/FileRepositoryTest.php @@ -303,7 +303,7 @@ public function testTemporaryFileAndWrite(): void $image = fopen(__DIR__ . '/../Resources/smiley.png', 'rb'); $this->assertNotFalse($image); - $imageContent = \file_get_contents(__DIR__ . '/../Resources/smiley.png'); + $imageContent = file_get_contents(__DIR__ . '/../Resources/smiley.png'); $this->assertNotFalse($imageContent); $temporaryFile->setContentFromStream($image); diff --git a/tests/File/FileTest.php b/tests/File/FileTest.php index 30a9ff4..f1bdd4a 100644 --- a/tests/File/FileTest.php +++ b/tests/File/FileTest.php @@ -33,10 +33,10 @@ public function testLocalFile(): void $path = $dir . '/test.txt'; - \file_put_contents($path, 'test'); + file_put_contents($path, 'test'); $file = new File($path); - $path = \realpath($path); + $path = realpath($path); $this->assertNotFalse($path); $this->assertFileInterface( @@ -144,7 +144,7 @@ public function testOpenBasedir(): void $dir = realpath(__DIR__ . '/../../'); ini_set('open_basedir', $dir . ":" . '/tmp'); $path = $dir . '/var/test.txt'; - \file_put_contents($path, 'foo'); + file_put_contents($path, 'foo'); $file = new File($path); $content = $file->getContent(); diff --git a/tests/File/FileTestTrait.php b/tests/File/FileTestTrait.php index fc1be50..b6a1070 100644 --- a/tests/File/FileTestTrait.php +++ b/tests/File/FileTestTrait.php @@ -50,9 +50,9 @@ protected function assertFileInterface( // filename tests if ($fileName !== null) { - $fullName = \pathinfo($fileName, PATHINFO_BASENAME); - $extension = \pathinfo($fileName, PATHINFO_EXTENSION); - $fileNameWithoutExtension = \pathinfo($fileName, PATHINFO_FILENAME); + $fullName = pathinfo($fileName, PATHINFO_BASENAME); + $extension = pathinfo($fileName, PATHINFO_EXTENSION); + $fileNameWithoutExtension = pathinfo($fileName, PATHINFO_FILENAME); $this->assertSame((string) $file->getName()->getFull(), $fullName); $this->assertSame((string) $file->getName()->getBase(), $fileNameWithoutExtension); @@ -66,21 +66,21 @@ protected function assertFileInterface( // local file saving tests $splFileInfo = $file->saveToLocalFile($localTestFile); - $this->assertSame($splFileInfo->getRealPath(), \realpath($localTestFile)); - $this->assertSame(\file_get_contents($localTestFile), $content); + $this->assertSame($splFileInfo->getRealPath(), realpath($localTestFile)); + $this->assertSame(file_get_contents($localTestFile), $content); unlink($localTestFile); // local temporary file tests $localTemporaryFile = $file->createLocalTemporaryFile(); - $this->assertSame(\file_get_contents($localTemporaryFile->getRealPath()), $content); + $this->assertSame(file_get_contents($localTemporaryFile->getRealPath()), $content); $localTemporaryFilePath = $localTemporaryFile->getRealPath(); unset($localTemporaryFile); $this->assertFileDoesNotExist($localTemporaryFilePath); // media type tests $this->assertSame($file->getType()->getName(), $type); - $this->assertSame($file->getType()->getType(), \explode('/', $type)[0]); - $this->assertSame($file->getType()->getSubType(), \explode('/', $type)[1]); + $this->assertSame($file->getType()->getType(), explode('/', $type)[0]); + $this->assertSame($file->getType()->getSubType(), explode('/', $type)[1]); // size tests $this->assertSame($file->getSize(), \strlen($content)); @@ -102,10 +102,10 @@ protected function assertFileInterface( $this->assertSame((string) $fileMetadata->getType(), $type); $metadataLastModified = $metadata->get(Constants::FILE_MODIFICATION_TIME); - $this->assertTrue(is_int($metadataLastModified)); + $this->assertTrue(\is_int($metadataLastModified)); $this->assertSame( $fileMetadata->getModificationTime()->getTimestamp(), - $metadata->get(Constants::FILE_MODIFICATION_TIME) + $metadata->get(Constants::FILE_MODIFICATION_TIME), ); // width and height tests diff --git a/tests/File/FilesystemRepositoryTest.php b/tests/File/FilesystemRepositoryTest.php index 4ebb81e..01c83e8 100644 --- a/tests/File/FilesystemRepositoryTest.php +++ b/tests/File/FilesystemRepositoryTest.php @@ -36,7 +36,7 @@ public function testAddFilesystem(): void $repository->addFilesystem( 'test', - new Filesystem(new LocalFilesystemAdapter('/tmp')) + new Filesystem(new LocalFilesystemAdapter('/tmp')), ); $filesystem = $repository->getFilesystem('test'); $this->assertInstanceOf(FilesystemOperator::class, $filesystem); @@ -49,12 +49,12 @@ public function testAddMultipleFilesystemError(): void $repository->addFilesystem( 'test', - new Filesystem(new LocalFilesystemAdapter('/tmp')) + new Filesystem(new LocalFilesystemAdapter('/tmp')), ); $repository->addFilesystem( 'test', - new Filesystem(new LocalFilesystemAdapter('/tmp')) + new Filesystem(new LocalFilesystemAdapter('/tmp')), ); } diff --git a/tests/File/MetadataTest.php b/tests/File/MetadataTest.php index 7e4a84d..549afa7 100644 --- a/tests/File/MetadataTest.php +++ b/tests/File/MetadataTest.php @@ -28,21 +28,21 @@ protected function setUp(): void { parent::setUp(); - $this->originalTimeZone = \date_default_timezone_get(); + $this->originalTimeZone = date_default_timezone_get(); } #[\Override] protected function tearDown(): void { /** @psalm-suppress ArgumentTypeCoercion */ - \date_default_timezone_set($this->originalTimeZone); + date_default_timezone_set($this->originalTimeZone); parent::tearDown(); } public function testHttpMetadataUtcTimezone(): void { - \date_default_timezone_set('UTC'); + date_default_timezone_set('UTC'); $rawMetadata = new RawMetadata(); $rawMetadata->set(Constants::FILE_MODIFICATION_TIME, 1234567890); @@ -59,7 +59,7 @@ public function testHttpMetadataUtcTimezone(): void public function testHttpMetadataWibTimezone(): void { - \date_default_timezone_set('Asia/Jakarta'); + date_default_timezone_set('Asia/Jakarta'); $rawMetadata = new RawMetadata(); $rawMetadata->set(Constants::FILE_MODIFICATION_TIME, 1234567890); @@ -76,7 +76,7 @@ public function testHttpMetadataWibTimezone(): void public function testFileMetadataUtcTimezone(): void { - \date_default_timezone_set('UTC'); + date_default_timezone_set('UTC'); $rawMetadata = new RawMetadata(); $rawMetadata->set(Constants::FILE_MODIFICATION_TIME, 1234567890); @@ -90,7 +90,7 @@ public function testFileMetadataUtcTimezone(): void public function testFileMetadataWibTimezone(): void { - \date_default_timezone_set('Asia/Jakarta'); + date_default_timezone_set('Asia/Jakarta'); $rawMetadata = new RawMetadata(); $rawMetadata->set(Constants::FILE_MODIFICATION_TIME, 1234567890); diff --git a/tests/FileAssociation/FileAssociationManagerTest.php b/tests/FileAssociation/FileAssociationManagerTest.php index 6b94b31..576d21b 100644 --- a/tests/FileAssociation/FileAssociationManagerTest.php +++ b/tests/FileAssociation/FileAssociationManagerTest.php @@ -47,7 +47,7 @@ protected function setUp(): void ->get('test.' . FileAssociationManager::class); $this->assertInstanceOf( FileAssociationManager::class, - $fileAssociationManager + $fileAssociationManager, ); $this->fileAssociationManager = $fileAssociationManager; @@ -57,7 +57,7 @@ protected function setUp(): void $this->assertInstanceOf( FileRepositoryInterface::class, - $fileRepository + $fileRepository, ); $this->fileRepository = $fileRepository; diff --git a/tests/FileAssociation/PropertyListerTest.php b/tests/FileAssociation/PropertyListerTest.php index 37178ff..bf79063 100644 --- a/tests/FileAssociation/PropertyListerTest.php +++ b/tests/FileAssociation/PropertyListerTest.php @@ -27,14 +27,14 @@ public function testAttributePropertyLister(): void $entity = new EntityWithAttribute('id'); $properties = $lister->getFileProperties($entity); $properties = $properties instanceof \Traversable - ? \iterator_to_array($properties) + ? iterator_to_array($properties) : $properties; $this->assertSame(['file'], $properties); $subclassedEntity = new SubclassOfEntityWithAttribute('id'); $properties = $lister->getFileProperties($subclassedEntity); $properties = $properties instanceof \Traversable - ? \iterator_to_array($properties) + ? iterator_to_array($properties) : $properties; $this->assertSame(['anotherFile', 'file'], $properties); } diff --git a/tests/FileAssociationEntity/AbstractFileTest.php b/tests/FileAssociationEntity/AbstractFileTest.php index 76afb62..f3a670a 100644 --- a/tests/FileAssociationEntity/AbstractFileTest.php +++ b/tests/FileAssociationEntity/AbstractFileTest.php @@ -97,8 +97,8 @@ public function testUnsetAbstractFileHavingEmbeddedMetadata(): void public function testEmbeddedMetadataTimezone(): void { - $oldTimeZone = \date_default_timezone_get(); - \date_default_timezone_set('Asia/Jakarta'); + $oldTimeZone = date_default_timezone_get(); + date_default_timezone_set('Asia/Jakarta'); $metadata = new EmbeddedMetadata(); $metadata->set(Constants::FILE_MODIFICATION_TIME, 1234567890); @@ -117,6 +117,6 @@ public function testEmbeddedMetadataTimezone(): void static::assertSame('Asia/Jakarta', $modificationTime->getTimezone()->getName()); - \date_default_timezone_set($oldTimeZone); + date_default_timezone_set($oldTimeZone); } } diff --git a/tests/FileAssociationEntity/EmbeddedMetadataTest.php b/tests/FileAssociationEntity/EmbeddedMetadataTest.php index 2ac2676..2d53008 100644 --- a/tests/FileAssociationEntity/EmbeddedMetadataTest.php +++ b/tests/FileAssociationEntity/EmbeddedMetadataTest.php @@ -65,27 +65,27 @@ public function testEmbeddedMetadata(): void $this->assertSame( $originalMetadata->get(Constants::FILE_NAME), - $entityMetadata->get(Constants::FILE_NAME) + $entityMetadata->get(Constants::FILE_NAME), ); $this->assertSame( $originalMetadata->get(Constants::FILE_SIZE), - $entityMetadata->get(Constants::FILE_SIZE) + $entityMetadata->get(Constants::FILE_SIZE), ); $this->assertSame( $originalMetadata->get(Constants::FILE_TYPE), - $entityMetadata->get(Constants::FILE_TYPE) + $entityMetadata->get(Constants::FILE_TYPE), ); $this->assertSame( $originalMetadata->get(Constants::FILE_MODIFICATION_TIME), - $entityMetadata->get(Constants::FILE_MODIFICATION_TIME) + $entityMetadata->get(Constants::FILE_MODIFICATION_TIME), ); $this->assertSame( $originalMetadata->tryGet(Constants::MEDIA_WIDTH), - $entityMetadata->tryGet(Constants::MEDIA_WIDTH) + $entityMetadata->tryGet(Constants::MEDIA_WIDTH), ); $this->assertSame( $originalMetadata->tryGet(Constants::MEDIA_HEIGHT), - $entityMetadata->tryGet(Constants::MEDIA_HEIGHT) + $entityMetadata->tryGet(Constants::MEDIA_HEIGHT), ); // setting high-level name @@ -112,7 +112,7 @@ public function testEmbeddedMetadata(): void $this->assertSame( $originalMetadata->get(Constants::FILE_NAME), - $entityMetadata->get(Constants::FILE_NAME) + $entityMetadata->get(Constants::FILE_NAME), ); // setting high-level type @@ -139,7 +139,7 @@ public function testEmbeddedMetadata(): void $this->assertSame( $originalMetadata->get(Constants::FILE_TYPE), - $entityMetadata->get(Constants::FILE_TYPE) + $entityMetadata->get(Constants::FILE_TYPE), ); } } diff --git a/tests/FileBundle/IntegrationTest.php b/tests/FileBundle/IntegrationTest.php index ea31dbe..cf832ad 100644 --- a/tests/FileBundle/IntegrationTest.php +++ b/tests/FileBundle/IntegrationTest.php @@ -35,7 +35,7 @@ public function testWiring(): void foreach (TestKernel::getServiceIds() as $serviceId) { $this->assertInstanceOf( $serviceId, - $this->container?->get('test.' . $serviceId) + $this->container?->get('test.' . $serviceId), ); } } diff --git a/tests/FileImage/ImageResizerTest.php b/tests/FileImage/ImageResizerTest.php index 363dc60..25e06ee 100644 --- a/tests/FileImage/ImageResizerTest.php +++ b/tests/FileImage/ImageResizerTest.php @@ -34,7 +34,7 @@ public function testImageResizer(): void { $file = $this->fileRepository->createFromLocalFile( new FilePointer('inmemory', 'smiley'), - __DIR__ . '/../Resources/smiley.png' + __DIR__ . '/../Resources/smiley.png', ); $imageResizer = new ImageResizer(); diff --git a/tests/FileServer/TemporaryUrlTest.php b/tests/FileServer/TemporaryUrlTest.php index 9ebc918..29fc4a4 100644 --- a/tests/FileServer/TemporaryUrlTest.php +++ b/tests/FileServer/TemporaryUrlTest.php @@ -40,7 +40,7 @@ public function testTemporaryUrlWithFilePointer(): void $this->assertInstanceOf( TemporaryUrlGeneratorInterface::class, - $temporaryUrlGenerator + $temporaryUrlGenerator, ); $filePointer = new FilePointer('default', 'test.txt'); @@ -56,7 +56,7 @@ public function testTemporaryUrlWithFile(): void $this->assertInstanceOf( TemporaryUrlGeneratorInterface::class, - $temporaryUrlGenerator + $temporaryUrlGenerator, ); $file = new File(__DIR__ . '/../Resources/localFile.txt'); diff --git a/tests/FileSymfonyBridge/FileExtensionTest.php b/tests/FileSymfonyBridge/FileExtensionTest.php index 9cb3736..6865b9f 100644 --- a/tests/FileSymfonyBridge/FileExtensionTest.php +++ b/tests/FileSymfonyBridge/FileExtensionTest.php @@ -29,7 +29,7 @@ class FileExtensionTest extends TypeTestCase public function testFileType(): void { $temporaryFile = LocalTemporaryFile::create(); - \file_put_contents($temporaryFile->getPathname(), 'foo'); + file_put_contents($temporaryFile->getPathname(), 'foo'); $file = new UploadedFile($temporaryFile->getPathname(), 'foo.txt', null, 0, true); $form = $this->factory->createBuilder(FileType::class) @@ -60,7 +60,7 @@ public function testFileType(): void protected function getTypeExtensions(): array { return [ - new FileTypeExtension() + new FileTypeExtension(), ]; } } diff --git a/tests/FileSymfonyBridge/FileTypeTest.php b/tests/FileSymfonyBridge/FileTypeTest.php index 7aebd6f..57fa049 100644 --- a/tests/FileSymfonyBridge/FileTypeTest.php +++ b/tests/FileSymfonyBridge/FileTypeTest.php @@ -28,7 +28,7 @@ class FileTypeTest extends TypeTestCase public function testFileType(): void { $temporaryFile = LocalTemporaryFile::create(); - \file_put_contents($temporaryFile->getPathname(), 'foo'); + file_put_contents($temporaryFile->getPathname(), 'foo'); $file = new UploadedFile($temporaryFile->getPathname(), 'foo.txt', null, 0, true); $form = $this->factory->createBuilder(FileType::class) diff --git a/tests/FileZip/ZipTest.php b/tests/FileZip/ZipTest.php index e52f53e..93d497a 100644 --- a/tests/FileZip/ZipTest.php +++ b/tests/FileZip/ZipTest.php @@ -40,7 +40,7 @@ protected function setUp(): void $this->assertInstanceOf( FileRepositoryInterface::class, - $fileRepository + $fileRepository, ); $this->fileRepository = $fileRepository; @@ -50,7 +50,7 @@ protected function setUp(): void $this->assertInstanceOf( FileZip::class, - $fileZip + $fileZip, ); $this->fileZip = $fileZip; @@ -111,37 +111,37 @@ public function testZip(): void $this->assertEquals( 'file1', - file_get_contents('zip://' . $temporaryFile . '#file1.txt') + file_get_contents('zip://' . $temporaryFile . '#file1.txt'), ); $this->assertEquals( 'file2', - file_get_contents('zip://' . $temporaryFile . '#file2.txt') + file_get_contents('zip://' . $temporaryFile . '#file2.txt'), ); $this->assertEquals( 'file3', - file_get_contents('zip://' . $temporaryFile . '#file3.txt') + file_get_contents('zip://' . $temporaryFile . '#file3.txt'), ); $this->assertEquals( 'file3a', - file_get_contents('zip://' . $temporaryFile . '#file3 (1).txt') + file_get_contents('zip://' . $temporaryFile . '#file3 (1).txt'), ); $this->assertEquals( 'fileInSubDir1', - file_get_contents('zip://' . $temporaryFile . '#subdir/fileInSubDir1.txt') + file_get_contents('zip://' . $temporaryFile . '#subdir/fileInSubDir1.txt'), ); $this->assertEquals( 'fileInSubDir2', - file_get_contents('zip://' . $temporaryFile . '#subdir/fileInSubDir2.txt') + file_get_contents('zip://' . $temporaryFile . '#subdir/fileInSubDir2.txt'), ); $this->assertEquals( 'fileInSubDir2a', - file_get_contents('zip://' . $temporaryFile . '#subdir/fileInSubDir2 (1).txt') + file_get_contents('zip://' . $temporaryFile . '#subdir/fileInSubDir2 (1).txt'), ); fclose($output); diff --git a/tests/Model/Entity.php b/tests/Model/Entity.php index 8d8732d..baa504a 100644 --- a/tests/Model/Entity.php +++ b/tests/Model/Entity.php @@ -21,9 +21,8 @@ class Entity implements FileAssociationInterface private ?FileInterface $file = null; public function __construct( - private readonly string $id - ) { - } + private readonly string $id, + ) {} #[\Override] public static function getFileAssociationPropertyList(): array diff --git a/tests/Model/EntityExtendingAbstractFile.php b/tests/Model/EntityExtendingAbstractFile.php index b361cb6..5fe1526 100644 --- a/tests/Model/EntityExtendingAbstractFile.php +++ b/tests/Model/EntityExtendingAbstractFile.php @@ -17,6 +17,4 @@ use Rekalogika\Domain\File\Association\Entity\AbstractFile; #[Entity()] -class EntityExtendingAbstractFile extends AbstractFile -{ -} +class EntityExtendingAbstractFile extends AbstractFile {} diff --git a/tests/Model/EntityWithAnyId.php b/tests/Model/EntityWithAnyId.php index 6fd9a16..541b795 100644 --- a/tests/Model/EntityWithAnyId.php +++ b/tests/Model/EntityWithAnyId.php @@ -16,9 +16,8 @@ class EntityWithAnyId { public function __construct( - private readonly mixed $id - ) { - } + private readonly mixed $id, + ) {} public function getId(): mixed { diff --git a/tests/Model/EntityWithAttribute.php b/tests/Model/EntityWithAttribute.php index c38a32a..83534d6 100644 --- a/tests/Model/EntityWithAttribute.php +++ b/tests/Model/EntityWithAttribute.php @@ -24,9 +24,8 @@ class EntityWithAttribute private ?FileInterface $nonAssociatedFile = null; public function __construct( - private readonly string $id - ) { - } + private readonly string $id, + ) {} public function getId(): string { diff --git a/tests/Model/EntityWithEmbeddedMetadata.php b/tests/Model/EntityWithEmbeddedMetadata.php index 86084d5..214a4d2 100644 --- a/tests/Model/EntityWithEmbeddedMetadata.php +++ b/tests/Model/EntityWithEmbeddedMetadata.php @@ -29,7 +29,7 @@ class EntityWithEmbeddedMetadata private EmbeddedMetadata $fileMetadata; public function __construct( - private string $id + private string $id, ) { $this->fileMetadata = new EmbeddedMetadata(); } diff --git a/tests/Model/EntityWithFileProxyUtilGetterSetter.php b/tests/Model/EntityWithFileProxyUtilGetterSetter.php index a77a0b7..f157eb1 100644 --- a/tests/Model/EntityWithFileProxyUtilGetterSetter.php +++ b/tests/Model/EntityWithFileProxyUtilGetterSetter.php @@ -19,9 +19,8 @@ class EntityWithFileProxyUtilGetterSetter { public function __construct( - private ?FileInterface $file = null - ) { - } + private ?FileInterface $file = null, + ) {} public function getFile(): ?FileInterface { diff --git a/tests/Model/EntityWithLazyFile.php b/tests/Model/EntityWithLazyFile.php index 1c28515..3e78362 100644 --- a/tests/Model/EntityWithLazyFile.php +++ b/tests/Model/EntityWithLazyFile.php @@ -23,9 +23,7 @@ class EntityWithLazyFile #[AsFileAssociation(fetch: 'LAZY')] private ?FileInterface $file = null; - public function __construct(private readonly string $id) - { - } + public function __construct(private readonly string $id) {} /** * Get the value of file diff --git a/tests/Model/EntityWithMandatoryFile.php b/tests/Model/EntityWithMandatoryFile.php index c8c09ed..3b29854 100644 --- a/tests/Model/EntityWithMandatoryFile.php +++ b/tests/Model/EntityWithMandatoryFile.php @@ -23,9 +23,7 @@ class EntityWithMandatoryFile #[AsFileAssociation] private FileInterface $file; - public function __construct(private readonly string $id) - { - } + public function __construct(private readonly string $id) {} /** * Get the value of file diff --git a/tests/Model/EntityWithPlainGetterSetter.php b/tests/Model/EntityWithPlainGetterSetter.php index 9bf2089..3784073 100644 --- a/tests/Model/EntityWithPlainGetterSetter.php +++ b/tests/Model/EntityWithPlainGetterSetter.php @@ -18,9 +18,8 @@ class EntityWithPlainGetterSetter { public function __construct( - private ?FileInterface $file = null - ) { - } + private ?FileInterface $file = null, + ) {} public function getFile(): ?FileInterface { diff --git a/tests/TestKernel.php b/tests/TestKernel.php index f4c4340..734496d 100644 --- a/tests/TestKernel.php +++ b/tests/TestKernel.php @@ -108,8 +108,8 @@ public function registerContainerConfiguration(LoaderInterface $loader): void 'enable_lazy_ghost_objects' => true, 'controller_resolver' => [ 'auto_mapping' => false, - ] - ] + ], + ], ]); $container->loadFromExtension('rekalogika_file', $this->config);