Skip to content

Commit a566811

Browse files
authored
chore: enable native_function_invocation in php-cs-fixer (#94)
1 parent 2a6ac45 commit a566811

18 files changed

+30
-25
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
'no_useless_else' => true,
3131
'no_useless_return' => true,
3232
'declare_strict_types' => true,
33+
'native_function_invocation' => ['include' => ['@compiler_optimized']],
3334
'header_comment' => [
3435
'header' => <<<EOF
3536
This file is part of rekalogika/domain-event-src package.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 2.3.2
4+
5+
* chore: enable native_function_invocation in php-cs-fixer
6+
37
## 2.3.1
48

59
* fix: invalid version in `composer.json`

packages/domain-event-outbox/src/Command/MessageRelayCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6161
return Command::SUCCESS;
6262
}
6363

64-
if (!is_string($managerName)) {
64+
if (!\is_string($managerName)) {
6565
throw new \InvalidArgumentException('The manager name must be a string.');
6666
}
6767

packages/domain-event-outbox/src/DependencyInjection/CompilerPass/OutboxEntityPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class OutboxEntityPass implements CompilerPassInterface
2525
public function process(ContainerBuilder $container): void
2626
{
2727
$entityManagers = $container->getParameter('doctrine.entity_managers');
28-
assert(is_array($entityManagers));
28+
\assert(\is_array($entityManagers));
2929

3030
/**
3131
* @var string $name

packages/domain-event-outbox/src/DependencyInjection/RekalogikaDomainEventOutboxExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function load(array $configs, ContainerBuilder $container): void
4444
$config = $this->processConfiguration($configuration, $configs);
4545

4646
$outboxTable = $config['outbox_table'] ?? null;
47-
assert(is_string($outboxTable), 'The "outbox_table" option must be a string.');
47+
\assert(\is_string($outboxTable), 'The "outbox_table" option must be a string.');
4848
$container->setParameter('rekalogika.domain_event.outbox.outbox_table', $outboxTable);
4949

5050
$container

packages/domain-event-outbox/src/Doctrine/EntityManagerOutboxReader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ public function getOutboxMessages(int $limit): iterable
4141
->setMaxResults($limit);
4242

4343
$result = $queryBuilder->getQuery()->getResult();
44-
assert(is_array($result));
44+
\assert(\is_array($result));
4545

4646
foreach ($result as $row) {
47-
assert($row instanceof OutboxMessage);
47+
\assert($row instanceof OutboxMessage);
4848

4949
$id = $row->getId();
5050

packages/domain-event-outbox/src/Doctrine/OutboxReaderFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ public function createOutboxReader(string $managerName): OutboxReaderInterface
3232
return new EntityManagerOutboxReader($manager);
3333
}
3434

35-
throw new \InvalidArgumentException(sprintf('Object manager with name "%s" is an instance of "%s", but it is unsupported', $managerName, get_class($manager)));
35+
throw new \InvalidArgumentException(sprintf('Object manager with name "%s" is an instance of "%s", but it is unsupported', $managerName, \get_class($manager)));
3636
}
3737
}

packages/domain-event-outbox/src/MessageRelay/MessageRelay.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,6 @@ private function messageHasHandlers(Envelope $envelope): bool
110110
$handlers = $this->handlersLocator->getHandlers($envelope);
111111
$handlers = $handlers instanceof \Traversable ? iterator_to_array($handlers) : $handlers;
112112

113-
return count($handlers) > 0;
113+
return \count($handlers) > 0;
114114
}
115115
}

packages/domain-event/src/DependencyInjection/CompilerPass/EntityManagerDecoratorPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class EntityManagerDecoratorPass implements CompilerPassInterface
2626
public function process(ContainerBuilder $container): void
2727
{
2828
$entityManagers = $container->getParameter('doctrine.entity_managers');
29-
assert(is_array($entityManagers));
29+
\assert(\is_array($entityManagers));
3030

3131
$eventDispatchers = $container->getDefinition(Constants::EVENT_DISPATCHERS);
3232

packages/domain-event/src/Doctrine/DomainEventAwareEntityManager.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function dispatchPreFlushDomainEvents(): int
109109

110110
private function preFlushDispatch(): int
111111
{
112-
$num = count($this->preFlushDomainEvents);
112+
$num = \count($this->preFlushDomainEvents);
113113
$events = $this->preFlushDomainEvents->pop();
114114

115115
foreach ($events as $event) {
@@ -127,7 +127,7 @@ private function preFlushDispatch(): int
127127

128128
public function dispatchPostFlushDomainEvents(): int
129129
{
130-
$num = count($this->postFlushDomainEvents);
130+
$num = \count($this->postFlushDomainEvents);
131131
$events = $this->postFlushDomainEvents->pop();
132132
// for safeguard we also clear preflush events here
133133
$this->preFlushDomainEvents->clear();
@@ -230,8 +230,8 @@ public function rollback(): void
230230
*/
231231
public function transactional(mixed $func): mixed
232232
{
233-
if (!is_callable($func)) {
234-
throw new \InvalidArgumentException('Expected argument of type "callable", got "' . gettype($func) . '"');
233+
if (!\is_callable($func)) {
234+
throw new \InvalidArgumentException('Expected argument of type "callable", got "' . \gettype($func) . '"');
235235
}
236236

237237
$this->beginTransaction();
@@ -274,8 +274,8 @@ public function wrapInTransaction(callable $func): mixed
274274

275275
private function hasPendingEvents(): bool
276276
{
277-
return count($this->preFlushDomainEvents) > 0
278-
|| count($this->postFlushDomainEvents) > 0;
277+
return \count($this->preFlushDomainEvents) > 0
278+
|| \count($this->postFlushDomainEvents) > 0;
279279
}
280280

281281
public function __destruct()

0 commit comments

Comments
 (0)