mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-02 04:53:49 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -12,7 +12,6 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
|
||||
|
||||
use Chill\MainBundle\Form\PermissionsGroupType;
|
||||
use LogicException;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
@@ -29,13 +28,7 @@ class ACLFlagsCompilerPass implements CompilerPassInterface
|
||||
foreach ($tags as $tag) {
|
||||
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
|
||||
)
|
||||
),
|
||||
default => throw new \LogicException(sprintf("This tag 'scope' is not implemented: %s, on service with id %s", $tag['scope'], $id)),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,6 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
|
||||
|
||||
use Chill\MainBundle\Export\ExportManager;
|
||||
use LogicException;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
@@ -32,8 +31,7 @@ class ExportsCompilerPass implements CompilerPassInterface
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->has(ExportManager::class)) {
|
||||
throw new LogicException('service ' . ExportManager::class . ' '
|
||||
. 'is not defined. It is required by ExportsCompilerPass');
|
||||
throw new \LogicException('service '.ExportManager::class.' is not defined. It is required by ExportsCompilerPass');
|
||||
}
|
||||
|
||||
$chillManagerDefinition = $container->findDefinition(
|
||||
@@ -57,13 +55,11 @@ class ExportsCompilerPass implements CompilerPassInterface
|
||||
foreach ($taggedServices as $id => $tagAttributes) {
|
||||
foreach ($tagAttributes as $attributes) {
|
||||
if (!isset($attributes['prefix'])) {
|
||||
throw new LogicException("the 'prefix' attribute is missing in your " .
|
||||
"service '{$id}' definition");
|
||||
throw new \LogicException("the 'prefix' attribute is missing in your service '{$id}' definition");
|
||||
}
|
||||
|
||||
if (array_search($attributes['prefix'], $knownAliases, true)) {
|
||||
throw new LogicException('There is already a chill.export_elements_provider service with prefix '
|
||||
. $attributes['prefix'] . '. Choose another prefix.');
|
||||
throw new \LogicException('There is already a chill.export_elements_provider service with prefix '.$attributes['prefix'].'. Choose another prefix.');
|
||||
}
|
||||
$knownAliases[] = $attributes['prefix'];
|
||||
|
||||
@@ -88,13 +84,11 @@ class ExportsCompilerPass implements CompilerPassInterface
|
||||
foreach ($taggedServices as $id => $tagAttributes) {
|
||||
foreach ($tagAttributes as $attributes) {
|
||||
if (!isset($attributes['alias'])) {
|
||||
throw new LogicException("the 'alias' attribute is missing in your " .
|
||||
"service '{$id}' definition");
|
||||
throw new \LogicException("the 'alias' attribute is missing in your service '{$id}' definition");
|
||||
}
|
||||
|
||||
if (array_search($attributes['alias'], $knownAliases, true)) {
|
||||
throw new LogicException('There is already a chill.export_formatter service with alias '
|
||||
. $attributes['alias'] . '. Choose another alias.');
|
||||
throw new \LogicException('There is already a chill.export_formatter service with alias '.$attributes['alias'].'. Choose another alias.');
|
||||
}
|
||||
$knownAliases[] = $attributes['alias'];
|
||||
|
||||
|
@@ -12,7 +12,6 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
|
||||
|
||||
use Chill\MainBundle\Routing\MenuComposer;
|
||||
use LogicException;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
@@ -22,8 +21,7 @@ class MenuCompilerPass implements CompilerPassInterface
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('chill.main.menu_composer')) {
|
||||
throw new LogicException(sprintf('The service %s does not exists in '
|
||||
. 'container.', MenuComposer::class));
|
||||
throw new \LogicException(sprintf('The service %s does not exists in container.', MenuComposer::class));
|
||||
}
|
||||
|
||||
$menuComposerDefinition = $container->getDefinition('chill.main.menu_composer');
|
||||
|
@@ -12,7 +12,6 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
|
||||
|
||||
use Chill\MainBundle\Templating\UI\CountNotificationUser;
|
||||
use LogicException;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
@@ -22,8 +21,7 @@ class NotificationCounterCompilerPass implements CompilerPassInterface
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition(CountNotificationUser::class)) {
|
||||
throw new LogicException('The service ' . CountNotificationUser::class . ' '
|
||||
. 'should be defined');
|
||||
throw new \LogicException('The service '.CountNotificationUser::class.' should be defined');
|
||||
}
|
||||
|
||||
$notificationCounterDefinition = $container->getDefinition(CountNotificationUser::class);
|
||||
|
@@ -11,7 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
|
||||
|
||||
use LogicException;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
@@ -26,8 +25,7 @@ class SearchableServicesCompilerPass implements CompilerPassInterface
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('chill_main.search_provider')) {
|
||||
throw new LogicException('service chill_main.search_provider '
|
||||
. 'is not defined.');
|
||||
throw new \LogicException('service chill_main.search_provider is not defined.');
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition(
|
||||
@@ -43,13 +41,11 @@ class SearchableServicesCompilerPass implements CompilerPassInterface
|
||||
foreach ($taggedServices as $id => $tagAttributes) {
|
||||
foreach ($tagAttributes as $attributes) {
|
||||
if (!isset($attributes['alias'])) {
|
||||
throw new LogicException("the 'name' attribute is missing in your " .
|
||||
"service '{$id}' definition");
|
||||
throw new \LogicException("the 'name' attribute is missing in your service '{$id}' definition");
|
||||
}
|
||||
|
||||
if (array_search($attributes['alias'], $knownAliases, true)) {
|
||||
throw new LogicException('There is already a chill.search service with alias '
|
||||
. $attributes['alias'] . '. Choose another alias.');
|
||||
throw new \LogicException('There is already a chill.search service with alias '.$attributes['alias'].'. Choose another alias.');
|
||||
}
|
||||
$knownAliases[] = $attributes['alias'];
|
||||
|
||||
|
@@ -28,7 +28,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use function array_key_exists;
|
||||
|
||||
class ShortMessageCompilerPass implements CompilerPassInterface
|
||||
{
|
||||
@@ -43,30 +42,28 @@ 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::class)) {
|
||||
if (!class_exists('\\'.\Ovh\Api::class)) {
|
||||
throw new RuntimeException('Class \\Ovh\\Api not found');
|
||||
}
|
||||
|
||||
foreach (['user', 'host', 'pass'] as $component) {
|
||||
if (!array_key_exists($component, $dsn)) {
|
||||
throw new RuntimeException(sprintf('The component %s does not exist in dsn. Please provide a dsn ' .
|
||||
'like ovh://applicationKey:applicationSecret@endpoint?consumerKey=xxxx&sender=yyyy&service_name=zzzz', $component));
|
||||
if (!\array_key_exists($component, $dsn)) {
|
||||
throw new RuntimeException(sprintf('The component %s does not exist in dsn. Please provide a dsn like ovh://applicationKey:applicationSecret@endpoint?consumerKey=xxxx&sender=yyyy&service_name=zzzz', $component));
|
||||
}
|
||||
|
||||
$container->setParameter('chill_main.short_messages.ovh_config_' . $component, $dsn[$component]);
|
||||
$container->setParameter('chill_main.short_messages.ovh_config_'.$component, $dsn[$component]);
|
||||
}
|
||||
|
||||
foreach (['consumer_key', 'sender', 'service_name'] as $param) {
|
||||
if (!array_key_exists($param, $dsn['queries'])) {
|
||||
throw new RuntimeException(sprintf('The parameter %s does not exist in dsn. Please provide a dsn ' .
|
||||
'like ovh://applicationKey:applicationSecret@endpoint?consumerKey=xxxx&sender=yyyy&service_name=zzzz', $param));
|
||||
if (!\array_key_exists($param, $dsn['queries'])) {
|
||||
throw new RuntimeException(sprintf('The parameter %s does not exist in dsn. Please provide a dsn like ovh://applicationKey:applicationSecret@endpoint?consumerKey=xxxx&sender=yyyy&service_name=zzzz', $param));
|
||||
}
|
||||
$container->setParameter('chill_main.short_messages.ovh_config_' . $param, $dsn['queries'][$param]);
|
||||
$container->setParameter('chill_main.short_messages.ovh_config_'.$param, $dsn['queries'][$param]);
|
||||
}
|
||||
|
||||
$ovh = new Definition();
|
||||
$ovh
|
||||
->setClass('\\' . \Ovh\Api::class)
|
||||
->setClass('\\'.\Ovh\Api::class)
|
||||
->setArgument(0, $dsn['user'])
|
||||
->setArgument(1, $dsn['pass'])
|
||||
->setArgument(2, $dsn['host'])
|
||||
|
@@ -11,7 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
|
||||
|
||||
use LogicException;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
@@ -25,8 +24,7 @@ class TimelineCompilerClass implements CompilerPassInterface
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('chill_main.timeline_builder')) {
|
||||
throw new LogicException('service chill_main.timeline_builder '
|
||||
. 'is not defined.');
|
||||
throw new \LogicException('service chill_main.timeline_builder is not defined.');
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition(
|
||||
@@ -40,8 +38,7 @@ class TimelineCompilerClass implements CompilerPassInterface
|
||||
foreach ($taggedServices as $id => $tagAttributes) {
|
||||
foreach ($tagAttributes as $attributes) {
|
||||
if (!isset($attributes['context'])) {
|
||||
throw new LogicException("the 'context' attribute is missing in your " .
|
||||
"service '{$id}' definition");
|
||||
throw new \LogicException("the 'context' attribute is missing in your service '{$id}' definition");
|
||||
}
|
||||
|
||||
$definition->addMethodCall(
|
||||
|
Reference in New Issue
Block a user