From 7785f01786b724d7d77bb08b94993347cfa76da9 Mon Sep 17 00:00:00 2001 From: SonataCI Date: Wed, 13 Nov 2024 10:50:11 +0000 Subject: [PATCH 1/2] DevKit updates --- rector.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rector.php b/rector.php index b6dac16f..74463238 100644 --- a/rector.php +++ b/rector.php @@ -19,6 +19,7 @@ use Rector\Config\RectorConfig; use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector; +use Rector\PHPUnit\CodeQuality\Rector\Class_\NarrowUnusedSetUpDefinedPropertyRector; use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\LevelSetList; @@ -40,5 +41,6 @@ $rectorConfig->skip([ ExceptionHandlerTypehintRector::class, PreferPHPUnitThisCallRector::class, + NarrowUnusedSetUpDefinedPropertyRector::class, ]); }; From cb58b75ed1810b39ad0e9f2e59053fc4b1600ec3 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Wed, 13 Nov 2024 15:03:18 +0100 Subject: [PATCH 2/2] CS --- src/Action/CompareAction.php | 2 +- src/Action/IndexAction.php | 2 +- src/Action/ViewDetailAction.php | 2 +- src/Action/ViewEntityAction.php | 2 +- src/Action/ViewRevisionAction.php | 4 ++-- src/AuditConfiguration.php | 2 +- src/AuditManager.php | 2 +- src/AuditReader.php | 14 +++++++------- src/ChangedEntity.php | 2 +- src/Collection/AuditedCollection.php | 4 ++-- ...redChangedManyToManyEntityRevisionToPersist.php | 2 +- src/DependencyInjection/Configuration.php | 2 +- src/EventListener/CreateSchemaListener.php | 2 +- src/EventListener/LogRevisionsListener.php | 8 ++++---- src/Exception/AuditException.php | 2 +- src/Exception/DeletedException.php | 2 +- src/Exception/InvalidRevisionException.php | 2 +- src/Exception/NoRevisionFoundException.php | 2 +- src/Exception/NotAuditedException.php | 2 +- src/Revision.php | 2 +- src/User/TokenStorageUsernameCallable.php | 4 ++-- tests/App/AppKernel.php | 8 ++++---- tests/App/Entity/User.php | 2 +- tests/CoreTest.php | 2 +- tests/Fixtures/Core/AnimalAudit.php | 2 +- tests/Fixtures/Core/ArticleAudit.php | 2 +- tests/Fixtures/Core/Cat.php | 2 +- tests/Fixtures/Core/Dog.php | 2 +- tests/Fixtures/Core/Fox.php | 2 +- tests/Fixtures/Core/PetAudit.php | 2 +- tests/Fixtures/Core/ProfileAudit.php | 2 +- tests/Fixtures/Core/Rabbit.php | 2 +- tests/Fixtures/Core/UserAudit.php | 2 +- tests/Fixtures/PHP81Issue/IssueEntityWithEnum.php | 2 +- .../BaseSelfReferencingManyToManyEntity.php | 2 +- tests/Fixtures/Relation/PageAlias.php | 2 +- tests/Fixtures/Relation/PageLocalization.php | 2 +- tests/Fixtures/Relation/Product.php | 2 +- .../Relation/UnidirectionalManyToManyEntity.php | 2 +- .../UnidirectionalManyToManyLinkedEntity.php | 2 +- tests/Functional/SmokeTest.php | 6 +++--- tests/Issue/Issue318Test.php | 2 +- tests/Types/ConvertToPHPType.php | 4 ++-- tests/Types/Issue196Type.php | 2 +- 44 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/Action/CompareAction.php b/src/Action/CompareAction.php index 80a0ad29..4041fd5f 100644 --- a/src/Action/CompareAction.php +++ b/src/Action/CompareAction.php @@ -22,7 +22,7 @@ final class CompareAction { public function __construct( private Environment $twig, - private AuditReader $auditReader + private AuditReader $auditReader, ) { } diff --git a/src/Action/IndexAction.php b/src/Action/IndexAction.php index c4127344..0cc119f1 100644 --- a/src/Action/IndexAction.php +++ b/src/Action/IndexAction.php @@ -21,7 +21,7 @@ final class IndexAction { public function __construct( private Environment $twig, - private AuditReader $auditReader + private AuditReader $auditReader, ) { } diff --git a/src/Action/ViewDetailAction.php b/src/Action/ViewDetailAction.php index 9a2402ec..3cdc0437 100644 --- a/src/Action/ViewDetailAction.php +++ b/src/Action/ViewDetailAction.php @@ -22,7 +22,7 @@ final class ViewDetailAction { public function __construct( private Environment $twig, - private AuditReader $auditReader + private AuditReader $auditReader, ) { } diff --git a/src/Action/ViewEntityAction.php b/src/Action/ViewEntityAction.php index b4345138..da2bf386 100644 --- a/src/Action/ViewEntityAction.php +++ b/src/Action/ViewEntityAction.php @@ -21,7 +21,7 @@ final class ViewEntityAction { public function __construct( private Environment $twig, - private AuditReader $auditReader + private AuditReader $auditReader, ) { } diff --git a/src/Action/ViewRevisionAction.php b/src/Action/ViewRevisionAction.php index 6c004646..a9102e97 100644 --- a/src/Action/ViewRevisionAction.php +++ b/src/Action/ViewRevisionAction.php @@ -23,7 +23,7 @@ final class ViewRevisionAction { public function __construct( private Environment $twig, - private AuditReader $auditReader + private AuditReader $auditReader, ) { } @@ -35,7 +35,7 @@ public function __invoke(int $rev): Response try { $revision = $this->auditReader->findRevision($rev); } catch (InvalidRevisionException $ex) { - throw new NotFoundHttpException(sprintf('Revision %d not found', $rev), $ex); + throw new NotFoundHttpException(\sprintf('Revision %d not found', $rev), $ex); } $changedEntities = $this->auditReader->findEntitiesChangedAtRevision($rev); diff --git a/src/AuditConfiguration.php b/src/AuditConfiguration.php index b66f677c..666ba351 100644 --- a/src/AuditConfiguration.php +++ b/src/AuditConfiguration.php @@ -263,7 +263,7 @@ public function setUsernameCallable($usernameCallable): void { // php 5.3 compat if (null !== $usernameCallable && !\is_callable($usernameCallable)) { - throw new \InvalidArgumentException(sprintf('Username Callable must be callable. Got: %s', get_debug_type($usernameCallable))); + throw new \InvalidArgumentException(\sprintf('Username Callable must be callable. Got: %s', get_debug_type($usernameCallable))); } $this->usernameCallable = $usernameCallable; diff --git a/src/AuditManager.php b/src/AuditManager.php index 35feb9fe..98b88f33 100644 --- a/src/AuditManager.php +++ b/src/AuditManager.php @@ -30,7 +30,7 @@ class AuditManager public function __construct( private AuditConfiguration $config, - private ?ClockInterface $clock = null + private ?ClockInterface $clock = null, ) { $this->metadataFactory = $config->createMetadataFactory(); } diff --git a/src/AuditReader.php b/src/AuditReader.php index f5e919e4..482e1018 100644 --- a/src/AuditReader.php +++ b/src/AuditReader.php @@ -75,7 +75,7 @@ class AuditReader public function __construct( private EntityManagerInterface $em, private AuditConfiguration $config, - private MetadataFactory $metadataFactory + private MetadataFactory $metadataFactory, ) { $this->platform = $this->em->getConnection()->getDatabasePlatform(); $this->quoteStrategy = $this->em->getConfiguration()->getQuoteStrategy(); @@ -240,7 +240,7 @@ public function find($className, $id, $revision, array $options = []) : 'e'; $type = Type::getType(self::getMappingValue($classMetadata->fieldMappings[$field], 'type')); - $columnList[] = sprintf( + $columnList[] = \sprintf( '%s AS %s', $type->convertToPHPValueSQL( $tableAlias.'.'.$this->quoteStrategy->getColumnName($field, $classMetadata, $this->platform), @@ -295,7 +295,7 @@ public function find($className, $id, $revision, array $options = []) $queriedDiscrValues[] = $this->em->getConnection()->quote($allDiscrValues[$subclassName]); } - $whereSQL .= sprintf( + $whereSQL .= \sprintf( ' AND %s IN (%s)', self::getMappingNameValue($classMetadata->discriminatorColumn), implode(', ', $queriedDiscrValues) @@ -303,7 +303,7 @@ public function find($className, $id, $revision, array $options = []) } } - $query = sprintf( + $query = \sprintf( 'SELECT %s FROM %s e %s WHERE %s ORDER BY e.%s DESC', implode(', ', $columnList), $tableName, @@ -547,7 +547,7 @@ public function findRevisions($className, $id) } } - $query = sprintf( + $query = \sprintf( 'SELECT r.* FROM %s r INNER JOIN %s e ON r.id = e.%s WHERE %s ORDER BY r.id DESC', $this->config->getRevisionTableName(), $tableName, @@ -1041,7 +1041,7 @@ private function createEntity($className, array $columnMap, array $data, $revisi $columnList[] = $targetKeyJoinColumn; } - $query = sprintf( + $query = \sprintf( 'SELECT %s FROM %s e WHERE %s ORDER BY e.%s DESC', implode(', ', $columnList), $tableName, @@ -1128,7 +1128,7 @@ private function createEntity($className, array $columnMap, array $data, $revisi foreach ($targetAssoc['relationToSourceKeyColumns'] as $sourceKeyJoinColumn => $sourceKeyColumn) { $columnList[] = $sourceKeyJoinColumn; } - $query = sprintf( + $query = \sprintf( 'SELECT %s FROM %s e WHERE %s ORDER BY e.%s DESC', implode(', ', $columnList), $tableName, diff --git a/src/ChangedEntity.php b/src/ChangedEntity.php index b6588c4d..f48e04ba 100644 --- a/src/ChangedEntity.php +++ b/src/ChangedEntity.php @@ -28,7 +28,7 @@ public function __construct( private string $className, private array $id, private string $revType, - private object $entity + private object $entity, ) { } diff --git a/src/Collection/AuditedCollection.php b/src/Collection/AuditedCollection.php index 063e81ea..8d1ac5ad 100644 --- a/src/Collection/AuditedCollection.php +++ b/src/Collection/AuditedCollection.php @@ -73,7 +73,7 @@ public function __construct( protected ClassMetadata $metadata, protected array|AssociationMapping $associationDefinition, protected array $foreignKeys, - protected $revision + protected $revision, ) { $this->configuration = $auditReader->getConfiguration(); $this->entities = new ArrayCollection(); @@ -414,7 +414,7 @@ public function offsetGet(mixed $offset) $this->initialize(); if (!$this->entities->offsetExists($offset)) { - throw new AuditedCollectionException(sprintf('Offset "%s" is not defined', $offset)); + throw new AuditedCollectionException(\sprintf('Offset "%s" is not defined', $offset)); } $entity = $this->entities->offsetGet($offset); diff --git a/src/DeferredChangedManyToManyEntityRevisionToPersist.php b/src/DeferredChangedManyToManyEntityRevisionToPersist.php index 2b6f3448..56eac1cc 100644 --- a/src/DeferredChangedManyToManyEntityRevisionToPersist.php +++ b/src/DeferredChangedManyToManyEntityRevisionToPersist.php @@ -33,7 +33,7 @@ public function __construct( private array $entityData, private array|ManyToManyOwningSideMapping $assoc, private ClassMetadata $class, - private ClassMetadata $targetClass + private ClassMetadata $targetClass, ) { } diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 6bf2dc68..246285d3 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -59,7 +59,7 @@ public function getConfigTreeBuilder(): TreeBuilder ->beforeNormalization() ->always(static function (?string $value): ?string { if (null !== $value && !\in_array($value, self::ALLOWED_REVISION_ID_FIELD_TYPES, true)) { - @trigger_error(sprintf( + @trigger_error(\sprintf( 'The value "%s" for the "revision_id_field_type" is deprecated' .' since sonata-project/entity-audit-bundle 1.3 and will throw an error in version 2.0.' .' You must pass one of the following values: "%s".', diff --git a/src/EventListener/CreateSchemaListener.php b/src/EventListener/CreateSchemaListener.php index 0b06057a..c76329a3 100644 --- a/src/EventListener/CreateSchemaListener.php +++ b/src/EventListener/CreateSchemaListener.php @@ -102,7 +102,7 @@ public function postGenerateSchemaTable(GenerateSchemaTableEventArgs $eventArgs) $revisionTable->addColumn($this->config->getRevisionFieldName(), $this->config->getRevisionIdFieldType()); $revisionTable->addColumn($this->config->getRevisionTypeFieldName(), Types::STRING, ['length' => 4]); if (!\in_array($cm->inheritanceType, [ClassMetadata::INHERITANCE_TYPE_NONE, ClassMetadata::INHERITANCE_TYPE_JOINED, ClassMetadata::INHERITANCE_TYPE_SINGLE_TABLE], true)) { - throw new \Exception(sprintf('Inheritance type "%s" is not yet supported', $cm->inheritanceType)); + throw new \Exception(\sprintf('Inheritance type "%s" is not yet supported', $cm->inheritanceType)); } $primaryKey = $entityTable->getPrimaryKey(); diff --git a/src/EventListener/LogRevisionsListener.php b/src/EventListener/LogRevisionsListener.php index af4d3c40..4ed98432 100644 --- a/src/EventListener/LogRevisionsListener.php +++ b/src/EventListener/LogRevisionsListener.php @@ -78,7 +78,7 @@ class LogRevisionsListener implements EventSubscriber public function __construct( AuditManager $auditManager, - private ?ClockInterface $clock = null + private ?ClockInterface $clock = null, ) { $this->config = $auditManager->getConfiguration(); $this->metadataFactory = $auditManager->getMetadataFactory(); @@ -166,7 +166,7 @@ public function postFlush(PostFlushEventArgs $eventArgs): void } if (null === $type) { - throw new \Exception(sprintf('Could not resolve database type for column "%s" during extra updates', $column)); + throw new \Exception(\sprintf('Could not resolve database type for column "%s" during extra updates', $column)); } $types[] = $type; @@ -476,7 +476,7 @@ private function getInsertRevisionSQL(EntityManagerInterface $em, ClassMetadata private function getInsertJoinTableRevisionSQL( ClassMetadata $class, ClassMetadata $targetClass, - array|ManyToManyOwningSideMapping $assoc + array|ManyToManyOwningSideMapping $assoc, ): string { $joinTableName = self::getMappingJoinTableNameValue($assoc); $cacheKey = $class->name.'.'.$targetClass->name.'.'.$joinTableName; @@ -635,7 +635,7 @@ private function recordRevisionForManyToManyEntity( array $entityData, array|ManyToManyOwningSideMapping $assoc, ClassMetadata $class, - ClassMetadata $targetClass + ClassMetadata $targetClass, ): void { $conn = $em->getConnection(); $joinTableParams = [$this->getRevisionId($conn), $revType]; diff --git a/src/Exception/AuditException.php b/src/Exception/AuditException.php index d8a93ef1..d0a62301 100644 --- a/src/Exception/AuditException.php +++ b/src/Exception/AuditException.php @@ -33,7 +33,7 @@ public function __construct( ?string $className, ?array $id, protected $revision, - string $message = '' + string $message = '', ) { parent::__construct($message); diff --git a/src/Exception/DeletedException.php b/src/Exception/DeletedException.php index 2a679f8b..d679f253 100644 --- a/src/Exception/DeletedException.php +++ b/src/Exception/DeletedException.php @@ -21,7 +21,7 @@ class DeletedException extends AuditException */ public function __construct(string $className, array $id, $revision) { - parent::__construct($className, $id, $revision, sprintf( + parent::__construct($className, $id, $revision, \sprintf( 'Class "%s" entity id "%s" has been removed at revision %s', $className, implode(', ', $id), diff --git a/src/Exception/InvalidRevisionException.php b/src/Exception/InvalidRevisionException.php index be3e85a7..bd47db98 100644 --- a/src/Exception/InvalidRevisionException.php +++ b/src/Exception/InvalidRevisionException.php @@ -20,6 +20,6 @@ class InvalidRevisionException extends AuditException */ public function __construct($revision) { - parent::__construct(null, null, $revision, sprintf('No revision "%s" exists.', $revision)); + parent::__construct(null, null, $revision, \sprintf('No revision "%s" exists.', $revision)); } } diff --git a/src/Exception/NoRevisionFoundException.php b/src/Exception/NoRevisionFoundException.php index 93e319c8..00aa8ceb 100644 --- a/src/Exception/NoRevisionFoundException.php +++ b/src/Exception/NoRevisionFoundException.php @@ -21,7 +21,7 @@ class NoRevisionFoundException extends AuditException */ public function __construct(string $className, array $id, $revision) { - parent::__construct($className, $id, $revision, sprintf( + parent::__construct($className, $id, $revision, \sprintf( 'No revision of class "%s" (%s) was found at revision %s or before. The entity did not exist at the specified revision yet.', $className, implode(', ', $id), diff --git a/src/Exception/NotAuditedException.php b/src/Exception/NotAuditedException.php index 987a68c0..1014c5fb 100644 --- a/src/Exception/NotAuditedException.php +++ b/src/Exception/NotAuditedException.php @@ -17,6 +17,6 @@ class NotAuditedException extends AuditException { public function __construct(string $className) { - parent::__construct($className, null, null, sprintf('Class "%s" is not audited.', $className)); + parent::__construct($className, null, null, \sprintf('Class "%s" is not audited.', $className)); } } diff --git a/src/Revision.php b/src/Revision.php index d0527cdd..ad42d3e9 100644 --- a/src/Revision.php +++ b/src/Revision.php @@ -24,7 +24,7 @@ class Revision public function __construct( private $rev, private \DateTime $timestamp, - private ?string $username + private ?string $username, ) { } diff --git a/src/User/TokenStorageUsernameCallable.php b/src/User/TokenStorageUsernameCallable.php index ba19c6f2..fc64ddb8 100644 --- a/src/User/TokenStorageUsernameCallable.php +++ b/src/User/TokenStorageUsernameCallable.php @@ -30,7 +30,7 @@ public function __construct(object $tokenStorageOrContainer) if ($tokenStorageOrContainer instanceof TokenStorageInterface) { $this->tokenStorage = $tokenStorageOrContainer; } elseif ($tokenStorageOrContainer instanceof Container) { - @trigger_error(sprintf( + @trigger_error(\sprintf( 'Passing as argument 1 an instance of "%s" to "%s" is deprecated since' .' sonata-project/entity-audit-bundle 1.x and will throw an "%s" in version 2.0.' .' You must pass an instance of "%s" instead.', @@ -44,7 +44,7 @@ public function __construct(object $tokenStorageOrContainer) \assert($tokenStorage instanceof TokenStorageInterface); $this->tokenStorage = $tokenStorage; } else { - throw new \TypeError(sprintf( + throw new \TypeError(\sprintf( 'Argument 1 passed to "%s()" must be an instance of "%s" or %s, instance of "%s" given.', __METHOD__, TokenStorageInterface::class, diff --git a/tests/App/AppKernel.php b/tests/App/AppKernel.php index 8e56f091..aa7d38f2 100644 --- a/tests/App/AppKernel.php +++ b/tests/App/AppKernel.php @@ -44,12 +44,12 @@ public function registerBundles(): iterable public function getCacheDir(): string { - return sprintf('%scache', $this->getBaseDir()); + return \sprintf('%scache', $this->getBaseDir()); } public function getLogDir(): string { - return sprintf('%slog', $this->getBaseDir()); + return \sprintf('%slog', $this->getBaseDir()); } public function getProjectDir(): string @@ -59,7 +59,7 @@ public function getProjectDir(): string protected function configureRoutes(RoutingConfigurator $routes): void { - $routes->import(sprintf('%s/config/routes.yml', $this->getProjectDir())); + $routes->import(\sprintf('%s/config/routes.yml', $this->getProjectDir())); } protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void @@ -77,6 +77,6 @@ protected function configureContainer(ContainerBuilder $containerBuilder, Loader private function getBaseDir(): string { - return sprintf('%s/entity-audit-bundle/var/', sys_get_temp_dir()); + return \sprintf('%s/entity-audit-bundle/var/', sys_get_temp_dir()); } } diff --git a/tests/App/Entity/User.php b/tests/App/Entity/User.php index a35ec592..0dfeb85d 100644 --- a/tests/App/Entity/User.php +++ b/tests/App/Entity/User.php @@ -30,7 +30,7 @@ class User public function __construct( #[ORM\Column(type: Types::STRING)] - private string $name + private string $name, ) { } diff --git a/tests/CoreTest.php b/tests/CoreTest.php index 2c0a886a..b6078d31 100644 --- a/tests/CoreTest.php +++ b/tests/CoreTest.php @@ -159,7 +159,7 @@ public function testFindNoRevisionFound(): void $reader = $this->getAuditManager()->createAuditReader($this->getEntityManager()); $this->expectException(NoRevisionFoundException::class); - $this->expectExceptionMessage(sprintf( + $this->expectExceptionMessage(\sprintf( 'No revision of class "%s" (1) was found at revision 1 or before. The entity did not exist at the specified revision yet.', UserAudit::class )); diff --git a/tests/Fixtures/Core/AnimalAudit.php b/tests/Fixtures/Core/AnimalAudit.php index dff0918f..f191b33e 100644 --- a/tests/Fixtures/Core/AnimalAudit.php +++ b/tests/Fixtures/Core/AnimalAudit.php @@ -32,7 +32,7 @@ abstract class AnimalAudit public function __construct( #[ORM\Column(type: Types::STRING)] - private string $name + private string $name, ) { } diff --git a/tests/Fixtures/Core/ArticleAudit.php b/tests/Fixtures/Core/ArticleAudit.php index a8d55796..08c5e8d7 100644 --- a/tests/Fixtures/Core/ArticleAudit.php +++ b/tests/Fixtures/Core/ArticleAudit.php @@ -35,7 +35,7 @@ public function __construct( #[ORM\ManyToOne(targetEntity: UserAudit::class)] private ?UserAudit $author, #[ORM\Column(type: Types::TEXT)] - protected string $ignoreme + protected string $ignoreme, ) { } diff --git a/tests/Fixtures/Core/Cat.php b/tests/Fixtures/Core/Cat.php index 1e2c68f9..e7067a32 100644 --- a/tests/Fixtures/Core/Cat.php +++ b/tests/Fixtures/Core/Cat.php @@ -22,7 +22,7 @@ class Cat extends PetAudit public function __construct( string $name, #[ORM\Column(type: Types::STRING, name: 'cute_cat_color')] - private string $color + private string $color, ) { parent::__construct($name); } diff --git a/tests/Fixtures/Core/Dog.php b/tests/Fixtures/Core/Dog.php index b43ed526..49314d2e 100644 --- a/tests/Fixtures/Core/Dog.php +++ b/tests/Fixtures/Core/Dog.php @@ -22,7 +22,7 @@ class Dog extends PetAudit public function __construct( string $name, #[ORM\Column(type: Types::INTEGER, name: 'dog_tail_length')] - private int $tailLength + private int $tailLength, ) { parent::__construct($name); } diff --git a/tests/Fixtures/Core/Fox.php b/tests/Fixtures/Core/Fox.php index c6792a8f..8bd8dfea 100644 --- a/tests/Fixtures/Core/Fox.php +++ b/tests/Fixtures/Core/Fox.php @@ -22,7 +22,7 @@ class Fox extends AnimalAudit public function __construct( string $name, #[ORM\Column(type: Types::INTEGER, name: 'fox_tail_length')] - private int $tailLength + private int $tailLength, ) { parent::__construct($name); } diff --git a/tests/Fixtures/Core/PetAudit.php b/tests/Fixtures/Core/PetAudit.php index 366c7c06..8894c7ed 100644 --- a/tests/Fixtures/Core/PetAudit.php +++ b/tests/Fixtures/Core/PetAudit.php @@ -32,7 +32,7 @@ abstract class PetAudit public function __construct( #[ORM\Column(type: Types::STRING)] - private string $name + private string $name, ) { } diff --git a/tests/Fixtures/Core/ProfileAudit.php b/tests/Fixtures/Core/ProfileAudit.php index 82fb7d26..202168ba 100644 --- a/tests/Fixtures/Core/ProfileAudit.php +++ b/tests/Fixtures/Core/ProfileAudit.php @@ -33,7 +33,7 @@ class ProfileAudit public function __construct( #[ORM\Column(type: Types::TEXT)] - private string $biography + private string $biography, ) { } diff --git a/tests/Fixtures/Core/Rabbit.php b/tests/Fixtures/Core/Rabbit.php index 4f83bc69..7c395b98 100644 --- a/tests/Fixtures/Core/Rabbit.php +++ b/tests/Fixtures/Core/Rabbit.php @@ -22,7 +22,7 @@ class Rabbit extends AnimalAudit public function __construct( string $name, #[ORM\Column(type: Types::STRING, name: 'cute_rabbit_color')] - private string $color + private string $color, ) { parent::__construct($name); } diff --git a/tests/Fixtures/Core/UserAudit.php b/tests/Fixtures/Core/UserAudit.php index f4cc947a..5c2bcbc2 100644 --- a/tests/Fixtures/Core/UserAudit.php +++ b/tests/Fixtures/Core/UserAudit.php @@ -32,7 +32,7 @@ class UserAudit public function __construct( #[ORM\Column(type: Types::STRING)] - private string $name + private string $name, ) { } diff --git a/tests/Fixtures/PHP81Issue/IssueEntityWithEnum.php b/tests/Fixtures/PHP81Issue/IssueEntityWithEnum.php index 2b11a530..5b00b28e 100644 --- a/tests/Fixtures/PHP81Issue/IssueEntityWithEnum.php +++ b/tests/Fixtures/PHP81Issue/IssueEntityWithEnum.php @@ -26,7 +26,7 @@ class IssueEntityWithEnum public function __construct( #[ORM\Column(enumType: Status::class)] - private Status $status + private Status $status, ) { } diff --git a/tests/Fixtures/Relation/BaseSelfReferencingManyToManyEntity.php b/tests/Fixtures/Relation/BaseSelfReferencingManyToManyEntity.php index cd00cf88..ec6f9332 100644 --- a/tests/Fixtures/Relation/BaseSelfReferencingManyToManyEntity.php +++ b/tests/Fixtures/Relation/BaseSelfReferencingManyToManyEntity.php @@ -40,7 +40,7 @@ abstract class BaseSelfReferencingManyToManyEntity public function __construct( #[ORM\Column(type: Types::STRING, name: 'title')] - private string $title + private string $title, ) { $this->linkedEntities = new ArrayCollection(); } diff --git a/tests/Fixtures/Relation/PageAlias.php b/tests/Fixtures/Relation/PageAlias.php index 1c77099a..86d75e6b 100644 --- a/tests/Fixtures/Relation/PageAlias.php +++ b/tests/Fixtures/Relation/PageAlias.php @@ -28,7 +28,7 @@ public function __construct( #[ORM\JoinColumn(name: 'page_id', referencedColumnName: 'id', nullable: false)] protected Page $page, #[ORM\Column(type: Types::STRING, nullable: false, length: 255, unique: true)] - protected ?string $alias = null + protected ?string $alias = null, ) { } diff --git a/tests/Fixtures/Relation/PageLocalization.php b/tests/Fixtures/Relation/PageLocalization.php index 8c1894ed..b0cbb2df 100644 --- a/tests/Fixtures/Relation/PageLocalization.php +++ b/tests/Fixtures/Relation/PageLocalization.php @@ -35,7 +35,7 @@ class PageLocalization public function __construct( #[ORM\Column(type: Types::STRING)] - protected string $locale + protected string $locale, ) { } diff --git a/tests/Fixtures/Relation/Product.php b/tests/Fixtures/Relation/Product.php index 27c3fd67..de0937fb 100644 --- a/tests/Fixtures/Relation/Product.php +++ b/tests/Fixtures/Relation/Product.php @@ -30,7 +30,7 @@ abstract class Product extends SomeEntity public function __construct( #[ORM\Column(type: Types::STRING)] - protected string $name + protected string $name, ) { } diff --git a/tests/Fixtures/Relation/UnidirectionalManyToManyEntity.php b/tests/Fixtures/Relation/UnidirectionalManyToManyEntity.php index 10fbe125..dc2fa53f 100644 --- a/tests/Fixtures/Relation/UnidirectionalManyToManyEntity.php +++ b/tests/Fixtures/Relation/UnidirectionalManyToManyEntity.php @@ -37,7 +37,7 @@ class UnidirectionalManyToManyEntity public function __construct( #[ORM\Column(type: Types::STRING)] - private string $title + private string $title, ) { $this->linkedEntity = new ArrayCollection(); } diff --git a/tests/Fixtures/Relation/UnidirectionalManyToManyLinkedEntity.php b/tests/Fixtures/Relation/UnidirectionalManyToManyLinkedEntity.php index 6087dda6..1cea250f 100644 --- a/tests/Fixtures/Relation/UnidirectionalManyToManyLinkedEntity.php +++ b/tests/Fixtures/Relation/UnidirectionalManyToManyLinkedEntity.php @@ -26,7 +26,7 @@ class UnidirectionalManyToManyLinkedEntity public function __construct( #[ORM\Column(type: Types::STRING)] - private string $name + private string $name, ) { } diff --git a/tests/Functional/SmokeTest.php b/tests/Functional/SmokeTest.php index 17eee4a8..763669b3 100644 --- a/tests/Functional/SmokeTest.php +++ b/tests/Functional/SmokeTest.php @@ -41,8 +41,8 @@ public function provideSuccessfulResponsesCases(): iterable $encodeUserClass = urlencode(User::class); - yield 'view detail' => [sprintf('/audit/viewent/%s/1', $encodeUserClass)]; - yield 'view entity' => [sprintf('/audit/viewent/%s/1/1', $encodeUserClass)]; - yield 'compare' => [sprintf('/audit/compare/%s/1?newRev=2&oldRev=1', $encodeUserClass)]; + yield 'view detail' => [\sprintf('/audit/viewent/%s/1', $encodeUserClass)]; + yield 'view entity' => [\sprintf('/audit/viewent/%s/1/1', $encodeUserClass)]; + yield 'compare' => [\sprintf('/audit/compare/%s/1?newRev=2&oldRev=1', $encodeUserClass)]; } } diff --git a/tests/Issue/Issue318Test.php b/tests/Issue/Issue318Test.php index b228a3d3..03850941 100644 --- a/tests/Issue/Issue318Test.php +++ b/tests/Issue/Issue318Test.php @@ -42,7 +42,7 @@ public function testIssue318(): void $config = $this->getAuditManager()->getConfiguration(); $userNotNullColumnName = 'alias'; $userIdColumnName = 'id'; - $revisionsTableUser = $schema->getTable(sprintf( + $revisionsTableUser = $schema->getTable(\sprintf( '%s.%sissue318user%s', $schemaName, $config->getTablePrefix(), diff --git a/tests/Types/ConvertToPHPType.php b/tests/Types/ConvertToPHPType.php index 14e8040f..5dc68f1b 100644 --- a/tests/Types/ConvertToPHPType.php +++ b/tests/Types/ConvertToPHPType.php @@ -30,11 +30,11 @@ public function canRequireSQLConversion(): bool public function convertToPHPValueSQL($sqlExpr, $platform): string { - return sprintf('UPPER(%s)', $sqlExpr); + return \sprintf('UPPER(%s)', $sqlExpr); } public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform): string { - return sprintf('LOWER(%s)', $sqlExpr); + return \sprintf('LOWER(%s)', $sqlExpr); } } diff --git a/tests/Types/Issue196Type.php b/tests/Types/Issue196Type.php index 76544bff..9797569f 100644 --- a/tests/Types/Issue196Type.php +++ b/tests/Types/Issue196Type.php @@ -33,6 +33,6 @@ public function canRequireSQLConversion(): bool public function convertToDatabaseValueSQL($sqlExpr, AbstractPlatform $platform): string { - return sprintf('lower(%s)', $sqlExpr); + return \sprintf('lower(%s)', $sqlExpr); } }