Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
aba08c1
WIP: Adjust Neos.Utility.Unicode
Apr 4, 2025
851da67
Adjust Neos.Utility.Schema
Apr 4, 2025
4e16d8f
Adjust Neos.Utility.Pdo
Apr 4, 2025
e9241bc
Adjust Neos.Utility.ObjectHandling
Apr 4, 2025
cd3cadc
Adjust Neos.Utility.MediaTypes
Apr 4, 2025
7728d8d
Adjust Neos.Utility.Files
Apr 4, 2025
85b57a2
Adjust Neos.Utility.Arrays
Apr 4, 2025
6d0fd1f
TASK: Revert breaking changes to Utility->ObjectAccess
mficzel Oct 24, 2025
686ad05
TASK: Revert breaking changes to Utility->Arrays
mficzel Oct 24, 2025
3007bea
TASK: Revert breaking changes of Utility.MediaTypes
mficzel Oct 24, 2025
e76dde5
TASK: Adjust phpstan config to apply level 8 rules to the utility pac…
mficzel Oct 24, 2025
b5eb922
TASK: Adjust utility packages to phpstan level 8
mficzel Oct 24, 2025
07d75d6
Adjust Neos.Kickstarter
Apr 5, 2025
b58dc60
Adjust Neos.Http.Factories
Apr 5, 2025
151671f
Adjust Neos.Http.Factories
Apr 5, 2025
e303bc4
Adjust Neos.Http.Factories to Neos.Flow Http subcontext adjustments
Apr 12, 2025
f98e014
add scanDirectories folders for special classes
Apr 13, 2025
baa09ad
TASK: Adjust Http.Factories and Kickstarter for Stan level 8
mficzel Oct 24, 2025
41b9a94
Adjust Neos.FluidAdaptor
Apr 5, 2025
f0ee451
TASK: Adjust FluidAdapter for PhpStan level 8
mficzel Oct 24, 2025
f6d38e7
Adjust Neos.Flow.Log
Apr 5, 2025
5e02f0c
TASK: Raise PhpStan level for Flow.Log to 8 and adjust breakiness
mficzel Oct 24, 2025
1fec38c
TASK: Add phpstan template/generics to `getAllSubClassNamesForClass()`
mhsdesign Dec 12, 2025
84f811a
PATCH: Dont annotate `DependencyProxy` in `@var` as this is an antipa…
mhsdesign Dec 12, 2025
d7568f8
PATCH: Revert to correct types in `PaginateController`
mhsdesign Dec 12, 2025
ea4df23
PATCH: Remove obsolete `@var` type hint (`isMainRequest` already tell…
mhsdesign Dec 12, 2025
ea82bf0
PATCH: Document what _legacy_ phpstan means (lvl3) and fix one whites…
mhsdesign Dec 12, 2025
5769192
BUGFIX: Throw exception when `Files::getRecursiveDirectoryGenerator()…
mhsdesign Dec 12, 2025
61a8b72
Merge remote-tracking branch 'origin/9.1' into phpstanLevel8-v3
mhsdesign Dec 12, 2025
2d2fe5c
TASK: Throw if `rotateLogFile` cannot create or open lock file
mhsdesign Dec 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Neos.Flow.Log/Classes/Backend/AbstractBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ abstract class AbstractBackend implements BackendInterface
*/
public function __construct($options = [])
{
if (is_array($options) || $options instanceof \ArrayAccess) {
if (is_iterable($options)) {
foreach ($options as $optionKey => $optionValue) {
$methodName = 'set' . ucfirst($optionKey);
if (method_exists($this, $methodName)) {
Expand Down
13 changes: 4 additions & 9 deletions Neos.Flow.Log/Classes/Backend/AnsiConsoleBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AnsiConsoleBackend extends ConsoleBackend
const END = "\033[0m";

/**
* @var array
* @var array<string,string>
*/
protected $tagFormats = [];

Expand Down Expand Up @@ -75,12 +75,7 @@ public function open(): void
/**
* Appends the given message along with the additional information into the log.
*
* @param string $message
* @param int $severity
* @param array $additionalData
* @param string $packageKey
* @param string $className
* @param string $methodName
* @param array<mixed>|null $additionalData
* @return void
*/
public function append(string $message, int $severity = LOG_INFO, $additionalData = null, ?string $packageKey = null, ?string $className = null, ?string $methodName = null): void
Expand Down Expand Up @@ -118,15 +113,15 @@ protected function formatOutput($output)
} else {
return str_replace('|', $matches[3], $format);
}
}, $output);
}, $output) ?: '';
} while ($lastOutput !== $output);
return $output;
}

/**
* @param boolean $disableAnsi
*/
public function setDisableAnsi($disableAnsi)
public function setDisableAnsi($disableAnsi): void
{
$this->disableAnsi = $disableAnsi;
}
Expand Down
7 changes: 4 additions & 3 deletions Neos.Flow.Log/Classes/Backend/ConsoleBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ConsoleBackend extends AbstractBackend
{
/**
* An array of severity labels, indexed by their integer constant
* @var array
* @var array<int,string>
*/
protected $severityLabels;

Expand Down Expand Up @@ -61,10 +61,11 @@ public function open(): void
LOG_DEBUG => 'DEBUG ',
];

$this->streamHandle = fopen('php://' . $this->streamName, 'w');
if (!is_resource($this->streamHandle)) {
$streamHandle = fopen('php://' . $this->streamName, 'w');
if (!is_resource($streamHandle)) {
throw new CouldNotOpenResourceException('Could not open stream "' . $this->streamName . '" for write access.', 1310986609);
}
$this->streamHandle = $streamHandle;
}

/**
Expand Down
5 changes: 4 additions & 1 deletion Neos.Flow.Log/Classes/Backend/FileBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FileBackend extends AbstractBackend
{
/**
* An array of severity labels, indexed by their integer constant
* @var array
* @var array<int,string>
*/
protected $severityLabels;

Expand Down Expand Up @@ -192,6 +192,9 @@ public function open(): void
protected function rotateLogFile(): void
{
$lockResource = fopen($this->logFileUrl . '.lock', 'w+');
if ($lockResource === false) {
throw new \RuntimeException(sprintf('Fatal: cannot open/create file "%s".', $this->logFileUrl . '.lock'), 1765550110);
}

$exclusiveNonBlockingLockResult = flock($lockResource, LOCK_EX | LOCK_NB);
if ($exclusiveNonBlockingLockResult === false) {
Expand Down
4 changes: 2 additions & 2 deletions Neos.Flow.Log/Classes/PlainTextFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public function __construct($variable)
}

/**
* @param $spaces
* @return string
* @param int $spaces
* @return ?string
*/
public function format($spaces = 4)
{
Expand Down
12 changes: 6 additions & 6 deletions Neos.Flow.Log/Classes/Psr/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Logger implements LoggerInterface
/**
* Constructs the PSR-3 Logger.
*
* @param iterable $backends
* @param iterable<mixed> $backends
*/
public function __construct(iterable $backends)
{
Expand All @@ -61,7 +61,7 @@ public function __construct(iterable $backends)
/**
* @param mixed $level
* @param string|\Stringable $message
* @param array $context
* @param array<string,mixed> $context
* @api
*/
public function log($level, string|\Stringable $message, array $context = []): void
Expand All @@ -80,8 +80,8 @@ public function log($level, string|\Stringable $message, array $context = []): v
}

/**
* @param array $context
* @return array list of packageKey, className and methodName either string or null
* @param array<string,mixed> $context
* @return array<int,string|null> list of packageKey, className and methodName either string or null
*/
protected function extractLegacyDataFromContext(array $context): array
{
Expand All @@ -93,8 +93,8 @@ protected function extractLegacyDataFromContext(array $context): array
}

/**
* @param array $context
* @return array
* @param array<string,mixed> $context
* @return array<string,mixed>
*/
protected function removeLegacyDataFromContext(array $context): array
{
Expand Down
5 changes: 3 additions & 2 deletions Neos.Flow/Classes/Reflection/ReflectionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,9 @@ public function getAllImplementationClassNamesForInterface(string $interfaceName
* Searches for and returns all names of classes inheriting the specified class.
* If no class inheriting the given class was found, an empty array is returned.
*
* @param class-string $className
* @return array<class-string>
* @template T of object
* @param class-string<T> $className
* @return list<class-string<T>>
* @throws ClassLoadingForReflectionFailedException
* @throws InvalidClassException
* @throws \ReflectionException
Expand Down
1 change: 1 addition & 0 deletions Neos.FluidAdaptor/Classes/Core/Cache/CacheAdaptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function get($name)
*
* @param string $name
* @param string $value
* @return void
*/
public function set($name, $value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function process(NodeInterface $node, $interceptorPosition, ParsingState
if (strpos($node->getText(), 'Public/') === false) {
return $node;
}
$textParts = preg_split(self::PATTERN_SPLIT_AT_RESOURCE_URIS, $node->getText(), -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
$textParts = preg_split(self::PATTERN_SPLIT_AT_RESOURCE_URIS, $node->getText(), -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) ?: [];
$node = new RootNode();
foreach ($textParts as $part) {
$matches = [];
Expand All @@ -109,7 +109,7 @@ public function process(NodeInterface $node, $interceptorPosition, ParsingState
if ($this->defaultPackageKey !== null) {
$arguments['package'] = new TextNode($this->defaultPackageKey);
}
if (isset($matches['Package']) && FlowPackageKey::isPackageKeyValid($matches['Package'])) {
if (FlowPackageKey::isPackageKeyValid($matches['Package'])) {
$arguments['package'] = new TextNode($matches['Package']);
}

Expand All @@ -127,7 +127,7 @@ public function process(NodeInterface $node, $interceptorPosition, ParsingState
/**
* This interceptor wants to hook into text nodes.
*
* @return array Array of INTERCEPT_* constants
* @return array<int,int> Array of INTERCEPT_* constants
*/
public function getInterceptionPoints()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class LegacyNamespaceExpressionNode extends AbstractExpressionNode implements Ex
* Pattern which detects namespace declarations made inline.
* syntax, e.g. {namespace neos=TYPO3\Neos\ViewHelpers}.
*/
public static $detectionExpression = '/{namespace\\s*([a-z0-9]+)\\s*=\\s*([a-z0-9_\\\\]+)\\s*}/i';
public static string $detectionExpression = '/{namespace\\s*([a-z0-9]+)\\s*=\\s*([a-z0-9_\\\\]+)\\s*}/i';

/**
* Evaluates the expression stored in this node, in the context of $renderingcontext.
*
* @param RenderingContextInterface $renderingContext
* @param string $expression
* @param array $matches
* @param array<int,mixed> $matches
* @return mixed
*/
public static function evaluateExpression(RenderingContextInterface $renderingContext, $expression, array $matches)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ class ResourceUriNode extends ViewHelperNode
protected $viewHelperResolver;

/**
* @var string
* @var class-string<ResourceViewHelper>
*/
protected $viewHelperClassName = ResourceViewHelper::class;

/**
* @param ViewHelperResolver $viewHelperResolver
* @return void
*/
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);
}
Expand Down
1 change: 1 addition & 0 deletions Neos.FluidAdaptor/Classes/Core/Parser/TemplateParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function isEscapingEnabled()

/**
* @param boolean $escapingEnabled
* @return void
*/
public function setEscapingEnabled($escapingEnabled)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ class EscapingFlagProcessor implements TemplateProcessorInterface
*/
protected $renderingContext;

public static $SCAN_PATTERN_ESCAPINGMODIFIER = '/{escapingEnabled\s*=\s*(?P<enabled>true|false)\s*}/i';
public static string $SCAN_PATTERN_ESCAPINGMODIFIER = '/{escapingEnabled\s*=\s*(?P<enabled>true|false)\s*}/i';

/**
* @param RenderingContextInterface $renderingContext
* @return void
*/
public function setRenderingContext(RenderingContextInterface $renderingContext)
{
Expand Down Expand Up @@ -56,7 +57,7 @@ public function preProcessSource($templateSource)
if (strtolower($matches[0]['enabled']) === 'false') {
$this->renderingContext->getTemplateParser()->setEscapingEnabled(false);
}
$templateSource = preg_replace(self::$SCAN_PATTERN_ESCAPINGMODIFIER, '', $templateSource);
$templateSource = preg_replace(self::$SCAN_PATTERN_ESCAPINGMODIFIER, '', $templateSource) ?: '';

return $templateSource;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class NamespaceDetectionTemplateProcessor extends FluidNamespaceDetectionTemplat
/**
* Extension of the default pattern for dynamic tags including namespaces with uppercase letters.
*/
public static $EXTENDED_SPLIT_PATTERN_TEMPLATE_DYNAMICTAGS = '/
public static string $EXTENDED_SPLIT_PATTERN_TEMPLATE_DYNAMICTAGS = '/
(
(?: <\/? # Start dynamic tags
(?:(?:[a-zA-Z0-9\\.]*):[a-zA-Z0-9\\.]+) # A tag consists of the namespace prefix and word characters
Expand Down Expand Up @@ -75,7 +75,7 @@ public function preProcessSource($templateSource)
*/
public function protectCDataSectionsFromParser(string $templateSource)
{
$parts = preg_split('/(\<\!\[CDATA\[|\]\]\>)/', $templateSource, -1, PREG_SPLIT_DELIM_CAPTURE);
$parts = preg_split('/(\<\!\[CDATA\[|\]\]\>)/', $templateSource, -1, PREG_SPLIT_DELIM_CAPTURE) ?: [];
$balance = 0;
$content = '';
$resultingParts = [];
Expand Down Expand Up @@ -127,7 +127,7 @@ public function protectCDataSectionsFromParser(string $templateSource)
public function throwExceptionsForUnhandledNamespaces(string $templateSource): void
{
$viewHelperResolver = $this->renderingContext->getViewHelperResolver();
$splitTemplate = preg_split(static::$EXTENDED_SPLIT_PATTERN_TEMPLATE_DYNAMICTAGS, $templateSource, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$splitTemplate = preg_split(static::$EXTENDED_SPLIT_PATTERN_TEMPLATE_DYNAMICTAGS, $templateSource, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY) ?: [];
foreach ($splitTemplate as $templateElement) {
if (preg_match(Patterns::$SCAN_PATTERN_TEMPLATE_VIEWHELPERTAG, $templateElement, $matchedVariables) > 0) {
if (!$viewHelperResolver->isNamespaceValidOrIgnored($matchedVariables['NamespaceIdentifier'])) {
Expand All @@ -148,11 +148,9 @@ public function throwExceptionsForUnhandledNamespaces(string $templateSource): v
foreach ($sections as $section) {
if (preg_match(Patterns::$SCAN_PATTERN_SHORTHANDSYNTAX_OBJECTACCESSORS, $section, $matchedVariables) > 0) {
preg_match_all(Patterns::$SPLIT_PATTERN_SHORTHANDSYNTAX_VIEWHELPER, $section, $shorthandViewHelpers, PREG_SET_ORDER);
if (is_array($shorthandViewHelpers) === true) {
foreach ($shorthandViewHelpers as $shorthandViewHelper) {
if (!$viewHelperResolver->isNamespaceValidOrIgnored($shorthandViewHelper['NamespaceIdentifier'])) {
throw new UnknownNamespaceException('Unknown Namespace: ' . $shorthandViewHelper['NamespaceIdentifier']);
}
foreach ($shorthandViewHelpers as $shorthandViewHelper) {
if (!$viewHelperResolver->isNamespaceValidOrIgnored($shorthandViewHelper['NamespaceIdentifier'])) {
throw new UnknownNamespaceException('Unknown Namespace: ' . $shorthandViewHelper['NamespaceIdentifier']);
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions Neos.FluidAdaptor/Classes/Core/Rendering/RenderingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Neos\FluidAdaptor\Core\ViewHelper\ViewHelperResolver;
use Neos\FluidAdaptor\View\TemplatePaths;
use TYPO3Fluid\Fluid\Core\Parser\Configuration;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\AbstractExpressionNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\CastingExpressionNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\MathExpressionNode;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\TernaryExpressionNode;
Expand All @@ -42,7 +43,7 @@ class RenderingContext extends FluidRenderingContext implements FlowAwareRenderi
* which will be consulted when an expression does not match
* any built-in parser expression types.
*
* @var array
* @var array<class-string<AbstractExpressionNode>>
*/
protected $expressionNodeTypes = [
LegacyNamespaceExpressionNode::class,
Expand Down Expand Up @@ -81,7 +82,7 @@ class RenderingContext extends FluidRenderingContext implements FlowAwareRenderi
/**
* RenderingContext constructor.
*
* @param array $options
* @param array<string,mixed> $options
*/
public function __construct(array $options = [])
{
Expand All @@ -99,6 +100,7 @@ public function __construct(array $options = [])

/**
* @param ObjectManagerInterface $objectManager
* @return void
*/
public function injectObjectManager(ObjectManagerInterface $objectManager)
{
Expand All @@ -116,7 +118,7 @@ public function getControllerContext()
/**
* @param ControllerContext $controllerContext
*/
public function setControllerContext($controllerContext)
public function setControllerContext($controllerContext): void
{
$this->controllerContext = $controllerContext;
$request = $controllerContext->getRequest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ abstract class AbstractConditionViewHelper extends AbstractViewHelper

/**
* Initializes the "then" and "else" arguments
* @return void
*/
public function initializeArguments()
{
Expand All @@ -66,18 +67,19 @@ public function initializeArguments()
* subclasses that will be using this base class in the future. Let this
* be a warning if someone considers changing this method signature!
*
* @param array|NULL $arguments
* @param array<mixed>|NULL $arguments
* @param RenderingContextInterface $renderingContext
* @return boolean
* @api
*/
protected static function evaluateCondition($arguments, RenderingContextInterface $renderingContext)
{
return (boolean)$arguments['condition'];
// fallback value derived from registerArgument default value
return (boolean)($arguments['condition'] ?? false);
}

/**
* @param array $arguments
* @param array<string,mixed> $arguments
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
* @return mixed
Expand All @@ -103,8 +105,8 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl
}

/**
* @param array $closures
* @param array $conditionClosures
* @param array<mixed> $closures
* @param array<mixed> $conditionClosures
* @param RenderingContextInterface $renderingContext
* @return string
*/
Expand Down Expand Up @@ -236,7 +238,7 @@ public function compile($argumentsName, $closureName, &$initializationPhpCode, V

/**
* @param boolean $isConditionFullfilled
* @param array $arguments
* @param array<string,mixed> $arguments
* @param RenderingContextInterface $renderingContext
* @return mixed
*/
Expand Down
Loading