Skip to content
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
3 changes: 1 addition & 2 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="2.1.0" installed="2.1.0" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="5.26.1" installed="5.26.1" location="./tools/psalm" copy="false"/>
<phar name="phpstan" version="2.1.17" installed="2.1.17" location="./tools/phpstan" copy="false"/>
</phive>
7 changes: 1 addition & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,8 @@
"cs-check": "phpcs --colors --parallel=16 -p src/ tests/",
"cs-fix": "phpcbf --colors --parallel=16 -p src/ tests/",
"phpstan": "tools/phpstan analyse",
"psalm": "tools/psalm --show-info=false",
"stan": [
"@phpstan",
"@psalm"
],
"stan": "@phpstan",
"phpstan-baseline": "tools/phpstan --generate-baseline",
"psalm-baseline": "tools/psalm --set-baseline=psalm-baseline.xml",
"stan-setup": "phive install",
"test": "phpunit"
},
Expand Down
25 changes: 0 additions & 25 deletions psalm.xml

This file was deleted.

2 changes: 1 addition & 1 deletion src/Command/CompileCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function execute(Arguments $args, ConsoleIo $io)
{
$type = $args->getArgumentAt(0);

/** @psalm-var class-string<\Cake\TwigView\View\TwigView> $viewClass */
/** @phpstan-var class-string<\Cake\TwigView\View\TwigView> $viewClass */
$viewClass = $args->getOption('view-class');

// Setup cached TwigView to avoid creating for every file
Expand Down
4 changes: 2 additions & 2 deletions src/Filesystem/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ protected static function setupIterator(string $path, array $extensions): Iterat
$path,
FilesystemIterator::KEY_AS_PATHNAME |
FilesystemIterator::CURRENT_AS_FILEINFO |
FilesystemIterator::SKIP_DOTS
FilesystemIterator::SKIP_DOTS,
),
RecursiveIteratorIterator::CHILD_FIRST,
RecursiveIteratorIterator::CATCH_GET_CHILD
RecursiveIteratorIterator::CATCH_GET_CHILD,
), '/.+' . $extPattern . '$/', RegexIterator::GET_MATCH);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Twig/Extension/TimeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function getFunctions(): array
public function formatDate(
mixed $date,
?string $format = null,
DateTimeZone|string|false|null $timezone = null
DateTimeZone|string|false|null $timezone = null,
): string {
if (!isset($this->coreExt)) {
$this->coreExt = new CoreExtension();
Expand Down
8 changes: 4 additions & 4 deletions src/Twig/Extension/ViewExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,28 @@ public function getFunctions(): array
function ($context, string $name, array $data = [], array $options = []) {
return $context['_view']->cell($name, $data, $options);
},
['needs_context' => true, 'is_safe' => ['all']]
['needs_context' => true, 'is_safe' => ['all']],
),
new TwigFunction(
'element',
function ($context, string $name, array $data = [], array $options = []) {
return $context['_view']->element($name, $data, $options);
},
['needs_context' => true, 'is_safe' => ['all']]
['needs_context' => true, 'is_safe' => ['all']],
),
new TwigFunction(
'fetch',
function ($context, string $name, string $default = '') {
return $context['_view']->fetch($name, $default);
},
['needs_context' => true, 'is_safe' => ['all']]
['needs_context' => true, 'is_safe' => ['all']],
),
new TwigFunction(
'helper_*_*',
function ($context, $helper, $method, array $args = []) {
return $context['_view']->{$helper}->{$method}(...$args);
},
['needs_context' => true, 'is_variadic' => true, 'is_safe' => ['all']]
['needs_context' => true, 'is_variadic' => true, 'is_safe' => ['all']],
),
];
}
Expand Down
4 changes: 2 additions & 2 deletions src/Twig/Node/Cell.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
?AbstractExpression $data = null,
?AbstractExpression $options = null,
int $lineno = 0,
?string $tag = null
?string $tag = null,
) {
if ($data === null) {
$data = new ArrayExpression([], $lineno);
Expand All @@ -76,7 +76,7 @@
'variable' => $variable,
],
$lineno,
$tag
$tag,

Check warning on line 79 in src/Twig/Node/Cell.php

View check run for this annotation

Codecov / codecov/patch

src/Twig/Node/Cell.php#L79

Added line #L79 was not covered by tests
);

$this->assign = $assign;
Expand Down
4 changes: 2 additions & 2 deletions src/Twig/Node/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
?AbstractExpression $data = null,
?AbstractExpression $options = null,
int $lineno = 0,
?string $tag = null
?string $tag = null,
) {
if ($data === null) {
$data = new ArrayExpression([], $lineno);
Expand All @@ -62,7 +62,7 @@
],
[],
$lineno,
$tag
$tag,

Check warning on line 65 in src/Twig/Node/Element.php

View check run for this annotation

Codecov / codecov/patch

src/Twig/Node/Element.php#L65

Added line #L65 was not covered by tests
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/View/TwigView.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ protected function _evaluate(string $templateFile, array $dataForView): string

$dataForView = array_merge(
$dataForView,
iterator_to_array($this->helpers()->getIterator())
iterator_to_array($this->helpers()->getIterator()),
);

return $this->getTwig()->load($templateFile)->render($dataForView);
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Twig/FileLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function testGetCacheKey()
{
$this->assertSame(
TEST_APP . 'templates/simple.twig',
$this->loader->getCacheKey(TEST_APP . 'templates/simple.twig')
$this->loader->getCacheKey(TEST_APP . 'templates/simple.twig'),
);
}

Expand Down