Skip to content

Commit 644db5c

Browse files
nicolas-grekasfabpot
authored andcommitted
Bump minimum version of PHP to 8.1
1 parent df3275e commit 644db5c

19 files changed

+51
-52
lines changed

Command/DebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ private function getLoaderPaths(string $name = null): array
294294
}
295295

296296
foreach ($namespaces as $namespace) {
297-
$paths = array_map([$this, 'getRelativePath'], $loader->getPaths($namespace));
297+
$paths = array_map($this->getRelativePath(...), $loader->getPaths($namespace));
298298

299299
if (FilesystemLoader::MAIN_NAMESPACE === $namespace) {
300300
$namespace = '(None)';

ErrorRenderer/TwigErrorRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(Environment $twig, HtmlErrorRenderer $fallbackErrorR
3636
{
3737
$this->twig = $twig;
3838
$this->fallbackErrorRenderer = $fallbackErrorRenderer ?? new HtmlErrorRenderer();
39-
$this->debug = !\is_callable($debug) || $debug instanceof \Closure ? $debug : \Closure::fromCallable($debug);
39+
$this->debug = \is_bool($debug) ? $debug : $debug(...);
4040
}
4141

4242
/**

Extension/AssetExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public function __construct(Packages $packages)
3535
public function getFunctions(): array
3636
{
3737
return [
38-
new TwigFunction('asset', [$this, 'getAssetUrl']),
39-
new TwigFunction('asset_version', [$this, 'getAssetVersion']),
38+
new TwigFunction('asset', $this->getAssetUrl(...)),
39+
new TwigFunction('asset_version', $this->getAssetVersion(...)),
4040
];
4141
}
4242

Extension/CodeExtension.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ public function __construct(string|FileLinkFormatter $fileLinkFormat, string $pr
3939
public function getFilters(): array
4040
{
4141
return [
42-
new TwigFilter('abbr_class', [$this, 'abbrClass'], ['is_safe' => ['html']]),
43-
new TwigFilter('abbr_method', [$this, 'abbrMethod'], ['is_safe' => ['html']]),
44-
new TwigFilter('format_args', [$this, 'formatArgs'], ['is_safe' => ['html']]),
45-
new TwigFilter('format_args_as_text', [$this, 'formatArgsAsText']),
46-
new TwigFilter('file_excerpt', [$this, 'fileExcerpt'], ['is_safe' => ['html']]),
47-
new TwigFilter('format_file', [$this, 'formatFile'], ['is_safe' => ['html']]),
48-
new TwigFilter('format_file_from_text', [$this, 'formatFileFromText'], ['is_safe' => ['html']]),
49-
new TwigFilter('format_log_message', [$this, 'formatLogMessage'], ['is_safe' => ['html']]),
50-
new TwigFilter('file_link', [$this, 'getFileLink']),
51-
new TwigFilter('file_relative', [$this, 'getFileRelative']),
42+
new TwigFilter('abbr_class', $this->abbrClass(...), ['is_safe' => ['html']]),
43+
new TwigFilter('abbr_method', $this->abbrMethod(...), ['is_safe' => ['html']]),
44+
new TwigFilter('format_args', $this->formatArgs(...), ['is_safe' => ['html']]),
45+
new TwigFilter('format_args_as_text', $this->formatArgsAsText(...)),
46+
new TwigFilter('file_excerpt', $this->fileExcerpt(...), ['is_safe' => ['html']]),
47+
new TwigFilter('format_file', $this->formatFile(...), ['is_safe' => ['html']]),
48+
new TwigFilter('format_file_from_text', $this->formatFileFromText(...), ['is_safe' => ['html']]),
49+
new TwigFilter('format_log_message', $this->formatLogMessage(...), ['is_safe' => ['html']]),
50+
new TwigFilter('file_link', $this->getFileLink(...)),
51+
new TwigFilter('file_relative', $this->getFileRelative(...)),
5252
];
5353
}
5454

Extension/DumpExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(ClonerInterface $cloner, HtmlDumper $dumper = null)
4141
public function getFunctions(): array
4242
{
4343
return [
44-
new TwigFunction('dump', [$this, 'dump'], ['is_safe' => ['html'], 'needs_context' => true, 'needs_environment' => true]),
44+
new TwigFunction('dump', $this->dump(...), ['is_safe' => ['html'], 'needs_context' => true, 'needs_environment' => true]),
4545
];
4646
}
4747

Extension/ExpressionExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class ExpressionExtension extends AbstractExtension
2828
public function getFunctions(): array
2929
{
3030
return [
31-
new TwigFunction('expression', [$this, 'createExpression']),
31+
new TwigFunction('expression', $this->createExpression(...)),
3232
];
3333
}
3434

Extension/FormExtension.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ public function getFunctions(): array
6868
new TwigFunction('form_end', null, ['node_class' => RenderBlockNode::class, 'is_safe' => ['html']]),
6969
new TwigFunction('csrf_token', [FormRenderer::class, 'renderCsrfToken']),
7070
new TwigFunction('form_parent', 'Symfony\Bridge\Twig\Extension\twig_get_form_parent'),
71-
new TwigFunction('field_name', [$this, 'getFieldName']),
72-
new TwigFunction('field_value', [$this, 'getFieldValue']),
73-
new TwigFunction('field_label', [$this, 'getFieldLabel']),
74-
new TwigFunction('field_help', [$this, 'getFieldHelp']),
75-
new TwigFunction('field_errors', [$this, 'getFieldErrors']),
76-
new TwigFunction('field_choices', [$this, 'getFieldChoices']),
71+
new TwigFunction('field_name', $this->getFieldName(...)),
72+
new TwigFunction('field_value', $this->getFieldValue(...)),
73+
new TwigFunction('field_label', $this->getFieldLabel(...)),
74+
new TwigFunction('field_help', $this->getFieldHelp(...)),
75+
new TwigFunction('field_errors', $this->getFieldErrors(...)),
76+
new TwigFunction('field_choices', $this->getFieldChoices(...)),
7777
];
7878
}
7979

Extension/HttpFoundationExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public function __construct(UrlHelper $urlHelper)
3636
public function getFunctions(): array
3737
{
3838
return [
39-
new TwigFunction('absolute_url', [$this, 'generateAbsoluteUrl']),
40-
new TwigFunction('relative_path', [$this, 'generateRelativePath']),
39+
new TwigFunction('absolute_url', $this->generateAbsoluteUrl(...)),
40+
new TwigFunction('relative_path', $this->generateRelativePath(...)),
4141
];
4242
}
4343

Extension/LogoutUrlExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public function __construct(LogoutUrlGenerator $generator)
3535
public function getFunctions(): array
3636
{
3737
return [
38-
new TwigFunction('logout_url', [$this, 'getLogoutUrl']),
39-
new TwigFunction('logout_path', [$this, 'getLogoutPath']),
38+
new TwigFunction('logout_url', $this->getLogoutUrl(...)),
39+
new TwigFunction('logout_path', $this->getLogoutPath(...)),
4040
];
4141
}
4242

Extension/RoutingExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public function __construct(UrlGeneratorInterface $generator)
3838
public function getFunctions(): array
3939
{
4040
return [
41-
new TwigFunction('url', [$this, 'getUrl'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]),
42-
new TwigFunction('path', [$this, 'getPath'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]),
41+
new TwigFunction('url', $this->getUrl(...), ['is_safe_callback' => $this->isUrlGenerationSafe(...)]),
42+
new TwigFunction('path', $this->getPath(...), ['is_safe_callback' => $this->isUrlGenerationSafe(...)]),
4343
];
4444
}
4545

0 commit comments

Comments
 (0)