Skip to content

Fix nullable php8.4, remove old spaceless function #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Builder/BuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function getDefaultTemplateName(): string;
*
* @return string The short classname.
*/
function getSimpleClassName(string $class = null): string;
function getSimpleClassName(?string $class = null): string;

function setOutputName(string $outputName): void;

Expand Down
2 changes: 1 addition & 1 deletion src/Builder/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Generator
*
* @param string|null $baseTempDir Existing base directory for temporary template files
*/
public function __construct(string $baseTempDir = null)
public function __construct(?string $baseTempDir = null)
{
if (null === $baseTempDir) {
$baseTempDir = sys_get_temp_dir();
Expand Down
20 changes: 1 addition & 19 deletions src/Extension/TwigPrintExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public function getFunctions(): array
'echo_endfor' => new TwigFunction('echo_endfor' , $this->getEchoEndFor(...), $options),
'echo_raw' => new TwigFunction('echo_raw' , $this->getEchoRaw(...), $options),
'echo_endraw' => new TwigFunction('echo_endraw' , $this->getEchoEndRaw(...), $options),
'echo_spaceless' => new TwigFunction('echo_spaceless' , $this->getEchoSpaceless(...), $options),
'echo_endspaceless' => new TwigFunction('echo_endspaceless', $this->getEchoEndSpaceless(...), $options),
'echo_extends' => new TwigFunction('echo_extends' , $this->getEchoExtends(...), $options),
'echo_if' => new TwigFunction('echo_if' , $this->getEchoIf(...), $options),
'echo_else' => new TwigFunction('echo_else' , $this->getEchoElse(...), $options),
Expand Down Expand Up @@ -188,7 +186,7 @@ public function getEchoExtends(string $name): string
* {{ echo_for('item', 'myListObject', 'key') }}
* => {% for key,item in myListObject %}
*/
public function getEchoFor(string $object, string $in, string $key = null): string
public function getEchoFor(string $object, string $in, ?string $key = null): string
{
return strtr(
'{% for %%key%%%%object%% in %%in%% %}',
Expand Down Expand Up @@ -223,22 +221,6 @@ public function getEchoEndRaw(): string
return '{% endraw %}';
}

/**
* Print "spaceless" tag
*/
public function getEchoSpaceless(): string
{
return '{% apply spaceless %}';
}

/**
* Print "endspaceless" tag
*/
public function getEchoEndSpaceless(): string
{
return '{% endapply %}';
}

/**
* Converts an array to a twig array expression (string).
* Only in case a value contains '{{' and '}}' the value won't be
Expand Down