Skip to content

Commit 680ab25

Browse files
authored
Added missing void return types and minor refactoring (#547)
1 parent e92da4f commit 680ab25

28 files changed

Lines changed: 72 additions & 297 deletions

phpstan-baseline.neon

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -288,18 +288,6 @@ parameters:
288288
count: 1
289289
path: src/bundle/Core/Command/VirtualFieldDuplicateFixCommand.php
290290

291-
-
292-
message: '#^Method Ibexa\\Bundle\\Core\\DependencyInjection\\Compiler\\BinaryContentDownloadPass\:\:addCall\(\) has no return type specified\.$#'
293-
identifier: missingType.return
294-
count: 1
295-
path: src/bundle/Core/DependencyInjection/Compiler/BinaryContentDownloadPass.php
296-
297-
-
298-
message: '#^Method Ibexa\\Bundle\\Core\\DependencyInjection\\Compiler\\BinaryContentDownloadPass\:\:addCall\(\) has parameter \$targetServiceName with no type specified\.$#'
299-
identifier: missingType.parameter
300-
count: 1
301-
path: src/bundle/Core/DependencyInjection/Compiler/BinaryContentDownloadPass.php
302-
303291
-
304292
message: '#^Argument of an invalid type array\|bool\|float\|int\|string\|null supplied for foreach, only iterables are supported\.$#'
305293
identifier: foreach.nonIterable
@@ -312,30 +300,6 @@ parameters:
312300
count: 1
313301
path: src/bundle/Core/DependencyInjection/Compiler/EntityManagerFactoryServiceLocatorPass.php
314302

315-
-
316-
message: '#^Method Ibexa\\Bundle\\Core\\DependencyInjection\\Compiler\\ImaginePass\:\:processReduceNoiseFilter\(\) has no return type specified\.$#'
317-
identifier: missingType.return
318-
count: 1
319-
path: src/bundle/Core/DependencyInjection/Compiler/ImaginePass.php
320-
321-
-
322-
message: '#^Method Ibexa\\Bundle\\Core\\DependencyInjection\\Compiler\\ImaginePass\:\:processReduceNoiseFilter\(\) has parameter \$driver with no type specified\.$#'
323-
identifier: missingType.parameter
324-
count: 1
325-
path: src/bundle/Core/DependencyInjection/Compiler/ImaginePass.php
326-
327-
-
328-
message: '#^Method Ibexa\\Bundle\\Core\\DependencyInjection\\Compiler\\ImaginePass\:\:processSwirlFilter\(\) has no return type specified\.$#'
329-
identifier: missingType.return
330-
count: 1
331-
path: src/bundle/Core/DependencyInjection/Compiler/ImaginePass.php
332-
333-
-
334-
message: '#^Method Ibexa\\Bundle\\Core\\DependencyInjection\\Compiler\\ImaginePass\:\:processSwirlFilter\(\) has parameter \$driver with no type specified\.$#'
335-
identifier: missingType.parameter
336-
count: 1
337-
path: src/bundle/Core/DependencyInjection/Compiler/ImaginePass.php
338-
339303
-
340304
message: '#^Argument of an invalid type array\|bool\|float\|int\|string\|null supplied for foreach, only iterables are supported\.$#'
341305
identifier: foreach.nonIterable
@@ -426,12 +390,6 @@ parameters:
426390
count: 1
427391
path: src/bundle/Core/DependencyInjection/Compiler/SessionConfigurationPass.php
428392

429-
-
430-
message: '#^Constant Ibexa\\Bundle\\Core\\DependencyInjection\\Compiler\\TranslationCollectorPass\:\:LOCALES_MAP type has no value type specified in iterable type array\.$#'
431-
identifier: missingType.iterableValue
432-
count: 1
433-
path: src/bundle/Core/DependencyInjection/Compiler/TranslationCollectorPass.php
434-
435393
-
436394
message: '#^Parameter \#1 \$kernelRootDir of class Ibexa\\Bundle\\Core\\Translation\\GlobCollector constructor expects string, array\|bool\|float\|int\|string\|null given\.$#'
437395
identifier: argument.type
@@ -8028,30 +7986,6 @@ parameters:
80287986
count: 1
80297987
path: src/lib/Base/Container/Compiler/GenericFieldTypeConverterPass.php
80307988

8031-
-
8032-
message: '#^Method Ibexa\\Core\\Base\\Container\\Compiler\\Search\\Legacy\\CriteriaConverterPass\:\:addHandlers\(\) has no return type specified\.$#'
8033-
identifier: missingType.return
8034-
count: 1
8035-
path: src/lib/Base/Container/Compiler/Search/Legacy/CriteriaConverterPass.php
8036-
8037-
-
8038-
message: '#^Method Ibexa\\Core\\Base\\Container\\Compiler\\Search\\Legacy\\CriteriaConverterPass\:\:addHandlers\(\) has parameter \$handlers with no type specified\.$#'
8039-
identifier: missingType.parameter
8040-
count: 1
8041-
path: src/lib/Base/Container/Compiler/Search/Legacy/CriteriaConverterPass.php
8042-
8043-
-
8044-
message: '#^Method Ibexa\\Core\\Base\\Container\\Compiler\\Search\\Legacy\\SortClauseConverterPass\:\:addHandlers\(\) has no return type specified\.$#'
8045-
identifier: missingType.return
8046-
count: 1
8047-
path: src/lib/Base/Container/Compiler/Search/Legacy/SortClauseConverterPass.php
8048-
8049-
-
8050-
message: '#^Method Ibexa\\Core\\Base\\Container\\Compiler\\Search\\Legacy\\SortClauseConverterPass\:\:addHandlers\(\) has parameter \$handlers with no type specified\.$#'
8051-
identifier: missingType.parameter
8052-
count: 1
8053-
path: src/lib/Base/Container/Compiler/Search/Legacy/SortClauseConverterPass.php
8054-
80557989
-
80567990
message: '#^Class Ibexa\\Core\\Base\\Container\\Compiler\\TaggedServiceIdsIterator\\BackwardCompatibleIterator implements generic interface IteratorAggregate but does not specify its types\: TKey, TValue$#'
80577991
identifier: missingType.generics

src/bundle/Core/DependencyInjection/Compiler/BinaryContentDownloadPass.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@
1414
use Symfony\Component\DependencyInjection\ContainerBuilder;
1515
use Symfony\Component\DependencyInjection\Reference;
1616

17-
/**
18-
* Injects the downloadUrlGenerator into the binary fieldtype external storage services.
19-
*/
2017
class BinaryContentDownloadPass implements CompilerPassInterface
2118
{
22-
public function process(ContainerBuilder $container)
19+
public function process(ContainerBuilder $container): void
2320
{
2421
if (!$container->has(ContentDownloadUrlGenerator::class)) {
2522
return;
@@ -31,7 +28,7 @@ public function process(ContainerBuilder $container)
3128
$this->addCall($container, $downloadUrlReference, BinaryFileStorage::class);
3229
}
3330

34-
private function addCall(ContainerBuilder $container, Reference $reference, $targetServiceName)
31+
private function addCall(ContainerBuilder $container, Reference $reference, string $targetServiceName): void
3532
{
3633
if (!$container->has($targetServiceName)) {
3734
return;

src/bundle/Core/DependencyInjection/Compiler/ChainConfigResolverPass.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,9 @@
1212
use Symfony\Component\DependencyInjection\ContainerBuilder;
1313
use Symfony\Component\DependencyInjection\Reference;
1414

15-
/**
16-
* The ChainConfigResolverPass will register all services tagged as "ibexa.site.config.resolver"
17-
* to the chain config resolver.
18-
*/
1915
class ChainConfigResolverPass implements CompilerPassInterface
2016
{
21-
/**
22-
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
23-
*/
24-
public function process(ContainerBuilder $container)
17+
public function process(ContainerBuilder $container): void
2518
{
2619
if (!$container->hasDefinition(ChainConfigResolver::class)) {
2720
return;
@@ -31,7 +24,6 @@ public function process(ContainerBuilder $container)
3124

3225
foreach ($container->findTaggedServiceIds('ibexa.site.config.resolver') as $id => $attributes) {
3326
$priority = isset($attributes[0]['priority']) ? (int)$attributes[0]['priority'] : 0;
34-
// Priority range is between -255 (the lowest) and 255 (the highest)
3527
if ($priority > 255) {
3628
$priority = 255;
3729
}

src/bundle/Core/DependencyInjection/Compiler/ChainRoutingPass.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,9 @@
1414
use Symfony\Component\DependencyInjection\ContainerBuilder;
1515
use Symfony\Component\DependencyInjection\Reference;
1616

17-
/**
18-
* The ChainRoutingPass will register all services tagged as "router" to the chain router.
19-
*/
2017
class ChainRoutingPass implements CompilerPassInterface
2118
{
22-
/**
23-
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
24-
*/
25-
public function process(ContainerBuilder $container)
19+
public function process(ContainerBuilder $container): void
2620
{
2721
if (!$container->hasDefinition(ChainRouter::class)) {
2822
return;
@@ -54,7 +48,6 @@ public function process(ContainerBuilder $container)
5448

5549
foreach ($container->findTaggedServiceIds('router') as $id => $attributes) {
5650
$priority = isset($attributes[0]['priority']) ? (int)$attributes[0]['priority'] : 0;
57-
// Priority range is between -255 (the lowest) and 255 (the highest)
5851
if ($priority > 255) {
5952
$priority = 255;
6053
}

src/bundle/Core/DependencyInjection/Compiler/ConsoleCacheWarmupPass.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,16 @@
77

88
namespace Ibexa\Bundle\Core\DependencyInjection\Compiler;
99

10+
use const PHP_SAPI;
1011
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1112
use Symfony\Component\DependencyInjection\ContainerBuilder;
1213
use Symfony\Component\DependencyInjection\Reference;
1314

14-
/**
15-
* Cache related compiler pass.
16-
*
17-
* Ensures class cache warmup is disabled in console mode.
18-
*/
1915
class ConsoleCacheWarmupPass implements CompilerPassInterface
2016
{
21-
public function process(ContainerBuilder $container)
17+
public function process(ContainerBuilder $container): void
2218
{
23-
// This pass is CLI only as CLI class cache warmup conflicts with web access, see EZP-29034
24-
if (\PHP_SAPI !== 'cli' ||
19+
if (PHP_SAPI !== 'cli' ||
2520
!$container->hasDefinition('kernel.class_cache.cache_warmer')) {
2621
return;
2722
}
@@ -32,17 +27,16 @@ public function process(ContainerBuilder $container)
3227
continue;
3328
}
3429

35-
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
30+
$priority = $attributes[0]['priority'] ?? 0;
3631
$warmers[$priority][] = new Reference($id);
3732
}
3833

3934
if (empty($warmers)) {
4035
return;
4136
}
4237

43-
// sort by priority and flatten
4438
krsort($warmers);
45-
$warmers = \call_user_func_array('array_merge', $warmers);
39+
$warmers = array_merge(...$warmers);
4640

4741
$container->getDefinition('cache_warmer')->replaceArgument(0, $warmers);
4842
}

src/bundle/Core/DependencyInjection/Compiler/ConsoleCommandPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
final class ConsoleCommandPass implements CompilerPassInterface
1616
{
17-
public function process(ContainerBuilder $container)
17+
public function process(ContainerBuilder $container): void
1818
{
1919
foreach ($container->findTaggedServiceIds('console.command') as $id => $attributes) {
2020
$definition = $container->getDefinition($id);

src/bundle/Core/DependencyInjection/Compiler/FieldTypeParameterProviderRegistryPass.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,16 @@
88
namespace Ibexa\Bundle\Core\DependencyInjection\Compiler;
99

1010
use Ibexa\Core\MVC\Symfony\FieldType\View\ParameterProviderRegistry;
11+
use LogicException;
1112
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1213
use Symfony\Component\DependencyInjection\ContainerBuilder;
1314
use Symfony\Component\DependencyInjection\Reference;
1415

15-
/**
16-
* This compiler pass will register Ibexa field type parameter providers.
17-
*/
1816
class FieldTypeParameterProviderRegistryPass implements CompilerPassInterface
1917
{
20-
public const FIELD_TYPE_PARAMETER_PROVIDER_SERVICE_TAG = 'ibexa.field_type.view.parameter.provider';
21-
22-
/**
23-
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
24-
*
25-
* @throws \LogicException
26-
*/
27-
public function process(ContainerBuilder $container)
18+
public const string FIELD_TYPE_PARAMETER_PROVIDER_SERVICE_TAG = 'ibexa.field_type.view.parameter.provider';
19+
20+
public function process(ContainerBuilder $container): void
2821
{
2922
if (!$container->hasDefinition(ParameterProviderRegistry::class)) {
3023
return;
@@ -38,7 +31,7 @@ public function process(ContainerBuilder $container)
3831
foreach ($serviceTags as $serviceId => $attributes) {
3932
foreach ($attributes as $attribute) {
4033
if (!isset($attribute['alias'])) {
41-
throw new \LogicException(
34+
throw new LogicException(
4235
sprintf(
4336
'Service "%s" tagged with "%s" service tag needs an "alias" attribute to identify the Field Type.',
4437
$serviceId,

src/bundle/Core/DependencyInjection/Compiler/ImaginePass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
class ImaginePass implements CompilerPassInterface
2121
{
22-
public function process(ContainerBuilder $container)
22+
public function process(ContainerBuilder $container): void
2323
{
2424
if (!$container->hasDefinition('liip_imagine.filter.configuration')) {
2525
return;
@@ -38,7 +38,7 @@ public function process(ContainerBuilder $container)
3838
}
3939
}
4040

41-
private function processReduceNoiseFilter(ContainerBuilder $container, $driver)
41+
private function processReduceNoiseFilter(ContainerBuilder $container, string $driver): void
4242
{
4343
if ($driver === 'imagick') {
4444
$container->setAlias('ibexa.image_alias.imagine.filter.reduce_noise', new Alias(ImagickReduceNoiseFilter::class));
@@ -47,7 +47,7 @@ private function processReduceNoiseFilter(ContainerBuilder $container, $driver)
4747
}
4848
}
4949

50-
private function processSwirlFilter(ContainerBuilder $container, $driver)
50+
private function processSwirlFilter(ContainerBuilder $container, string $driver): void
5151
{
5252
if ($driver === 'imagick') {
5353
$container->setAlias('ibexa.image_alias.imagine.filter.swirl', new Alias(ImagickSwirlFilter::class));

src/bundle/Core/DependencyInjection/Compiler/NotificationRendererPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515

1616
class NotificationRendererPass implements CompilerPassInterface
1717
{
18-
public const TAG_NAME = 'ibexa.notification.renderer';
19-
public const REGISTRY_DEFINITION_ID = 'notification.renderer.registry';
18+
public const string TAG_NAME = 'ibexa.notification.renderer';
19+
public const string REGISTRY_DEFINITION_ID = 'notification.renderer.registry';
2020

21-
public function process(ContainerBuilder $container)
21+
public function process(ContainerBuilder $container): void
2222
{
2323
if (!$container->has(self::REGISTRY_DEFINITION_ID)) {
2424
return;

src/bundle/Core/DependencyInjection/Compiler/PlaceholderProviderPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515

1616
class PlaceholderProviderPass implements CompilerPassInterface
1717
{
18-
public const TAG_NAME = 'ibexa.media.images.placeholder.provider';
19-
public const REGISTRY_DEFINITION_ID = PlaceholderProviderRegistry::class;
18+
public const string TAG_NAME = 'ibexa.media.images.placeholder.provider';
19+
public const string REGISTRY_DEFINITION_ID = PlaceholderProviderRegistry::class;
2020

21-
public function process(ContainerBuilder $container)
21+
public function process(ContainerBuilder $container): void
2222
{
2323
if (!$container->hasDefinition(self::REGISTRY_DEFINITION_ID)) {
2424
return;

0 commit comments

Comments
 (0)