From 0b8e267bce22ba028dbae209d8ec8a5419f878b1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 12 Jul 2026 15:21:02 +0200 Subject: [PATCH] Fix CS --- .php-cs-fixer.dist.php | 1 - src/Environment.php | 54 ---------------------- src/ExtensionSet.php | 3 -- src/Node/CheckSecurityCallNode.php | 3 -- src/Node/Expression/CallExpression.php | 3 -- src/Node/Expression/FunctionExpression.php | 3 -- src/Node/IncludeNode.php | 6 --- src/Node/ModuleNode.php | 36 --------------- src/Node/Node.php | 3 -- src/Node/TypesNode.php | 3 -- src/Parser.php | 3 -- src/Runtime/EscaperRuntime.php | 6 --- src/TemplateWrapper.php | 6 --- src/Test/IntegrationTestCase.php | 7 --- src/Test/NodeTestCase.php | 5 -- src/TokenStream.php | 3 -- 16 files changed, 145 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index caae17b96..2622f4406 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -2,7 +2,6 @@ use PhpCsFixer\Config; use PhpCsFixer\Finder; -use PhpCsFixer\Runner\Parallel\ParallelConfigFactory; return (new Config()) ->setRules([ diff --git a/src/Environment.php b/src/Environment.php index 2d75b0b0a..6710f60aa 100644 --- a/src/Environment.php +++ b/src/Environment.php @@ -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 { diff --git a/src/ExtensionSet.php b/src/ExtensionSet.php index aa5568986..450093466 100644 --- a/src/ExtensionSet.php +++ b/src/ExtensionSet.php @@ -74,9 +74,6 @@ final class ExtensionSet $this->staging = new StagingExtension(); } - /** - * @return void - */ public function initRuntime(): void { $this->runtimeInitialized = true; diff --git a/src/Node/CheckSecurityCallNode.php b/src/Node/CheckSecurityCallNode.php index 978e54ca3..5a2f4b6fd 100644 --- a/src/Node/CheckSecurityCallNode.php +++ b/src/Node/CheckSecurityCallNode.php @@ -20,9 +20,6 @@ use Twig\Compiler; #[YieldReady] class CheckSecurityCallNode extends Node { - /** - * @return void - */ public function compile(Compiler $compiler): void { $compiler diff --git a/src/Node/Expression/CallExpression.php b/src/Node/Expression/CallExpression.php index fdebb6ec3..1b92e9b6c 100644 --- a/src/Node/Expression/CallExpression.php +++ b/src/Node/Expression/CallExpression.php @@ -26,9 +26,6 @@ abstract class CallExpression extends AbstractExpression { private $reflector; - /** - * @return void - */ protected function compileCallable(Compiler $compiler): void { $twigCallable = $this->getTwigCallable(); diff --git a/src/Node/Expression/FunctionExpression.php b/src/Node/Expression/FunctionExpression.php index 179dd2070..6fd555f4b 100644 --- a/src/Node/Expression/FunctionExpression.php +++ b/src/Node/Expression/FunctionExpression.php @@ -55,9 +55,6 @@ class FunctionExpression extends CallExpression implements SupportDefinedTestInt } } - /** - * @return void - */ public function compile(Compiler $compiler): void { $name = $this->getAttribute('name'); diff --git a/src/Node/IncludeNode.php b/src/Node/IncludeNode.php index 6e46e481e..9d4fe664b 100644 --- a/src/Node/IncludeNode.php +++ b/src/Node/IncludeNode.php @@ -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')) { diff --git a/src/Node/ModuleNode.php b/src/Node/ModuleNode.php index 13d81c8cd..b06ece802 100644 --- a/src/Node/ModuleNode.php +++ b/src/Node/ModuleNode.php @@ -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 diff --git a/src/Node/Node.php b/src/Node/Node.php index 574067475..c36161eaf 100644 --- a/src/Node/Node.php +++ b/src/Node/Node.php @@ -112,9 +112,6 @@ class Node implements \Countable, \IteratorAggregate } } - /** - * @return void - */ public function compile(Compiler $compiler): void { foreach ($this->nodes as $node) { diff --git a/src/Node/TypesNode.php b/src/Node/TypesNode.php index f933b923d..a5dfacb5f 100644 --- a/src/Node/TypesNode.php +++ b/src/Node/TypesNode.php @@ -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. diff --git a/src/Parser.php b/src/Parser.php index 7d5b223ab..c82a422df 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -318,9 +318,6 @@ class Parser return \count($this->traits) > 0; } - /** - * @return void - */ public function embedTemplate(ModuleNode $template): void { $template->setIndex(++$this->lastEmbedIndex); diff --git a/src/Runtime/EscaperRuntime.php b/src/Runtime/EscaperRuntime.php index 57f116680..67bf75a15 100644 --- a/src/Runtime/EscaperRuntime.php +++ b/src/Runtime/EscaperRuntime.php @@ -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, 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 { diff --git a/src/TemplateWrapper.php b/src/TemplateWrapper.php index e0ce7a51d..afadc2b53 100644 --- a/src/TemplateWrapper.php +++ b/src/TemplateWrapper.php @@ -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(); diff --git a/src/Test/IntegrationTestCase.php b/src/Test/IntegrationTestCase.php index c66f4783e..fe3184f5a 100644 --- a/src/Test/IntegrationTestCase.php +++ b/src/Test/IntegrationTestCase.php @@ -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) { diff --git a/src/Test/NodeTestCase.php b/src/Test/NodeTestCase.php index 39dd3b1ec..5e60efcfb 100644 --- a/src/Test/NodeTestCase.php +++ b/src/Test/NodeTestCase.php @@ -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); diff --git a/src/TokenStream.php b/src/TokenStream.php index d9804e320..1385ffb89 100644 --- a/src/TokenStream.php +++ b/src/TokenStream.php @@ -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));