mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-30 20:16:45 +00:00
Fix CS
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
use PhpCsFixer\Config;
|
||||
use PhpCsFixer\Finder;
|
||||
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
|
||||
|
||||
return (new Config())
|
||||
->setRules([
|
||||
|
||||
@@ -154,8 +154,6 @@ class Environment
|
||||
|
||||
/**
|
||||
* Enables debugging mode.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enableDebug(): void
|
||||
{
|
||||
@@ -165,8 +163,6 @@ class Environment
|
||||
|
||||
/**
|
||||
* Disables debugging mode.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function disableDebug(): void
|
||||
{
|
||||
@@ -186,8 +182,6 @@ class Environment
|
||||
|
||||
/**
|
||||
* Enables the auto_reload option.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enableAutoReload(): void
|
||||
{
|
||||
@@ -196,8 +190,6 @@ class Environment
|
||||
|
||||
/**
|
||||
* Disables the auto_reload option.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function disableAutoReload(): void
|
||||
{
|
||||
@@ -216,8 +208,6 @@ class Environment
|
||||
|
||||
/**
|
||||
* Enables the strict_variables option.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enableStrictVariables(): void
|
||||
{
|
||||
@@ -227,8 +217,6 @@ class Environment
|
||||
|
||||
/**
|
||||
* Disables the strict_variables option.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function disableStrictVariables(): void
|
||||
{
|
||||
@@ -278,8 +266,6 @@ class Environment
|
||||
* @param CacheInterface|string|false $cache A Twig\Cache\CacheInterface implementation,
|
||||
* an absolute path to the compiled templates,
|
||||
* or false to disable cache
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCache($cache): void
|
||||
{
|
||||
@@ -516,9 +502,6 @@ class Environment
|
||||
throw new LoaderError(\sprintf('Unable to find one of the following templates: "%s".', implode('", "', $names)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setLexer(Lexer $lexer): void
|
||||
{
|
||||
$this->lexer = $lexer;
|
||||
@@ -536,9 +519,6 @@ class Environment
|
||||
return $this->lexer->tokenize($source);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setParser(Parser $parser): void
|
||||
{
|
||||
$this->parser = $parser;
|
||||
@@ -558,9 +538,6 @@ class Environment
|
||||
return $this->parser->parse($stream);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setCompiler(Compiler $compiler): void
|
||||
{
|
||||
$this->compiler = $compiler;
|
||||
@@ -595,9 +572,6 @@ class Environment
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setLoader(LoaderInterface $loader): void
|
||||
{
|
||||
$this->loader = $loader;
|
||||
@@ -608,9 +582,6 @@ class Environment
|
||||
return $this->loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setCharset(string $charset): void
|
||||
{
|
||||
if ('UTF8' === $charset = strtoupper($charset ?: '')) {
|
||||
@@ -631,9 +602,6 @@ class Environment
|
||||
return $this->extensionSet->hasExtension($class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function addRuntimeLoader(RuntimeLoaderInterface $loader): void
|
||||
{
|
||||
$this->runtimeLoaders[] = $loader;
|
||||
@@ -681,9 +649,6 @@ class Environment
|
||||
throw new RuntimeError(\sprintf('Unable to load the "%s" runtime.', $class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function addExtension(ExtensionInterface $extension): void
|
||||
{
|
||||
$this->extensionSet->addExtension($extension);
|
||||
@@ -692,8 +657,6 @@ class Environment
|
||||
|
||||
/**
|
||||
* @param ExtensionInterface[] $extensions An array of extensions
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setExtensions(array $extensions): void
|
||||
{
|
||||
@@ -709,9 +672,6 @@ class Environment
|
||||
return $this->extensionSet->getExtensions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function addTokenParser(TokenParserInterface $parser): void
|
||||
{
|
||||
$this->extensionSet->addTokenParser($parser);
|
||||
@@ -743,9 +703,6 @@ class Environment
|
||||
$this->extensionSet->registerUndefinedTokenParserCallback($callable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function addNodeVisitor(NodeVisitorInterface $visitor): void
|
||||
{
|
||||
$this->extensionSet->addNodeVisitor($visitor);
|
||||
@@ -761,9 +718,6 @@ class Environment
|
||||
return $this->extensionSet->getNodeVisitors();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function addFilter(TwigFilter $filter): void
|
||||
{
|
||||
$this->extensionSet->addFilter($filter);
|
||||
@@ -801,9 +755,6 @@ class Environment
|
||||
return $this->extensionSet->getFilters();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function addTest(TwigTest $test): void
|
||||
{
|
||||
$this->extensionSet->addTest($test);
|
||||
@@ -835,9 +786,6 @@ class Environment
|
||||
$this->extensionSet->registerUndefinedTestCallback($callable);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function addFunction(TwigFunction $function): void
|
||||
{
|
||||
$this->extensionSet->addFunction($function);
|
||||
@@ -882,8 +830,6 @@ class Environment
|
||||
* but after, you can only update existing globals.
|
||||
*
|
||||
* @param mixed $value The global value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addGlobal(string $name, $value): void
|
||||
{
|
||||
|
||||
@@ -74,9 +74,6 @@ final class ExtensionSet
|
||||
$this->staging = new StagingExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function initRuntime(): void
|
||||
{
|
||||
$this->runtimeInitialized = true;
|
||||
|
||||
@@ -20,9 +20,6 @@ use Twig\Compiler;
|
||||
#[YieldReady]
|
||||
class CheckSecurityCallNode extends Node
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function compile(Compiler $compiler): void
|
||||
{
|
||||
$compiler
|
||||
|
||||
@@ -26,9 +26,6 @@ abstract class CallExpression extends AbstractExpression
|
||||
{
|
||||
private $reflector;
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function compileCallable(Compiler $compiler): void
|
||||
{
|
||||
$twigCallable = $this->getTwigCallable();
|
||||
|
||||
@@ -55,9 +55,6 @@ class FunctionExpression extends CallExpression implements SupportDefinedTestInt
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function compile(Compiler $compiler): void
|
||||
{
|
||||
$name = $this->getAttribute('name');
|
||||
|
||||
@@ -79,9 +79,6 @@ class IncludeNode extends Node implements NodeOutputInterface, CoercesChildrenTo
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function addGetTemplate(Compiler $compiler/* , string $template = '' */): void
|
||||
{
|
||||
$compiler
|
||||
@@ -93,9 +90,6 @@ class IncludeNode extends Node implements NodeOutputInterface, CoercesChildrenTo
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function addTemplateArguments(Compiler $compiler): void
|
||||
{
|
||||
if (!$this->hasNode('variables')) {
|
||||
|
||||
@@ -73,9 +73,6 @@ final class ModuleNode extends Node implements CoercesChildrenToStringInterface
|
||||
$this->setSourceContext($source);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setIndex($index): void
|
||||
{
|
||||
$this->setAttribute('index', $index);
|
||||
@@ -96,9 +93,6 @@ final class ModuleNode extends Node implements CoercesChildrenToStringInterface
|
||||
return $this->hasNode('parent') ? ['parent'] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function compileTemplate(Compiler $compiler): void
|
||||
{
|
||||
if (!$this->getAttribute('index')) {
|
||||
@@ -128,9 +122,6 @@ final class ModuleNode extends Node implements CoercesChildrenToStringInterface
|
||||
$this->compileClassFooter($compiler);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function compileGetParent(Compiler $compiler): void
|
||||
{
|
||||
if (!$this->hasNode('parent')) {
|
||||
@@ -164,9 +155,6 @@ final class ModuleNode extends Node implements CoercesChildrenToStringInterface
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function compileClassHeader(Compiler $compiler): void
|
||||
{
|
||||
$compiler
|
||||
@@ -206,9 +194,6 @@ final class ModuleNode extends Node implements CoercesChildrenToStringInterface
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function compileConstructor(Compiler $compiler): void
|
||||
{
|
||||
$compiler
|
||||
@@ -346,9 +331,6 @@ final class ModuleNode extends Node implements CoercesChildrenToStringInterface
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function compileDisplay(Compiler $compiler): void
|
||||
{
|
||||
$compiler
|
||||
@@ -394,9 +376,6 @@ final class ModuleNode extends Node implements CoercesChildrenToStringInterface
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function compileClassFooter(Compiler $compiler): void
|
||||
{
|
||||
$compiler
|
||||
@@ -406,17 +385,11 @@ final class ModuleNode extends Node implements CoercesChildrenToStringInterface
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function compileMacros(Compiler $compiler): void
|
||||
{
|
||||
$compiler->subcompile($this->getNode('macros'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function compileGetTemplateName(Compiler $compiler): void
|
||||
{
|
||||
$compiler
|
||||
@@ -433,9 +406,6 @@ final class ModuleNode extends Node implements CoercesChildrenToStringInterface
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function compileIsTraitable(Compiler $compiler): void
|
||||
{
|
||||
// A template can be used as a trait if:
|
||||
@@ -483,9 +453,6 @@ final class ModuleNode extends Node implements CoercesChildrenToStringInterface
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function compileDebugInfo(Compiler $compiler): void
|
||||
{
|
||||
$compiler
|
||||
@@ -500,9 +467,6 @@ final class ModuleNode extends Node implements CoercesChildrenToStringInterface
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function compileGetSourceContext(Compiler $compiler): void
|
||||
{
|
||||
$compiler
|
||||
|
||||
@@ -112,9 +112,6 @@ class Node implements \Countable, \IteratorAggregate
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function compile(Compiler $compiler): void
|
||||
{
|
||||
foreach ($this->nodes as $node) {
|
||||
|
||||
@@ -30,9 +30,6 @@ class TypesNode extends Node
|
||||
parent::__construct([], ['mapping' => $types], $lineno);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function compile(Compiler $compiler): void
|
||||
{
|
||||
// Don't compile anything.
|
||||
|
||||
@@ -318,9 +318,6 @@ class Parser
|
||||
return \count($this->traits) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function embedTemplate(ModuleNode $template): void
|
||||
{
|
||||
$template->setIndex(++$this->lastEmbedIndex);
|
||||
|
||||
@@ -36,8 +36,6 @@ final class EscaperRuntime implements RuntimeExtensionInterface
|
||||
*
|
||||
* @param string $strategy The strategy name that should be used as a strategy in the escape call
|
||||
* @param callable(string $string, string $charset): string $callable A valid PHP callable
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setEscaper($strategy, callable $callable): void
|
||||
{
|
||||
@@ -56,8 +54,6 @@ final class EscaperRuntime implements RuntimeExtensionInterface
|
||||
|
||||
/**
|
||||
* @param array<class-string<\Stringable>, string[]> $safeClasses
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSafeClasses(array $safeClasses = []): void
|
||||
{
|
||||
@@ -71,8 +67,6 @@ final class EscaperRuntime implements RuntimeExtensionInterface
|
||||
/**
|
||||
* @param class-string<\Stringable> $class
|
||||
* @param string[] $strategies
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addSafeClass(string $class, array $strategies): void
|
||||
{
|
||||
|
||||
@@ -51,9 +51,6 @@ final class TemplateWrapper
|
||||
return $this->template->render($context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function display(array $context = []): void
|
||||
{
|
||||
// using func_get_args() allows to not expose the blocks argument
|
||||
@@ -79,9 +76,6 @@ final class TemplateWrapper
|
||||
return $this->template->renderBlock($name, $context + $this->env->getGlobals());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function displayBlock(string $name, array $context = []): void
|
||||
{
|
||||
$context += $this->env->getGlobals();
|
||||
|
||||
@@ -123,8 +123,6 @@ abstract class IntegrationTestCase extends TestCase
|
||||
* The annotation feeds PHPUnit < 10; the attribute feeds PHPUnit >= 10 and must point to a static provider, as PHPUnit >= 11 rejects non-static ones.
|
||||
*
|
||||
* @dataProvider getTests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[DataProvider('provideTests')]
|
||||
public function testIntegration($file, $message, $condition, $templates, $exception, $outputs, $deprecation = ''): void
|
||||
@@ -136,8 +134,6 @@ abstract class IntegrationTestCase extends TestCase
|
||||
* @dataProvider getLegacyTests
|
||||
*
|
||||
* @group legacy
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[DataProvider('provideLegacyTests'), Group('legacy')]
|
||||
public function testLegacyIntegration($file, $message, $condition, $templates, $exception, $outputs, $deprecation = ''): void
|
||||
@@ -227,9 +223,6 @@ abstract class IntegrationTestCase extends TestCase
|
||||
return $this->getTests('testLegacyIntegration', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function doIntegrationTest($file, $message, $condition, $templateSources, $exception, $outputs, $deprecation = ''): void
|
||||
{
|
||||
if (!$outputs) {
|
||||
|
||||
@@ -49,8 +49,6 @@ abstract class NodeTestCase extends TestCase
|
||||
*
|
||||
* @dataProvider getTests
|
||||
* @dataProvider provideTests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[DataProvider('provideTests')]
|
||||
public function testCompile($node, $source, $environment = null, $isPattern = false): void
|
||||
@@ -58,9 +56,6 @@ abstract class NodeTestCase extends TestCase
|
||||
$this->assertNodeCompilation($source, $node, $environment, $isPattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function assertNodeCompilation($source, Node $node, ?Environment $environment = null, $isPattern = false): void
|
||||
{
|
||||
$compiler = $this->getCompiler($environment);
|
||||
|
||||
@@ -39,9 +39,6 @@ final class TokenStream
|
||||
return implode("\n", $this->tokens);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function injectTokens(array $tokens): void
|
||||
{
|
||||
$this->tokens = array_merge(\array_slice($this->tokens, 0, $this->current), $tokens, \array_slice($this->tokens, $this->current));
|
||||
|
||||
Reference in New Issue
Block a user