mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-26 09:33:50 +00:00
DX: apply rector rulesset up to PHP72
This commit is contained in:
@@ -38,11 +38,7 @@ class MenuCompilerPass implements CompilerPassInterface
|
||||
}
|
||||
|
||||
usort($services, static function ($a, $b) {
|
||||
if ($a['priority'] === $b['priority']) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($a['priority'] < $b['priority']) ? -1 : 1;
|
||||
return $a['priority'] <=> $b['priority'];
|
||||
});
|
||||
|
||||
foreach ($services as $service) {
|
||||
|
@@ -34,7 +34,7 @@ class ShortMessageCompilerPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
$config = $container->resolveEnvPlaceholders($container->getParameter('chill_main.short_messages', null), true);
|
||||
$config = $container->resolveEnvPlaceholders($container->getParameter('chill_main.short_messages'), true);
|
||||
// weird fix for special characters
|
||||
$config['dsn'] = str_replace(['%%'], ['%'], $config['dsn']);
|
||||
$dsn = parse_url($config['dsn']);
|
||||
@@ -43,7 +43,7 @@ class ShortMessageCompilerPass implements CompilerPassInterface
|
||||
if ('null' === $dsn['scheme'] || false === $config['enabled']) {
|
||||
$defaultTransporter = new Reference(NullShortMessageSender::class);
|
||||
} elseif ('ovh' === $dsn['scheme']) {
|
||||
if (!class_exists('\Ovh\Api')) {
|
||||
if (!class_exists('\\' . \Ovh\Api::class)) {
|
||||
throw new RuntimeException('Class \\Ovh\\Api not found');
|
||||
}
|
||||
|
||||
@@ -66,17 +66,17 @@ class ShortMessageCompilerPass implements CompilerPassInterface
|
||||
|
||||
$ovh = new Definition();
|
||||
$ovh
|
||||
->setClass('\Ovh\Api')
|
||||
->setClass('\\' . \Ovh\Api::class)
|
||||
->setArgument(0, $dsn['user'])
|
||||
->setArgument(1, $dsn['pass'])
|
||||
->setArgument(2, $dsn['host'])
|
||||
->setArgument(3, $dsn['queries']['consumer_key']);
|
||||
$container->setDefinition('Ovh\Api', $ovh);
|
||||
$container->setDefinition(\Ovh\Api::class, $ovh);
|
||||
|
||||
$ovhSender = new Definition();
|
||||
$ovhSender
|
||||
->setClass(OvhShortMessageSender::class)
|
||||
->setArgument(0, new Reference('Ovh\Api'))
|
||||
->setArgument(0, new Reference(\Ovh\Api::class))
|
||||
->setArgument(1, $dsn['queries']['service_name'])
|
||||
->setArgument(2, $dsn['queries']['sender'])
|
||||
->setArgument(3, new Reference(LoggerInterface::class))
|
||||
|
@@ -37,7 +37,7 @@ class Configuration implements ConfigurationInterface
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder('chill_main');
|
||||
$rootNode = $treeBuilder->getRootNode('chill_main');
|
||||
$rootNode = $treeBuilder->getRootNode();
|
||||
|
||||
$rootNode
|
||||
->children()
|
||||
|
@@ -193,8 +193,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
|
||||
/** @var WidgetFactoryInterface $factory */
|
||||
$factory = $this->widgetServices[$alias];
|
||||
// get the config (under the key which equals to widget_alias
|
||||
$config = isset($param[$factory->getWidgetAlias()]) ?
|
||||
$param[$factory->getWidgetAlias()] : [];
|
||||
$config = $param[$factory->getWidgetAlias()] ?? [];
|
||||
// register the service into the container
|
||||
$serviceId = $this->registerServiceIntoContainer(
|
||||
$container,
|
||||
|
@@ -139,7 +139,7 @@ trait AddWidgetConfigurationTrait
|
||||
protected function addWidgetsConfiguration(string $place, ContainerBuilder $containerBuilder)
|
||||
{
|
||||
$treeBuilder = new TreeBuilder($place);
|
||||
$root = $treeBuilder->getRootNode($place)
|
||||
$root = $treeBuilder->getRootNode()
|
||||
->canBeUnset()
|
||||
->info('register widgets on place "' . $place . '"');
|
||||
|
||||
@@ -170,7 +170,7 @@ trait AddWidgetConfigurationTrait
|
||||
// adding the possible config on each widget under the widget_alias
|
||||
foreach ($this->filterWidgetByPlace($place) as $factory) {
|
||||
$builder = new TreeBuilder($factory->getWidgetAlias());
|
||||
$widgetOptionsRoot = $builder->getRootNode($factory->getWidgetAlias());
|
||||
$widgetOptionsRoot = $builder->getRootNode();
|
||||
$widgetOptionsRoot->canBeUnset()
|
||||
->info(sprintf(
|
||||
'the configuration for the widget "%s" (only required if this widget is set in widget_alias)',
|
||||
|
Reference in New Issue
Block a user