Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/9.0' into feature/dispatcher-ret…
Browse files Browse the repository at this point in the history
…urns-psr-responses
  • Loading branch information
mhsdesign committed Apr 24, 2024
2 parents 0002e5e + 00fa8ff commit 29694c2
Show file tree
Hide file tree
Showing 209 changed files with 5,470 additions and 2,268 deletions.
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Backend/BackendInterface.php
Expand Up @@ -51,7 +51,7 @@ public function getPrefixedIdentifier(string $entryIdentifier): string;
* @param string $entryIdentifier An identifier for this specific cache entry
* @param string $data The data to be stored
* @param array $tags Tags to associate with this cache entry. If the backend does not support tags, this option can be ignored.
* @param integer $lifetime Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime.
* @param integer|null $lifetime Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime.
* @return void
* @throws \Neos\Cache\Exception if no cache frontend has been set.
* @throws \InvalidArgumentException if the identifier is not valid
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Backend/FileBackend.php
Expand Up @@ -48,7 +48,7 @@ class FileBackend extends SimpleFileBackend implements PhpCapableBackendInterfac
protected $cacheEntryFileExtension = '';

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

Expand Down
4 changes: 2 additions & 2 deletions Neos.Cache/Classes/Psr/Cache/CacheItem.php
Expand Up @@ -39,7 +39,7 @@ class CacheItem implements CacheItemInterface


/**
* @var \DateTime|null
* @var \DateTimeInterface|null
*/
protected $expirationDate;

Expand Down Expand Up @@ -127,7 +127,7 @@ public function expiresAfter(int|\DateInterval|null $time): static
}

/**
* @return \DateTime|null
* @return \DateTimeInterface|null
*/
public function getExpirationDate()
{
Expand Down
8 changes: 4 additions & 4 deletions Neos.Eel/Classes/FlowQuery/FlowQuery.php
Expand Up @@ -145,13 +145,13 @@ public function setOperationResolver(OperationResolverInterface $operationResolv
}

/**
* Add a new operation to the operation list and return the new FlowQuery
* object. If the operation is final, we directly compute the result and
* return the value.
* Add a new operation to the operation list and return the new FlowQuery object.
*
* If the operation is final, we directly compute the result and return the value.
*
* @param string $operationName
* @param array $arguments
* @return FlowQuery
* @return FlowQuery|mixed
*/
public function __call($operationName, array $arguments)
{
Expand Down
2 changes: 1 addition & 1 deletion Neos.Eel/Classes/FlowQuery/OperationInterface.php
Expand Up @@ -58,7 +58,7 @@ public function canEvaluate($context);
*
* @param FlowQuery $flowQuery the FlowQuery object
* @param array $arguments the arguments for this operation
* @return mixed|null if the operation is final, the return value
* @return mixed if the operation is final, the return value
*/
public function evaluate(FlowQuery $flowQuery, array $arguments);
}
3 changes: 2 additions & 1 deletion Neos.Eel/Classes/FlowQuery/Operations/IsOperation.php
Expand Up @@ -40,7 +40,7 @@ class IsOperation extends AbstractOperation
*
* @param FlowQuery $flowQuery the FlowQuery object
* @param array $arguments the filter arguments
* @return void|boolean
* @return mixed
*/
public function evaluate(FlowQuery $flowQuery, array $arguments)
{
Expand All @@ -49,6 +49,7 @@ public function evaluate(FlowQuery $flowQuery, array $arguments)
} else {
$flowQuery->pushOperation('is', []);
$flowQuery->pushOperation('filter', $arguments);
return null;
}
}
}
2 changes: 1 addition & 1 deletion Neos.Eel/Classes/Helper/MathHelper.php
Expand Up @@ -421,7 +421,7 @@ public function round($subject, $precision = 0)
* Get the sign of the given number, indicating whether the number is positive, negative or zero
*
* @param integer|float $x The value
* @return integer -1, 0, 1 depending on the sign or NAN if the given value was not numeric
* @return integer|float -1, 0, 1 depending on the sign or NAN if the given value was not numeric
*/
public function sign($x)
{
Expand Down
9 changes: 5 additions & 4 deletions Neos.Error.Messages/Classes/Result.php
Expand Up @@ -345,7 +345,7 @@ public function hasMessages(): bool
* where the key is the property path where the error occurred, and the
* value is a list of all errors (stored as array)
*
* @return array<Error>
* @return array<string, array<int, Error>>
* @api
*/
public function getFlattenedErrors(): array
Expand All @@ -361,7 +361,7 @@ public function getFlattenedErrors(): array
* value is a list of all errors (stored as array)
*
* @param string $type
* @return array<Error>
* @return array<string, array<int, Error>>
* @api
*/
public function getFlattenedErrorsOfType(string $type): array
Expand All @@ -376,7 +376,7 @@ public function getFlattenedErrorsOfType(string $type): array
* where the key is the property path where the warning occurred, and the
* value is a list of all warnings (stored as array)
*
* @return array<Warning>
* @return array<string, array<int, Warning>>
* @api
*/
public function getFlattenedWarnings(): array
Expand All @@ -391,7 +391,7 @@ public function getFlattenedWarnings(): array
* where the key is the property path where the notice occurred, and the
* value is a list of all notices (stored as array)
*
* @return array<Notice>
* @return array<string, array<int, Notice>>
* @api
*/
public function getFlattenedNotices(): array
Expand All @@ -408,6 +408,7 @@ public function getFlattenedNotices(): array
* @param array $result The current result to be flattened
* @param array $level The property path in the format array('level1', 'level2', ...) for recursion
* @param string $messageTypeFilter If specified only messages implementing the given class name are taken into account
* @param-out array<string, array<int, mixed>> $result
* @return void
*/
public function flattenTree(string $propertyName, array &$result, array $level = [], string $messageTypeFilter = null)
Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow.Log/Classes/PlainTextFormatter.php
Expand Up @@ -36,7 +36,7 @@ public function format($spaces = 4)
* @param mixed $var The variable
* @param integer $spaces Indent for this var dump
* @param int $continuationSpaces Running total indentation (INTERNAL)
* @return string text output
* @return string|null text output
*/
protected function renderVariableAsPlaintext($var, $spaces = 4, $continuationSpaces = 0)
{
Expand Down
77 changes: 40 additions & 37 deletions Neos.Flow/Classes/Annotations/InjectConfiguration.php
Expand Up @@ -11,11 +11,11 @@
* source code.
*/

use Neos\Flow\Configuration\ConfigurationManager;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Neos\Flow\Configuration\ConfigurationManager;

/**
* Used to enable property injection for configuration including settings.
* Used to enable property and constructor argument injection for configuration including settings.
*
* Flow will build Dependency Injection code for the property and try
* to inject the configured configuration.
Expand All @@ -24,46 +24,49 @@
* @NamedArgumentConstructor
* @Target("PROPERTY")
*/
#[\Attribute(\Attribute::TARGET_PROPERTY)]
final class InjectConfiguration
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_PARAMETER)]
final readonly class InjectConfiguration
{
/**
* Path of a configuration which should be injected into the property.
* Can be specified as anonymous argument: InjectConfiguration("some.path")
*
* For type "Settings" this refers to the relative path (excluding the package key)
*
* Example: session.name
*
* @var string|null
*/
public $path;

/**
* Defines the package key to be used for retrieving settings. If no package key is specified, we'll assume the
* package to be the same which contains the class where the InjectConfiguration annotation is used.
*
* Note: This property is only supported for type "Settings"
*
* Example: Neos.Flow
*
* @var string|null
*/
public $package;
public function __construct(
/**
* Path of a configuration which should be injected into the property.
* Can be specified as anonymous argument: InjectConfiguration("some.path")
*
* For type "Settings" this refers to the relative path (excluding the package key)
*
* Example: session.name
*/
public ?string $path = null,
/**
* Defines the package key to be used for retrieving settings. If no package key is specified, we'll assume the
* package to be the same which contains the class where the InjectConfiguration annotation is used.
*
* Note: This property is only supported for type "Settings"
*
* Example: Neos.Flow
*/
public ?string $package = null,
/**
* Type of Configuration (defaults to "Settings").
*
* @param $type ?string one of the ConfigurationManager::CONFIGURATION_TYPE_* constants
*/
public ?string $type = ConfigurationManager::CONFIGURATION_TYPE_SETTINGS
) {
if ($this->type !== ConfigurationManager::CONFIGURATION_TYPE_SETTINGS && $this->package !== null) {
throw new \DomainException(sprintf('Invalid usage of "package" with configuration type "%s". Using "package" is only valid for "Settings".', $this->type), 1686910380912);
}
}

/**
* Type of Configuration (defaults to "Settings").
*
* @var string one of the ConfigurationManager::CONFIGURATION_TYPE_* constants
* @param string $fallbackPackageKey fallback, in case no package key is specified {@see self::$package}
*/
public $type = ConfigurationManager::CONFIGURATION_TYPE_SETTINGS;

public function __construct(?string $path = null, ?string $package = null, ?string $type = null)
public function getFullConfigurationPath(string $fallbackPackageKey): ?string
{
$this->path = $path;
$this->package = $package;
if ($type !== null) {
$this->type = $type;
if ($this->type !== ConfigurationManager::CONFIGURATION_TYPE_SETTINGS) {
return $this->path;
}
$packageKey = $this->package ?? $fallbackPackageKey;
return rtrim($packageKey . '.' . $this->path, '.');
}
}
67 changes: 67 additions & 0 deletions Neos.Flow/Classes/Annotations/Route.php
@@ -0,0 +1,67 @@
<?php
declare(strict_types=1);

namespace Neos\Flow\Annotations;

/*
* This file is part of the Neos.Flow package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/

use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
* Adds a route configuration to a method
*
* This is a convenient way to add routes in project code
* but should not be used in libraries/packages that shall be
* configured for different use cases.
*
* @Annotation
* @NamedArgumentConstructor
* @Target({"METHOD"})
*/
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
final readonly class Route
{
/**
* Magic route values cannot be set as default nor be contained as segments like `{\@action}` or `{\@controller}` in the uriPattern.
* The magic route value `\@format` is allowed if necessary.
*/
private const PRESERVED_DEFAULTS = ['@package', '@subpackage', '@controller', '@action'];

/**
* @param string $uriPattern The uri-pattern for the route without leading '/'. Might contain route values in the form of `path/{foo}`
* @param string $name The suffix of the route name as shown in `route:list` (defaults to the action name: "My.Package :: Site :: index")
* @param array $httpMethods List of uppercase http verbs like 'GET', 'POST', 'PUT', 'DELETE', if not specified any request method will be matched
* @param array $defaults Values to set for this route
*/
public function __construct(
public string $uriPattern,
public string $name = '',
public array $httpMethods = [],
public array $defaults = [],
) {
if ($uriPattern === '' || str_starts_with($uriPattern, '/')) {
throw new \DomainException(sprintf('Uri pattern must not be empty or begin with a slash: "%s"', $uriPattern), 1711529592);
}
foreach ($httpMethods as $httpMethod) {
if ($httpMethod === '' || ctype_lower($httpMethod)) {
throw new \DomainException(sprintf('Http method must not be empty or be lower case: "%s"', $httpMethod), 1711530485);
}
}
foreach (self::PRESERVED_DEFAULTS as $preservedDefaultName) {
if (str_contains($uriPattern, sprintf('{%s}', $preservedDefaultName))) {
throw new \DomainException(sprintf('It is not allowed to use "%s" in the uri pattern "%s"', $preservedDefaultName, $uriPattern), 1711129634);
}
if (array_key_exists($preservedDefaultName, $defaults)) {
throw new \DomainException(sprintf('It is not allowed to override "%s" as default', $preservedDefaultName), 1711129638);
}
}
}
}
5 changes: 2 additions & 3 deletions Neos.Flow/Classes/Aop/Pointcut/RuntimeExpressionEvaluator.php
Expand Up @@ -11,7 +11,7 @@
* source code.
*/

use Neos\Cache\Frontend\StringFrontend;
use Neos\Cache\Frontend\FrontendInterface;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Aop\JoinPointInterface;
use Neos\Flow\Cache\CacheManager;
Expand All @@ -28,7 +28,7 @@
class RuntimeExpressionEvaluator
{
/**
* @var StringFrontend
* @var FrontendInterface
*/
protected $runtimeExpressionsCache;

Expand All @@ -54,7 +54,6 @@ public function injectObjectManager(ObjectManagerInterface $objectManager): void
{
if ($this->objectManager === null) {
$this->objectManager = $objectManager;
/** @var CacheManager $cacheManager */
$cacheManager = $this->objectManager->get(CacheManager::class);
$this->runtimeExpressionsCache = $cacheManager->getCache('Flow_Aop_RuntimeExpressions');
}
Expand Down
8 changes: 4 additions & 4 deletions Neos.Flow/Classes/Cli/ConsoleOutput.php
Expand Up @@ -32,12 +32,12 @@
class ConsoleOutput
{
/**
* @var SymfonyConsoleOutput
* @var OutputInterface
*/
protected $output;

/**
* @var SymfonyStringInput
* @var InputInterface
*/
protected $input;

Expand Down Expand Up @@ -158,7 +158,7 @@ public function outputTable(array $rows, array $headers = null, string $headerTi
*
* @param string|array $question The question to ask. If an array each array item is turned into one line of a multi-line question
* @param array $choices List of choices to pick from
* @param mixed|null $default The default answer if the user enters nothing
* @param string|bool|int|float|null $default The default answer if the user enters nothing
* @param boolean $multiSelect If true the result will be an array with the selected options. Multiple options can be given separated by commas
* @param integer|null $attempts Max number of times to ask before giving up (null by default, which means infinite)
* @return integer|string|array Either the value for indexed arrays, the key for associative arrays or an array for multiple selections
Expand Down Expand Up @@ -291,7 +291,7 @@ public function askHiddenResponseAndValidate($question, callable $validator, int
/**
* Starts the progress output
*
* @param integer $max Maximum steps. If NULL an indeterminate progress bar is rendered
* @param integer|null $max Maximum steps. If NULL an indeterminate progress bar is rendered
* @return void
*/
public function progressStart(int $max = null): void
Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow/Classes/Cli/Request.php
Expand Up @@ -32,7 +32,7 @@ class Request
protected $controllerCommandName = 'default';

/**
* @var Command
* @var Command|null
*/
protected $command;

Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow/Classes/Cli/Response.php
Expand Up @@ -47,7 +47,7 @@ class Response
private $content = '';

/**
* @var bool|null
* @var bool|null true, false or NULL (= autodetection)
*/
private $colorSupport;

Expand Down

0 comments on commit 29694c2

Please sign in to comment.