Upgrade php to v8.3 with rector

This commit is contained in:
2024-08-13 15:26:27 +02:00
parent 547a9d1369
commit f3ac864233
1806 changed files with 6843 additions and 568 deletions

View File

@@ -21,6 +21,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
class BirthdateFilter implements ExportElementValidatedInterface, FilterInterface
{
// add specific role for this filter
#[\Override]
public function addRole(): ?string
{
// we do not need any new role for this filter, so we return null
@@ -28,6 +29,7 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac
}
// here, we alter the query created by Export
#[\Override]
public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data)
{
$where = $qb->getDQLPart('where');
@@ -52,12 +54,14 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac
}
// we give information on which type of export this filter applies
#[\Override]
public function applyOn()
{
return 'person';
}
// we build a form to collect some parameters from the users
#[\Override]
public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder)
{
$builder->add('date_from', DateType::class, [
@@ -74,6 +78,7 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac
'format' => 'dd-MM-yyyy',
]);
}
#[\Override]
public function getFormDefaultData(): array
{
return ['date_from' => new DateTime(), 'date_to' => new DateTime()];
@@ -81,6 +86,7 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac
// here, we create a simple string which will describe the action of
// the filter in the Response
#[\Override]
public function describeAction($data, $format = 'string')
{
return ['Filtered by person\'s birtdate: '
@@ -90,6 +96,7 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac
], ];
}
#[\Override]
public function getTitle()
{
return 'Filter by person\'s birthdate';
@@ -99,6 +106,7 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac
// is executed here. This function is added by the interface
// `ExportElementValidatedInterface`, and can be ignore if there is
// no need for a validation
#[\Override]
public function validateForm($data, ExecutionContextInterface $context)
{
$date_from = $data['date_from'];

View File

@@ -32,25 +32,30 @@ class CountPerson implements ExportInterface
$this->entityManager = $em;
}
#[\Override]
public function buildForm(FormBuilderInterface $builder)
{
// this export does not add any form
}
#[\Override]
public function getFormDefaultData(): array
{
return [];
}
#[\Override]
public function getAllowedFormattersTypes()
{
return [FormatterInterface::TYPE_TABULAR];
}
#[\Override]
public function getDescription()
{
return 'Count peoples by various parameters.';
}
#[\Override]
public function getLabels($key, array $values, $data)
{
// the Closure which will be executed by the formatter.
@@ -60,6 +65,7 @@ class CountPerson implements ExportInterface
};
}
#[\Override]
public function getQueryKeys($data)
{
// this array match the result keys in the query. We have only
@@ -67,21 +73,25 @@ class CountPerson implements ExportInterface
return ['export_result'];
}
#[\Override]
public function getResult($query, $data)
{
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
}
#[\Override]
public function getTitle()
{
return 'Count peoples';
}
#[\Override]
public function getType()
{
return Declarations::PERSON_TYPE;
}
#[\Override]
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
// we gather all center the user choose.
@@ -98,11 +108,13 @@ class CountPerson implements ExportInterface
return $qb;
}
#[\Override]
public function requiredRole(): string
{
return PersonVoter::STATS;
}
#[\Override]
public function supportsModifiers()
{
// explain the export manager which formatters and filters are allowed

View File

@@ -31,6 +31,7 @@ class ChillMainConfiguration implements ConfigurationInterface
$this->setWidgetFactories($widgetFactories);
}
#[\Override]
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_main');

View File

@@ -27,11 +27,13 @@ class ChillMainExtension extends Extension implements Widget\HasWidgetFactoriesE
*/
protected $widgetFactories = [];
#[\Override]
public function addWidgetFactory(WidgetFactoryInterface $factory)
{
$this->widgetFactories[] = $factory;
}
#[\Override]
public function getConfiguration(array $config, ContainerBuilder $container)
{
return new Configuration($this->widgetFactories, $container);
@@ -40,11 +42,13 @@ class ChillMainExtension extends Extension implements Widget\HasWidgetFactoriesE
/**
* @return WidgetFactoryInterface[]
*/
#[\Override]
public function getWidgetFactories()
{
return $this->widgetFactories;
}
#[\Override]
public function load(array $configs, ContainerBuilder $container)
{
// configuration for main bundle

View File

@@ -25,6 +25,7 @@ class ChillPersonAddAPersonListWidgetFactory extends AbstractWidgetFactory
* see http://symfony.com/doc/current/components/config/definition.html
*
*/
#[\Override]
public function configureOptions($place, NodeBuilder $node)
{
$node->booleanNode('only_active')
@@ -56,6 +57,7 @@ class ChillPersonAddAPersonListWidgetFactory extends AbstractWidgetFactory
* the service must exists in the container, and it is not required that the service
* has the `chill_main` tag.
*/
#[\Override]
public function getServiceId(ContainerBuilder $containerBuilder, $place, $order, array $config)
{
return 'chill_person.widget.person_list';
@@ -66,6 +68,7 @@ class ChillPersonAddAPersonListWidgetFactory extends AbstractWidgetFactory
*
* @return string
*/
#[\Override]
public function getWidgetAlias()
{
return 'person_list';

View File

@@ -79,6 +79,7 @@ class ChillPersonAddAPersonWidget implements WidgetInterface
*
* @return string
*/
#[\Override]
public function render(Twig_Environment $env, $place, array $context, array $config)
{
$qb = $this->personRepository

View File

@@ -22,6 +22,7 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
*/
class ChillPersonExtension extends Extension implements PrependExtensionInterface
{
#[\Override]
public function load(array $configs, ContainerBuilder $container)
{
// ...
@@ -32,6 +33,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
*
* @param \Chill\PersonBundle\DependencyInjection\containerBuilder $container
*/
#[\Override]
public function prepend(ContainerBuilder $container)
{
$container->prependExtensionConfig('chill_main', [