From faa72c7902c0386f54132d3b18cf2c6242405cde Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 17 Nov 2023 14:55:50 +0100 Subject: [PATCH] TASK: Use `assert` instead of `@var` annotation --- .../Classes/Fusion/ContentElementEditableImplementation.php | 2 +- .../Classes/Fusion/ContentElementWrappingImplementation.php | 2 +- Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php | 2 +- .../Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php | 2 +- Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php | 2 +- .../Classes/ViewHelpers/ContentElement/EditableViewHelper.php | 2 +- Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php b/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php index 244031cb1d6..9e24293f650 100644 --- a/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php +++ b/Neos.Neos/Classes/Fusion/ContentElementEditableImplementation.php @@ -57,8 +57,8 @@ public function evaluate() { $content = $this->getValue(); - /** @var RenderingMode $renderingMode */ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); + assert($renderingMode instanceof RenderingMode); if (!$renderingMode->isEdit) { return $content; } diff --git a/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php b/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php index 8d2439a38dd..6e2b85fbc85 100644 --- a/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php +++ b/Neos.Neos/Classes/Fusion/ContentElementWrappingImplementation.php @@ -67,8 +67,8 @@ public function evaluate() { $content = $this->getValue(); - /** @var RenderingMode $renderingMode */ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); + assert($renderingMode instanceof RenderingMode); if (!$renderingMode->isEdit) { return $content; } diff --git a/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php b/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php index f7c93c09782..151bf487fc4 100644 --- a/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php +++ b/Neos.Neos/Classes/Fusion/ConvertUrisImplementation.php @@ -124,8 +124,8 @@ public function evaluate() ), 1382624087); } - /** @var RenderingMode $renderingMode */ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); + assert($renderingMode instanceof RenderingMode); if ($renderingMode->isEdit && $this->fusionValue('forceConversion') !== true) { return $text; } diff --git a/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php b/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php index 0cf8dc51b74..04123026c66 100644 --- a/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php +++ b/Neos.Neos/Classes/Fusion/ExceptionHandlers/NodeWrappingHandler.php @@ -74,8 +74,8 @@ protected function handle($fusionPath, \Exception $exception, $referenceCode): s /** @var Node $node */ $node = $currentContext['node']; - /** @var RenderingMode $renderingMode */ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); + assert($renderingMode instanceof RenderingMode); $applicationContext = $this->environment->getContext(); if (!$renderingMode->isEdit) { diff --git a/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php b/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php index ddcb58c53fe..fc72801df34 100644 --- a/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php +++ b/Neos.Neos/Classes/Fusion/ExceptionHandlers/PageHandler.php @@ -87,8 +87,8 @@ protected function handle($fusionPath, \Exception $exception, $referenceCode) } if (!is_null($documentNode)) { - /** @var RenderingMode $renderingMode */ $renderingMode = $this->runtime->fusionGlobals->get('renderingMode'); + assert($renderingMode instanceof RenderingMode); if ( $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess') && $renderingMode->isEdit diff --git a/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php b/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php index 4f81f801571..d6f77451288 100644 --- a/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/ContentElement/EditableViewHelper.php @@ -117,8 +117,8 @@ public function render(): string $output = (string)$this->tag->render(); - /** @var RenderingMode $renderingMode */ $renderingMode = $this->getContextVariable('renderingMode'); + assert($renderingMode instanceof RenderingMode); if (!$renderingMode->isEdit) { return $output; } diff --git a/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php b/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php index b7bca5eea1c..dd19d456035 100644 --- a/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/ContentElement/WrapViewHelper.php @@ -87,8 +87,8 @@ public function render(): string ); } - /** @var RenderingMode $renderingMode */ $renderingMode = $fusionObject->getRuntime()->fusionGlobals->get('renderingMode'); + assert($renderingMode instanceof RenderingMode); if (!$renderingMode->isEdit) { return (string)$this->renderChildren(); }