apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -20,7 +20,6 @@ use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodCommentVoter;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodResourceVoter;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Exception;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
@@ -28,8 +27,6 @@ use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use function array_key_exists;
/**
* Class ChillPersonExtension
* Loads and manages your bundle configuration.
@@ -39,7 +36,7 @@ use function array_key_exists;
class ChillPersonExtension extends Extension implements PrependExtensionInterface
{
/**
* @throws Exception
* @throws \Exception
*/
public function load(array $configs, ContainerBuilder $container)
{
@@ -73,7 +70,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
// register all configuration in a unique parameter
$container->setParameter('chill_person', $config);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../config'));
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
$loader->load('services.yaml');
$loader->load('services/widgets.yaml');
$loader->load('services/fixtures.yaml');
@@ -97,7 +94,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
$loader->load('services/exports_person.yaml');
if ($container->getParameter('chill_person.accompanying_period') !== 'hidden') {
if ('hidden' !== $container->getParameter('chill_person.accompanying_period')) {
$loader->load('services/exports_accompanying_course.yaml');
$loader->load('services/exports_social_actions.yaml');
$loader->load('services/exports_evaluation.yaml');
@@ -117,7 +114,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
$this->prependCruds($container);
$this->prependWorkflows($container);
//add person_fields parameter as global
// add person_fields parameter as global
$chillPersonConfig = $container->getExtensionConfig($this->getAlias());
$config = $this->processConfiguration(new Configuration(), $chillPersonConfig);
$twigConfig = [
@@ -135,7 +132,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
$this->declarePersonAsCustomizable($container);
//declare routes for person bundle
// declare routes for person bundle
$container->prependExtensionConfig('chill_main', [
'routing' => [
'resources' => [
@@ -918,7 +915,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
*/
protected function prependDoctrineDQL(ContainerBuilder $container)
{
//add DQL function to ORM (default entity_manager)
// add DQL function to ORM (default entity_manager)
$container->prependExtensionConfig('doctrine', [
'orm' => [
@@ -1026,7 +1023,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
'mark_inactive_long' => [
'from' => [
AccompanyingPeriod::STEP_CONFIRMED,
AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT
AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT,
],
'to' => AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG,
],
@@ -1035,7 +1032,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_LONG,
AccompanyingPeriod::STEP_CONFIRMED_INACTIVE_SHORT,
],
'to' => AccompanyingPeriod::STEP_CONFIRMED
'to' => AccompanyingPeriod::STEP_CONFIRMED,
],
'close' => [
'from' => [
@@ -1071,9 +1068,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
);
}
/**
* @param $config
*/
private function handleAccompanyingPeriodsFieldsParameters(ContainerBuilder $container, $config)
{
$container->setParameter('chill_person.accompanying_period_fields', $config);
@@ -1084,19 +1078,16 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
break;
default:
$container->setParameter('chill_person.accompanying_period_fields.' . $key, $value);
$container->setParameter('chill_person.accompanying_period_fields.'.$key, $value);
break;
}
}
}
/**
* @param $config
*/
private function handlePersonFieldsParameters(ContainerBuilder $container, $config)
{
if (array_key_exists('enabled', $config)) {
if (\array_key_exists('enabled', $config)) {
unset($config['enabled']);
}
@@ -1105,7 +1096,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
foreach ($config as $key => $value) {
match ($key) {
'accompanying_period' => $container->setParameter('chill_person.accompanying_period', $value),
default => $container->setParameter('chill_person.person_fields.' . $key, $value),
default => $container->setParameter('chill_person.person_fields.'.$key, $value),
};
}
}

View File

@@ -14,8 +14,6 @@ namespace Chill\PersonBundle\DependencyInjection\CompilerPass;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use function in_array;
/**
* Remove services which add AccompanyingPeriod to timeline if
* accompanying_periods are set to `hidden`.
@@ -25,7 +23,7 @@ class AccompanyingPeriodTimelineCompilerPass implements CompilerPassInterface
public function process(ContainerBuilder $container)
{
// remove services when accompanying period are hidden
if ($container->getParameter('chill_person.accompanying_period') !== 'hidden') {
if ('hidden' !== $container->getParameter('chill_person.accompanying_period')) {
return;
}
@@ -52,7 +50,7 @@ class AccompanyingPeriodTimelineCompilerPass implements CompilerPassInterface
$definition->removeMethodCall('addProvider');
if (false === in_array($arguments[1], $definitions, true)) {
if (false === \in_array($arguments[1], $definitions, true)) {
$definition->addMethodCall($method, $arguments);
}
}

View File

@@ -11,8 +11,6 @@ declare(strict_types=1);
namespace Chill\PersonBundle\DependencyInjection;
use DateInterval;
use Exception;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
@@ -24,8 +22,8 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
private string $validationBirthdateNotAfterInfos = 'The period before today during which'
. ' any birthdate is not allowed. The birthdate is expressed as ISO8601 : '
. 'https://en.wikipedia.org/wiki/ISO_8601#Durations';
.' any birthdate is not allowed. The birthdate is expressed as ISO8601 : '
.'https://en.wikipedia.org/wiki/ISO_8601#Durations';
public function getConfigTreeBuilder()
{
@@ -48,19 +46,19 @@ class Configuration implements ConfigurationInterface
->validate()
->ifTrue(static function ($period) {
try {
$interval = new DateInterval($period);
} catch (Exception) {
$interval = new \DateInterval($period);
} catch (\Exception) {
return true;
}
return false;
})
->thenInvalid('Invalid period for birthdate validation : "%s" '
. 'The parameter should match duration as defined by ISO8601 : '
. 'https://en.wikipedia.org/wiki/ISO_8601#Durations')
.'The parameter should match duration as defined by ISO8601 : '
.'https://en.wikipedia.org/wiki/ISO_8601#Durations')
->end() // birthdate_not_after, parent = children of validation
->end() // children for 'validation', parent = validation
->end() //validation, parent = children of root
->end() // validation, parent = children of root
->end() // children of root, parent = root
->booleanNode('create_person_allowed')
->defaultTrue()
@@ -107,7 +105,7 @@ class Configuration implements ConfigurationInterface
->end()
->end()
->end()
->end() //children for 'person_fields', parent = array 'person_fields'
->end() // children for 'person_fields', parent = array 'person_fields'
->end() // person_fields, parent = children of root
->arrayNode('accompanying_periods_fields')
->canBeDisabled()
@@ -122,7 +120,7 @@ class Configuration implements ConfigurationInterface
->append($this->addFieldNode('anonymous'))
->append($this->addFieldNode('emergency'))
->append($this->addFieldNode('confidential'))
->end() //children for 'accompanying_person_fields', parent = array 'person_fields'
->end() // children for 'accompanying_person_fields', parent = array 'person_fields'
->end() // paccompanying_person_fields, parent = children of root
->booleanNode('allow_multiple_simultaneous_accompanying_periods')
->info('Can we have more than one simultaneous accompanying period in the same time. Default false.')