From 609a153934c792665560118447fe1182a34b79f9 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 21 Jun 2024 22:27:09 +0200 Subject: [PATCH 1/5] TASK: Downmerge readme changes from version 3 --- README.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8ab5eb0..7955659 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Neos Node Templates -When using Neos CMS as an editor, you often work with nested node structures that +When using Neos CMS as an editor, you often work with nested node structures that have to be created manually. This packages aims at easing the editing workflow by -automatically creating helpful child nodes and making useful modifications to node +automatically creating helpful child nodes and making useful modifications to node properties when creating new nodes in the Neos UI. In contrast to child nodes that are defined in the regular node type definition -(which cannot be removed by the editor), all modifications that are made when a +(which cannot be removed by the editor), all modifications that are made when a template is applied can be changed or removed by the editor. The desired node structure is defined in a declarative way in the NodeTypes.yaml @@ -89,7 +89,7 @@ You can also access data from the node creation dialog if you use the ui: showInCreationDialog: true 'cardTitle': - type: string: + type: string label: 'Card Title' options: template: @@ -129,7 +129,7 @@ templates) from being applied, its most common use case is conditional child nod ### Loops Loops can be used to create multiple child nodes. You can use ``withItems`` to define the items -of the loop. When using EEL, be sure to return an array. The current item is available in EEL +of the loop. When using EEL, be sure to return an array. The current item is available in EEL expressions as the ``item`` context variable. The following example creates three different text child nodes in the main content collection: @@ -259,7 +259,7 @@ My.NodeType:Bar (depends on "data" context) The standalone validation should detect errors and prevents editors having to deal with these errors at runtime. -For more complex templates, which are dependent on the node creation data, it is recommended to write separate tests. Currently, errors in templates depending on the data context will only be treated as warning, as they are probably not an issue at runtime. +For more complex templates, which are dependent on the node creation data, it is recommended to write separate tests. Currently, errors in templates depending on the data context will only be treated as warning, as they are probably not an issue at runtime. ## Create template from node subtree @@ -267,9 +267,14 @@ When creating a more complex node template (to create multiple pages and content For this case you can use the command: ```sh -flow nodeTemplate:createFromNodeSubtree +flow nodeTemplate:createFromNodeSubtree ``` +- `--starting-node-id`: specified root node of the node tree + +**options:** +- `--workspace-name`: custom workspace to dump from. Defaults to 'live'. + It will give you the output similar to the yaml example above. References to Nodes and non-primitive property values are commented out in the YAML. From fd492edf64581b455baf0a18aa3fe6dec2854eca Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 21 Jun 2024 22:29:23 +0200 Subject: [PATCH 2/5] TASK: Introduce `getObject` pattern --- .../AbstractNodeTemplateTestCase.php | 22 ++++++++--- Tests/Functional/FakeNodeTypeManagerTrait.php | 12 ++++-- .../Features/Exceptions/ExceptionsTest.php | 12 ------ .../ResolvablePropertiesTest.php | 8 ++-- .../StandaloneValidationCommandTest.php | 38 +++++++++---------- .../FeedbackCollectionMessagesTrait.php | 10 ++++- Tests/Functional/WithConfigurationTrait.php | 2 +- 7 files changed, 58 insertions(+), 46 deletions(-) diff --git a/Tests/Functional/AbstractNodeTemplateTestCase.php b/Tests/Functional/AbstractNodeTemplateTestCase.php index a9f8d2e..5690313 100644 --- a/Tests/Functional/AbstractNodeTemplateTestCase.php +++ b/Tests/Functional/AbstractNodeTemplateTestCase.php @@ -11,7 +11,6 @@ use Neos\ContentRepository\Domain\Model\Workspace; use Neos\ContentRepository\Domain\Repository\ContentDimensionRepository; use Neos\ContentRepository\Domain\Repository\WorkspaceRepository; -use Neos\ContentRepository\Domain\Service\Context; use Neos\ContentRepository\Domain\Service\ContextFactoryInterface; use Neos\ContentRepository\Domain\Service\NodeTypeManager; use Neos\Flow\Tests\FunctionalTestCase; @@ -43,10 +42,11 @@ abstract class AbstractNodeTemplateTestCase extends FunctionalTestCase private NodeTypeManager $nodeTypeManager; - private Context $subgraph; - private string $fixturesDir; + /** @deprecated please use {@see self::getObject()} instead */ + protected $objectManager; + public function setUp(): void { parent::setUp(); @@ -82,6 +82,17 @@ public function tearDown(): void $this->objectManager->forgetInstance(NodeTypeManager::class); } + /** + * @template T of object + * @param class-string $className + * + * @return T + */ + final protected function getObject(string $className): object + { + return $this->objectManager->get($className); + } + private function setupContentRepository(): void { // Create an environment to create nodes. @@ -98,10 +109,9 @@ private function setupContentRepository(): void $this->persistenceManager->persistAll(); $this->contextFactory = $this->objectManager->get(ContextFactoryInterface::class); - $this->subgraph = $this->contextFactory->create(['workspaceName' => 'live']); - - $rootNode = $this->subgraph->getRootNode(); + $subgraph = $this->contextFactory->create(['workspaceName' => 'live']); + $rootNode = $subgraph->getRootNode(); $sitesRootNode = $rootNode->createNode('sites'); $testSiteNode = $sitesRootNode->createNode('test-site'); diff --git a/Tests/Functional/FakeNodeTypeManagerTrait.php b/Tests/Functional/FakeNodeTypeManagerTrait.php index 8107a0f..4c6157e 100644 --- a/Tests/Functional/FakeNodeTypeManagerTrait.php +++ b/Tests/Functional/FakeNodeTypeManagerTrait.php @@ -6,19 +6,25 @@ use Neos\ContentRepository\Domain\Service\NodeTypeManager; use Neos\Flow\Configuration\ConfigurationManager; -use Neos\Flow\ObjectManagement\ObjectManagerInterface; use Neos\Utility\Arrays; use Symfony\Component\Yaml\Yaml; /** - * @property ObjectManagerInterface $objectManager * @property NodeTypeManager $nodeTypeManager */ trait FakeNodeTypeManagerTrait { + /** + * @template T of object + * @param class-string $className + * + * @return T + */ + abstract protected function getObject(string $className): object; + private function loadFakeNodeTypes(): void { - $configuration = $this->objectManager->get(ConfigurationManager::class)->getConfiguration('NodeTypes'); + $configuration = $this->getObject(ConfigurationManager::class)->getConfiguration('NodeTypes'); $fileIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__ . '/Features')); diff --git a/Tests/Functional/Features/Exceptions/ExceptionsTest.php b/Tests/Functional/Features/Exceptions/ExceptionsTest.php index 35ee3c9..c79b0b7 100644 --- a/Tests/Functional/Features/Exceptions/ExceptionsTest.php +++ b/Tests/Functional/Features/Exceptions/ExceptionsTest.php @@ -48,18 +48,6 @@ public function exceptionsAreCaughtAndPartialTemplateIsNotBuild(): void $this->assertLastCreatedTemplateMatchesSnapshot('OnlyExceptions'); - // self::assertSame([ - // [ - // 'message' => 'Template for "WithOneEvaluationException" was not applied. Only Node /sites/test-site/homepage/main/new-node@live[Flowpack.NodeTemplates:Content.WithOneEvaluationException] was created.', - // 'severity' => 'ERROR' - // ], - // [ - // 'message' => 'Expression "${\'left open" in "childNodes.abort.when" | EelException(The EEL expression "${\'left open" was not a valid EEL expression. Perhaps you forgot to wrap it in ${...}?, 1410441849)', - // 'severity' => 'ERROR' - // ] - // ], $this->getMessagesOfFeedbackCollection()); - - $this->assertCaughtExceptionsMatchesSnapshot('OnlyExceptions'); $this->assertNodeDumpAndTemplateDumpMatchSnapshot('OnlyExceptions', $createdNode); }); diff --git a/Tests/Functional/Features/ResolvableProperties/ResolvablePropertiesTest.php b/Tests/Functional/Features/ResolvableProperties/ResolvablePropertiesTest.php index d09a56a..f9f7afb 100644 --- a/Tests/Functional/Features/ResolvableProperties/ResolvablePropertiesTest.php +++ b/Tests/Functional/Features/ResolvableProperties/ResolvablePropertiesTest.php @@ -20,17 +20,17 @@ public function itMatchesSnapshot1(): void $this->createFakeNode('some-node-id'); $this->createFakeNode('other-node-id'); - $resource = $this->objectManager->get(ResourceManager::class)->importResource(__DIR__ . '/image.png'); + $resource = $this->getObject(ResourceManager::class)->importResource(__DIR__ . '/image.png'); $asset = new Asset($resource); ObjectAccess::setProperty($asset, 'Persistence_Object_Identifier', 'c228200e-7472-4290-9936-4454a5b5692a', true); - $this->objectManager->get(AssetRepository::class)->add($asset); + $this->getObject(AssetRepository::class)->add($asset); - $resource2 = $this->objectManager->get(ResourceManager::class)->importResource(__DIR__ . '/image.png'); + $resource2 = $this->getObject(ResourceManager::class)->importResource(__DIR__ . '/image.png'); $image = new Image($resource2); ObjectAccess::setProperty($image, 'Persistence_Object_Identifier', 'c8ae9f9f-dd11-4373-bf42-4bf31ec5bd19', true); - $this->objectManager->get(ImageRepository::class)->add($image); + $this->getObject(ImageRepository::class)->add($image); $createdNode = $this->createNodeInto( $this->homePageMainContentCollectionNode, diff --git a/Tests/Functional/Features/StandaloneValidationCommand/StandaloneValidationCommandTest.php b/Tests/Functional/Features/StandaloneValidationCommand/StandaloneValidationCommandTest.php index 4e27b5e..653b509 100644 --- a/Tests/Functional/Features/StandaloneValidationCommand/StandaloneValidationCommandTest.php +++ b/Tests/Functional/Features/StandaloneValidationCommand/StandaloneValidationCommandTest.php @@ -5,11 +5,8 @@ namespace Flowpack\NodeTemplates\Tests\Functional\Features\StandaloneValidationCommand; use Flowpack\NodeTemplates\Application\Command\NodeTemplateCommandController; -use Flowpack\NodeTemplates\Domain\NodeTemplateDumper\NodeTemplateDumper; -use Flowpack\NodeTemplates\Domain\Template\RootTemplate; use Flowpack\NodeTemplates\Tests\Functional\FakeNodeTypeManagerTrait; use Flowpack\NodeTemplates\Tests\Functional\SnapshotTrait; -use Neos\ContentRepository\Domain\Model\NodeInterface; use Neos\ContentRepository\Domain\Model\Workspace; use Neos\ContentRepository\Domain\Repository\ContentDimensionRepository; use Neos\ContentRepository\Domain\Repository\WorkspaceRepository; @@ -33,14 +30,6 @@ final class StandaloneValidationCommandTest extends FunctionalTestCase private ContextFactoryInterface $contextFactory; - protected NodeInterface $homePageNode; - - protected NodeInterface $homePageMainContentCollectionNode; - - private NodeTemplateDumper $nodeTemplateDumper; - - private RootTemplate $lastCreatedRootTemplate; - private NodeTypeManager $nodeTypeManager; private string $fixturesDir; @@ -49,7 +38,7 @@ public function setUp(): void { parent::setUp(); - $this->nodeTypeManager = $this->objectManager->get(NodeTypeManager::class); + $this->nodeTypeManager = $this->getObject(NodeTypeManager::class); $this->loadFakeNodeTypes(); @@ -63,34 +52,45 @@ public function tearDown(): void { parent::tearDown(); $this->inject($this->contextFactory, 'contextInstances', []); - $this->objectManager->get(FeedbackCollection::class)->reset(); + $this->getObject(FeedbackCollection::class)->reset(); $this->objectManager->forgetInstance(ContentDimensionRepository::class); $this->objectManager->forgetInstance(NodeTypeManager::class); } + /** + * @template T of object + * @param class-string $className + * + * @return T + */ + final protected function getObject(string $className): object + { + return $this->objectManager->get($className); + } + private function setupContentRepository(): void { // Create an environment to create nodes. - $this->objectManager->get(ContentDimensionRepository::class)->setDimensionsConfiguration([]); + $this->getObject(ContentDimensionRepository::class)->setDimensionsConfiguration([]); $liveWorkspace = new Workspace('live'); - $workspaceRepository = $this->objectManager->get(WorkspaceRepository::class); + $workspaceRepository = $this->getObject(WorkspaceRepository::class); $workspaceRepository->add($liveWorkspace); $testSite = new Site('test-site'); $testSite->setSiteResourcesPackageKey('Test.Site'); - $siteRepository = $this->objectManager->get(SiteRepository::class); + $siteRepository = $this->getObject(SiteRepository::class); $siteRepository->add($testSite); $this->persistenceManager->persistAll(); - $this->contextFactory = $this->objectManager->get(ContextFactoryInterface::class); + $this->contextFactory = $this->getObject(ContextFactoryInterface::class); $subgraph = $this->contextFactory->create(['workspaceName' => 'live']); $rootNode = $subgraph->getRootNode(); $sitesRootNode = $rootNode->createNode('sites'); $testSiteNode = $sitesRootNode->createNode('test-site'); - $this->homePageNode = $testSiteNode->createNode( + $testSiteNode->createNode( 'homepage', $this->nodeTypeManager->getNodeType('Flowpack.NodeTemplates:Document.HomePage') ); @@ -99,7 +99,7 @@ private function setupContentRepository(): void /** @test */ public function itMatchesSnapshot() { - $commandController = $this->objectManager->get(NodeTemplateCommandController::class); + $commandController = $this->getObject(NodeTemplateCommandController::class); ObjectAccess::setProperty($commandController, 'response', $cliResponse = new Response(), true); ObjectAccess::getProperty($commandController, 'output', true)->setOutput($bufferedOutput = new BufferedOutput()); diff --git a/Tests/Functional/FeedbackCollectionMessagesTrait.php b/Tests/Functional/FeedbackCollectionMessagesTrait.php index ff79289..bf56190 100644 --- a/Tests/Functional/FeedbackCollectionMessagesTrait.php +++ b/Tests/Functional/FeedbackCollectionMessagesTrait.php @@ -10,10 +10,18 @@ trait FeedbackCollectionMessagesTrait { + /** + * @template T of object + * @param class-string $className + * + * @return T + */ + abstract protected function getObject(string $className): object; + private function getMessagesOfFeedbackCollection(): array { /** @var FeedbackInterface[] $allFeedbacks */ - $allFeedbacks = ObjectAccess::getProperty($this->objectManager->get(FeedbackCollection::class), 'feedbacks', true); + $allFeedbacks = ObjectAccess::getProperty($this->getObject(FeedbackCollection::class), 'feedbacks', true); /** @var AbstractMessageFeedback[] $allFeedbacks */ $messages = []; diff --git a/Tests/Functional/WithConfigurationTrait.php b/Tests/Functional/WithConfigurationTrait.php index 233c50d..7469708 100644 --- a/Tests/Functional/WithConfigurationTrait.php +++ b/Tests/Functional/WithConfigurationTrait.php @@ -18,7 +18,7 @@ trait WithConfigurationTrait */ private function withMockedConfigurationSettings(array $additionalSettings, callable $fn): void { - $configurationManager = $this->objectManager->get(ConfigurationManager::class); + $configurationManager = $this->getObject(ConfigurationManager::class); $configurationManagerMock = $this->getMockBuilder(ConfigurationManager::class)->disableOriginalConstructor()->getMock(); $mockedSettings = Arrays::arrayMergeRecursiveOverrule($configurationManager->getConfiguration('Settings'), $additionalSettings); $configurationManagerMock->expects(self::any())->method('getConfiguration')->willReturnCallback(function (string $configurationType, string $configurationPath = null) use($configurationManager, $mockedSettings) { From 301b05869ed7849b92a08e4a8f102e4c0ee4d472 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 21 Jun 2024 22:38:19 +0200 Subject: [PATCH 3/5] TASK: Simplify `TransientNodeTest` --- .../Domain/NodeCreation/TransientNodeTest.php | 64 ++++++------------- 1 file changed, 19 insertions(+), 45 deletions(-) diff --git a/Tests/Unit/Domain/NodeCreation/TransientNodeTest.php b/Tests/Unit/Domain/NodeCreation/TransientNodeTest.php index 2ba541a..abcb4db 100644 --- a/Tests/Unit/Domain/NodeCreation/TransientNodeTest.php +++ b/Tests/Unit/Domain/NodeCreation/TransientNodeTest.php @@ -64,22 +64,19 @@ class TransientNodeTest extends TestCase type: references YAML; - /** @var array> */ - private array $nodeTypesFixture; - - /** @var array */ - private array $nodeTypes; + private NodeTypeManager $nodeTypeManager; public function setUp(): void { parent::setUp(); - $this->nodeTypesFixture = Yaml::parse(self::NODE_TYPE_FIXTURES); + $this->nodeTypeManager = new NodeTypeManager(); + $this->nodeTypeManager->overrideNodeTypes(Yaml::parse(self::NODE_TYPE_FIXTURES)); } /** @test */ public function fromRegularAllowedChildNode(): void { - $parentNode = $this->createFakeRegularTransientNode($this->getNodeType('A:Content1')); + $parentNode = $this->createFakeRegularTransientNode('A:Content1'); self::assertSame($this->getNodeType('A:Content1'), $parentNode->getNodeType()); $parentNode->requireConstraintsImposedByAncestorsToBeMet($this->getNodeType('A:Content2')); } @@ -87,7 +84,7 @@ public function fromRegularAllowedChildNode(): void /** @test */ public function forTetheredChildNodeAllowedChildNode(): void { - $grandParentNode = $this->createFakeRegularTransientNode($this->getNodeType('A:WithContent1AllowedCollectionAsChildNode')); + $grandParentNode = $this->createFakeRegularTransientNode('A:WithContent1AllowedCollectionAsChildNode'); $parentNode = $grandParentNode->forTetheredChildNode(NodeName::fromString('collection'), []); self::assertSame($this->getNodeType('A:Collection.Allowed'), $parentNode->getNodeType()); @@ -98,7 +95,7 @@ public function forTetheredChildNodeAllowedChildNode(): void /** @test */ public function forTetheredChildNodeAllowedChildNodeBecauseConstraintOverride(): void { - $grandParentNode = $this->createFakeRegularTransientNode($this->getNodeType('A:WithContent1AllowedCollectionAsChildNodeViaOverride')); + $grandParentNode = $this->createFakeRegularTransientNode('A:WithContent1AllowedCollectionAsChildNodeViaOverride'); $parentNode = $grandParentNode->forTetheredChildNode(NodeName::fromString('collection'), []); self::assertSame($this->getNodeType('A:Collection.Disallowed'), $parentNode->getNodeType()); @@ -109,7 +106,7 @@ public function forTetheredChildNodeAllowedChildNodeBecauseConstraintOverride(): /** @test */ public function forRegularChildNodeAllowedChildNode(): void { - $grandParentNode = $this->createFakeRegularTransientNode($this->getNodeType('A:Content1')); + $grandParentNode = $this->createFakeRegularTransientNode('A:Content1'); $parentNode = $grandParentNode->forRegularChildNode($this->getNodeType('A:Content2'), []); self::assertSame($this->getNodeType('A:Content2'), $parentNode->getNodeType()); @@ -123,7 +120,7 @@ public function fromRegularDisallowedChildNode(): void $this->expectException(NodeConstraintException::class); $this->expectExceptionMessage('Node type "A:Content1" is not allowed for child nodes of type A:Collection.Disallowed'); - $parentNode = $this->createFakeRegularTransientNode($this->getNodeType('A:Collection.Disallowed')); + $parentNode = $this->createFakeRegularTransientNode('A:Collection.Disallowed'); self::assertSame($this->getNodeType('A:Collection.Disallowed'), $parentNode->getNodeType()); $parentNode->requireConstraintsImposedByAncestorsToBeMet($this->getNodeType('A:Content1')); @@ -135,7 +132,7 @@ public function forTetheredChildNodeDisallowedChildNode(): void $this->expectException(NodeConstraintException::class); $this->expectExceptionMessage('Node type "A:Content1" is not allowed below tethered child nodes "collection" of nodes of type "A:WithDisallowedCollectionAsChildNode"'); - $grandParentNode = $this->createFakeRegularTransientNode($this->getNodeType('A:WithDisallowedCollectionAsChildNode')); + $grandParentNode = $this->createFakeRegularTransientNode('A:WithDisallowedCollectionAsChildNode'); $parentNode = $grandParentNode->forTetheredChildNode(NodeName::fromString('collection'), []); self::assertSame($this->getNodeType('A:Collection.Disallowed'), $parentNode->getNodeType()); @@ -149,7 +146,7 @@ public function forRegularChildNodeDisallowedChildNode(): void $this->expectException(NodeConstraintException::class); $this->expectExceptionMessage('Node type "A:Content1" is not allowed for child nodes of type A:Collection.Disallowed'); - $grandParentNode = $this->createFakeRegularTransientNode($this->getNodeType('A:Content2')); + $grandParentNode = $this->createFakeRegularTransientNode('A:Content2'); $parentNode = $grandParentNode->forRegularChildNode($this->getNodeType('A:Collection.Disallowed'), []); self::assertSame($this->getNodeType('A:Collection.Disallowed'), $parentNode->getNodeType()); @@ -162,7 +159,7 @@ public function splitPropertiesAndReferencesByTypeDeclaration(): void { $node = TransientNode::forRegular( $this->getNodeType('A:ContentWithProperties'), - $this->getMockBuilder(NodeTypeManager::class)->disableOriginalConstructor()->getMock(), + $this->nodeTypeManager, $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock(), [ 'property-string' => '', @@ -191,11 +188,13 @@ public function splitPropertiesAndReferencesByTypeDeclaration(): void ); } - private function createFakeRegularTransientNode(NodeType $nodeType): TransientNode + private function createFakeRegularTransientNode(string $nodeTypeName): TransientNode { + $nodeType = $this->getNodeType($nodeTypeName); + return TransientNode::forRegular( $nodeType, - $this->getMockBuilder(NodeTypeManager::class)->disableOriginalConstructor()->getMock(), + $this->nodeTypeManager, $this->getMockBuilder(Context::class)->disableOriginalConstructor()->getMock(), [] ); @@ -206,34 +205,9 @@ private function createFakeRegularTransientNode(NodeType $nodeType): TransientNo */ private function getNodeType(string $nodeTypeName): ?NodeType { - if (!isset($this->nodeTypesFixture[$nodeTypeName])) { - return null; - } - - if (isset($this->nodeTypes[$nodeTypeName])) { - return $this->nodeTypes[$nodeTypeName]; - } - - $configuration = $this->nodeTypesFixture[$nodeTypeName]; - $declaredSuperTypes = []; - if (isset($configuration['superTypes']) && is_array($configuration['superTypes'])) { - foreach ($configuration['superTypes'] as $superTypeName => $enabled) { - $declaredSuperTypes[$superTypeName] = $enabled === true ? $this->getNodeType($superTypeName) : null; - } - } - - $nodeType = new NodeType( - $nodeTypeName, - $declaredSuperTypes, - $configuration - ); - - $fakeNodeTypeManager = $this->getMockBuilder(NodeTypeManager::class)->onlyMethods(['getNodeType'])->getMock(); - - $fakeNodeTypeManager->expects(self::any())->method('getNodeType')->willReturnCallback(fn ($nodeType) => $this->getNodeType($nodeType)); - - ObjectAccess::setProperty($nodeType, 'nodeTypeManager', $fakeNodeTypeManager, true); - - return $this->nodeTypes[$nodeTypeName] = $nodeType; + $nodeType = $this->nodeTypeManager->getNodeType($nodeTypeName); + // no di here + ObjectAccess::setProperty($nodeType, 'nodeTypeManager', $this->nodeTypeManager, true); + return $nodeType; } } From ca153772798303bac478c0c75f6a9686623b71ad Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 21 Jun 2024 22:40:41 +0200 Subject: [PATCH 4/5] TASK: Dont `@psalm-` prefix when using phpstan :D --- Classes/Domain/NodeTemplateDumper/Comment.php | 6 ++--- .../TemplateConfigurationProcessor.php | 10 ++++----- .../TemplateConfiguration/TemplatePart.php | 22 +++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Classes/Domain/NodeTemplateDumper/Comment.php b/Classes/Domain/NodeTemplateDumper/Comment.php index 6eb1548..a3c6874 100644 --- a/Classes/Domain/NodeTemplateDumper/Comment.php +++ b/Classes/Domain/NodeTemplateDumper/Comment.php @@ -15,12 +15,12 @@ class Comment { /** - * @psalm-var \Closure(string $indentation, string $propertyName): string $renderFunction + * @var \Closure(string $indentation, string $propertyName): string $renderFunction */ private \Closure $renderFunction; /** - * @psalm-param \Closure(string $indentation, string $propertyName): string $renderFunction + * @param \Closure(string $indentation, string $propertyName): string $renderFunction */ private function __construct(\Closure $renderFunction) { @@ -28,7 +28,7 @@ private function __construct(\Closure $renderFunction) } /** - * @psalm-param \Closure(string $indentation, string $propertyName): string $renderFunction + * @param \Closure(string $indentation, string $propertyName): string $renderFunction */ public static function fromRenderer($renderFunction): self { diff --git a/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php b/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php index 9047921..5e5f189 100644 --- a/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php +++ b/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php @@ -23,8 +23,8 @@ class TemplateConfigurationProcessor protected $eelEvaluationService; /** - * @psalm-param array $configuration - * @psalm-param array $evaluationContext + * @param array $configuration + * @param array $evaluationContext * @param ProcessingErrors $caughtEvaluationExceptions * @return RootTemplate */ @@ -145,9 +145,9 @@ private function createTemplateFromTemplatePart(TemplatePart $templatePart): Tem } /** - * @psalm-param mixed $rawConfigurationValue - * @psalm-param array $evaluationContext - * @psalm-return mixed + * @param mixed $rawConfigurationValue + * @param array $evaluationContext + * @return mixed * @throws \Neos\Eel\ParserException|\Exception */ private function preprocessConfigurationValue($rawConfigurationValue, array $evaluationContext) diff --git a/Classes/Domain/TemplateConfiguration/TemplatePart.php b/Classes/Domain/TemplateConfiguration/TemplatePart.php index 8aad337..d204ca6 100644 --- a/Classes/Domain/TemplateConfiguration/TemplatePart.php +++ b/Classes/Domain/TemplateConfiguration/TemplatePart.php @@ -30,7 +30,7 @@ class TemplatePart /** * @psalm-readonly - * @psalm-var \Closure(mixed $value, array $evaluationContext): mixed + * @var \Closure(mixed $value, array $evaluationContext): mixed */ private \Closure $configurationValueProcessor; @@ -40,9 +40,9 @@ class TemplatePart private ProcessingErrors $processingErrors; /** - * @psalm-param array $configuration - * @psalm-param array $evaluationContext - * @psalm-param \Closure(mixed $value, array $evaluationContext): mixed $configurationValueProcessor + * @param array $configuration + * @param array $evaluationContext + * @param \Closure(mixed $value, array $evaluationContext): mixed $configurationValueProcessor * @throws StopBuildingTemplatePartException */ private function __construct( @@ -61,9 +61,9 @@ private function __construct( } /** - * @psalm-param array $configuration - * @psalm-param array $evaluationContext - * @psalm-param \Closure(mixed $value, array $evaluationContext): mixed $configurationValueProcessor + * @param array $configuration + * @param array $evaluationContext + * @param \Closure(mixed $value, array $evaluationContext): mixed $configurationValueProcessor * @throws StopBuildingTemplatePartException */ public static function createRoot( @@ -102,7 +102,7 @@ public function getFullPathToConfiguration(): array } /** - * @psalm-param string|list $configurationPath + * @param string|list $configurationPath * @throws StopBuildingTemplatePartException */ public function withConfigurationByConfigurationPath($configurationPath): self @@ -117,7 +117,7 @@ public function withConfigurationByConfigurationPath($configurationPath): self } /** - * @psalm-param array $evaluationContext + * @param array $evaluationContext */ public function withMergedEvaluationContext(array $evaluationContext): self { @@ -134,7 +134,7 @@ public function withMergedEvaluationContext(array $evaluationContext): self } /** - * @psalm-param string|list $configurationPath + * @param string|list $configurationPath * @return mixed * @throws StopBuildingTemplatePartException */ @@ -185,7 +185,7 @@ public function getRawConfiguration($configurationPath) } /** - * @psalm-param string|list $configurationPath + * @param string|list $configurationPath */ public function hasConfiguration($configurationPath): bool { From 853ffc276d1f49ef0ee30d259e2f782dbd4fd615 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 21 Jun 2024 22:46:10 +0200 Subject: [PATCH 5/5] TASK: Correctly document `createFromNodeSubtree` --- Classes/Application/Command/NodeTemplateCommandController.php | 4 ++-- Classes/Domain/TemplateConfiguration/EelEvaluationService.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/Application/Command/NodeTemplateCommandController.php b/Classes/Application/Command/NodeTemplateCommandController.php index 377ba9a..24cc3b2 100644 --- a/Classes/Application/Command/NodeTemplateCommandController.php +++ b/Classes/Application/Command/NodeTemplateCommandController.php @@ -51,8 +51,8 @@ class NodeTemplateCommandController extends CommandController * Dump the node tree structure into a NodeTemplate YAML structure. * References to Nodes and non-primitive property values are commented out in the YAML. * - * @param string $startingNodeId specified root node of the node tree - * @param string $workspaceName + * @param string $startingNodeId specified root node of the node tree. + * @param string $workspaceName custom workspace to dump from. Defaults to 'live'. * @return void */ public function createFromNodeSubtreeCommand(string $startingNodeId, string $workspaceName = 'live'): void diff --git a/Classes/Domain/TemplateConfiguration/EelEvaluationService.php b/Classes/Domain/TemplateConfiguration/EelEvaluationService.php index 542c6f4..80d99c2 100644 --- a/Classes/Domain/TemplateConfiguration/EelEvaluationService.php +++ b/Classes/Domain/TemplateConfiguration/EelEvaluationService.php @@ -28,7 +28,7 @@ class EelEvaluationService /** * Evaluate an Eel expression. * - * @param $contextVariables array additional context for eel expressions + * @param array $contextVariables additional context for eel expressions * @return mixed The result of the evaluated Eel expression * @throws ParserException|\Exception */