DX: apply rector rules up to php8.0

This commit is contained in:
2023-04-15 01:05:37 +02:00
parent d8870e906f
commit dde3002100
714 changed files with 2348 additions and 9263 deletions

View File

@@ -93,10 +93,7 @@ class ChillMainExtension extends Extension implements
$this->widgetFactories[] = $factory;
}
/**
* @return \Chill\MainBundle\DependencyInjection\Configuration|object|\Symfony\Component\Config\Definition\ConfigurationInterface|null
*/
public function getConfiguration(array $config, ContainerBuilder $container)
public function getConfiguration(array $config, ContainerBuilder $container): \Chill\MainBundle\DependencyInjection\Configuration|object|\Symfony\Component\Config\Definition\ConfigurationInterface|null
{
return new Configuration($this->widgetFactories, $container);
}

View File

@@ -27,21 +27,16 @@ class ACLFlagsCompilerPass implements CompilerPassInterface
$reference = new Reference($id);
foreach ($tags as $tag) {
switch ($tag['scope']) {
case PermissionsGroupType::FLAG_SCOPE:
$permissionGroupType->addMethodCall('addFlagProvider', [$reference]);
break;
default:
throw new LogicException(
sprintf(
"This tag 'scope' is not implemented: %s, on service with id %s",
$tag['scope'],
$id
)
);
}
match ($tag['scope']) {
PermissionsGroupType::FLAG_SCOPE => $permissionGroupType->addMethodCall('addFlagProvider', [$reference]),
default => throw new LogicException(
sprintf(
"This tag 'scope' is not implemented: %s, on service with id %s",
$tag['scope'],
$id
)
),
};
}
}
}

View File

@@ -24,14 +24,11 @@ class Configuration implements ConfigurationInterface
{
use AddWidgetConfigurationTrait;
private ContainerBuilder $containerBuilder;
public function __construct(
array $widgetFactories,
ContainerBuilder $containerBuilder
private ContainerBuilder $containerBuilder
) {
$this->setWidgetFactories($widgetFactories);
$this->containerBuilder = $containerBuilder;
}
public function getConfigTreeBuilder()

View File

@@ -153,7 +153,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
$extension,
HasWidgetFactoriesExtensionInterface::class,
HasWidgetFactoriesExtensionInterface::class,
get_class($extensionClass)
$extensionClass::class
));
}
@@ -277,7 +277,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
if (empty($alias)) {
throw new LogicException(sprintf(
'the widget factory %s returns an empty alias',
get_class($factory)
$factory::class
));
}
@@ -285,13 +285,13 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
if (!is_array($factory->getAllowedPlaces())) {
throw new UnexpectedValueException("the method 'getAllowedPlaces' "
. 'should return a non-empty array. Unexpected value on ' .
get_class($factory));
$factory::class);
}
if (count($factory->getAllowedPlaces()) === 0) {
throw new LengthException("The method 'getAllowedPlaces' should "
. 'return a non-empty array, but returned 0 elements on ' .
get_class($factory) . '::getAllowedPlaces()');
$factory::class . '::getAllowedPlaces()');
}
// check the alias does not exists yet
@@ -365,12 +365,10 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
/**
* get the places where the service is allowed.
*
* @param mixed $place
* @param mixed $widgetAlias
*
* @return unknown
*/
private function isPlaceAllowedForWidget($place, $widgetAlias, ContainerBuilder $container)
private function isPlaceAllowedForWidget(mixed $place, mixed $widgetAlias, ContainerBuilder $container)
{
if ($this->widgetServices[$widgetAlias] instanceof WidgetFactoryInterface) {
if (