apply rector rules: php up to php82

This commit is contained in:
2023-07-19 23:16:01 +02:00
parent 7b637d1287
commit 023a29cb78
744 changed files with 1369 additions and 1381 deletions

View File

@@ -46,7 +46,7 @@ class CSVCellTwig extends AbstractExtension
return [
new TwigFilter(
'csv_cell',
[$this, 'csvCellFilter'],
$this->csvCellFilter(...),
['is_safe' => ['html']]
),
];

View File

@@ -34,7 +34,7 @@ final class ChillMarkdownRenderExtension extends AbstractExtension
public function getFilters(): array
{
return [
new TwigFilter('chill_markdown_to_html', [$this, 'renderMarkdownToHtml'], [
new TwigFilter('chill_markdown_to_html', $this->renderMarkdownToHtml(...), [
'is_safe' => ['html'],
]),
];

View File

@@ -23,7 +23,7 @@ class ChillTwigHelper extends AbstractExtension
public function getFilters()
{
return [
new TwigFilter('chill_print_or_message', [$this, 'printOrMessage'], [
new TwigFilter('chill_print_or_message', $this->printOrMessage(...), [
'needs_environment' => true,
'is_safe' => ['html', 'html_attrs'],
]),

View File

@@ -46,16 +46,16 @@ class ChillTwigRoutingHelper extends AbstractExtension
public function getFilters()
{
return [
new TwigFilter('chill_return_path_label', [$this, 'getLabelReturnPath']),
new TwigFilter('chill_return_path_label', $this->getLabelReturnPath(...)),
];
}
public function getFunctions()
{
return [
new TwigFunction('chill_return_path_or', [$this, 'getReturnPathOr'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]),
new TwigFunction('chill_path_add_return_path', [$this, 'getPathAddReturnPath'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]),
new TwigFunction('chill_path_forward_return_path', [$this, 'getPathForwardReturnPath'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]),
new TwigFunction('chill_return_path_or', $this->getReturnPathOr(...), ['is_safe_callback' => $this->isUrlGenerationSafe(...)]),
new TwigFunction('chill_path_add_return_path', $this->getPathAddReturnPath(...), ['is_safe_callback' => $this->isUrlGenerationSafe(...)]),
new TwigFunction('chill_path_forward_return_path', $this->getPathForwardReturnPath(...), ['is_safe_callback' => $this->isUrlGenerationSafe(...)]),
];
}

View File

@@ -25,7 +25,7 @@ use function strtr;
*/
class AddressRender implements ChillEntityRenderInterface
{
public const DEFAULT_OPTIONS = [
final public const DEFAULT_OPTIONS = [
'with_valid_from' => false,
'with_valid_to' => false,
'with_picto' => false,
@@ -36,7 +36,7 @@ class AddressRender implements ChillEntityRenderInterface
'extended_infos' => false,
];
public function __construct(private EngineInterface $templating, private TranslatableStringHelperInterface $translatableStringHelper)
public function __construct(private readonly EngineInterface $templating, private readonly TranslatableStringHelperInterface $translatableStringHelper)
{
}

View File

@@ -44,10 +44,10 @@ class ChillEntityRenderExtension extends AbstractExtension
public function getFilters()
{
return [
new TwigFilter('chill_entity_render_string', [$this, 'renderString'], [
new TwigFilter('chill_entity_render_string', $this->renderString(...), [
'is_safe' => ['html'],
]),
new TwigFilter('chill_entity_render_box', [$this, 'renderBox'], [
new TwigFilter('chill_entity_render_box', $this->renderBox(...), [
'is_safe' => ['html'],
]),
];

View File

@@ -25,7 +25,7 @@ class CommentRender implements ChillEntityRenderInterface
{
use BoxUtilsChillEntityRenderTrait;
public function __construct(private UserRepositoryInterface $userRepository, private EngineInterface $engine)
public function __construct(private readonly UserRepositoryInterface $userRepository, private readonly EngineInterface $engine)
{
}

View File

@@ -24,13 +24,13 @@ use function array_merge;
*/
class UserRender implements ChillEntityRenderInterface
{
public const DEFAULT_OPTIONS = [
final public const DEFAULT_OPTIONS = [
'main_scope' => true,
'user_job' => true,
'absence' => true,
];
public function __construct(private TranslatableStringHelper $translatableStringHelper, private EngineInterface $engine, private TranslatorInterface $translator)
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly EngineInterface $engine, private readonly TranslatorInterface $translator)
{
}

View File

@@ -80,13 +80,13 @@ class DelegatedBlockRenderingEvent extends Event implements ArrayAccess
return $this->context[$offset];
}
public function offsetSet($offset, $value): void
public function offsetSet($offset, $value): never
{
throw new RuntimeException('The event context is read-only, you are not '
. 'allowed to update it.');
}
public function offsetUnset($offset): void
public function offsetUnset($offset): never
{
throw new RuntimeException('The event context is read-only, you are not '
. 'allowed to update it.');

View File

@@ -40,7 +40,7 @@ class FilterOrderHelperBuilder
*/
private array $userPickers = [];
public function __construct(private FormFactoryInterface $formFactory, private RequestStack $requestStack)
public function __construct(private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack)
{
}

View File

@@ -18,7 +18,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class FilterOrderHelperFactory implements FilterOrderHelperFactoryInterface
{
public function __construct(private FormFactoryInterface $formFactory, private RequestStack $requestStack)
public function __construct(private readonly FormFactoryInterface $formFactory, private readonly RequestStack $requestStack)
{
}

View File

@@ -31,7 +31,7 @@ class Templating extends AbstractExtension
public function getFilters(): array
{
return [
new TwigFilter('chill_render_filter_order_helper', [$this, 'renderFilterOrderHelper'], [
new TwigFilter('chill_render_filter_order_helper', $this->renderFilterOrderHelper(...), [
'needs_environment' => true, 'is_safe' => ['html'],
]),
];

View File

@@ -19,9 +19,9 @@ use function array_key_exists;
final class TranslatableStringHelper implements TranslatableStringHelperInterface
{
private string $defaultLocale;
private readonly string $defaultLocale;
public function __construct(private RequestStack $requestStack, private TranslatorInterface $translator, ParameterBagInterface $parameterBag)
public function __construct(private readonly RequestStack $requestStack, private readonly TranslatorInterface $translator, ParameterBagInterface $parameterBag)
{
$this->defaultLocale = $parameterBag->get('kernel.default_locale');
}

View File

@@ -22,7 +22,7 @@ class TranslatableStringTwig extends AbstractExtension
/**
* TranslatableStringTwig constructor.
*/
public function __construct(private TranslatableStringHelper $helper)
public function __construct(private readonly TranslatableStringHelper $helper)
{
}
@@ -38,7 +38,7 @@ class TranslatableStringTwig extends AbstractExtension
return [
new TwigFilter(
'localize_translatable_string',
[$this, 'localize']
$this->localize(...)
), ];
}

View File

@@ -92,7 +92,7 @@ class WidgetRenderingTwig extends AbstractExtension
return [
new TwigFunction(
'chill_delegated_block',
[$this, 'renderingWidget'],
$this->renderingWidget(...),
[
'is_safe' => ['html'],
'needs_environment' => true,
@@ -101,7 +101,7 @@ class WidgetRenderingTwig extends AbstractExtension
),
new TwigFunction(
'chill_widget',
[$this, 'renderingWidget'],
$this->renderingWidget(...),
['is_safe' => ['html'], 'needs_environment' => true]
),
];