From d0377b9e6d6406ba771e9685f814710ed4c9a9e7 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sun, 21 Jan 2024 10:52:13 +0100 Subject: [PATCH] TASK: Migrate Neos.Fusion/Core to phpstan level 8 (Neos 8.3) Only files in `Neos.Fusion/Classes/Core` have been migrated, as they contain relatively new code like the parser. Two kind of errors have been partially ignored from the level 8 For one: "no value type specified in iterable type array" as adding `array` would just bloat this commit up. In these files we are mostly dealing with the fusion configuration which is highly dynamic: - Neos.Fusion/Classes/Core/Runtime.php - Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php - Neos.Fusion/Classes/Core/Cache/ContentCache.php - Neos.Fusion/Classes/Core/Cache/CacheSegmentParser.php - Neos.Fusion/Classes/Core/RuntimeConfiguration.php - Neos.Fusion/Classes/Core/ObjectTreeParser/MergedArrayTreeVisitor.php - Neos.Fusion/Classes/Core/ObjectTreeParser/MergedArrayTree.php And "has no return type specified" was noticed a lot in the ast visiting code. But i plan to refactor this instead to something better type able: - Neos.Fusion/Classes/Core/ObjectTreeParser/MergedArrayTreeVisitor.php - Neos.Fusion/Classes/Core/ObjectTreeParser/AstNodeVisitorInterface.php - Neos.Fusion/Classes/Core/ObjectTreeParser/Ast --- .../Classes/Core/Cache/CacheSegmentParser.php | 5 +-- .../Classes/Core/Cache/ContentCache.php | 5 +-- .../Core/Cache/FileMonitorListener.php | 4 +-- .../Classes/Core/Cache/ParserCache.php | 3 ++ .../Classes/Core/Cache/ParserCacheFlusher.php | 4 +-- .../Core/Cache/RuntimeContentCache.php | 2 +- Neos.Fusion/Classes/Core/DslFactory.php | 4 +-- .../ExceptionHandlers/AbsorbingHandler.php | 2 +- .../AbstractRenderingExceptionHandler.php | 3 +- .../ExceptionHandlers/BubblingHandler.php | 7 ++-- .../ContextDependentHandler.php | 4 +-- .../ExceptionHandlers/HtmlMessageHandler.php | 8 ++--- .../ExceptionHandlers/ThrowingHandler.php | 4 +-- .../ExceptionHandlers/XmlCommentHandler.php | 4 +-- .../Classes/Core/FusionConfiguration.php | 19 ++++++++--- .../Core/FusionSourceCodeCollection.php | 9 ++++-- .../ObjectTreeParser/Ast/AbstractNode.php | 2 +- .../Ast/AssignedObjectPath.php | 2 +- .../Core/ObjectTreeParser/Ast/Block.php | 2 +- .../Core/ObjectTreeParser/Ast/BoolValue.php | 2 +- .../Core/ObjectTreeParser/Ast/CharValue.php | 32 ------------------- .../Ast/DslExpressionValue.php | 2 +- .../Ast/EelExpressionValue.php | 2 +- .../Core/ObjectTreeParser/Ast/FloatValue.php | 2 +- .../Core/ObjectTreeParser/Ast/FusionFile.php | 2 +- .../Ast/FusionObjectValue.php | 2 +- .../ObjectTreeParser/Ast/IncludeStatement.php | 2 +- .../Core/ObjectTreeParser/Ast/IntValue.php | 2 +- .../ObjectTreeParser/Ast/MetaPathSegment.php | 2 +- .../Core/ObjectTreeParser/Ast/NullValue.php | 2 +- .../Core/ObjectTreeParser/Ast/ObjectPath.php | 2 +- .../ObjectTreeParser/Ast/ObjectStatement.php | 2 +- .../Core/ObjectTreeParser/Ast/PathSegment.php | 2 +- .../Ast/PrototypePathSegment.php | 2 +- .../Core/ObjectTreeParser/Ast/SimpleValue.php | 32 ------------------- .../ObjectTreeParser/Ast/StatementList.php | 2 +- .../Core/ObjectTreeParser/Ast/StringValue.php | 2 +- .../ObjectTreeParser/Ast/ValueAssignment.php | 2 +- .../Core/ObjectTreeParser/Ast/ValueCopy.php | 2 +- .../Core/ObjectTreeParser/Ast/ValueUnset.php | 2 +- .../Exception/ParserException.php | 2 +- .../ObjectTreeParser/FilePatternResolver.php | 8 +++-- .../Classes/Core/ObjectTreeParser/Lexer.php | 3 ++ .../Core/ObjectTreeParser/MergedArrayTree.php | 2 +- .../MergedArrayTreeVisitor.php | 4 +-- .../ObjectTreeParser/ObjectTreeParser.php | 4 +-- .../Classes/Core/ObjectTreeParser/Token.php | 5 +-- Neos.Fusion/Classes/Core/Parser.php | 7 ++-- Neos.Fusion/Classes/Core/Runtime.php | 8 +++-- Neos.Fusion/Classes/Core/RuntimeFactory.php | 1 + .../Classes/Exception/RuntimeException.php | 4 +-- 51 files changed, 105 insertions(+), 138 deletions(-) delete mode 100644 Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/CharValue.php delete mode 100644 Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/SimpleValue.php diff --git a/Neos.Fusion/Classes/Core/Cache/CacheSegmentParser.php b/Neos.Fusion/Classes/Core/Cache/CacheSegmentParser.php index f9f89ba821b..d424a592d28 100644 --- a/Neos.Fusion/Classes/Core/Cache/CacheSegmentParser.php +++ b/Neos.Fusion/Classes/Core/Cache/CacheSegmentParser.php @@ -200,6 +200,7 @@ protected function extractContentAndSubSegments($currentPosition, array $segment $nextEndPosition = $this->calculateNextTokenPosition($currentPosition, ContentCache::CACHE_SEGMENT_END_TOKEN); } + /** may have to be phpstan-ignore-next-line'd: $toPosition expects int|null but int|false given. Is this a real case? */ $remainingContent = $this->extractContent($currentPosition, $nextEndPosition); $segmentData['content'] .= $remainingContent; $segmentData['cleanContent'] .= $remainingContent; @@ -234,7 +235,7 @@ protected function reduceSegmentDataToCacheRelevantInformation(array $segmentDat /** * @param integer $fromPosition - * @param integer $toPosition + * @param integer|null $toPosition * @return string */ protected function extractContent($fromPosition, $toPosition = null) @@ -263,7 +264,7 @@ protected function calculateCurrentPosition($position) * * @param integer $currentPosition The position to start searching from * @param string $token the token to search for (will internally be appeneded by the randomCacheMarker) - * @return integer|boolean Position of the token or false if the token was not found + * @return integer|false Position of the token or false if the token was not found */ protected function calculateNextTokenPosition($currentPosition, $token) { diff --git a/Neos.Fusion/Classes/Core/Cache/ContentCache.php b/Neos.Fusion/Classes/Core/Cache/ContentCache.php index 29d5736bd18..f36526283a8 100644 --- a/Neos.Fusion/Classes/Core/Cache/ContentCache.php +++ b/Neos.Fusion/Classes/Core/Cache/ContentCache.php @@ -240,8 +240,8 @@ public function processCacheSegments($content, $storeCacheEntries = true) * @param string $fusionPath Fusion path identifying the Fusion object to retrieve from the content cache * @param array $cacheIdentifierValues Further values which play into the cache identifier hash, must be the same as the ones specified while the cache entry was written * @param boolean $addCacheSegmentMarkersToPlaceholders If cache segment markers should be added – this makes sense if the cached segment is about to be included in a not-yet-cached segment - * @param string|bool $cacheDiscriminator The evaluated cache discriminator value, if any and false if the cache discriminator is disabled for the current context - * @return string|boolean The segment with replaced cache placeholders, or false if a segment was missing in the cache + * @param string|false $cacheDiscriminator The evaluated cache discriminator value, if any and false if the cache discriminator is disabled for the current context + * @return string|false The segment with replaced cache placeholders, or false if a segment was missing in the cache * @throws Exception */ public function getCachedSegment($uncachedCommandCallback, $fusionPath, $cacheIdentifierValues, $addCacheSegmentMarkersToPlaceholders = false, $cacheDiscriminator = null) @@ -361,6 +361,7 @@ protected function getTypeForContextValue($contextValue) { if (is_object($contextValue)) { if ($contextValue instanceof Proxy) { + /** @var string $type */ $type = get_parent_class($contextValue); } else { $type = get_class($contextValue); diff --git a/Neos.Fusion/Classes/Core/Cache/FileMonitorListener.php b/Neos.Fusion/Classes/Core/Cache/FileMonitorListener.php index ac8e57d5ed4..37d2acd12e6 100644 --- a/Neos.Fusion/Classes/Core/Cache/FileMonitorListener.php +++ b/Neos.Fusion/Classes/Core/Cache/FileMonitorListener.php @@ -37,8 +37,8 @@ public function __construct(CacheManager $flowCacheManager) } /** - * @param $fileMonitorIdentifier - * @param array $changedFiles + * @param string $fileMonitorIdentifier + * @param array $changedFiles * @return void */ public function flushContentCacheOnFileChanges($fileMonitorIdentifier, array $changedFiles) diff --git a/Neos.Fusion/Classes/Core/Cache/ParserCache.php b/Neos.Fusion/Classes/Core/Cache/ParserCache.php index 0e83c20def2..0ceb1f67f3f 100644 --- a/Neos.Fusion/Classes/Core/Cache/ParserCache.php +++ b/Neos.Fusion/Classes/Core/Cache/ParserCache.php @@ -15,6 +15,7 @@ use Neos\Flow\Annotations as Flow; use Neos\Cache\Frontend\VariableFrontend; +use Neos\Flow\Package\FlowPackageInterface; use Neos\Flow\Package\PackageManager; use Neos\Fusion\Core\ObjectTreeParser\Ast\FusionFile; use Neos\Utility\Unicode\Functions as UnicodeFunctions; @@ -44,6 +45,7 @@ class ParserCache /** * @Flow\InjectConfiguration(path="enableParsePartialsCache") + * @var boolean */ protected $enableCache; @@ -105,6 +107,7 @@ private function getAbsolutePathForPackageRessourceUri(string $requestedPath): s throw new \InvalidArgumentException("Unsupported stream wrapper: '$requestedPath'"); } + /** @var FlowPackageInterface $package */ $package = $this->packageManager->getPackage($resourceUriParts['host']); return Files::concatenatePaths([$package->getResourcesPath(), $resourceUriParts['path']]); } diff --git a/Neos.Fusion/Classes/Core/Cache/ParserCacheFlusher.php b/Neos.Fusion/Classes/Core/Cache/ParserCacheFlusher.php index 9d02094ebd0..abee7a14a46 100644 --- a/Neos.Fusion/Classes/Core/Cache/ParserCacheFlusher.php +++ b/Neos.Fusion/Classes/Core/Cache/ParserCacheFlusher.php @@ -38,8 +38,8 @@ public function __construct(CacheManager $flowCacheManager) } /** - * @param $fileMonitorIdentifier - * @param array $changedFiles + * @param string $fileMonitorIdentifier + * @param array $changedFiles * @return void */ public function flushPartialCacheOnFileChanges($fileMonitorIdentifier, array $changedFiles) diff --git a/Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php b/Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php index 3909d124fe6..49e04c5e5bf 100644 --- a/Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php +++ b/Neos.Fusion/Classes/Core/Cache/RuntimeContentCache.php @@ -34,7 +34,7 @@ class RuntimeContentCache protected $enableContentCache = false; /** - * @var boolean + * @var boolean|null */ protected $inCacheEntryPoint = null; diff --git a/Neos.Fusion/Classes/Core/DslFactory.php b/Neos.Fusion/Classes/Core/DslFactory.php index f5f883b1b55..acf21dbeba3 100644 --- a/Neos.Fusion/Classes/Core/DslFactory.php +++ b/Neos.Fusion/Classes/Core/DslFactory.php @@ -25,7 +25,7 @@ class DslFactory { /** * @Flow\InjectConfiguration("dsl") - * @var + * @var array>|null */ protected $dslSettings; @@ -36,7 +36,7 @@ class DslFactory */ public function create(string $identifier): DslInterface { - if (isset($this->dslSettings) && is_array($this->dslSettings) && isset($this->dslSettings[$identifier])) { + if (is_array($this->dslSettings) && isset($this->dslSettings[$identifier])) { $dslObjectName = $this->dslSettings[$identifier]; if (!class_exists($dslObjectName)) { throw new Fusion\Exception(sprintf('The fusion dsl-object %s was not found.', $dslObjectName), 1490776462); diff --git a/Neos.Fusion/Classes/Core/ExceptionHandlers/AbsorbingHandler.php b/Neos.Fusion/Classes/Core/ExceptionHandlers/AbsorbingHandler.php index ba4f822c4c0..29257c63ec5 100644 --- a/Neos.Fusion/Classes/Core/ExceptionHandlers/AbsorbingHandler.php +++ b/Neos.Fusion/Classes/Core/ExceptionHandlers/AbsorbingHandler.php @@ -37,7 +37,7 @@ class AbsorbingHandler extends AbstractRenderingExceptionHandler * * @param string $fusionPath path causing the exception * @param \Exception $exception exception to handle - * @param integer $referenceCode + * @param string|null $referenceCode * @return string */ protected function handle($fusionPath, \Exception $exception, $referenceCode) diff --git a/Neos.Fusion/Classes/Core/ExceptionHandlers/AbstractRenderingExceptionHandler.php b/Neos.Fusion/Classes/Core/ExceptionHandlers/AbstractRenderingExceptionHandler.php index adf3c9a88bb..811f0f46f39 100644 --- a/Neos.Fusion/Classes/Core/ExceptionHandlers/AbstractRenderingExceptionHandler.php +++ b/Neos.Fusion/Classes/Core/ExceptionHandlers/AbstractRenderingExceptionHandler.php @@ -64,6 +64,7 @@ public function handleRenderingException($fusionPath, \Exception $exception) } if ($exception instanceof Exceptions\RuntimeException) { $fusionPath = $exception->getFusionPath(); + /** @var \Exception $exception */ $exception = $exception->getPrevious(); } if ($this->exceptionDisablesCache($fusionPath, $exception)) { @@ -78,7 +79,7 @@ public function handleRenderingException($fusionPath, \Exception $exception) * * @param string $fusionPath path causing the exception * @param \Exception $exception exception to handle - * @param integer $referenceCode + * @param string|null $referenceCode * @return string */ abstract protected function handle($fusionPath, \Exception $exception, $referenceCode); diff --git a/Neos.Fusion/Classes/Core/ExceptionHandlers/BubblingHandler.php b/Neos.Fusion/Classes/Core/ExceptionHandlers/BubblingHandler.php index 59b56e472c9..184d8ef7c4a 100644 --- a/Neos.Fusion/Classes/Core/ExceptionHandlers/BubblingHandler.php +++ b/Neos.Fusion/Classes/Core/ExceptionHandlers/BubblingHandler.php @@ -23,7 +23,7 @@ class BubblingHandler extends AbstractRenderingExceptionHandler /** * Handle an Exception thrown while rendering Fusion * - * @param array $fusionPath + * @param string $fusionPath * @param \Exception $exception * @return string * @throws StopActionException @@ -44,11 +44,12 @@ public function handleRenderingException($fusionPath, \Exception $exception) * * @param string $fusionPath path causing the exception * @param \Exception $exception exception to handle - * @param integer $referenceCode - * @return void + * @param string|null $referenceCode + * @return string */ protected function handle($fusionPath, \Exception $exception, $referenceCode) { // nothing to be done here, as this method is normally called in "handleRenderingException()", which was overridden above. + throw new \BadMethodCallException('Never called.'); } } diff --git a/Neos.Fusion/Classes/Core/ExceptionHandlers/ContextDependentHandler.php b/Neos.Fusion/Classes/Core/ExceptionHandlers/ContextDependentHandler.php index d26d3233eae..1e0bb3694e1 100644 --- a/Neos.Fusion/Classes/Core/ExceptionHandlers/ContextDependentHandler.php +++ b/Neos.Fusion/Classes/Core/ExceptionHandlers/ContextDependentHandler.php @@ -29,9 +29,9 @@ class ContextDependentHandler extends AbstractRenderingExceptionHandler /** * Handle an exception depending on the context with an HTML message or XML comment * - * @param array $fusionPath path causing the exception + * @param string $fusionPath path causing the exception * @param \Exception $exception exception to handle - * @param integer $referenceCode + * @param string|null $referenceCode * @return string */ protected function handle($fusionPath, \Exception $exception, $referenceCode) diff --git a/Neos.Fusion/Classes/Core/ExceptionHandlers/HtmlMessageHandler.php b/Neos.Fusion/Classes/Core/ExceptionHandlers/HtmlMessageHandler.php index 18a45cabaaf..be714eeb74f 100644 --- a/Neos.Fusion/Classes/Core/ExceptionHandlers/HtmlMessageHandler.php +++ b/Neos.Fusion/Classes/Core/ExceptionHandlers/HtmlMessageHandler.php @@ -40,7 +40,7 @@ class HtmlMessageHandler extends AbstractRenderingExceptionHandler /** * @param LoggerInterface $logger */ - public function injectLogger(LoggerInterface $logger) + public function injectLogger(LoggerInterface $logger): void { $this->logger = $logger; } @@ -48,7 +48,7 @@ public function injectLogger(LoggerInterface $logger) /** * @param ThrowableStorageInterface $throwableStorage */ - public function injectThrowableStorage(ThrowableStorageInterface $throwableStorage) + public function injectThrowableStorage(ThrowableStorageInterface $throwableStorage): void { $this->throwableStorage = $throwableStorage; } @@ -66,7 +66,7 @@ public function __construct(bool $renderTechnicalDetails = true) * * @param string $fusionPath path causing the exception * @param \Exception $exception exception to handle - * @param integer $referenceCode + * @param string|null $referenceCode * @return string */ protected function handle($fusionPath, \Exception $exception, $referenceCode) @@ -96,7 +96,7 @@ protected function handle($fusionPath, \Exception $exception, $referenceCode) * Renders a message depicting the user where to find further information * for the given reference code. * - * @param integer $referenceCode + * @param string $referenceCode * @return string A rendered message with the reference code containing HTML */ protected function formatErrorCodeMessage($referenceCode) diff --git a/Neos.Fusion/Classes/Core/ExceptionHandlers/ThrowingHandler.php b/Neos.Fusion/Classes/Core/ExceptionHandlers/ThrowingHandler.php index 7486ed72459..192f1d8059f 100644 --- a/Neos.Fusion/Classes/Core/ExceptionHandlers/ThrowingHandler.php +++ b/Neos.Fusion/Classes/Core/ExceptionHandlers/ThrowingHandler.php @@ -22,7 +22,7 @@ class ThrowingHandler extends AbstractRenderingExceptionHandler /** * Handle an Exception thrown while rendering Fusion * - * @param array $fusionPath + * @param string $fusionPath * @param \Exception $exception * @return string * @throws StopActionException @@ -39,7 +39,7 @@ public function handleRenderingException($fusionPath, \Exception $exception) * * @param string $fusionPath path causing the exception * @param \Exception $exception exception to handle - * @param integer $referenceCode + * @param string|null $referenceCode * @return string */ protected function handle($fusionPath, \Exception $exception, $referenceCode) diff --git a/Neos.Fusion/Classes/Core/ExceptionHandlers/XmlCommentHandler.php b/Neos.Fusion/Classes/Core/ExceptionHandlers/XmlCommentHandler.php index 8237a3c5968..59d874c0317 100644 --- a/Neos.Fusion/Classes/Core/ExceptionHandlers/XmlCommentHandler.php +++ b/Neos.Fusion/Classes/Core/ExceptionHandlers/XmlCommentHandler.php @@ -33,7 +33,7 @@ class XmlCommentHandler extends AbstractRenderingExceptionHandler /** * @param LoggerInterface $logger */ - public function injectLogger(LoggerInterface $logger) + public function injectLogger(LoggerInterface $logger): void { $this->logger = $logger; } @@ -41,7 +41,7 @@ public function injectLogger(LoggerInterface $logger) /** * @param ThrowableStorageInterface $throwableStorage */ - public function injectThrowableStorage(ThrowableStorageInterface $throwableStorage) + public function injectThrowableStorage(ThrowableStorageInterface $throwableStorage): void { $this->throwableStorage = $throwableStorage; } diff --git a/Neos.Fusion/Classes/Core/FusionConfiguration.php b/Neos.Fusion/Classes/Core/FusionConfiguration.php index 66e2791e6a1..591ac3b533f 100644 --- a/Neos.Fusion/Classes/Core/FusionConfiguration.php +++ b/Neos.Fusion/Classes/Core/FusionConfiguration.php @@ -20,20 +20,29 @@ */ final class FusionConfiguration { - /** @internal */ + /** + * @internal + * @param array $fusionConfiguration + */ protected function __construct( private array $fusionConfiguration ) { } - /** @internal */ - public static function fromArray(array $fusionConfiguration) + /** + * @internal + * @param array $fusionConfiguration + */ + public static function fromArray(array $fusionConfiguration): self { return new static($fusionConfiguration); } - /** @internal */ - public function toArray() + /** + * @internal + * @return array + */ + public function toArray(): array { return $this->fusionConfiguration; } diff --git a/Neos.Fusion/Classes/Core/FusionSourceCodeCollection.php b/Neos.Fusion/Classes/Core/FusionSourceCodeCollection.php index dd20062a890..1d0dab33298 100644 --- a/Neos.Fusion/Classes/Core/FusionSourceCodeCollection.php +++ b/Neos.Fusion/Classes/Core/FusionSourceCodeCollection.php @@ -13,7 +13,10 @@ * source code. */ -/** @api */ +/** + * @implements \IteratorAggregate + * @api + */ final class FusionSourceCodeCollection implements \IteratorAggregate, \Countable { /** @var array */ @@ -49,7 +52,7 @@ public static function tryFromPackageRootFusion(string $packageKey): self return static::tryFromFilePath($fusionPathAndFilename); } - public static function empty() + public static function empty(): self { return new static(); } @@ -71,7 +74,7 @@ public function count(): int } /** - * @param array $fusionSourceCode + * @param array $fusionSourceCode * @return array */ private static function deduplicateItemsAndKeepLast(array $fusionSourceCode): array diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/AbstractNode.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/AbstractNode.php index f46a84002be..ffb6bd8ac27 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/AbstractNode.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/AbstractNode.php @@ -20,5 +20,5 @@ #[Flow\Proxy(false)] abstract class AbstractNode { - abstract public function visit(AstNodeVisitorInterface $visitor, ...$args); + abstract public function visit(AstNodeVisitorInterface $visitor, mixed ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/AssignedObjectPath.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/AssignedObjectPath.php index a03d07d23b6..a4d3b85decc 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/AssignedObjectPath.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/AssignedObjectPath.php @@ -27,7 +27,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitAssignedObjectPath($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/Block.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/Block.php index 187bf913967..a7d9044dc57 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/Block.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/Block.php @@ -25,7 +25,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitBlock($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/BoolValue.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/BoolValue.php index f8c72168d12..27cb116c3bf 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/BoolValue.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/BoolValue.php @@ -25,7 +25,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitBoolValue($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/CharValue.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/CharValue.php deleted file mode 100644 index f03c077dac5..00000000000 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/CharValue.php +++ /dev/null @@ -1,32 +0,0 @@ -visitCharValue($this, ...$args); - } -} diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/DslExpressionValue.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/DslExpressionValue.php index df7d6107a35..f1550e260ad 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/DslExpressionValue.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/DslExpressionValue.php @@ -27,7 +27,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitDslExpressionValue($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/EelExpressionValue.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/EelExpressionValue.php index 5c758b8b99d..2245a53964b 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/EelExpressionValue.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/EelExpressionValue.php @@ -25,7 +25,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitEelExpressionValue($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/FloatValue.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/FloatValue.php index fec331c9bda..23a566c7b88 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/FloatValue.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/FloatValue.php @@ -25,7 +25,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitFloatValue($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/FusionFile.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/FusionFile.php index 7c8a6e51801..73be093fe8b 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/FusionFile.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/FusionFile.php @@ -27,7 +27,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitFusionFile($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/FusionObjectValue.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/FusionObjectValue.php index fe6ff482e64..0f8a306f70d 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/FusionObjectValue.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/FusionObjectValue.php @@ -25,7 +25,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitFusionObjectValue($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/IncludeStatement.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/IncludeStatement.php index 7857334e743..385a1c628e9 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/IncludeStatement.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/IncludeStatement.php @@ -25,7 +25,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitIncludeStatement($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/IntValue.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/IntValue.php index 63115f7035a..42ddcfa7901 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/IntValue.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/IntValue.php @@ -25,7 +25,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitIntValue($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/MetaPathSegment.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/MetaPathSegment.php index c427fe03d63..27e8a45fedc 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/MetaPathSegment.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/MetaPathSegment.php @@ -25,7 +25,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitMetaPathSegment($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/NullValue.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/NullValue.php index 101cddaafe7..e2d53c784ba 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/NullValue.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/NullValue.php @@ -19,7 +19,7 @@ #[Flow\Proxy(false)] class NullValue extends AbstractPathValue { - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitNullValue($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ObjectPath.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ObjectPath.php index fc478895776..e9e6090a8ae 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ObjectPath.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ObjectPath.php @@ -30,7 +30,7 @@ public function __construct(AbstractPathSegment ...$segments) $this->segments = $segments; } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitObjectPath($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ObjectStatement.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ObjectStatement.php index 31e6a1c990d..ac12483db4a 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ObjectStatement.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ObjectStatement.php @@ -31,7 +31,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitObjectStatement($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/PathSegment.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/PathSegment.php index 72cab27978b..eb8de5192e7 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/PathSegment.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/PathSegment.php @@ -25,7 +25,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitPathSegment($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/PrototypePathSegment.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/PrototypePathSegment.php index 59f84a59178..347359ab10b 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/PrototypePathSegment.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/PrototypePathSegment.php @@ -25,7 +25,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitPrototypePathSegment($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/SimpleValue.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/SimpleValue.php deleted file mode 100644 index da9da2b9615..00000000000 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/SimpleValue.php +++ /dev/null @@ -1,32 +0,0 @@ -visitSimpleValue($this, ...$args); - } -} diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/StatementList.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/StatementList.php index 87ff12074d9..0352f132a68 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/StatementList.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/StatementList.php @@ -30,7 +30,7 @@ public function __construct(AbstractStatement ...$statements) $this->statements = $statements; } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitStatementList($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/StringValue.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/StringValue.php index e202a7eb3b0..ff09ad51056 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/StringValue.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/StringValue.php @@ -25,7 +25,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitStringValue($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ValueAssignment.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ValueAssignment.php index b225367486c..66a007d2654 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ValueAssignment.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ValueAssignment.php @@ -25,7 +25,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitValueAssignment($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ValueCopy.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ValueCopy.php index b5e787e8874..1878f280ced 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ValueCopy.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ValueCopy.php @@ -25,7 +25,7 @@ public function __construct( ) { } - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitValueCopy($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ValueUnset.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ValueUnset.php index 04463f2b175..8b7513cf30f 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ValueUnset.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Ast/ValueUnset.php @@ -19,7 +19,7 @@ #[Flow\Proxy(false)] class ValueUnset extends AbstractOperation { - public function visit(AstNodeVisitorInterface $visitor, ...$args) + public function visit(AstNodeVisitorInterface $visitor, mixed ...$args) { return $visitor->visitValueUnset($this, ...$args); } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Exception/ParserException.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Exception/ParserException.php index 8dde45cda31..dc159e56aa5 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Exception/ParserException.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Exception/ParserException.php @@ -100,7 +100,7 @@ public function setHideColumnInformation(): self } /** - * @param callable(MessageLinePart $next, MessageLinePart $prev): string $messageMaker + * @param callable(MessageLinePart $next, MessageLinePart $prev): string $messageCreator */ public function setMessageCreator(callable $messageCreator): self { diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/FilePatternResolver.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/FilePatternResolver.php index acdd893eb25..662bbb136e9 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/FilePatternResolver.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/FilePatternResolver.php @@ -54,7 +54,7 @@ class FilePatternResolver * @param string $filePattern * @param string|null $filePathForRelativeResolves * @param string $defaultFileEndForUnspecificGlobbing - * @return array|string[] + * @return list * @throws Fusion\Exception */ public static function resolveFilesByPattern(string $filePattern, ?string $filePathForRelativeResolves, string $defaultFileEndForUnspecificGlobbing): array @@ -99,6 +99,9 @@ protected static function resolveRelativePath(string $filePattern, ?string $file return Files::concatenatePaths([dirname($filePathForRelativeResolves), $filePattern]); } + /** + * @return list + */ protected static function parseGlobPatternAndResolveFiles(string $filePattern, string $defaultFileNameEnd): array { $fileIteratorCreator = match (1) { @@ -119,6 +122,7 @@ protected static function parseGlobPatternAndResolveFiles(string $filePattern, s default => throw new Fusion\Exception("The include glob pattern '$filePattern' is invalid. Only globbing with /**/* or /* is supported.", 1636144713), }; + /** @var array{base: string, end: string} $matches */ $basePath = $matches['base']; $fileNameEnd = $matches['end'] === '' ? $defaultFileNameEnd : $matches['end']; @@ -133,7 +137,7 @@ protected static function parseGlobPatternAndResolveFiles(string $filePattern, s /** * @param \Iterator|\SplFileInfo[] $fileIterator * @param string $fileNameEnd when file matches this ending it will be included. - * @return array + * @return list */ protected static function iterateOverFilesAndSelectByFileEnding(\Iterator $fileIterator, string $fileNameEnd): array { diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Lexer.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Lexer.php index 063922e2935..77453b29d90 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Lexer.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Lexer.php @@ -144,6 +144,9 @@ public function consumeLookahead(): Token { $token = $this->lookahead; $this->lookahead = null; + if ($token === null) { + throw new \LogicException('Cannot consume lookahead.', 1705652155); + } return $token; } diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/MergedArrayTree.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/MergedArrayTree.php index 8eff369e33e..bd33b7b1b85 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/MergedArrayTree.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/MergedArrayTree.php @@ -67,7 +67,7 @@ public function setValueInTree(array $path, $value): void }); } - protected static function arraySetOrMergeValueByPathWithCallback(array &$subject, array $path, $value, callable $toArray): void + protected static function arraySetOrMergeValueByPathWithCallback(array &$subject, array $path, mixed $value, callable $toArray): void { // points to the current path element, but inside the tree. $pointer = &$subject; diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/MergedArrayTreeVisitor.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/MergedArrayTreeVisitor.php index 59d973720fb..3422282ba01 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/MergedArrayTreeVisitor.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/MergedArrayTreeVisitor.php @@ -254,7 +254,7 @@ public function visitValueCopy(ValueCopy $valueCopy, array $currentPath = null) $this->mergedArrayTree->copyValueInTree($currentPath, $sourcePath); } - public function visitAssignedObjectPath(AssignedObjectPath $assignedObjectPath, $relativePath = []) + public function visitAssignedObjectPath(AssignedObjectPath $assignedObjectPath, array $relativePath = []) { $path = []; if ($assignedObjectPath->isRelative) { @@ -305,7 +305,7 @@ protected function prepareParserException(ParserException $parserException): Par if ($this->contextPathAndFilename === null) { $fusionCode = ''; } else { - $fusionCode = file_get_contents($this->contextPathAndFilename); + $fusionCode = file_get_contents($this->contextPathAndFilename) ?: ''; } return $parserException ->setHideColumnInformation() diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/ObjectTreeParser.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/ObjectTreeParser.php index 64eb91f8432..adb77d5e0c0 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/ObjectTreeParser.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/ObjectTreeParser.php @@ -117,9 +117,9 @@ protected function expect(int $tokenType): Token /** * Checks, if the token type matches the current, if so consume it and return true. * @param int $tokenType - * @return bool|null + * @return bool */ - protected function lazyExpect(int $tokenType): ?bool + protected function lazyExpect(int $tokenType): bool { $token = $this->lexer->getCachedLookaheadOrTryToGenerateLookaheadForTokenAndGetLookahead($tokenType); if ($token === null || $token->getType() !== $tokenType) { diff --git a/Neos.Fusion/Classes/Core/ObjectTreeParser/Token.php b/Neos.Fusion/Classes/Core/ObjectTreeParser/Token.php index 799fa24f48d..c8948c94e72 100644 --- a/Neos.Fusion/Classes/Core/ObjectTreeParser/Token.php +++ b/Neos.Fusion/Classes/Core/ObjectTreeParser/Token.php @@ -89,7 +89,7 @@ public static function typeToString(int $type): string { $stringRepresentation = array_search($type, static::getConstants(), true); - if ($stringRepresentation === false) { + if (is_string($stringRepresentation) === false) { throw new \LogicException("Token of type '$type' does not exist", 1637307344); } return $stringRepresentation; @@ -97,8 +97,9 @@ public static function typeToString(int $type): string /** * @Flow\CompileStatic + * @return array */ - protected static function getConstants() + protected static function getConstants(): array { $reflection = new \ReflectionClass(self::class); return $reflection->getConstants(); diff --git a/Neos.Fusion/Classes/Core/Parser.php b/Neos.Fusion/Classes/Core/Parser.php index eeffdd005c9..128c123a8e8 100644 --- a/Neos.Fusion/Classes/Core/Parser.php +++ b/Neos.Fusion/Classes/Core/Parser.php @@ -31,6 +31,7 @@ class Parser { /** * Reserved parse tree keys for internal usage. + * @var list */ public static array $reservedParseTreeKeys = ['__meta', '__prototypes', '__stopInheritanceChain', '__prototypeObjectName', '__prototypeChain', '__value', '__objectType', '__eelExpression']; @@ -75,8 +76,8 @@ public function parseFromSource(FusionSourceCodeCollection $sourceCode): FusionC * * @param string $sourceCode The Fusion source code to parse * @param string|null $contextPathAndFilename An optional path and filename used for relative Fusion file includes - * @param array $mergedArrayTreeUntilNow Used internally for keeping track of the built merged array tree - * @return array The merged array tree for the Fusion runtime, generated from the source code + * @param array $mergedArrayTreeUntilNow Used internally for keeping track of the built merged array tree + * @return array The merged array tree for the Fusion runtime, generated from the source code * @throws Fusion\Exception * @deprecated with Neos 8.3 – will be removed with Neos 9.0, use {@link parseFromSource} instead * @api @@ -114,7 +115,7 @@ protected function handleFileInclude(MergedArrayTree $mergedArrayTree, string $f } } - protected function handleDslTranspile(string $identifier, string $code) + protected function handleDslTranspile(string $identifier, string $code): mixed { return $this->parserCache->cacheForDsl( $identifier, diff --git a/Neos.Fusion/Classes/Core/Runtime.php b/Neos.Fusion/Classes/Core/Runtime.php index 0480101e208..75631a2abe1 100644 --- a/Neos.Fusion/Classes/Core/Runtime.php +++ b/Neos.Fusion/Classes/Core/Runtime.php @@ -101,7 +101,7 @@ class Runtime protected $defaultContextVariables; /** - * @var array + * @var RuntimeConfiguration */ protected $runtimeConfiguration; @@ -601,7 +601,7 @@ protected function instantiateFusionObject($fusionPath, $fusionConfiguration, ar MESSAGE, 1347952109); } - /** @var $fusionObject AbstractFusionObject */ + /** @var AbstractFusionObject $fusionObject */ $fusionObject = new $fusionObjectClassName($this, $fusionPath, $fusionObjectType); if ($this->shouldAssignPropertiesToFusionObject($fusionObject)) { /** @var $fusionObject AbstractArrayFusionObject */ @@ -691,6 +691,7 @@ protected function evaluateEelExpression($expression, AbstractFusionObject $cont } $contextVariables['this'] = $contextObject; + /** may have to be phpstan-ignore-next-line'd: the mind of the great phpstan can and will not comprehend this */ if ($this->eelEvaluator instanceof \Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy) { $this->eelEvaluator->_activateDependency(); } @@ -753,7 +754,7 @@ protected function evaluateApplyValues($configurationWithEventualProperties, $fu 'value' => $value ]; } - } elseif ($singleApplyValues instanceof \Traversable && $singleApplyValues instanceof \ArrayAccess) { + } elseif ($singleApplyValues instanceof \Iterator && $singleApplyValues instanceof \ArrayAccess) { for ($singleApplyValues->rewind(); ($key = $singleApplyValues->key()) !== null; $singleApplyValues->next()) { $combinedApplyValues[$fusionPath . '/' . $key] = [ 'key' => $key, @@ -867,6 +868,7 @@ protected function getDefaultContextVariables() * @param string $behaviorIfPathNotFound One of the BEHAVIOR_* constants * @throws Exception\MissingFusionImplementationException * @throws Exception\MissingFusionObjectException + * @return void */ protected function throwExceptionForUnrenderablePathIfNeeded($fusionPath, $fusionConfiguration, $behaviorIfPathNotFound) { diff --git a/Neos.Fusion/Classes/Core/RuntimeFactory.php b/Neos.Fusion/Classes/Core/RuntimeFactory.php index fc159cb9071..686ebc398b5 100644 --- a/Neos.Fusion/Classes/Core/RuntimeFactory.php +++ b/Neos.Fusion/Classes/Core/RuntimeFactory.php @@ -32,6 +32,7 @@ class RuntimeFactory protected $fusionParser; /** + * @param array $fusionConfiguration * @deprecated with Neos 8.3 might be removed with Neos 9.0 use {@link createFromConfiguration} instead. */ public function create(array $fusionConfiguration, ControllerContext $controllerContext = null): Runtime diff --git a/Neos.Fusion/Classes/Exception/RuntimeException.php b/Neos.Fusion/Classes/Exception/RuntimeException.php index cca947a8082..73692f1a9a0 100644 --- a/Neos.Fusion/Classes/Exception/RuntimeException.php +++ b/Neos.Fusion/Classes/Exception/RuntimeException.php @@ -26,7 +26,7 @@ class RuntimeException extends Exception * @param string $message * @param int $code * @param \Exception $previous - * @param null $fusionPath + * @param string $fusionPath */ public function __construct($message = '', $code = 0, \Exception $previous = null, $fusionPath = null) { @@ -36,7 +36,7 @@ public function __construct($message = '', $code = 0, \Exception $previous = nul } /** - * @return null|string + * @return string */ public function getFusionPath() {