Skip to content

Commit

Permalink
[TASK] Raise php-cs-fixer:^3.54.0 (#869)
Browse files Browse the repository at this point in the history
Fix trailing commas due to new cgl rules.

> composer req --dev friendsofphp/php-cs-fixer:^3.54.0
  • Loading branch information
s2b committed Apr 18, 2024
1 parent 392c7d5 commit 6364ff8
Show file tree
Hide file tree
Showing 86 changed files with 441 additions and 441 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -17,7 +17,7 @@
},
"require-dev": {
"ext-json": "*",
"friendsofphp/php-cs-fixer": "^3.52.1",
"friendsofphp/php-cs-fixer": "^3.54.0",
"phpstan/phpstan": "^1.10.14",
"phpstan/phpstan-phpunit": "^1.3.11",
"phpunit/phpunit": "^10.2.6"
Expand Down
4 changes: 2 additions & 2 deletions examples/example_conditions.php
Expand Up @@ -34,8 +34,8 @@
'nested' => [
'then' => 'Dotted variable TRUE',
'else' => 'Dotted variable FALSE',
'check' => true
]
'check' => true,
],
]);

// Assigning the template path and filename to be rendered. Doing this overrides
Expand Down
2 changes: 1 addition & 1 deletion examples/example_multiplepaths.php
Expand Up @@ -49,7 +49,7 @@
TemplatePaths::CONFIG_PARTIALROOTPATHS => [
__DIR__ . '/Resources/Private/Partials/',
__DIR__ . '/ResourceOverrides/Private/Partials/',
]
],
]);

$view->assign('foobar', 'This is foobar');
Expand Down
2 changes: 1 addition & 1 deletion examples/example_structures.php
Expand Up @@ -35,7 +35,7 @@
$view->assign('group', [
['property' => 'one'],
['property' => 'one'],
['property' => 'two']
['property' => 'two'],
]);

// Rendering the View: plain old rendering of single file, no bells and whistles.
Expand Down
6 changes: 3 additions & 3 deletions examples/example_variables.php
Expand Up @@ -33,7 +33,7 @@
'csv' => 'one,two',
'aStringWithNumbers' => '132 a string',
'anArray' => ['one', 'two'],
'typeNameInteger' => 'integer'
'typeNameInteger' => 'integer',
],
'foobar' => 'string foo',
// The variables we will use as dynamic part names:
Expand All @@ -48,14 +48,14 @@
// A numerically indexed array which we will access directly.
'numeric' => [
'foo',
'bar'
'bar',
],
$dynamic1 => 'Dynamic key in $array[$dynamic1]',
$dynamic2 => 'Dynamic key in $array[$dynamic2]',
],
'123numericprefix' => 'Numeric prefixed variable',
// A variable whose value refers to another variable name
'dynamicVariableName' => 'foobar'
'dynamicVariableName' => 'foobar',
]);

// Assigning the template path and filename to be rendered. Doing this overrides
Expand Down
2 changes: 1 addition & 1 deletion examples/src/CustomViewHelperResolver.php
Expand Up @@ -55,7 +55,7 @@ public function getArgumentDefinitionsForViewHelper(ViewHelperInterface $viewHel
'array', // our argument must now be an array
'This is our new description for the argument',
false, // argument is no longer mandatory
['foo' => 'bar'] // our argument has a new default value if argument is not provided
['foo' => 'bar'], // our argument has a new default value if argument is not provided
);
}
return $arguments;
Expand Down
6 changes: 3 additions & 3 deletions examples/src/Helper/ExampleHelper.php
Expand Up @@ -31,13 +31,13 @@ public function init(): TemplateView
// rendering the file located in `TemplatesB` because this folder was last
// and is checked first (think of these paths as prioritised fallbacks).
$paths->setTemplateRootPaths([
__DIR__ . '/../../Resources/Private/Templates/'
__DIR__ . '/../../Resources/Private/Templates/',
]);
$paths->setLayoutRootPaths([
__DIR__ . '/../../Resources/Private/Layouts/'
__DIR__ . '/../../Resources/Private/Layouts/',
]);
$paths->setPartialRootPaths([
__DIR__ . '/../../Resources/Private/Partials/'
__DIR__ . '/../../Resources/Private/Partials/',
]);

// Configure View's caching to use system temp dir (typically /tmp und unix) as caching directory.
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Cache/FluidCacheWarmupResult.php
Expand Up @@ -60,7 +60,7 @@ public function add(ParsedTemplateInterface $state, $templatePathAndFilename)
static::RESULT_COMPILABLE => $currentlyCompiled || $state->isCompilable(),
static::RESULT_COMPILED => $currentlyCompiled,
static::RESULT_HASLAYOUT => $state->hasLayout(),
static::RESULT_COMPILEDCLASS => $state->getIdentifier()
static::RESULT_COMPILEDCLASS => $state->getIdentifier(),
];
if ($state instanceof FailedCompilingState) {
$this->results[$templatePathAndFilename][static::RESULT_FAILURE] = $state->getFailureReason();
Expand Down
34 changes: 17 additions & 17 deletions src/Core/Cache/StandardCacheWarmer.php
Expand Up @@ -76,7 +76,7 @@ public function warm(RenderingContextInterface $renderingContext)
$result->merge(
$this->warmupTemplateRootPaths($renderingContext),
$this->warmupPartialRootPaths($renderingContext),
$this->warmupLayoutRootPaths($renderingContext)
$this->warmupLayoutRootPaths($renderingContext),
);
return $result;
}
Expand Down Expand Up @@ -121,9 +121,9 @@ protected function warmupTemplateRootPaths(RenderingContextInterface $renderingC
$templateFile,
$paths->getTemplateIdentifier(
$controllerName,
substr($templateFile, $pathCutoffPoint, $formatCutoffPoint)
substr($templateFile, $pathCutoffPoint, $formatCutoffPoint),
),
$renderingContext
$renderingContext,
);
$result->add($state, $templateFile);
}
Expand All @@ -135,9 +135,9 @@ protected function warmupTemplateRootPaths(RenderingContextInterface $renderingC
$templateFile,
$paths->getTemplateIdentifier(
'Default',
substr($templateFile, $pathCutoffPoint, $formatCutoffPoint)
substr($templateFile, $pathCutoffPoint, $formatCutoffPoint),
),
$renderingContext
$renderingContext,
);
$result->add($state, $templateFile);
}
Expand Down Expand Up @@ -174,7 +174,7 @@ protected function warmupPartialRootPaths(RenderingContextInterface $renderingCo
$state = $this->warmSingleFile(
$partialFile,
$paths->getPartialIdentifier(substr($partialFile, $pathCutoffPoint, $formatCutoffPoint)),
$renderingContext
$renderingContext,
);
$result->add($state, $partialFile);
}
Expand Down Expand Up @@ -211,7 +211,7 @@ protected function warmupLayoutRootPaths(RenderingContextInterface $renderingCon
$state = $this->warmSingleFile(
$layoutFile,
$paths->getLayoutIdentifier(substr($layoutFile, $pathCutoffPoint, $formatCutoffPoint)),
$renderingContext
$renderingContext,
);
$result->add($state, $layoutFile);
}
Expand Down Expand Up @@ -264,44 +264,44 @@ protected function warmSingleFile($templatePathAndFilename, $identifier, Renderi
try {
$parsedTemplate = $renderingContext->getTemplateParser()->getOrParseAndStoreTemplate(
$identifier,
$this->createClosure($templatePathAndFilename)
$this->createClosure($templatePathAndFilename),
);
} catch (StopCompilingException $error) {
$parsedTemplate->setFailureReason(sprintf('Compiling is intentionally disabled. Specific reason unknown. Message: "%s"', $error->getMessage()));
$parsedTemplate->setMitigations([
'Can be caused by specific ViewHelpers. If this is is not intentional: avoid ViewHelpers which disable caches.',
'If cache is intentionally disabled: consider using `f:cache.static` to cause otherwise uncompilable ViewHelpers\' output to be replaced with a static string in compiled templates.'
'If cache is intentionally disabled: consider using `f:cache.static` to cause otherwise uncompilable ViewHelpers\' output to be replaced with a static string in compiled templates.',
]);
} catch (ExpressionException $error) {
$parsedTemplate->setFailureReason(sprintf('ExpressionNode evaluation error: %s', $error->getMessage()));
$parsedTemplate->setMitigations([
'Emulate variables used in ExpressionNode using `f:cache.warmup` or assign in warming RenderingContext'
'Emulate variables used in ExpressionNode using `f:cache.warmup` or assign in warming RenderingContext',
]);
} catch (\TYPO3Fluid\Fluid\Core\Parser\Exception $error) {
$parsedTemplate->setFailureReason($error->getMessage());
$parsedTemplate->setMitigations([
'Fix possible syntax errors.',
'Check that all ViewHelpers are correctly referenced and namespaces loaded (note: namespaces may be added externally!)',
'Check that all ExpressionNode types used by the template are loaded (note: may depend on RenderingContext implementation!)',
'Emulate missing variables used in expressions by using `f:cache.warmup` around your template code.'
'Emulate missing variables used in expressions by using `f:cache.warmup` around your template code.',
]);
} catch (\TYPO3Fluid\Fluid\Core\ViewHelper\Exception $error) {
$parsedTemplate->setFailureReason(sprintf('ViewHelper threw Exception: %s', $error->getMessage()));
$parsedTemplate->setMitigations([
'Emulate missing variables using `f:cache.warmup` around failing ViewHelper.',
'Emulate globals / context required by ViewHelper.',
'Disable caching for template if ViewHelper depends on globals / context that cannot be emulated.'
'Disable caching for template if ViewHelper depends on globals / context that cannot be emulated.',
]);
} catch (\TYPO3Fluid\Fluid\Core\Exception $error) {
$parsedTemplate->setFailureReason(sprintf('Fluid engine error: %s', $error->getMessage()));
$parsedTemplate->setMitigations([
'Search online for additional information about specific error.'
'Search online for additional information about specific error.',
]);
} catch (Exception $error) {
$parsedTemplate->setFailureReason(sprintf('Fluid view error: %s', $error->getMessage()));
$parsedTemplate->setMitigations([
'Investigate reported error in View class for missing variable checks, missing configuration etc.',
'Consider using a different View class for rendering in warmup mode (a custom rendering context can provide it)'
'Consider using a different View class for rendering in warmup mode (a custom rendering context can provide it)',
]);
} catch (\RuntimeException $error) {
$parsedTemplate->setFailureReason(
Expand All @@ -310,11 +310,11 @@ protected function warmSingleFile($templatePathAndFilename, $identifier, Renderi
get_class($error),
$error->getFile(),
$error->getLine(),
$error->getMessage()
)
$error->getMessage(),
),
);
$parsedTemplate->setMitigations([
'There are no automated suggestions for mitigating this issue. An online search may yield more information.'
'There are no automated suggestions for mitigating this issue. An online search may yield more information.',
]);
}
return $parsedTemplate;
Expand Down
14 changes: 7 additions & 7 deletions src/Core/Compiler/TemplateCompiler.php
Expand Up @@ -192,7 +192,7 @@ public function store($identifier, ParsingState $parsingState)
// RootNode, we could just call $parsingState->getRootNode()->compile().
$this->convertSubNodes($parsingState->getRootNode()->getChildNodes()),
'render',
'Main Render function'
'Main Render function',
);

$storedLayoutName = $parsingState->getVariableContainer()->get('layoutName');
Expand All @@ -214,7 +214,7 @@ public function store($identifier, ParsingState $parsingState)
$this->generateCodeForLayoutName($storedLayoutName),
($parsingState->hasLayout() ? 'true' : 'false'),
var_export($this->renderingContext->getViewHelperResolver()->getNamespaces(), true),
$generatedRenderFunctions
$generatedRenderFunctions,
);
$this->renderingContext->getCache()->set($identifier, $templateCode);
return $templateCode;
Expand Down Expand Up @@ -250,7 +250,7 @@ protected function generateSectionCodeFromParsingState(ParsingState $parsingStat
// and call $node->convert($this) directly.
$this->convertSubNodes($sectionRootNode->getChildNodes()),
'section_' . sha1($sectionName),
'section ' . $sectionName
'section ' . $sectionName,
);
}
}
Expand Down Expand Up @@ -285,7 +285,7 @@ protected function generateCodeForSection(array $converted, string $methodName,
'}' . chr(10),
$comment,
$methodName,
$execution
$execution,
);
}
return sprintf(
Expand All @@ -299,7 +299,7 @@ protected function generateCodeForSection(array $converted, string $methodName,
$comment,
$methodName,
$initialization,
$execution
$execution,
);
}

Expand Down Expand Up @@ -354,7 +354,7 @@ private function convertSubNodes(array $nodes): array
case 0:
return [
'initialization' => '',
'execution' => 'NULL'
'execution' => 'NULL',
];
case 1:
$childNode = current($nodes);
Expand All @@ -376,7 +376,7 @@ private function convertSubNodes(array $nodes): array
}
return [
'initialization' => $initializationPhpCode,
'execution' => $outputVariableName
'execution' => $outputVariableName,
];
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Compiler/ViewHelperCompiler.php
Expand Up @@ -93,8 +93,8 @@ public function compileWithCallToStaticMethod(ViewHelperInterface $viewHelper, $
$onClass,
$method,
$argumentsName,
$renderChildrenClosureName
)
$renderChildrenClosureName,
),
];
}
}
2 changes: 1 addition & 1 deletion src/Core/Parser/SyntaxTree/AbstractNode.php
Expand Up @@ -106,7 +106,7 @@ public function convert(TemplateCompiler $templateCompiler): array
{
return [
'initialization' => '// Uncompilable node type: ' . get_class($this) . chr(10),
'execution' => ''
'execution' => '',
];
}
}
8 changes: 4 additions & 4 deletions src/Core/Parser/SyntaxTree/ArrayNode.php
Expand Up @@ -54,29 +54,29 @@ public function convert(TemplateCompiler $templateCompiler): array
$initializationPhpCode .= sprintf(
'\'%s\' => %s,' . chr(10),
$key,
$converted['execution']
$converted['execution'],
);
} elseif (is_numeric($value)) {
// handle int, float, numeric strings
$initializationPhpCode .= sprintf(
'\'%s\' => %s,' . chr(10),
$key,
$value
$value,
);
} else {
// handle strings
$initializationPhpCode .= sprintf(
'\'%s\' => \'%s\',' . chr(10),
$key,
str_replace(['\\', '\''], ['\\\\', '\\\''], $value)
str_replace(['\\', '\''], ['\\\\', '\\\''], $value),
);
}
}
$initializationPhpCode .= '];' . chr(10);

return [
'initialization' => $accumulatedInitializationPhpCode . chr(10) . $initializationPhpCode,
'execution' => $arrayVariableName
'execution' => $arrayVariableName,
];
}
}
4 changes: 2 additions & 2 deletions src/Core/Parser/SyntaxTree/BooleanNode.php
Expand Up @@ -176,8 +176,8 @@ public function convert(TemplateCompiler $templateCompiler): array
BooleanNode::class,
$functionName,
BooleanNode::class,
$stack['execution']
)
$stack['execution'],
),
];
}
}
2 changes: 1 addition & 1 deletion src/Core/Parser/SyntaxTree/EscapingNode.php
Expand Up @@ -73,7 +73,7 @@ public function convert(TemplateCompiler $templateCompiler): array
'call_user_func_array( function ($var) { ' .
'return (is_string($var) || (is_object($var) && method_exists($var, \'__toString\')) ' .
'? htmlspecialchars((string) $var, ENT_QUOTES) : $var); }, [%s])',
$configuration['execution']
$configuration['execution'],
);
}
return $configuration;
Expand Down
Expand Up @@ -86,8 +86,8 @@ public function compile(TemplateCompiler $templateCompiler)
'\%s::evaluateExpression($renderingContext, %s, %s)',
$handlerClass,
$expressionVariable,
$matchesVariable
)
$matchesVariable,
),
];
}

Expand Down
Expand Up @@ -22,7 +22,7 @@ class CastingExpressionNode extends AbstractExpressionNode
* @var array
*/
protected static $validTypes = [
'integer', 'boolean', 'string', 'float', 'array', 'DateTime'
'integer', 'boolean', 'string', 'float', 'array', 'DateTime',
];

/**
Expand Down Expand Up @@ -61,8 +61,8 @@ public static function evaluateExpression(RenderingContextInterface $renderingCo
sprintf(
'Invalid target conversion type "%s" specified in casting expression "{%s}".',
$type,
$expression
)
$expression,
),
);
}
return self::convertStatic($variable, $type);
Expand Down

0 comments on commit 6364ff8

Please sign in to comment.