diff --git a/src/Auditor.php b/src/Auditor.php
index 5540403c..d0957a27 100644
--- a/src/Auditor.php
+++ b/src/Auditor.php
@@ -71,7 +71,7 @@ public function getProviders(): array
public function getProvider(string $name): ProviderInterface
{
if (!$this->hasProvider($name)) {
- throw new InvalidArgumentException(sprintf('Unknown provider "%s"', $name));
+ throw new InvalidArgumentException(\sprintf('Unknown provider "%s"', $name));
}
return $this->providers[$name];
@@ -88,7 +88,7 @@ public function hasProvider(string $name): bool
public function registerProvider(ProviderInterface $provider): self
{
if (!$provider->supportsStorage() && !$provider->supportsAuditing()) {
- throw new ProviderException(sprintf('Provider "%s" does not support storage and auditing.', $provider::class));
+ throw new ProviderException(\sprintf('Provider "%s" does not support storage and auditing.', $provider::class));
}
$this->providers[$provider::class] = $provider;
@@ -111,7 +111,7 @@ public function registerProvider(ProviderInterface $provider): self
public function enableStorage(ProviderInterface $provider): self
{
if (!$provider->supportsStorage()) {
- throw new ProviderException(sprintf('Provider "%s" does not support storage.', $provider::class));
+ throw new ProviderException(\sprintf('Provider "%s" does not support storage.', $provider::class));
}
$this->storageProviders[$provider::class] = $provider;
@@ -125,7 +125,7 @@ public function enableStorage(ProviderInterface $provider): self
public function disableStorage(ProviderInterface $provider): self
{
if (!$provider->supportsStorage()) {
- throw new ProviderException(sprintf('Provider "%s" does not support storage.', $provider::class));
+ throw new ProviderException(\sprintf('Provider "%s" does not support storage.', $provider::class));
}
if (1 === \count($this->storageProviders)) {
@@ -144,7 +144,7 @@ public function isStorageEnabled(ProviderInterface $provider): bool
{
$key = $provider::class;
if (!$this->hasProvider($key)) {
- throw new InvalidArgumentException(sprintf('Unknown provider "%s"', $key));
+ throw new InvalidArgumentException(\sprintf('Unknown provider "%s"', $key));
}
return \array_key_exists($key, $this->storageProviders);
@@ -156,7 +156,7 @@ public function isStorageEnabled(ProviderInterface $provider): bool
public function enableAuditing(ProviderInterface $provider): self
{
if (!$provider->supportsAuditing()) {
- throw new ProviderException(sprintf('Provider "%s" does not support audit hooks.', $provider::class));
+ throw new ProviderException(\sprintf('Provider "%s" does not support audit hooks.', $provider::class));
}
$this->auditProviders[$provider::class] = $provider;
@@ -170,7 +170,7 @@ public function enableAuditing(ProviderInterface $provider): self
public function disableAuditing(ProviderInterface $provider): self
{
if (!$provider->supportsAuditing()) {
- throw new ProviderException(sprintf('Provider "%s" does not support audit hooks.', $provider::class));
+ throw new ProviderException(\sprintf('Provider "%s" does not support audit hooks.', $provider::class));
}
if (1 === \count($this->auditProviders)) {
@@ -188,7 +188,7 @@ public function disableAuditing(ProviderInterface $provider): self
public function isAuditingEnabled(ProviderInterface $provider): bool
{
if (!$this->hasProvider($provider::class)) {
- throw new InvalidArgumentException(sprintf('Unknown provider "%s"', $provider::class));
+ throw new InvalidArgumentException(\sprintf('Unknown provider "%s"', $provider::class));
}
return \array_key_exists($provider::class, $this->auditProviders);
diff --git a/src/Provider/AbstractProvider.php b/src/Provider/AbstractProvider.php
index 633a5a57..a6001138 100644
--- a/src/Provider/AbstractProvider.php
+++ b/src/Provider/AbstractProvider.php
@@ -58,7 +58,7 @@ public function registerStorageService(StorageServiceInterface $service): Provid
}
if (\array_key_exists($service->getName(), $this->storageServices)) {
- throw new ProviderException(sprintf('A storage service named "%s" is already registered.', $service->getName()));
+ throw new ProviderException(\sprintf('A storage service named "%s" is already registered.', $service->getName()));
}
$this->storageServices[$service->getName()] = $service;
@@ -81,7 +81,7 @@ public function registerAuditingService(AuditingServiceInterface $service): Prov
}
if (\array_key_exists($service->getName(), $this->auditingServices)) {
- throw new ProviderException(sprintf('An auditing service named "%s" is already registered.', $service->getName()));
+ throw new ProviderException(\sprintf('An auditing service named "%s" is already registered.', $service->getName()));
}
$this->auditingServices[$service->getName()] = $service;
diff --git a/src/Provider/Doctrine/Auditing/Transaction/AuditTrait.php b/src/Provider/Doctrine/Auditing/Transaction/AuditTrait.php
index 229dc3ae..44faaa52 100644
--- a/src/Provider/Doctrine/Auditing/Transaction/AuditTrait.php
+++ b/src/Provider/Doctrine/Auditing/Transaction/AuditTrait.php
@@ -31,7 +31,7 @@ private function id(EntityManagerInterface $entityManager, object $entity): mixe
try {
$pk = $meta->getSingleIdentifierFieldName();
} catch (ORMMappingException) {
- throw new MappingException(sprintf('Composite primary keys are not supported (%s).', $entity::class));
+ throw new MappingException(\sprintf('Composite primary keys are not supported (%s).', $entity::class));
}
if (isset($meta->fieldMappings[$pk])) {
diff --git a/src/Provider/Doctrine/DoctrineProvider.php b/src/Provider/Doctrine/DoctrineProvider.php
index 28bd79fa..8245fd4b 100644
--- a/src/Provider/Doctrine/DoctrineProvider.php
+++ b/src/Provider/Doctrine/DoctrineProvider.php
@@ -95,7 +95,7 @@ public function getAuditingServiceForEntity(string $entity): AuditingService
}
}
- throw new InvalidArgumentException(sprintf('Auditing service not found for "%s".', $entity));
+ throw new InvalidArgumentException(\sprintf('Auditing service not found for "%s".', $entity));
}
public function getStorageServiceForEntity(string $entity): StorageService
@@ -130,7 +130,7 @@ public function persist(LifecycleEvent $event): void
unset($payload['table'], $payload['entity']);
$keys = array_keys(self::FIELDS);
- $query = sprintf(
+ $query = \sprintf(
'INSERT INTO %s (%s) VALUES (%s)',
$auditTable,
implode(', ', $keys),
diff --git a/src/Provider/Doctrine/Persistence/Command/CleanAuditLogsCommand.php b/src/Provider/Doctrine/Persistence/Command/CleanAuditLogsCommand.php
index 42a5672a..a5bc1766 100644
--- a/src/Provider/Doctrine/Persistence/Command/CleanAuditLogsCommand.php
+++ b/src/Provider/Doctrine/Persistence/Command/CleanAuditLogsCommand.php
@@ -80,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
try {
$until = new DateTimeImmutable($date);
} catch (Exception) {
- $io->error(sprintf('Invalid date format provided: %s', $date));
+ $io->error(\sprintf('Invalid date format provided: %s', $date));
}
} else {
// Fall back to default retention period
@@ -129,7 +129,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$count += \count($entities);
}
- $message = sprintf(
+ $message = \sprintf(
"You are about to clean audits created before %s: %d classes involved.\n Do you want to proceed?",
$until->format(self::UNTIL_DATE_FORMAT),
$count
@@ -176,7 +176,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$queryBuilder->executeStatement();
}
- $progressBar->setMessage(sprintf('Cleaning audit tables... (%s)', $auditTable));
+ $progressBar->setMessage(\sprintf('Cleaning audit tables... (%s)', $auditTable));
$progressBar->advance();
}
}
@@ -211,7 +211,7 @@ private function validateKeepArgument(string $keep, SymfonyStyle $io): ?DateTime
try {
$dateInterval = new DateInterval($keep);
} catch (Exception) {
- $io->error(sprintf("'keep' argument must be a valid ISO 8601 date interval, '%s' given.", $keep));
+ $io->error(\sprintf("'keep' argument must be a valid ISO 8601 date interval, '%s' given.", $keep));
$this->release();
return null;
diff --git a/src/Provider/Doctrine/Persistence/Command/UpdateSchemaCommand.php b/src/Provider/Doctrine/Persistence/Command/UpdateSchemaCommand.php
index d9e303da..035a8ae3 100644
--- a/src/Provider/Doctrine/Persistence/Command/UpdateSchemaCommand.php
+++ b/src/Provider/Doctrine/Persistence/Command/UpdateSchemaCommand.php
@@ -79,7 +79,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
foreach ($sqls as $queries) {
foreach ($queries as $sql) {
- $io->text(sprintf(' %s;', $sql));
+ $io->text(\sprintf(' %s;', $sql));
}
}
}
@@ -104,7 +104,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$pluralization = (1 === $count) ? 'query was' : 'queries were';
- $io->text(sprintf(' %s %s executed', $count, $pluralization));
+ $io->text(\sprintf(' %s %s executed', $count, $pluralization));
$io->success('Database schema updated successfully!');
}
@@ -117,12 +117,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io->caution('This operation should not be executed in a production environment!');
$io->text(
[
- sprintf('The Schema-Tool would execute "%s" queries to update the database.', $count),
+ \sprintf('The Schema-Tool would execute "%s" queries to update the database.', $count),
'',
'Please run the operation by passing one - or both - of the following options:',
'',
- sprintf(' %s --force to execute the command', $this->getName()),
- sprintf(' %s --dump-sql to dump the SQL statements to the screen', $this->getName()),
+ \sprintf(' %s --force to execute the command', $this->getName()),
+ \sprintf(' %s --dump-sql to dump the SQL statements to the screen', $this->getName()),
]
);
diff --git a/src/Provider/Doctrine/Persistence/Event/CreateSchemaListener.php b/src/Provider/Doctrine/Persistence/Event/CreateSchemaListener.php
index 9afbf318..da095f9c 100644
--- a/src/Provider/Doctrine/Persistence/Event/CreateSchemaListener.php
+++ b/src/Provider/Doctrine/Persistence/Event/CreateSchemaListener.php
@@ -35,7 +35,7 @@ public function postGenerateSchemaTable(GenerateSchemaTableEventArgs $eventArgs)
ClassMetadataInfo::INHERITANCE_TYPE_JOINED,
ClassMetadataInfo::INHERITANCE_TYPE_SINGLE_TABLE,
], true)) {
- throw new Exception(sprintf('Inheritance type "%s" is not yet supported', $metadata->inheritanceType));
+ throw new Exception(\sprintf('Inheritance type "%s" is not yet supported', $metadata->inheritanceType));
}
$targetEntity = $metadata->name;
diff --git a/src/Provider/Doctrine/Persistence/Helper/DoctrineHelper.php b/src/Provider/Doctrine/Persistence/Helper/DoctrineHelper.php
index 2fa7e5af..5f1036ce 100644
--- a/src/Provider/Doctrine/Persistence/Helper/DoctrineHelper.php
+++ b/src/Provider/Doctrine/Persistence/Helper/DoctrineHelper.php
@@ -51,7 +51,7 @@ public static function getRealClassName(object|string $subject): string
public static function getDoctrineType(string $type): string
{
if (!\defined(Types::class.'::'.$type)) {
- throw new InvalidArgumentException(sprintf('Undefined Doctrine type "%s"', $type));
+ throw new InvalidArgumentException(\sprintf('Undefined Doctrine type "%s"', $type));
}
\assert(\is_string(\constant(Types::class.'::'.$type)));
diff --git a/src/Provider/Doctrine/Persistence/Reader/Filter/DateRangeFilter.php b/src/Provider/Doctrine/Persistence/Reader/Filter/DateRangeFilter.php
index e54c36d3..84c9c602 100644
--- a/src/Provider/Doctrine/Persistence/Reader/Filter/DateRangeFilter.php
+++ b/src/Provider/Doctrine/Persistence/Reader/Filter/DateRangeFilter.php
@@ -45,12 +45,12 @@ public function getSQL(): array
$params = [];
if ($this->minValue instanceof DateTimeInterface) {
- $sqls[] = sprintf('%s >= :min_%s', $this->name, $this->name);
+ $sqls[] = \sprintf('%s >= :min_%s', $this->name, $this->name);
$params['min_'.$this->name] = $this->minValue->format('Y-m-d H:i:s');
}
if ($this->maxValue instanceof DateTimeInterface) {
- $sqls[] = sprintf('%s <= :max_%s', $this->name, $this->name);
+ $sqls[] = \sprintf('%s <= :max_%s', $this->name, $this->name);
$params['max_'.$this->name] = $this->maxValue->format('Y-m-d H:i:s');
}
diff --git a/src/Provider/Doctrine/Persistence/Reader/Filter/RangeFilter.php b/src/Provider/Doctrine/Persistence/Reader/Filter/RangeFilter.php
index adc05ec5..1adafbd6 100644
--- a/src/Provider/Doctrine/Persistence/Reader/Filter/RangeFilter.php
+++ b/src/Provider/Doctrine/Persistence/Reader/Filter/RangeFilter.php
@@ -52,12 +52,12 @@ public function getSQL(): array
$params = [];
if (null !== $this->minValue) {
- $sqls[] = sprintf('%s >= :min_%s', $this->name, $this->name);
+ $sqls[] = \sprintf('%s >= :min_%s', $this->name, $this->name);
$params['min_'.$this->name] = $this->minValue;
}
if (null !== $this->maxValue) {
- $sqls[] = sprintf('%s <= :max_%s', $this->name, $this->name);
+ $sqls[] = \sprintf('%s <= :max_%s', $this->name, $this->name);
$params['max_'.$this->name] = $this->maxValue;
}
diff --git a/src/Provider/Doctrine/Persistence/Reader/Filter/SimpleFilter.php b/src/Provider/Doctrine/Persistence/Reader/Filter/SimpleFilter.php
index 041712c4..fe4d39a6 100644
--- a/src/Provider/Doctrine/Persistence/Reader/Filter/SimpleFilter.php
+++ b/src/Provider/Doctrine/Persistence/Reader/Filter/SimpleFilter.php
@@ -30,13 +30,13 @@ public function getSQL(): array
{
if (\is_array($this->value) && 1 < \count($this->value)) {
return [
- 'sql' => sprintf('%s IN (:%s)', $this->name, $this->name),
+ 'sql' => \sprintf('%s IN (:%s)', $this->name, $this->name),
'params' => [$this->name => $this->value],
];
}
return [
- 'sql' => sprintf('%s = :%s', $this->name, $this->name),
+ 'sql' => \sprintf('%s = :%s', $this->name, $this->name),
'params' => [$this->name => (\is_array($this->value) ? $this->value[0] : $this->value)],
];
}
diff --git a/src/Provider/Doctrine/Persistence/Reader/Query.php b/src/Provider/Doctrine/Persistence/Reader/Query.php
index 6260f7b8..72fdd79c 100644
--- a/src/Provider/Doctrine/Persistence/Reader/Query.php
+++ b/src/Provider/Doctrine/Persistence/Reader/Query.php
@@ -315,7 +315,7 @@ private function buildLimit(QueryBuilder $queryBuilder): QueryBuilder
private function checkFilter(string $filter): void
{
if (!\in_array($filter, $this->getSupportedFilters(), true)) {
- throw new InvalidArgumentException(sprintf('Unsupported "%s" filter, allowed filters: %s.', $filter, implode(', ', $this->getSupportedFilters())));
+ throw new InvalidArgumentException(\sprintf('Unsupported "%s" filter, allowed filters: %s.', $filter, implode(', ', $this->getSupportedFilters())));
}
}
}
diff --git a/src/Provider/Doctrine/Persistence/Reader/Reader.php b/src/Provider/Doctrine/Persistence/Reader/Reader.php
index f6f20d22..5228f8bb 100644
--- a/src/Provider/Doctrine/Persistence/Reader/Reader.php
+++ b/src/Provider/Doctrine/Persistence/Reader/Reader.php
@@ -165,7 +165,7 @@ public function getEntityAuditTableName(string $entity): string
$schema = $entityManager->getClassMetadata($entity)->getSchemaName().'.';
}
- return sprintf(
+ return \sprintf(
'%s%s%s%s',
$schema,
$configuration->getTablePrefix(),
diff --git a/src/Provider/Doctrine/Persistence/Schema/SchemaManager.php b/src/Provider/Doctrine/Persistence/Schema/SchemaManager.php
index 681b2a18..23dffd21 100644
--- a/src/Provider/Doctrine/Persistence/Schema/SchemaManager.php
+++ b/src/Provider/Doctrine/Persistence/Schema/SchemaManager.php
@@ -198,7 +198,7 @@ public function createAuditTable(string $entity, ?Schema $schema = null): Schema
PlatformHelper::isIndexLengthLimited($columnName, $connection) ? ['lengths' => [191]] : []
);
} else {
- throw new InvalidArgumentException(sprintf("Missing key 'name' for column '%s'", $columnName));
+ throw new InvalidArgumentException(\sprintf("Missing key 'name' for column '%s'", $columnName));
}
}
}
@@ -274,7 +274,7 @@ public function computeAuditTablename(string $entityTableName, Configuration $co
{
return preg_replace(
'#^([^.]+\.)?(.+)$#',
- sprintf(
+ \sprintf(
'$1%s$2%s',
preg_quote($configuration->getTablePrefix(), '#'),
preg_quote($configuration->getTableSuffix(), '#')
diff --git a/tests/Provider/Doctrine/Event/DoctrineSubscriberTest.php b/tests/Provider/Doctrine/Event/DoctrineSubscriberTest.php
index 94461164..2c7cee03 100644
--- a/tests/Provider/Doctrine/Event/DoctrineSubscriberTest.php
+++ b/tests/Provider/Doctrine/Event/DoctrineSubscriberTest.php
@@ -28,7 +28,7 @@ final class DoctrineSubscriberTest extends TestCase
{
public function testIssue184IfAbstractDriverMiddleware(): void
{
- $transactionManager = new class() implements TransactionManagerInterface {
+ $transactionManager = new class implements TransactionManagerInterface {
public function populate($transaction): void {}
public function process($transaction): void
@@ -70,7 +70,7 @@ public function process($transaction): void
public function testIssue184IfNotAbstractDriverMiddleware(): void
{
- $transactionManager = new class() implements TransactionManagerInterface {
+ $transactionManager = new class implements TransactionManagerInterface {
public function populate($transaction): void {}
public function process($transaction): void
@@ -133,7 +133,7 @@ public function createDatabasePlatformForVersion($version): void {}
public function testIssue184Unexpected(): void
{
- $transactionManager = new class() implements TransactionManagerInterface {
+ $transactionManager = new class implements TransactionManagerInterface {
public function populate($transaction): void {}
public function process($transaction): void
@@ -145,7 +145,7 @@ public function process($transaction): void
$args = new OnFlushEventArgs($objectManager);
- $driver = new class() implements VersionAwarePlatformDriver {
+ $driver = new class implements VersionAwarePlatformDriver {
public function connect(array $params): void {}
public function getDatabasePlatform(): void {}
diff --git a/tests/Provider/Doctrine/Persistence/Command/CleanAuditLogsCommandTest.php b/tests/Provider/Doctrine/Persistence/Command/CleanAuditLogsCommandTest.php
index 86aa3137..9588808c 100644
--- a/tests/Provider/Doctrine/Persistence/Command/CleanAuditLogsCommandTest.php
+++ b/tests/Provider/Doctrine/Persistence/Command/CleanAuditLogsCommandTest.php
@@ -46,7 +46,7 @@ public function testExecuteFailsWithKeepWrongFormat(): void
// the output of the command in the console
$output = $commandTester->getDisplay();
- self::assertStringContainsString(sprintf("[ERROR] 'keep' argument must be a valid ISO 8601 date interval, '%s' given.", self::KEEP), $output);
+ self::assertStringContainsString(\sprintf("[ERROR] 'keep' argument must be a valid ISO 8601 date interval, '%s' given.", self::KEEP), $output);
}
public function testDumpSQL(): void