Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

chore: cs #114

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.59.3" installed="3.59.3" location="./tools/php-cs-fixer" copy="false"/>
<phar name="php-cs-fixer" version="^3.64.0" installed="3.64.0" location="./tools/php-cs-fixer" copy="false"/>
</phive>
10 changes: 2 additions & 8 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,19 @@
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PER-CS2.0' => true,
'array_syntax' => ['syntax' => 'short'],

// imports
'@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' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function process(ContainerBuilder $container): void
* @var string $name
*/
foreach (array_keys($entityManagers) as $name) {
$parameterKey = sprintf('rekalogika.domain_event.doctrine.orm.%s_entity_manager', $name);
$parameterKey = \sprintf('rekalogika.domain_event.doctrine.orm.%s_entity_manager', $name);
$container->setParameter($parameterKey, $name);

$path = realpath(__DIR__ . '/../../Entity');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static function (
$tagAttributes['bus'] = 'rekalogika.domain_event.bus';
if ($reflector instanceof \ReflectionMethod) {
if (isset($tagAttributes['method'])) {
throw new \LogicException(sprintf('AsPreFlushDomainEventListener attribute cannot declare a method on "%s::%s()".', $reflector->class, $reflector->name));
throw new \LogicException(\sprintf('AsPreFlushDomainEventListener attribute cannot declare a method on "%s::%s()".', $reflector->class, $reflector->name));
}

$tagAttributes['method'] = $reflector->getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public function createOutboxReader(string $managerName): OutboxReaderInterface
return new EntityManagerOutboxReader($manager);
}

throw new \InvalidArgumentException(sprintf('Object manager with name "%s" is an instance of "%s", but it is unsupported', $managerName, $manager::class));
throw new \InvalidArgumentException(\sprintf('Object manager with name "%s" is an instance of "%s", but it is unsupported', $managerName, $manager::class));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ class UnserializeFailureException extends RuntimeException
{
public function __construct(string $serializedText)
{
parent::__construct(sprintf('Failed to unserialize serialized event object: "%s"', $serializedText));
parent::__construct(\sprintf('Failed to unserialize serialized event object: "%s"', $serializedText));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static function (
$tagAttributes['dispatcher'] = Constants::EVENT_DISPATCHER_POST_FLUSH;
if ($reflector instanceof \ReflectionMethod) {
if (isset($tagAttributes['method'])) {
throw new \LogicException(sprintf('AsPostFlushDomainEventListener attribute cannot declare a method on "%s::%s()".', $reflector->class, $reflector->name));
throw new \LogicException(\sprintf('AsPostFlushDomainEventListener attribute cannot declare a method on "%s::%s()".', $reflector->class, $reflector->name));
}

$tagAttributes['method'] = $reflector->getName();
Expand Down Expand Up @@ -91,7 +91,7 @@ static function (
$tagAttributes['dispatcher'] = Constants::EVENT_DISPATCHER_PRE_FLUSH;
if ($reflector instanceof \ReflectionMethod) {
if (isset($tagAttributes['method'])) {
throw new \LogicException(sprintf('AsPreFlushDomainEventListener attribute cannot declare a method on "%s::%s()".', $reflector->class, $reflector->name));
throw new \LogicException(\sprintf('AsPreFlushDomainEventListener attribute cannot declare a method on "%s::%s()".', $reflector->class, $reflector->name));
}

$tagAttributes['method'] = $reflector->getName();
Expand Down Expand Up @@ -122,7 +122,7 @@ static function (
$tagAttributes['dispatcher'] = Constants::EVENT_DISPATCHER_IMMEDIATE;
if ($reflector instanceof \ReflectionMethod) {
if (isset($tagAttributes['method'])) {
throw new \LogicException(sprintf('AsImmediateDomainEventListener attribute cannot declare a method on "%s::%s()".', $reflector->class, $reflector->name));
throw new \LogicException(\sprintf('AsImmediateDomainEventListener attribute cannot declare a method on "%s::%s()".', $reflector->class, $reflector->name));
}

$tagAttributes['method'] = $reflector->getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function dispatchPreFlushDomainEvents(): int
++$i;

if ($i > self::$preflushLoopLimit) {
throw new SafeguardTriggeredException(sprintf('Pre-flush loop limit reached (%d)', self::$preflushLoopLimit));
throw new SafeguardTriggeredException(\sprintf('Pre-flush loop limit reached (%d)', self::$preflushLoopLimit));
}
} while ($num > 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getManagerName(ObjectManager $manager): string
}

return $this->objectManagerToName[$manager]
?? throw new \InvalidArgumentException(sprintf('Manager "%s" is not registered', $manager::class));
?? throw new \InvalidArgumentException(\sprintf('Manager "%s" is not registered', $manager::class));
}

#[\Override]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public function __construct(DomainEventStore $preFlushEvents, DomainEventStore $
{
$num = \count($preFlushEvents) + \count($postFlushEvents);

parent::__construct(sprintf('There are still %d undispatched domain events. If you disable autodispatch, you have to dispatch them manually or clear them.', $num));
parent::__construct(\sprintf('There are still %d undispatched domain events. If you disable autodispatch, you have to dispatch them manually or clear them.', $num));
}
}