Skip to content

Commit d4d0051

Browse files
authored
Merge pull request #53 from Miljar/phpcs-prefix-internal-methods
Prefix internal PHP methods with namespace
2 parents f422971 + 8cfbcc3 commit d4d0051

23 files changed

Lines changed: 68 additions & 68 deletions

src/Command/AbstractProjectionCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,18 @@ protected function initialize(InputInterface $input, OutputInterface $output)
8989
$this->projectionName = $input->getArgument(static::ARGUMENT_PROJECTION_NAME);
9090

9191
if (! $this->projectionManagerForProjectionsLocator->has($this->projectionName)) {
92-
throw new RuntimeException(sprintf('ProjectionManager for "%s" not found', $this->projectionName));
92+
throw new RuntimeException(\sprintf('ProjectionManager for "%s" not found', $this->projectionName));
9393
}
9494
$this->projectionManager = $this->projectionManagerForProjectionsLocator->get($this->projectionName);
9595

9696
if (! $this->projectionsLocator->has($this->projectionName)) {
97-
throw new RuntimeException(sprintf('Projection "%s" not found', $this->projectionName));
97+
throw new RuntimeException(\sprintf('Projection "%s" not found', $this->projectionName));
9898
}
9999
$this->projection = $this->projectionsLocator->get($this->projectionName);
100100

101101
if ($this->projection instanceof ReadModelProjection) {
102102
if (! $this->projectionReadModelLocator->has($this->projectionName)) {
103-
throw new RuntimeException(sprintf('ReadModel for "%s" not found', $this->projectionName));
103+
throw new RuntimeException(\sprintf('ReadModel for "%s" not found', $this->projectionName));
104104
}
105105
$this->readModel = $this->projectionReadModelLocator->get($this->projectionName);
106106

@@ -114,13 +114,13 @@ protected function initialize(InputInterface $input, OutputInterface $output)
114114
if (null === $this->projector) {
115115
throw new RuntimeException('Projection was not created');
116116
}
117-
$output->writeln(sprintf('<header>Initialized projection "%s"</header>', $this->projectionName));
117+
$output->writeln(\sprintf('<header>Initialized projection "%s"</header>', $this->projectionName));
118118
try {
119119
$state = $this->projectionManager->fetchProjectionStatus($this->projectionName)->getValue();
120120
} catch (\Prooph\EventStore\Exception\RuntimeException $e) {
121121
$state = 'unknown';
122122
}
123-
$output->writeln(sprintf('<action>Current status: <highlight>%s</highlight></action>', $state));
123+
$output->writeln(\sprintf('<action>Current status: <highlight>%s</highlight></action>', $state));
124124
$output->writeln('====================');
125125
}
126126
}

src/Command/ProjectionDeleteCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
2525
{
2626
$withEvents = $input->getOption(self::OPTION_WITH_EVENTS);
2727
if ($withEvents) {
28-
$output->writeln(sprintf('<action>Deleting projection <highlight>%s</highlight> with emitted events</action>', $this->projectionName));
28+
$output->writeln(\sprintf('<action>Deleting projection <highlight>%s</highlight> with emitted events</action>', $this->projectionName));
2929
} else {
30-
$output->writeln(sprintf('<action>Deleting projection </action><highlight>%s</highlight>', $this->projectionName));
30+
$output->writeln(\sprintf('<action>Deleting projection </action><highlight>%s</highlight>', $this->projectionName));
3131
}
3232
$this->projectionManager->deleteProjection($this->projectionName, $withEvents);
3333
}

src/Command/ProjectionNamesCommand.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,20 @@ protected function execute(InputInterface $input, OutputInterface $output)
5656
{
5757
$this->formatOutput($output);
5858

59-
$managerNames = array_keys($this->projectionManagerNames);
59+
$managerNames = \array_keys($this->projectionManagerNames);
6060

6161
if ($requestedManager = $input->getOption(self::OPTION_MANAGER)) {
62-
$managerNames = array_filter($managerNames, function (string $managerName) use ($requestedManager) {
62+
$managerNames = \array_filter($managerNames, function (string $managerName) use ($requestedManager) {
6363
return $managerName === $requestedManager;
6464
});
6565
}
6666

6767
$filter = $input->getArgument(self::ARGUMENT_FILTER);
6868
$regex = $input->getOption(static::OPTION_REGEX);
6969

70-
$output->write(sprintf('<action>Projection names'));
70+
$output->write(\sprintf('<action>Projection names'));
7171
if ($filter) {
72-
$output->write(sprintf(' filter <highlight>%s</highlight>', $filter));
72+
$output->write(\sprintf(' filter <highlight>%s</highlight>', $filter));
7373
}
7474
if ($regex) {
7575
$output->write(' <comment>regex enabled</comment>');
@@ -87,8 +87,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
8787
foreach ($managerNames as $managerName) {
8888
$projectionManager = $this->projectionManagersLocator->get($managerName);
8989

90-
if (count($names) > $offset) {
91-
$projectionNames = $projectionManager->$method($filter, $limit - (count($names) - $offset));
90+
if (\count($names) > $offset) {
91+
$projectionNames = $projectionManager->$method($filter, $limit - (\count($names) - $offset));
9292
} else {
9393
$projectionNames = $projectionManager->$method($filter);
9494
}
@@ -97,12 +97,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
9797
$names[] = [$managerName, $projectionName];
9898
}
9999

100-
if (count($names) >= $maxNeeded) {
100+
if (\count($names) >= $maxNeeded) {
101101
break;
102102
}
103103
}
104104

105-
$names = array_slice($names, $offset, $limit);
105+
$names = \array_slice($names, $offset, $limit);
106106

107107
$table = new Table($output);
108108
$table

src/Command/ProjectionResetCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected function configure()
1919

2020
protected function execute(InputInterface $input, OutputInterface $output)
2121
{
22-
$output->writeln(sprintf('<action>Resetting projection <highlight>%s</highlight></action>', $this->projectionName));
22+
$output->writeln(\sprintf('<action>Resetting projection <highlight>%s</highlight></action>', $this->projectionName));
2323
$this->projectionManager->resetProjection($this->projectionName);
2424
}
2525
}

src/Command/ProjectionRunCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
2525
{
2626
$keepRunning = ! $input->getOption(static::OPTION_RUN_ONCE);
2727
$output->writeln(
28-
sprintf(
28+
\sprintf(
2929
'<action>Starting projection <highlight>%s</highlight>. Keep running: <highlight>%s</highlight></action>', $this->projectionName,
3030
$keepRunning === true ? 'enabled' : 'disabled'
3131
)
3232
);
3333

3434
$projector = $this->projection->project($this->projector);
3535
$projector->run($keepRunning);
36-
$output->writeln(sprintf('<action>Projection <highlight>%s</highlight> completed.</action>', $this->projectionName));
36+
$output->writeln(\sprintf('<action>Projection <highlight>%s</highlight> completed.</action>', $this->projectionName));
3737
}
3838
}

src/Command/ProjectionStateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ protected function configure()
2020
protected function execute(InputInterface $input, OutputInterface $output)
2121
{
2222
$output->writeln('<action>Current state:</action>');
23-
$output->writeln(json_encode($this->projectionManager->fetchProjectionState($this->projectionName)));
23+
$output->writeln(\json_encode($this->projectionManager->fetchProjectionState($this->projectionName)));
2424
}
2525
}

src/Command/ProjectionStopCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected function configure()
1919

2020
protected function execute(InputInterface $input, OutputInterface $output)
2121
{
22-
$output->writeln(sprintf('<action>Stopping projection <highlight>%s</highlight></action>', $this->projectionName));
22+
$output->writeln(\sprintf('<action>Stopping projection <highlight>%s</highlight></action>', $this->projectionName));
2323
$this->projectionManager->stopProjection($this->projectionName);
2424
}
2525
}

src/DependencyInjection/Compiler/DeprecateFqcnProjectionsPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function process(ContainerBuilder $container): void
1717
return;
1818
}
1919

20-
$projections = array_map(function ($argument) {
20+
$projections = \array_map(function ($argument) {
2121
if ($argument instanceof ServiceClosureArgument) {
2222
$argument = $argument->getValues()[0];
2323
}
@@ -26,9 +26,9 @@ public function process(ContainerBuilder $container): void
2626
}, $container->getDefinition('prooph_event_store.projections_locator')->getArgument(0));
2727

2828
foreach ($projections as $eachProjectionId) {
29-
if (! $container->has($eachProjectionId) && class_exists($eachProjectionId)) {
29+
if (! $container->has($eachProjectionId) && \class_exists($eachProjectionId)) {
3030
$container->setDefinition($eachProjectionId, new Definition($eachProjectionId));
31-
@trigger_error(
31+
@\trigger_error(
3232
"The service for the projection \"$eachProjectionId\" is not available. "
3333
. 'Passing FQCN of projections to the configuration is deprecated since v0.5 '
3434
. 'and the support for this will be removed with v1.0',

src/DependencyInjection/Compiler/MetadataEnricherPass.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@ public function process(ContainerBuilder $container)
2929
$globalPlugins = $container->findTaggedServiceIds('prooph_event_store.metadata_enricher');
3030

3131
foreach ($stores as $name => $store) {
32-
$storeEnricherPlugins = $container->findTaggedServiceIds(sprintf('prooph_event_store.%s.metadata_enricher', $name));
33-
$plugins = array_merge($globalPlugins, $storeEnricherPlugins);
32+
$storeEnricherPlugins = $container->findTaggedServiceIds(\sprintf('prooph_event_store.%s.metadata_enricher', $name));
33+
$plugins = \array_merge($globalPlugins, $storeEnricherPlugins);
3434
$enrichers = [];
3535

3636
foreach ($plugins as $id => $args) {
3737
$enrichers[] = new Reference($id);
3838
}
3939

40-
$metadataEnricherAggregateId = sprintf('prooph_event_store.%s.%s', 'metadata_enricher_aggregate', $name);
40+
$metadataEnricherAggregateId = \sprintf('prooph_event_store.%s.%s', 'metadata_enricher_aggregate', $name);
4141
$metadataEnricherAggregateDefinition = $container->getDefinition($metadataEnricherAggregateId);
4242
$metadataEnricherAggregateDefinition->setArguments([$enrichers]);
4343

44-
$metadataEnricherId = sprintf('prooph_event_store.%s.%s', 'metadata_enricher_plugin', $name);
44+
$metadataEnricherId = \sprintf('prooph_event_store.%s.%s', 'metadata_enricher_plugin', $name);
4545
$metadataEnricherDefinition = $container->getDefinition($metadataEnricherId);
4646
$metadataEnricherDefinition->setClass(MetadataEnricherPlugin::class);
47-
$metadataEnricherDefinition->addTag(sprintf('prooph_event_store.%s.plugin', $name));
47+
$metadataEnricherDefinition->addTag(\sprintf('prooph_event_store.%s.plugin', $name));
4848
$metadataEnricherDefinition->setArguments([new Reference($metadataEnricherAggregateId)]);
4949
}
5050
}

src/DependencyInjection/Compiler/PluginLocatorPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ public function process(ContainerBuilder $container)
2525
$storePlugins = [];
2626

2727
foreach ($stores as $name => $store) {
28-
$storePlugins[] = $container->findTaggedServiceIds(sprintf('prooph_event_store.%s.plugin', $name));
28+
$storePlugins[] = $container->findTaggedServiceIds(\sprintf('prooph_event_store.%s.plugin', $name));
2929
}
3030

31-
$plugins = array_merge($globalPlugins, ...$storePlugins);
31+
$plugins = \array_merge($globalPlugins, ...$storePlugins);
3232

3333
$locatorPlugins = [];
3434

0 commit comments

Comments
 (0)