Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/9.0' into feature/actioncontroll…
Browse files Browse the repository at this point in the history
…er-simplecontroller
  • Loading branch information
mhsdesign committed Jan 25, 2024
2 parents 0689c78 + e5b1248 commit 465c80b
Show file tree
Hide file tree
Showing 168 changed files with 4,770 additions and 585 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['8.2']
php-versions: ['8.2', '8.3']
# see https://mariadb.com/kb/en/mariadb-server-release-dates/
# this should be a current release, e.g. the LTS version
mariadb-versions: ['10.6']
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion Neos.Cache/Classes/Backend/FileBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,15 @@ public function findIdentifiersByTag(string $searchedTag): array
* specified tags.
*
* @param string[] $tags The tags to search for
* @return string[] An array with identifiers of all matching entries. An empty array if no entries matched
* @return string[] An array with identifiers of all matching entries. An empty array if no entries matched or no tags were provided
* @api
*/
public function findIdentifiersByTags(array $tags): array
{
if (empty($tags)) {
return [];
}

$entryIdentifiers = [];
for ($directoryIterator = new \DirectoryIterator($this->cacheDirectory); $directoryIterator->valid(); $directoryIterator->next()) {
if ($directoryIterator->isDot()) {
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Psr/Cache/CacheItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion Neos.Cache/Classes/Psr/SimpleCache/SimpleCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Neos.Eel/Classes/CompilingEvaluator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 0 additions & 11 deletions Neos.Eel/Classes/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,4 @@ public function push($value, $key = null)
}
return $this;
}

/**
* @return string
*/
public function __toString()
{
if (is_object($this->value) && !method_exists($this->value, '__toString')) {
return '[object ' . get_class($this->value) . ']';
}
return (string)$this->value;
}
}
2 changes: 1 addition & 1 deletion Neos.Eel/Classes/FlowQuery/FlowQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public function pushOperation($operationName, array $arguments)
*
* Should only be called inside an operation.
*
* @return string the next operation name or NULL if no next operation found.
* @return string|null the next operation name or NULL if no next operation found.
*/
public function peekOperationName()
{
Expand Down
2 changes: 1 addition & 1 deletion Neos.Eel/Classes/FlowQuery/OperationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
1 change: 0 additions & 1 deletion Neos.Eel/Classes/FlowQuery/OperationResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public static function buildOperationsAndFinalOperationNames($objectManager)

$reflectionService = $objectManager->get(ReflectionService::class);
$operationClassNames = $reflectionService->getAllImplementationClassNamesForInterface(OperationInterface::class);
/** @var $operationClassName OperationInterface */
foreach ($operationClassNames as $operationClassName) {
$shortOperationName = $operationClassName::getShortName();
$operationPriority = $operationClassName::getPriority();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion Neos.Eel/Classes/Helper/MathHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Neos.Eel/Classes/Helper/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function lastIndexOf($string, $search, $toIndex = null)
*
* @param string $string The input string
* @param string $pattern A PREG pattern
* @return array The matches as array or NULL if not matched
* @return array|null The matches as array or NULL if not matched
* @throws EvaluationException
*/
public function pregMatch($string, $pattern)
Expand All @@ -255,7 +255,7 @@ public function pregMatch($string, $pattern)
*
* @param string $string The input string
* @param string $pattern A PREG pattern
* @return array The matches as array or NULL if not matched
* @return array|null The matches as array or NULL if not matched
* @throws EvaluationException
*/
public function pregMatchAll($string, $pattern)
Expand Down
9 changes: 4 additions & 5 deletions Neos.Eel/Classes/InterpretedEelParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,20 +226,19 @@ public function SumCalculation_op(&$result, $sub)

public function SumCalculation_rgt(&$result, $sub)
{
$lval = $result['val'];
$rval = $sub['val'];
$lval = $this->unwrap($result['val']);
$rval = $this->unwrap($sub['val']);

switch ($result['op']) {
case '+':
if (is_string($lval) || is_string($rval)) {
// Do not unwrap here and use better __toString handling of Context
$result['val'] = $lval . $rval;
} else {
$result['val'] = $this->unwrap($lval) + $this->unwrap($rval);
$result['val'] = $lval + $rval;
}
break;
case '-':
$result['val'] = $this->unwrap($lval) - $this->unwrap($rval);
$result['val'] = $lval - $rval;
break;
}
}
Expand Down
5 changes: 5 additions & 0 deletions Neos.Eel/Classes/InterpretedEvaluator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
25 changes: 0 additions & 25 deletions Neos.Eel/Classes/ProtectedContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,6 @@ public function getAndWrap($path = null)
return $context;
}


/**
* Allow the given method (or array of methods) for calls
*
* Method can be allowed on the root level of the context or
* for arbitrary paths. A special method "*" will allow all methods
* to be called.
*
* Examples:
*
* $context->allow('myMethod');
*
* $context->allow('*');
*
* $context->allow(array('String.*', 'Array.reverse'));
*
* @param array|string $pathOrMethods
* @return void
* @deprecated Use allow() instead. See https://github.com/neos/flow-development-collection/pull/2024
*/
public function whitelist($pathOrMethods)
{
$this->allow($pathOrMethods);
}

/**
* Allow the given method (or array of methods) for calls
*
Expand Down
2 changes: 2 additions & 0 deletions Neos.Eel/Classes/Validation/ExpressionSyntaxValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)]);
}
}
Expand Down
12 changes: 12 additions & 0 deletions Neos.Eel/Resources/Private/PHP/php-peg/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
* the bracket if a failed match + restore has moved the current position backwards - so we have to check that too.
*/
class ParserRegexp {
protected $parser = null;
protected $rx = '';
protected $matches = null;
protected $match_pos = null;
protected $check_pos = null;

function __construct($parser, $rx) {
$this->parser = $parser;
Expand Down Expand Up @@ -50,6 +55,10 @@ function match() {
* for result construction and building
*/
class Parser {
public $string = '';
public $pos = 0;
protected $depth = 0;
protected $regexps = [];

function __construct($string) {
$this->string = $string;
Expand Down Expand Up @@ -211,6 +220,9 @@ function store(&$result, $subres, $storetag = NULL) {
* @author Hamish Friedlander
*/
class Packrat extends Parser {
protected $packstatebase = '';
protected $packstate = [];
protected $packres = [];

function __construct($string) {
parent::__construct($string);
Expand Down
2 changes: 1 addition & 1 deletion Neos.Eel/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "The Embedded Expression Language (Eel) is a building block for creating Domain Specific Languages",
"require": {
"php": "^8.2",
"neos/flow": "~9.0.0",
"neos/flow": "self.version",
"neos/cache": "self.version",
"neos/utility-unicode": "self.version",
"neos/utility-objecthandling": "self.version"
Expand Down
1 change: 0 additions & 1 deletion Neos.Error.Messages/Classes/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 0 additions & 11 deletions Neos.Flow/.phpstorm.meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@
*/

namespace PHPSTORM_META {

override(
\Neos\Flow\ObjectManagement\ObjectManagerInterface::get(),
map(['' => '@'])
);

override(
\Neos\Flow\Core\Bootstrap::getEarlyInstance(),
map(['' => '@'])
);

expectedArguments(\Neos\Flow\Annotations\Validate::__construct(), 1, 'AggregateBoundary', 'Alphanumeric', 'Boolean', 'Collection', 'Conjunction', 'Count', 'DateTimeRange', 'DateTime', 'Disjunction', 'EmailAddress', 'Float', 'GenericObject', 'Integer', 'Label', 'LocaleIdentifier', 'NotEmpty', 'NumberRange', 'Number', 'Raw', 'RegularExpresion', 'StringLength', 'Text', 'UniqueEntity', 'Uuid');

expectedArguments(\Neos\Flow\Annotations\Scope::__construct(), 0, 'prototype', 'session', 'singleton');
Expand Down
3 changes: 0 additions & 3 deletions Neos.Flow/Classes/Annotations/Inject.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ final class Inject
*/
public $name;

/**
* @param array $values
*/
public function __construct(?string $name = null, bool $lazy = true)
{
$this->lazy = $lazy;
Expand Down
42 changes: 42 additions & 0 deletions Neos.Flow/Classes/Annotations/InjectCache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
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;

/**
* Used to enable property injection for cache frontends.
*
* Flow will build Dependency Injection code for the property and try
* to inject the specified cache.
*
* @Annotation
* @NamedArgumentConstructor
* @Target("PROPERTY")
*/
#[\Attribute(\Attribute::TARGET_PROPERTY)]
final class InjectCache
{
/**
* Identifier for the Cache that will be injected.
*
* Example: Neos_Fusion_Content
*
* @var string
*/
public $identifier;

public function __construct(string $identifier)
{
$this->identifier = $identifier;
}
}
5 changes: 4 additions & 1 deletion Neos.Flow/Classes/Aop/Advice/AdviceChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion Neos.Flow/Classes/Aop/JoinPointInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function hasException();
* If no exception has been thrown, NULL is returned.
* Only makes sense for After Throwing advices.
*
* @return \Exception The exception thrown or NULL
* @return \Exception|null The exception thrown or NULL
*/
public function getException();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 465c80b

Please sign in to comment.