From 9824a7d96360d16011250450601436cd00db811c Mon Sep 17 00:00:00 2001 From: Denny Lubitz Date: Fri, 18 Oct 2024 18:32:03 +0200 Subject: [PATCH] TASK: Remove .value in Fusion migrations --- config/set/contentrepository-90.php | 2 +- .../Rules/FusionNodeTypeNameRector.php | 6 +++--- .../FusionNodeTypeNameRector/Fixture/some_file.fusion.inc | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config/set/contentrepository-90.php b/config/set/contentrepository-90.php index cb5ace8..bae66b4 100644 --- a/config/set/contentrepository-90.php +++ b/config/set/contentrepository-90.php @@ -134,7 +134,7 @@ // setName // getName $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getName', 'nodeName'); - $fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_name', 'Line %LINE: !! You very likely need to rewrite "q(VARIABLE).property("_name")" to "VARIABLE.nodeName.value". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'); + $fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_name', 'Line %LINE: !! You very likely need to rewrite "q(VARIABLE).property("_name")" to "VARIABLE.nodeName". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'); // getLabel $rectorConfig->rule(FusionNodeLabelRector::class); // setProperty diff --git a/src/ContentRepository90/Rules/FusionNodeTypeNameRector.php b/src/ContentRepository90/Rules/FusionNodeTypeNameRector.php index 11bf397..fe30df3 100644 --- a/src/ContentRepository90/Rules/FusionNodeTypeNameRector.php +++ b/src/ContentRepository90/Rules/FusionNodeTypeNameRector.php @@ -14,7 +14,7 @@ class FusionNodeTypeNameRector implements FusionRectorInterface public function getRuleDefinition(): RuleDefinition { - return CodeSampleLoader::fromFile('Fusion: Rewrite node.nodeType.name to node.nodeTypeName.value', __CLASS__); + return CodeSampleLoader::fromFile('Fusion: Rewrite node.nodeType.name to node.nodeTypeName', __CLASS__); } public function refactorFileContent(string $fileContent): string @@ -22,12 +22,12 @@ public function refactorFileContent(string $fileContent): string return EelExpressionTransformer::parse($fileContent) ->process(fn(string $eelExpression) => preg_replace( '/(node|documentNode|site)\.nodeType\.name/', - '$1.nodeTypeName.value', + '$1.nodeTypeName', $eelExpression )) ->addCommentsIfRegexMatches( '/\.nodeType.name/', - '// TODO 9.0 migration: Line %LINE: You may need to rewrite "VARIABLE.nodeType.name" to "VARIABLE.nodeTypeName.value". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.' + '// TODO 9.0 migration: Line %LINE: You may need to rewrite "VARIABLE.nodeType.name" to "VARIABLE.nodeTypeName". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.' )->getProcessedContent(); } } diff --git a/tests/ContentRepository90/Rules/FusionNodeTypeNameRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeTypeNameRector/Fixture/some_file.fusion.inc index 23010be..19b5d73 100644 --- a/tests/ContentRepository90/Rules/FusionNodeTypeNameRector/Fixture/some_file.fusion.inc +++ b/tests/ContentRepository90/Rules/FusionNodeTypeNameRector/Fixture/some_file.fusion.inc @@ -16,7 +16,7 @@ renderer = afx` } } ----- -// TODO 9.0 migration: Line 13: You may need to rewrite "VARIABLE.nodeType.name" to "VARIABLE.nodeTypeName.value". We did not auto-apply this migration because we cannot be sure whether the variable is a Node. +// TODO 9.0 migration: Line 13: You may need to rewrite "VARIABLE.nodeType.name" to "VARIABLE.nodeTypeName". We did not auto-apply this migration because we cannot be sure whether the variable is a Node. prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) { renderer = Neos.Fusion:Component { @@ -24,12 +24,12 @@ renderer = Neos.Fusion:Component { # # pass down props # -attributes = ${node.nodeTypeName.value || documentNode.nodeTypeName.value} +attributes = ${node.nodeTypeName || documentNode.nodeTypeName} renderer = afx` ` }