diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd9dbc9dc1..80a4de9230 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -120,8 +120,6 @@ jobs: git -C ../${{ env.FLOW_FOLDER }} checkout -b build composer config repositories.flow '{ "type": "path", "url": "../${{ env.FLOW_FOLDER }}", "options": { "symlink": false } }' composer require --no-update neos/flow-development-collection:"dev-build as ${{ env.FLOW_BRANCH_ALIAS }}" - # todo remove temporary hack ;) (sorry - if i forget) - composer require --no-update --dev "phpstan/phpstan:^1.10.0" - name: Cache Composer packages id: composer-cache diff --git a/Neos.Cache/Classes/Psr/Cache/CacheItem.php b/Neos.Cache/Classes/Psr/Cache/CacheItem.php index 810c40b824..69cb3bf51d 100644 --- a/Neos.Cache/Classes/Psr/Cache/CacheItem.php +++ b/Neos.Cache/Classes/Psr/Cache/CacheItem.php @@ -110,7 +110,7 @@ public function expiresAt(?\DateTimeInterface $expiration): static /** * @param \DateInterval|int|null $time - * @return CacheItem|static + * @return static */ public function expiresAfter(int|\DateInterval|null $time): static { diff --git a/Neos.Cache/Classes/Psr/SimpleCache/SimpleCache.php b/Neos.Cache/Classes/Psr/SimpleCache/SimpleCache.php index 4666860c6c..61ee172b06 100644 --- a/Neos.Cache/Classes/Psr/SimpleCache/SimpleCache.php +++ b/Neos.Cache/Classes/Psr/SimpleCache/SimpleCache.php @@ -60,7 +60,7 @@ public function __construct(string $identifier, BackendInterface $backend) * * @param string $key An identifier used for this cache entry * @param mixed $value The variable to cache - * @param null|int|\DateInterval $lifetime Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime. + * @param null|int|\DateInterval $ttl Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime. * @return bool * * @throws Exception diff --git a/Neos.Eel/Classes/CompilingEvaluator.php b/Neos.Eel/Classes/CompilingEvaluator.php index 438f2a9b20..f2d8200285 100644 --- a/Neos.Eel/Classes/CompilingEvaluator.php +++ b/Neos.Eel/Classes/CompilingEvaluator.php @@ -97,13 +97,15 @@ protected function evaluateAndUnwrap(\closure $expressionFunction, Context $cont */ protected function generateEvaluatorCode($expression) { - /** @phpstan-ignore-next-line */ + /** @phpstan-ignore-next-line `CompilingEelParser` has been explicitly excluded from analysis, because it contains generated code that is impossible to fix */ $parser = new CompilingEelParser($expression); $result = $parser->match_Expression(); if ($result === false) { throw new ParserException(sprintf('Expression "%s" could not be parsed.', $expression), 1344513194); + /** @phpstan-ignore-next-line $parser->pos appears to be undeclared, because instantiation of $parser is hidden as well */ } elseif ($parser->pos !== strlen($expression)) { + /** @phpstan-ignore-next-line $parser->pos appears to be undeclared, because instantiation of $parser is hidden as well */ throw new ParserException(sprintf('Expression "%s" could not be parsed. Error starting at character %d: "%s".', $expression, $parser->pos, substr($expression, $parser->pos)), 1327682383); } elseif (!array_key_exists('code', $result)) { throw new ParserException(sprintf('Parser error, no code in result %s ', json_encode($result)), 1334491498); diff --git a/Neos.Eel/Classes/FlowQuery/OperationInterface.php b/Neos.Eel/Classes/FlowQuery/OperationInterface.php index 2b2bb552cd..158b45fb79 100644 --- a/Neos.Eel/Classes/FlowQuery/OperationInterface.php +++ b/Neos.Eel/Classes/FlowQuery/OperationInterface.php @@ -42,7 +42,7 @@ public static function isFinal(); * can work with the $context objects. It can be implemented * to implement runtime conditions. * - * @param array (or array-like object) $context onto which this operation should be applied + * @param array $context (or array-like object) $context onto which this operation should be applied * @return boolean true if the operation can be applied onto the $context, false otherwise * @api */ diff --git a/Neos.Eel/Classes/FlowQuery/OperationResolver.php b/Neos.Eel/Classes/FlowQuery/OperationResolver.php index c0bdd615ca..e8724193b1 100644 --- a/Neos.Eel/Classes/FlowQuery/OperationResolver.php +++ b/Neos.Eel/Classes/FlowQuery/OperationResolver.php @@ -73,7 +73,7 @@ public static function buildOperationsAndFinalOperationNames($objectManager) $reflectionService = $objectManager->get(ReflectionService::class); $operationClassNames = $reflectionService->getAllImplementationClassNamesForInterface(OperationInterface::class); - /** @var $operationClassName OperationInterface */ + /** @var OperationInterface $operationClassName */ foreach ($operationClassNames as $operationClassName) { $shortOperationName = $operationClassName::getShortName(); $operationPriority = $operationClassName::getPriority(); diff --git a/Neos.Eel/Classes/FlowQuery/Operations/AbstractOperation.php b/Neos.Eel/Classes/FlowQuery/Operations/AbstractOperation.php index cf0542ff5e..a2527ce36f 100644 --- a/Neos.Eel/Classes/FlowQuery/Operations/AbstractOperation.php +++ b/Neos.Eel/Classes/FlowQuery/Operations/AbstractOperation.php @@ -80,7 +80,7 @@ public static function getShortName() /** * {@inheritdoc} * - * @param array (or array-like object) $context onto which this operation should be applied + * @param array $context (or array-like object) $context onto which this operation should be applied * @return boolean true if the operation can be applied onto the $context, false otherwise * @api */ diff --git a/Neos.Eel/Classes/Helper/MathHelper.php b/Neos.Eel/Classes/Helper/MathHelper.php index fe52948f14..7b1ec9a702 100644 --- a/Neos.Eel/Classes/Helper/MathHelper.php +++ b/Neos.Eel/Classes/Helper/MathHelper.php @@ -94,7 +94,7 @@ public function getSQRT2() * @param float $x A number * @return float The absolute value of the given value */ - public function abs($x = 'NAN') + public function abs($x = NAN) { if (!is_numeric($x) && $x !== null) { return NAN; diff --git a/Neos.Eel/Classes/InterpretedEvaluator.php b/Neos.Eel/Classes/InterpretedEvaluator.php index 4c6cc64139..b113e065b1 100644 --- a/Neos.Eel/Classes/InterpretedEvaluator.php +++ b/Neos.Eel/Classes/InterpretedEvaluator.php @@ -35,7 +35,12 @@ public function evaluate($expression, Context $context) if ($res === false) { throw new ParserException(sprintf('Expression "%s" could not be parsed.', $expression), 1344514198); + /** + * @phpstan-ignore-next-line $parser->pos appears to be undeclared, because it is declared up in the parent class chain of `InterpretedEelParser`, + * wherein multiple classes (e.g. `EelParser` and `AbstractEelParser`) are explicitly excluded from analysis, because they contain generated code that is impossible to fix + */ } elseif ($parser->pos !== strlen($expression)) { + /** @phpstan-ignore-next-line $parser->pos appears to be undeclared see comment above. */ throw new ParserException(sprintf('Expression "%s" could not be parsed. Error starting at character %d: "%s".', $expression, $parser->pos, substr($expression, $parser->pos)), 1344514188); } elseif (!array_key_exists('val', $res)) { throw new ParserException(sprintf('Parser error, no val in result %s ', json_encode($res)), 1344514204); diff --git a/Neos.Eel/Classes/Validation/ExpressionSyntaxValidator.php b/Neos.Eel/Classes/Validation/ExpressionSyntaxValidator.php index 7499bdb6e5..4dd29e881d 100644 --- a/Neos.Eel/Classes/Validation/ExpressionSyntaxValidator.php +++ b/Neos.Eel/Classes/Validation/ExpressionSyntaxValidator.php @@ -28,7 +28,9 @@ protected function isValid($value) if ($result === false) { $this->addError('Expression "%s" could not be parsed.', 1421940748, [$value]); + /** @phpstan-ignore-next-line */ } elseif ($parser->pos !== strlen($value)) { + /** @phpstan-ignore-next-line */ $this->addError('Expression "%s" could not be parsed. Error starting at character %d: "%s".', 1421940760, [$value, $parser->pos, substr($value, $parser->pos)]); } } diff --git a/Neos.Error.Messages/Classes/Result.php b/Neos.Error.Messages/Classes/Result.php index 3875d7d9ff..53caced03e 100644 --- a/Neos.Error.Messages/Classes/Result.php +++ b/Neos.Error.Messages/Classes/Result.php @@ -458,7 +458,6 @@ public function merge(Result $otherResult) $this->mergeProperty($otherResult, 'getNotices', 'addNotice'); } - /** @var $subResult Result */ foreach ($otherResult->getSubResults() as $subPropertyName => $subResult) { if (array_key_exists($subPropertyName, $this->propertyResults) && $this->propertyResults[$subPropertyName]->hasMessages()) { $this->forProperty($subPropertyName)->merge($subResult); diff --git a/Neos.Flow/Classes/Annotations/Inject.php b/Neos.Flow/Classes/Annotations/Inject.php index 067524c7cc..f95caa3ee7 100644 --- a/Neos.Flow/Classes/Annotations/Inject.php +++ b/Neos.Flow/Classes/Annotations/Inject.php @@ -43,9 +43,6 @@ final class Inject */ public $name; - /** - * @param array $values - */ public function __construct(?string $name = null, bool $lazy = true) { $this->lazy = $lazy; diff --git a/Neos.Flow/Classes/Aop/Advice/AdviceChain.php b/Neos.Flow/Classes/Aop/Advice/AdviceChain.php index c12011b01f..21da910d4b 100644 --- a/Neos.Flow/Classes/Aop/Advice/AdviceChain.php +++ b/Neos.Flow/Classes/Aop/Advice/AdviceChain.php @@ -11,6 +11,7 @@ * source code. */ use Neos\Flow\Aop\JoinPointInterface; +use Neos\Flow\Aop\ProxyInterface as InternalAopProxyInterface; /** * The advice chain holds a number of subsequent advices that @@ -56,7 +57,9 @@ public function proceed(JoinPointInterface &$joinPoint) if ($this->adviceIndex < count($this->advices)) { $result = $this->advices[$this->adviceIndex]->invoke($joinPoint); } else { - $result = $joinPoint->getProxy()->Flow_Aop_Proxy_invokeJoinpoint($joinPoint); + /** @var InternalAopProxyInterface $proxy */ + $proxy = $joinPoint->getProxy(); + $result = $proxy->Flow_Aop_Proxy_invokeJoinpoint($joinPoint); } return $result; } diff --git a/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php b/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php index 2ec30d93fc..58e2ac329f 100644 --- a/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php +++ b/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php @@ -435,7 +435,7 @@ public function buildProxyClass(string $targetClassName, array &$aspectContainer $proxyClass->addInterfaces($introducedInterfaces); $proxyClass->addTraits($introducedTraits); - /** @var $propertyIntroduction PropertyIntroduction */ + /** @var PropertyIntroduction $propertyIntroduction */ foreach ($propertyIntroductions as $propertyIntroduction) { $propertyName = $propertyIntroduction->getPropertyName(); $declaringAspectClassName = $propertyIntroduction->getDeclaringAspectClassName(); diff --git a/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php b/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php index 1ba559c9a0..f8c9029380 100644 --- a/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php +++ b/Neos.Flow/Classes/Aop/Pointcut/PointcutExpressionParser.php @@ -279,7 +279,6 @@ protected function parseDesignatorMethod(string $operator, string $signaturePatt $classNameFilter = new PointcutClassNameFilter($classPattern); $classNameFilter->injectReflectionService($this->reflectionService); $methodNameFilter = new PointcutMethodNameFilter($methodNamePattern, $methodVisibility, $methodArgumentConstraints); - /** @var LoggerInterface $logger */ $logger = $this->objectManager->get(PsrLoggerFactoryInterface::class)->get('systemLogger'); $methodNameFilter->injectLogger($logger); $methodNameFilter->injectReflectionService($this->reflectionService); diff --git a/Neos.Flow/Classes/Aop/Pointcut/RuntimeExpressionEvaluator.php b/Neos.Flow/Classes/Aop/Pointcut/RuntimeExpressionEvaluator.php index 63c0eb0c35..4621ab5484 100644 --- a/Neos.Flow/Classes/Aop/Pointcut/RuntimeExpressionEvaluator.php +++ b/Neos.Flow/Classes/Aop/Pointcut/RuntimeExpressionEvaluator.php @@ -11,6 +11,7 @@ * source code. */ +use Neos\Cache\Frontend\StringFrontend; use Neos\Flow\Annotations as Flow; use Neos\Flow\Aop\JoinPointInterface; use Neos\Flow\Cache\CacheManager; diff --git a/Neos.Flow/Classes/Cli/Response.php b/Neos.Flow/Classes/Cli/Response.php index f4dc4888b8..0fedb619d0 100644 --- a/Neos.Flow/Classes/Cli/Response.php +++ b/Neos.Flow/Classes/Cli/Response.php @@ -47,12 +47,12 @@ class Response private $content = ''; /** - * @var + * @var bool|int */ private $colorSupport; /** - * @var + * @var int */ private $outputFormat = self::OUTPUTFORMAT_STYLED; diff --git a/Neos.Flow/Classes/Command/ConfigurationCommandController.php b/Neos.Flow/Classes/Command/ConfigurationCommandController.php index 616ffea159..801b3aa6cc 100644 --- a/Neos.Flow/Classes/Command/ConfigurationCommandController.php +++ b/Neos.Flow/Classes/Command/ConfigurationCommandController.php @@ -17,8 +17,6 @@ use Neos\Flow\Configuration\ConfigurationManager; use Neos\Flow\Configuration\ConfigurationSchemaValidator; use Neos\Flow\Configuration\Exception\SchemaValidationException; -use Neos\Error\Messages\Error; -use Neos\Error\Messages\Notice; use Neos\Utility\Arrays; use Neos\Utility\SchemaGenerator; @@ -155,7 +153,6 @@ public function validateCommand(string $type = null, string $path = null, bool $ if ($result->hasNotices()) { $notices = $result->getFlattenedNotices(); $this->outputLine('%d notices:', [count($notices)]); - /** @var Notice $notice */ foreach ($notices as $path => $pathNotices) { foreach ($pathNotices as $notice) { $this->outputLine(' - %s -> %s', [$path, $notice->render()]); @@ -168,7 +165,6 @@ public function validateCommand(string $type = null, string $path = null, bool $ if ($result->hasErrors()) { $errors = $result->getFlattenedErrors(); $this->outputLine('%d errors were found:', [count($errors)]); - /** @var Error $error */ foreach ($errors as $path => $pathErrors) { foreach ($pathErrors as $error) { $this->outputLine(' - %s -> %s', [$path, $error->render()]); diff --git a/Neos.Flow/Classes/Command/MiddlewareCommandController.php b/Neos.Flow/Classes/Command/MiddlewareCommandController.php index d54af049aa..c05b0080da 100644 --- a/Neos.Flow/Classes/Command/MiddlewareCommandController.php +++ b/Neos.Flow/Classes/Command/MiddlewareCommandController.php @@ -13,7 +13,6 @@ use Neos\Flow\Annotations as Flow; use Neos\Flow\Cli\CommandController; -use Neos\Flow\Mvc\Routing\Route; use Neos\Utility\PositionalArraySorter; /** @@ -36,7 +35,6 @@ public function listCommand(): void $this->outputLine('Currently configured middlewares:'); $rows = []; $index = 0; - /** @var Route $route */ foreach ($orderedChainConfiguration->toArray() as $middlewareName => $middlewareConfiguration) { $rows[] = [ '#' => ++ $index, diff --git a/Neos.Flow/Classes/Command/ResourceCommandController.php b/Neos.Flow/Classes/Command/ResourceCommandController.php index 5ec0666fa9..dcb2ec7b95 100644 --- a/Neos.Flow/Classes/Command/ResourceCommandController.php +++ b/Neos.Flow/Classes/Command/ResourceCommandController.php @@ -24,7 +24,6 @@ use Neos\Flow\ResourceManagement\ResourceManager; use Neos\Flow\ResourceManagement\ResourceRepository; use Neos\Media\Domain\Repository\AssetRepository; - use Neos\Media\Domain\Repository\ThumbnailRepository; /** @@ -98,6 +97,7 @@ public function publishCommand(string $collection = null) /** @var CollectionInterface $collection */ $this->outputLine('Publishing resources of collection "%s"', [$collection->getName()]); $target = $collection->getTarget(); + /** @phpstan-ignore-next-line will be fixed via https://github.com/neos/flow-development-collection/pull/3229 */ $target->publishCollection($collection, function ($iteration) { $this->clearState($iteration); }); @@ -232,13 +232,13 @@ public function cleanCommand() $assetRepository = class_exists(AssetRepository::class) ? $this->objectManager->get(AssetRepository::class) : null; /* @var ThumbnailRepository|null $thumbnailRepository */ $thumbnailRepository = class_exists(ThumbnailRepository::class) ? $this->objectManager->get(ThumbnailRepository::class) : null; - $mediaPackagePresent = $assetRepository && $thumbnailRepository && $this->packageManager->isPackageAvailable('Neos.Media'); + $mediaPackagePresent = $this->packageManager->isPackageAvailable('Neos.Media'); if (count($brokenResources) > 0) { foreach ($brokenResources as $key => $resourceIdentifier) { $resource = $this->resourceRepository->findByIdentifier($resourceIdentifier); $brokenResources[$key] = $resource; - if ($mediaPackagePresent) { + if ($mediaPackagePresent && $assetRepository !== null && $thumbnailRepository !== null) { $assets = $assetRepository->findByResource($resource); if ($assets !== null) { $relatedAssets[$resource] = $assets; @@ -280,7 +280,7 @@ public function cleanCommand() ]); $resource->disableLifecycleEvents(); $this->resourceRepository->remove($resource); - if ($mediaPackagePresent) { + if ($mediaPackagePresent && $assetRepository !== null && $thumbnailRepository !== null) { if (isset($relatedAssets[$resource])) { foreach ($relatedAssets[$resource] as $asset) { $assetRepository->removeWithoutUsageChecks($asset); diff --git a/Neos.Flow/Classes/Command/SchemaCommandController.php b/Neos.Flow/Classes/Command/SchemaCommandController.php index 48dafb094d..de65a5026a 100644 --- a/Neos.Flow/Classes/Command/SchemaCommandController.php +++ b/Neos.Flow/Classes/Command/SchemaCommandController.php @@ -15,8 +15,6 @@ use Neos\Flow\Annotations as Flow; use Neos\Flow\Package\PackageManager; use Neos\Flow\Cli\CommandController; -use Neos\Error\Messages\Error; -use Neos\Error\Messages\Notice; use Neos\Utility\SchemaValidator; use Symfony\Component\Yaml\Yaml; use Neos\Utility\Files; @@ -80,7 +78,6 @@ public function validateCommand(string $configurationFile = null, string $schema if ($result->hasNotices()) { $notices = $result->getFlattenedNotices(); $this->outputLine('%d notices:', [count($notices)]); - /** @var Notice $notice */ foreach ($notices as $path => $pathNotices) { foreach ($pathNotices as $notice) { $this->outputLine(' - %s -> %s', [$path, $notice->render()]); @@ -93,7 +90,6 @@ public function validateCommand(string $configurationFile = null, string $schema if ($result->hasErrors()) { $errors = $result->getFlattenedErrors(); $this->outputLine('%d errors were found:', [count($errors)]); - /** @var Error $error */ foreach ($errors as $path => $pathErrors) { foreach ($pathErrors as $error) { $this->outputLine(' - %s -> %s', [$path, $error->render()]); diff --git a/Neos.Flow/Classes/Core/Booting/Scripts.php b/Neos.Flow/Classes/Core/Booting/Scripts.php index 9b352de3c6..8123cd3f1f 100644 --- a/Neos.Flow/Classes/Core/Booting/Scripts.php +++ b/Neos.Flow/Classes/Core/Booting/Scripts.php @@ -41,6 +41,7 @@ use Neos\Flow\ObjectManagement\ObjectManager; use Neos\Flow\ObjectManagement\ObjectManagerInterface; use Neos\Flow\Package\FlowPackageInterface; +use Neos\Flow\Package\GenericPackage; use Neos\Flow\Package\PackageManager; use Neos\Flow\Reflection\ReflectionService; use Neos\Flow\Reflection\ReflectionServiceFactory; @@ -577,8 +578,10 @@ public static function initializeSystemFileMonitor(Bootstrap $bootstrap) if (!in_array($packageKey, $packagesWithConfiguredObjects)) { continue; } - foreach ($package->getAutoloadPaths() as $autoloadPath) { - self::monitorDirectoryIfItExists($fileMonitors['Flow_ClassFiles'], $autoloadPath, '\.php$'); + if ($package instanceof GenericPackage) { + foreach ($package->getAutoloadPaths() as $autoloadPath) { + self::monitorDirectoryIfItExists($fileMonitors['Flow_ClassFiles'], $autoloadPath, '\.php$'); + } } // Note that getFunctionalTestsPath is currently not part of any interface... We might want to add it or find a better way. @@ -602,8 +605,10 @@ public static function initializeSystemFileMonitor(Bootstrap $bootstrap) */ protected static function getListOfPackagesWithConfiguredObjects(Bootstrap $bootstrap): array { - $objectManager = $bootstrap->getEarlyInstance(ObjectManagerInterface::class); - $packagesWithConfiguredObjects = array_reduce($objectManager->getAllObjectConfigurations(), function ($foundPackages, $item) { + $objectManager = $bootstrap->getObjectManager(); + /** @phpstan-ignore-next-line the object manager interface doesn't specify this method */ + $allObjectConfigurations = $objectManager->getAllObjectConfigurations(); + $packagesWithConfiguredObjects = array_reduce($allObjectConfigurations, function ($foundPackages, $item) { if (isset($item['p']) && !in_array($item['p'], $foundPackages)) { $foundPackages[] = $item['p']; } diff --git a/Neos.Flow/Classes/Http/Client/InternalRequestEngine.php b/Neos.Flow/Classes/Http/Client/InternalRequestEngine.php index 5d9b6fe00b..67e83c28c8 100644 --- a/Neos.Flow/Classes/Http/Client/InternalRequestEngine.php +++ b/Neos.Flow/Classes/Http/Client/InternalRequestEngine.php @@ -126,11 +126,12 @@ public function sendRequest(RequestInterface $httpRequest): ResponseInterface } $requestHandler = $this->bootstrap->getActiveRequestHandler(); - /** @phpstan-ignore-next-line */ + /** @phpstan-ignore-next-line composer doesnt autoload this class */ if (!$requestHandler instanceof FunctionalTestRequestHandler) { throw new Http\Exception('The browser\'s internal request engine has only been designed for use within functional tests.', 1335523749); } + /** @phpstan-ignore-next-line composer doesnt autoload this class */ $requestHandler->setHttpRequest($httpRequest); $this->securityContext->clearContext(); $this->validatorResolver->reset(); @@ -142,6 +143,7 @@ public function sendRequest(RequestInterface $httpRequest): ResponseInterface */ $middlewaresChain = $objectManager->get(Http\Middleware\MiddlewaresChain::class); $middlewaresChain->onStep(function (ServerRequestInterface $request) use ($requestHandler) { + /** @phpstan-ignore-next-line composer doesnt autoload this class */ $requestHandler->setHttpRequest($request); }); diff --git a/Neos.Flow/Classes/I18n/Xliff/Service/XliffReader.php b/Neos.Flow/Classes/I18n/Xliff/Service/XliffReader.php index 01d70f9949..46c176dc6d 100644 --- a/Neos.Flow/Classes/I18n/Xliff/Service/XliffReader.php +++ b/Neos.Flow/Classes/I18n/Xliff/Service/XliffReader.php @@ -39,6 +39,7 @@ public function readFiles($sourcePath, callable $iterator) $reader->open($sourcePath); $reader->read(); + /** @var object|\XMLReader $reader the stubs for XMLReader are wrong https://github.com/phpstan/phpstan/issues/8629 */ if ($reader->nodeType == \XMLReader::ELEMENT && $reader->name === 'xliff') { $version = $reader->getAttribute('version'); $result = true; @@ -66,6 +67,7 @@ public function readFiles($sourcePath, callable $iterator) */ protected function isFileNode(\XMLReader $reader) { + /** @var object|\XMLReader $reader the stubs for XMLReader are wrong https://github.com/phpstan/phpstan/issues/8629 */ return $reader->nodeType === \XMLReader::ELEMENT && $reader->name === 'file'; } } diff --git a/Neos.Flow/Classes/Log/ThrowableStorage/FileStorage.php b/Neos.Flow/Classes/Log/ThrowableStorage/FileStorage.php index 87f41852af..c20b65b99c 100644 --- a/Neos.Flow/Classes/Log/ThrowableStorage/FileStorage.php +++ b/Neos.Flow/Classes/Log/ThrowableStorage/FileStorage.php @@ -266,7 +266,6 @@ protected function cleanupThrowableDumps(): void if ($this->maximumThrowableDumpAge > 0) { $cutoffTime = time() - $this->maximumThrowableDumpAge; - /** @var \SplFileInfo $directoryEntry */ $iterator = new \DirectoryIterator($this->storagePath); foreach ($iterator as $directoryEntry) { if ($directoryEntry->isFile() && $directoryEntry->getCTime() < $cutoffTime) { diff --git a/Neos.Flow/Classes/Mvc/Controller/Arguments.php b/Neos.Flow/Classes/Mvc/Controller/Arguments.php index 031c9d2618..f1206c7ed6 100644 --- a/Neos.Flow/Classes/Mvc/Controller/Arguments.php +++ b/Neos.Flow/Classes/Mvc/Controller/Arguments.php @@ -18,7 +18,7 @@ * A composite of controller arguments * * @api - * @extends \ArrayObject + * @extends \ArrayObject */ class Arguments extends \ArrayObject { diff --git a/Neos.Flow/Classes/Mvc/Routing/ObjectPathMappingRepository.php b/Neos.Flow/Classes/Mvc/Routing/ObjectPathMappingRepository.php index 1ae53cec15..e6eabd2b5a 100644 --- a/Neos.Flow/Classes/Mvc/Routing/ObjectPathMappingRepository.php +++ b/Neos.Flow/Classes/Mvc/Routing/ObjectPathMappingRepository.php @@ -96,6 +96,7 @@ public function persistEntities() { foreach ($this->entityManager->getUnitOfWork()->getIdentityMap() as $className => $entities) { if ($className === $this->entityClassName) { + /** @phpstan-ignore-next-line we pass an optional parameter, which is not part of the interface */ $this->entityManager->flush($entities); return; } diff --git a/Neos.Flow/Classes/Mvc/Routing/Route.php b/Neos.Flow/Classes/Mvc/Routing/Route.php index 3a12aa0368..2f60eedc2a 100644 --- a/Neos.Flow/Classes/Mvc/Routing/Route.php +++ b/Neos.Flow/Classes/Mvc/Routing/Route.php @@ -141,14 +141,14 @@ class Route /** * Container for Route Parts. * - * @var array + * @var array */ protected $routeParts = []; /** * If not empty only the specified HTTP verbs are accepted by this route * - * @var array non-associative array e.g. array('GET', 'POST') + * @var list non-associative array e.g. array('GET', 'POST') */ protected $httpMethods = []; @@ -459,7 +459,6 @@ public function matches(RouteContext $routeContext) $routePath = trim($routePath, '/'); $skipOptionalParts = false; $optionalPartCount = 0; - /** @var $routePart RoutePartInterface */ foreach ($this->routeParts as $routePart) { if ($routePart->isOptional()) { $optionalPartCount++; @@ -543,7 +542,6 @@ public function resolves(ResolveContext $resolveContext) $requireOptionalRouteParts = false; $matchingOptionalUriPortion = ''; $routeValues = $resolveContext->getRouteValues(); - /** @var $routePart RoutePartInterface */ foreach ($this->routeParts as $routePart) { if ($routePart instanceof ParameterAwareRoutePartInterface) { $resolveResult = $routePart->resolveWithParameters($routeValues, $resolveContext->getParameters()); @@ -738,7 +736,7 @@ public function parse() $matches = []; preg_match_all(self::PATTERN_EXTRACTROUTEPARTS, $this->uriPattern, $matches, PREG_SET_ORDER); - /** @var $lastRoutePart RoutePartInterface */ + /** @var RoutePartInterface|null $lastRoutePart */ $lastRoutePart = null; foreach ($matches as $match) { $routePartType = empty($match['dynamic']) ? self::ROUTEPART_TYPE_STATIC : self::ROUTEPART_TYPE_DYNAMIC; diff --git a/Neos.Flow/Classes/Mvc/Routing/Router.php b/Neos.Flow/Classes/Mvc/Routing/Router.php index 453ce03755..44e431b39c 100644 --- a/Neos.Flow/Classes/Mvc/Routing/Router.php +++ b/Neos.Flow/Classes/Mvc/Routing/Router.php @@ -62,7 +62,7 @@ class Router implements RouterInterface /** * Array of routes to match against * - * @var array + * @var array */ protected $routes = []; @@ -127,7 +127,6 @@ public function route(RouteContext $routeContext): array $this->createRoutesFromConfiguration(); $httpRequest = $routeContext->getHttpRequest(); - /** @var $route Route */ foreach ($this->routes as $route) { if ($route->matches($routeContext) === true) { $this->lastMatchedRoute = $route; @@ -196,7 +195,6 @@ public function resolve(ResolveContext $resolveContext): UriInterface $this->createRoutesFromConfiguration(); - /** @var $route Route */ foreach ($this->routes as $route) { if ($route->resolves($resolveContext) === true) { $uriConstraints = $route->getResolvedUriConstraints()->withPathPrefix($resolveContext->getUriPathPrefix()); diff --git a/Neos.Flow/Classes/Package.php b/Neos.Flow/Classes/Package.php index 8cc9b57568..b69f7dd552 100644 --- a/Neos.Flow/Classes/Package.php +++ b/Neos.Flow/Classes/Package.php @@ -55,7 +55,7 @@ public function boot(Core\Bootstrap $bootstrap) } if ($context->isTesting()) { - /** @phpstan-ignore-next-line */ + /** @phpstan-ignore-next-line composer doesnt autoload this class */ $bootstrap->registerRequestHandler(new Tests\FunctionalTestRequestHandler($bootstrap)); } @@ -133,7 +133,7 @@ public function boot(Core\Bootstrap $bootstrap) } }); - /** @phpstan-ignore-next-line */ + /** @phpstan-ignore-next-line composer doesnt autoload this class */ $dispatcher->connect(Tests\FunctionalTestCase::class, 'functionalTestTearDown', Mvc\Routing\RouterCachingService::class, 'flushCaches'); $dispatcher->connect(Configuration\ConfigurationManager::class, 'configurationManagerReady', function (Configuration\ConfigurationManager $configurationManager) { diff --git a/Neos.Flow/Classes/Package/PackageManager.php b/Neos.Flow/Classes/Package/PackageManager.php index 593cdb41df..f724e10179 100644 --- a/Neos.Flow/Classes/Package/PackageManager.php +++ b/Neos.Flow/Classes/Package/PackageManager.php @@ -289,7 +289,6 @@ public function getFilteredPackages($packageState = 'available', $packageType = protected function filterPackagesByType($packages, $packageType): array { $filteredPackages = []; - /** @var $package Package */ foreach ($packages as $package) { if ($package->getComposerManifest('type') === $packageType) { $filteredPackages[$package->getPackageKey()] = $package; @@ -622,7 +621,7 @@ protected function scanAvailablePackages(): array protected function findComposerPackagesInPath(string $startingDirectory): \Generator { $directories = new \DirectoryIterator($startingDirectory); - /** @var \SplFileInfo $fileInfo */ + /** @var \DirectoryIterator $fileInfo */ foreach ($directories as $fileInfo) { if ($fileInfo->isDot()) { continue; diff --git a/Neos.Flow/Classes/Persistence/Aspect/PersistenceMagicAspect.php b/Neos.Flow/Classes/Persistence/Aspect/PersistenceMagicAspect.php index fd8737cb59..60c77bc3e1 100644 --- a/Neos.Flow/Classes/Persistence/Aspect/PersistenceMagicAspect.php +++ b/Neos.Flow/Classes/Persistence/Aspect/PersistenceMagicAspect.php @@ -94,7 +94,7 @@ public function initializeObject() */ public function generateUuid(JoinPointInterface $joinPoint) { - /** @var $proxy PersistenceMagicInterface */ + /** @var PersistenceMagicInterface $proxy */ $proxy = $joinPoint->getProxy(); ObjectAccess::setProperty($proxy, 'Persistence_Object_Identifier', Algorithms::generateUUID(), true); $this->persistenceManager->registerNewObject($proxy); @@ -153,6 +153,7 @@ public function generateValueHash(JoinPointInterface $joinPoint) */ public function cloneObject(JoinPointInterface $joinPoint) { + /** @phpstan-ignore-next-line will be removed with https://github.com/neos/flow-development-collection/pull/3223 */ $joinPoint->getProxy()->Flow_Persistence_clone = true; } } diff --git a/Neos.Flow/Classes/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriver.php b/Neos.Flow/Classes/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriver.php index 7c21db05ed..4dac159c2e 100644 --- a/Neos.Flow/Classes/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriver.php +++ b/Neos.Flow/Classes/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriver.php @@ -249,9 +249,11 @@ public function loadMetadataForClass($className, ClassMetadata $metadata) if ($tableAnnotation->uniqueConstraints !== null) { foreach ($tableAnnotation->uniqueConstraints as $uniqueConstraint) { $uniqueConstraint = ['columns' => $uniqueConstraint->columns]; + /** @phpstan-ignore-next-line seperate fix in https://github.com/neos/flow-development-collection/pull/3263 */ if (!empty($uniqueConstraint->options)) { $uniqueConstraint['options'] = $uniqueConstraint->options; } + /** @phpstan-ignore-next-line seperate fix in https://github.com/neos/flow-development-collection/pull/3263 */ if (!empty($uniqueConstraint->name)) { $primaryTable['uniqueConstraints'][$uniqueConstraint->name] = $uniqueConstraint; } else { @@ -915,7 +917,6 @@ protected function evaluateJoinColumnAnnotations(\ReflectionProperty $property) { $joinColumns = []; - /** @var ORM\JoinColumn $joinColumnAnnotation */ if ($joinColumnAnnotation = $this->reader->getPropertyAnnotation($property, ORM\JoinColumn::class)) { $joinColumns[] = $this->joinColumnToArray($joinColumnAnnotation, strtolower($property->getName())); } elseif ($joinColumnsAnnotation = $this->reader->getPropertyAnnotation($property, ORM\JoinColumns::class)) { diff --git a/Neos.Flow/Classes/Persistence/Doctrine/Query.php b/Neos.Flow/Classes/Persistence/Doctrine/Query.php index 4d54d6a9a1..795fd52f9d 100644 --- a/Neos.Flow/Classes/Persistence/Doctrine/Query.php +++ b/Neos.Flow/Classes/Persistence/Doctrine/Query.php @@ -685,7 +685,7 @@ protected function getPropertyNameWithAlias($propertyPath) /** * Return the SQL statements representing this Query. * - * @return array + * @return string */ public function getSql() { diff --git a/Neos.Flow/Classes/Persistence/Doctrine/Repository.php b/Neos.Flow/Classes/Persistence/Doctrine/Repository.php index d9c35b5032..f940d5840d 100644 --- a/Neos.Flow/Classes/Persistence/Doctrine/Repository.php +++ b/Neos.Flow/Classes/Persistence/Doctrine/Repository.php @@ -67,12 +67,12 @@ abstract class Repository extends EntityRepository implements RepositoryInterfac public function __construct(EntityManagerInterface $entityManager, ClassMetadata $classMetadata = null) { if ($classMetadata === null) { - /** @var class-string $objectType */ if (defined('static::ENTITY_CLASSNAME') === false) { $objectType = preg_replace(['/\\\Repository\\\/', '/Repository$/'], ['\\Model\\', ''], get_class($this)); } else { $objectType = static::ENTITY_CLASSNAME; } + /** @var class-string $objectType */ $this->objectType = $objectType; $classMetadata = $entityManager->getClassMetadata($this->objectType); } diff --git a/Neos.Flow/Classes/Persistence/Doctrine/Service.php b/Neos.Flow/Classes/Persistence/Doctrine/Service.php index e8c406d6e0..f7a10ca1b8 100644 --- a/Neos.Flow/Classes/Persistence/Doctrine/Service.php +++ b/Neos.Flow/Classes/Persistence/Doctrine/Service.php @@ -571,7 +571,6 @@ private function mark(OutputInterface $output, Version $version, bool $all, Exec * Returns the current migration status as an array. * * @return array - * @return DependencyFactory * @throws DBALException */ public function getMigrationStatus(): array diff --git a/Neos.Flow/Classes/Persistence/Repository.php b/Neos.Flow/Classes/Persistence/Repository.php index f569009567..cea6418226 100644 --- a/Neos.Flow/Classes/Persistence/Repository.php +++ b/Neos.Flow/Classes/Persistence/Repository.php @@ -45,12 +45,12 @@ abstract class Repository implements RepositoryInterface */ public function __construct() { - /** @var class-string $entityClassName */ if (defined('static::ENTITY_CLASSNAME') === false) { $entityClassName = preg_replace(['/\\\Repository\\\/', '/Repository$/'], ['\\Model\\', ''], get_class($this)); } else { $entityClassName = static::ENTITY_CLASSNAME; } + /** @var class-string $entityClassName */ $this->entityClassName = $entityClassName; } diff --git a/Neos.Flow/Classes/Property/PropertyMappingConfiguration.php b/Neos.Flow/Classes/Property/PropertyMappingConfiguration.php index efef2acd18..ffc1fb167a 100644 --- a/Neos.Flow/Classes/Property/PropertyMappingConfiguration.php +++ b/Neos.Flow/Classes/Property/PropertyMappingConfiguration.php @@ -14,6 +14,7 @@ /** * Concrete configuration object for the PropertyMapper. * + * @phpstan-consistent-constructor * @api */ class PropertyMappingConfiguration implements PropertyMappingConfigurationInterface @@ -36,7 +37,7 @@ class PropertyMappingConfiguration implements PropertyMappingConfigurationInterf /** * Stores the configuration for specific child properties. * - * @var array + * @var array */ protected $subConfigurationForProperty = []; @@ -87,6 +88,10 @@ class PropertyMappingConfiguration implements PropertyMappingConfigurationInterf */ protected $mapUnknownProperties = false; + public function __construct() + { + } + /** * The behavior is as follows: * @@ -361,11 +366,10 @@ public function traverseProperties(array $splittedPropertyPath) $currentProperty = array_shift($splittedPropertyPath); if (!isset($this->subConfigurationForProperty[$currentProperty])) { - $type = get_class($this); if (isset($this->subConfigurationForProperty[self::PROPERTY_PATH_PLACEHOLDER])) { $this->subConfigurationForProperty[$currentProperty] = clone $this->subConfigurationForProperty[self::PROPERTY_PATH_PLACEHOLDER]; } else { - $this->subConfigurationForProperty[$currentProperty] = new $type; + $this->subConfigurationForProperty[$currentProperty] = new static(); } } return $this->subConfigurationForProperty[$currentProperty]->traverseProperties($splittedPropertyPath); diff --git a/Neos.Flow/Classes/Reflection/ParameterReflection.php b/Neos.Flow/Classes/Reflection/ParameterReflection.php index c14b996c39..94c560aac0 100644 --- a/Neos.Flow/Classes/Reflection/ParameterReflection.php +++ b/Neos.Flow/Classes/Reflection/ParameterReflection.php @@ -48,7 +48,7 @@ public function getClass(): ?ClassReflection return null; } - return is_object($class) && !$class->isBuiltin() ? new ClassReflection($class->getName()) : null; + return is_object($class) && $class instanceof \ReflectionNamedType && !$class->isBuiltin() ? new ClassReflection($class->getName()) : null; } /** diff --git a/Neos.Flow/Classes/Reflection/ReflectionService.php b/Neos.Flow/Classes/Reflection/ReflectionService.php index 12d310a005..40d8a0ae30 100644 --- a/Neos.Flow/Classes/Reflection/ReflectionService.php +++ b/Neos.Flow/Classes/Reflection/ReflectionService.php @@ -248,6 +248,7 @@ public function setStatusCache(StringFrontend $cache) $this->statusCache = $cache; $backend = $this->statusCache->getBackend(); if (is_callable(['initializeObject', $backend])) { + /** @phpstan-ignore-next-line will be refactored with neos 9 */ $backend->initializeObject(); } } @@ -1282,12 +1283,10 @@ protected function reflectClass($className) $this->classReflectionData[$className][self::DATA_CLASS_FINAL] = true; } - /** @var $parentClass ClassReflection */ foreach ($this->getParentClasses($class) as $parentClass) { $this->addParentClass($className, $parentClass); } - /** @var $interface ClassReflection */ foreach ($class->getInterfaces() as $interface) { $this->addImplementedInterface($className, $interface); } @@ -1308,7 +1307,6 @@ protected function reflectClass($className) } } - /** @var $property PropertyReflection */ foreach ($class->getProperties() as $property) { $this->reflectClassProperty($className, $property); } @@ -1877,6 +1875,7 @@ protected function convertParameterReflectionToArray(ParameterReflection $parame $parameterInformation[self::DATA_PARAMETER_ALLOWS_NULL] = true; } + /** @var \ReflectionNamedType|\ReflectionUnionType|\ReflectionIntersectionType|null $parameterType */ $parameterType = $parameter->getType(); if ($parameterType !== null) { if ($parameterType instanceof \ReflectionUnionType) { @@ -1940,7 +1939,6 @@ static function (\ReflectionNamedType $type) { protected function forgetChangedClasses() { $frozenNamespaces = []; - /** @var $package Package */ foreach ($this->packageManager->getAvailablePackages() as $packageKey => $package) { if ($this->packageManager->isPackageFrozen($packageKey)) { $frozenNamespaces = array_merge($frozenNamespaces, $package->getNamespaces()); @@ -2259,7 +2257,9 @@ protected function saveProductionData() $this->reflectionDataRuntimeCache->set('__classNames', $classNames); $this->reflectionDataRuntimeCache->set('__annotatedClasses', $this->annotatedClasses); + /** @phpstan-ignore-next-line will be refactored with neos 9 */ $this->reflectionDataRuntimeCache->getBackend()->freeze(); + /** @phpstan-ignore-next-line will be refactored with neos 9 */ $this->classSchemataRuntimeCache->getBackend()->freeze(); $this->log(sprintf('Built and froze reflection runtime caches (%s classes).', count($this->classReflectionData)), LogLevel::INFO); @@ -2343,6 +2343,7 @@ protected function getPrecompiledReflectionStoragePath() */ protected function hasFrozenCacheInProduction() { + /** @phpstan-ignore-next-line will be refactored with neos 9 */ return $this->environment->getContext()->isProduction() && $this->reflectionDataRuntimeCache->getBackend()->isFrozen(); } } diff --git a/Neos.Flow/Classes/ResourceManagement/Collection.php b/Neos.Flow/Classes/ResourceManagement/Collection.php index 40ac1677a1..281e9ba1fe 100644 --- a/Neos.Flow/Classes/ResourceManagement/Collection.php +++ b/Neos.Flow/Classes/ResourceManagement/Collection.php @@ -164,6 +164,7 @@ public function getObjects(callable $callback = null) } } } else { + /** @phpstan-ignore-next-line will be fixed via https://github.com/neos/flow-development-collection/pull/3229 */ yield from $this->storage->getObjectsByCollection($this, $callback); } diff --git a/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php b/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php index 5541935707..af71858c29 100644 --- a/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php +++ b/Neos.Flow/Classes/ResourceManagement/Target/FileSystemTarget.php @@ -197,6 +197,7 @@ public function publishCollection(CollectionInterface $collection, callable $cal { $storage = $collection->getStorage(); $this->checkAndRemovePackageSymlinks($storage); + /** @phpstan-ignore-next-line will be fixed via https://github.com/neos/flow-development-collection/pull/3229 */ foreach ($collection->getObjects($callback) as $object) { /** @var StorageObject $object */ $sourceStream = $object->getStream(); diff --git a/Neos.Flow/Classes/Security/Authentication/AuthenticationProviderManager.php b/Neos.Flow/Classes/Security/Authentication/AuthenticationProviderManager.php index f5387d229f..8607ccaddd 100644 --- a/Neos.Flow/Classes/Security/Authentication/AuthenticationProviderManager.php +++ b/Neos.Flow/Classes/Security/Authentication/AuthenticationProviderManager.php @@ -147,9 +147,7 @@ public function authenticate(): void $session = $this->sessionManager->getCurrentSession(); - /** @var $token TokenInterface */ foreach ($tokens as $token) { - /** @var $provider AuthenticationProviderInterface */ foreach ($this->tokenAndProviderFactory->getProviders() as $provider) { if ($provider->canAuthenticate($token) && $token->getAuthenticationStatus() === TokenInterface::AUTHENTICATION_NEEDED) { $provider->authenticate($token); @@ -226,7 +224,6 @@ public function logout(): void $this->isAuthenticated = null; $session = $this->sessionManager->getCurrentSession(); - /** @var $token TokenInterface */ foreach ($this->securityContext->getAuthenticationTokens() as $token) { $token->setAuthenticationStatus(TokenInterface::NO_CREDENTIALS_GIVEN); } diff --git a/Neos.Flow/Classes/Security/Authentication/AuthenticationProviderResolver.php b/Neos.Flow/Classes/Security/Authentication/AuthenticationProviderResolver.php index 5fe3e15aff..d04def1887 100644 --- a/Neos.Flow/Classes/Security/Authentication/AuthenticationProviderResolver.php +++ b/Neos.Flow/Classes/Security/Authentication/AuthenticationProviderResolver.php @@ -41,7 +41,7 @@ public function __construct(ObjectManagerInterface $objectManager) * Resolves the class name of an authentication provider. If a valid provider class name is given, it is just returned. * * @param string $providerName The (short) name of the provider - * @return string The object name of the authentication provider + * @return class-string The object name of the authentication provider * @throws NoAuthenticationProviderFoundException */ public function resolveProviderClass($providerName) diff --git a/Neos.Flow/Classes/Security/Authentication/Provider/PersistedUsernamePasswordProvider.php b/Neos.Flow/Classes/Security/Authentication/Provider/PersistedUsernamePasswordProvider.php index 7f31e17e3c..4e94364393 100644 --- a/Neos.Flow/Classes/Security/Authentication/Provider/PersistedUsernamePasswordProvider.php +++ b/Neos.Flow/Classes/Security/Authentication/Provider/PersistedUsernamePasswordProvider.php @@ -86,7 +86,7 @@ public function authenticate(TokenInterface $authenticationToken) throw new UnsupportedAuthenticationTokenException(sprintf('This provider cannot authenticate the given token. The token must implement %s', UsernamePasswordTokenInterface::class), 1217339840); } - /** @var $account Account */ + /** @var Account|null $account */ $account = null; if ($authenticationToken->getAuthenticationStatus() !== TokenInterface::AUTHENTICATION_SUCCESSFUL) { diff --git a/Neos.Flow/Classes/Security/Authentication/TokenAndProviderFactory.php b/Neos.Flow/Classes/Security/Authentication/TokenAndProviderFactory.php index 4bb3885a78..4fe716176e 100644 --- a/Neos.Flow/Classes/Security/Authentication/TokenAndProviderFactory.php +++ b/Neos.Flow/Classes/Security/Authentication/TokenAndProviderFactory.php @@ -150,7 +150,7 @@ protected function buildProvidersAndTokensFromConfiguration() if (!$providerConfiguration) { continue; } - + if (!is_array($providerConfiguration) || !isset($providerConfiguration['provider'])) { throw new Exception\InvalidAuthenticationProviderException('The configured authentication provider "' . $providerName . '" needs a "provider" option!', 1248209521); } @@ -164,17 +164,15 @@ protected function buildProvidersAndTokensFromConfiguration() $providerOptions = $providerConfiguration['providerOptions']; } - /** @var $providerInstance AuthenticationProviderInterface */ + /** @var AuthenticationProviderInterface $providerInstance */ $providerInstance = $providerObjectName::create($providerName, $providerOptions); $this->providers[$providerName] = $providerInstance; - /** @var $tokenInstance TokenInterface */ $tokenInstance = null; foreach ($providerInstance->getTokenClassNames() as $tokenClassName) { if (isset($providerConfiguration['token'])) { $tokenClassName = $this->tokenResolver->resolveTokenClass((string)$providerConfiguration['token']); } - /** @noinspection PhpMethodParametersCountMismatchInspection */ $tokenInstance = $this->objectManager->get($tokenClassName, $providerConfiguration['tokenOptions'] ?? []); if (!$tokenInstance instanceof TokenInterface) { throw new Exception\InvalidAuthenticationProviderException(sprintf('The specified token is not an instance of %s but a %s. Please adjust the "token" configuration of the "%s" authentication provider', TokenInterface::class, is_object($tokenInstance) ? get_class($tokenInstance) : gettype($tokenInstance), $providerName), 1585921152); @@ -221,7 +219,7 @@ protected function buildProvidersAndTokensFromConfiguration() throw new Exception\NoEntryPointFoundException('An entry point with the name: "' . $entryPointName . '" could not be resolved. Make sure it is a valid class name, either fully qualified or relative to Neos\Flow\Security\Authentication\EntryPoint!', 1236767282); } - /** @var $entryPoint EntryPointInterface */ + /** @var EntryPointInterface $entryPoint */ $entryPoint = new $entryPointClassName(); if (isset($providerConfiguration['entryPointOptions'])) { $entryPoint->setOptions($providerConfiguration['entryPointOptions']); diff --git a/Neos.Flow/Classes/Security/Authentication/TokenInterface.php b/Neos.Flow/Classes/Security/Authentication/TokenInterface.php index 6d0567bce1..e3a6246454 100644 --- a/Neos.Flow/Classes/Security/Authentication/TokenInterface.php +++ b/Neos.Flow/Classes/Security/Authentication/TokenInterface.php @@ -12,6 +12,7 @@ */ use Neos\Flow\Mvc\ActionRequest; use Neos\Flow\Security\Account; +use Neos\Flow\Security\RequestPatternInterface; /** * Contract for an authentication token. @@ -110,7 +111,7 @@ public function setRequestPatterns(array $requestPatterns); /** * Returns an array of set \Neos\Flow\Security\RequestPatternInterface, NULL if none was set * - * @return array Array of set request patterns + * @return array Array of set request patterns * @see hasRequestPattern() */ public function getRequestPatterns(); diff --git a/Neos.Flow/Classes/Security/Authorization/FilterFirewall.php b/Neos.Flow/Classes/Security/Authorization/FilterFirewall.php index 1d7bcc2054..1d2bc80d53 100644 --- a/Neos.Flow/Classes/Security/Authorization/FilterFirewall.php +++ b/Neos.Flow/Classes/Security/Authorization/FilterFirewall.php @@ -112,7 +112,7 @@ protected function createFilterFromConfiguration(array $filterConfiguration): Re $patternClassName = $this->requestPatternResolver->resolveRequestPatternClass($patternType); $patternOptions = isset($filterConfiguration['patternOptions']) ? $filterConfiguration['patternOptions'] : []; - /** @var $requestPattern RequestPatternInterface */ + /** @var RequestPatternInterface $requestPattern */ $requestPattern = $this->objectManager->get($patternClassName, $patternOptions); /** @var InterceptorInterface $interceptor */ diff --git a/Neos.Flow/Classes/Security/Authorization/Privilege/Entity/Doctrine/PropertyConditionGenerator.php b/Neos.Flow/Classes/Security/Authorization/Privilege/Entity/Doctrine/PropertyConditionGenerator.php index d94f5dec4d..4f58ce339f 100644 --- a/Neos.Flow/Classes/Security/Authorization/Privilege/Entity/Doctrine/PropertyConditionGenerator.php +++ b/Neos.Flow/Classes/Security/Authorization/Privilege/Entity/Doctrine/PropertyConditionGenerator.php @@ -11,6 +11,7 @@ * source code. */ +use Doctrine\ORM\Mapping\ClassMetadataInfo; use Doctrine\Persistence\Mapping\ClassMetadata; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Mapping\QuoteStrategy; @@ -258,7 +259,7 @@ public function getSql(DoctrineSqlFilter $sqlFilter, ClassMetadata $targetEntity /** * @param DoctrineSqlFilter $sqlFilter * @param QuoteStrategy $quoteStrategy - * @param ClassMetadata $targetEntity + * @param ClassMetadataInfo $targetEntity * @param string $targetTableAlias * @param string $targetEntityPropertyName * @return string @@ -272,7 +273,7 @@ protected function getSqlForPropertyContains(DoctrineSqlFilter $sqlFilter, Quote } if (is_array($this->operandDefinition)) { - throw new InvalidQueryRewritingConstraintException('Multivalued properties with "contains" cannot have a multivalued operand! Got: "' . $this->path . ' ' . $this->operator . ' ' . $this->operandDefinition . '"', 1545145424); + throw new InvalidQueryRewritingConstraintException('Multivalued properties with "contains" cannot have a multivalued operand! Got: "' . $this->path . ' ' . $this->operator . ' ' . json_encode($this->operandDefinition) . '"', 1545145424); } $associationMapping = $targetEntity->getAssociationMapping($targetEntityPropertyName); @@ -345,7 +346,7 @@ protected function getSqlForSimpleProperty(DoctrineSqlFilter $sqlFilter, QuoteSt /** * @param DoctrineSqlFilter $sqlFilter * @param QuoteStrategy $quoteStrategy - * @param ClassMetadata $targetEntity + * @param ClassMetadataInfo $targetEntity * @param string $targetTableAlias * @param string $targetEntityPropertyName * @return string @@ -390,7 +391,7 @@ protected function getSqlForManyToOneAndOneToOneRelationsWithoutPropertyPath(Doc /** * @param DoctrineSqlFilter $sqlFilter * @param QuoteStrategy $quoteStrategy - * @param ClassMetadata $targetEntity + * @param ClassMetadataInfo $targetEntity * @param string $targetTableAlias * @param string $targetEntityPropertyName * @return string @@ -471,12 +472,12 @@ protected function getSubselectQuery(ClassMetadata $targetEntity, $targetEntityP } /** - * @param SQLFilter $sqlFilter + * @param DoctrineSqlFilter $sqlFilter * @param string $propertyPointer * @param string $operandDefinition * @return string */ - protected function getConstraintStringForSimpleProperty(SQLFilter $sqlFilter, $propertyPointer, $operandDefinition = null) + protected function getConstraintStringForSimpleProperty(DoctrineSqlFilter $sqlFilter, $propertyPointer, $operandDefinition = null) { $operandDefinition = ($operandDefinition === null ? $this->operandDefinition : $operandDefinition); $parameter = null; diff --git a/Neos.Flow/Classes/Security/Authorization/PrivilegeManagerInterface.php b/Neos.Flow/Classes/Security/Authorization/PrivilegeManagerInterface.php index d203b1771e..da5b738c16 100644 --- a/Neos.Flow/Classes/Security/Authorization/PrivilegeManagerInterface.php +++ b/Neos.Flow/Classes/Security/Authorization/PrivilegeManagerInterface.php @@ -11,7 +11,7 @@ * source code. */ -use Neos\Flow\Annotations as Flow; +use Neos\Flow\Security\Policy\Role; /** * Contract for a privilege manager diff --git a/Neos.Flow/Classes/Security/Context.php b/Neos.Flow/Classes/Security/Context.php index 867db77353..034c0234f4 100644 --- a/Neos.Flow/Classes/Security/Context.php +++ b/Neos.Flow/Classes/Security/Context.php @@ -418,7 +418,6 @@ public function getRoles() $this->roles['Neos.Flow:AuthenticatedUser'] = $this->policyService->getRole('Neos.Flow:AuthenticatedUser'); - /** @var $token TokenInterface */ foreach ($authenticatedTokens as $token) { $account = $token->getAccount(); if ($account === null) { @@ -466,7 +465,6 @@ public function getAccount() $this->initialize(); } - /** @var $token TokenInterface */ foreach ($this->getAuthenticationTokens() as $token) { if ($token->isAuthenticated() === true) { return $token->getAccount(); @@ -666,7 +664,6 @@ protected function separateActiveAndInactiveTokens(array $tokens) return; } - /** @var $token TokenInterface */ foreach ($tokens as $token) { if ($this->isTokenActive($token)) { $this->activeTokens[$token->getAuthenticationProviderName()] = $token; @@ -690,7 +687,6 @@ protected function isTokenActive(TokenInterface $token) return true; } $requestPatternsByType = []; - /** @var $requestPattern RequestPatternInterface */ foreach ($token->getRequestPatterns() as $requestPattern) { $patternType = TypeHandling::getTypeForValue($requestPattern); if (isset($requestPatternsByType[$patternType]) && $requestPatternsByType[$patternType] === true) { @@ -706,15 +702,14 @@ protected function isTokenActive(TokenInterface $token) * If a specific type is found in the session this token replaces the one (of the same type) * given by the manager. * - * @param array $managerTokens Array of tokens provided by the authentication manager - * @param array $sessionTokens Array of tokens restored from the session + * @param array $managerTokens Array of tokens provided by the authentication manager + * @param array $sessionTokens Array of tokens restored from the session * @return array Array of Authentication\TokenInterface objects */ protected function mergeTokens(array $managerTokens, array $sessionTokens) { $resultTokens = []; - /** @var $managerToken TokenInterface */ foreach ($managerTokens as $managerToken) { $resultTokens[$managerToken->getAuthenticationProviderName()] = $this->findBestMatchingToken($managerToken, $sessionTokens); } @@ -760,7 +755,7 @@ protected function findBestMatchingToken(TokenInterface $managerToken, array $se /** * Updates the token credentials for all tokens in the given array. * - * @param array $tokens Array of authentication tokens the credentials should be updated for + * @param array $tokens Array of authentication tokens the credentials should be updated for * @return void */ protected function updateTokens(array $tokens) @@ -772,7 +767,6 @@ protected function updateTokens(array $tokens) return; } - /** @var $token TokenInterface */ foreach ($tokens as $token) { $token->updateCredentials($this->request); } diff --git a/Neos.Flow/Classes/Security/Cryptography/HashService.php b/Neos.Flow/Classes/Security/Cryptography/HashService.php index 84ba07c922..24df1e3af7 100644 --- a/Neos.Flow/Classes/Security/Cryptography/HashService.php +++ b/Neos.Flow/Classes/Security/Cryptography/HashService.php @@ -145,7 +145,6 @@ public function validateAndStripHmac($string) */ public function hashPassword($password, $strategyIdentifier = 'default') { - /** @var $passwordHashingStrategy PasswordHashingStrategyInterface */ list($passwordHashingStrategy, $strategyIdentifier) = $this->getPasswordHashingStrategyAndIdentifier($strategyIdentifier); $hashedPasswordAndSalt = $passwordHashingStrategy->hashPassword($password, $this->getEncryptionKey()); return $strategyIdentifier . '=>' . $hashedPasswordAndSalt; @@ -166,8 +165,7 @@ public function validatePassword($password, $hashedPasswordAndSalt) list($strategyIdentifier, $hashedPasswordAndSalt) = explode('=>', $hashedPasswordAndSalt, 2); } - /** @var $passwordHashingStrategy PasswordHashingStrategyInterface */ - list($passwordHashingStrategy, ) = $this->getPasswordHashingStrategyAndIdentifier($strategyIdentifier); + list($passwordHashingStrategy) = $this->getPasswordHashingStrategyAndIdentifier($strategyIdentifier); return $passwordHashingStrategy->validatePassword($password, $hashedPasswordAndSalt, $this->getEncryptionKey()); } @@ -175,7 +173,7 @@ public function validatePassword($password, $hashedPasswordAndSalt) * Get a password hashing strategy * * @param string $strategyIdentifier - * @return array and string + * @return array{PasswordHashingStrategyInterface, string} * @throws MissingConfigurationException */ protected function getPasswordHashingStrategyAndIdentifier($strategyIdentifier = 'default') diff --git a/Neos.Flow/Classes/Session/Session.php b/Neos.Flow/Classes/Session/Session.php index 78560d1b34..e79c61617d 100644 --- a/Neos.Flow/Classes/Session/Session.php +++ b/Neos.Flow/Classes/Session/Session.php @@ -382,6 +382,7 @@ public function resume() $this->lastActivityTimestamp = $this->now; return $lastActivitySecondsAgo; } + return null; } /** @@ -690,13 +691,12 @@ protected function autoExpire() * Note that if a session is started after tokens have been authenticated, the * session will NOT be tagged with authenticated accounts. * - * @param array + * @param $tokens array * @return void */ protected function storeAuthenticatedAccountsInfo(array $tokens) { $accountProviderAndIdentifierPairs = []; - /** @var TokenInterface $token */ foreach ($tokens as $token) { $account = $token->getAccount(); if ($token->isAuthenticated() && $account !== null) { diff --git a/Neos.Flow/Classes/Session/SessionManager.php b/Neos.Flow/Classes/Session/SessionManager.php index 429e7736cc..da0dd6b8e5 100644 --- a/Neos.Flow/Classes/Session/SessionManager.php +++ b/Neos.Flow/Classes/Session/SessionManager.php @@ -148,6 +148,7 @@ public function getSession($sessionIdentifier) $this->remoteSessions[$sessionIdentifier] = new Session($sessionIdentifier, $sessionInfo['storageIdentifier'], $sessionInfo['lastActivityTimestamp'], $sessionInfo['tags']); return $this->remoteSessions[$sessionIdentifier]; } + return null; } /** diff --git a/Neos.Flow/composer.json b/Neos.Flow/composer.json index 6a939a85d4..4bf5f91424 100644 --- a/Neos.Flow/composer.json +++ b/Neos.Flow/composer.json @@ -13,6 +13,7 @@ "ext-json": "*", "ext-reflection": "*", "ext-xml": "*", + "ext-xmlreader": "*", "neos/cache": "self.version", "neos/eel": "self.version", diff --git a/Neos.FluidAdaptor/Classes/Core/Cache/CacheAdaptor.php b/Neos.FluidAdaptor/Classes/Core/Cache/CacheAdaptor.php index 9f921561d4..43bb16e5a4 100644 --- a/Neos.FluidAdaptor/Classes/Core/Cache/CacheAdaptor.php +++ b/Neos.FluidAdaptor/Classes/Core/Cache/CacheAdaptor.php @@ -53,7 +53,7 @@ public function get($name) public function set($name, $value) { // we need to strip the first line with the php header as the flow cache adds that again. - return $this->flowCache->set($name, substr($value, strpos($value, "\n") + 1)); + $this->flowCache->set($name, substr($value, strpos($value, "\n") + 1)); } /** @@ -61,14 +61,15 @@ public function set($name, $value) * the entire cache if no entry is provided. * * @param string|null $name - * @return bool|void + * @return bool|null */ public function flush($name = null) { if ($name !== null) { return $this->flowCache->remove($name); } else { - return $this->flowCache->flush(); + $this->flowCache->flush(); + return null; } } diff --git a/Neos.FluidAdaptor/Classes/Core/Parser/Interceptor/ResourceInterceptor.php b/Neos.FluidAdaptor/Classes/Core/Parser/Interceptor/ResourceInterceptor.php index 9a15de7ac1..7a357088dc 100644 --- a/Neos.FluidAdaptor/Classes/Core/Parser/Interceptor/ResourceInterceptor.php +++ b/Neos.FluidAdaptor/Classes/Core/Parser/Interceptor/ResourceInterceptor.php @@ -91,7 +91,7 @@ public function setDefaultPackageKey($defaultPackageKey) */ public function process(NodeInterface $node, $interceptorPosition, ParsingState $parsingState) { - /** @var $node TextNode */ + /** @var TextNode $node */ if (strpos($node->getText(), 'Public/') === false) { return $node; } diff --git a/Neos.FluidAdaptor/Classes/Core/Parser/SyntaxTree/ResourceUriNode.php b/Neos.FluidAdaptor/Classes/Core/Parser/SyntaxTree/ResourceUriNode.php index 8e963cf91b..29701b8a96 100644 --- a/Neos.FluidAdaptor/Classes/Core/Parser/SyntaxTree/ResourceUriNode.php +++ b/Neos.FluidAdaptor/Classes/Core/Parser/SyntaxTree/ResourceUriNode.php @@ -46,6 +46,7 @@ public function injectViewHelperResolver(ViewHelperResolver $viewHelperResolver) { $this->viewHelperResolver = $viewHelperResolver; $this->uninitializedViewHelper = $this->viewHelperResolver->createViewHelperInstanceFromClassName($this->viewHelperClassName); + /** @phpstan-ignore-next-line we use internal api */ $this->uninitializedViewHelper->setViewHelperNode($this); $this->argumentDefinitions = $this->viewHelperResolver->getArgumentDefinitionsForViewHelper($this->uninitializedViewHelper); } diff --git a/Neos.FluidAdaptor/Classes/Core/ViewHelper/AbstractViewHelper.php b/Neos.FluidAdaptor/Classes/Core/ViewHelper/AbstractViewHelper.php index f88a25acf6..33e65f290b 100644 --- a/Neos.FluidAdaptor/Classes/Core/ViewHelper/AbstractViewHelper.php +++ b/Neos.FluidAdaptor/Classes/Core/ViewHelper/AbstractViewHelper.php @@ -27,6 +27,11 @@ */ abstract class AbstractViewHelper extends FluidAbstractViewHelper { + /** + * @var FlowAwareRenderingContextInterface&RenderingContextInterface + */ + protected $renderingContext; + /** * Controller Context to use * diff --git a/Neos.FluidAdaptor/Classes/Core/ViewHelper/Facets/ChildNodeAccessInterface.php b/Neos.FluidAdaptor/Classes/Core/ViewHelper/Facets/ChildNodeAccessInterface.php index 7fb2850edb..513a34ea06 100644 --- a/Neos.FluidAdaptor/Classes/Core/ViewHelper/Facets/ChildNodeAccessInterface.php +++ b/Neos.FluidAdaptor/Classes/Core/ViewHelper/Facets/ChildNodeAccessInterface.php @@ -11,6 +11,8 @@ * source code. */ +use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\AbstractNode; + /** * Child Node Access Facet. View Helpers should implement this interface if they * need access to the direct children in the Syntax Tree at rendering-time. @@ -28,7 +30,7 @@ interface ChildNodeAccessInterface /** * Sets the direct child nodes of the current syntax tree node. * - * @param array<\Neos\FluidAdaptor\Core\Parser\SyntaxTree\AbstractNode> $childNodes + * @param array $childNodes * @return void */ public function setChildNodes(array $childNodes); diff --git a/Neos.FluidAdaptor/Classes/Core/Widget/AbstractWidgetController.php b/Neos.FluidAdaptor/Classes/Core/Widget/AbstractWidgetController.php index adc78f6d6e..cdf3ff91ff 100644 --- a/Neos.FluidAdaptor/Classes/Core/Widget/AbstractWidgetController.php +++ b/Neos.FluidAdaptor/Classes/Core/Widget/AbstractWidgetController.php @@ -14,6 +14,7 @@ use Neos\Flow\Mvc\ActionRequest; use Neos\Flow\Mvc\ActionResponse; use Neos\Flow\Mvc\Controller\ActionController; +use Neos\Flow\Persistence\QueryResultInterface; use Neos\FluidAdaptor\Core\Widget\Exception\WidgetContextNotFoundException; /** @@ -28,7 +29,7 @@ abstract class AbstractWidgetController extends ActionController /** * Configuration for this widget. * - * @var array + * @var array{objects: QueryResultInterface} * @api */ protected $widgetConfiguration; @@ -45,7 +46,6 @@ abstract class AbstractWidgetController extends ActionController */ public function processRequest(ActionRequest $request, ActionResponse $response) { - /** @var $widgetContext WidgetContext */ $widgetContext = $request->getInternalArgument('__widgetContext'); if (!$widgetContext instanceof WidgetContext) { throw new WidgetContextNotFoundException('The widget context could not be found in the request.', 1307450180); diff --git a/Neos.FluidAdaptor/Classes/Core/Widget/AbstractWidgetViewHelper.php b/Neos.FluidAdaptor/Classes/Core/Widget/AbstractWidgetViewHelper.php index 57a4befcc2..e27a240ad0 100644 --- a/Neos.FluidAdaptor/Classes/Core/Widget/AbstractWidgetViewHelper.php +++ b/Neos.FluidAdaptor/Classes/Core/Widget/AbstractWidgetViewHelper.php @@ -218,7 +218,6 @@ protected function initiateSubRequest() throw new Exception\MissingControllerException('initiateSubRequest() can not be called if there is no controller inside $this->controller. Make sure to add the @Neos\Flow\Annotations\Inject annotation in your widget class.', 1284401632); } - /** @var $subRequest ActionRequest */ $subRequest = $this->controllerContext->getRequest()->createSubRequest(); $this->passArgumentsToSubRequest($subRequest); diff --git a/Neos.FluidAdaptor/Classes/Service/XsdGenerator.php b/Neos.FluidAdaptor/Classes/Service/XsdGenerator.php index 885334dcb2..951bb7dadb 100644 --- a/Neos.FluidAdaptor/Classes/Service/XsdGenerator.php +++ b/Neos.FluidAdaptor/Classes/Service/XsdGenerator.php @@ -13,7 +13,7 @@ use Neos\Flow\Annotations as Flow; use Neos\Flow\Reflection\ClassReflection; -use Neos\FluidAdaptor\Core\ViewHelper\ArgumentDefinition; +use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperInterface; /** * XML Schema (XSD) Generator. Will generate an XML schema which can be used for auto-completion @@ -75,16 +75,16 @@ protected function generateXmlForClassName($className, $viewHelperNamespace, \Si $tagName = $this->getTagNameForClass($className, $viewHelperNamespace); $xsdElement = $xmlRootNode->addChild('xsd:element'); - $xsdElement['name'] = $tagName; + $xsdElement->offsetSet('name', $tagName); $this->docCommentParser->parseDocComment($reflectionClass->getDocComment()); $this->addDocumentation($this->docCommentParser->getDescription(), $xsdElement); $xsdComplexType = $xsdElement->addChild('xsd:complexType'); - $xsdComplexType['mixed'] = 'true'; + $xsdComplexType->offsetSet('mixed', 'true'); $xsdSequence = $xsdComplexType->addChild('xsd:sequence'); $xsdAny = $xsdSequence->addChild('xsd:any'); - $xsdAny['minOccurs'] = '0'; - $xsdAny['maxOccurs'] = 'unbounded'; + $xsdAny->offsetSet('minOccurs', '0'); + $xsdAny->offsetSet('maxOccurs', 'unbounded'); $this->addAttributes($className, $xsdComplexType); } @@ -99,10 +99,10 @@ protected function generateXmlForClassName($className, $viewHelperNamespace, \Si */ protected function addAttributes($className, \SimpleXMLElement $xsdElement) { + /** @var ViewHelperInterface $viewHelper */ $viewHelper = $this->objectManager->get($className); $argumentDefinitions = $viewHelper->prepareArguments(); - /** @var $argumentDefinition ArgumentDefinition */ foreach ($argumentDefinitions as $argumentDefinition) { $xsdAttribute = $xsdElement->addChild('xsd:attribute'); $xsdAttribute['type'] = 'xsd:string'; diff --git a/Neos.FluidAdaptor/Classes/View/TemplatePaths.php b/Neos.FluidAdaptor/Classes/View/TemplatePaths.php index fb001bd3c1..141f8f6e32 100644 --- a/Neos.FluidAdaptor/Classes/View/TemplatePaths.php +++ b/Neos.FluidAdaptor/Classes/View/TemplatePaths.php @@ -12,6 +12,7 @@ * source code. */ +use Neos\Flow\Package\FlowPackageInterface; use Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException; use Neos\Flow\Package\PackageManager; use Neos\Utility\ObjectAccess; @@ -298,6 +299,7 @@ public function getPartialPathAndFilename($partialName) if (strpos($partialName, ':') !== false) { list($packageKey, $actualPartialName) = explode(':', $partialName); + /** @var FlowPackageInterface $package */ $package = $this->packageManager->getPackage($packageKey); $patternReplacementVariables['package'] = $packageKey; $patternReplacementVariables['packageResourcesPath'] = $package->getResourcesPath(); @@ -365,6 +367,7 @@ protected function getPackagePrivateResourcesPath($packageKey) if (!$this->packageManager->isPackageAvailable($packageKey)) { return null; } + /** @phpstan-ignore-next-line this code will be dropped totally as its unused */ $packageResourcesPath = $this->packageManager->getPackage($packageKey)->getResourcesPath(); return Files::concatenatePaths([$packageResourcesPath, 'Private']); diff --git a/Neos.FluidAdaptor/Classes/ViewHelpers/FlashMessagesViewHelper.php b/Neos.FluidAdaptor/Classes/ViewHelpers/FlashMessagesViewHelper.php index 5c0e97801b..5198e6ed28 100644 --- a/Neos.FluidAdaptor/Classes/ViewHelpers/FlashMessagesViewHelper.php +++ b/Neos.FluidAdaptor/Classes/ViewHelpers/FlashMessagesViewHelper.php @@ -105,14 +105,13 @@ public function render() * Render the flash messages as unsorted list. This is triggered if no "as" argument is given * to the ViewHelper. * - * @param array $flashMessages + * @param list $flashMessages * @return string */ protected function renderAsList(array $flashMessages) { $flashMessagesClass = isset($this->arguments['class']) ? $this->arguments['class'] : 'flashmessages'; $tagContent = ''; - /** @var $singleFlashMessage Message */ foreach ($flashMessages as $singleFlashMessage) { $severityClass = sprintf('%s-%s', $flashMessagesClass, strtolower($singleFlashMessage->getSeverity())); $messageContent = htmlspecialchars($singleFlashMessage->render()); diff --git a/Neos.FluidAdaptor/Classes/ViewHelpers/Form/AbstractFormFieldViewHelper.php b/Neos.FluidAdaptor/Classes/ViewHelpers/Form/AbstractFormFieldViewHelper.php index f5f5797c09..489844b745 100644 --- a/Neos.FluidAdaptor/Classes/ViewHelpers/Form/AbstractFormFieldViewHelper.php +++ b/Neos.FluidAdaptor/Classes/ViewHelpers/Form/AbstractFormFieldViewHelper.php @@ -138,7 +138,6 @@ protected function getValueAttribute($ignoreSubmittedFormData = false) */ protected function hasMappingErrorOccurred(): bool { - /** @var $validationResults Result */ $validationResults = $this->getRequest()->getInternalArgument('__submittedArgumentValidationResults'); return ($validationResults instanceof Result && $validationResults->hasErrors()); } @@ -267,7 +266,6 @@ protected function setErrorClassAttribute(): void */ protected function getMappingResultsForProperty(): Result { - /** @var $validationResults Result */ $validationResults = $this->getRequest()->getInternalArgument('__submittedArgumentValidationResults'); if (!$validationResults instanceof Result) { return new Result(); diff --git a/Neos.FluidAdaptor/Classes/ViewHelpers/RenderChildrenViewHelper.php b/Neos.FluidAdaptor/Classes/ViewHelpers/RenderChildrenViewHelper.php index 50121e4f2d..9d35aca2ef 100644 --- a/Neos.FluidAdaptor/Classes/ViewHelpers/RenderChildrenViewHelper.php +++ b/Neos.FluidAdaptor/Classes/ViewHelpers/RenderChildrenViewHelper.php @@ -8,7 +8,6 @@ * the terms of the MIT license. * * */ -use Neos\Flow\Mvc\ActionRequest; use Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper; use Neos\FluidAdaptor\Core\Widget\Exception\RenderingContextNotFoundException; use Neos\FluidAdaptor\Core\Widget\Exception\WidgetContextNotFoundException; @@ -112,11 +111,9 @@ protected function getWidgetChildNodes(): RootNode */ protected function getWidgetContext(): WidgetContext { - /** @var ActionRequest $request */ $request = $this->controllerContext->getRequest(); - /** @var $widgetContext WidgetContext */ $widgetContext = $request->getInternalArgument('__widgetContext'); - if ($widgetContext === null) { + if (!$widgetContext instanceof WidgetContext) { throw new WidgetContextNotFoundException('The Request does not contain a widget context! must be called inside a Widget Template.', 1284986120); } diff --git a/Neos.FluidAdaptor/Classes/ViewHelpers/Security/IfAccessViewHelper.php b/Neos.FluidAdaptor/Classes/ViewHelpers/Security/IfAccessViewHelper.php index 1fad377e30..e342f6afd6 100644 --- a/Neos.FluidAdaptor/Classes/ViewHelpers/Security/IfAccessViewHelper.php +++ b/Neos.FluidAdaptor/Classes/ViewHelpers/Security/IfAccessViewHelper.php @@ -14,6 +14,7 @@ use Neos\Flow\Security\Authorization\PrivilegeManagerInterface; use Neos\Flow\Security\Context; +use Neos\FluidAdaptor\Core\Rendering\FlowAwareRenderingContextInterface; use Neos\FluidAdaptor\Core\Rendering\RenderingContext; use Neos\FluidAdaptor\Core\ViewHelper\AbstractConditionViewHelper; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; @@ -91,7 +92,7 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl /** * @param null $arguments - * @param RenderingContextInterface $renderingContext + * @param FlowAwareRenderingContextInterface&RenderingContextInterface $renderingContext * @return boolean */ protected static function evaluateCondition($arguments, RenderingContextInterface $renderingContext) diff --git a/Neos.FluidAdaptor/Classes/ViewHelpers/Security/IfAuthenticatedViewHelper.php b/Neos.FluidAdaptor/Classes/ViewHelpers/Security/IfAuthenticatedViewHelper.php index ef754c7cf4..a7a78ae4b9 100644 --- a/Neos.FluidAdaptor/Classes/ViewHelpers/Security/IfAuthenticatedViewHelper.php +++ b/Neos.FluidAdaptor/Classes/ViewHelpers/Security/IfAuthenticatedViewHelper.php @@ -13,6 +13,7 @@ use Neos\Flow\Security\Authentication\TokenInterface; use Neos\Flow\Security\Context; +use Neos\FluidAdaptor\Core\Rendering\FlowAwareRenderingContextInterface; use Neos\FluidAdaptor\Core\ViewHelper\AbstractConditionViewHelper; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; @@ -66,7 +67,7 @@ public function render() /** * @param null $arguments - * @param RenderingContextInterface $renderingContext + * @param FlowAwareRenderingContextInterface&RenderingContextInterface $renderingContext * @return bool */ protected static function evaluateCondition($arguments, RenderingContextInterface $renderingContext) diff --git a/Neos.FluidAdaptor/Classes/ViewHelpers/Security/IfHasRoleViewHelper.php b/Neos.FluidAdaptor/Classes/ViewHelpers/Security/IfHasRoleViewHelper.php index 2d1571962f..8a52c13747 100644 --- a/Neos.FluidAdaptor/Classes/ViewHelpers/Security/IfHasRoleViewHelper.php +++ b/Neos.FluidAdaptor/Classes/ViewHelpers/Security/IfHasRoleViewHelper.php @@ -15,6 +15,7 @@ use Neos\Flow\Security\Account; use Neos\Flow\Security\Context; use Neos\Flow\Security\Policy\PolicyService; +use Neos\FluidAdaptor\Core\Rendering\FlowAwareRenderingContextInterface; use Neos\FluidAdaptor\Core\ViewHelper\AbstractConditionViewHelper; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; @@ -104,7 +105,7 @@ public function render() /** * @param null $arguments - * @param RenderingContextInterface $renderingContext + * @param FlowAwareRenderingContextInterface&RenderingContextInterface $renderingContext * @return boolean */ protected static function evaluateCondition($arguments, RenderingContextInterface $renderingContext) diff --git a/Neos.FluidAdaptor/Classes/ViewHelpers/Uri/ResourceViewHelper.php b/Neos.FluidAdaptor/Classes/ViewHelpers/Uri/ResourceViewHelper.php index 9de4502393..6254572c13 100644 --- a/Neos.FluidAdaptor/Classes/ViewHelpers/Uri/ResourceViewHelper.php +++ b/Neos.FluidAdaptor/Classes/ViewHelpers/Uri/ResourceViewHelper.php @@ -16,6 +16,7 @@ use Neos\Flow\ResourceManagement\Exception; use Neos\Flow\ResourceManagement\ResourceManager; use Neos\Flow\ResourceManagement\PersistentResource; +use Neos\FluidAdaptor\Core\Rendering\FlowAwareRenderingContextInterface; use Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper; use Neos\FluidAdaptor\Core\ViewHelper\Exception\InvalidVariableException; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; @@ -101,13 +102,12 @@ public function render() /** * @param array $arguments * @param \Closure $renderChildrenClosure - * @param RenderingContextInterface $renderingContext + * @param FlowAwareRenderingContextInterface&RenderingContextInterface $renderingContext * @return string * @throws InvalidVariableException */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { - /** @var ResourceManager $resourceManager */ $resourceManager = $renderingContext->getObjectManager()->get(ResourceManager::class); $resource = $arguments['resource'] ?? null; diff --git a/Neos.FluidAdaptor/Classes/ViewHelpers/Validation/IfHasErrorsViewHelper.php b/Neos.FluidAdaptor/Classes/ViewHelpers/Validation/IfHasErrorsViewHelper.php index c3adb91e98..3efab8366c 100644 --- a/Neos.FluidAdaptor/Classes/ViewHelpers/Validation/IfHasErrorsViewHelper.php +++ b/Neos.FluidAdaptor/Classes/ViewHelpers/Validation/IfHasErrorsViewHelper.php @@ -13,7 +13,6 @@ use Neos\Error\Messages\Result; -use Neos\Flow\Mvc\ActionRequest; use Neos\FluidAdaptor\Core\Rendering\FlowAwareRenderingContextInterface; use Neos\FluidAdaptor\Core\ViewHelper\AbstractConditionViewHelper; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; @@ -72,18 +71,15 @@ public function render() /** * @param null $arguments - * @param FlowAwareRenderingContextInterface|RenderingContextInterface $renderingContext + * @param FlowAwareRenderingContextInterface&RenderingContextInterface $renderingContext * @return boolean */ protected static function evaluateCondition($arguments, RenderingContextInterface $renderingContext) { - /** @var ActionRequest $request */ - /** @var FlowAwareRenderingContextInterface $renderingContext */ $request = $renderingContext->getControllerContext()->getRequest(); - /** @var Result $validationResults */ $validationResults = $request->getInternalArgument('__submittedArgumentValidationResults'); - if ($validationResults === null) { + if (!$validationResults instanceof Result) { return false; } if (isset($arguments['for'])) { diff --git a/Neos.FluidAdaptor/Classes/ViewHelpers/Validation/ResultsViewHelper.php b/Neos.FluidAdaptor/Classes/ViewHelpers/Validation/ResultsViewHelper.php index b68c1db874..35fc03da8a 100644 --- a/Neos.FluidAdaptor/Classes/ViewHelpers/Validation/ResultsViewHelper.php +++ b/Neos.FluidAdaptor/Classes/ViewHelpers/Validation/ResultsViewHelper.php @@ -91,7 +91,6 @@ public function render() $as = $this->arguments['as']; $request = $this->controllerContext->getRequest(); - /** @var $validationResults Result */ $validationResults = $request->getInternalArgument('__submittedArgumentValidationResults'); if ($validationResults instanceof Result && $for !== '') { $validationResults = $validationResults->forProperty($for); diff --git a/Neos.FluidAdaptor/Classes/ViewHelpers/Widget/Controller/AutocompleteController.php b/Neos.FluidAdaptor/Classes/ViewHelpers/Widget/Controller/AutocompleteController.php index 6eafc73d84..9dd40909a6 100644 --- a/Neos.FluidAdaptor/Classes/ViewHelpers/Widget/Controller/AutocompleteController.php +++ b/Neos.FluidAdaptor/Classes/ViewHelpers/Widget/Controller/AutocompleteController.php @@ -11,7 +11,6 @@ * source code. */ -use Neos\Flow\Persistence\QueryResultInterface; use Neos\Utility\ObjectAccess; use Neos\Utility\Arrays; use Neos\FluidAdaptor\Core\Widget\AbstractWidgetController; @@ -49,7 +48,6 @@ public function indexAction() public function autocompleteAction($term) { $searchProperty = $this->widgetConfiguration['searchProperty']; - /** @var $queryResult QueryResultInterface */ $queryResult = $this->widgetConfiguration['objects']; $query = clone $queryResult->getQuery(); $constraint = $query->getConstraint(); diff --git a/Neos.FluidAdaptor/Classes/ViewHelpers/Widget/LinkViewHelper.php b/Neos.FluidAdaptor/Classes/ViewHelpers/Widget/LinkViewHelper.php index d5ce8bc259..55de2b8c53 100644 --- a/Neos.FluidAdaptor/Classes/ViewHelpers/Widget/LinkViewHelper.php +++ b/Neos.FluidAdaptor/Classes/ViewHelpers/Widget/LinkViewHelper.php @@ -110,7 +110,6 @@ protected function getAjaxUri(): string if ($this->hasArgument('format')) { $arguments['@format'] = $this->arguments['format']; } - /** @var $widgetContext WidgetContext */ $widgetContext = $this->controllerContext->getRequest()->getInternalArgument('__widgetContext'); if (!$widgetContext instanceof WidgetContext) { throw new WidgetContextNotFoundException('Widget context not found in ', 1307450686); diff --git a/Neos.FluidAdaptor/Classes/ViewHelpers/Widget/UriViewHelper.php b/Neos.FluidAdaptor/Classes/ViewHelpers/Widget/UriViewHelper.php index 4e1b95629c..f96c6702e2 100644 --- a/Neos.FluidAdaptor/Classes/ViewHelpers/Widget/UriViewHelper.php +++ b/Neos.FluidAdaptor/Classes/ViewHelpers/Widget/UriViewHelper.php @@ -94,7 +94,6 @@ protected function getAjaxUri(): string if ($this->arguments['format'] !== '') { $arguments['@format'] = $this->arguments['format']; } - /** @var $widgetContext WidgetContext */ $widgetContext = $this->controllerContext->getRequest()->getInternalArgument('__widgetContext'); if (!$widgetContext instanceof WidgetContext) { throw new WidgetContextNotFoundException('Widget context not found in ', 1307450639); diff --git a/composer.json b/composer.json index 4325edcb4d..dcc3478fcf 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ "ext-json": "*", "ext-reflection": "*", "ext-xml": "*", + "ext-xmlreader": "*", "psr/http-message": "^1.0", "psr/http-factory": "^1.0", "psr/container": "^1.0", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 6e510a2184..2d8a0153ee 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,5 +1,9 @@ parameters: - level: 1 + level: 2 + ignoreErrors: + # https://github.com/phpstan/phpstan/issues/9467 will be fixed with flow 9 + - '#^Method Neos\\Flow\\Persistence\\QueryInterface\:\:logicalOr\(\) invoked with \d parameters, 1 required\.$#' + - '#^Method Neos\\Flow\\Persistence\\QueryInterface\:\:logicalAnd\(\) invoked with \d parameters, 1 required\.$#' paths: - Neos.Cache/Classes - Neos.Eel/Classes @@ -21,10 +25,11 @@ parameters: - bootstrap-phpstan.php excludePaths: analyse: + - Neos.Flow/.phpstorm.meta.php + # The parsers are autogenerated / extending autogenerated code and not analysable - Neos.Eel/Classes/FlowQuery/FizzleParser.php - Neos.Eel/Classes/AbstractParser.php - Neos.Eel/Classes/EelParser.php - Neos.Eel/Classes/InterpretedEelParser.php - Neos.Eel/Classes/CompilingEelParser.php - - Neos.Flow/.phpstorm.meta.php - Neos.Flow/Classes/Security/Authorization/Privilege/Entity/Doctrine/EntityPrivilegeExpressionEvaluator.php