From 930bba2d6ed7be86e06c3b5f7859496cd434da07 Mon Sep 17 00:00:00 2001 From: Denny Lubitz Date: Fri, 18 Oct 2024 18:23:36 +0200 Subject: [PATCH 1/2] TASK: Repair docs generate --- docs/rules_overview.md | 1012 +++++++++++++++-- .../FusionPrototypeNameAddCommentRector.php | 6 +- .../FusionReplacePrototypeNameRector.php | 12 +- .../Fixture/some_class.php.inc | 0 .../NodeTypeAllowsGrandchildNodeTypeTest.php | 0 .../config/configured_rule.php | 0 .../Fixture/some_class.php.inc | 0 .../Fixture/some_class2.php.inc | 0 .../Fixture/some_class3.php.inc | 0 .../Fixture/some_class4.php.inc | 0 .../Fixture/some_class5.php.inc | 0 .../NodeTypeGetAutoCreatedChildNodesTest.php | 0 .../config/configured_rule.php | 0 .../Fixture/some_class.php.inc | 0 .../Fixture/some_class2.php.inc | 0 .../Fixture/some_class3.php.inc | 0 ...eTypeGetTypeOfAutoCreatedChildNodeTest.php | 0 .../config/configured_rule.php | 0 .../Fixture/primary1.fusion.inc | 0 .../Fixture/primary2.fusion.inc | 0 .../Fixture/some_file.fusion.inc | 0 .../FusionPrototypeNameCommentTest.php | 2 +- .../config/configured_rule.php | 0 .../skip_prototype_definition.fusion.inc | 0 .../Fixture/some_file.fusion.inc | 0 .../FusionPrototypeNameReplacementTest.php | 2 +- .../config/configured_rule.php | 0 ...lready_content_repository_registry.php.inc | 33 - ...has_already_rendering_mode_service.php.inc | 35 - .../AnnotationToAttributeTest.php | 2 +- .../Fixture/aspect.php.inc | 0 .../Fixture/autowiring.php.inc | 0 .../Fixture/compilestatic.php.inc | 0 .../Fixture/entity.php.inc | 0 .../Fixture/entitywithrepository.php.inc | 0 .../Fixture/flushescaches.php.inc | 0 .../Fixture/identity.php.inc | 0 .../Fixture/ignorevalidation.php.inc | 0 .../Fixture/inject.php.inc | 0 .../Fixture/injectconfiguration.php.inc | 0 .../Fixture/internal.php.inc | 0 .../Fixture/lazy.php.inc | 0 .../Fixture/maprequestbody.php.inc | 0 .../Fixture/proxy.php.inc | 0 .../Fixture/scope.php.inc | 0 .../Fixture/session.php.inc | 0 .../Fixture/signal.php.inc | 0 .../Fixture/skipcsrfprotection.php.inc | 0 .../Fixture/transient.php.inc | 0 .../Fixture/validate.php.inc | 0 .../Fixture/value_object.php.inc | 0 .../config/configured_rule.php | 0 52 files changed, 923 insertions(+), 181 deletions(-) rename tests/ContentRepository90/Rules/{NodeTypeAllowsGrandchildNodeType => NodeTypeAllowsGrandchildNodeTypeRector}/Fixture/some_class.php.inc (100%) rename tests/ContentRepository90/Rules/{NodeTypeAllowsGrandchildNodeType => NodeTypeAllowsGrandchildNodeTypeRector}/NodeTypeAllowsGrandchildNodeTypeTest.php (100%) rename tests/ContentRepository90/Rules/{NodeTypeAllowsGrandchildNodeType => NodeTypeAllowsGrandchildNodeTypeRector}/config/configured_rule.php (100%) rename tests/ContentRepository90/Rules/{NodeTypeGetAutoCreatedChildNodes => NodeTypeGetAutoCreatedChildNodesRector}/Fixture/some_class.php.inc (100%) rename tests/ContentRepository90/Rules/{NodeTypeGetAutoCreatedChildNodes => NodeTypeGetAutoCreatedChildNodesRector}/Fixture/some_class2.php.inc (100%) rename tests/ContentRepository90/Rules/{NodeTypeGetAutoCreatedChildNodes => NodeTypeGetAutoCreatedChildNodesRector}/Fixture/some_class3.php.inc (100%) rename tests/ContentRepository90/Rules/{NodeTypeGetAutoCreatedChildNodes => NodeTypeGetAutoCreatedChildNodesRector}/Fixture/some_class4.php.inc (100%) rename tests/ContentRepository90/Rules/{NodeTypeGetAutoCreatedChildNodes => NodeTypeGetAutoCreatedChildNodesRector}/Fixture/some_class5.php.inc (100%) rename tests/ContentRepository90/Rules/{NodeTypeGetAutoCreatedChildNodes => NodeTypeGetAutoCreatedChildNodesRector}/NodeTypeGetAutoCreatedChildNodesTest.php (100%) rename tests/ContentRepository90/Rules/{NodeTypeGetAutoCreatedChildNodes => NodeTypeGetAutoCreatedChildNodesRector}/config/configured_rule.php (100%) rename tests/ContentRepository90/Rules/{NodeTypeGetTypeOfAutoCreatedChildNode => NodeTypeGetTypeOfAutoCreatedChildNodeRector}/Fixture/some_class.php.inc (100%) rename tests/ContentRepository90/Rules/{NodeTypeGetTypeOfAutoCreatedChildNode => NodeTypeGetTypeOfAutoCreatedChildNodeRector}/Fixture/some_class2.php.inc (100%) rename tests/ContentRepository90/Rules/{NodeTypeGetTypeOfAutoCreatedChildNode => NodeTypeGetTypeOfAutoCreatedChildNodeRector}/Fixture/some_class3.php.inc (100%) rename tests/ContentRepository90/Rules/{NodeTypeGetTypeOfAutoCreatedChildNode => NodeTypeGetTypeOfAutoCreatedChildNodeRector}/NodeTypeGetTypeOfAutoCreatedChildNodeTest.php (100%) rename tests/ContentRepository90/Rules/{NodeTypeGetTypeOfAutoCreatedChildNode => NodeTypeGetTypeOfAutoCreatedChildNodeRector}/config/configured_rule.php (100%) rename tests/Generic/Rules/{FusionPrototypeNameAddComment => FusionPrototypeNameAddCommentRector}/Fixture/primary1.fusion.inc (100%) rename tests/Generic/Rules/{FusionPrototypeNameAddComment => FusionPrototypeNameAddCommentRector}/Fixture/primary2.fusion.inc (100%) rename tests/Generic/Rules/{FusionPrototypeNameAddComment => FusionPrototypeNameAddCommentRector}/Fixture/some_file.fusion.inc (100%) rename tests/Generic/Rules/{FusionPrototypeNameAddComment => FusionPrototypeNameAddCommentRector}/FusionPrototypeNameCommentTest.php (89%) rename tests/Generic/Rules/{FusionPrototypeNameAddComment => FusionPrototypeNameAddCommentRector}/config/configured_rule.php (100%) rename tests/Generic/Rules/{FusionPrototypeNameReplacement => FusionReplacePrototypeNameRector}/Fixture/skip_prototype_definition.fusion.inc (100%) rename tests/Generic/Rules/{FusionPrototypeNameReplacement => FusionReplacePrototypeNameRector}/Fixture/some_file.fusion.inc (100%) rename tests/Generic/Rules/{FusionPrototypeNameReplacement => FusionReplacePrototypeNameRector}/FusionPrototypeNameReplacementTest.php (89%) rename tests/Generic/Rules/{FusionPrototypeNameReplacement => FusionReplacePrototypeNameRector}/config/configured_rule.php (100%) delete mode 100644 tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/has_already_content_repository_registry.php.inc delete mode 100644 tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/has_already_rendering_mode_service.php.inc rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/AnnotationToAttributeTest.php (90%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/aspect.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/autowiring.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/compilestatic.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/entity.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/entitywithrepository.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/flushescaches.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/identity.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/ignorevalidation.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/inject.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/injectconfiguration.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/internal.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/lazy.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/maprequestbody.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/proxy.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/scope.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/session.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/signal.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/skipcsrfprotection.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/transient.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/validate.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/Fixture/value_object.php.inc (100%) rename tests/Rules/{AnnotationToAttribute => AnnotationToAttributeRector}/config/configured_rule.php (100%) diff --git a/docs/rules_overview.md b/docs/rules_overview.md index df7d737..565894b 100644 --- a/docs/rules_overview.md +++ b/docs/rules_overview.md @@ -1,4 +1,4 @@ -# 34 Rules Overview +# 57 Rules Overview ## ContentDimensionCombinatorGetAllAllowedCombinationsRector @@ -36,6 +36,19 @@
+## ContentRepositoryUtilityRenderValidNodeNameRector + +Replaces Utility::renderValidNodeName(...) into NodeName::fromString(...)->value. + +- class: [`Neos\Rector\ContentRepository90\Rules\ContentRepositoryUtilityRenderValidNodeNameRector`](../src/ContentRepository90/Rules/ContentRepositoryUtilityRenderValidNodeNameRector.php) + +```diff +-\Neos\ContentRepository\Utility::renderValidNodeName('foo'); ++\Neos\ContentRepository\Core\SharedModel\Node\NodeName::fromString('foo')->value; +``` + +
+ ## ContextFactoryToLegacyContextStubRector `"ContextFactory::create()"` will be rewritten. @@ -72,6 +85,31 @@
+## ContextGetCurrentRenderingModeRector + +`"ContentContext::getCurrentRenderingMode()"` will be replaced with `RenderingModeService::findByCurrentUser().` + +- class: [`Neos\Rector\ContentRepository90\Rules\ContextGetCurrentRenderingModeRector`](../src/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector.php) + +```diff + getCurrentRenderingMode(); ++ $renderingMode = $this->renderingModeService->findByCurrentUser(); + } + } + + ?> +``` + +
+ ## ContextGetFirstLevelNodeCacheRector `"Context::getFirstLevelNodeCache()"` will be removed. @@ -125,6 +163,64 @@
+## ContextIsInBackendRector + +`"ContentContext::isLive()"` will be replaced with `RenderingModeService::findByCurrentUser().` + +- class: [`Neos\Rector\ContentRepository90\Rules\ContextIsInBackendRector`](../src/ContentRepository90/Rules/ContextIsInBackendRector.php) + +```diff + isInBackend(); +- if ($context->isInBackend() && $foo == 'bar') { ++ $isInBackend = $this->renderingModeService->findByCurrentUser()->isEdit; ++ if ($this->renderingModeService->findByCurrentUser()->isEdit && $foo == 'bar') { + return true; + } + } + } + + ?> +``` + +
+ +## ContextIsLiveRector + +`"ContentContext::isLive()"` will be replaced with `RenderingModeService::findByCurrentUser().` + +- class: [`Neos\Rector\ContentRepository90\Rules\ContextIsLiveRector`](../src/ContentRepository90/Rules/ContextIsLiveRector.php) + +```diff + isLive(); +- if ($context->isLive() && $foo == 'bar') { ++ $isLive = !$this->renderingModeService->findByCurrentUser()->isEdit && !$this->renderingModeService->findByCurrentUser()->isPreview; ++ if (!$this->renderingModeService->findByCurrentUser()->isEdit && !$this->renderingModeService->findByCurrentUser()->isPreview && $foo == 'bar') { + return true; + } + } + } + + ?> +``` + +
+ ## FusionCachingNodeInEntryIdentifierRector Fusion: Rewrite node to Neos.Caching.entryIdentifierForNode(...) in @cache.entryIdentifier segments @@ -154,9 +250,48 @@ Fusion: Rewrite node to Neos.Caching.entryIdentifierForNode(...) in @cache.entry
+## FusionContextCurrentRenderingModeRector + +Fusion: Rewrite node.context.currentRenderingMode... to renderingMode... + +- class: [`Neos\Rector\ContentRepository90\Rules\FusionContextCurrentRenderingModeRector`](../src/ContentRepository90/Rules/FusionContextCurrentRenderingModeRector.php) + +```diff ++// TODO 9.0 migration: Line 9: You very likely need to rewrite "VARIABLE.context.currentRenderingMode..." to "renderingMode...". 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 { + +- nodeAttributes = ${node.context.currentRenderingMode.edit || node.context.currentRenderingMode.preview || node.context.currentRenderingMode.title || node.context.currentRenderingMode.name || node.context.currentRenderingMode.fusionPath || node.context.currentRenderingMode.options['foo']} +- siteAttributes = ${site.context.currentRenderingMode.edit || site.context.currentRenderingMode.preview || site.context.currentRenderingMode.title || site.context.currentRenderingMode.name || site.context.currentRenderingMode.fusionPath || site.context.currentRenderingMode.options['foo']} +- documentNodeAttributes = ${documentNode.context.currentRenderingMode.edit || documentNode.context.currentRenderingMode.preview || documentNode.context.currentRenderingMode.title || documentNode.context.currentRenderingMode.name || documentNode.context.currentRenderingMode.fusionPath || documentNode.context.currentRenderingMode.options['foo']} ++ nodeAttributes = ${renderingMode.isEdit || renderingMode.isPreview || renderingMode.title || renderingMode.name || renderingMode.fusionPath || renderingMode.options['foo']} ++ siteAttributes = ${renderingMode.isEdit || renderingMode.isPreview || renderingMode.title || renderingMode.name || renderingMode.fusionPath || renderingMode.options['foo']} ++ documentNodeAttributes = ${renderingMode.isEdit || renderingMode.isPreview || renderingMode.title || renderingMode.name || renderingMode.fusionPath || renderingMode.options['foo']} + other = ${other.context.currentRenderingMode.edit || other.context.currentRenderingMode.preview || other.context.currentRenderingMode.title || other.context.currentRenderingMode.name || other.context.currentRenderingMode.fusionPath || other.context.currentRenderingMode.options['foo']} + + renderer = afx` + + ` + } + } +``` + +
+ ## FusionContextCurrentSiteRector -Fusion: Rewrite node.context.inBackend to Neos.Node.inBackend(...) +Fusion: Rewrite node.context.currentSite to Neos.Site.findBySiteNode(site) - class: [`Neos\Rector\ContentRepository90\Rules\FusionContextCurrentSiteRector`](../src/ContentRepository90/Rules/FusionContextCurrentSiteRector.php) @@ -183,12 +318,12 @@ Fusion: Rewrite node.context.inBackend to Neos.Node.inBackend(...) ## FusionContextInBackendRector -Fusion: Rewrite node.context.inBackend to Neos.Node.inBackend(...) +Fusion: Rewrite "node.context.inBackend" to "renderingMode.isEdit" - class: [`Neos\Rector\ContentRepository90\Rules\FusionContextInBackendRector`](../src/ContentRepository90/Rules/FusionContextInBackendRector.php) ```diff -+// TODO 9.0 migration: Line 26: You very likely need to rewrite "VARIABLE.context.inBackend" to Neos.Node.inBackend(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node. ++// TODO 9.0 migration: Line 26: You very likely need to rewrite "VARIABLE.context.inBackend" to "renderingMode.isEdit". 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 { @@ -197,7 +332,7 @@ Fusion: Rewrite node.context.inBackend to Neos.Node.inBackend(...) # pass down props # - attributes = ${node.context.inBackend || site.context.inBackend || documentNode.context.inBackend} -+ attributes = ${Neos.Node.inBackend(node) || Neos.Node.inBackend(site) || Neos.Node.inBackend(documentNode)} ++ attributes = ${renderingMode.isEdit || renderingMode.isEdit || renderingMode.isEdit} # # the `checked` state is calculated outside the renderer to allow` overriding via `attributes` @@ -214,11 +349,11 @@ Fusion: Rewrite node.context.inBackend to Neos.Node.inBackend(...) ` } @@ -229,12 +364,12 @@ Fusion: Rewrite node.context.inBackend to Neos.Node.inBackend(...) ## FusionContextLiveRector -Fusion: Rewrite node.context.live to Neos.Node.isLive(...) +Fusion: Rewrite "node.context.live" to "!renderingMode.isEdit" - class: [`Neos\Rector\ContentRepository90\Rules\FusionContextLiveRector`](../src/ContentRepository90/Rules/FusionContextLiveRector.php) ```diff -+// TODO 9.0 migration: Line 26: You very likely need to rewrite "VARIABLE.context.live" to Neos.Node.isLive(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node. ++// TODO 9.0 migration: Line 26: You very likely need to rewrite "VARIABLE.context.live" to "!renderingMode.isEdit". 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 { @@ -243,7 +378,7 @@ Fusion: Rewrite node.context.live to Neos.Node.isLive(...) # pass down props # - attributes = ${node.context.live || site.context.live || documentNode.context.live} -+ attributes = ${Neos.Node.isLive(node) || Neos.Node.isLive(site) || Neos.Node.isLive(documentNode)} ++ attributes = ${!renderingMode.isEdit || !renderingMode.isEdit || !renderingMode.isEdit} # # the `checked` state is calculated outside the renderer to allow` overriding via `attributes` @@ -260,11 +395,11 @@ Fusion: Rewrite node.context.live to Neos.Node.isLive(...) ` } @@ -273,9 +408,61 @@ Fusion: Rewrite node.context.live to Neos.Node.isLive(...)
+## FusionFlowQueryNodePropertyToWarningCommentRector + +Fusion: Adds a warning comment when the defined property is used within an FlowQuery `"property()".` + +:wrench: **configure it!** + +- class: [`Neos\Rector\Generic\Rules\FusionFlowQueryNodePropertyToWarningCommentRector`](../src/Generic/Rules/FusionFlowQueryNodePropertyToWarningCommentRector.php) + +```php +extension('rectorConfig', [ + [ + 'class' => FusionFlowQueryNodePropertyToWarningCommentRector::class, + 'configuration' => [ + new FusionFlowQueryNodePropertyToWarningComment('_autoCreated', 'Line %LINE: !! You very likely need to rewrite "q(VARIABLE).property("_autoCreated")" to "VARIABLE.classification.tethered". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'), + ], + ], + ]); +}; +``` + +↓ + +```diff ++// TODO 9.0 migration: Line 11: !! You very likely need to rewrite "q(VARIABLE).property("_autoCreated")" to "VARIABLE.classification.tethered". We did not auto-apply this migration because we cannot be sure whether the variable is a Node. ++// TODO 9.0 migration: Line 12: !! You very likely need to rewrite "q(VARIABLE).property("_autoCreated")" to "VARIABLE.classification.tethered". 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 very likely need to rewrite "q(VARIABLE).property("_autoCreated")" to "VARIABLE.classification.tethered". We did not auto-apply this migration because we cannot be sure whether the variable is a Node. ++// TODO 9.0 migration: Line 11: !! You very likely need to rewrite "q(VARIABLE).property("_contextPath")" to "Neos.Node.serializedNodeAddress(VARIABLE)". We did not auto-apply this migration because we cannot be sure whether the variable is a Node. ++// TODO 9.0 migration: Line 12: !! You very likely need to rewrite "q(VARIABLE).property("_contextPath")" to "Neos.Node.serializedNodeAddress(VARIABLE)". 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 very likely need to rewrite "q(VARIABLE).property("_contextPath")" to "Neos.Node.serializedNodeAddress(VARIABLE)". 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 { + + attributes = ${q(node).property('_autoCreated') || q(site).property("_contextPath")} + attributes2 = ${q(site).property('_autoCreated') || q(site).property("_contextPath")} + attributes3 = ${q(node).parent().property('_autoCreated') || q(node).parent().property("_contextPath")} + + } + } +``` + +
+ ## FusionNodeAggregateIdentifierRector -Fusion: Rewrite node.nodeAggregateIdentifier to node.nodeAggregateId.value +Fusion: Rewrite node.nodeAggregateIdentifier to `q(node).id()` - class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeAggregateIdentifierRector`](../src/ContentRepository90/Rules/FusionNodeAggregateIdentifierRector.php) @@ -289,14 +476,14 @@ Fusion: Rewrite node.nodeAggregateIdentifier to node.nodeAggregateId.value # pass down props # - attributes = ${node.nodeAggregateIdentifier || documentNode.nodeAggregateIdentifier} -+ attributes = ${node.nodeAggregateId.value || documentNode.nodeAggregateId.value} ++ attributes = ${q(node).id() || q(documentNode).id()} renderer = afx` ` } @@ -305,14 +492,112 @@ Fusion: Rewrite node.nodeAggregateIdentifier to node.nodeAggregateId.value
+## FusionNodeAutoCreatedRector + +Fusion: Rewrite node.autoCreated to node.classification.tethered + +- class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeAutoCreatedRector`](../src/ContentRepository90/Rules/FusionNodeAutoCreatedRector.php) + +```diff ++// TODO 9.0 migration: Line 26: !! You very likely need to rewrite "VARIABLE.autoCreated" to "VARIABLE.classification.tethered". 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 { + + # + # pass down props + # +- attributes = ${node.autoCreated || documentNode.autoCreated} ++ attributes = ${node.classification.tethered || documentNode.classification.tethered} + + # + # the `checked` state is calculated outside the renderer to allow` overriding via `attributes` + # + checked = false + checked.@process.checkMultiValue = ${Array.indexOf(field.getCurrentMultivalueStringified(), field.getTargetValueStringified()) > -1} + checked.@process.checkMultiValue.@if.hasValue = ${field.hasCurrentValue()} + checked.@process.checkMultiValue.@if.isMultiple = ${field.isMultiple()} + checked.@process.checkSingleValue = ${field.getCurrentValueStringified() == field.getTargetValueStringified()} + checked.@process.checkSingleValue.@if.hasValue = ${field.hasCurrentValue()} + checked.@process.checkSingleValue.@if.isSingle = ${!field.isMultiple()} + + renderer = afx` + + ` + } + } +``` + +
+ +## FusionNodeContextPathRector + +Fusion: Rewrite node.contextPath to Neos.Node.serializedNodeAddress(node) + +- class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeContextPathRector`](../src/ContentRepository90/Rules/FusionNodeContextPathRector.php) + +```diff ++// TODO 9.0 migration: Line 12: !! You very likely need to rewrite "q(VARIABLE).property('_contextPath')" to "Neos.Node.serializedNodeAddress(VARIABLE)". We did not auto-apply this migration because we cannot be sure whether the variable is a Node. ++// TODO 9.0 migration: Line 28: !! You very likely need to rewrite "VARIABLE.contextPath" to "Neos.Node.serializedNodeAddress(VARIABLE)". 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 { + + # + # pass down props + # +- attributes = ${node.contextPath || documentNode.contextPath || q(node).property('_contextPath') || q(documentNode).property("_contextPath")} +- foo = ${q(bar).property('_contextPath') || q(bar).property("_contextPath")} ++ attributes = ${Neos.Node.serializedNodeAddress(node) || Neos.Node.serializedNodeAddress(documentNode) || Neos.Node.serializedNodeAddress(node) || Neos.Node.serializedNodeAddress(documentNode)} ++ foo = ${Neos.Node.serializedNodeAddress(bar) || Neos.Node.serializedNodeAddress(bar)} + boo = ${q(nodes).first().property('_contextPath') || q(nodes).first().property("_contextPath")} + + # + # the `checked` state is calculated outside the renderer to allow` overriding via `attributes` + # + checked = false + checked.@process.checkMultiValue = ${Array.indexOf(field.getCurrentMultivalueStringified(), field.getTargetValueStringified()) > -1} + checked.@process.checkMultiValue.@if.hasValue = ${field.hasCurrentValue()} + checked.@process.checkMultiValue.@if.isMultiple = ${field.isMultiple()} + checked.@process.checkSingleValue = ${field.getCurrentValueStringified() == field.getTargetValueStringified()} + checked.@process.checkSingleValue.@if.hasValue = ${field.hasCurrentValue()} + checked.@process.checkSingleValue.@if.isSingle = ${!field.isMultiple()} + + renderer = afx` + + ` + } + } +``` + +
+ ## FusionNodeDepthRector -Fusion: Rewrite node.depth to Neos.Node.depth(node) +Fusion: Rewrite node.depth and q(node).property("_depth") to Neos.Node.depth(node) - class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeDepthRector`](../src/ContentRepository90/Rules/FusionNodeDepthRector.php) ```diff -+// TODO 9.0 migration: Line 26: You may need to rewrite "VARIABLE.depth" to Neos.Node.depth(VARIABLE). 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 "q(VARIABLE).property('_depth')" to Neos.Node.depth(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node. ++// TODO 9.0 migration: Line 29: You may need to rewrite "VARIABLE.depth" to Neos.Node.depth(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node. ++// TODO 9.0 migration: Line 30: You may need to rewrite "VARIABLE.depth" to Neos.Node.depth(VARIABLE). 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 { @@ -320,8 +605,11 @@ Fusion: Rewrite node.depth to Neos.Node.depth(node) # # pass down props # -- attributes = ${node.depth || documentNode.depth} -+ attributes = ${Neos.Node.depth(node) || Neos.Node.depth(documentNode)} +- attributes = ${node.depth || documentNode.depth || q(node).property('_depth') || q(documentNode).property("_depth")} +- foo = ${q(bar).property('_depth') || q(bar).property("_depth")} ++ attributes = ${Neos.Node.depth(node) || Neos.Node.depth(documentNode) || Neos.Node.depth(node) || Neos.Node.depth(documentNode)} ++ foo = ${Neos.Node.depth(bar) || Neos.Node.depth(bar)} + boo = ${q(nodes).first().property('_depth') || q(nodes).first().property("_depth")} # # the `checked` state is calculated outside the renderer to allow` overriding via `attributes` @@ -339,7 +627,8 @@ Fusion: Rewrite node.depth to Neos.Node.depth(node) type="checkbox" - name={node.depth} + name={Neos.Node.depth(node)} - value={someOtherVariable.depth} + value={someOtherVariable.depth || something} + path={someOtherVariable.depth} checked={props.checked} - {...node.depth} + {...Neos.Node.depth(node)} @@ -351,14 +640,88 @@ Fusion: Rewrite node.depth to Neos.Node.depth(node)
+## FusionNodeHiddenAfterDateTimeRector + +Fusion: Rewrite node.hiddenAfterDateTime to q(node).property("disableAfterDateTime") + +- class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeHiddenAfterDateTimeRector`](../src/ContentRepository90/Rules/FusionNodeHiddenAfterDateTimeRector.php) + +```diff ++// TODO 9.0 migration: Line 16: You may need to rewrite "VARIABLE.hiddenAfterDateTime" to q(VARIABLE).property("disableAfterDateTime"). 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 { + + # + # pass down props + # +- attributes = ${node.hiddenAfterDateTime || documentNode.hiddenAfterDateTime} +- attributes2 = ${q(node).property("_hiddenAfterDateTime")} ++ attributes = ${q(node).property("disableAfterDateTime") || q(documentNode).property("disableAfterDateTime")} ++ attributes2 = ${q(node).property("disableAfterDateTime")} + + renderer = afx` + + ` + } + } +``` + +
+ +## FusionNodeHiddenBeforeDateTimeRector + +Fusion: Rewrite node.hiddenBeforeDateTime to q(node).property("enableAfterDateTime") + +- class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeHiddenBeforeDateTimeRector`](../src/ContentRepository90/Rules/FusionNodeHiddenBeforeDateTimeRector.php) + +```diff ++// TODO 9.0 migration: Line 16: You may need to rewrite "VARIABLE.hiddenBeforeDateTime" to q(VARIABLE).property("enableAfterDateTime"). 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 { + + # + # pass down props + # +- attributes = ${node.hiddenBeforeDateTime || documentNode.hiddenBeforeDateTime} +- attribute2 = ${q(node).property("_hiddenBeforeDateTime")} ++ attributes = ${q(node).property("enableAfterDateTime") || q(documentNode).property("enableAfterDateTime")} ++ attribute2 = ${q(node).property("enableAfterDateTime")} + + renderer = afx` + + ` + } + } +``` + +
+ ## FusionNodeHiddenInIndexRector -Fusion: Rewrite node.hiddenInIndex to node.properties._hiddenInIndex +Fusion: Rewrite node.hiddenInIndex and q(node).property("_hiddenInIndex") to node.property('hiddenInIndex') - class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeHiddenInIndexRector`](../src/ContentRepository90/Rules/FusionNodeHiddenInIndexRector.php) ```diff -+// TODO 9.0 migration: Line 26: You may need to rewrite "VARIABLE.hiddenInIndex" to VARIABLE.properties._hiddenInIndex. We did not auto-apply this migration because we cannot be sure whether the variable is a Node. ++// TODO 9.0 migration: Line 26: You may need to rewrite "VARIABLE.hiddenInIndex" to VARIABLE.property('hiddenInMenu'). 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 { @@ -366,8 +729,8 @@ Fusion: Rewrite node.hiddenInIndex to node.properties._hiddenInIndex # # pass down props # -- attributes = ${node.hiddenInIndex || documentNode.hiddenInIndex || site.hiddenInIndex} -+ attributes = ${node.properties._hiddenInIndex || documentNode.properties._hiddenInIndex || site.properties._hiddenInIndex} +- attributes = ${node.hiddenInIndex || documentNode.hiddenInIndex || site.hiddenInIndex || q(node).property('_hiddenInIndex') || q(documentNode).property("_hiddenInIndex")} ++ attributes = ${node.property('hiddenInMenu') || documentNode.property('hiddenInMenu') || site.property('hiddenInMenu') || q(node).property('hiddenInMenu') || q(documentNode).property('hiddenInMenu')} # # the `checked` state is calculated outside the renderer to allow` overriding via `attributes` @@ -384,11 +747,11 @@ Fusion: Rewrite node.hiddenInIndex to node.properties._hiddenInIndex ` } @@ -397,14 +760,34 @@ Fusion: Rewrite node.hiddenInIndex to node.properties._hiddenInIndex
+## FusionNodeHiddenRector + +Fusion: Rewrite node.hidden and q(node).property("_hidden") to Neos.Node.isDisabled(node) + +- class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeHiddenRector`](../src/ContentRepository90/Rules/FusionNodeHiddenRector.php) + +```diff ++// TODO 9.0 migration: Line 5: You may need to rewrite "q(VARIABLE).property('_hidden')" to Neos.Node.isDisabled(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node. + prototype(Neos.Rector:Test) < prototype(Neos.Fusion:Value) { +- node = ${q(node).property('_hidden') || q(documentNode).property("_hidden") || q(site).property("_hidden")} +- otherVariable = ${q(someOtherVariable).property('_hidden')} ++ node = ${Neos.Node.isDisabled(node) || Neos.Node.isDisabled(documentNode) || Neos.Node.isDisabled(site)} ++ otherVariable = ${Neos.Node.isDisabled(someOtherVariable)} + flowQuery = ${q(someOtherVariable).first().property('_hidden')} +- inAfx = afx`` ++ inAfx = afx`` + } +``` + +
+ ## FusionNodeIdentifierRector -Fusion: Rewrite node.identifier to node.nodeAggregateId.value +Fusion: Rewrite "node.identifier" and "q(node).property('_identifier')" to `"q(node).id()"` - class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeIdentifierRector`](../src/ContentRepository90/Rules/FusionNodeIdentifierRector.php) ```diff -+// TODO 9.0 migration: Line 13: You may need to rewrite "VARIABLE.identifier" to VARIABLE.nodeAggregateId.value. 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 { @@ -412,15 +795,16 @@ Fusion: Rewrite node.identifier to node.nodeAggregateId.value # # pass down props # -- attributes = ${node.identifier || documentNode.identifier} -+ attributes = ${node.nodeAggregateId.value || documentNode.nodeAggregateId.value} +- attributes = ${q(node).property("_identifier") || q(documentNode).property("_identifier")} ++ attributes = ${q(node).id() || q(documentNode).id()} renderer = afx` ` } @@ -429,14 +813,56 @@ Fusion: Rewrite node.identifier to node.nodeAggregateId.value
+## FusionNodeLabelRector + +Fusion: Rewrite "node.label" and "q(node).property('_label')" to `"q(node).label()"` + +- class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeLabelRector`](../src/ContentRepository90/Rules/FusionNodeLabelRector.php) + +```diff + prototype(Neos.Rector:Test) < prototype(Neos.Fusion:Value) { +- node = ${q(node).property('_label') || q(documentNode).property("_label") || q(site).property("_label")} +- otherVariable = ${q(someOtherVariable).property('_label')} +- inAfx = afx`` ++ node = ${q(node).label() || q(documentNode).label() || q(site).label()} ++ otherVariable = ${q(someOtherVariable).label()} ++ inAfx = afx`` + } +``` + +
+ +## FusionNodeNodeTypeRector + +Fusion: Rewrite "node.nodeType" and "q(node).property('_nodeType')" to "Neos.Node.getNodeType(node)" + +- class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeNodeTypeRector`](../src/ContentRepository90/Rules/FusionNodeNodeTypeRector.php) + +```diff + prototype(Neos.Rector:Test) < prototype(Neos.Fusion:Value) { +- node = ${q(node).property('_nodeType') || q(documentNode).property("_nodeType") || q(site).property("_nodeType")} +- otherVariable = ${q(someOtherVariable).property('_nodeType')} +- nested = ${q(someOtherVariable).property('_nodeType.properties')} +- deepNested = ${q(someOtherVariable).property('_nodeType.options.myOption')} +- inAfx = afx`` ++ node = ${Neos.Node.getNodeType(node) || Neos.Node.getNodeType(documentNode) || Neos.Node.getNodeType(site)} ++ otherVariable = ${Neos.Node.getNodeType(someOtherVariable)} ++ nested = ${Neos.Node.getNodeType(someOtherVariable).properties} ++ deepNested = ${Neos.Node.getNodeType(someOtherVariable).options.myOption} ++ inAfx = afx`` + } +``` + +
+ ## FusionNodeParentRector -Fusion: Rewrite node.parent to Neos.NodeAccess.findParent(node) +Fusion: Rewrite node.parent to `q(node).parent().get(0)` - class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeParentRector`](../src/ContentRepository90/Rules/FusionNodeParentRector.php) ```diff -+// TODO 9.0 migration: Line 26: You may need to rewrite "VARIABLE.parent" to Neos.NodeAccess.findParent(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node. ++// TODO 9.0 migration: Line 15: You may need to rewrite "VARIABLE.parent" to "q(VARIABLE).parent().get(0)". 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 { @@ -445,28 +871,18 @@ Fusion: Rewrite node.parent to Neos.NodeAccess.findParent(node) # pass down props # - attributes = ${node.parent || documentNode.parent} -+ attributes = ${Neos.NodeAccess.findParent(node) || Neos.NodeAccess.findParent(documentNode)} - - # - # the `checked` state is calculated outside the renderer to allow` overriding via `attributes` - # - checked = false - checked.@process.checkMultiValue = ${Array.indexOf(field.getCurrentMultivalueStringified(), field.getTargetValueStringified()) > -1} - checked.@process.checkMultiValue.@if.hasValue = ${field.hasCurrentValue()} - checked.@process.checkMultiValue.@if.isMultiple = ${field.isMultiple()} - checked.@process.checkSingleValue = ${field.getCurrentValueStringified() == field.getTargetValueStringified()} - checked.@process.checkSingleValue.@if.hasValue = ${field.hasCurrentValue()} - checked.@process.checkSingleValue.@if.isSingle = ${!field.isMultiple()} ++ attributes = ${q(node).parent().get(0) || q(documentNode).parent().get(0)} renderer = afx` ` } @@ -477,12 +893,13 @@ Fusion: Rewrite node.parent to Neos.NodeAccess.findParent(node) ## FusionNodePathRector -Fusion: Rewrite node.path to Neos.Node.path(node) +Fusion: Rewrite node.path and q(node).property("_path") to Neos.Node.path(node) - class: [`Neos\Rector\ContentRepository90\Rules\FusionNodePathRector`](../src/ContentRepository90/Rules/FusionNodePathRector.php) ```diff -+// TODO 9.0 migration: Line 26: You may need to rewrite "VARIABLE.path" to Neos.Node.path(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node. ++// TODO 9.0 migration: Line 29: You may need to rewrite "VARIABLE.path" to Neos.Node.path(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node. ++// TODO 9.0 migration: Line 30: You may need to rewrite "VARIABLE.path" to Neos.Node.path(VARIABLE). 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 { @@ -490,8 +907,11 @@ Fusion: Rewrite node.path to Neos.Node.path(node) # # pass down props # -- attributes = ${node.path || documentNode.path} -+ attributes = ${Neos.Node.path(node) || Neos.Node.path(documentNode)} +- attributes = ${node.path || documentNode.path || q(node).property('_path') || q(documentNode).property("_path")} +- foo = ${q(bar).property('_path') || q(bar).property("_path")} ++ attributes = ${Neos.Node.path(node) || Neos.Node.path(documentNode) || Neos.Node.path(node) || Neos.Node.path(documentNode)} ++ foo = ${Neos.Node.path(bar) || Neos.Node.path(bar)} + boo = ${q(nodes).first().property('_path') || q(nodes).first().property("_path")} # # the `checked` state is calculated outside the renderer to allow` overriding via `attributes` @@ -509,7 +929,8 @@ Fusion: Rewrite node.path to Neos.Node.path(node) type="checkbox" - name={node.path} + name={Neos.Node.path(node)} - value={someOtherVariable.path} + value={someOtherVariable.path || something} + path={someOtherVariable.path} checked={props.checked} - {...node.path} + {...Neos.Node.path(node)} @@ -539,11 +960,16 @@ use Neos\Rector\Generic\ValueObject\FusionNodePropertyPathToWarningComment; use Rector\Config\RectorConfig; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->ruleWithConfiguration(FusionNodePropertyPathToWarningCommentRector::class, [ - new FusionNodePropertyPathToWarningComment('removed', 'Line %LINE: !! node.removed - the new CR *never* returns removed nodes; so you can simplify your code and just assume removed == FALSE in all scenarios.'), - new FusionNodePropertyPathToWarningComment('hiddenBeforeDateTime', 'Line %LINE: !! node.hiddenBeforeDateTime is not supported by the new CR. Timed publishing will be implemented not on the read model, but by dispatching commands at a given time.'), - new FusionNodePropertyPathToWarningComment('hiddenAfterDateTime', 'Line %LINE: !! node.hiddenAfterDateTime is not supported by the new CR. Timed publishing will be implemented not on the read model, but by dispatching commands at a given time.'), - new FusionNodePropertyPathToWarningComment('foo.bar', 'Line %LINE: !! node.foo.bar is not supported anymore.'), + $containerConfigurator->extension('rectorConfig', [ + [ + 'class' => FusionNodePropertyPathToWarningCommentRector::class, + 'configuration' => [ + new FusionNodePropertyPathToWarningComment('removed', 'Line %LINE: !! node.removed - the new CR *never* returns removed nodes; so you can simplify your code and just assume removed == FALSE in all scenarios.'), + new FusionNodePropertyPathToWarningComment('hiddenBeforeDateTime', 'Line %LINE: !! node.hiddenBeforeDateTime is not supported by the new CR. Timed publishing will be implemented not on the read model, but by dispatching commands at a given time.'), + new FusionNodePropertyPathToWarningComment('hiddenAfterDateTime', 'Line %LINE: !! node.hiddenAfterDateTime is not supported by the new CR. Timed publishing will be implemented not on the read model, but by dispatching commands at a given time.'), + new FusionNodePropertyPathToWarningComment('foo.bar', 'Line %LINE: !! node.foo.bar is not supported anymore.'), + ], + ], ]); }; ``` @@ -613,24 +1039,181 @@ return static function (RectorConfig $rectorConfig): void {
-## InjectContentRepositoryRegistryIfNeededRector +## FusionNodeTypeNameRector + +Fusion: Rewrite node.nodeType.name to node.nodeTypeName.value + +- class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeTypeNameRector`](../src/ContentRepository90/Rules/FusionNodeTypeNameRector.php) + +```diff ++// 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. + prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) { + + renderer = Neos.Fusion:Component { + + # + # pass down props + # +-attributes = ${node.nodeType.name || documentNode.nodeType.name} ++attributes = ${node.nodeTypeName.value || documentNode.nodeTypeName.value} + renderer = afx` + + ` + } + } +``` + +
+ +## FusionPrototypeNameAddCommentRector + +Fusion: Add comment to file if prototype name matches at least once. + +:wrench: **configure it!** + +- class: [`Neos\Rector\Generic\Rules\FusionPrototypeNameAddCommentRector`](../src/Generic/Rules/FusionPrototypeNameAddCommentRector.php) + +```php +extension('rectorConfig', [ + [ + 'class' => FusionPrototypeNameAddCommentRector::class, + 'configuration' => [ + 'Neos.Neos:Raw', + 'Neos.Neos:Raw: Add this comment to top of file.', + ], + ], + ]); +}; +``` + +↓ + +```diff ++// TODO 9.0 migration: You need to refactor "Neos.Neos:PrimaryContent" to use "Neos.Neos:ContentCollection" instead. + prototype(My.Fancy:Component) < prototype(Neos.Fusion:Join) { + main = Neos.Neos:PrimaryContent { + nodePath = 'main' + } + + content = Neos.Neos:PrimaryContent + content.nodePath = 'content' + } + + prototype(My.Evil:Component) < prototype(Neos.Neos:PrimaryContent) { + + } +``` + +
+ +## FusionReplacePrototypeNameRector + +Fusion: Rewrite prototype names form e.g Foo.Bar:Boo to Boo.Bar:Foo + +:wrench: **configure it!** + +- class: [`Neos\Rector\Generic\Rules\FusionReplacePrototypeNameRector`](../src/Generic/Rules/FusionReplacePrototypeNameRector.php) + +```php +extension('rectorConfig', [ + [ + 'class' => FusionReplacePrototypeNameRector::class, + 'configuration' => [ + 'Neos.Neos:Raw', + 'Neos.Neos:NewRaw', + 'Neos.Neos:Raw: This comment should be added on top of the file.', + ], + ], + ]); +}; +``` + +↓ + +```diff ++// TODO 9.0 migration: Neos.Neos:FooReplaced: This comment should be added on top of the file. ++// TODO 9.0 migration: Neos.Neos:BarReplaced: This comment should be added on top of the file. + prototype(Neos.Neos:Foo) < prototype(Neos.Neos:Bar) { + +- raw = Neos.Neos:Foo ++ raw = Neos.Neos:FooReplaced + renderer = afx` +- ++ + ` + } +``` + +
+ +## InjectServiceIfNeededRector add injection for `$contentRepositoryRegistry` if in use. -- class: [`Neos\Rector\ContentRepository90\Rules\InjectContentRepositoryRegistryIfNeededRector`](../src/ContentRepository90/Rules/InjectContentRepositoryRegistryIfNeededRector.php) +:wrench: **configure it!** + +- class: [`Neos\Rector\Generic\Rules\InjectServiceIfNeededRector`](../src/Generic/Rules/InjectServiceIfNeededRector.php) + +```php +extension('rectorConfig', [ + [ + 'class' => InjectServiceIfNeededRector::class, + 'configuration' => [ + new AddInjection('contentRepositoryRegistry', 'Neos\ContentRepositoryRegistry\ContentRepositoryRegistry'), + ], + ], + ]); +}; +``` + +↓ ```diff contentRepositoryRegistry->subgraphForNode($node); + $currentRenderingMode = $this->renderingModeService->findByCurrentUser(); } } @@ -657,8 +1240,13 @@ use Neos\Rector\Generic\ValueObject\MethodCallToWarningComment; use Rector\Config\RectorConfig; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->ruleWithConfiguration(MethodCallToWarningCommentRector::class, [ - new MethodCallToWarningComment('PhpParser\Node', 'getWorkspace', '!! Node::getWorkspace() does not make sense anymore concept-wise. In Neos < 9, it pointed to the workspace where the node was *at home at*. Now, the closest we have here is the node identity.'), + $containerConfigurator->extension('rectorConfig', [ + [ + 'class' => MethodCallToWarningCommentRector::class, + 'configuration' => [ + new MethodCallToWarningComment('Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub', 'getWorkspace', '!! Node::getWorkspace() does not make sense anymore concept-wise. In Neos < 9, it pointed to the workspace where the node was *at home at*. Now, the closest we have here is the node identity.'), + ], + ], ]); }; ``` @@ -668,11 +1256,11 @@ return static function (RectorConfig $rectorConfig): void { ```diff findParentNode(); + $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); @@ -749,17 +1337,17 @@ return static function (RectorConfig $rectorConfig): void { ```diff getChildNodes() as $node) { +- foreach ($node->getChildNodes(offset: 100, limit: 10) as $node) { + $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); + // TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call. + -+ foreach (iterator_to_array($subgraph->findChildNodes($node->nodeAggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter::all())) as $node) { ++ foreach (iterator_to_array($subgraph->findChildNodes($node->nodeAggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter::create(pagination: ['limit' => 10, 'offset' => 100]))) as $node) { } } } @@ -778,11 +1366,11 @@ return static function (RectorConfig $rectorConfig): void { ```diff getContext()->getWorkspaceName(); + $contentRepository = $this->contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryId); @@ -804,11 +1392,11 @@ return static function (RectorConfig $rectorConfig): void { ```diff getContext()->getWorkspace(); + $contentRepository = $this->contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryId); @@ -830,11 +1418,11 @@ return static function (RectorConfig $rectorConfig): void { ```diff getDepth(); + $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); @@ -856,11 +1444,11 @@ return static function (RectorConfig $rectorConfig): void { ```diff getDimensions(); + // TODO 9.0 migration: Try to remove the toLegacyDimensionArray() call and make your codebase more typesafe. @@ -874,6 +1462,33 @@ return static function (RectorConfig $rectorConfig): void {
+## NodeGetIdentifierRector + +`"NodeInterface::getIdentifier()"` will be rewritten + +- class: [`Neos\Rector\ContentRepository90\Rules\NodeGetIdentifierRector`](../src/ContentRepository90/Rules/NodeGetIdentifierRector.php) + +```diff + getIdentifier(); ++ // TODO 9.0 migration: Check if you could change your code to work with the NodeAggregateId value object instead. ++ ++ $nodeIdentifier = $node->nodeAggregateId->value; + } + } + + ?> +``` + +
+ ## NodeGetParentRector `"NodeInterface::getParent()"` will be rewritten @@ -883,11 +1498,11 @@ return static function (RectorConfig $rectorConfig): void { ```diff getParent(); + $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); @@ -909,11 +1524,11 @@ return static function (RectorConfig $rectorConfig): void { ```diff getPath(); + $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node); @@ -937,14 +1552,14 @@ return static function (RectorConfig $rectorConfig): void { ```diff isHiddenInIndex(); -+ return $node->getProperty('_hiddenInIndex'); ++ return $node->getProperty('hiddenInMenu'); } } @@ -962,17 +1577,135 @@ return static function (RectorConfig $rectorConfig): void { ```diff isHidden(); -+ $contentRepository = $this->contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryId); -+ $nodeHiddenStateFinder = $contentRepository->projectionState(\Neos\ContentRepository\Core\Projection\NodeHiddenState\NodeHiddenStateFinder::class); -+ $hiddenState = $nodeHiddenStateFinder->findHiddenState($node->subgraphIdentity->contentStreamId, $node->subgraphIdentity->dimensionSpacePoint, $node->nodeAggregateId); -+ return $hiddenState->isHidden(); ++ return $node->tags->contain(\Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag::disabled()); + } + } + + ?> +``` + +
+ +## NodeTypeAllowsGrandchildNodeTypeRector + +"$nodeType->allowsGrandchildNodeType($parentNodeName, `$nodeType)"` will be rewritten. + +- class: [`Neos\Rector\ContentRepository90\Rules\NodeTypeAllowsGrandchildNodeTypeRector`](../src/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector.php) + +```diff + getNodeType(); + $grandParentsNodeType = $node->getParent()->getParent()->getNodeType(); ++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories. ++ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default')); + +- $grandParentsNodeType->allowsGrandchildNodeType($parentNodeName, $nodeType); ++ $contentRepository->getNodeTypeManager()->isNodeTypeAllowedAsChildToTetheredNode($grandParentsNodeType, \Neos\ContentRepository\Core\SharedModel\Node\NodeName::fromString($parentNodeName), $nodeType); + } + } + + ?> +``` + +
+ +## NodeTypeGetAutoCreatedChildNodesRector + +`"$nodeType->getAutoCreatedChildNodes()"` will be rewritten. + +- class: [`Neos\Rector\ContentRepository90\Rules\NodeTypeGetAutoCreatedChildNodesRector`](../src/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector.php) + +```diff + getNodeType(); +- $childNodes = $nodeType->getAutoCreatedChildNodes(); ++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories. ++ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default')); ++ $childNodes = $contentRepository->getNodeTypeManager()->getTetheredNodesConfigurationForNodeType($nodeType); + } + } + + ?> +``` + +
+ +## NodeTypeGetNameRector + +`"NodeType::getName()"` will be rewritten + +- class: [`Neos\Rector\ContentRepository90\Rules\NodeTypeGetNameRector`](../src/ContentRepository90/Rules/NodeTypeGetNameRector.php) + +```diff + getName(); ++ $nodetype = $nodetype->name->value; + } + } + + ?> +``` + +
+ +## NodeTypeGetTypeOfAutoCreatedChildNodeRector + +"$nodeType->getTypeOfAutoCreatedChildNode($nodeName)" will be rewritten. + +- class: [`Neos\Rector\ContentRepository90\Rules\NodeTypeGetTypeOfAutoCreatedChildNodeRector`](../src/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector.php) + +```diff + getNodeType(); +- $type = $nodeType->getTypeOfAutoCreatedChildNode($nodeName); ++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories. ++ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default')); ++ $type = $contentRepository->getNodeTypeManager()->getTypeOfTetheredNode($nodeType, $nodeName); } } @@ -1049,8 +1782,13 @@ use Neos\Rector\Generic\ValueObject\RemoveInjection; use Rector\Config\RectorConfig; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->ruleWithConfiguration(RemoveInjectionsRector::class, [ - new RemoveInjection('Foo\Bar\Baz'), + $containerConfigurator->extension('rectorConfig', [ + [ + 'class' => RemoveInjectionsRector::class, + 'configuration' => [ + new RemoveInjection('Foo\Bar\Baz'), + ], + ], ]); }; ``` @@ -1114,8 +1852,13 @@ use Neos\Rector\Generic\ValueObject\RemoveParentClass; use Rector\Config\RectorConfig; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->ruleWithConfiguration(RemoveParentClassRector::class, [ - new RemoveParentClass('Foo\Bar\Baz', '// TODO: Neos 9.0 Migration: Stuff'), + $containerConfigurator->extension('rectorConfig', [ + [ + 'class' => RemoveParentClassRector::class, + 'configuration' => [ + new RemoveParentClass('Foo\Bar\Baz', '// TODO: Neos 9.0 Migration: Stuff'), + ], + ], ]); }; ``` @@ -1136,6 +1879,73 @@ return static function (RectorConfig $rectorConfig): void {
+## ToStringToMethodCallOrPropertyFetchRector + +Turns defined code uses of `"__toString()"` method to specific method calls or property fetches. + +:wrench: **configure it!** + +- class: [`Neos\Rector\Generic\Rules\ToStringToMethodCallOrPropertyFetchRector`](../src/Generic/Rules/ToStringToMethodCallOrPropertyFetchRector.php) + +```php +extension('rectorConfig', [ + [ + 'class' => ToStringToMethodCallOrPropertyFetchRector::class, + 'configuration' => [ + 'SomeObject' => 'getPath()', + ], + ], + ]); +}; +``` + +↓ + +```diff + $someValue = new SomeObject; +-$result = (string) $someValue; +-$result = $someValue->__toString(); ++$result = $someValue->getPath(); ++$result = $someValue->getPath(); +``` + +
+ +## WorkspaceGetNameRector + +`"Workspace::getName()"` will be rewritten + +- class: [`Neos\Rector\ContentRepository90\Rules\WorkspaceGetNameRector`](../src/ContentRepository90/Rules/WorkspaceGetNameRector.php) + +```diff + getName(); ++ // TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead. ++ ++ $workspaceName = $workspace->workspaceName->value; + } + } + + ?> +``` + +
+ ## WorkspaceRepositoryCountByNameRector `"WorkspaceRepository::countByName()"` will be rewritten. diff --git a/src/Generic/Rules/FusionPrototypeNameAddCommentRector.php b/src/Generic/Rules/FusionPrototypeNameAddCommentRector.php index 537c9e3..70dff89 100644 --- a/src/Generic/Rules/FusionPrototypeNameAddCommentRector.php +++ b/src/Generic/Rules/FusionPrototypeNameAddCommentRector.php @@ -20,7 +20,7 @@ class FusionPrototypeNameAddCommentRector implements FusionRectorInterface, Conf public function getRuleDefinition(): RuleDefinition { - return CodeSampleLoader::fromFile('Fusion: Add comment to file if prototype name matches at least once.', __CLASS__); + return CodeSampleLoader::fromFile('Fusion: Add comment to file if prototype name matches at least once.', __CLASS__, ['Neos.Neos:Raw', 'Neos.Neos:Raw: Add this comment to top of file.']); } public function refactorFileContent(string $fileContent): string @@ -28,7 +28,7 @@ public function refactorFileContent(string $fileContent): string $comments = []; foreach ($this->fusionPrototypeNameAddComments as $fusionPrototypeNameAddComment) { $matches = []; - $pattern = '/(^|[=\s\(<\/])(' .$fusionPrototypeNameAddComment->name. ')([\s\{\)\/>]|$)/'; + $pattern = '/(^|[=\s\(<\/])(' . $fusionPrototypeNameAddComment->name . ')([\s\{\)\/>]|$)/'; preg_match($pattern, $fileContent, $matches); if (count($matches) > 0) { @@ -36,7 +36,7 @@ public function refactorFileContent(string $fileContent): string } } - if (count($comments) > 0){ + if (count($comments) > 0) { $fileContent = implode("\n", $comments) . "\n" . $fileContent; } diff --git a/src/Generic/Rules/FusionReplacePrototypeNameRector.php b/src/Generic/Rules/FusionReplacePrototypeNameRector.php index 4cec8ff..d18cb79 100644 --- a/src/Generic/Rules/FusionReplacePrototypeNameRector.php +++ b/src/Generic/Rules/FusionReplacePrototypeNameRector.php @@ -20,7 +20,7 @@ class FusionReplacePrototypeNameRector implements FusionRectorInterface, Configu public function getRuleDefinition(): RuleDefinition { - return CodeSampleLoader::fromFile('Fusion: Rewrite prototype names form e.g Foo.Bar:Boo to Boo.Bar:Foo', __CLASS__); + return CodeSampleLoader::fromFile('Fusion: Rewrite prototype names form e.g Foo.Bar:Boo to Boo.Bar:Foo', __CLASS__, ['Neos.Neos:Raw', 'Neos.Neos:NewRaw', 'Neos.Neos:Raw: This comment should be added on top of the file.']); } public function refactorFileContent(string $fileContent): string @@ -29,19 +29,19 @@ public function refactorFileContent(string $fileContent): string foreach ($this->fusionPrototypeNameReplacements as $fusionPrototypeNameReplacement) { $replacementCount = 0; if ($fusionPrototypeNameReplacement->skipPrototypeDefinitions) { - $pattern = '/(^|[=\s<\/])(' .$fusionPrototypeNameReplacement->oldName. ')([\s{\/>]|$)/'; + $pattern = '/(^|[=\s<\/])(' . $fusionPrototypeNameReplacement->oldName . ')([\s{\/>]|$)/'; } else { - $pattern = '/(^|[=\s(<\/])(' .$fusionPrototypeNameReplacement->oldName. ')([\s{)\/>]|$)/'; + $pattern = '/(^|[=\s(<\/])(' . $fusionPrototypeNameReplacement->oldName . ')([\s{)\/>]|$)/'; } - $replacement = '$1'.$fusionPrototypeNameReplacement->newName.'$3'; + $replacement = '$1' . $fusionPrototypeNameReplacement->newName . '$3'; $fileContent = preg_replace($pattern, $replacement, $fileContent, count: $replacementCount); - if($replacementCount > 0 && $fusionPrototypeNameReplacement->comment !== null) { + if ($replacementCount > 0 && $fusionPrototypeNameReplacement->comment !== null) { $comments[] = '// TODO 9.0 migration: ' . $fusionPrototypeNameReplacement->comment; } } - if (count($comments) > 0){ + if (count($comments) > 0) { $fileContent = implode("\n", $comments) . "\n" . $fileContent; } diff --git a/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeType/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/Fixture/some_class.php.inc similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeType/Fixture/some_class.php.inc rename to tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/Fixture/some_class.php.inc diff --git a/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeType/NodeTypeAllowsGrandchildNodeTypeTest.php b/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/NodeTypeAllowsGrandchildNodeTypeTest.php similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeType/NodeTypeAllowsGrandchildNodeTypeTest.php rename to tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/NodeTypeAllowsGrandchildNodeTypeTest.php diff --git a/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeType/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/config/configured_rule.php similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeType/config/configured_rule.php rename to tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/config/configured_rule.php diff --git a/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodes/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/Fixture/some_class.php.inc similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodes/Fixture/some_class.php.inc rename to tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/Fixture/some_class.php.inc diff --git a/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodes/Fixture/some_class2.php.inc b/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/Fixture/some_class2.php.inc similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodes/Fixture/some_class2.php.inc rename to tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/Fixture/some_class2.php.inc diff --git a/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodes/Fixture/some_class3.php.inc b/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/Fixture/some_class3.php.inc similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodes/Fixture/some_class3.php.inc rename to tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/Fixture/some_class3.php.inc diff --git a/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodes/Fixture/some_class4.php.inc b/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/Fixture/some_class4.php.inc similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodes/Fixture/some_class4.php.inc rename to tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/Fixture/some_class4.php.inc diff --git a/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodes/Fixture/some_class5.php.inc b/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/Fixture/some_class5.php.inc similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodes/Fixture/some_class5.php.inc rename to tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/Fixture/some_class5.php.inc diff --git a/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodes/NodeTypeGetAutoCreatedChildNodesTest.php b/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/NodeTypeGetAutoCreatedChildNodesTest.php similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodes/NodeTypeGetAutoCreatedChildNodesTest.php rename to tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/NodeTypeGetAutoCreatedChildNodesTest.php diff --git a/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodes/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/config/configured_rule.php similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodes/config/configured_rule.php rename to tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/config/configured_rule.php diff --git a/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNode/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/Fixture/some_class.php.inc similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNode/Fixture/some_class.php.inc rename to tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/Fixture/some_class.php.inc diff --git a/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNode/Fixture/some_class2.php.inc b/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/Fixture/some_class2.php.inc similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNode/Fixture/some_class2.php.inc rename to tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/Fixture/some_class2.php.inc diff --git a/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNode/Fixture/some_class3.php.inc b/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/Fixture/some_class3.php.inc similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNode/Fixture/some_class3.php.inc rename to tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/Fixture/some_class3.php.inc diff --git a/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNode/NodeTypeGetTypeOfAutoCreatedChildNodeTest.php b/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/NodeTypeGetTypeOfAutoCreatedChildNodeTest.php similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNode/NodeTypeGetTypeOfAutoCreatedChildNodeTest.php rename to tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/NodeTypeGetTypeOfAutoCreatedChildNodeTest.php diff --git a/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNode/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/config/configured_rule.php similarity index 100% rename from tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNode/config/configured_rule.php rename to tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/config/configured_rule.php diff --git a/tests/Generic/Rules/FusionPrototypeNameAddComment/Fixture/primary1.fusion.inc b/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/primary1.fusion.inc similarity index 100% rename from tests/Generic/Rules/FusionPrototypeNameAddComment/Fixture/primary1.fusion.inc rename to tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/primary1.fusion.inc diff --git a/tests/Generic/Rules/FusionPrototypeNameAddComment/Fixture/primary2.fusion.inc b/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/primary2.fusion.inc similarity index 100% rename from tests/Generic/Rules/FusionPrototypeNameAddComment/Fixture/primary2.fusion.inc rename to tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/primary2.fusion.inc diff --git a/tests/Generic/Rules/FusionPrototypeNameAddComment/Fixture/some_file.fusion.inc b/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/some_file.fusion.inc similarity index 100% rename from tests/Generic/Rules/FusionPrototypeNameAddComment/Fixture/some_file.fusion.inc rename to tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/some_file.fusion.inc diff --git a/tests/Generic/Rules/FusionPrototypeNameAddComment/FusionPrototypeNameCommentTest.php b/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/FusionPrototypeNameCommentTest.php similarity index 89% rename from tests/Generic/Rules/FusionPrototypeNameAddComment/FusionPrototypeNameCommentTest.php rename to tests/Generic/Rules/FusionPrototypeNameAddCommentRector/FusionPrototypeNameCommentTest.php index 0431bec..06aad40 100644 --- a/tests/Generic/Rules/FusionPrototypeNameAddComment/FusionPrototypeNameCommentTest.php +++ b/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/FusionPrototypeNameCommentTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Neos\Rector\Tests\Generic\Rules\FusionPrototypeNameReplacement; +namespace Neos\Rector\Tests\Generic\Rules\FusionReplacePrototypeNameRector; use Rector\Testing\PHPUnit\AbstractRectorTestCase; diff --git a/tests/Generic/Rules/FusionPrototypeNameAddComment/config/configured_rule.php b/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/config/configured_rule.php similarity index 100% rename from tests/Generic/Rules/FusionPrototypeNameAddComment/config/configured_rule.php rename to tests/Generic/Rules/FusionPrototypeNameAddCommentRector/config/configured_rule.php diff --git a/tests/Generic/Rules/FusionPrototypeNameReplacement/Fixture/skip_prototype_definition.fusion.inc b/tests/Generic/Rules/FusionReplacePrototypeNameRector/Fixture/skip_prototype_definition.fusion.inc similarity index 100% rename from tests/Generic/Rules/FusionPrototypeNameReplacement/Fixture/skip_prototype_definition.fusion.inc rename to tests/Generic/Rules/FusionReplacePrototypeNameRector/Fixture/skip_prototype_definition.fusion.inc diff --git a/tests/Generic/Rules/FusionPrototypeNameReplacement/Fixture/some_file.fusion.inc b/tests/Generic/Rules/FusionReplacePrototypeNameRector/Fixture/some_file.fusion.inc similarity index 100% rename from tests/Generic/Rules/FusionPrototypeNameReplacement/Fixture/some_file.fusion.inc rename to tests/Generic/Rules/FusionReplacePrototypeNameRector/Fixture/some_file.fusion.inc diff --git a/tests/Generic/Rules/FusionPrototypeNameReplacement/FusionPrototypeNameReplacementTest.php b/tests/Generic/Rules/FusionReplacePrototypeNameRector/FusionPrototypeNameReplacementTest.php similarity index 89% rename from tests/Generic/Rules/FusionPrototypeNameReplacement/FusionPrototypeNameReplacementTest.php rename to tests/Generic/Rules/FusionReplacePrototypeNameRector/FusionPrototypeNameReplacementTest.php index 5ed741f..b958371 100644 --- a/tests/Generic/Rules/FusionPrototypeNameReplacement/FusionPrototypeNameReplacementTest.php +++ b/tests/Generic/Rules/FusionReplacePrototypeNameRector/FusionPrototypeNameReplacementTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Neos\Rector\Tests\Generic\Rules\FusionPrototypeNameReplacement; +namespace Neos\Rector\Tests\Generic\Rules\FusionReplacePrototypeNameRector; use Rector\Testing\PHPUnit\AbstractRectorTestCase; diff --git a/tests/Generic/Rules/FusionPrototypeNameReplacement/config/configured_rule.php b/tests/Generic/Rules/FusionReplacePrototypeNameRector/config/configured_rule.php similarity index 100% rename from tests/Generic/Rules/FusionPrototypeNameReplacement/config/configured_rule.php rename to tests/Generic/Rules/FusionReplacePrototypeNameRector/config/configured_rule.php diff --git a/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/has_already_content_repository_registry.php.inc b/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/has_already_content_repository_registry.php.inc deleted file mode 100644 index 815bb24..0000000 --- a/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/has_already_content_repository_registry.php.inc +++ /dev/null @@ -1,33 +0,0 @@ -contentRepositoryRegistry->subgraphForNode($node); - } -} - -?> ------ -contentRepositoryRegistry->subgraphForNode($node); - } -} - -?> diff --git a/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/has_already_rendering_mode_service.php.inc b/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/has_already_rendering_mode_service.php.inc deleted file mode 100644 index 2069b85..0000000 --- a/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/has_already_rendering_mode_service.php.inc +++ /dev/null @@ -1,35 +0,0 @@ -renderingModeService->findByCurrentUser(); - } -} - -?> ------ -renderingModeService->findByCurrentUser(); - } -} - -?> diff --git a/tests/Rules/AnnotationToAttribute/AnnotationToAttributeTest.php b/tests/Rules/AnnotationToAttributeRector/AnnotationToAttributeTest.php similarity index 90% rename from tests/Rules/AnnotationToAttribute/AnnotationToAttributeTest.php rename to tests/Rules/AnnotationToAttributeRector/AnnotationToAttributeTest.php index 4c0cec1..1483174 100644 --- a/tests/Rules/AnnotationToAttribute/AnnotationToAttributeTest.php +++ b/tests/Rules/AnnotationToAttributeRector/AnnotationToAttributeTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Neos\Rector\Tests\Rules\AnnotationToAttribute; +namespace Neos\Rector\Tests\Rules\AnnotationToAttributeRector; use Rector\Testing\PHPUnit\AbstractRectorTestCase; diff --git a/tests/Rules/AnnotationToAttribute/Fixture/aspect.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/aspect.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/aspect.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/aspect.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/autowiring.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/autowiring.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/autowiring.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/autowiring.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/compilestatic.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/compilestatic.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/compilestatic.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/compilestatic.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/entity.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/entity.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/entity.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/entity.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/entitywithrepository.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/entitywithrepository.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/entitywithrepository.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/entitywithrepository.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/flushescaches.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/flushescaches.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/flushescaches.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/flushescaches.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/identity.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/identity.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/identity.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/identity.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/ignorevalidation.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/ignorevalidation.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/ignorevalidation.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/ignorevalidation.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/inject.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/inject.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/inject.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/inject.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/injectconfiguration.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/injectconfiguration.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/injectconfiguration.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/injectconfiguration.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/internal.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/internal.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/internal.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/internal.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/lazy.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/lazy.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/lazy.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/lazy.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/maprequestbody.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/maprequestbody.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/maprequestbody.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/maprequestbody.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/proxy.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/proxy.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/proxy.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/proxy.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/scope.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/scope.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/scope.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/scope.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/session.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/session.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/session.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/session.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/signal.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/signal.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/signal.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/signal.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/skipcsrfprotection.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/skipcsrfprotection.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/skipcsrfprotection.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/skipcsrfprotection.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/transient.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/transient.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/transient.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/transient.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/validate.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/validate.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/validate.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/validate.php.inc diff --git a/tests/Rules/AnnotationToAttribute/Fixture/value_object.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/value_object.php.inc similarity index 100% rename from tests/Rules/AnnotationToAttribute/Fixture/value_object.php.inc rename to tests/Rules/AnnotationToAttributeRector/Fixture/value_object.php.inc diff --git a/tests/Rules/AnnotationToAttribute/config/configured_rule.php b/tests/Rules/AnnotationToAttributeRector/config/configured_rule.php similarity index 100% rename from tests/Rules/AnnotationToAttribute/config/configured_rule.php rename to tests/Rules/AnnotationToAttributeRector/config/configured_rule.php From d7729648d2f6c32b9738ded8c73f03bb5eb68838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anke=20H=C3=A4slich?= Date: Thu, 24 Oct 2024 10:53:54 +0200 Subject: [PATCH 2/2] TASK: Update docs --- docs/rules_overview.md | 79 ++++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 26 deletions(-) diff --git a/docs/rules_overview.md b/docs/rules_overview.md index 565894b..e342d2f 100644 --- a/docs/rules_overview.md +++ b/docs/rules_overview.md @@ -1,4 +1,4 @@ -# 57 Rules Overview +# 58 Rules Overview ## ContentDimensionCombinatorGetAllAllowedCombinationsRector @@ -462,12 +462,12 @@ return static function (RectorConfig $rectorConfig): void { ## FusionNodeAggregateIdentifierRector -Fusion: Rewrite node.nodeAggregateIdentifier to `q(node).id()` +Fusion: Rewrite node.nodeAggregateIdentifier to node.nodeAggregateId - class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeAggregateIdentifierRector`](../src/ContentRepository90/Rules/FusionNodeAggregateIdentifierRector.php) ```diff -+// TODO 9.0 migration: Line 13: You may need to rewrite "VARIABLE.nodeAggregateIdentifier" to VARIABLE.nodeAggregateId.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.nodeAggregateIdentifier" to VARIABLE.nodeAggregateId. 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 { @@ -476,14 +476,14 @@ Fusion: Rewrite node.nodeAggregateIdentifier to `q(node).id()` # pass down props # - attributes = ${node.nodeAggregateIdentifier || documentNode.nodeAggregateIdentifier} -+ attributes = ${q(node).id() || q(documentNode).id()} ++ attributes = ${node.nodeAggregateId || documentNode.nodeAggregateId} renderer = afx` ` } @@ -783,7 +783,7 @@ Fusion: Rewrite node.hidden and q(node).property("_hidden") to Neos.Node.isDisab ## FusionNodeIdentifierRector -Fusion: Rewrite "node.identifier" and "q(node).property('_identifier')" to `"q(node).id()"` +Fusion: Rewrite "node.identifier" and "q(node).property('_identifier')" to "node.nodeAggregateId" - class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeIdentifierRector`](../src/ContentRepository90/Rules/FusionNodeIdentifierRector.php) @@ -796,15 +796,15 @@ Fusion: Rewrite "node.identifier" and "q(node).property('_identifier')" to `"q(n # pass down props # - attributes = ${q(node).property("_identifier") || q(documentNode).property("_identifier")} -+ attributes = ${q(node).id() || q(documentNode).id()} ++ attributes = ${node.nodeAggregateId || documentNode.nodeAggregateId} renderer = afx` ` } @@ -815,7 +815,7 @@ Fusion: Rewrite "node.identifier" and "q(node).property('_identifier')" to `"q(n ## FusionNodeLabelRector -Fusion: Rewrite "node.label" and "q(node).property('_label')" to `"q(node).label()"` +Fusion: Rewrite "node.label" and "q(node).property('_label')" to "Neos.Node.label(node)" - class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeLabelRector`](../src/ContentRepository90/Rules/FusionNodeLabelRector.php) @@ -824,9 +824,9 @@ Fusion: Rewrite "node.label" and "q(node).property('_label')" to `"q(node).label - node = ${q(node).property('_label') || q(documentNode).property("_label") || q(site).property("_label")} - otherVariable = ${q(someOtherVariable).property('_label')} - inAfx = afx`` -+ node = ${q(node).label() || q(documentNode).label() || q(site).label()} -+ otherVariable = ${q(someOtherVariable).label()} -+ inAfx = afx`` ++ node = ${Neos.Node.label(node) || Neos.Node.label(documentNode) || Neos.Node.label(site)} ++ otherVariable = ${Neos.Node.label(someOtherVariable)} ++ inAfx = afx`` } ``` @@ -834,7 +834,7 @@ Fusion: Rewrite "node.label" and "q(node).property('_label')" to `"q(node).label ## FusionNodeNodeTypeRector -Fusion: Rewrite "node.nodeType" and "q(node).property('_nodeType')" to "Neos.Node.getNodeType(node)" +Fusion: Rewrite "node.nodeType" and "q(node).property('_nodeType')" to "Neos.Node.nodeType(node)" - class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeNodeTypeRector`](../src/ContentRepository90/Rules/FusionNodeNodeTypeRector.php) @@ -845,11 +845,11 @@ Fusion: Rewrite "node.nodeType" and "q(node).property('_nodeType')" to "Neos.Nod - nested = ${q(someOtherVariable).property('_nodeType.properties')} - deepNested = ${q(someOtherVariable).property('_nodeType.options.myOption')} - inAfx = afx`` -+ node = ${Neos.Node.getNodeType(node) || Neos.Node.getNodeType(documentNode) || Neos.Node.getNodeType(site)} -+ otherVariable = ${Neos.Node.getNodeType(someOtherVariable)} -+ nested = ${Neos.Node.getNodeType(someOtherVariable).properties} -+ deepNested = ${Neos.Node.getNodeType(someOtherVariable).options.myOption} -+ inAfx = afx`` ++ node = ${Neos.Node.nodeType(node) || Neos.Node.nodeType(documentNode) || Neos.Node.nodeType(site)} ++ otherVariable = ${Neos.Node.nodeType(someOtherVariable)} ++ nested = ${Neos.Node.nodeType(someOtherVariable).properties} ++ deepNested = ${Neos.Node.nodeType(someOtherVariable).options.myOption} ++ inAfx = afx`` } ``` @@ -1041,12 +1041,12 @@ return static function (RectorConfig $rectorConfig): void { ## FusionNodeTypeNameRector -Fusion: Rewrite node.nodeType.name to node.nodeTypeName.value +Fusion: Rewrite node.nodeType.name to node.nodeTypeName - class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeTypeNameRector`](../src/ContentRepository90/Rules/FusionNodeTypeNameRector.php) ```diff -+// 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 { @@ -1055,14 +1055,14 @@ Fusion: Rewrite node.nodeType.name to node.nodeTypeName.value # pass down props # -attributes = ${node.nodeType.name || documentNode.nodeType.name} -+attributes = ${node.nodeTypeName.value || documentNode.nodeTypeName.value} ++attributes = ${node.nodeTypeName || documentNode.nodeTypeName} renderer = afx` ` } @@ -1593,6 +1593,33 @@ return static function (RectorConfig $rectorConfig): void {
+## NodeLabelGeneratorRector + +`"$node->getLabel()"` will be rewritten. + +- class: [`Neos\Rector\ContentRepository90\Rules\NodeLabelGeneratorRector`](../src/ContentRepository90/Rules/NodeLabelGeneratorRector.php) + +```diff + getLabel(); ++ $label = $this->nodeLabelGenerator->getLabel($node); + } + } + + ?> +``` + +
+ ## NodeTypeAllowsGrandchildNodeTypeRector "$nodeType->allowsGrandchildNodeType($parentNodeName, `$nodeType)"` will be rewritten.