Skip to content

Commit

Permalink
TASK: Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Jan 20, 2024
1 parent 883ad0b commit 9079261
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
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: 3 additions & 3 deletions Neos.Eel/Classes/CompilingEvaluator.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +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 */
/** @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 */
/** @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
7 changes: 5 additions & 2 deletions Neos.Eel/Classes/InterpretedEvaluator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +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 */
/**
* @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 */
/** @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
4 changes: 2 additions & 2 deletions Neos.Flow/Classes/Aop/Advice/AdviceChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* source code.
*/
use Neos\Flow\Aop\JoinPointInterface;
use Neos\Flow\Aop\ProxyInterface;
use Neos\Flow\Aop\ProxyInterface as InternalAopProxyInterface;

/**
* The advice chain holds a number of subsequent advices that
Expand Down Expand Up @@ -57,7 +57,7 @@ public function proceed(JoinPointInterface &$joinPoint)
if ($this->adviceIndex < count($this->advices)) {
$result = $this->advices[$this->adviceIndex]->invoke($joinPoint);
} else {
/** @var ProxyInterface $proxy */
/** @var InternalAopProxyInterface $proxy */
$proxy = $joinPoint->getProxy();
$result = $proxy->Flow_Aop_Proxy_invokeJoinpoint($joinPoint);
}
Expand Down
3 changes: 1 addition & 2 deletions Neos.Flow/Classes/Cli/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Response
private $content = '';

/**
* @var boolean|int
* @var bool|int
*/
private $colorSupport;

Expand Down Expand Up @@ -118,7 +118,6 @@ public function getContent(): string
/**
* Sets color support / styled output to yes, no or auto detection
*
* @deprecated and will be removed https://github.com/neos/flow-development-collection/pull/3262
* @param boolean $colorSupport true, false or NULL (= autodetection)
* @return void
*/
Expand Down
5 changes: 2 additions & 3 deletions Neos.Flow/Classes/Command/ResourceCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -239,7 +238,7 @@ public function cleanCommand()
foreach ($brokenResources as $key => $resourceIdentifier) {
$resource = $this->resourceRepository->findByIdentifier($resourceIdentifier);
$brokenResources[$key] = $resource;
if ($mediaPackagePresent && class_exists(AssetRepository::class) && class_exists(ThumbnailRepository::class)) {
if ($mediaPackagePresent && $assetRepository !== null && $thumbnailRepository !== null) {
$assets = $assetRepository->findByResource($resource);
if ($assets !== null) {
$relatedAssets[$resource] = $assets;
Expand Down Expand Up @@ -281,7 +280,7 @@ public function cleanCommand()
]);
$resource->disableLifecycleEvents();
$this->resourceRepository->remove($resource);
if ($mediaPackagePresent && class_exists(AssetRepository::class) && class_exists(ThumbnailRepository::class)) {
if ($mediaPackagePresent && $assetRepository !== null && $thumbnailRepository !== null) {
if (isset($relatedAssets[$resource])) {
foreach ($relatedAssets[$resource] as $asset) {
$assetRepository->removeWithoutUsageChecks($asset);
Expand Down
1 change: 0 additions & 1 deletion Neos.Flow/Classes/Log/ThrowableStorage/FileStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ protected function cleanupThrowableDumps(): void
$cutoffTime = time() - $this->maximumThrowableDumpAge;

$iterator = new \DirectoryIterator($this->storagePath);
/** @var \DirectoryIterator $directoryEntry */
foreach ($iterator as $directoryEntry) {
if ($directoryEntry->isFile() && $directoryEntry->getCTime() < $cutoffTime) {
unlink($directoryEntry->getRealPath());
Expand Down
3 changes: 2 additions & 1 deletion Neos.FluidAdaptor/Classes/Core/Cache/CacheAdaptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
$this->flowCache->flush();
return null;
}
}

Expand Down
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ parameters:
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
Expand Down

0 comments on commit 9079261

Please sign in to comment.