diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 6d200f0..56a4bee 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- php-versions: ['8.2', '8.3']
+ php-versions: ['8.3', '8.4']
runs-on: ubuntu-latest
diff --git a/README.md b/README.md
index 1ebe3bd..be11e57 100644
--- a/README.md
+++ b/README.md
@@ -2,19 +2,26 @@
This package contains a Rector ruleset which is used for migrating from Neos 8.x to 9.0 (and lateron also further up).
-It will eventually replace Core/Code Migrations (./flow flow:core:migrate) (which are not used anymore for migrating to Neos 9 and further).
-
Right now we focus especially on rules to migrate from the old Content Repository API (< Neos 9.0) to the
Event Sourced Content Repository (>= 9.0).
+**PHP-only migrations**
+
+Earlier version of `neos/rector` also did the migration of Yaml and Fusion file. They have been moved into Neos core migrations starting version 9.0.8. Now `neos/rector` only contains PHP migrations.
+
+See for more details: https://github.com/neos/neos-development-collection/issues/5607
+
+
+
## Installation
-As Rector has strict dependency requirements, which might not match your own project, we strongly recommend to install
-neos/rector in a dedicated directory and **not to add it to your project**.
+
+Please install the neos/rector package in your Distribution as a dev dependency with composer.
+
(This has changed to previous versions of this package)
```bash
# inside your Distribution folder
-composer create-project neos/rector:dev-main --stability=dev rector
-cp rector/rector.template.php rector.php
+composer require --dev neos/rector:dev-main
+cp Packages/Libraries/neos/rector/rector.template.php rector.php
```
## Configuration
@@ -24,19 +31,12 @@ migrated). By default, all of `./DistributionPackages` will be migrated.
Right now, we ship the following sets of Rector rules:
-- `\Neos\Rector\NeosRectorSets::CONTENTREPOSITORY_9_0`: all rules needed to migrate to the Event-Sourced Content Repository
-
-Also you need to add the autoload paths, to allow rector to parse your code properly. By default we added `./Packages` and `./DistributionPackages` to the template.
+- `\Neos\Rector\NeosRectorSets::CONTENTREPOSITORY_9_0`: all rules needed to migrate to the Event-Sourced Content
+ Repository
```php
$rectorConfig->sets([
NeosRectorSets::CONTENTREPOSITORY_9_0,
- //NeosRectorSets::NEOS_8_4,
-]);
-
-$rectorConfig->autoloadPaths([
- __DIR__ . '/Packages',
- __DIR__ . '/DistributionPackages',
]);
$rectorConfig->paths([
@@ -52,11 +52,12 @@ Run the following command at the root of your distribution (i.e. where `rector.p
```bash
# for trying out what would be done
-./rector/vendor/bin/rector --dry-run
+./bin/rector --dry-run
# for running the migrations
-./rector/vendor/bin/rector
+./bin/rector
```
+
---
# Developing Rector Rules for Neos
@@ -77,58 +78,13 @@ The test setup runs completely self contained; does not need *any* Distribution
```bash
# if inside a Neos Distribution, change to the Package's folder
-cd rector
+cd Packages/Libraries/neos/rector
# install PHPunit
composer install
# run PHPUnit
-composer test
-```
-
-## Fusion Rector
-
-We extended Rector specifically for migrating Fusion files, by providing a `FusionFileProcessor` and a `FusionRectorInterface`
-which you can implement if you want to build Fusion transformations.
-
-The Fusion Rectors will usually use one of the following tooling classes:
-
-- `EelExpressionTransformer`: for finding all Eel expressions inside Fusion and AFX; and transforming them in some way.
-
-The Fusion and AFX Parsing functionality is based on the official Fusion and AFX parsers. However, the classes are
-vendored/copied into this package by the `./embed-fusion-and-afx-parsers.sh` script, because of the following reasons:
-
-- Rector needs to run even when Flow cannot compile the classes; so we cannot depend on a Flow package.
-- We slightly need to patch the AFX parser, because we need position information for Eel Expressions.
-
-The Fusion parser was subclassed by `Neos\Rector\Core\FusionProcessing\CustomObjectTreeParser` for retaining position
-information of AFX and Eel Expressions.
-
-
-**Updating Fusion and AFX Parser**
-
-To update the vendored Fusion and AFX parsers, run the `./embed-fusion-and-afx-parsers.sh` script.
-
-
-**Updating the AFX Parser Patch**
-
-The AFX parser needs a custom patch (see `./scripts/afx-eel-positions.patch`) to retain positions.
-
-To create/update this patch, do the following:
-
-```bash
-cd Packages/Neos
-
-# apply the current patch
-patch -p1 < ../../rector/scripts/afx-eel-positions.patch
-
-# Now, do your modifications as needed.
-
-# when you are finished, create the new patch
-git diff -- Neos.Fusion.Afx/ > ../../rector/scripts/afx-eel-positions.patch
-
-# ... and reset the code changes inside Neos.Fusion.Afx.
-git restore -- Neos.Fusion.Afx/
+composer tests
```
## Generating docs
diff --git a/composer.json b/composer.json
index e3f4456..c9fc0ab 100644
--- a/composer.json
+++ b/composer.json
@@ -16,15 +16,14 @@
"tests": "phpunit tests"
},
"require": {
- "php": "8.0.* || 8.1.* || 8.2.* || 8.3.*",
- "rector/rector": "0.15.25",
- "phpstan/phpstan": "1.10.14",
+ "php": "^8.3",
+ "rector/rector": "^2.0",
"symfony/yaml": "*",
"neos/utility-arrays": "*",
"webmozart/assert": "^1.11"
},
"require-dev": {
- "phpunit/phpunit": "^9.5",
- "symplify/rule-doc-generator": "^11.1"
+ "phpunit/phpunit": "^12.0",
+ "symplify/rule-doc-generator": "^12.2"
}
}
diff --git a/config/set/contentrepository-90.php b/config/set/contentrepository-90.php
index 3305955..15b909b 100644
--- a/config/set/contentrepository-90.php
+++ b/config/set/contentrepository-90.php
@@ -9,7 +9,7 @@
use Neos\Neos\Domain\Service\WorkspacePublishingService;
use Neos\Neos\Domain\Service\WorkspaceService;
use Neos\Rector\ContentRepository90\Legacy\LegacyContextStub;
-use Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub;
+use Neos\ContentRepository\Domain\Model\Node as NodeLegacyStub;
use Neos\Rector\ContentRepository90\Rules\ContentDimensionCombinatorGetAllAllowedCombinationsRector;
use Neos\Rector\ContentRepository90\Rules\ContentRepositoryUtilityRenderValidNodeNameRector;
use Neos\Rector\ContentRepository90\Rules\ContextFactoryToLegacyContextStubRector;
@@ -18,29 +18,6 @@
use Neos\Rector\ContentRepository90\Rules\ContextGetRootNodeRector;
use Neos\Rector\ContentRepository90\Rules\ContextIsInBackendRector;
use Neos\Rector\ContentRepository90\Rules\ContextIsLiveRector;
-use Neos\Rector\ContentRepository90\Rules\FusionCacheLifetimeRector;
-use Neos\Rector\ContentRepository90\Rules\FusionCachingNodeInEntryIdentifierRector;
-use Neos\Rector\ContentRepository90\Rules\FusionContextCurrentRenderingModeRector;
-use Neos\Rector\ContentRepository90\Rules\FusionContextCurrentSiteRector;
-use Neos\Rector\ContentRepository90\Rules\FusionContextGetWorkspaceNameRector;
-use Neos\Rector\ContentRepository90\Rules\FusionContextGetWorkspaceRector;
-use Neos\Rector\ContentRepository90\Rules\FusionContextInBackendRector;
-use Neos\Rector\ContentRepository90\Rules\FusionContextLiveRector;
-use Neos\Rector\ContentRepository90\Rules\FusionFlowQueryContextRector;
-use Neos\Rector\ContentRepository90\Rules\FusionNodeAggregateIdentifierRector;
-use Neos\Rector\ContentRepository90\Rules\FusionNodeAutoCreatedRector;
-use Neos\Rector\ContentRepository90\Rules\FusionNodeContextPathRector;
-use Neos\Rector\ContentRepository90\Rules\FusionNodeDepthRector;
-use Neos\Rector\ContentRepository90\Rules\FusionNodeHiddenAfterDateTimeRector;
-use Neos\Rector\ContentRepository90\Rules\FusionNodeHiddenBeforeDateTimeRector;
-use Neos\Rector\ContentRepository90\Rules\FusionNodeHiddenInIndexRector;
-use Neos\Rector\ContentRepository90\Rules\FusionNodeHiddenRector;
-use Neos\Rector\ContentRepository90\Rules\FusionNodeIdentifierRector;
-use Neos\Rector\ContentRepository90\Rules\FusionNodeLabelRector;
-use Neos\Rector\ContentRepository90\Rules\FusionNodeNodeTypeRector;
-use Neos\Rector\ContentRepository90\Rules\FusionNodeParentRector;
-use Neos\Rector\ContentRepository90\Rules\FusionNodePathRector;
-use Neos\Rector\ContentRepository90\Rules\FusionNodeTypeNameRector;
use Neos\Rector\ContentRepository90\Rules\NodeFactoryResetRector;
use Neos\Rector\ContentRepository90\Rules\NodeFindParentNodeRector;
use Neos\Rector\ContentRepository90\Rules\NodeGetChildNodesRector;
@@ -78,12 +55,6 @@
use Neos\Rector\ContentRepository90\Rules\WorkspaceRepositoryFindByIdentifierRector;
use Neos\Rector\ContentRepository90\Rules\WorkspaceSetDescriptionRector;
use Neos\Rector\ContentRepository90\Rules\WorkspaceSetTitleRector;
-use Neos\Rector\ContentRepository90\Rules\YamlDimensionConfigRector;
-use Neos\Rector\ContentRepository90\Rules\YamlRoutePartHandlerRector;
-use Neos\Rector\Generic\Rules\FusionFlowQueryNodePropertyToWarningCommentRector;
-use Neos\Rector\Generic\Rules\FusionNodePropertyPathToWarningCommentRector;
-use Neos\Rector\Generic\Rules\FusionPrototypeNameAddCommentRector;
-use Neos\Rector\Generic\Rules\FusionReplacePrototypeNameRector;
use Neos\Rector\Generic\Rules\InjectServiceIfNeededRector;
use Neos\Rector\Generic\Rules\MethodCallToWarningCommentRector;
use Neos\Rector\Generic\Rules\ObjectInstantiationToWarningCommentRector;
@@ -91,10 +62,6 @@
use Neos\Rector\Generic\Rules\SignalSlotToWarningCommentRector;
use Neos\Rector\Generic\Rules\ToStringToMethodCallOrPropertyFetchRector;
use Neos\Rector\Generic\ValueObject\AddInjection;
-use Neos\Rector\Generic\ValueObject\FusionFlowQueryNodePropertyToWarningComment;
-use Neos\Rector\Generic\ValueObject\FusionNodePropertyPathToWarningComment;
-use Neos\Rector\Generic\ValueObject\FusionPrototypeNameAddComment;
-use Neos\Rector\Generic\ValueObject\FusionPrototypeNameReplacement;
use Neos\Rector\Generic\ValueObject\MethodCallToWarningComment;
use Neos\Rector\Generic\ValueObject\ObjectInstantiationToWarningComment;
use Neos\Rector\Generic\ValueObject\RemoveInjection;
@@ -105,744 +72,646 @@
use Rector\Renaming\Rector\MethodCall\RenameMethodRector;
use Rector\Renaming\Rector\Name\RenameClassRector;
use Rector\Renaming\ValueObject\MethodCallRename;
-use Rector\Transform\Rector\MethodCall\MethodCallToPropertyFetchRector;
-use Rector\Transform\ValueObject\MethodCallToPropertyFetch;
-
-return static function (RectorConfig $rectorConfig): void {
- // Register FusionFileProcessor. All Fusion Rectors will be auto-registered at this processor.
- $services = $rectorConfig->services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(\Neos\Rector\Core\FusionProcessing\FusionFileProcessor::class);
- $services->set(\Neos\Rector\Core\YamlProcessing\YamlFileProcessor::class);
- $rectorConfig->disableParallel(); // parallel does not work for non-PHP-Files, so we need to disable it - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->autoloadPaths([__DIR__ . '/../../src/ContentRepository90/Legacy']);
-
- $rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
- \Neos\ContentRepository\Domain\Model\Node::class => NodeLegacyStub::class,
- \Neos\ContentRepository\Domain\Model\NodeInterface::class => NodeLegacyStub::class,
- \Neos\ContentRepository\Domain\Projection\Content\NodeInterface::class => NodeLegacyStub::class,
- \Neos\ContentRepository\Domain\Projection\Content\TraversableNodeInterface::class => NodeLegacyStub::class,
-
- \Neos\ContentRepository\Domain\Projection\Content\TraversableNodes::class => \Neos\ContentRepository\Core\Projection\ContentGraph\Nodes::class,
-
- \Neos\ContentRepository\Domain\Service\Context::class => LegacyContextStub::class,
- \Neos\Neos\Domain\Service\ContentContext::class => LegacyContextStub::class,
-
- \Neos\ContentRepository\Domain\Model\NodeType::class => \Neos\ContentRepository\Core\NodeType\NodeType::class,
- \Neos\ContentRepository\Domain\Service\NodeTypeManager::class => \Neos\ContentRepository\Core\NodeType\NodeTypeManager::class,
-
- \Neos\ContentRepository\Domain\Model\Workspace::class => \Neos\ContentRepository\Core\SharedModel\Workspace\Workspace::class,
- \Neos\ContentRepository\Domain\NodeAggregate\NodeAggregateIdentifier::class => \Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId::class,
- \Neos\ContentRepository\Domain\NodeAggregate\NodeName::class => \Neos\ContentRepository\Core\SharedModel\Node\NodeName::class,
- \Neos\ContentRepository\Domain\NodeType\NodeTypeName::class => \Neos\ContentRepository\Core\NodeType\NodeTypeName::class,
- \Neos\ContentRepository\Domain\Projection\Content\PropertyCollectionInterface::class => \Neos\ContentRepository\Core\Projection\ContentGraph\PropertyCollection::class,
- \Neos\ContentRepository\Domain\Model\ArrayPropertyCollection::class => \Neos\ContentRepository\Core\Projection\ContentGraph\PropertyCollection::class,
- \Neos\Neos\Routing\FrontendNodeRoutePartHandlerInterface::class => \Neos\Neos\FrontendRouting\FrontendNodeRoutePartHandlerInterface::class,
- ]);
-
- $rectorConfig->ruleWithConfiguration(FusionReplacePrototypeNameRector::class, [
- new FusionPrototypeNameReplacement('Neos.Fusion:Array', 'Neos.Fusion:Join'),
- new FusionPrototypeNameReplacement('Neos.Fusion:RawArray', 'Neos.Fusion:DataStructure'),
- new FusionPrototypeNameReplacement('Neos.Fusion:Collection', 'Neos.Fusion:Loop',
- 'Migration of Neos.Fusion:Collection to Neos.Fusion:Loop needs manual action. The key `collection` has to be renamed to `items` which cannot be done automatically'
- ),
- new FusionPrototypeNameReplacement('Neos.Fusion:RawCollection', 'Neos.Fusion:Map',
- 'Migration of Neos.Fusion:RawCollection to Neos.Fusion:Map needs manual action. The key `collection` has to be renamed to `items` which cannot be done automatically'
- ),
- new FusionPrototypeNameReplacement('Neos.Neos:PrimaryContent', 'Neos.Neos:ContentCollection', '"Neos.Neos:PrimaryContent" has been removed without a complete replacement. We replaced all usages with "Neos.Neos:ContentCollection" but not the prototype definition. Please check the replacements and if you have overridden the "Neos.Neos:PrimaryContent" prototype and rewrite it for your needs.', true),
- ]);
-
-
- /** @var MethodCallToPropertyFetch[] $methodCallToPropertyFetches */
- $methodCallToPropertyFetches = [];
-
- /** @var MethodCallToWarningComment[] $methodCallToWarningComments */
- $methodCallToWarningComments = [];
-
-
- $fusionFlowQueryPropertyToComments = [];
- /**
- * Neos\ContentRepository\Domain\Model\NodeInterface
- */
- // setName
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setName', '!! Node::setName() is not supported by the new CR. Use the "ChangeNodeAggregateName" command to change the node name.');
- // 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". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.');
- // getLabel
- $rectorConfig->rule(FusionNodeLabelRector::class);
- $rectorConfig->rule(NodeLabelGeneratorRector::class);
- // setProperty
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setProperty', '!! Node::setProperty() is not supported by the new CR. Use the "SetNodeProperties" command to change property values.');
- // hasProperty -> compatible with ES CR Node (nothing to do)
- // getProperty -> compatible with ES CR Node (nothing to do)
- // removeProperty
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'removeProperty', '!! Node::removeProperty() is not supported by the new CR. Use the "SetNodeProperties" command to remove a property values.');
- // getProperties -> PropertyCollectionInterface
- $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getProperties', 'properties');
- // getPropertyNames
- $rectorConfig->rule(NodeGetPropertyNamesRector::class);
- // setContentObject -> DEPRECATED / NON-FUNCTIONAL
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setContentObject', '!! Node::setContentObject() is not supported by the new CR. Referencing objects can be done by storing them in Node::properties (and the serialization/deserialization is extensible).');
- // getContentObject -> DEPRECATED / NON-FUNCTIONAL
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getContentObject', '!! Node::getContentObject() is not supported by the new CR. Referencing objects can be done by storing them in Node::properties (and the serialization/deserialization is extensible).');
- // unsetContentObject -> DEPRECATED / NON-FUNCTIONAL
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'unsetContentObject', '!! Node::unsetContentObject() is not supported by the new CR. Referencing objects can be done by storing them in Node::properties (and the serialization/deserialization is extensible).');
- // setNodeType
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setNodeType', '!! Node::setNodeType() is not supported by the new CR. Use the "ChangeNodeAggregateType" command to change nodetype.');
- // getNodeType: NodeType
- // PHP: shortcut to Node->nodeTypeName->value
- $rectorConfig->rule(NodeGetNodeTypeGetNameRector::class);
- $rectorConfig->rule(NodeGetNodeTypeRector::class);
- // Fusion: node.nodeType -> Neos.Node.nodeType(node)
- // Fusion: node.nodeType.name -> node.nodeTypeName
- $rectorConfig->rule(FusionNodeNodeTypeRector::class);
- // setHidden
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setHidden', '!! Node::setHidden() is not supported by the new CR. Use the "EnableNodeAggregate" or "DisableNodeAggregate" command to change the visibility of the node.');
- // isHidden
- $rectorConfig->rule(NodeIsHiddenRector::class);
- $rectorConfig->rule(FusionNodeHiddenRector::class);
- // TODO: Fusion NodeAccess
- // setHiddenBeforeDateTime
- $rectorConfig->rule(NodeGetHiddenBeforeAfterDateTimeRector::class);
- // getHiddenBeforeDateTime
- // PHP: Covered by NodeGetHiddenBeforeAfterDateTimeRector
- $rectorConfig->rule(FusionNodeHiddenBeforeDateTimeRector::class);
- // setHiddenAfterDateTime
- // PHP: Covered by NodeGetHiddenBeforeAfterDateTimeRector
- // getHiddenAfterDateTime
- // PHP: Covered by NodeGetHiddenBeforeAfterDateTimeRector
- $rectorConfig->rule(FusionNodeHiddenAfterDateTimeRector::class);
- // setHiddenInIndex
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setHiddenInIndex', '!! Node::setHiddenInIndex() is not supported by the new CR. Use the "SetNodeProperties" command to change the property value for "hiddenInMenu".');
- // isHiddenInIndex
- $rectorConfig->rule(NodeIsHiddenInIndexRector::class);
- // Fusion: .hiddenInIndex -> node.properties._hiddenInIndex
- $rectorConfig->rule(FusionNodeHiddenInIndexRector::class);
- $fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_hiddenInIndex', 'Line %LINE: !! You very likely need to rewrite "q(VARIABLE).property("_hiddenInIndex")" to "VARIABLE.property(\'hiddenInMenu\')". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.');
- // setAccessRoles
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setAccessRoles', '!! Node::setAccessRoles() is not supported by the new CR.');
- // getAccessRoles
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getAccessRoles', '!! Node::getAccessRoles() is not supported by the new CR.');
- // getPath
- $rectorConfig->rule(NodeGetPathRector::class);
- $rectorConfig->rule(FusionNodePathRector::class);
- $fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_path', 'Line %LINE: !! You very likely need to rewrite "q(VARIABLE).property("_path")" to "Neos.Node.path(VARIABLE)". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.');
- // getContextPath
- $rectorConfig->rule(NodeGetContextPathRector::class);
- $rectorConfig->rule(FusionNodeContextPathRector::class);
- $fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_contextPath', 'Line %LINE: !! 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.');
- // getDepth
- $rectorConfig->rule(NodeGetDepthRector::class);
- $rectorConfig->rule(FusionNodeDepthRector::class);
- $fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_depth', 'Line %LINE: !! You very likely 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.');
- // setWorkspace -> internal
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setWorkspace', '!! Node::setWorkspace() was always internal, and the workspace system has been fundamentally changed with the new CR. Try to rewrite your code around Content Streams.');
- // getWorkspace
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, '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.');
- $fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_workspace', 'Line %LINE: !! You very likely need to rewrite "q(VARIABLE).property("_workspace")". It 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.');
- // getIdentifier
- $rectorConfig->rule(NodeGetIdentifierRector::class);
- $rectorConfig->rule(FusionNodeIdentifierRector::class);
- $fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_identifier', 'Line %LINE: !! You very likely need to rewrite "q(VARIABLE).property("_identifier")" to "VARIABLE.aggregateId". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.');
- // setIndex -> internal
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setIndex', '!! Node::setIndex() was always internal. To reorder nodes, use the "MoveNodeAggregate" command');
- // getIndex
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getIndex', '!! Node::getIndex() is not supported. You can fetch all siblings and inspect the ordering');
- $fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_index', 'Line %LINE: !! You very likely need to rewrite "q(VARIABLE).property("_index")". You can fetch all siblings and inspect the ordering.');
- // getParent -> Node
- $rectorConfig->rule(NodeGetParentRector::class);
- $rectorConfig->rule(FusionNodeParentRector::class);
- $fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_parent', 'Line %LINE: !! You very likely need to rewrite "q(VARIABLE).property("_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.');
- // getParentPath - deprecated
- // createNode
- // createSingleNode -> internal
- // createNodeFromTemplate
- // getNode(relative path) - deprecated
- // getPrimaryChildNode() - deprecated
- // getChildNodes($nodeTypeFilter, $limit, $offset) - deprecated
- $rectorConfig->rule(NodeGetChildNodesRector::class);
- // hasChildNodes($nodeTypeFilter) - deprecated
- // remove()
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'remove', '!! Node::remove() is not supported by the new CR. Use the "RemoveNodeAggregate" command to remove a node.');
- // setRemoved()
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setRemoved', '!! Node::setRemoved() is not supported by the new CR. Use the "RemoveNodeAggregate" command to remove a node.');
- // isRemoved()
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'isRemoved', '!! Node::isRemoved() - the new CR *never* returns removed nodes; so you can simplify your code and just assume removed == FALSE in all scenarios.');
- $fusionNodePropertyPathToWarningComments[] = 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.');
- // isVisible()
- // isAccessible()
- // hasAccessRestrictions()
- // isNodeTypeAllowedAsChildNode()
- // moveBefore()
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'moveBefore', '!! Node::moveBefore() is not supported by the new CR. Use the "MoveNodeAggregate" command to move a node.');
- // moveAfter()
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'moveAfter', '!! Node::moveAfter() is not supported by the new CR. Use the "MoveNodeAggregate" command to move a node.');
- // moveInto()
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'moveInto', '!! Node::moveInto() is not supported by the new CR. Use the "MoveNodeAggregate" command to move a node.');
- // copyBefore()
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'copyBefore', '!! Node::copyBefore() is not supported by the new CR. Use the "NodeDuplicationService::copyNodesRecursively" to copy a node.');
- // copyAfter()
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'copyAfter', '!! Node::copyAfter() is not supported by the new CR. Use the "NodeDuplicationService::copyNodesRecursively" to copy a node.');
- // copyInto()
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'copyInto', '!! Node::copyInto() is not supported by the new CR. Use the "NodeDuplicationService::copyNodesRecursively" to copy a node.');
- // getNodeData()
- $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getNodeData', '!! Node::getNodeData() - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.');
- // getContext()
- // getContext()->getWorkspace()
- $rectorConfig->rule(NodeGetContextGetWorkspaceRector::class);
- // TODO: Fusion
- // getContext()->getWorkspaceName()
- $rectorConfig->rule(NodeGetContextGetWorkspaceNameRector::class);
- // TODO: Fusion
- // getDimensions()
- $rectorConfig->rule(NodeGetDimensionsRector::class);
- // TODO: Fusion
- // createVariantForContext()
- // isAutoCreated()
- $rectorConfig->rule(NodeIsAutoCreatedRector::class);
- $rectorConfig->rule(FusionNodeAutoCreatedRector::class);
- $fusionFlowQueryPropertyToComments[] = 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.');
-
- // getOtherNodeVariants()
-
- $rectorConfig->ruleWithConfiguration(FusionFlowQueryNodePropertyToWarningCommentRector::class, $fusionFlowQueryPropertyToComments);
-
-
- /**
- * Neos\ContentRepository\Domain\Projection\Content\NodeInterface
- */
- // isRoot()
- // isTethered()
- // getContentStreamIdentifier() -> threw exception in <= Neos 8.0 - so nobody could have used this
- // getNodeAggregateIdentifier()
- $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getNodeAggregateIdentifier', 'aggregateId');
- $rectorConfig->rule(rectorClass: FusionNodeAggregateIdentifierRector::class);
- // getNodeTypeName()
- $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getNodeTypeName', 'nodeTypeName');
- // getNodeType() ** (included/compatible in old NodeInterface)
- // getNodeName()
- $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getNodeName', 'nodeName');
- // getOriginDimensionSpacePoint() -> threw exception in <= Neos 8.0 - so nobody could have used this
- // getProperties() ** (included/compatible in old NodeInterface)
- // getProperty() ** (included/compatible in old NodeInterface)
- // hasProperty() ** (included/compatible in old NodeInterface)
- // getLabel() ** (included/compatible in old NodeInterface)
-
- /**
- * Neos\ContentRepository\Core\NodeType\NodeType
- */
- // getName()
- $rectorConfig->rule(FusionNodeTypeNameRector::class);
- $rectorConfig->rule(NodeTypeGetNameRector::class);
- // getAutoCreatedChildNodes
- $rectorConfig->rule(NodeTypeGetAutoCreatedChildNodesRector::class);
- // hasAutoCreatedChildNode
- $rectorConfig->ruleWithConfiguration(RenameMethodRector::class, [new MethodCallRename(
- NodeType::class,
- 'hasAutoCreatedChildNode',
- 'hasTetheredNode'
- )]);
- // getTypeOfAutoCreatedChildNode
- $rectorConfig->rule(NodeTypeGetTypeOfAutoCreatedChildNodeRector::class);
- // allowsGrandchildNodeType
- $rectorConfig->rule(NodeTypeAllowsGrandchildNodeTypeRector::class);
-
-
- /**
- * Neos\ContentRepository\Domain\Projection\Content\TraversableNodeInterface
- */
- // getDimensionSpacePoint() -> threw exception in <= Neos 8.0 - so nobody could have used this
- // findParentNode() -> TraversableNodeInterface
- $rectorConfig->rule(NodeFindParentNodeRector::class);
- // findNodePath() -> NodePath
- // TODO: PHP
- // findNamedChildNode(NodeName $nodeName): TraversableNodeInterface;
- // TODO: PHP
- // findChildNodes(NodeTypeConstraints $nodeTypeConstraints = null, int $limit = null, int $offset = null): TraversableNodes;
- // TODO: PHP
- // countChildNodes(NodeTypeConstraints $nodeTypeConstraints = null): int;
- // TODO: PHP
- // findReferencedNodes(): TraversableNodes;
- // TODO: PHP
- // findNamedReferencedNodes(PropertyName $edgeName): TraversableNodes;
- // TODO: PHP
- // findReferencingNodes() -> threw exception in <= Neos 8.0 - so nobody could have used this
- // findNamedReferencingNodes() -> threw exception in <= Neos 8.0 - so nobody could have used this
-
-
- /**
- * Context
- */
- $rectorConfig->rule(ContextFactoryToLegacyContextStubRector::class);
- // Context::getWorkspaceName()
- // TODO: PHP
- $rectorConfig->rule(FusionContextGetWorkspaceNameRector::class);
- // Context::getRootNode()
- $rectorConfig->rule(ContextGetRootNodeRector::class);
- $fusionNodePropertyPathToWarningComments[] = new FusionNodePropertyPathToWarningComment('context.rootNode', 'Line %LINE: !! node.context.rootNode is removed in Neos 9.0.');
- // Context::getNode()
- // TODO: PHP
- // Context::getNodeByIdentifier()
- // TODO: PHP
- // Context::getNodeVariantsByIdentifier()
- // TODO: PHP
- // Context::getNodesOnPath()
- // TODO: PHP
- // Context::adoptNode()
- // TODO: PHP
- // Context::getFirstLevelNodeCache()
- $rectorConfig->rule(ContextGetFirstLevelNodeCacheRector::class);
- // getCurrentDateTime(): DateTime|DateTimeInterface
- // TODO: PHP
- $fusionNodePropertyPathToWarningComments[] = new FusionNodePropertyPathToWarningComment('context.currentDateTime', 'Line %LINE: !! node.context.currentDateTime is removed in Neos 9.0.');
- // getDimensions(): array
- // TODO: PHP
- $fusionNodePropertyPathToWarningComments[] = new FusionNodePropertyPathToWarningComment('context.dimensions', 'Line %LINE: !! node.context.dimensions is removed in Neos 9.0. You can get node DimensionSpacePoints via node.dimensionSpacePoints now or use the `Neos.Dimension.*` helper.');
- // getNodeByIdentifier(identifier: string): NodeInterface|null
- // TODO: PHP
- // getProperties(): array
- // TODO: PHP
- $fusionNodePropertyPathToWarningComments[] = new FusionNodePropertyPathToWarningComment('context.properties', 'Line %LINE: !! node.context.properties is removed in Neos 9.0.');
- // getTargetDimensions(): array
- // TODO: PHP
- $fusionNodePropertyPathToWarningComments[] = new FusionNodePropertyPathToWarningComment('context.targetDimensions', 'Line %LINE: !! node.context.targetDimensions is removed in Neos 9.0.');
- // getTargetDimensionValues(): array
- // TODO: PHP
- $fusionNodePropertyPathToWarningComments[] = new FusionNodePropertyPathToWarningComment('context.targetDimensionValues', 'Line %LINE: !! node.context.targetDimensionValues is removed in Neos 9.0.');
- // getWorkspace([createWorkspaceIfNecessary: bool = true]): Workspace
- // TODO: PHP
- $rectorConfig->rule(FusionContextGetWorkspaceRector::class);
- // isInaccessibleContentShown(): bool
- // TODO: PHP
- $fusionNodePropertyPathToWarningComments[] = new FusionNodePropertyPathToWarningComment('context.isInaccessibleContentShown', 'Line %LINE: !! node.context.isInaccessibleContentShown is removed in Neos 9.0.');
- // isInvisibleContentShown(): bool
- // TODO: PHP
- $fusionNodePropertyPathToWarningComments[] = new FusionNodePropertyPathToWarningComment('context.isInvisibleContentShown', 'Line %LINE: !! node.context.isInvisibleContentShown is removed in Neos 9.0.');
- // isRemovedContentShown(): bool
- // TODO: PHP
- $fusionNodePropertyPathToWarningComments[] = new FusionNodePropertyPathToWarningComment('context.isRemovedContentShown', 'Line %LINE: !! node.context.isRemovedContentShown is removed in Neos 9.0.');
- // validateWorkspace(workspace: Workspace): void
- // TODO: PHP
-
-
-
- /**
- * ContentContext
- */
- // ContentContext::getCurrentSite
- $methodCallToWarningComments[] = new MethodCallToWarningComment(LegacyContextStub::class, 'getCurrentSite', '!! ContentContext::getCurrentSite() is removed in Neos 9.0.');
- $rectorConfig->rule(FusionContextCurrentSiteRector::class);
- // ContentContext::getCurrentDomain
- $methodCallToWarningComments[] = new MethodCallToWarningComment(LegacyContextStub::class, 'getCurrentDomain', '!! ContentContext::getCurrentDomain() is removed in Neos 9.0.');
- $fusionNodePropertyPathToWarningComments[] = new FusionNodePropertyPathToWarningComment('context.currentDomain', 'Line %LINE: !! node.context.currentDomain is removed in Neos 9.0.');
- // ContentContext::getCurrentSiteNode
- $methodCallToWarningComments[] = new MethodCallToWarningComment(LegacyContextStub::class, 'getCurrentSiteNode', '!! ContentContext::getCurrentSiteNode() is removed in Neos 9.0. Use Subgraph and traverse up to "Neos.Neos:Site" node.');
- $fusionNodePropertyPathToWarningComments[] = new FusionNodePropertyPathToWarningComment('context.currentSiteNode', 'Line %LINE: !! node.context.currentSiteNode is removed in Neos 9.0. Check if you can\'t simply use ${site}.');
- // ContentContext::isLive -> renderingMode.isLive
- $rectorConfig->rule(ContextIsLiveRector::class);
- $rectorConfig->rule(FusionContextLiveRector::class);
- // ContentContext::isInBackend -> renderingMode.inBackend
- $rectorConfig->rule(ContextIsInBackendRector::class);
- $rectorConfig->rule(FusionContextInBackendRector::class);
- // ContentContext::getCurrentRenderingMode... -> renderingMode...
- $rectorConfig->rule(ContextGetCurrentRenderingModeRector::class);
- $rectorConfig->rule(FusionContextCurrentRenderingModeRector::class);
-
- /**
- * CreateContentContextTrait
- */
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\Neos\Controller\CreateContentContextTrait::class, 'createContentContext', '!! CreateContentContextTrait::createContentContext() is removed in Neos 9.0.');
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\Neos\Controller\CreateContentContextTrait::class, 'createContextMatchingNodeData', '!! CreateContentContextTrait::createContextMatchingNodeData() is removed in Neos 9.0.');
-
- /**
- * CacheLifetimeOperation
- */
- $rectorConfig->rule(FusionCacheLifetimeRector::class);
-
-
- /**
- * ContentDimensionCombinator
- */
- // ContentDimensionCombinator::getAllAllowedCombinations
- $rectorConfig->rule(ContentDimensionCombinatorGetAllAllowedCombinationsRector::class);
-
- /**
- * Neos\Neos\Domain\Service\NodeSearchService
- */
- $rectorConfig->rule(NodeSearchServiceRector::class);
-
-
- /**
- * Neos\ContentRepository\Domain\Factory\NodeFactory
- */
- // TODO: What other methods?
- // NodeFactory::reset
- $rectorConfig->rule(NodeFactoryResetRector::class);
-
- /**
- * Neos\ContentRepository\Domain\Repository\WorkspaceRepository
- */
- // countByName(workspace): int
- $rectorConfig->rule(WorkspaceRepositoryCountByNameRector::class);
- // findByBaseWorkspace(baseWorkspace): QueryResultInterface
- $rectorConfig->rule(WorkspaceRepositoryFindByBaseWorkspaceRector::class);
- // findByIdentifier(baseWorkspace): Workspace
- $rectorConfig->rule(WorkspaceRepositoryFindByIdentifierRector::class);
-
- /**
- * Neos\ContentRepository\Domain\Model\Workspace
- */
- $rectorConfig->rule(WorkspaceGetNameRector::class);
-
- /**
- * NodeTemplate
- */
- $nodeTemplateWarningMessage = '!! NodeTemplate::%2$s is removed in Neos 9.0. Use the "CreateNodeAggregateWithNode" command to create new nodes or "CreateNodeVariant" command to create variants of an existing node in other dimensions.';
- // getIdentifier(): string
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeTemplate::class, 'getIdentifier', $nodeTemplateWarningMessage);
- // getName(): string
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeTemplate::class, 'getName', $nodeTemplateWarningMessage);
- // getWorkspace(): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeTemplate::class, 'getWorkspace', $nodeTemplateWarningMessage);
- // setIdentifier(identifier: string): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeTemplate::class, 'setIdentifier', $nodeTemplateWarningMessage);
- // setName(newName: string): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeTemplate::class, 'setName', $nodeTemplateWarningMessage);
-
- /**
- * ObjectInstantiationToWarningComment
- */
- $rectorConfig->ruleWithConfiguration(ObjectInstantiationToWarningCommentRector::class, [
+use Neos\Rector\Generic\Rules\MethodCallToPropertyFetchRector;
+use Neos\Rector\Generic\ValueObject\MethodCallToPropertyFetch;
+
+
+$rectorConfig = RectorConfig::configure()
+ ->withoutParallel()
+ ->withAutoloadPaths(
+ [__DIR__ . '/../../src/ContentRepository90/Legacy']
+ );
+
+
+/** @var MethodCallToPropertyFetch[] $methodCallToPropertyFetches */
+$methodCallToPropertyFetches = [];
+
+/** @var MethodCallToWarningComment[] $methodCallToWarningComments */
+$methodCallToWarningComments = [];
+
+
+/**
+ * Neos\ContentRepository\Domain\Model\NodeInterface
+ */
+// setName
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setName', '!! Node::setName() is not supported by the new CR. Use the "ChangeNodeAggregateName" command to change the node name.');
+// getName
+$methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getName', 'nodeName');
+$rectorConfig->withRules([NodeLabelGeneratorRector::class]);
+// setProperty
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setProperty', '!! Node::setProperty() is not supported by the new CR. Use the "SetNodeProperties" command to change property values.');
+// hasProperty -> compatible with ES CR Node (nothing to do)
+// getProperty -> compatible with ES CR Node (nothing to do)
+// removeProperty
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'removeProperty', '!! Node::removeProperty() is not supported by the new CR. Use the "SetNodeProperties" command to remove a property values.');
+// getProperties -> PropertyCollectionInterface
+$methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getProperties', 'properties');
+// getPropertyNames
+$rectorConfig->withRules([NodeGetPropertyNamesRector::class]);
+// setContentObject -> DEPRECATED / NON-FUNCTIONAL
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setContentObject', '!! Node::setContentObject() is not supported by the new CR. Referencing objects can be done by storing them in Node::properties (and the serialization/deserialization is extensible).');
+// getContentObject -> DEPRECATED / NON-FUNCTIONAL
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getContentObject', '!! Node::getContentObject() is not supported by the new CR. Referencing objects can be done by storing them in Node::properties (and the serialization/deserialization is extensible).');
+// unsetContentObject -> DEPRECATED / NON-FUNCTIONAL
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'unsetContentObject', '!! Node::unsetContentObject() is not supported by the new CR. Referencing objects can be done by storing them in Node::properties (and the serialization/deserialization is extensible).');
+// setNodeType
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setNodeType', '!! Node::setNodeType() is not supported by the new CR. Use the "ChangeNodeAggregateType" command to change nodetype.');
+// getNodeType: NodeType
+// PHP: shortcut to Node->nodeTypeName->value
+$rectorConfig->withRules([NodeGetNodeTypeGetNameRector::class]);
+$rectorConfig->withRules([NodeGetNodeTypeRector::class]);
+// setHidden
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setHidden', '!! Node::setHidden() is not supported by the new CR. Use the "EnableNodeAggregate" or "DisableNodeAggregate" command to change the visibility of the node.');
+// isHidden
+$rectorConfig->withRules([NodeIsHiddenRector::class]);
+// setHiddenBeforeDateTime
+$rectorConfig->withRules([NodeGetHiddenBeforeAfterDateTimeRector::class]);
+// getHiddenBeforeDateTime
+// PHP: Covered by NodeGetHiddenBeforeAfterDateTimeRector
+// setHiddenAfterDateTime
+// PHP: Covered by NodeGetHiddenBeforeAfterDateTimeRector
+// getHiddenAfterDateTime
+// PHP: Covered by NodeGetHiddenBeforeAfterDateTimeRector
+// setHiddenInIndex
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setHiddenInIndex', '!! Node::setHiddenInIndex() is not supported by the new CR. Use the "SetNodeProperties" command to change the property value for "hiddenInMenu".');
+// isHiddenInIndex
+$rectorConfig->withRules([NodeIsHiddenInIndexRector::class]);
+// setAccessRoles
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setAccessRoles', '!! Node::setAccessRoles() is not supported by the new CR.');
+// getAccessRoles
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getAccessRoles', '!! Node::getAccessRoles() is not supported by the new CR.');
+// getPath
+$rectorConfig->withRules([NodeGetPathRector::class]);
+// getContextPath
+$rectorConfig->withRules([NodeGetContextPathRector::class]);
+// getDepth
+$rectorConfig->withRules([NodeGetDepthRector::class]);
+// setWorkspace -> internal
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setWorkspace', '!! Node::setWorkspace() was always internal, and the workspace system has been fundamentally changed with the new CR. Try to rewrite your code around Content Streams.');
+// getWorkspace
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, '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.');
+// getIdentifier
+$rectorConfig->withRules([NodeGetIdentifierRector::class]);
+// setIndex -> internal
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setIndex', '!! Node::setIndex() was always internal. To reorder nodes, use the "MoveNodeAggregate" command');
+// getIndex
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getIndex', '!! Node::getIndex() is not supported. You can fetch all siblings and inspect the ordering');
+// getParent -> Node
+$rectorConfig->withRules([NodeGetParentRector::class]);
+// getParentPath - deprecated
+// createNode
+// createSingleNode -> internal
+// createNodeFromTemplate
+// getNode(relative path) - deprecated
+// getPrimaryChildNode() - deprecated
+// getChildNodes($nodeTypeFilter, $limit, $offset) - deprecated
+$rectorConfig->withRules([NodeGetChildNodesRector::class]);
+// hasChildNodes($nodeTypeFilter) - deprecated
+// remove()
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'remove', '!! Node::remove() is not supported by the new CR. Use the "RemoveNodeAggregate" command to remove a node.');
+// setRemoved()
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setRemoved', '!! Node::setRemoved() is not supported by the new CR. Use the "RemoveNodeAggregate" command to remove a node.');
+// isRemoved()
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'isRemoved', '!! Node::isRemoved() - the new CR *never* returns removed nodes; so you can simplify your code and just assume removed == FALSE in all scenarios.');
+// isVisible()
+// isAccessible()
+// hasAccessRestrictions()
+// isNodeTypeAllowedAsChildNode()
+// moveBefore()
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'moveBefore', '!! Node::moveBefore() is not supported by the new CR. Use the "MoveNodeAggregate" command to move a node.');
+// moveAfter()
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'moveAfter', '!! Node::moveAfter() is not supported by the new CR. Use the "MoveNodeAggregate" command to move a node.');
+// moveInto()
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'moveInto', '!! Node::moveInto() is not supported by the new CR. Use the "MoveNodeAggregate" command to move a node.');
+// copyBefore()
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'copyBefore', '!! Node::copyBefore() is not supported by the new CR. Use the "NodeDuplicationService::copyNodesRecursively" to copy a node.');
+// copyAfter()
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'copyAfter', '!! Node::copyAfter() is not supported by the new CR. Use the "NodeDuplicationService::copyNodesRecursively" to copy a node.');
+// copyInto()
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'copyInto', '!! Node::copyInto() is not supported by the new CR. Use the "NodeDuplicationService::copyNodesRecursively" to copy a node.');
+// getNodeData()
+$methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getNodeData', '!! Node::getNodeData() - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.');
+// getContext()
+// getContext()->getWorkspace()
+$rectorConfig->withRules([NodeGetContextGetWorkspaceRector::class]);
+// getContext()->getWorkspaceName()
+$rectorConfig->withRules([NodeGetContextGetWorkspaceNameRector::class]);
+// getDimensions()
+$rectorConfig->withRules([NodeGetDimensionsRector::class]);
+// createVariantForContext()
+// isAutoCreated()
+$rectorConfig->withRules([NodeIsAutoCreatedRector::class]);
+
+// getOtherNodeVariants()
+
+
+/**
+ * Neos\ContentRepository\Domain\Projection\Content\NodeInterface
+ */
+// isRoot()
+// isTethered()
+// getContentStreamIdentifier() -> threw exception in <= Neos 8.0 - so nobody could have used this
+// getNodeAggregateIdentifier()
+$methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getNodeAggregateIdentifier', 'aggregateId');
+// getNodeTypeName()
+$methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getNodeTypeName', 'nodeTypeName');
+// getNodeType() ** (included/compatible in old NodeInterface)
+// getNodeName()
+$methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getNodeName', 'nodeName');
+// getOriginDimensionSpacePoint() -> threw exception in <= Neos 8.0 - so nobody could have used this
+// getProperties() ** (included/compatible in old NodeInterface)
+// getProperty() ** (included/compatible in old NodeInterface)
+// hasProperty() ** (included/compatible in old NodeInterface)
+// getLabel() ** (included/compatible in old NodeInterface)
+
+/**
+ * Neos\ContentRepository\Core\NodeType\NodeType
+ */
+// getName()
+$rectorConfig->withRules([NodeTypeGetNameRector::class]);
+// getAutoCreatedChildNodes
+$rectorConfig->withRules([NodeTypeGetAutoCreatedChildNodesRector::class]);
+// hasAutoCreatedChildNode
+$rectorConfig->withConfiguredRule(RenameMethodRector::class, [new MethodCallRename(
+ NodeType::class,
+ 'hasAutoCreatedChildNode',
+ 'hasTetheredNode'
+)]);
+// getTypeOfAutoCreatedChildNode
+$rectorConfig->withRules([NodeTypeGetTypeOfAutoCreatedChildNodeRector::class]);
+// allowsGrandchildNodeType
+$rectorConfig->withRules([NodeTypeAllowsGrandchildNodeTypeRector::class]);
+
+
+/**
+ * Neos\ContentRepository\Domain\Projection\Content\TraversableNodeInterface
+ */
+// getDimensionSpacePoint() -> threw exception in <= Neos 8.0 - so nobody could have used this
+// findParentNode() -> TraversableNodeInterface
+$rectorConfig->withRules([NodeFindParentNodeRector::class]);
+// findNodePath() -> NodePath
+// TODO: PHP
+// findNamedChildNode(NodeName $nodeName): TraversableNodeInterface;
+// TODO: PHP
+// findChildNodes(NodeTypeConstraints $nodeTypeConstraints = null, int $limit = null, int $offset = null): TraversableNodes;
+// TODO: PHP
+// countChildNodes(NodeTypeConstraints $nodeTypeConstraints = null): int;
+// TODO: PHP
+// findReferencedNodes(): TraversableNodes;
+// TODO: PHP
+// findNamedReferencedNodes(PropertyName $edgeName): TraversableNodes;
+// TODO: PHP
+// findReferencingNodes() -> threw exception in <= Neos 8.0 - so nobody could have used this
+// findNamedReferencingNodes() -> threw exception in <= Neos 8.0 - so nobody could have used this
+
+
+/**
+ * Context
+ */
+$rectorConfig->withRules([ContextFactoryToLegacyContextStubRector::class]);
+// Context::getWorkspaceName()
+// TODO: PHP
+// Context::getRootNode()
+$rectorConfig->withRules([ContextGetRootNodeRector::class]);
+// Context::getNode()
+// TODO: PHP
+// Context::getNodeByIdentifier()
+// TODO: PHP
+// Context::getNodeVariantsByIdentifier()
+// TODO: PHP
+// Context::getNodesOnPath()
+// TODO: PHP
+// Context::adoptNode()
+// TODO: PHP
+// Context::getFirstLevelNodeCache()
+$rectorConfig->withRules([ContextGetFirstLevelNodeCacheRector::class]);
+// getCurrentDateTime(): DateTime|DateTimeInterface
+// TODO: PHP
+// getDimensions(): array
+// TODO: PHP
+// getNodeByIdentifier(identifier: string): NodeInterface|null
+// TODO: PHP
+// getProperties(): array
+// TODO: PHP
+// getTargetDimensions(): array
+// TODO: PHP
+// getTargetDimensionValues(): array
+// TODO: PHP
+// getWorkspace([createWorkspaceIfNecessary: bool = true]): Workspace
+// TODO: PHP
+// isInaccessibleContentShown(): bool
+// TODO: PHP
+// isInvisibleContentShown(): bool
+// TODO: PHP
+// isRemovedContentShown(): bool
+// TODO: PHP
+// validateWorkspace(workspace: Workspace): void
+// TODO: PHP
+
+
+/**
+ * ContentContext
+ */
+// ContentContext::getCurrentSite
+$methodCallToWarningComments[] = new MethodCallToWarningComment(LegacyContextStub::class, 'getCurrentSite', '!! ContentContext::getCurrentSite() is removed in Neos 9.0.');
+// ContentContext::getCurrentDomain
+$methodCallToWarningComments[] = new MethodCallToWarningComment(LegacyContextStub::class, 'getCurrentDomain', '!! ContentContext::getCurrentDomain() is removed in Neos 9.0.');
+// ContentContext::getCurrentSiteNode
+$methodCallToWarningComments[] = new MethodCallToWarningComment(LegacyContextStub::class, 'getCurrentSiteNode', '!! ContentContext::getCurrentSiteNode() is removed in Neos 9.0. Use Subgraph and traverse up to "Neos.Neos:Site" node.');
+// ContentContext::isLive -> renderingMode.isLive
+$rectorConfig->withRules([ContextIsLiveRector::class]);
+// ContentContext::isInBackend -> renderingMode.inBackend
+$rectorConfig->withRules([ContextIsInBackendRector::class]);
+// ContentContext::getCurrentRenderingMode... -> renderingMode...
+$rectorConfig->withRules([ContextGetCurrentRenderingModeRector::class]);
+
+/**
+ * CreateContentContextTrait
+ */
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\Neos\Controller\CreateContentContextTrait::class, 'createContentContext', '!! CreateContentContextTrait::createContentContext() is removed in Neos 9.0.');
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\Neos\Controller\CreateContentContextTrait::class, 'createContextMatchingNodeData', '!! CreateContentContextTrait::createContextMatchingNodeData() is removed in Neos 9.0.');
+
+/**
+ * CacheLifetimeOperation
+ */
+
+
+/**
+ * ContentDimensionCombinator
+ */
+// ContentDimensionCombinator::getAllAllowedCombinations
+$rectorConfig->withRules([ContentDimensionCombinatorGetAllAllowedCombinationsRector::class]);
+
+/**
+ * Neos\Neos\Domain\Service\NodeSearchService
+ */
+$rectorConfig->withRules([NodeSearchServiceRector::class]);
+
+
+/**
+ * Neos\ContentRepository\Domain\Factory\NodeFactory
+ */
+// TODO: What other methods?
+// NodeFactory::reset
+$rectorConfig->withRules([NodeFactoryResetRector::class]);
+
+/**
+ * Neos\ContentRepository\Domain\Repository\WorkspaceRepository
+ */
+// countByName(workspace): int
+$rectorConfig->withRules([WorkspaceRepositoryCountByNameRector::class]);
+// findByBaseWorkspace(baseWorkspace): QueryResultInterface
+$rectorConfig->withRules([WorkspaceRepositoryFindByBaseWorkspaceRector::class]);
+// findByIdentifier(baseWorkspace): Workspace
+$rectorConfig->withRules([WorkspaceRepositoryFindByIdentifierRector::class]);
+
+/**
+ * Neos\ContentRepository\Domain\Model\Workspace
+ */
+$rectorConfig->withRules([WorkspaceGetNameRector::class]);
+
+/**
+ * NodeTemplate
+ */
+$nodeTemplateWarningMessage = '!! NodeTemplate::%2$s is removed in Neos 9.0. Use the "CreateNodeAggregateWithNode" command to create new nodes or "CreateNodeVariant" command to create variants of an existing node in other dimensions.';
+// getIdentifier(): string
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeTemplate::class, 'getIdentifier', $nodeTemplateWarningMessage);
+// getName(): string
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeTemplate::class, 'getName', $nodeTemplateWarningMessage);
+// getWorkspace(): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeTemplate::class, 'getWorkspace', $nodeTemplateWarningMessage);
+// setIdentifier(identifier: string): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeTemplate::class, 'setIdentifier', $nodeTemplateWarningMessage);
+// setName(newName: string): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeTemplate::class, 'setName', $nodeTemplateWarningMessage);
+
+/**
+ * ObjectInstantiationToWarningComment
+ */
+$rectorConfig->withConfiguredRule(ObjectInstantiationToWarningCommentRector::class, [
new ObjectInstantiationToWarningComment(\Neos\ContentRepository\Domain\Model\NodeTemplate::class, '!! NodeTemplate is removed in Neos 9.0. Use the "CreateNodeAggregateWithNode" command to create new nodes or "CreateNodeVariant" command to create variants of an existing node in other dimensions.'),
new ObjectInstantiationToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints::class, '!! NodeTypeConstraints is removed in Neos 9.0. Please use the proper filter in subgraph finders e.g. "FindChildNodesFilter" for ContentSubgraphInterface::findChildNodes().')
]
- );
-
- /**
- * Neos\ContentRepository\Domain\Service\NodeTypeManager
- */
- $rectorConfig->rule(NodeTypeManagerAccessRector::class);
- // createNodeType(nodeTypeName: string): NodeType
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Service\NodeTypeManager::class, 'createNodeType', '!! NodeTypeManager::createNodeType() was never implemented and is removed in Neos 9.0.');
- // getNodeType(nodeTypeName: string): NodeType
- // --> Compatible with 9.0
- // getNodeTypes([includeAbstractNodeTypes: bool = true]): NodeType[]
- // --> Compatible with 9.0
- // getSubNodeTypes(superTypeName: string, [includeAbstractNodeTypes: bool = true]): NodeType[]
- // --> Compatible with 9.0
- // hasNodeType(nodeTypeName: string): bool
- // --> Compatible with 9.0
- // overrideNodeTypes(completeNodeTypeConfiguration: array): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Service\NodeTypeManager::class, 'overrideNodeTypes', '!! NodeTypeManager::createNodeType() was never meant to be used outside of testing and is removed in Neos 9.0.');
-
- /**
- * NodeData
- */
- $nodeDataWarningMessage = '!! NodeData::%2$s is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.';
- // createNodeData(name: string, [nodeType: NodeType|null = null], [identifier: null|string = null], [workspace: Workspace|null = null], [dimensions: array|null = null]): NodeData
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'createNodeData', $nodeDataWarningMessage);
- // createNodeDataFromTemplate(nodeTemplate: NodeTemplate, [nodeName: null|string = null], [workspace: Workspace|null = null], [dimensions: array|null = null]): NodeData
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'createNodeDataFromTemplate', $nodeDataWarningMessage);
- // createShadow(path: string): NodeData
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'createShadow', $nodeDataWarningMessage);
- // createSingleNodeData(name: string, [nodeType: NodeType|null = null], [identifier: null|string = null], [workspace: Workspace|null = null], [dimensions: array|null = null]): NodeData
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'createSingleNodeData', $nodeDataWarningMessage);
- // getContextPath(): string
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getContextPath', $nodeDataWarningMessage);
- // getDepth(): int
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getDepth', $nodeDataWarningMessage);
- // getDimensions(): NodeDimension[]
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getDimensions', $nodeDataWarningMessage);
- // getDimensionsHash(): string
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getDimensionsHash', $nodeDataWarningMessage);
- // getDimensionValues(): array
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getDimensionValues', $nodeDataWarningMessage);
- // getIdentifier(): string
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getIdentifier', $nodeDataWarningMessage);
- // getIndex(): int
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getIndex', $nodeDataWarningMessage);
- // getMovedTo(): NodeData
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getMovedTo', $nodeDataWarningMessage);
- // getName(): string
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getName', $nodeDataWarningMessage);
- // getNumberOfChildNodes(nodeTypeFilter: string, workspace: Workspace, dimensions: array): int
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getNumberOfChildNodes', $nodeDataWarningMessage);
- // getParent(): NodeData|null
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getParent', $nodeDataWarningMessage);
- // getParentPath(): string
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getParentPath', $nodeDataWarningMessage);
- // getPath(): string
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getPath', $nodeDataWarningMessage);
- // getWorkspace(): Workspace
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getWorkspace', $nodeDataWarningMessage);
- // hasAccessRestrictions(): bool
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'hasAccessRestrictions', $nodeDataWarningMessage);
- // isAccessible(): bool
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'isAccessible', $nodeDataWarningMessage);
- // isInternal(): bool
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'isInternal', $nodeDataWarningMessage);
- // isRemoved(): bool
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'isRemoved', $nodeDataWarningMessage);
- // isVisible(): bool
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'isVisible', $nodeDataWarningMessage);
- // matchesWorkspaceAndDimensions(workspace: Workspace, [dimensions: array|null = null]): bool
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'matchesWorkspaceAndDimensions', $nodeDataWarningMessage);
- // move(targetPath: string, targetWorkspace: Workspace): NodeData|null
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'targetPath', $nodeDataWarningMessage);
- // remove(): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'remove', $nodeDataWarningMessage);
- // setDimensions(dimensionsToBeSet: array): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'setDimensions', $nodeDataWarningMessage);
- // setIdentifier(identifier: string): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'setIdentifier', $nodeDataWarningMessage);
- // setIndex(index: int): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'setIndex', $nodeDataWarningMessage);
- // setMovedTo([nodeData: NodeData|null = null]): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'setMovedTo', $nodeDataWarningMessage);
- // setPath(path: string, [recursive: bool = true]): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'setPath', $nodeDataWarningMessage);
- // setRemoved(removed: bool): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'setRemoved', $nodeDataWarningMessage);
- // setWorkspace([workspace: Workspace|null = null]): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'setWorkspace', $nodeDataWarningMessage);
- // similarize(sourceNode: AbstractNodeData, [isCopy: bool = false]): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'similarize', $nodeDataWarningMessage);
-
- /**
- * \Neos\ContentRepository\Domain\NodeType\NodeTypeConstraintFactory
- */
- // parseFilterStrnig(serializedFilters: string): NodeTypeConstraints
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraintFactory::class, 'parseFilterString', '!! The "NodeTypeConstraintFactory" has been removed in Neos 9. Please use the proper filter in subgraph finders e.g. "FindChildNodesFilter" for ContentSubgraphInterface::findChildNodes().');
-
- /**
- * \Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints
- */
- $nodeTypeConstraintsWarning = '!! NodeTypeConstraints has been removed in Neos 9. Please use the proper filter in subgraph finders e.g. "FindChildNodesFilter" for ContentSubgraphInterface::findChildNodes().';
- // asLegacyNodeTypeFilterString(): string
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints::class, 'asLegacyNodeTypeFilterString', $nodeTypeConstraintsWarning);
- // getExplicitlyAllowedNodeTypeNames(): NodeTypeName[]
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints::class, 'getExplicitlyAllowedNodeTypeNames', $nodeTypeConstraintsWarning);
- // getExplicitlyDisallowedNodeTypeNames(): NodeTypeName[]
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints::class, 'getExplicitlyDisallowedNodeTypeNames', $nodeTypeConstraintsWarning);
- // isWildcardAllowed(): bool
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints::class, 'isWildcardAllowed', $nodeTypeConstraintsWarning);
- // matches(nodeTypeName: NodeTypeName): bool
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints::class, 'nodeTypeName', $nodeTypeConstraintsWarning);
- // withExplicitlyDisallowedNodeType(nodeTypeName: NodeTypeName): NodeTypeConstraints
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints::class, 'withExplicitlyDisallowedNodeType', $nodeTypeConstraintsWarning);
-
- /**
- * Signals and Slots
- * https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots
- */
- $signalsAndSlotsToComment = [];
- // Neos\ContentRepository\Domain\Service\PublishingService
- // - nodePublished
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Service\PublishingService::class, 'nodePublished', 'The signal "nodePublished" on "PublishingService" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - nodeDiscarded
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Service\PublishingService::class, 'nodeDiscarded', 'The signal "nodeDiscarded" on "PublishingService" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // Neos\Neos\Service\PublishingService
- // - nodePublished
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\Neos\Service\PublishingService::class, 'nodePublished', 'The signal "nodePublished" on "PublishingService" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - nodeDiscarded
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\Neos\Service\PublishingService::class, 'nodeDiscarded', 'The signal "nodeDiscarded" on "PublishingService" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // Neos\ContentRepository\Domain\Service\Context
- // - beforeAdoptNode
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Service\Context::class, 'beforeAdoptNode', 'The signal "beforeAdoptNode" on "Context" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - afterAdoptNode
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Service\Context::class, 'afterAdoptNode', 'The signal "afterAdoptNode" on "Context" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // Neos\ContentRepository\Domain\Repository\NodeDataRepository
- // - repositoryObjectsPersisted
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Repository\NodeDataRepository::class, 'repositoryObjectsPersisted', 'The signal "repositoryObjectsPersisted" on "NodeDataRepository" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // Neos\ContentRepository\Domain\Model\Workspace
- // - baseWorkspaceChanged
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'baseWorkspaceChanged', 'The signal "baseWorkspaceChanged" on "Workspace" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - beforeNodePublishing
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'beforeNodePublishing', 'The signal "beforeNodePublishing" on "Workspace" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - afterNodePublishing
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'afterNodePublishing', 'The signal "afterNodePublishing" on "Workspace" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // Neos\ContentRepository\Domain\Model\NodeData
- // - nodePathChanged
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'nodePathChanged', 'The signal "nodePathChanged" on "NodeData" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // Neos\ContentRepository\Domain\Model\Node
- // - beforeNodeMove
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'beforeNodeMove', 'The signal "beforeNodeMove" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - afterNodeMove
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'afterNodeMove', 'The signal "afterNodeMove" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - beforeNodeCopy
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'beforeNodeCopy', 'The signal "beforeNodeCopy" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - afterNodeCopy
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'afterNodeCopy', 'The signal "afterNodeCopy" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - nodePathChanged
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'nodePathChanged', 'The signal "nodePathChanged" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - beforeNodeCreate
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'beforeNodeCreate', 'The signal "beforeNodeCreate" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - afterNodeCreate
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'afterNodeCreate', 'The signal "afterNodeCreate" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - nodeAdded
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'nodeAdded', 'The signal "nodeAdded" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - nodeUpdated
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'nodeUpdated', 'The signal "nodeUpdated" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - nodeRemoved
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'nodeRemoved', 'The signal "nodeRemoved" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - beforeNodePropertyChange
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'beforeNodePropertyChange', 'The signal "beforeNodePropertyChange" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
- // - nodePropertyChanged
- $signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'nodePropertyChanged', 'The signal "nodePropertyChanged" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
-
- $rectorConfig->ruleWithConfiguration(SignalSlotToWarningCommentRector::class, $signalsAndSlotsToComment);
-
-
- /**
- * Neos.Fusion:Attributes
- */
- $rectorConfig->ruleWithConfiguration(FusionPrototypeNameAddCommentRector::class, [
- new FusionPrototypeNameAddComment('Neos.Fusion:Attributes', 'TODO 9.0 migration: Neos.Fusion:Attributes has been removed without a replacement. You need to replace it by the property attributes in "Neos.Fusion:Tag" or apply the Eel helper "Neos.Array.toHtmlAttributesString(attributes)".')
- ]);
-
- $rectorConfig->rule(ContentRepositoryUtilityRenderValidNodeNameRector::class);
-
- /**
- * FlowQuery Operation context()
- */
- $rectorConfig->rule(FusionFlowQueryContextRector::class);
-
- /**
- * \Neos\ContentRepository\Domain\Model\Workspace
- */
- // getBaseWorkspace(): Workspace|null
- $rectorConfig->rule(WorkspaceGetBaseWorkspaceRector::class);
- // getBaseWorkspaces(): Workspace[]
- $rectorConfig->rule(WorkspaceGetBaseWorkspacesRector::class);
- // getDescription(): null|string
- $rectorConfig->rule(WorkspaceGetDescriptionRector::class);
- // getName(): string
- // ->name
- // getNodeCount(): int
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'getNodeCount', '!! Workspace::getNodeCount() has been removed in Neos 9.0 without a replacement.');
- // getOwner(): UserInterface|null
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'getOwner', '!! Workspace::getOwner() has been removed in Neos 9.0. Use WorkspaceService::getWorkspaceMetadata()->ownerUserId to get the userId of the owner.');
- // getRootNodeData(): NodeData
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'getRootNodeData', '!! Workspace::getRootNodeData() has been removed in Neos 9.0 without a replacement.');
- // getTitle(): string
- $rectorConfig->rule(WorkspaceGetTitleRector::class);
- // meta->setWorkspaceTitle
- // isInternalWorkspace(): bool
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'isInternalWorkspace', '!! Workspace::isInternalWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()');
- // isPersonalWorkspace(): bool
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'isPersonalWorkspace', '!! Workspace::isPersonalWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()');
- // isPrivateWorkspace(): bool
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'isPrivateWorkspace', '!! Workspace::isPrivateWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()');
- // isPublicWorkspace(): bool
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'isPublicWorkspace', '!! Workspace::isPublicWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()');
- // publish(targetWorkspace: Workspace): void
- $rectorConfig->rule(WorkspacePublishRector::class);
- // publishNode(nodeToPublish: NodeInterface, targetWorkspace: Workspace): void
- $rectorConfig->rule(WorkspacePublishNodeRector::class);
- // publishNodes(nodes: NodeInterface[], targetWorkspace: Workspace): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'publishNodes', '!! Workspace::publishNodes() has been removed in Neos 9.0. Use the \Neos\Neos\Domain\Service\WorkspacePublishingService to publish a workspace or changes in a document.');
- // setBaseWorkspace(baseWorkspace: Workspace): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'setBaseWorkspace', '!! Workspace::setBaseWorkspace() is not supported by the new CR. Use the "ChangeBaseWorkspace" command to change the baseWorkspace of a workspace.');
- // setDescription(description: string): void
- $rectorConfig->rule(WorkspaceSetDescriptionRector::class);
- // setOwner(user: UserInterface|null|string): void
- $methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'setOwner', '!! Workspace::setOwner() has been removed in Neos 9.0. You can set the owner of a workspace during creation WorkspaceService::createPersonalWorkspace().');
- // setTitle(title: string): void
- $rectorConfig->rule(WorkspaceSetTitleRector::class);
-
- /**
- * SPECIAL rules
- */
- $rectorConfig->rule(FusionCachingNodeInEntryIdentifierRector::class);
- $rectorConfig->ruleWithConfiguration(\Neos\Rector\Generic\Rules\RemoveParentClassRector::class, [
- new RemoveParentClass(
- parentClassName: Neos\ContentRepository\Migration\Transformations\AbstractTransformation::class,
- comment: '// TODO 9.0 migration: You need to convert your AbstractTransformation to an implementation of Neos\ContentRepository\NodeMigration\Transformation\TransformationFactoryInterface'
- )
- ]);
-
- $rectorConfig->rule(YamlDimensionConfigRector::class);
- $rectorConfig->rule(YamlRoutePartHandlerRector::class);
-
- /**
- * CLEAN UP / END GLOBAL RULES
- */
- $rectorConfig->ruleWithConfiguration(MethodCallToPropertyFetchRector::class, $methodCallToPropertyFetches);
- $rectorConfig->ruleWithConfiguration(MethodCallToWarningCommentRector::class, $methodCallToWarningComments);
- $rectorConfig->ruleWithConfiguration(FusionNodePropertyPathToWarningCommentRector::class, $fusionNodePropertyPathToWarningComments);
-
- // Remove injections to classes which are gone now
- $rectorConfig->ruleWithConfiguration(RemoveInjectionsRector::class, [
- new RemoveInjection(\Neos\ContentRepository\Domain\Service\ContextFactoryInterface::class),
- new RemoveInjection(\Neos\ContentRepository\Domain\Service\ContextFactory::class),
- new RemoveInjection(\Neos\Neos\Domain\Service\ContentContextFactory::class),
- new RemoveInjection(\Neos\Rector\ContentRepository90\Legacy\LegacyContextStub::class),
- new RemoveInjection(\Neos\ContentRepository\Domain\Service\ContentDimensionCombinator::class),
- new RemoveInjection(\Neos\ContentRepository\Domain\Factory\NodeFactory::class),
- new RemoveInjection(\Neos\ContentRepository\Domain\Repository\WorkspaceRepository::class),
- new RemoveInjection(\Neos\ContentRepository\Core\NodeType\NodeTypeManager::class),
- new RemoveInjection(\Neos\Neos\Domain\Service\NodeSearchServiceInterface::class),
- new RemoveInjection(\Neos\Neos\Domain\Service\NodeSearchService::class),
- new RemoveInjection(\Neos\ContentRepository\Domain\Repository\NodeDataRepository::class),
- new RemoveInjection(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraintFactory::class),
- ]);
-
- // Remove traits which are gone
- $rectorConfig->ruleWithConfiguration(RemoveTraitUseRector::class, [
- \Neos\Neos\Controller\CreateContentContextTrait::class
- ]);
-
- // todo these ToStringToMethodCallOrPropertyFetchRector rules are likely mostly obsolete and only to migrate from one Neos 9 beta to another but NOT for upgrading from 8.3
- // see https://github.com/neos/neos-development-collection/pull/4156
- $rectorConfig->ruleWithConfiguration(ToStringToMethodCallOrPropertyFetchRector::class, [
- \Neos\ContentRepository\Core\Dimension\ContentDimensionId::class => 'value',
- \Neos\ContentRepository\Core\Dimension\ContentDimensionValue::class => 'value',
- \Neos\ContentRepository\Core\Dimension\ContentDimensionValueSpecializationDepth::class => 'value',
- \Neos\ContentRepository\Core\Feature\ContentStreamEventStreamName::class => 'value',
- \Neos\ContentRepository\Core\Infrastructure\Property\PropertyType::class => 'value',
- \Neos\ContentRepository\Core\NodeType\NodeType::class => 'name',
- \Neos\ContentRepository\Core\NodeType\NodeTypeName::class => 'value',
- \Neos\ContentRepository\Core\Projection\ContentGraph\NodePath::class => 'value',
- \Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::class => 'value',
- \Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId::class => 'value',
- \Neos\ContentRepository\Core\SharedModel\Node\NodeName::class => 'value',
- \Neos\ContentRepository\Core\SharedModel\Node\PropertyName::class => 'value',
- \Neos\ContentRepository\Core\SharedModel\Node\ReferenceName::class => 'value',
- \Neos\ContentRepository\Core\SharedModel\User\UserId::class => 'value',
- \Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId::class => 'value',
- \Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceDescription::class => 'value',
- \Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::class => 'value',
- \Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceTitle::class => 'value',
- \Neos\ContentRepository\Core\DimensionSpace\AbstractDimensionSpacePoint::class => 'toJson()',
- \Neos\ContentRepository\Core\DimensionSpace\ContentSubgraphVariationWeight::class => 'toJson()',
- \Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet::class => 'toJson()',
- \Neos\ContentRepository\Core\DimensionSpace\OriginDimensionSpacePointSet::class => 'toJson()',
- \Neos\ContentRepository\Core\Projection\ContentGraph\CoverageByOrigin::class => 'toJson()',
- \Neos\ContentRepository\Core\Projection\ContentGraph\OriginByCoverage::class => 'toJson()',
- \Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateIds::class => 'toJson()',
- ]);
-
- // We can only add one rule per class name. As workaround, we need to alias the RenameClassRector, so we are able to
- // add this rule twice.
- if (!class_exists(\Alias\RenameClassRectorLegacy::class)) {
- class_alias(RenameClassRector::class, \Alias\RenameClassRectorLegacy::class);
- }
- $rectorConfig->ruleWithConfiguration(\Alias\RenameClassRectorLegacy::class, [
- NodeLegacyStub::class => Node::class,
- ]);
-
- // Should run LAST - as other rules above might create $this->contentRepositoryRegistry calls.
- $rectorConfig->ruleWithConfiguration(InjectServiceIfNeededRector::class, [
- new AddInjection('contentRepositoryRegistry', ContentRepositoryRegistry::class),
- new AddInjection('renderingModeService', RenderingModeService::class),
- new AddInjection('nodeLabelGenerator', NodeLabelGeneratorInterface::class),
- new AddInjection('workspacePublishingService', WorkspacePublishingService::class),
- new AddInjection('workspaceService', WorkspaceService::class),
- ]);
- // TODO: does not fully seem to work.$rectorConfig->rule(RemoveDuplicateCommentRector::class);
-};
+);
+
+/**
+ * Neos\ContentRepository\Domain\Service\NodeTypeManager
+ */
+$rectorConfig->withRules([NodeTypeManagerAccessRector::class]);
+// createNodeType(nodeTypeName: string): NodeType
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Service\NodeTypeManager::class, 'createNodeType', '!! NodeTypeManager::createNodeType() was never implemented and is removed in Neos 9.0.');
+// getNodeType(nodeTypeName: string): NodeType
+// --> Compatible with 9.0
+// getNodeTypes([includeAbstractNodeTypes: bool = true]): NodeType[]
+// --> Compatible with 9.0
+// getSubNodeTypes(superTypeName: string, [includeAbstractNodeTypes: bool = true]): NodeType[]
+// --> Compatible with 9.0
+// hasNodeType(nodeTypeName: string): bool
+// --> Compatible with 9.0
+// overrideNodeTypes(completeNodeTypeConfiguration: array): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Service\NodeTypeManager::class, 'overrideNodeTypes', '!! NodeTypeManager::createNodeType() was never meant to be used outside of testing and is removed in Neos 9.0.');
+
+/**
+ * NodeData
+ */
+$nodeDataWarningMessage = '!! NodeData::%2$s is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.';
+// createNodeData(name: string, [nodeType: NodeType|null = null], [identifier: null|string = null], [workspace: Workspace|null = null], [dimensions: array|null = null]): NodeData
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'createNodeData', $nodeDataWarningMessage);
+// createNodeDataFromTemplate(nodeTemplate: NodeTemplate, [nodeName: null|string = null], [workspace: Workspace|null = null], [dimensions: array|null = null]): NodeData
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'createNodeDataFromTemplate', $nodeDataWarningMessage);
+// createShadow(path: string): NodeData
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'createShadow', $nodeDataWarningMessage);
+// createSingleNodeData(name: string, [nodeType: NodeType|null = null], [identifier: null|string = null], [workspace: Workspace|null = null], [dimensions: array|null = null]): NodeData
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'createSingleNodeData', $nodeDataWarningMessage);
+// getContextPath(): string
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getContextPath', $nodeDataWarningMessage);
+// getDepth(): int
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getDepth', $nodeDataWarningMessage);
+// getDimensions(): NodeDimension[]
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getDimensions', $nodeDataWarningMessage);
+// getDimensionsHash(): string
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getDimensionsHash', $nodeDataWarningMessage);
+// getDimensionValues(): array
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getDimensionValues', $nodeDataWarningMessage);
+// getIdentifier(): string
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getIdentifier', $nodeDataWarningMessage);
+// getIndex(): int
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getIndex', $nodeDataWarningMessage);
+// getMovedTo(): NodeData
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getMovedTo', $nodeDataWarningMessage);
+// getName(): string
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getName', $nodeDataWarningMessage);
+// getNumberOfChildNodes(nodeTypeFilter: string, workspace: Workspace, dimensions: array): int
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getNumberOfChildNodes', $nodeDataWarningMessage);
+// getParent(): NodeData|null
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getParent', $nodeDataWarningMessage);
+// getParentPath(): string
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getParentPath', $nodeDataWarningMessage);
+// getPath(): string
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getPath', $nodeDataWarningMessage);
+// getWorkspace(): Workspace
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'getWorkspace', $nodeDataWarningMessage);
+// hasAccessRestrictions(): bool
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'hasAccessRestrictions', $nodeDataWarningMessage);
+// isAccessible(): bool
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'isAccessible', $nodeDataWarningMessage);
+// isInternal(): bool
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'isInternal', $nodeDataWarningMessage);
+// isRemoved(): bool
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'isRemoved', $nodeDataWarningMessage);
+// isVisible(): bool
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'isVisible', $nodeDataWarningMessage);
+// matchesWorkspaceAndDimensions(workspace: Workspace, [dimensions: array|null = null]): bool
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'matchesWorkspaceAndDimensions', $nodeDataWarningMessage);
+// move(targetPath: string, targetWorkspace: Workspace): NodeData|null
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'targetPath', $nodeDataWarningMessage);
+// remove(): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'remove', $nodeDataWarningMessage);
+// setDimensions(dimensionsToBeSet: array): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'setDimensions', $nodeDataWarningMessage);
+// setIdentifier(identifier: string): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'setIdentifier', $nodeDataWarningMessage);
+// setIndex(index: int): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'setIndex', $nodeDataWarningMessage);
+// setMovedTo([nodeData: NodeData|null = null]): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'setMovedTo', $nodeDataWarningMessage);
+// setPath(path: string, [recursive: bool = true]): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'setPath', $nodeDataWarningMessage);
+// setRemoved(removed: bool): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'setRemoved', $nodeDataWarningMessage);
+// setWorkspace([workspace: Workspace|null = null]): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'setWorkspace', $nodeDataWarningMessage);
+// similarize(sourceNode: AbstractNodeData, [isCopy: bool = false]): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'similarize', $nodeDataWarningMessage);
+
+/**
+ * \Neos\ContentRepository\Domain\NodeType\NodeTypeConstraintFactory
+ */
+// parseFilterStrnig(serializedFilters: string): NodeTypeConstraints
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraintFactory::class, 'parseFilterString', '!! The "NodeTypeConstraintFactory" has been removed in Neos 9. Please use the proper filter in subgraph finders e.g. "FindChildNodesFilter" for ContentSubgraphInterface::findChildNodes().');
+
+/**
+ * \Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints
+ */
+$nodeTypeConstraintsWarning = '!! NodeTypeConstraints has been removed in Neos 9. Please use the proper filter in subgraph finders e.g. "FindChildNodesFilter" for ContentSubgraphInterface::findChildNodes().';
+// asLegacyNodeTypeFilterString(): string
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints::class, 'asLegacyNodeTypeFilterString', $nodeTypeConstraintsWarning);
+// getExplicitlyAllowedNodeTypeNames(): NodeTypeName[]
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints::class, 'getExplicitlyAllowedNodeTypeNames', $nodeTypeConstraintsWarning);
+// getExplicitlyDisallowedNodeTypeNames(): NodeTypeName[]
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints::class, 'getExplicitlyDisallowedNodeTypeNames', $nodeTypeConstraintsWarning);
+// isWildcardAllowed(): bool
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints::class, 'isWildcardAllowed', $nodeTypeConstraintsWarning);
+// matches(nodeTypeName: NodeTypeName): bool
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints::class, 'nodeTypeName', $nodeTypeConstraintsWarning);
+// withExplicitlyDisallowedNodeType(nodeTypeName: NodeTypeName): NodeTypeConstraints
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraints::class, 'withExplicitlyDisallowedNodeType', $nodeTypeConstraintsWarning);
+
+/**
+ * Signals and Slots
+ * https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots
+ */
+$signalsAndSlotsToComment = [];
+// Neos\ContentRepository\Domain\Service\PublishingService
+// - nodePublished
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Service\PublishingService::class, 'nodePublished', 'The signal "nodePublished" on "PublishingService" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - nodeDiscarded
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Service\PublishingService::class, 'nodeDiscarded', 'The signal "nodeDiscarded" on "PublishingService" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// Neos\Neos\Service\PublishingService
+// - nodePublished
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\Neos\Service\PublishingService::class, 'nodePublished', 'The signal "nodePublished" on "PublishingService" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - nodeDiscarded
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\Neos\Service\PublishingService::class, 'nodeDiscarded', 'The signal "nodeDiscarded" on "PublishingService" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// Neos\ContentRepository\Domain\Service\Context
+// - beforeAdoptNode
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Service\Context::class, 'beforeAdoptNode', 'The signal "beforeAdoptNode" on "Context" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - afterAdoptNode
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Service\Context::class, 'afterAdoptNode', 'The signal "afterAdoptNode" on "Context" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// Neos\ContentRepository\Domain\Repository\NodeDataRepository
+// - repositoryObjectsPersisted
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Repository\NodeDataRepository::class, 'repositoryObjectsPersisted', 'The signal "repositoryObjectsPersisted" on "NodeDataRepository" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// Neos\ContentRepository\Domain\Model\Workspace
+// - baseWorkspaceChanged
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'baseWorkspaceChanged', 'The signal "baseWorkspaceChanged" on "Workspace" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - beforeNodePublishing
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'beforeNodePublishing', 'The signal "beforeNodePublishing" on "Workspace" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - afterNodePublishing
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'afterNodePublishing', 'The signal "afterNodePublishing" on "Workspace" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// Neos\ContentRepository\Domain\Model\NodeData
+// - nodePathChanged
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\NodeData::class, 'nodePathChanged', 'The signal "nodePathChanged" on "NodeData" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// Neos\ContentRepository\Domain\Model\Node
+// - beforeNodeMove
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'beforeNodeMove', 'The signal "beforeNodeMove" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - afterNodeMove
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'afterNodeMove', 'The signal "afterNodeMove" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - beforeNodeCopy
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'beforeNodeCopy', 'The signal "beforeNodeCopy" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - afterNodeCopy
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'afterNodeCopy', 'The signal "afterNodeCopy" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - nodePathChanged
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'nodePathChanged', 'The signal "nodePathChanged" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - beforeNodeCreate
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'beforeNodeCreate', 'The signal "beforeNodeCreate" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - afterNodeCreate
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'afterNodeCreate', 'The signal "afterNodeCreate" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - nodeAdded
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'nodeAdded', 'The signal "nodeAdded" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - nodeUpdated
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'nodeUpdated', 'The signal "nodeUpdated" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - nodeRemoved
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'nodeRemoved', 'The signal "nodeRemoved" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - beforeNodePropertyChange
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'beforeNodePropertyChange', 'The signal "beforeNodePropertyChange" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+// - nodePropertyChanged
+$signalsAndSlotsToComment[] = new SignalSlotToWarningComment(\Neos\ContentRepository\Domain\Model\Node::class, 'nodePropertyChanged', 'The signal "nodePropertyChanged" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.');
+
+$rectorConfig->withConfiguredRule(SignalSlotToWarningCommentRector::class, $signalsAndSlotsToComment);
+
+
+$rectorConfig->withRules([ContentRepositoryUtilityRenderValidNodeNameRector::class]);
+
+/**
+ * \Neos\ContentRepository\Domain\Model\Workspace
+ */
+// getBaseWorkspace(): Workspace|null
+$rectorConfig->withRules([WorkspaceGetBaseWorkspaceRector::class]);
+// getBaseWorkspaces(): Workspace[]
+$rectorConfig->withRules([WorkspaceGetBaseWorkspacesRector::class]);
+// getDescription(): null|string
+$rectorConfig->withRules([WorkspaceGetDescriptionRector::class]);
+// getName(): string
+// ->name
+// getNodeCount(): int
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'getNodeCount', '!! Workspace::getNodeCount() has been removed in Neos 9.0 without a replacement.');
+// getOwner(): UserInterface|null
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'getOwner', '!! Workspace::getOwner() has been removed in Neos 9.0. Use WorkspaceService::getWorkspaceMetadata()->ownerUserId to get the userId of the owner.');
+// getRootNodeData(): NodeData
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'getRootNodeData', '!! Workspace::getRootNodeData() has been removed in Neos 9.0 without a replacement.');
+// getTitle(): string
+$rectorConfig->withRules([WorkspaceGetTitleRector::class]);
+// meta->setWorkspaceTitle
+// isInternalWorkspace(): bool
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'isInternalWorkspace', '!! Workspace::isInternalWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()');
+// isPersonalWorkspace(): bool
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'isPersonalWorkspace', '!! Workspace::isPersonalWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()');
+// isPrivateWorkspace(): bool
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'isPrivateWorkspace', '!! Workspace::isPrivateWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()');
+// isPublicWorkspace(): bool
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'isPublicWorkspace', '!! Workspace::isPublicWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()');
+// publish(targetWorkspace: Workspace): void
+$rectorConfig->withRules([WorkspacePublishRector::class]);
+// publishNode(nodeToPublish: NodeInterface, targetWorkspace: Workspace): void
+$rectorConfig->withRules([WorkspacePublishNodeRector::class]);
+// publishNodes(nodes: NodeInterface[], targetWorkspace: Workspace): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'publishNodes', '!! Workspace::publishNodes() has been removed in Neos 9.0. Use the \Neos\Neos\Domain\Service\WorkspacePublishingService to publish a workspace or changes in a document.');
+// setBaseWorkspace(baseWorkspace: Workspace): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'setBaseWorkspace', '!! Workspace::setBaseWorkspace() is not supported by the new CR. Use the "ChangeBaseWorkspace" command to change the baseWorkspace of a workspace.');
+// setDescription(description: string): void
+$rectorConfig->withRules([WorkspaceSetDescriptionRector::class]);
+// setOwner(user: UserInterface|null|string): void
+$methodCallToWarningComments[] = new MethodCallToWarningComment(\Neos\ContentRepository\Domain\Model\Workspace::class, 'setOwner', '!! Workspace::setOwner() has been removed in Neos 9.0. You can set the owner of a workspace during creation WorkspaceService::createPersonalWorkspace().');
+// setTitle(title: string): void
+$rectorConfig->withRules([WorkspaceSetTitleRector::class]);
+
+$rectorConfig->withConfiguredRule(RenameClassRector::class, [
+ \Neos\ContentRepository\Domain\Model\Node::class => Node::class,
+ \Neos\ContentRepository\Domain\Model\NodeInterface::class => Node::class,
+ \Neos\ContentRepository\Domain\Projection\Content\NodeInterface::class => Node::class,
+ \Neos\ContentRepository\Domain\Projection\Content\TraversableNodeInterface::class => Node::class,
+
+ \Neos\ContentRepository\Domain\Projection\Content\TraversableNodes::class => \Neos\ContentRepository\Core\Projection\ContentGraph\Nodes::class,
+
+ \Neos\ContentRepository\Domain\Service\Context::class => LegacyContextStub::class,
+ \Neos\Neos\Domain\Service\ContentContext::class => LegacyContextStub::class,
+
+ \Neos\ContentRepository\Domain\Model\NodeType::class => \Neos\ContentRepository\Core\NodeType\NodeType::class,
+ \Neos\ContentRepository\Domain\Service\NodeTypeManager::class => \Neos\ContentRepository\Core\NodeType\NodeTypeManager::class,
+
+ \Neos\ContentRepository\Domain\Model\Workspace::class => \Neos\ContentRepository\Core\SharedModel\Workspace\Workspace::class,
+ \Neos\ContentRepository\Domain\NodeAggregate\NodeAggregateIdentifier::class => \Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId::class,
+ \Neos\ContentRepository\Domain\NodeAggregate\NodeName::class => \Neos\ContentRepository\Core\SharedModel\Node\NodeName::class,
+ \Neos\ContentRepository\Domain\NodeType\NodeTypeName::class => \Neos\ContentRepository\Core\NodeType\NodeTypeName::class,
+ \Neos\ContentRepository\Domain\Projection\Content\PropertyCollectionInterface::class => \Neos\ContentRepository\Core\Projection\ContentGraph\PropertyCollection::class,
+ \Neos\ContentRepository\Domain\Model\ArrayPropertyCollection::class => \Neos\ContentRepository\Core\Projection\ContentGraph\PropertyCollection::class,
+ \Neos\Neos\Routing\FrontendNodeRoutePartHandlerInterface::class => \Neos\Neos\FrontendRouting\FrontendNodeRoutePartHandlerInterface::class,
+]);
+
+/**
+ * SPECIAL rules
+ */
+$rectorConfig->withConfiguredRule(\Neos\Rector\Generic\Rules\RemoveParentClassRector::class, [
+ new RemoveParentClass(
+ parentClassName: Neos\ContentRepository\Migration\Transformations\AbstractTransformation::class,
+ comment: '// TODO 9.0 migration: You need to convert your AbstractTransformation to an implementation of Neos\ContentRepository\NodeMigration\Transformation\TransformationFactoryInterface'
+ )
+]);
+
+/**
+ * CLEAN UP / END GLOBAL RULES
+ */
+$rectorConfig->withConfiguredRule(MethodCallToPropertyFetchRector::class, $methodCallToPropertyFetches);
+$rectorConfig->withConfiguredRule(MethodCallToWarningCommentRector::class, $methodCallToWarningComments);
+
+// Remove injections to classes which are gone now
+$rectorConfig->withConfiguredRule(RemoveInjectionsRector::class, [
+ new RemoveInjection(\Neos\ContentRepository\Domain\Service\ContextFactoryInterface::class),
+ new RemoveInjection(\Neos\ContentRepository\Domain\Service\ContextFactory::class),
+ new RemoveInjection(\Neos\Neos\Domain\Service\ContentContextFactory::class),
+ new RemoveInjection(\Neos\Rector\ContentRepository90\Legacy\LegacyContextStub::class),
+ new RemoveInjection(\Neos\ContentRepository\Domain\Service\ContentDimensionCombinator::class),
+ new RemoveInjection(\Neos\ContentRepository\Domain\Factory\NodeFactory::class),
+ new RemoveInjection(\Neos\ContentRepository\Domain\Repository\WorkspaceRepository::class),
+ new RemoveInjection(\Neos\ContentRepository\Core\NodeType\NodeTypeManager::class),
+ new RemoveInjection(\Neos\Neos\Domain\Service\NodeSearchServiceInterface::class),
+ new RemoveInjection(\Neos\Neos\Domain\Service\NodeSearchService::class),
+ new RemoveInjection(\Neos\ContentRepository\Domain\Repository\NodeDataRepository::class),
+ new RemoveInjection(\Neos\ContentRepository\Domain\NodeType\NodeTypeConstraintFactory::class),
+]);
+
+// Remove traits which are gone
+$rectorConfig->withConfiguredRule(RemoveTraitUseRector::class, [
+ \Neos\Neos\Controller\CreateContentContextTrait::class
+]);
+
+// todo these ToStringToMethodCallOrPropertyFetchRector rules are likely mostly obsolete and only to migrate from one Neos 9 beta to another but NOT for upgrading from 8.3
+// see https://github.com/neos/neos-development-collection/pull/4156
+$rectorConfig->withConfiguredRule(ToStringToMethodCallOrPropertyFetchRector::class, [
+ \Neos\ContentRepository\Core\Dimension\ContentDimensionId::class => 'value',
+ \Neos\ContentRepository\Core\Dimension\ContentDimensionValue::class => 'value',
+ \Neos\ContentRepository\Core\Dimension\ContentDimensionValueSpecializationDepth::class => 'value',
+ \Neos\ContentRepository\Core\Feature\ContentStreamEventStreamName::class => 'value',
+ \Neos\ContentRepository\Core\Infrastructure\Property\PropertyType::class => 'value',
+ \Neos\ContentRepository\Core\NodeType\NodeType::class => 'name',
+ \Neos\ContentRepository\Core\NodeType\NodeTypeName::class => 'value',
+ \Neos\ContentRepository\Core\Projection\ContentGraph\NodePath::class => 'value',
+ \Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::class => 'value',
+ \Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId::class => 'value',
+ \Neos\ContentRepository\Core\SharedModel\Node\NodeName::class => 'value',
+ \Neos\ContentRepository\Core\SharedModel\Node\PropertyName::class => 'value',
+ \Neos\ContentRepository\Core\SharedModel\Node\ReferenceName::class => 'value',
+ \Neos\ContentRepository\Core\SharedModel\User\UserId::class => 'value',
+ \Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId::class => 'value',
+ \Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceDescription::class => 'value',
+ \Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::class => 'value',
+ \Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceTitle::class => 'value',
+ \Neos\ContentRepository\Core\DimensionSpace\AbstractDimensionSpacePoint::class => 'toJson()',
+ \Neos\ContentRepository\Core\DimensionSpace\ContentSubgraphVariationWeight::class => 'toJson()',
+ \Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet::class => 'toJson()',
+ \Neos\ContentRepository\Core\DimensionSpace\OriginDimensionSpacePointSet::class => 'toJson()',
+ \Neos\ContentRepository\Core\Projection\ContentGraph\CoverageByOrigin::class => 'toJson()',
+ \Neos\ContentRepository\Core\Projection\ContentGraph\OriginByCoverage::class => 'toJson()',
+ \Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateIds::class => 'toJson()',
+]);
+
+// Should run LAST - as other rules above might create $this->contentRepositoryRegistry calls.
+$rectorConfig->withConfiguredRule(InjectServiceIfNeededRector::class, [
+ new AddInjection('contentRepositoryRegistry', ContentRepositoryRegistry::class),
+ new AddInjection('renderingModeService', RenderingModeService::class),
+ new AddInjection('nodeLabelGenerator', NodeLabelGeneratorInterface::class),
+ new AddInjection('workspacePublishingService', WorkspacePublishingService::class),
+ new AddInjection('workspaceService', WorkspaceService::class),
+]);
+
+
+return $rectorConfig;
\ No newline at end of file
diff --git a/config/set/neos-84.php b/config/set/neos-84.php
deleted file mode 100644
index de8c01e..0000000
--- a/config/set/neos-84.php
+++ /dev/null
@@ -1,50 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(\Neos\Rector\Core\FusionProcessing\FusionFileProcessor::class);
- $services->set(\Neos\Rector\Core\YamlProcessing\YamlFileProcessor::class);
- $rectorConfig->disableParallel(); // parallel does not work for non-PHP-Files, so we need to disable it - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- /** @var MethodCallToPropertyFetch[] $methodCallToPropertyFetches */
- $methodCallToPropertyFetches = [];
-
- /** @var MethodCallToWarningComment[] $methodCallToWarningComments */
- $methodCallToWarningComments = [];
-
-
- $fusionFlowQueryPropertyToComments = [];
- $fusionNodePropertyPathToWarningComments = [];
-
-
- /**
- * Put your rules below here
- */
-
-
-
-
-
- /**
- * CLEAN UP / END GLOBAL RULES
- */
- $rectorConfig->ruleWithConfiguration(FusionNodePropertyPathToWarningCommentRector::class, $fusionFlowQueryPropertyToComments);
- $rectorConfig->ruleWithConfiguration(MethodCallToPropertyFetchRector::class, $methodCallToPropertyFetches);
- $rectorConfig->ruleWithConfiguration(MethodCallToWarningCommentRector::class, $methodCallToWarningComments);
- $rectorConfig->ruleWithConfiguration(FusionNodePropertyPathToWarningCommentRector::class, $fusionNodePropertyPathToWarningComments);
-
-};
diff --git a/docs/rules_overview.md b/docs/rules_overview.md
index 84c3d15..2a6c007 100644
--- a/docs/rules_overview.md
+++ b/docs/rules_overview.md
@@ -1,4 +1,4 @@
-# 66 Rules Overview
+# 53 Rules Overview
## ContentDimensionCombinatorGetAllAllowedCombinationsRector
@@ -149,11 +149,12 @@ Replaces Utility::renderValidNodeName(...) into NodeName::fromString(...)->value
public function run(\Neos\Rector\ContentRepository90\Legacy\LegacyContextStub $context)
{
- return $context->getRootNode();
++
+ // TODO 9.0 migration: !! MEGA DIRTY CODE! Ensure to rewrite this; by getting rid of LegacyContextStub.
+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
-+ $workspace = $contentRepository->getWorkspaceFinder()->findOneByName(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($context->workspaceName ?? 'live'));
-+ $rootNodeAggregate = $contentRepository->getContentGraph()->findRootNodeAggregateByType($workspace->currentContentStreamId, \Neos\ContentRepository\Core\NodeType\NodeTypeName::fromString('Neos.Neos:Sites'));
-+ $subgraph = $contentRepository->getContentGraph()->getSubgraph($workspace->currentContentStreamId, \Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint::fromLegacyDimensionArray($context->dimensions ?? []), $context->invisibleContentShown ? \Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints::withoutRestrictions() : \Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints::frontend());
++ $workspace = $contentRepository->findWorkspaceByName(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($context->workspaceName ?? 'live'));
++ $rootNodeAggregate = $contentRepository->getContentGraph($workspace->workspaceName)->findRootNodeAggregateByType(\Neos\ContentRepository\Core\NodeType\NodeTypeName::fromString('Neos.Neos:Sites'));
++ $subgraph = $contentRepository->getContentGraph($workspace->workspaceName)->getSubgraph(\Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint::fromLegacyDimensionArray($context->dimensions ?? []), $context->invisibleContentShown ? \Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints::withoutRestrictions() : \Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints::default());
+ return $subgraph->findNodeById($rootNodeAggregate->nodeAggregateId);
}
}
@@ -221,1003 +222,54 @@ Replaces Utility::renderValidNodeName(...) into NodeName::fromString(...)->value
-## FusionCachingNodeInEntryIdentifierRector
-
-Fusion: Rewrite node to Neos.Caching.entryIdentifierForNode(...) in @cache.entryIdentifier segments
-
-- class: [`Neos\Rector\ContentRepository90\Rules\FusionCachingNodeInEntryIdentifierRector`](../src/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector.php)
-
-```diff
- prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
- @cache {
- entryIdentifier {
-- foo = ${node}
-+ foo = ${Neos.Caching.entryIdentifierForNode(node)}
- }
- }
-- @cache.entryIdentifier.foo2 = ${documentNode}
-+ @cache.entryIdentifier.foo2 = ${Neos.Caching.entryIdentifierForNode(documentNode)}
- @cache {
-- entryIdentifier.foo3 = ${site}
-+ entryIdentifier.foo3 = ${Neos.Caching.entryIdentifierForNode(site)}
- entryIdentifier.foo4 = ${someOtherObject}
- }
- }
- }
-```
-
-
-
-## 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.currentSite to Neos.Site.findBySiteNode(site)
-
-- class: [`Neos\Rector\ContentRepository90\Rules\FusionContextCurrentSiteRector`](../src/ContentRepository90/Rules/FusionContextCurrentSiteRector.php)
-
-```diff
- prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
- renderer = Neos.Fusion:Component {
-- attributes = ${node.context.currentSite.siteResourcesPackageKey || site.context.currentSite.siteResourcesPackageKey || documentNode.context.currentSite.siteResourcesPackageKey}
-+ attributes = ${Neos.Site.findBySiteNode(site).siteResourcesPackageKey || Neos.Site.findBySiteNode(site).siteResourcesPackageKey || Neos.Site.findBySiteNode(site).siteResourcesPackageKey}
- renderer = afx`
-
- `
- }
- }
-```
-
-
-
-## FusionContextInBackendRector
-
-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 "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 {
-
- #
- # pass down props
- #
-- attributes = ${node.context.inBackend || site.context.inBackend || documentNode.context.inBackend}
-+ attributes = ${renderingMode.isEdit || renderingMode.isEdit || renderingMode.isEdit}
-
- #
- # 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`
-
- `
- }
- }
-```
-
-
-
-## FusionContextLiveRector
-
-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 "!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 {
-
- #
- # pass down props
- #
-- attributes = ${node.context.live || site.context.live || documentNode.context.live}
-+ attributes = ${!renderingMode.isEdit || !renderingMode.isEdit || !renderingMode.isEdit}
-
- #
- # 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`
-
- `
- }
- }
-```
-
-
-
-## FusionFlowQueryNodePropertyToWarningCommentRector
+## InjectServiceIfNeededRector
-Fusion: Adds a warning comment when the defined property is used within an FlowQuery `"property()".`
+add injection for `$contentRepositoryRegistry` if in use.
: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.aggregateId
-
-- 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.aggregateId. 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.nodeAggregateIdentifier || documentNode.nodeAggregateIdentifier}
-+ attributes = ${node.aggregateId || documentNode.aggregateId}
- renderer = afx`
-
- `
- }
- }
-```
-
-
-
-## FusionNodeAutoCreatedRector
-
-Fusion: Rewrite node.autoCreated to node.classification.tethered
-
-- class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeAutoCreatedRector`](../src/ContentRepository90/Rules/FusionNodeAutoCreatedRector.php)
+- class: [`Neos\Rector\Generic\Rules\InjectServiceIfNeededRector`](../src/Generic/Rules/InjectServiceIfNeededRector.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)
+ -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`
-
- `
+ class SomeClass
+ {
++ #[\Neos\Flow\Annotations\Inject]
++ protected \Neos\ContentRepositoryRegistry\ContentRepositoryRegistry $contentRepositoryRegistry;
++ #[\Neos\Flow\Annotations\Inject]
++ protected \Neos\Neos\Domain\Service\RenderingModeService $renderingModeService;
+ public function run(Node $node)
+ {
+ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
+ $currentRenderingMode = $this->renderingModeService->findByCurrentUser();
}
}
-```
-
-
-
-## FusionNodeDepthRector
-
-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 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 {
-
- #
- # pass down props
- #
-- 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`
- #
- 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`
-
- `
- }
- }
-```
-
-
-
-## 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 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.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 {
-
- #
- # pass down props
- #
-- 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`
- #
- 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`
-
- `
- }
- }
-```
-
-
-
-## 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" and "q(node).property('_identifier')" to "node.aggregateId"
-
-- class: [`Neos\Rector\ContentRepository90\Rules\FusionNodeIdentifierRector`](../src/ContentRepository90/Rules/FusionNodeIdentifierRector.php)
-
-```diff
- prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
-- attributes = ${q(node).property("_identifier") || q(documentNode).property("_identifier")}
-+ attributes = ${node.aggregateId || documentNode.aggregateId}
- renderer = afx`
-
- `
- }
- }
-```
-
-
-
-## FusionNodeLabelRector
-
-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)
-
-```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 = ${Neos.Node.label(node) || Neos.Node.label(documentNode) || Neos.Node.label(site)}
-+ otherVariable = ${Neos.Node.label(someOtherVariable)}
-+ inAfx = afx``
- }
-```
-
-
-
-## FusionNodeNodeTypeRector
-
-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)
-
-```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.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``
- }
-```
-
-
-
-## FusionNodeParentRector
-
-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 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 {
-
- #
- # pass down props
- #
-- attributes = ${node.parent || documentNode.parent}
-+ attributes = ${q(node).parent().get(0) || q(documentNode).parent().get(0)}
-
- renderer = afx`
-
- `
- }
- }
-```
-
-
-
-## FusionNodePathRector
-
-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 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 {
-
- #
- # pass down props
- #
-- 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`
- #
- 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`
-
- `
- }
- }
-```
-
-
-
-## FusionNodePropertyPathToWarningCommentRector
-
-Fusion: Adds a warning comment when the defined path is used within an Eel expression.
-
-:wrench: **configure it!**
-
-- class: [`Neos\Rector\Generic\Rules\FusionNodePropertyPathToWarningCommentRector`](../src/Generic/Rules/FusionNodePropertyPathToWarningCommentRector.php)
-
-```php
-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.'),
- ],
- ],
- ]);
-};
-```
-
-↓
-
-```diff
-+// TODO 9.0 migration: Line 20: !! node.removed - the new CR *never* returns removed nodes; so you can simplify your code and just assume removed == FALSE in all scenarios.
-+// TODO 9.0 migration: Line 21: !! node.removed - the new CR *never* returns removed nodes; so you can simplify your code and just assume removed == FALSE in all scenarios.
-+// TODO 9.0 migration: Line 42: !! node.removed - the new CR *never* returns removed nodes; so you can simplify your code and just assume removed == FALSE in all scenarios.
-+// TODO 9.0 migration: Line 54: !! node.removed - the new CR *never* returns removed nodes; so you can simplify your code and just assume removed == FALSE in all scenarios.
-+// TODO 9.0 migration: Line 20: !! 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.
-+// TODO 9.0 migration: Line 21: !! 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.
-+// TODO 9.0 migration: Line 46: !! 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.
-+// TODO 9.0 migration: Line 48: !! 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.
-+// TODO 9.0 migration: Line 22: !! 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.
-+// TODO 9.0 migration: Line 40: !! 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.
-+// TODO 9.0 migration: Line 52: !! 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.
-+// TODO 9.0 migration: Line 23: !! node.foo.bar is not supported anymore.
- prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${node.removed || site.removed || documentNode.hiddenBeforeDateTime}
- attributes2 = ${node.hiddenBeforeDateTime || site.hiddenBeforeDateTime || documentNode.removed}
- attributes3 = ${node.hiddenAfterDateTime || site.hiddenAfterDateTime || documentNode.hiddenAfterDateTime}
- attributes4 = ${node.foo.bar}
- attributes5 = ${node.fooXbar}
-
- #
- # 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`
-
-
-
- `
- }
- }
-```
-
-
-
-## FusionNodeTypeNameRector
-
-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". 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 || documentNode.nodeTypeName}
- 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
+## MethodCallToPropertyFetchRector
-add injection for `$contentRepositoryRegistry` if in use.
+Turn method call `$this->getFirstname()` to property fetch `$this->firstname`
: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'),
- ],
- ],
- ]);
-};
-```
-
-↓
+- class: [`Neos\Rector\Generic\Rules\MethodCallToPropertyFetchRector`](../src/Generic/Rules/MethodCallToPropertyFetchRector.php)
```diff
- contentRepositoryRegistry->subgraphForNode($node);
- $currentRenderingMode = $this->renderingModeService->findByCurrentUser();
+- $this->getFirstname();
++ $this->firstname;
}
}
-
- ?>
```
@@ -1230,40 +282,18 @@ return static function (RectorConfig $rectorConfig): void {
- class: [`Neos\Rector\Generic\Rules\MethodCallToWarningCommentRector`](../src/Generic/Rules/MethodCallToWarningCommentRector.php)
-```php
-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.'),
- ],
- ],
- ]);
-};
-```
-
-↓
-
```diff
getNode();
+ // TODO 9.0 migration: !! 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.
-+
return $node->getWorkspace();
}
}
@@ -1294,6 +324,8 @@ return static function (RectorConfig $rectorConfig): void {
public function run()
{
- $this->nodeFactory->reset();
+- return $this->nodeFactory->reset();
++ return;
}
}
@@ -1311,11 +343,11 @@ return static function (RectorConfig $rectorConfig): void {
```diff
findParentNode();
+ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
@@ -1337,16 +369,15 @@ return static function (RectorConfig $rectorConfig): void {
```diff
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->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter::create(pagination: ['limit' => 10, 'offset' => 100]))) as $node) {
}
}
@@ -1366,15 +397,14 @@ return static function (RectorConfig $rectorConfig): void {
```diff
getContext()->getWorkspaceName();
-+ $contentRepository = $this->contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryId);
-+ return $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId($node->subgraphIdentity->contentStreamId)->workspaceName;
++ return $node->workspaceName;
}
}
@@ -1392,15 +422,29 @@ return static function (RectorConfig $rectorConfig): void {
```diff
node;
+ }
+
+ public function run(Node $node)
{
+- $workspace = $this->getNode()->getContext()->getWorkspace();
++ $contentRepository = $this->contentRepositoryRegistry->get($this->getNode()->contentRepositoryId);
++ $workspace = $contentRepository->findWorkspaceByName($this->getNode()->workspaceName);
++ $contentRepository = $this->contentRepositoryRegistry->get($this->node->contentRepositoryId);
+
+- $workspace = $this->node->getContext()->getWorkspace();
++ $workspace = $contentRepository->findWorkspaceByName($this->node->workspaceName);
++ $contentRepository = $this->contentRepositoryRegistry->get($node->contentRepositoryId);
+
- return $node->getContext()->getWorkspace();
-+ $contentRepository = $this->contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryId);
-+ return $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId($node->subgraphIdentity->contentStreamId);
++ return $contentRepository->findWorkspaceByName($node->workspaceName);
}
}
@@ -1418,11 +462,11 @@ return static function (RectorConfig $rectorConfig): void {
```diff
getContextPath();
+ return \Neos\ContentRepository\Core\SharedModel\Node\NodeAddress::fromNode($node)->toJson();
@@ -1443,11 +487,11 @@ return static function (RectorConfig $rectorConfig): void {
```diff
getDepth();
+ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
@@ -1469,15 +513,22 @@ return static function (RectorConfig $rectorConfig): void {
```diff
getDimensions()[0];
++ // TODO 9.0 migration: Try to remove the toLegacyDimensionArray() call and make your codebase more typesafe.
++ $dimension = $node->originDimensionSpacePoint->toLegacyDimensionArray()[0];
+
+- $dimensions = MyFoo::do($node->getDimensions());
++ // TODO 9.0 migration: Try to remove the toLegacyDimensionArray() call and make your codebase more typesafe.
++ $dimensions = MyFoo::do($node->originDimensionSpacePoint->toLegacyDimensionArray());
+
- return $node->getDimensions();
+ // TODO 9.0 migration: Try to remove the toLegacyDimensionArray() call and make your codebase more typesafe.
-+
+ return $node->originDimensionSpacePoint->toLegacyDimensionArray();
}
}
@@ -1496,33 +547,29 @@ return static function (RectorConfig $rectorConfig): void {
```diff
getHiddenBeforeDateTime();
+ // TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details.
-
+ $dateTime = $node->getProperty('enableAfterDateTime');
+
+ // TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details.
+ // Use the "SetNodeProperties" command to change property values for "enableAfterDateTime" or "disableAfterDateTime".
-+
-+
$node->setHiddenBeforeDateTime($dateTime);
}
- public function nodeHiddenAfterDateTime(NodeLegacyStub $node)
+ public function nodeHiddenAfterDateTime(Node $node)
{
- $dateTime = $node->getHiddenAfterDateTime();
+ // TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details.
-+
+ $dateTime = $node->getProperty('disableAfterDateTime');
+
+ // TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details.
+ // Use the "SetNodeProperties" command to change property values for "enableAfterDateTime" or "disableAfterDateTime".
-+
-
$node->setHiddenAfterDateTime($dateTime);
}
}
@@ -1541,15 +588,14 @@ return static function (RectorConfig $rectorConfig): void {
```diff
getIdentifier();
+ // TODO 9.0 migration: Check if you could change your code to work with the NodeAggregateId value object instead.
-+
+ $nodeIdentifier = $node->aggregateId->value;
}
}
@@ -1568,11 +614,11 @@ return static function (RectorConfig $rectorConfig): void {
```diff
getNodeType();
$nodeTypeName = $nodeType->getName();
@@ -1596,11 +642,11 @@ return static function (RectorConfig $rectorConfig): void {
```diff
getNodeType();
+ $contentRepository = $this->contentRepositoryRegistry->get($node->contentRepositoryId);
@@ -1622,11 +668,11 @@ return static function (RectorConfig $rectorConfig): void {
```diff
getParent();
+ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
@@ -1648,18 +694,45 @@ return static function (RectorConfig $rectorConfig): void {
```diff
getPath();
++ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
++ // TODO 9.0 migration: Try to remove the (string) cast and make your code more type-safe.
++ $path = (string) $subgraph->findNodePath($node->aggregateId);
+ }
+
+ public function getPathByGetNode()
+ {
+- $path = $this->getNode()->getPath();
++ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($this->getNode());
++ // TODO 9.0 migration: Try to remove the (string) cast and make your code more type-safe.
++ $path = (string) $subgraph->findNodePath($this->getNode()->aggregateId);
+ }
+
+ public function getPath(Node $node)
{
- return $node->getPath();
+ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
+ // TODO 9.0 migration: Try to remove the (string) cast and make your code more type-safe.
-+
+ return (string) $subgraph->findNodePath($node->aggregateId);
}
+
+ public function getPathAsParameter(Node $node)
+ {
+- $path = MyFoo::do($node->getPath());
++ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
++ // TODO 9.0 migration: Try to remove the (string) cast and make your code more type-safe.
++ $path = MyFoo::do((string) $subgraph->findNodePath($node->aggregateId));
+ }
}
?>
@@ -1676,11 +749,11 @@ return static function (RectorConfig $rectorConfig): void {
```diff
getPropertyNames();
+ $propertyNames = array_keys(iterator_to_array($node->properties));
@@ -1701,11 +774,11 @@ return static function (RectorConfig $rectorConfig): void {
```diff
isAutoCreated();
+ $bool = $node->classification->isTethered();
@@ -1726,11 +799,11 @@ return static function (RectorConfig $rectorConfig): void {
```diff
isHiddenInIndex();
+ return $node->getProperty('hiddenInMenu');
@@ -1751,11 +824,11 @@ return static function (RectorConfig $rectorConfig): void {
```diff
isHidden();
+ return $node->tags->contain(\Neos\Neos\Domain\SubtreeTagging\NeosSubtreeTag::disabled());
@@ -1776,13 +849,13 @@ return static function (RectorConfig $rectorConfig): void {
```diff
getLabel();
+ $label = $this->nodeLabelGenerator->getLabel($node);
@@ -1811,25 +884,27 @@ return static function (RectorConfig $rectorConfig): void {
class SomeClass extends AnotherClass
{
/**
- * @var \Neos\Neos\Domain\Service\NodeSearchService
+ * @var \Neos\Neos\Domain\Service\NodeSearchServiceInterface
*/
- private $nodeSearchService;
+ private $nodeSearchServiceInterface;
- public function startingPointNodeIsGiven(Node $node, Context $context)
+ public function startingPointNodeIsGiven(Node $startingNode, Context $context)
{
$term = "term";
$searchNodeTypes = [];
-- $nodes = $this->nodeSearchService->findByProperties($term, $searchNodeTypes, $context, $node);
+- $nodes = $this->nodeSearchServiceInterface->findByProperties($term, $searchNodeTypes, $context, $startingNode);
++
+ // TODO 9.0 migration: This could be a suitable replacement. Please check if all your requirements are still fulfilled.
-+ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
-+ $nodes = $subgraph->findDescendantNodes($node->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindDescendantNodesFilter::create(nodeTypes: \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\NodeType\NodeTypeCriteria::create(\Neos\ContentRepository\Core\NodeType\NodeTypeNames::fromStringArray($searchNodeTypes), \Neos\ContentRepository\Core\NodeType\NodeTypeNames::createEmpty()), searchTerm: $term));
++ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($startingNode);
++ $nodes = $subgraph->findDescendantNodes($startingNode->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindDescendantNodesFilter::create(nodeTypes: \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\NodeType\NodeTypeCriteria::create(\Neos\ContentRepository\Core\NodeType\NodeTypeNames::fromStringArray($searchNodeTypes), \Neos\ContentRepository\Core\NodeType\NodeTypeNames::createEmpty()), searchTerm: $term));
}
public function startingPointNodeIsNotGiven(Context $context)
{
$term = "term";
$searchNodeTypes = [];
-- $nodes = $this->nodeSearchService->findByProperties($term, $searchNodeTypes, $context);
+- $nodes = $this->nodeSearchServiceInterface->findByProperties($term, $searchNodeTypes, $context);
++
+ // TODO 9.0 migration: The replacement needs a node as starting point for the search. Please provide a node, to make this replacement working.
+ $node = 'we-need-a-node-here';
+ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
@@ -1849,22 +924,23 @@ return static function (RectorConfig $rectorConfig): void {
```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);
++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
++ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
++
+ $contentRepository->getNodeTypeManager()->isNodeTypeAllowedAsChildToTetheredNode($grandParentsNodeType->name, \Neos\ContentRepository\Core\SharedModel\Node\NodeName::fromString($parentNodeName), $nodeType->name);
}
}
@@ -1883,16 +959,15 @@ return static function (RectorConfig $rectorConfig): void {
```diff
getNodeType();
- $childNodes = $nodeType->getAutoCreatedChildNodes();
+ // TODO 9.0 migration: NodeType::tetheredNodeTypeDefinitions() is not a 1:1 replacement of NodeType::getAutoCreatedChildNodes(). You need to change your code to work with new TetheredNodeTypeDefinition object.
-+
+ $childNodes = $nodeType->tetheredNodeTypeDefinitions;
}
}
@@ -1936,18 +1011,19 @@ return static function (RectorConfig $rectorConfig): void {
```diff
getNodeType();
- $type = $nodeType->getTypeOfAutoCreatedChildNode($nodeName);
++
+ // TODO 9.0 migration: Make this code aware of multiple Content Repositories. If you have a Node object around you can use $node->contentRepositoryId.
+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
+ $type = $contentRepository->getNodeTypeManager()->getNodeType($nodeType->tetheredNodeTypeDefinitions->get($nodeName));
@@ -1971,7 +1047,7 @@ return static function (RectorConfig $rectorConfig): void {
class SomeClass
{
/**
- * @var \Neos\ContentRepository\Core\NodeType\NodeTypeManager
+ * @var \Neos\ContentRepository\Domain\Service\NodeTypeManager
* @Flow\Inject
*/
protected $nodeTypeManager;
@@ -1979,6 +1055,7 @@ return static function (RectorConfig $rectorConfig): void {
{
- $nt = $this->nodeTypeManager->getNodeTypes(false);
+ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
++
+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
+ $nt = $contentRepository->getNodeTypeManager()->getNodeTypes(false);
}
@@ -1989,19 +1066,26 @@ return static function (RectorConfig $rectorConfig): void {
-## RemoveDuplicateCommentRector
+## ObjectInstantiationToWarningCommentRector
+
+"Warning comments for various non-supported signals
-"Warning comments for various non-supported use cases
+:wrench: **configure it!**
-- class: [`Neos\Rector\Generic\Rules\RemoveDuplicateCommentRector`](../src/Generic/Rules/RemoveDuplicateCommentRector.php)
+- class: [`Neos\Rector\Generic\Rules\ObjectInstantiationToWarningCommentRector`](../src/Generic/Rules/ObjectInstantiationToWarningCommentRector.php)
```diff
@@ -2017,29 +1101,6 @@ Remove properties marked with a @Flow\Inject annotation and a certain type
- class: [`Neos\Rector\Generic\Rules\RemoveInjectionsRector`](../src/Generic/Rules/RemoveInjectionsRector.php)
-```php
-extension('rectorConfig', [
- [
- 'class' => RemoveInjectionsRector::class,
- 'configuration' => [
- new RemoveInjection('Foo\Bar\Baz'),
- ],
- ],
- ]);
-};
-```
-
-↓
-
```diff
extension('rectorConfig', [
- [
- 'class' => RemoveParentClassRector::class,
- 'configuration' => [
- new RemoveParentClass('Foo\Bar\Baz', '// TODO: Neos 9.0 Migration: Stuff'),
- ],
- ],
- ]);
-};
-```
-
-↓
-
```diff
extension('rectorConfig', [
- [
- 'class' => SignalSlotToWarningCommentRector::class,
- 'configuration' => [
- new SignalSlotToWarningComment('PhpParser\Node', 'beforeMove', '!! This signal "beforeMove" on Node doesn\'t exist anymore'),
- ],
- ],
- ]);
-};
-```
-
-↓
-
```diff
getSignalSlotDispatcher();
-+ // TODO 9.0 migration: Signal "beforeMove" doesn't exist anymore
-+
++ // TODO 9.0 migration: Signal "beforeMove" doesn't exist anymore
$dispatcher->connect(
- NodeLegacyStub::class,
+ Node::class,
'beforeMove',
SomeOtherClass::class,
'someMethod'
);
-+ // TODO 9.0 migration: Signal "afterMove" doesn't exist anymore
-+
++ // TODO 9.0 migration: Signal "afterMove" doesn't exist anymore
$dispatcher->connect(
- 'Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub',
+ 'Neos\ContentRepository\Domain\Model\Node',
'afterMove',
SomeOtherClass::class,
'someMethod'
);
$dispatcher->connect(
- NodeLegacyStub::class,
+ Node::class,
'otherMethod',
SomeOtherClass::class,
'someMethod'
@@ -2217,34 +1230,106 @@ Turns defined code uses of `"__toString()"` method to specific method calls or p
- class: [`Neos\Rector\Generic\Rules\ToStringToMethodCallOrPropertyFetchRector`](../src/Generic/Rules/ToStringToMethodCallOrPropertyFetchRector.php)
-```php
-__toString();
++$result = $someValue->getPath();
++$result = $someValue->getPath();
+```
+
+
+
+## WorkspaceGetBaseWorkspaceRector
+
+`"Workspace::getBaseWorkspace()"` will be rewritten
+
+- class: [`Neos\Rector\ContentRepository90\Rules\WorkspaceGetBaseWorkspaceRector`](../src/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector.php)
+
+```diff
+ getBaseWorkspace();
-use Neos\Rector\Generic\Rules\ToStringToMethodCallOrPropertyFetchRector;
-use Rector\Config\RectorConfig;
+- return $workspace->getBaseWorkspace();
++ // TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead and make this code aware of multiple Content Repositories.
++ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
++ $baseWorkspace = $contentRepository->findWorkspaceByName($workspace->baseWorkspaceName);
++
++ // TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead and make this code aware of multiple Content Repositories.
++ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
++
++ return $contentRepository->findWorkspaceByName($workspace->baseWorkspaceName);
+ }
+ }
-return static function (RectorConfig $rectorConfig): void {
- $containerConfigurator->extension('rectorConfig', [
- [
- 'class' => ToStringToMethodCallOrPropertyFetchRector::class,
- 'configuration' => [
- 'SomeObject' => 'getPath()',
- ],
- ],
- ]);
-};
+ ?>
```
-↓
+
+
+## WorkspaceGetBaseWorkspacesRector
+
+`"Workspace::getBaseWorkspaces()"` will be rewritten
+
+- class: [`Neos\Rector\ContentRepository90\Rules\WorkspaceGetBaseWorkspacesRector`](../src/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector.php)
```diff
- $someValue = new SomeObject;
--$result = (string) $someValue;
--$result = $someValue->__toString();
-+$result = $someValue->getPath();
-+$result = $someValue->getPath();
+ getBaseWorkspaces();
+
+- return $workspace->getBaseWorkspaces();
++ // TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead and make this code aware of multiple Content Repositories.
++ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
++ $baseWorkspaces = $contentRepository->findWorkspaces()->getBaseWorkspaces($workspace->workspaceName);
++
++ // TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead and make this code aware of multiple Content Repositories.
++ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
++
++ return $contentRepository->findWorkspaces()->getBaseWorkspaces($workspace->workspaceName);
+ }
+ }
+
+ ?>
+```
+
+
+
+## WorkspaceGetDescriptionRector
+
+`"Workspace::getDescription()"` will be rewritten
+
+- class: [`Neos\Rector\ContentRepository90\Rules\WorkspaceGetDescriptionRector`](../src/ContentRepository90/Rules/WorkspaceGetDescriptionRector.php)
+
+```diff
+ getDescription();
++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
++ $description = $this->workspaceService->getWorkspaceMetadata(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName)->description->value;
+ }
+ }
+
+ ?>
```
@@ -2258,7 +1343,7 @@ return static function (RectorConfig $rectorConfig): void {
```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;
}
}
@@ -2276,6 +1360,85 @@ return static function (RectorConfig $rectorConfig): void {
+## WorkspaceGetTitleRector
+
+`"Workspace::getTitle()"` will be rewritten
+
+- class: [`Neos\Rector\ContentRepository90\Rules\WorkspaceGetTitleRector`](../src/ContentRepository90/Rules/WorkspaceGetTitleRector.php)
+
+```diff
+ getTitle();
++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
++ $title = $this->workspaceService->getWorkspaceMetadata(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName)->title->value;
+ }
+ }
+
+ ?>
+```
+
+
+
+## WorkspacePublishNodeRector
+
+`"Workspace::publishNode()"` will be rewritten
+
+- class: [`Neos\Rector\ContentRepository90\Rules\WorkspacePublishNodeRector`](../src/ContentRepository90/Rules/WorkspacePublishNodeRector.php)
+
+```diff
+ publishNode($node);
++ // TODO 9.0 migration: Check if this matches your requirements as this is not a 100% replacement. Make this code aware of multiple Content Repositories.
++ $this->workspacePublishingService->publishChangesInDocument(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, $node);
+ }
+ }
+
+ ?>
+```
+
+
+
+## WorkspacePublishRector
+
+`"Workspace::publish()"` will be rewritten
+
+- class: [`Neos\Rector\ContentRepository90\Rules\WorkspacePublishRector`](../src/ContentRepository90/Rules/WorkspacePublishRector.php)
+
+```diff
+ publish();
++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
++ $this->workspacePublishingService->publishWorkspace(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName);
+ }
+ }
+
+ ?>
+```
+
+
+
## WorkspaceRepositoryCountByNameRector
`"WorkspaceRepository::countByName()"` will be rewritten.
@@ -2290,20 +1453,118 @@ return static function (RectorConfig $rectorConfig): void {
class SomeClass
{
-- /**
-- * @var WorkspaceRepository
-- * @Flow\Inject
-- */
-- protected $workspaceRepository;
-+ #[\Neos\Flow\Annotations\Inject]
-+ protected \Neos\ContentRepositoryRegistry\ContentRepositoryRegistry $contentRepositoryRegistry;
+ /**
+ * @var WorkspaceRepository
+ * @Flow\Inject
+ */
+ protected $workspaceRepository;
public function run(string $workspace)
{
- return $this->workspaceRepository->countByName($workspace);
+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
+ // TODO 9.0 migration: remove ternary operator (...? 1 : 0 ) - unnecessary complexity
++ return $contentRepository->findWorkspaceByName(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($workspace)) !== null ? 1 : 0;
+ }
+ }
+
+ ?>
+```
+
+
+
+## WorkspaceRepositoryFindByBaseWorkspaceRector
+
+`"WorkspaceRepository::findByBaseWorkspace()"` will be rewritten.
+
+- class: [`Neos\Rector\ContentRepository90\Rules\WorkspaceRepositoryFindByBaseWorkspaceRector`](../src/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector.php)
+
+```diff
+ workspaceRepository->findByBaseWorkspace($workspaceIdentifier);
++
++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
++ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
++ $dependentWorkspaces = $contentRepository->findWorkspaces()->getDependantWorkspaces(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($workspaceIdentifier));
+ }
+ }
+```
+
+
+
+## WorkspaceRepositoryFindByIdentifierRector
+
+`"WorkspaceRepository::findByIdentifier()"` will be rewritten.
+
+- class: [`Neos\Rector\ContentRepository90\Rules\WorkspaceRepositoryFindByIdentifierRector`](../src/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector.php)
+
+```diff
+ workspaceRepository->findByIdentifier($workspaceIdentifier);
+
-+ return $contentRepository->getWorkspaceFinder()->findOneByName(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($workspace)) !== null ? 1 : 0;
++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
++ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
++ $workspace = $contentRepository->findWorkspaceByName(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($workspaceIdentifier));
+ }
+ }
+```
+
+
+
+## WorkspaceSetDescriptionRector
+
+`"Workspace::setDescription()"` will be rewritten
+
+- class: [`Neos\Rector\ContentRepository90\Rules\WorkspaceSetDescriptionRector`](../src/ContentRepository90/Rules/WorkspaceSetDescriptionRector.php)
+
+```diff
+ setDescription("description");
++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
++ $this->workspaceService->setWorkspaceDescription(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, \Neos\Neos\Domain\Model\WorkspaceDescription::fromString("description"));
+ }
+
+ public function get(Workspace $workspace)
+ {
+- return $workspace->setDescription("description");
++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
++ return $this->workspaceService->setWorkspaceDescription(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, \Neos\Neos\Domain\Model\WorkspaceDescription::fromString("description"));
}
}
@@ -2312,73 +1573,46 @@ return static function (RectorConfig $rectorConfig): void {
-## YamlDimensionConfigRector
+## WorkspaceSetTitleRector
-Fusion: Rewrite Settings.yaml config to new language
+`"Workspace::setTitle()"` will be rewritten
-- class: [`Neos\Rector\ContentRepository90\Rules\YamlDimensionConfigRector`](../src/ContentRepository90/Rules/YamlDimensionConfigRector.php)
+- class: [`Neos\Rector\ContentRepository90\Rules\WorkspaceSetTitleRector`](../src/ContentRepository90/Rules/WorkspaceSetTitleRector.php)
```diff
--# some YAML with comments
- Neos:
-- ContentRepository:
-- contentDimensions:
-- language:
-- label: 'Neos.Demo:Main:contentDimensions.language'
-- icon: icon-language
-- default: en_US
-- defaultPreset: en_US
-- presets:
-- en_US:
-- label: 'English (US)'
-+ ContentRepositoryRegistry:
-+ contentRepositories:
-+ default:
-+ contentDimensions:
-+ language:
-+ label: 'Neos.Demo:Main:contentDimensions.language'
-+ icon: icon-language
- values:
-- - en_US
-- # The default preset can also have an empty uriSegment value.
-- # https://docs.neos.io/cms/manual/content-repository/content-dimensions#behind-the-scenes-routing
-- uriSegment: en
-- en_UK:
-- label: 'English (UK)'
-- values:
-- - en_UK
-- - en_US
-- uriSegment: uk
-- de:
-- label: Deutsch
-- values:
-- - de
-- uriSegment: de
-+ en_US:
-+ label: 'English (US)'
-+ specializations:
-+ en_UK:
-+ label: 'English (UK)'
-+ de:
-+ label: Deutsch
-+ Neos:
-+ sites:
-+ '*':
-+ contentDimensions:
-+ # defaultDimensionSpacePoint is used for the homepage (URL /)
-+ defaultDimensionSpacePoint:
-+ language: en_US
-+ resolver:
-+ factoryClassName: Neos\Neos\FrontendRouting\DimensionResolution\Resolver\UriPathResolverFactory
-+ options:
-+ segments:
-+ -
-+ dimensionIdentifier: language
-+ # dimensionValue => uriPathSegment (empty uriPathSegment allowed)
-+ dimensionValueMapping:
-+ en_US: en
-+ en_UK: uk
-+ de: de
+ setTitle("title");
+- $bar = $workspace->setTitle("title");
++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
++ $this->workspaceService->setWorkspaceTitle(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, \Neos\Neos\Domain\Model\WorkspaceTitle::fromString("title"));
++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
++ $bar = $this->workspaceService->setWorkspaceTitle(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, \Neos\Neos\Domain\Model\WorkspaceTitle::fromString("title"));
+
+- $foo = $this->getWorkspace()->setTitle("title");
++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
++ $foo = $this->workspaceService->setWorkspaceTitle(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $this->getWorkspace()->workspaceName, \Neos\Neos\Domain\Model\WorkspaceTitle::fromString("title"));
+ }
+
+ public function get(Workspace $workspace)
+ {
+- return $workspace->setTitle("title");
++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
++ return $this->workspaceService->setWorkspaceTitle(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, \Neos\Neos\Domain\Model\WorkspaceTitle::fromString("title"));
+ }
+
+ public function getWorkspace(): Workspace {
+ return Workspace::create('default');
+ }
+ }
+
+ ?>
```
diff --git a/rector.template.php b/rector.template.php
index c150c44..8d9c11b 100644
--- a/rector.template.php
+++ b/rector.template.php
@@ -8,12 +8,6 @@
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([
NeosRectorSets::CONTENTREPOSITORY_9_0,
- //NeosRectorSets::NEOS_8_4,
- ]);
-
- $rectorConfig->autoloadPaths([
- __DIR__ . '/Packages',
- __DIR__ . '/DistributionPackages',
]);
$rectorConfig->paths([
diff --git a/src/ContentRepository90/Legacy/CreateContentContextTrait.php b/src/ContentRepository90/Legacy/CreateContentContextTrait.php
index 83ade57..f459ec8 100644
--- a/src/ContentRepository90/Legacy/CreateContentContextTrait.php
+++ b/src/ContentRepository90/Legacy/CreateContentContextTrait.php
@@ -1,9 +1,10 @@
>
*/
- public function getNodeTypes() : array
+ public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
+
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node) : ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Service\ContentDimensionCombinator::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'getAllAllowedCombinations')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getAllAllowedCombinations'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Service\ContentDimensionCombinator::class))) {
+ $this->changed = true;
+ $this->nodeVar = $node->var;
+
+ return $this->dimensionSpacePoints_toLegacyDimensionArray();
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))),
- self::assign('dimensionSpacePoints', $this->contentRepository_getVariationGraph_getDimensionSpacePoints()),
- self::todoComment('try to directly work with $dimensionSpacePoints, instead of converting them to the legacy dimension format')
- ],
- $node
- );
+ $node->expr = $newExpr;
- return $this->dimensionSpacePoints_toLegacyDimensionArray();
+ return [
+ self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))),
+ self::assign('dimensionSpacePoints', $this->contentRepository_getVariationGraph_getDimensionSpacePoints()),
+ self::withTodoComment(
+ 'try to directly work with $dimensionSpacePoints, instead of converting them to the legacy dimension format',
+ $node
+ ),
+ ];
}
}
diff --git a/src/ContentRepository90/Rules/ContentRepositoryUtilityRenderValidNodeNameRector.php b/src/ContentRepository90/Rules/ContentRepositoryUtilityRenderValidNodeNameRector.php
index 4cffb5c..ec2199d 100644
--- a/src/ContentRepository90/Rules/ContentRepositoryUtilityRenderValidNodeNameRector.php
+++ b/src/ContentRepository90/Rules/ContentRepositoryUtilityRenderValidNodeNameRector.php
@@ -8,12 +8,13 @@
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name\FullyQualified;
-use Rector\Core\Rector\AbstractRector;
-use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use PHPStan\Type\ObjectType;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
+use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
+use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class ContentRepositoryUtilityRenderValidNodeNameRector extends AbstractRector
+final class ContentRepositoryUtilityRenderValidNodeNameRector extends AbstractRector implements DocumentedRuleInterface
{
public function getRuleDefinition(): RuleDefinition
diff --git a/src/ContentRepository90/Rules/ContextFactoryToLegacyContextStubRector.php b/src/ContentRepository90/Rules/ContextFactoryToLegacyContextStubRector.php
index 8a3b067..357a817 100644
--- a/src/ContentRepository90/Rules/ContextFactoryToLegacyContextStubRector.php
+++ b/src/ContentRepository90/Rules/ContextFactoryToLegacyContextStubRector.php
@@ -1,27 +1,26 @@
>
*/
- public function getNodeTypes() : array
+ public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Expr\MethodCall::class];
}
+
/**
* @param \PhpParser\Node\Expr\MethodCall $node
*/
- public function refactor(Node $node) : ?Node
+ public function refactor(Node $node): ?Node
{
assert($node instanceof Node\Expr\MethodCall);
@@ -51,7 +51,7 @@ public function refactor(Node $node) : ?Node
}
return new Node\Expr\New_(
- // TODO clean up
+ // TODO clean up
new Node\Name('\\' . LegacyContextStub::class),
$node->args
);
diff --git a/src/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector.php b/src/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector.php
index 797764a..2fd8782 100644
--- a/src/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector.php
+++ b/src/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector.php
@@ -7,19 +7,17 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-use Rector\PostRector\Collector\NodesToAddCollector;
-use PhpParser\Node\Expr\Assign;
-final class ContextGetCurrentRenderingModeRector extends AbstractRector
+final class ContextGetCurrentRenderingModeRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
use ContextRectorTrait;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
diff --git a/src/ContentRepository90/Rules/ContextGetFirstLevelNodeCacheRector.php b/src/ContentRepository90/Rules/ContextGetFirstLevelNodeCacheRector.php
index 6849139..e2067db 100644
--- a/src/ContentRepository90/Rules/ContextGetFirstLevelNodeCacheRector.php
+++ b/src/ContentRepository90/Rules/ContextGetFirstLevelNodeCacheRector.php
@@ -4,23 +4,21 @@
namespace Neos\Rector\ContentRepository90\Rules;
-use Neos\Rector\ContentRepository90\Legacy\LegacyContextStub;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
use PhpParser\NodeFinder;
-use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitor;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class ContextGetFirstLevelNodeCacheRector extends AbstractRector
+final class ContextGetFirstLevelNodeCacheRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
@@ -38,14 +36,14 @@ public function getNodeTypes(): array
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param \PhpParser\Node\Stmt\Expression $node
*/
- public function refactor(Node $node): ?Node
+ public function refactor(Node $node)
{
assert($node instanceof Node\Stmt\Expression);
if ($this->containsContextGetFirstLevelNodeCache($node->expr)) {
- $this->removeNode($node);
+ return NodeVisitor::REMOVE_NODE;
}
return $node;
}
@@ -55,7 +53,7 @@ private function containsContextGetFirstLevelNodeCache(Node\Expr $expr): bool
$nodeFinder = new NodeFinder();
return $nodeFinder->findFirst(
$expr,
- fn(Node $node) => $node instanceof Node\Expr\MethodCall
+ fn (Node $node) => $node instanceof Node\Expr\MethodCall
// WARNING: The System cannot infer the Context type properly, as the factory has no types.
// Thus, we simply check on the method name getFirstLevelNodeCache() which is unique enough.
//&& (
diff --git a/src/ContentRepository90/Rules/ContextGetRootNodeRector.php b/src/ContentRepository90/Rules/ContextGetRootNodeRector.php
index f33422f..8765ca5 100644
--- a/src/ContentRepository90/Rules/ContextGetRootNodeRector.php
+++ b/src/ContentRepository90/Rules/ContextGetRootNodeRector.php
@@ -1,6 +1,7 @@
>
*/
- public function getNodeTypes() : array
+ public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
+
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node) : ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(LegacyContextStub::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'getRootNode')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getRootNode'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(LegacyContextStub::class))) {
+ $this->changed = true;
+ $this->nodeVar = $node->var;
+
+ return $this->subgraph_findNodeById(
+ $this->nodeFactory->createPropertyFetch('rootNodeAggregate', 'nodeAggregateId')
+ );
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::withTodoComment(
- '!! MEGA DIRTY CODE! Ensure to rewrite this; by getting rid of LegacyContextStub.',
- self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default')))
- ),
- self::assign('workspace', $this->contentRepository_findWorkspaceByName($this->workspaceName_fromString($this->context_workspaceName_fallbackToLive($node->var)))),
- self::assign('rootNodeAggregate', $this->contentRepository_getContentGraph_findRootNodeAggregateByType($this->nodeFactory->createPropertyFetch('workspace', 'workspaceName') , $this->nodeTypeName_fromString('Neos.Neos:Sites'))),
- self::assign('subgraph', $this->contentRepository_getContentGraph_getSubgraph($this->nodeFactory->createPropertyFetch('workspace', 'workspaceName'), $this->dimensionSpacePoint_fromLegacyDimensionArray($this->context_dimensions_fallbackToEmpty($node->var)), $this->visibilityConstraints($node->var))),
-
- ],
- $node
- );
+ $node->expr = $newExpr;
- return $this->subgraph_findNodeById(
- $this->nodeFactory->createPropertyFetch('rootNodeAggregate', 'nodeAggregateId')
- );
+ return [
+ new Nop(), // Needed, to render the comment below
+ self::withTodoComment(
+ '!! MEGA DIRTY CODE! Ensure to rewrite this; by getting rid of LegacyContextStub.',
+ self::assign('contentRepository',
+ $this->this_contentRepositoryRegistry_get(
+ $this->contentRepositoryId_fromString('default')
+ )
+ )
+ ),
+ self::assign('workspace',
+ $this->contentRepository_findWorkspaceByName(
+ $this->workspaceName_fromString(
+ $this->context_workspaceName_fallbackToLive($visitor->nodeVar)
+ )
+ )
+ ),
+ self::assign('rootNodeAggregate',
+ $this->contentRepository_getContentGraph_findRootNodeAggregateByType(
+ $this->nodeFactory->createPropertyFetch('workspace', 'workspaceName'),
+ $this->nodeTypeName_fromString('Neos.Neos:Sites')
+ )
+ ),
+ self::assign('subgraph',
+ $this->contentRepository_getContentGraph_getSubgraph(
+ $this->nodeFactory->createPropertyFetch('workspace', 'workspaceName'),
+ $this->dimensionSpacePoint_fromLegacyDimensionArray(
+ $this->context_dimensions_fallbackToEmpty($visitor->nodeVar)
+ ),
+ $this->visibilityConstraints($visitor->nodeVar)
+ )
+ ),
+ $node
+ ];
}
-
private function context_workspaceName_fallbackToLive(Node\Expr $legacyContextStub)
{
return new Node\Expr\BinaryOp\Coalesce(
diff --git a/src/ContentRepository90/Rules/ContextIsInBackendRector.php b/src/ContentRepository90/Rules/ContextIsInBackendRector.php
index d22bfab..5ea67df 100644
--- a/src/ContentRepository90/Rules/ContextIsInBackendRector.php
+++ b/src/ContentRepository90/Rules/ContextIsInBackendRector.php
@@ -7,20 +7,17 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-use Rector\PostRector\Collector\NodesToAddCollector;
-use PhpParser\Node\Expr\Assign;
-use PhpParser\NodeDumper;
-final class ContextIsInBackendRector extends AbstractRector
+final class ContextIsInBackendRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
use ContextRectorTrait;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
@@ -38,7 +35,7 @@ public function getNodeTypes(): array
}
/**
- * @param \PhpParser\Node\Stmt\Expression $node
+ * @param \PhpParser\Node\Expr\MethodCall $node
*/
public function refactor(Node $node): ?Node
{
diff --git a/src/ContentRepository90/Rules/ContextIsLiveRector.php b/src/ContentRepository90/Rules/ContextIsLiveRector.php
index c587160..df65009 100644
--- a/src/ContentRepository90/Rules/ContextIsLiveRector.php
+++ b/src/ContentRepository90/Rules/ContextIsLiveRector.php
@@ -7,20 +7,17 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-use Rector\PostRector\Collector\NodesToAddCollector;
-use PhpParser\Node\Expr\Assign;
-use PhpParser\NodeDumper;
-final class ContextIsLiveRector extends AbstractRector
+final class ContextIsLiveRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
use ContextRectorTrait;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
@@ -38,7 +35,7 @@ public function getNodeTypes(): array
}
/**
- * @param \PhpParser\Node\Stmt\Expression $node
+ * @param \PhpParser\Node\Expr\MethodCall $node
*/
public function refactor(Node $node): ?Node
{
diff --git a/src/ContentRepository90/Rules/ContextRectorTrait.php b/src/ContentRepository90/Rules/ContextRectorTrait.php
index d14b509..0ad1807 100644
--- a/src/ContentRepository90/Rules/ContextRectorTrait.php
+++ b/src/ContentRepository90/Rules/ContextRectorTrait.php
@@ -4,15 +4,8 @@
namespace Neos\Rector\ContentRepository90\Rules;
-use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
-use PhpParser\NodeFinder;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-use Rector\PostRector\Collector\NodesToAddCollector;
-use PhpParser\Node\Expr\Assign;
-use PhpParser\NodeDumper;
trait ContextRectorTrait
{
diff --git a/src/ContentRepository90/Rules/FusionCacheLifetimeRector.php b/src/ContentRepository90/Rules/FusionCacheLifetimeRector.php
deleted file mode 100644
index 08a1adc..0000000
--- a/src/ContentRepository90/Rules/FusionCacheLifetimeRector.php
+++ /dev/null
@@ -1,28 +0,0 @@
-addCommentsIfRegexMatches(
- '/\.cacheLifetime()/',
- '// TODO 9.0 migration: Line %LINE: You may need to remove ".cacheLifetime()" as this FlowQuery Operation has been removed. This is not needed anymore as the concept of timeable node visibility has changed. See https://github.com/neos/timeable-node-visibility'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector.php b/src/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector.php
deleted file mode 100644
index 9ff1008..0000000
--- a/src/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector.php
+++ /dev/null
@@ -1,33 +0,0 @@
-process(function (string $eelExpression, FusionPath $path) {
- if (!$path->containsSegments('__meta', 'cache', 'entryIdentifier')) {
- return $eelExpression;
- }
- return preg_replace(
- '/(?getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionContextCurrentRenderingModeRector.php b/src/ContentRepository90/Rules/FusionContextCurrentRenderingModeRector.php
deleted file mode 100644
index 7c7f545..0000000
--- a/src/ContentRepository90/Rules/FusionContextCurrentRenderingModeRector.php
+++ /dev/null
@@ -1,41 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.context\.currentRenderingMode\.(name|title|fusionPath|options)/',
- 'renderingMode.$2',
- $eelExpression
- ))
- ->process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.context\.currentRenderingMode\.edit/',
- 'renderingMode.isEdit',
- $eelExpression
- ))
- ->process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.context\.currentRenderingMode\.preview/',
- 'renderingMode.isPreview',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.context\.currentRenderingMode/',
- '// TODO 9.0 migration: Line %LINE: 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.'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionContextCurrentSiteRector.php b/src/ContentRepository90/Rules/FusionContextCurrentSiteRector.php
deleted file mode 100644
index de21d64..0000000
--- a/src/ContentRepository90/Rules/FusionContextCurrentSiteRector.php
+++ /dev/null
@@ -1,27 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site|[a-zA-Z]+)\.context\.currentSite\b/',
- 'Neos.Site.findBySiteNode(site)',
- $eelExpression
- ))->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionContextGetWorkspaceNameRector.php b/src/ContentRepository90/Rules/FusionContextGetWorkspaceNameRector.php
deleted file mode 100644
index c4e9653..0000000
--- a/src/ContentRepository90/Rules/FusionContextGetWorkspaceNameRector.php
+++ /dev/null
@@ -1,31 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.context\.(workspaceName|workspace\.name)\b/',
- '$1.workspaceName',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.context\.workspaceName/',
- '// TODO 9.0 migration: Line %LINE: You very likely need to rewrite "VARIABLE.context.workspaceName" to "VARIABLE.workspaceName". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionContextGetWorkspaceRector.php b/src/ContentRepository90/Rules/FusionContextGetWorkspaceRector.php
deleted file mode 100644
index f91333e..0000000
--- a/src/ContentRepository90/Rules/FusionContextGetWorkspaceRector.php
+++ /dev/null
@@ -1,26 +0,0 @@
-addCommentsIfRegexMatches(
- '/\.context\.workspace(\.\w)?\b/',
- '// TODO 9.0 migration: Line %LINE: You very likely need to rewrite "VARIABLE.context.workspace" as the "context" of nodes has been removed without a direct replacement in Neos 9. If you really need the workspace in fusion you need to create a dedicated helper yourself which should ideally do ALL the complex logic in php directly and return the computed result.'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionContextInBackendRector.php b/src/ContentRepository90/Rules/FusionContextInBackendRector.php
deleted file mode 100644
index 87f073c..0000000
--- a/src/ContentRepository90/Rules/FusionContextInBackendRector.php
+++ /dev/null
@@ -1,31 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.context\.inBackend/',
- 'renderingMode.isEdit',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.context\.inBackend/',
- '// TODO 9.0 migration: Line %LINE: 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.'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionContextLiveRector.php b/src/ContentRepository90/Rules/FusionContextLiveRector.php
deleted file mode 100644
index 4f95fba..0000000
--- a/src/ContentRepository90/Rules/FusionContextLiveRector.php
+++ /dev/null
@@ -1,31 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.context\.live/',
- '!renderingMode.isEdit',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.context\.live/',
- '// TODO 9.0 migration: Line %LINE: 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.'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionFlowQueryContextRector.php b/src/ContentRepository90/Rules/FusionFlowQueryContextRector.php
deleted file mode 100644
index 592602f..0000000
--- a/src/ContentRepository90/Rules/FusionFlowQueryContextRector.php
+++ /dev/null
@@ -1,26 +0,0 @@
-addCommentsIfRegexMatches(
- '/context\(\s*\{(.*)[\'"](targetDimensions|currentDateTime|removedContentShown|inaccessibleContentShown)[\'"](.*)\}\s*\)/',
- '// TODO 9.0 migration: Line %LINE: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionNodeAggregateIdentifierRector.php b/src/ContentRepository90/Rules/FusionNodeAggregateIdentifierRector.php
deleted file mode 100644
index 61cf25d..0000000
--- a/src/ContentRepository90/Rules/FusionNodeAggregateIdentifierRector.php
+++ /dev/null
@@ -1,33 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.nodeAggregateIdentifier/',
- '$1.aggregateId',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.nodeAggregateIdentifier/',
- '// TODO 9.0 migration: Line %LINE: You may need to rewrite "VARIABLE.nodeAggregateIdentifier" to VARIABLE.aggregateId. We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionNodeAutoCreatedRector.php b/src/ContentRepository90/Rules/FusionNodeAutoCreatedRector.php
deleted file mode 100644
index 8b00d80..0000000
--- a/src/ContentRepository90/Rules/FusionNodeAutoCreatedRector.php
+++ /dev/null
@@ -1,33 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.autoCreated/',
- '$1.classification.tethered',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.autoCreated/',
- '// TODO 9.0 migration: Line %LINE: !! 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.'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionNodeContextPathRector.php b/src/ContentRepository90/Rules/FusionNodeContextPathRector.php
deleted file mode 100644
index 8fa66d8..0000000
--- a/src/ContentRepository90/Rules/FusionNodeContextPathRector.php
+++ /dev/null
@@ -1,43 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.contextPath\b(?!\.|\()/',
- 'Neos.Node.serializedNodeAddress($1)',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.contextPath\b(?!\.|\()/',
- '// TODO 9.0 migration: Line %LINE: !! 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.'
- )
- ->process(fn(string $eelExpression) => preg_replace(
- '/q\(([^)]+)\)\.property\([\'"]_contextPath[\'"]\)/',
- 'Neos.Node.serializedNodeAddress($1)',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.property\([\'"]_contextPath[\'"]\)/',
- '// TODO 9.0 migration: Line %LINE: !! 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.'
- )
- ->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionNodeDepthRector.php b/src/ContentRepository90/Rules/FusionNodeDepthRector.php
deleted file mode 100644
index 9a0f8d1..0000000
--- a/src/ContentRepository90/Rules/FusionNodeDepthRector.php
+++ /dev/null
@@ -1,42 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/([a-zA-Z.]+)?(site|node|documentNode)\.depth\b(?!\.|\()/',
- 'Neos.Node.depth($1$2)',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.depth\b(?!\.|\()/',
- '// TODO 9.0 migration: Line %LINE: 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.'
- )
- ->process(fn(string $eelExpression) => preg_replace(
- '/q\(([^)]+)\)\.property\([\'"]_depth[\'"]\)/',
- 'Neos.Node.depth($1)',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.property\([\'"]_depth[\'"]\)/',
- '// TODO 9.0 migration: Line %LINE: 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.'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionNodeHiddenAfterDateTimeRector.php b/src/ContentRepository90/Rules/FusionNodeHiddenAfterDateTimeRector.php
deleted file mode 100644
index e93a58f..0000000
--- a/src/ContentRepository90/Rules/FusionNodeHiddenAfterDateTimeRector.php
+++ /dev/null
@@ -1,38 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode)\.hiddenAfterDateTime/',
- 'q($1).property("disableAfterDateTime")',
- $eelExpression
- ))
- ->process(fn(string $eelExpression) => preg_replace(
- '/.property\(["\']_hiddenAfterDateTime["\']\)/',
- '.property("disableAfterDateTime")',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.hiddenAfterDateTime/',
- '// TODO 9.0 migration: Line %LINE: 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.'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionNodeHiddenBeforeDateTimeRector.php b/src/ContentRepository90/Rules/FusionNodeHiddenBeforeDateTimeRector.php
deleted file mode 100644
index 9cc4a28..0000000
--- a/src/ContentRepository90/Rules/FusionNodeHiddenBeforeDateTimeRector.php
+++ /dev/null
@@ -1,38 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode)\.hiddenBeforeDateTime/',
- 'q($1).property("enableAfterDateTime")',
- $eelExpression
- ))
- ->process(fn(string $eelExpression) => preg_replace(
- '/.property\(["\']_hiddenBeforeDateTime["\']\)/',
- '.property("enableAfterDateTime")',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.hiddenBeforeDateTime/',
- '// TODO 9.0 migration: Line %LINE: 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.'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionNodeHiddenInIndexRector.php b/src/ContentRepository90/Rules/FusionNodeHiddenInIndexRector.php
deleted file mode 100644
index 4bcb633..0000000
--- a/src/ContentRepository90/Rules/FusionNodeHiddenInIndexRector.php
+++ /dev/null
@@ -1,39 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.hiddenInIndex\b(?!\.|\()/',
- '$1.property(\'hiddenInMenu\')',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.hiddenInIndex\b(?!\.|\()/',
- '// TODO 9.0 migration: Line %LINE: 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.'
- )
- ->process(fn(string $eelExpression) => preg_replace(
- '/\.property\([\'"]_hiddenInIndex[\'"]\)/',
- '.property(\'hiddenInMenu\')',
- $eelExpression
- )
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionNodeHiddenRector.php b/src/ContentRepository90/Rules/FusionNodeHiddenRector.php
deleted file mode 100644
index afa3d75..0000000
--- a/src/ContentRepository90/Rules/FusionNodeHiddenRector.php
+++ /dev/null
@@ -1,42 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.hidden\b(?!\.|\()/',
- 'Neos.Node.isDisabled($1)',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.hidden\b(?!\.|\()/',
- '// TODO 9.0 migration: Line %LINE: You may need to rewrite "VARIABLE.hidden" to Neos.Node.isDisabled(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
- )
- ->process(fn(string $eelExpression) => preg_replace(
- '/q\(([^)]+)\)\.property\([\'"]_hidden[\'"]\)/',
- 'Neos.Node.isDisabled($1)',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.property\([\'"]_hidden[\'"]\)/',
- '// TODO 9.0 migration: Line %LINE: 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.'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionNodeIdentifierRector.php b/src/ContentRepository90/Rules/FusionNodeIdentifierRector.php
deleted file mode 100644
index 5435ca7..0000000
--- a/src/ContentRepository90/Rules/FusionNodeIdentifierRector.php
+++ /dev/null
@@ -1,42 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.identifier/',
- '$1.aggregateId',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.identifier/',
- '// TODO 9.0 migration: Line %LINE: You may need to rewrite "VARIABLE.identifier" to "VARIABLE.aggregateId". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
- )
- ->process(fn(string $eelExpression) => preg_replace(
- '/q\(([^)]+)\)\.property\([\'"]_identifier[\'"]\)/',
- '$1.aggregateId',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.property\([\'"]_identifier[\'"]\)/',
- '// TODO 9.0 migration: Line %LINE: You may need to rewrite "VARIABLE.identifier" to "VARIABLE.aggregateId". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionNodeLabelRector.php b/src/ContentRepository90/Rules/FusionNodeLabelRector.php
deleted file mode 100644
index 405ca96..0000000
--- a/src/ContentRepository90/Rules/FusionNodeLabelRector.php
+++ /dev/null
@@ -1,38 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.label/',
- 'Neos.Node.label($1)',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.label\b(?!\()/',
- '// TODO 9.0 migration: Line %LINE: You very likely need to rewrite "VARIABLE.label" to "Neos.Node.label(VARIABLE)". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
- )
- ->process(fn(string $eelExpression) => preg_replace(
- '/q\(([^)]+)\)\.property\\([\'"]_label[\'"]\\)/',
- 'Neos.Node.label($1)',
- $eelExpression
- ))
- ->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionNodeNodeTypeRector.php b/src/ContentRepository90/Rules/FusionNodeNodeTypeRector.php
deleted file mode 100644
index cdc012e..0000000
--- a/src/ContentRepository90/Rules/FusionNodeNodeTypeRector.php
+++ /dev/null
@@ -1,48 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.nodeType\.name/',
- '$1.nodeTypeName',
- $eelExpression
- ))
- ->process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.nodeType\b/',
- 'Neos.Node.nodeType($1)',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.nodeType\b(?!\()/',
- '// TODO 9.0 migration: Line %LINE: You very likely need to rewrite "VARIABLE.nodeType" to "Neos.Node.nodeType(VARIABLE)". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
- )
- ->process(fn(string $eelExpression) => preg_replace(
- '/q\(([^)]+)\)\.property\\([\'"]_nodeType\.name[\'"]\\)/',
- '$1.nodeTypeName',
- $eelExpression
- ))
- ->process(fn(string $eelExpression) => preg_replace(
- '/q\(([^)]+)\)\.property\\([\'"]_nodeType(\.[^\'"]*)?[\'"]\\)/',
- 'Neos.Node.nodeType($1)$2',
- $eelExpression
- ))
- ->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionNodeParentRector.php b/src/ContentRepository90/Rules/FusionNodeParentRector.php
deleted file mode 100644
index aa01b0f..0000000
--- a/src/ContentRepository90/Rules/FusionNodeParentRector.php
+++ /dev/null
@@ -1,33 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode)\.parent/',
- 'q($1).parent().get(0)',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.parent($|[^a-z(])/i',
- '// TODO 9.0 migration: Line %LINE: 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.'
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionNodePathRector.php b/src/ContentRepository90/Rules/FusionNodePathRector.php
deleted file mode 100644
index ddbc120..0000000
--- a/src/ContentRepository90/Rules/FusionNodePathRector.php
+++ /dev/null
@@ -1,39 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.path\b(?!\.|\()/',
- 'Neos.Node.path($1)',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.path\b(?!\.|\()/',
- '// TODO 9.0 migration: Line %LINE: 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.'
- )
- ->process(fn(string $eelExpression) => preg_replace(
- '/q\(([^)]+)\)\.property\([\'"]_path[\'"]\)/',
- 'Neos.Node.path($1)',
- $eelExpression
- )
- )->getProcessedContent();
- }
-}
diff --git a/src/ContentRepository90/Rules/FusionNodeTypeNameRector.php b/src/ContentRepository90/Rules/FusionNodeTypeNameRector.php
deleted file mode 100644
index fe30df3..0000000
--- a/src/ContentRepository90/Rules/FusionNodeTypeNameRector.php
+++ /dev/null
@@ -1,33 +0,0 @@
-process(fn(string $eelExpression) => preg_replace(
- '/(node|documentNode|site)\.nodeType\.name/',
- '$1.nodeTypeName',
- $eelExpression
- ))
- ->addCommentsIfRegexMatches(
- '/\.nodeType.name/',
- '// 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/src/ContentRepository90/Rules/NodeFactoryResetRector.php b/src/ContentRepository90/Rules/NodeFactoryResetRector.php
index 7078e9f..7df5e95 100644
--- a/src/ContentRepository90/Rules/NodeFactoryResetRector.php
+++ b/src/ContentRepository90/Rules/NodeFactoryResetRector.php
@@ -1,24 +1,29 @@
>
*/
- public function getNodeTypes() : array
+ public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
+
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node) : ?Node
+ public function refactor(Node $node)
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Factory\NodeFactory::class))) {
- return null;
- }
- if (!$this->isName($node->name, 'reset')) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- $this->removeNode($node);
+ $methodCall = $this->betterNodeFinder->findFirst($node, function (Node $subNode) {
+ return $subNode instanceof MethodCall
+ && $this->isObjectType($subNode->var, new ObjectType(\Neos\ContentRepository\Domain\Factory\NodeFactory::class))
+ && $this->isName($subNode->name, 'reset');
+ });
+
+ if ($methodCall) {
+ if ($node instanceof Node\Stmt\Return_) {
+ return new Node\Stmt\Return_();
+ }
+ return NodeVisitor::REMOVE_NODE;
+ }
return $node;
}
diff --git a/src/ContentRepository90/Rules/NodeFindParentNodeRector.php b/src/ContentRepository90/Rules/NodeFindParentNodeRector.php
index 18c9deb..f0991fe 100644
--- a/src/ContentRepository90/Rules/NodeFindParentNodeRector.php
+++ b/src/ContentRepository90/Rules/NodeFindParentNodeRector.php
@@ -6,18 +6,22 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeFindParentNodeRector extends AbstractRector
+final class NodeFindParentNodeRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- )
+ public function __construct()
{
}
@@ -31,30 +35,61 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node): ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'findParentNode')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'findParentNode'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Model\Node::class))) {
+ $this->changed = true;
+ $this->nodeVar = $node->var;
+
+ return $this->subgraph_findParentNode($node->var);
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::assign('subgraph', $this->this_contentRepositoryRegistry_subgraphForNode($node->var)),
- ],
- $node
- );
+ $node->expr = $newExpr;
- return $this->subgraph_findParentNode($node->var);
+ return [
+ self::assign('subgraph', $this->this_contentRepositoryRegistry_subgraphForNode($visitor->nodeVar)),
+ $node
+ ];
}
}
diff --git a/src/ContentRepository90/Rules/NodeGetChildNodesRector.php b/src/ContentRepository90/Rules/NodeGetChildNodesRector.php
index eafa683..86aa4f7 100644
--- a/src/ContentRepository90/Rules/NodeGetChildNodesRector.php
+++ b/src/ContentRepository90/Rules/NodeGetChildNodesRector.php
@@ -1,26 +1,31 @@
>
*/
- public function getNodeTypes() : array
+ public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
+
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node) : ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'getChildNodes')) {
- return null;
- }
- $nodeTypeFilterExpr = null;
- $limitExpr = null;
- $offsetExpr = null;
- foreach ($node->args as $index => $arg) {
- $argumentName = $arg?->name?->name;
- $namedArgument = $argumentName !== null;
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getChildNodes'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Model\Node::class))) {
+ $this->changed = true;
+ $this->nodeVar = $node->var;
+
+ $nodeTypeFilterExpr = null;
+ $limitExpr = null;
+ $offsetExpr = null;
- if (($namedArgument && $argumentName === 'nodeTypeFilter') || !$namedArgument && $index === 0) {
- assert($arg instanceof Node\Arg);
+ foreach ($node->args as $index => $arg) {
+ $argumentName = $arg?->name?->name;
+ $namedArgument = $argumentName !== null;
- if ($arg->value instanceof Node\Scalar\String_) {
- $nodeTypeFilterExpr = $arg->value;
+ if (($namedArgument && $argumentName === 'nodeTypeFilter') || (!$namedArgument && $index === 0)) {
+ assert($arg instanceof Node\Arg);
+
+ if ($arg->value instanceof Node\Scalar\String_) {
+ $nodeTypeFilterExpr = $arg->value;
+ }
+ }
+ if (($namedArgument && $argumentName === 'limit') || (!$namedArgument && $index === 1)) {
+ assert($arg instanceof Node\Arg);
+ $limitExpr = $arg->value;
+ }
+ if (($namedArgument && $argumentName === 'offset') || (!$namedArgument && $index === 2)) {
+ assert($arg instanceof Node\Arg);
+ $offsetExpr = $arg->value;
+ }
+ }
+ return $this->iteratorToArray(
+ $this->subgraph_findChildNodes($node->var, $nodeTypeFilterExpr, $limitExpr, $offsetExpr)
+ );
+ }
+ }
+ return null;
}
- }
- if (($namedArgument && $argumentName === 'limit') || !$namedArgument && $index === 1) {
- assert($arg instanceof Node\Arg);
- $limitExpr = $arg->value;
- }
- if (($namedArgument && $argumentName === 'offset') || !$namedArgument && $index === 2) {
- assert($arg instanceof Node\Arg);
- $offsetExpr = $arg->value;
- }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
+ return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::assign('subgraph', $this->this_contentRepositoryRegistry_subgraphForNode($node->var)),
- self::todoComment('Try to remove the iterator_to_array($nodes) call.')
- ],
- $node
- );
-
- return $this->iteratorToArray(
- $this->subgraph_findChildNodes($node->var, $nodeTypeFilterExpr, $limitExpr, $offsetExpr)
- );
+ $node->expr = $newExpr;
+
+ return [
+ self::assign(
+ 'subgraph',
+ $this->this_contentRepositoryRegistry_subgraphForNode($visitor->nodeVar)
+ ),
+ self::withTodoComment(
+ 'Try to remove the iterator_to_array($nodes) call.',
+ $node
+ )
+ ];
}
}
diff --git a/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceNameRector.php b/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceNameRector.php
index 1649f8a..cf46541 100644
--- a/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceNameRector.php
+++ b/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceNameRector.php
@@ -7,17 +7,16 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeGetContextGetWorkspaceNameRector extends AbstractRector
+final class NodeGetContextGetWorkspaceNameRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
public function getRuleDefinition(): RuleDefinition
@@ -50,7 +49,7 @@ public function refactor(Node $node): ?Node
return null;
}
- if (!$this->isObjectType($node->var->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
+ if (!$this->isObjectType($node->var->var, new ObjectType(\Neos\ContentRepository\Domain\Model\Node::class))) {
return null;
}
diff --git a/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceRector.php b/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceRector.php
index 5b84945..e188174 100644
--- a/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceRector.php
+++ b/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceRector.php
@@ -4,20 +4,25 @@
namespace Neos\Rector\ContentRepository90\Rules;
+use Neos\ContentRepository\Domain\Model\Node as NodeLegacyStub;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeGetContextGetWorkspaceRector extends AbstractRector
+final class NodeGetContextGetWorkspaceRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- )
+ public function __construct()
{
}
@@ -31,45 +36,71 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node): ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
- // Node->getContext()->getWorkspace()
- if (!$this->isName($node->name, 'getWorkspace')) {
- return null;
- }
- if (!$node->var instanceof Node\Expr\MethodCall) {
- return null;
- }
- if (!$this->isName($node->var->name, 'getContext')) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isObjectType($node->var->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
- return null;
- }
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor($visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
- $nodeVar = $node->var->var;
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::assign(
- 'contentRepository',
- $this->this_contentRepositoryRegistry_get(
- $this->nodeFactory->createPropertyFetch($nodeVar, 'contentRepositoryId')
- )
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getWorkspace' &&
+ $node->var instanceof MethodCall &&
+ $node->var->name instanceof Identifier &&
+ $node->var->name->toString() === 'getContext'
+ ) {
+ $this->nodeVar = $node->var->var;
+ if ($this->nodeTypeResolver->isObjectType($this->nodeVar, new ObjectType(NodeLegacyStub::class))) {
+ $this->changed = true;
+
+ return $this->contentRepository_findWorkspaceByName(
+ $this->nodeFactory->createPropertyFetch($this->nodeVar, 'workspaceName')
+ );
+ }
+ }
+
+ return null;
+ }
+ });
+
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if ($visitor->changed) {
+ $node->expr = $newExpr;
+
+ $contentRepository = self::assign(
+ 'contentRepository',
+ $this->this_contentRepositoryRegistry_get(
+ $this->nodeFactory->createPropertyFetch($visitor->nodeVar, 'contentRepositoryId')
)
- ],
- $node
- );
+ );
+
+ return [
+ $contentRepository, $node
+ ];
+ }
- return $this->contentRepository_findWorkspaceByName(
- $this->nodeFactory->createPropertyFetch($nodeVar, 'workspaceName')
- );
+ return null;
}
}
diff --git a/src/ContentRepository90/Rules/NodeGetContextPathRector.php b/src/ContentRepository90/Rules/NodeGetContextPathRector.php
index 459bb48..8d2bbcc 100644
--- a/src/ContentRepository90/Rules/NodeGetContextPathRector.php
+++ b/src/ContentRepository90/Rules/NodeGetContextPathRector.php
@@ -8,17 +8,16 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeGetContextPathRector extends AbstractRector
+final class NodeGetContextPathRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
public function getRuleDefinition(): RuleDefinition
@@ -41,7 +40,7 @@ public function refactor(Node $node): ?Node
{
assert($node instanceof Node\Expr\MethodCall);
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
+ if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Model\Node::class))) {
return null;
}
if (!$this->isName($node->name, 'getContextPath')) {
diff --git a/src/ContentRepository90/Rules/NodeGetDepthRector.php b/src/ContentRepository90/Rules/NodeGetDepthRector.php
index e232dc9..020ecaa 100644
--- a/src/ContentRepository90/Rules/NodeGetDepthRector.php
+++ b/src/ContentRepository90/Rules/NodeGetDepthRector.php
@@ -1,26 +1,31 @@
>
*/
- public function getNodeTypes() : array
+ public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
+
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node) : ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'getDepth')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getDepth'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Model\Node::class))) {
+ $this->changed = true;
+ $this->nodeVar = $node->var;
+
+ return $this->subgraph_findNodePath_getDepth($node->var);
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::assign('subgraph', $this->this_contentRepositoryRegistry_subgraphForNode($node->var)),
- ],
- $node
- );
+ $node->expr = $newExpr;
- return $this->subgraph_findNodePath_getDepth($node->var);
+ return [
+ self::assign('subgraph', $this->this_contentRepositoryRegistry_subgraphForNode($visitor->nodeVar)),
+ $node
+ ];
}
}
diff --git a/src/ContentRepository90/Rules/NodeGetDimensionsRector.php b/src/ContentRepository90/Rules/NodeGetDimensionsRector.php
index 25e6ffe..b3285b8 100644
--- a/src/ContentRepository90/Rules/NodeGetDimensionsRector.php
+++ b/src/ContentRepository90/Rules/NodeGetDimensionsRector.php
@@ -4,19 +4,27 @@
namespace Neos\Rector\ContentRepository90\Rules;
+use Neos\ContentRepository\Domain\Model\Node as NodeLegacyStub;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\BetterNodeFinder;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeGetDimensionsRector extends AbstractRector
+final class NodeGetDimensionsRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
+ private BetterNodeFinder $betterNodeFinder,
) {
}
@@ -30,30 +38,54 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
public function refactor(Node $node): ?Node
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
- return null;
- }
- if (!$this->isName($node->name, 'getDimensions')) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::todoComment('Try to remove the toLegacyDimensionArray() call and make your codebase more typesafe.')
- ],
- $node
- );
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor($visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getDimensions'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(NodeLegacyStub::class))) {
+ $this->changed = true;
+
+ return $this->node_originDimensionSpacePoint_toLegacyDimensionArray($node->var);
+ }
+ }
+ return null;
+ }
+ });
+
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if ($visitor->changed) {
+ $node->expr = $newExpr;
+ self::withTodoComment('Try to remove the toLegacyDimensionArray() call and make your codebase more typesafe.', $node);
+ return $node;
+ }
- return $this->node_originDimensionSpacePoint_toLegacyDimensionArray($node->var);
+ return null;
}
}
diff --git a/src/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector.php b/src/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector.php
index 88afd33..5eec0ed 100644
--- a/src/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector.php
+++ b/src/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector.php
@@ -6,18 +6,23 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeGetHiddenBeforeAfterDateTimeRector extends AbstractRector
+final class NodeGetHiddenBeforeAfterDateTimeRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
public function getRuleDefinition(): RuleDefinition
@@ -30,47 +35,77 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
public function refactor(Node $node): ?Node
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (
- !$this->isName($node->name, 'getHiddenBeforeDateTime')
- && !$this->isName($node->name, 'setHiddenBeforeDateTime')
- && !$this->isName($node->name, 'getHiddenAfterDateTime')
- && !$this->isName($node->name, 'setHiddenAfterDateTime')
- ) {
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public bool $isGetter = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ $methodNames = ['getHiddenBeforeDateTime', 'setHiddenBeforeDateTime', 'getHiddenAfterDateTime', 'setHiddenAfterDateTime'];
+
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ in_array($node->name->toString(), $methodNames)
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Model\Node::class))) {
+ $this->changed = true;
+ $this->nodeVar = $node->var;
+
+ if ($node->name->toString() === 'getHiddenBeforeDateTime') {
+ $this->isGetter = true;
+ return $this->nodeFactory->createMethodCall($node->var, 'getProperty', ['enableAfterDateTime']);
+ }
+ if ($node->name->toString() === 'getHiddenAfterDateTime') {
+ $this->isGetter = true;
+ return $this->nodeFactory->createMethodCall($node->var, 'getProperty', ['disableAfterDateTime']);
+ }
+ return $node;
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $comment = 'Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details.';
+ $node->expr = $newExpr;
- if ($this->isName($node->name, 'getHiddenBeforeDateTime')) {
- $newNode = $this->nodeFactory->createMethodCall($node->var, 'getProperty', ['enableAfterDateTime']);
- } elseif ($this->isName($node->name, 'getHiddenAfterDateTime')) {
- $newNode = $this->nodeFactory->createMethodCall($node->var, 'getProperty', ['disableAfterDateTime']);
- } else {
- $newNode = $node;
+ $comment = 'Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details.';
+ if ($visitor->isGetter === false) {
$comment .= PHP_EOL . '// Use the "SetNodeProperties" command to change property values for "enableAfterDateTime" or "disableAfterDateTime".';
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::todoComment($comment)
- ],
+ return self::withTodoComment(
+ $comment,
$node
);
-
- return $newNode;
}
}
diff --git a/src/ContentRepository90/Rules/NodeGetIdentifierRector.php b/src/ContentRepository90/Rules/NodeGetIdentifierRector.php
index fab0e18..870f5ae 100644
--- a/src/ContentRepository90/Rules/NodeGetIdentifierRector.php
+++ b/src/ContentRepository90/Rules/NodeGetIdentifierRector.php
@@ -6,18 +6,23 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeGetIdentifierRector extends AbstractRector
+final class NodeGetIdentifierRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector,
- ) {
+ public function __construct()
+ {
}
public function getRuleDefinition(): RuleDefinition
@@ -30,31 +35,63 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
public function refactor(Node $node): ?Node
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'getIdentifier')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getIdentifier'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Model\Node::class))) {
+ $this->changed = true;
+ $this->nodeVar = $node->var;
+
+ $propertyFetchAggregateId = $this->nodeFactory->createPropertyFetch($node->var, 'aggregateId');
+ return $this->nodeFactory->createPropertyFetch($propertyFetchAggregateId, 'value');
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::todoComment('Check if you could change your code to work with the NodeAggregateId value object instead.')
- ],
- $node
- );
+ $node->expr = $newExpr;
- $propertyFetchAggregateId = $this->nodeFactory->createPropertyFetch($node->var, 'aggregateId');
- return $this->nodeFactory->createPropertyFetch($propertyFetchAggregateId, 'value');
+ return
+ self::withTodoComment(
+ 'Check if you could change your code to work with the NodeAggregateId value object instead.',
+ $node
+ );
}
}
diff --git a/src/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector.php b/src/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector.php
index d341321..d3bab31 100644
--- a/src/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector.php
+++ b/src/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector.php
@@ -6,18 +6,23 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeGetNodeTypeGetNameRector extends AbstractRector
+final class NodeGetNodeTypeGetNameRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
public function getRuleDefinition(): RuleDefinition
@@ -30,43 +35,66 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
public function refactor(Node $node): ?Node
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Core\NodeType\NodeType::class))) {
- return null;
- }
- if (!$this->isName($node->name, 'getName')) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$node->var instanceof Node\Expr\MethodCall) {
- return null;
- }
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
- $nodeTypeVar = $node->var;
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ ) {
+ }
- if (!$this->isObjectType($nodeTypeVar->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
- return null;
- }
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getName'
+ ) {
+ // ensure `$something->getNodeType()->getName()` where something is a legacy Node
+ if ($node->var instanceof MethodCall && $node->var->name instanceof Identifier && $node->var->name->toString() === 'getNodeType') {
+ // optional: check that $node->var is NodeType and inner var is Node
+ $isNodeType = $this->nodeTypeResolver->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Core\NodeType\NodeType::class));
+ $isLegacyNode = $this->nodeTypeResolver->isObjectType($node->var->var, new ObjectType(\Neos\ContentRepository\Domain\Model\Node::class));
+ if ($isNodeType && $isLegacyNode) {
+ $this->changed = true;
+ return $this->nodeFactory->createPropertyFetch(
+ $this->nodeFactory->createPropertyFetch(
+ $node->var->var,
+ 'nodeTypeName'
+ ), 'value'
+ );
+ }
+ }
+ }
+ return null;
+ }
+ }
+ );
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
- if (!$this->isName($nodeTypeVar->name, 'getNodeType')) {
+ if (!$visitor->changed) {
return null;
}
- return
- $this->nodeFactory->createPropertyFetch(
- $this->nodeFactory->createPropertyFetch(
- $node->var->var,
- 'nodeTypeName'
- ), 'value'
- );
+ $node->expr = $newExpr;
+ return $node;
}
}
diff --git a/src/ContentRepository90/Rules/NodeGetNodeTypeRector.php b/src/ContentRepository90/Rules/NodeGetNodeTypeRector.php
index b99afa8..8cca299 100644
--- a/src/ContentRepository90/Rules/NodeGetNodeTypeRector.php
+++ b/src/ContentRepository90/Rules/NodeGetNodeTypeRector.php
@@ -6,18 +6,23 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeGetNodeTypeRector extends AbstractRector
+final class NodeGetNodeTypeRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
public function getRuleDefinition(): RuleDefinition
@@ -30,42 +35,71 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node): ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'getNodeType')) {
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getNodeType'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Model\Node::class))) {
+ $this->changed = true;
+ $this->nodeVar = $node->var;
+
+ return $this->nodeFactory->createMethodCall(
+ $this->contentRepository_getNodeTypeManager()
+ , 'getNodeType',
+ [
+ $this->nodeFactory->createPropertyFetch($node->var, 'nodeTypeName')
+ ]);
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::assign(
- 'contentRepository',
- $this->this_contentRepositoryRegistry_get(
- $this->nodeFactory->createPropertyFetch($node->var, 'contentRepositoryId')
- )
- ),
- ],
- $node
- );
-
- return
- $this->nodeFactory->createMethodCall(
- $this->contentRepository_getNodeTypeManager()
- , 'getNodeType',
- [
- $this->nodeFactory->createPropertyFetch($node->var, 'nodeTypeName')
- ]);
+ $node->expr = $newExpr;
+
+ return [
+ self::assign(
+ 'contentRepository',
+ $this->this_contentRepositoryRegistry_get(
+ $this->nodeFactory->createPropertyFetch($visitor->nodeVar, 'contentRepositoryId')
+ )
+ ),
+ $node,
+ ];
}
}
diff --git a/src/ContentRepository90/Rules/NodeGetParentRector.php b/src/ContentRepository90/Rules/NodeGetParentRector.php
index a05627e..cc0b489 100644
--- a/src/ContentRepository90/Rules/NodeGetParentRector.php
+++ b/src/ContentRepository90/Rules/NodeGetParentRector.php
@@ -1,26 +1,32 @@
>
*/
- public function getNodeTypes() : array
+ public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
+
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node) : ?Node
+ public function refactor(Node $node)
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'getParent')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getParent'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(NodeLegacyStub::class))) {
+ $this->changed = true;
+ $this->nodeVar = $node->var;
+
+ return $this->subgraph_findParentNode($node->var);
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::assign('subgraph', $this->this_contentRepositoryRegistry_subgraphForNode($node->var)),
- ],
- $node
- );
+ $node->expr = $newExpr;
- return $this->subgraph_findParentNode($node->var);
+ return [
+ self::assign('subgraph', $this->this_contentRepositoryRegistry_subgraphForNode($visitor->nodeVar)),
+ $node
+ ];
}
}
diff --git a/src/ContentRepository90/Rules/NodeGetPathRector.php b/src/ContentRepository90/Rules/NodeGetPathRector.php
index f5d69f8..0dc4263 100644
--- a/src/ContentRepository90/Rules/NodeGetPathRector.php
+++ b/src/ContentRepository90/Rules/NodeGetPathRector.php
@@ -1,26 +1,35 @@
>
*/
- public function getNodeTypes() : array
+ public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
+
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node) : ?Node
+ public function refactor(Node $node)
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'getPath')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getPath'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(NodeLegacyStub::class))) {
+ $this->changed = true;
+ $this->nodeVar = $node->var;
+
+ return $this->castToString(
+ $this->subgraph_findNodePath($node->var)
+ );
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::assign('subgraph', $this->this_contentRepositoryRegistry_subgraphForNode($node->var)),
- self::todoComment('Try to remove the (string) cast and make your code more type-safe.')
- ],
- $node
- );
-
- return $this->castToString(
- $this->subgraph_findNodePath($node->var)
- );
+ $node->expr = $newExpr;
+
+ return [
+ self::assign(
+ 'subgraph',
+ $this->this_contentRepositoryRegistry_subgraphForNode($visitor->nodeVar)
+ ),
+ self::withTodoComment(
+ 'Try to remove the (string) cast and make your code more type-safe.',
+ $node
+ )
+ ];
}
}
diff --git a/src/ContentRepository90/Rules/NodeGetPropertyNamesRector.php b/src/ContentRepository90/Rules/NodeGetPropertyNamesRector.php
index c7771a3..eb18ad5 100644
--- a/src/ContentRepository90/Rules/NodeGetPropertyNamesRector.php
+++ b/src/ContentRepository90/Rules/NodeGetPropertyNamesRector.php
@@ -4,24 +4,22 @@
namespace Neos\Rector\ContentRepository90\Rules;
+use Neos\ContentRepository\Core\NodeType\NodeType;
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
-use Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub;
+use Neos\ContentRepository\Domain\Model\Node as NodeLegacyStub;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-use Neos\ContentRepository\Core\NodeType\NodeType;
-use PhpParser\NodeDumper;
-final class NodeGetPropertyNamesRector extends AbstractRector
+final class NodeGetPropertyNamesRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
public function getRuleDefinition(): RuleDefinition
@@ -55,7 +53,7 @@ public function refactor(Node $node): ?Node
return
$this->nodeFactory->createFuncCall('array_keys', [
$this->nodeFactory->createFuncCall('iterator_to_array', [
- $this->nodeFactory->createPropertyFetch($node->var, 'properties'),
+ $this->nodeFactory->createPropertyFetch($node->var, 'properties'),
]),
]);
}
diff --git a/src/ContentRepository90/Rules/NodeIsAutoCreatedRector.php b/src/ContentRepository90/Rules/NodeIsAutoCreatedRector.php
index cc5f482..6002771 100644
--- a/src/ContentRepository90/Rules/NodeIsAutoCreatedRector.php
+++ b/src/ContentRepository90/Rules/NodeIsAutoCreatedRector.php
@@ -7,17 +7,16 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeIsAutoCreatedRector extends AbstractRector
+final class NodeIsAutoCreatedRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
public function getRuleDefinition(): RuleDefinition
@@ -40,7 +39,7 @@ public function refactor(Node $node): ?Node
{
assert($node instanceof Node\Expr\MethodCall);
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
+ if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Model\Node::class))) {
return null;
}
if (!$this->isName($node->name, 'isAutoCreated')) {
diff --git a/src/ContentRepository90/Rules/NodeIsHiddenInIndexRector.php b/src/ContentRepository90/Rules/NodeIsHiddenInIndexRector.php
index e446af5..26862ea 100644
--- a/src/ContentRepository90/Rules/NodeIsHiddenInIndexRector.php
+++ b/src/ContentRepository90/Rules/NodeIsHiddenInIndexRector.php
@@ -8,21 +8,19 @@
use PhpParser\Node;
use PhpParser\Node\Expr\MethodCall;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeIsHiddenInIndexRector extends AbstractRector
+final class NodeIsHiddenInIndexRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- )
+ public function __construct()
{
}
- public function getRuleDefinition() : RuleDefinition
+ public function getRuleDefinition(): RuleDefinition
{
return CodeSampleLoader::fromFile('"NodeInterface::isHiddenInIndex()" will be rewritten', __CLASS__);
}
@@ -30,18 +28,19 @@ public function getRuleDefinition() : RuleDefinition
/**
* @return array>
*/
- public function getNodeTypes() : array
+ public function getNodeTypes(): array
{
return [MethodCall::class];
}
+
/**
* @param MethodCall $node
*/
- public function refactor(Node $node) : ?Node
+ public function refactor(Node $node): ?Node
{
assert($node instanceof MethodCall);
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
+ if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Model\Node::class))) {
return null;
}
if (!$this->isName($node->name, 'isHiddenInIndex')) {
diff --git a/src/ContentRepository90/Rules/NodeIsHiddenRector.php b/src/ContentRepository90/Rules/NodeIsHiddenRector.php
index bb7adf8..a404882 100644
--- a/src/ContentRepository90/Rules/NodeIsHiddenRector.php
+++ b/src/ContentRepository90/Rules/NodeIsHiddenRector.php
@@ -1,26 +1,25 @@
>
*/
- public function getNodeTypes() : array
+ public function getNodeTypes(): array
{
return [\PhpParser\Node\Expr\MethodCall::class];
}
+
/**
* @param \PhpParser\Node\Expr\MethodCall $node
*/
- public function refactor(Node $node) : ?Node
+ public function refactor(Node $node): ?Node
{
assert($node instanceof Node\Expr\MethodCall);
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) {
+ if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Model\Node::class))) {
return null;
}
if (!$this->isName($node->name, 'isHidden')) {
diff --git a/src/ContentRepository90/Rules/NodeLabelGeneratorRector.php b/src/ContentRepository90/Rules/NodeLabelGeneratorRector.php
index d5e627c..095692f 100644
--- a/src/ContentRepository90/Rules/NodeLabelGeneratorRector.php
+++ b/src/ContentRepository90/Rules/NodeLabelGeneratorRector.php
@@ -1,27 +1,26 @@
getLabel()" will be rewritten.', __CLASS__);
}
@@ -29,14 +28,15 @@ public function getRuleDefinition() : RuleDefinition
/**
* @return array>
*/
- public function getNodeTypes() : array
+ public function getNodeTypes(): array
{
return [Node\Expr\MethodCall::class];
}
+
/**
* @param Node\Expr\MethodCall $node
*/
- public function refactor(Node $node) : ?Node
+ public function refactor(Node $node): ?Node
{
assert($node instanceof Node\Expr\MethodCall);
diff --git a/src/ContentRepository90/Rules/NodeSearchServiceRector.php b/src/ContentRepository90/Rules/NodeSearchServiceRector.php
index ae00cbe..f31b659 100644
--- a/src/ContentRepository90/Rules/NodeSearchServiceRector.php
+++ b/src/ContentRepository90/Rules/NodeSearchServiceRector.php
@@ -6,18 +6,24 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\Node\Stmt\Nop;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeSearchServiceRector extends AbstractRector
+final class NodeSearchServiceRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
public function getRuleDefinition(): RuleDefinition
@@ -30,95 +36,120 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node): ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (
- !$this->isObjectType($node->var, new ObjectType(\Neos\Neos\Domain\Service\NodeSearchService::class))
- && !$this->isObjectType($node->var, new ObjectType(\Neos\Neos\Domain\Service\NodeSearchServiceInterface::class))
- ) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'findByProperties')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public bool $hasStartingPoint = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'findByProperties'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(\Neos\Neos\Domain\Service\NodeSearchService::class))
+ || $this->nodeTypeResolver->isObjectType($node->var, new ObjectType(\Neos\Neos\Domain\Service\NodeSearchServiceInterface::class))
+ ) {
+ $this->changed = true;
+
+ if (isset($node->args[3])) {
+ $this->hasStartingPoint = true;
+ $this->nodeVar = $node->args[3]->value;
+ } else {
+ $this->nodeVar = new Node\Expr\Variable('node');
+ }
+
+ return $this->nodeFactory->createMethodCall(
+ 'subgraph',
+ 'findDescendantNodes',
+ [
+ $this->nodeFactory->createPropertyFetch(
+ $this->nodeVar,
+ 'aggregateId'
+ ),
+ $this->nodeFactory->createStaticCall(
+ \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindDescendantNodesFilter::class,
+ 'create',
+ [
+ 'nodeTypes' => $this->nodeFactory->createStaticCall(
+ \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\NodeType\NodeTypeCriteria::class,
+ 'create',
+ [
+ $this->nodeFactory->createStaticCall(
+ \Neos\ContentRepository\Core\NodeType\NodeTypeNames::class,
+ 'fromStringArray',
+ [
+ $node->args[1]->value,
+ ]
+ ),
+ $this->nodeFactory->createStaticCall(
+ \Neos\ContentRepository\Core\NodeType\NodeTypeNames::class,
+ 'createEmpty',
+ ),
+ ]
+ ),
+ 'searchTerm' => $node->args[0]->value,
+ ]
+ )
+ ]
+ );
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- if (!isset($node->args[3])) {
- $nodeExpr = self::assign('node', new \PhpParser\Node\Scalar\String_('we-need-a-node-here'));
- $nodeNode = $nodeExpr->expr->var;
-
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::withTodoComment('The replacement needs a node as starting point for the search. Please provide a node, to make this replacement working.', $nodeExpr),
- $subgraphNode = self::assign('subgraph', $this->this_contentRepositoryRegistry_subgraphForNode($nodeNode)),
- ],
- $node
- );
-
- } else {
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::withTodoComment('This could be a suitable replacement. Please check if all your requirements are still fulfilled.',
- $subgraphNode = self::assign('subgraph', $this->this_contentRepositoryRegistry_subgraphForNode($node->args[3]->value))
- )
- ],
- $node
-
- );
- $nodeNode = $node->args[3]->value;
+ $node->expr = $newExpr;
+ if (!$visitor->hasStartingPoint) {
+ return [
+ new Nop(), // Needed, to render the comment below
+ self::withTodoComment(
+ 'The replacement needs a node as starting point for the search. Please provide a node, to make this replacement working.',
+ self::assign($visitor->nodeVar->name, new \PhpParser\Node\Scalar\String_('we-need-a-node-here')),
+ ),
+ self::assign('subgraph', $this->this_contentRepositoryRegistry_subgraphForNode($visitor->nodeVar)),
+ $node,
+ ];
}
- return $this->nodeFactory->createMethodCall(
- $subgraphNode->expr->var,
- 'findDescendantNodes',
- [
- $this->nodeFactory->createPropertyFetch(
- $nodeNode,
- 'aggregateId'
- ),
- $this->nodeFactory->createStaticCall(
- \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindDescendantNodesFilter::class,
- 'create',
- [
- 'nodeTypes' => $this->nodeFactory->createStaticCall(
- \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\NodeType\NodeTypeCriteria::class,
- 'create',
- [
- $this->nodeFactory->createStaticCall(
- \Neos\ContentRepository\Core\NodeType\NodeTypeNames::class,
- 'fromStringArray',
- [
- $node->args[1]->value,
- ]
- ),
- $this->nodeFactory->createStaticCall(
- \Neos\ContentRepository\Core\NodeType\NodeTypeNames::class,
- 'createEmpty',
- ),
- ]
- ),
- 'searchTerm' => $node->args[0]->value,
- ]
- )
- ]
- );
+ return [
+ new Nop(), // Needed, to render the comment below
+ self::withTodoComment(
+ 'This could be a suitable replacement. Please check if all your requirements are still fulfilled.',
+ self::assign('subgraph', $this->this_contentRepositoryRegistry_subgraphForNode($visitor->nodeVar)),
+ ),
+ $node,
+ ];
}
}
-/**
- * \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindDescendantNodesFilter::create(
- * nodeTypes: \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\NodeType\NodeTypeCriteria::create(
- * \Neos\ContentRepository\Core\NodeType\NodeTypeNames::fromStringArray($searchNodeTypes),
- * \Neos\ContentRepository\Core\NodeType\NodeTypeNames::createEmpty()
- * ),
- * searchTerm: $term
- * )
- */
diff --git a/src/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector.php b/src/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector.php
index c16cfdb..5947b63 100644
--- a/src/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector.php
+++ b/src/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector.php
@@ -7,18 +7,24 @@
use Neos\ContentRepository\Core\NodeType\NodeType;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\Node\Stmt\Nop;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeTypeAllowsGrandchildNodeTypeRector extends AbstractRector
+final class NodeTypeAllowsGrandchildNodeTypeRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
public function getRuleDefinition(): RuleDefinition
@@ -31,54 +37,84 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node): ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(NodeType::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'allowsGrandchildNodeType')) {
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'allowsGrandchildNodeType'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(NodeType::class))) {
+ $this->changed = true;
+
+ return $this->nodeFactory->createMethodCall(
+ $this->contentRepository_getNodeTypeManager(),
+ 'isNodeTypeAllowedAsChildToTetheredNode',
+ [
+ $this->nodeFactory->createPropertyFetch(
+ $node->var,
+ 'name'
+ ),
+ $this->nodeFactory->createStaticCall(
+ \Neos\ContentRepository\Core\SharedModel\Node\NodeName::class,
+ 'fromString',
+ [
+ $node->args[0]
+ ]
+ ),
+ $this->nodeFactory->createPropertyFetch(
+ $node->args[1]->value,
+ 'name'
+ )
+ ]
+ );
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::withTodoComment(
- 'Make this code aware of multiple Content Repositories.',
- self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))),
- )
- ],
+ $node->expr = $newExpr;
+
+ return [
+ new Nop(), // Needed, to render the comment below
+ self::withTodoComment(
+ 'Make this code aware of multiple Content Repositories.',
+ self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))),
+ ),
$node
- );
-
- return $this->nodeFactory->createMethodCall(
- $this->contentRepository_getNodeTypeManager(),
- 'isNodeTypeAllowedAsChildToTetheredNode',
- [
- $this->nodeFactory->createPropertyFetch(
- $node->var,
- 'name'
- ),
- $this->nodeFactory->createStaticCall(
- \Neos\ContentRepository\Core\SharedModel\Node\NodeName::class,
- 'fromString',
- [
- $node->args[0]
- ]
- ),
- $this->nodeFactory->createPropertyFetch(
- $node->args[1]->value,
- 'name'
- )
- ]
- );
+ ];
}
}
diff --git a/src/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector.php b/src/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector.php
index 84077d6..cefc546 100644
--- a/src/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector.php
+++ b/src/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector.php
@@ -1,27 +1,32 @@
getAutoCreatedChildNodes()" will be rewritten.', __CLASS__);
}
@@ -29,37 +34,66 @@ public function getRuleDefinition() : RuleDefinition
/**
* @return array>
*/
- public function getNodeTypes() : array
+ public function getNodeTypes(): array
{
- return [Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
+
/**
- * @param Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node) : ?Node
+ public function refactor(Node $node): ?Node
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(NodeType::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'getAutoCreatedChildNodes')) {
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getAutoCreatedChildNodes'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(NodeType::class))) {
+ $this->changed = true;
+
+ return $this->nodeFactory->createPropertyFetch(
+ $node->var,
+ 'tetheredNodeTypeDefinitions'
+ );
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::todoComment(
- 'NodeType::tetheredNodeTypeDefinitions() is not a 1:1 replacement of NodeType::getAutoCreatedChildNodes(). You need to change your code to work with new TetheredNodeTypeDefinition object.',
- )
- ],
- $node
- );
-
- return $this->nodeFactory->createPropertyFetch(
- $node->var,
- 'tetheredNodeTypeDefinitions'
- );
+ $node->expr = $newExpr;
+
+ return
+ self::withTodoComment(
+ 'NodeType::tetheredNodeTypeDefinitions() is not a 1:1 replacement of NodeType::getAutoCreatedChildNodes(). You need to change your code to work with new TetheredNodeTypeDefinition object.',
+ $node
+ );
}
}
diff --git a/src/ContentRepository90/Rules/NodeTypeGetNameRector.php b/src/ContentRepository90/Rules/NodeTypeGetNameRector.php
index 0deac54..c0e1728 100644
--- a/src/ContentRepository90/Rules/NodeTypeGetNameRector.php
+++ b/src/ContentRepository90/Rules/NodeTypeGetNameRector.php
@@ -7,17 +7,16 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeTypeGetNameRector extends AbstractRector
+final class NodeTypeGetNameRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
public function getRuleDefinition(): RuleDefinition
diff --git a/src/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector.php b/src/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector.php
index ce29ba4..0b2d083 100644
--- a/src/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector.php
+++ b/src/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector.php
@@ -7,18 +7,24 @@
use Neos\ContentRepository\Core\NodeType\NodeType;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\Node\Stmt\Nop;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class NodeTypeGetTypeOfAutoCreatedChildNodeRector extends AbstractRector
+final class NodeTypeGetTypeOfAutoCreatedChildNodeRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
public function getRuleDefinition(): RuleDefinition
@@ -31,46 +37,75 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node): ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(NodeType::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'getTypeOfAutoCreatedChildNode')) {
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getTypeOfAutoCreatedChildNode'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(NodeType::class))) {
+ $this->changed = true;
+
+ return $this->nodeFactory->createMethodCall(
+ $this->contentRepository_getNodeTypeManager(),
+ 'getNodeType',
+ [$this->nodeFactory->createMethodCall(
+ $this->nodeFactory->createPropertyFetch(
+ $node->var,
+ 'tetheredNodeTypeDefinitions'
+ ),
+ 'get',
+ $node->args
+ )]
+ );
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::withTodoComment(
- 'Make this code aware of multiple Content Repositories. If you have a Node object around you can use $node->contentRepositoryId.',
- self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))),
- )
- ],
- $node
- );
-
- return
- $this->nodeFactory->createMethodCall(
- $this->contentRepository_getNodeTypeManager(),
- 'getNodeType',
- [$this->nodeFactory->createMethodCall(
- $this->nodeFactory->createPropertyFetch(
- $node->var,
- 'tetheredNodeTypeDefinitions'
- ),
- 'get',
- $node->args
- )]
- );
+ $node->expr = $newExpr;
+
+ return [
+ new Nop(), // Needed, to render the comment below
+ self::withTodoComment(
+ 'Make this code aware of multiple Content Repositories. If you have a Node object around you can use $node->contentRepositoryId.',
+ self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))),
+ ),
+ $node,
+ ];
}
}
diff --git a/src/ContentRepository90/Rules/NodeTypeManagerAccessRector.php b/src/ContentRepository90/Rules/NodeTypeManagerAccessRector.php
index b403b7b..d8d5f05 100644
--- a/src/ContentRepository90/Rules/NodeTypeManagerAccessRector.php
+++ b/src/ContentRepository90/Rules/NodeTypeManagerAccessRector.php
@@ -1,26 +1,30 @@
nodeTypeManager" will be rewritten.', __CLASS__);
}
@@ -28,31 +32,69 @@ public function getRuleDefinition() : RuleDefinition
/**
* @return array>
*/
- public function getNodeTypes() : array
+ public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\PropertyFetch::class];
+ return [Node\Stmt::class];
}
+
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node) : ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\PropertyFetch);
-
- if (!$this->isObjectType($node, new ObjectType(\Neos\ContentRepository\Domain\Service\NodeTypeManager::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor($visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof PropertyFetch
+ ) {
+ $this->nodeVar = $node;
+ if ($this->nodeTypeResolver->isObjectType($this->nodeVar, new ObjectType(\Neos\ContentRepository\Domain\Service\NodeTypeManager::class))) {
+ $this->changed = true;
+
+ return $this->contentRepository_getNodeTypeManager();
+ }
+ }
+
+ return null;
+ }
+ });
+
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if ($visitor->changed) {
+ $node->expr = $newExpr;
+
+ $contentRepository = self::assign(
+ 'contentRepository',
+ $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))
+ );
+
+ return [
self::withTodoComment(
'Make this code aware of multiple Content Repositories.',
- self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))),
- )
- ],
- $node
- );
+ new Node\Stmt\Nop(),
+ ),
+ $contentRepository,
+ $node
+ ];
+ }
- return $this->contentRepository_getNodeTypeManager();
+ return null;
}
}
diff --git a/src/ContentRepository90/Rules/Traits/ContentRepositoryTrait.php b/src/ContentRepository90/Rules/Traits/ContentRepositoryTrait.php
index 46cda49..234e64a 100644
--- a/src/ContentRepository90/Rules/Traits/ContentRepositoryTrait.php
+++ b/src/ContentRepository90/Rules/Traits/ContentRepositoryTrait.php
@@ -5,15 +5,11 @@
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Variable;
-use PhpParser\Node\Identifier;
-use PhpParser\Node\Name\FullyQualified;
+use Rector\PhpParser\Node\NodeFactory;
trait ContentRepositoryTrait
{
- /**
- * @var \Rector\Core\PhpParser\Node\NodeFactory
- */
- protected $nodeFactory;
+ protected NodeFactory $nodeFactory;
private function contentRepository_findWorkspaceByName(Expr $workspaceName)
{
diff --git a/src/ContentRepository90/Rules/Traits/DimensionSpacePointsTrait.php b/src/ContentRepository90/Rules/Traits/DimensionSpacePointsTrait.php
index d5f5153..f203ee4 100644
--- a/src/ContentRepository90/Rules/Traits/DimensionSpacePointsTrait.php
+++ b/src/ContentRepository90/Rules/Traits/DimensionSpacePointsTrait.php
@@ -8,19 +8,16 @@
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Param;
+use PhpParser\Node\Name\FullyQualified;
+use Rector\PhpParser\Node\NodeFactory;
trait DimensionSpacePointsTrait
{
use FunctionsTrait;
- /**
- * @var \Rector\Core\PhpParser\Node\NodeFactory
- */
- protected $nodeFactory;
+ protected NodeFactory $nodeFactory;
-
- private function dimensionSpacePoints_toLegacyDimensionArray(
- ): Expr
+ private function dimensionSpacePoints_toLegacyDimensionArray(): Expr
{
return $this->nodeFactory->createFuncCall(
'array_map',
@@ -30,7 +27,7 @@ private function dimensionSpacePoints_toLegacyDimensionArray(
new Param(
new Variable('dimensionSpacePoint'),
null,
- '\\' . DimensionSpacePoint::class
+ new FullyQualified(DimensionSpacePoint::class)
)
],
'expr' => $this->nodeFactory->createMethodCall('dimensionSpacePoint', 'toLegacyDimensionArray')
diff --git a/src/ContentRepository90/Rules/Traits/NodeTrait.php b/src/ContentRepository90/Rules/Traits/NodeTrait.php
index a649f9e..0f88376 100644
--- a/src/ContentRepository90/Rules/Traits/NodeTrait.php
+++ b/src/ContentRepository90/Rules/Traits/NodeTrait.php
@@ -4,14 +4,11 @@
namespace Neos\Rector\ContentRepository90\Rules\Traits;
use PhpParser\Node\Expr;
-use PhpParser\Node\Expr\Variable;
+use Rector\PhpParser\Node\NodeFactory;
trait NodeTrait
{
- /**
- * @var \Rector\Core\PhpParser\Node\NodeFactory
- */
- protected $nodeFactory;
+ protected NodeFactory $nodeFactory;
private function node_nodeAggregateId(Expr $nodeVariable): Expr
{
diff --git a/src/ContentRepository90/Rules/Traits/SubgraphTrait.php b/src/ContentRepository90/Rules/Traits/SubgraphTrait.php
index 96334c7..be9ff16 100644
--- a/src/ContentRepository90/Rules/Traits/SubgraphTrait.php
+++ b/src/ContentRepository90/Rules/Traits/SubgraphTrait.php
@@ -5,17 +5,13 @@
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter;
use PhpParser\Node\Expr;
-use PhpParser\Node\Expr\Variable;
+use Rector\PhpParser\Node\NodeFactory;
trait SubgraphTrait
{
use NodeTrait;
- /**
- * @var \Rector\Core\PhpParser\Node\NodeFactory
- */
- protected $nodeFactory;
-
+ protected NodeFactory $nodeFactory;
private function subgraph_findChildNodes(
Expr $nodeVariable,
@@ -54,7 +50,7 @@ private function subgraph_findChildNodes(
);
}
- private function subgraph_findNodePath(Variable $nodeVariable): Expr
+ private function subgraph_findNodePath(Expr $nodeVariable): Expr
{
return $this->nodeFactory->createMethodCall(
'subgraph',
@@ -65,7 +61,7 @@ private function subgraph_findNodePath(Variable $nodeVariable): Expr
);
}
- private function subgraph_findNodePath_getDepth(Variable $nodeVariable): Expr
+ private function subgraph_findNodePath_getDepth(Expr $nodeVariable): Expr
{
return $this->nodeFactory->createMethodCall(
$this->subgraph_findNodePath($nodeVariable),
@@ -84,7 +80,7 @@ private function subgraph_findNodeById(Expr $nodeAggregateIdentifier)
);
}
- private function subgraph_findParentNode(Variable $nodeVariable): Expr
+ private function subgraph_findParentNode(Expr $nodeVariable): Expr
{
return $this->nodeFactory->createMethodCall(
'subgraph',
diff --git a/src/ContentRepository90/Rules/Traits/ThisTrait.php b/src/ContentRepository90/Rules/Traits/ThisTrait.php
index 79c42f2..1a0572f 100644
--- a/src/ContentRepository90/Rules/Traits/ThisTrait.php
+++ b/src/ContentRepository90/Rules/Traits/ThisTrait.php
@@ -4,14 +4,11 @@
namespace Neos\Rector\ContentRepository90\Rules\Traits;
use PhpParser\Node\Expr;
-use PhpParser\Node\Expr\Variable;
+use Rector\PhpParser\Node\NodeFactory;
trait ThisTrait
{
- /**
- * @var \Rector\Core\PhpParser\Node\NodeFactory
- */
- protected $nodeFactory;
+ protected NodeFactory $nodeFactory;
private function this_contentRepositoryRegistry_subgraphForNode(Expr $nodeVariable): Expr
{
diff --git a/src/ContentRepository90/Rules/Traits/ValueObjectTrait.php b/src/ContentRepository90/Rules/Traits/ValueObjectTrait.php
index fb15381..fc3317b 100644
--- a/src/ContentRepository90/Rules/Traits/ValueObjectTrait.php
+++ b/src/ContentRepository90/Rules/Traits/ValueObjectTrait.php
@@ -9,14 +9,12 @@
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use PhpParser\Node\Expr;
use PhpParser\Node\Scalar\String_;
+use Rector\PhpParser\Node\NodeFactory;
trait ValueObjectTrait
{
- /**
- * @var \Rector\Core\PhpParser\Node\NodeFactory
- */
- protected $nodeFactory;
+ protected NodeFactory $nodeFactory;
private function contentRepositoryId_fromString(string $contentRepositoryName)
{
diff --git a/src/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector.php b/src/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector.php
index 59e51ca..d9d39ac 100644
--- a/src/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector.php
+++ b/src/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector.php
@@ -6,19 +6,24 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\Variable;
+use PhpParser\Node\Identifier;
+use PhpParser\Node\Stmt\Nop;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class WorkspaceGetBaseWorkspaceRector extends AbstractRector
+final class WorkspaceGetBaseWorkspaceRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector,
- )
+ public function __construct()
{
}
@@ -32,38 +37,68 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node): ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Core\SharedModel\Workspace\Workspace::class))) {
- return null;
- }
- if (!$this->isName($node->name, 'getBaseWorkspace')) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::withTodoComment('Check if you could change your code to work with the WorkspaceName value object instead and make this code aware of multiple Content Repositories.',
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor($visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getBaseWorkspace'
+ ) {
+ $this->nodeVar = $node->var;
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Core\SharedModel\Workspace\Workspace::class))) {
+ $this->changed = true;
+
+ return $this->nodeFactory->createMethodCall(
+ new Variable('contentRepository'),
+ 'findWorkspaceByName',
+ [$this->nodeFactory->createPropertyFetch($node->var, 'baseWorkspaceName')]
+ );
+ }
+ }
+
+ return null;
+ }
+ });
+
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if ($visitor->changed) {
+ $node->expr = $newExpr;
+
+ return [
+ new Nop(), // Needed, to render the comment below
+ self::withTodoComment(
+ 'Check if you could change your code to work with the WorkspaceName value object instead and make this code aware of multiple Content Repositories.',
self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))),
- )
- ],
- $node
- );
-
-
- return
- $this->nodeFactory->createMethodCall(
- new Variable('contentRepository'),
- 'findWorkspaceByName',
- [$this->nodeFactory->createPropertyFetch($node->var, 'baseWorkspaceName')]
- );
+ ),
+ $node,
+ ];
+ }
+
+ return null;
}
}
diff --git a/src/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector.php b/src/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector.php
index b2fe107..1532cb2 100644
--- a/src/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector.php
+++ b/src/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector.php
@@ -4,21 +4,27 @@
namespace Neos\Rector\ContentRepository90\Rules;
+use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\Variable;
+use PhpParser\Node\Identifier;
+use PhpParser\Node\Stmt\Nop;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class WorkspaceGetBaseWorkspacesRector extends AbstractRector
+final class WorkspaceGetBaseWorkspacesRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector,
- )
+ public function __construct()
{
}
@@ -32,41 +38,71 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node): ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Core\SharedModel\Workspace\Workspace::class))) {
- return null;
- }
- if (!$this->isName($node->name, 'getBaseWorkspaces')) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::withTodoComment('Check if you could change your code to work with the WorkspaceName value object instead and make this code aware of multiple Content Repositories.',
- self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))),
- )
- ],
- $node
- );
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor($visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getBaseWorkspaces'
+ ) {
+ $this->nodeVar = $node->var;
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ $this->changed = true;
+ return $this->nodeFactory->createMethodCall(
+ $this->nodeFactory->createMethodCall(
+ new Variable('contentRepository'),
+ 'findWorkspaces'
+ ),
+ 'getBaseWorkspaces',
+ [$this->nodeFactory->createPropertyFetch($node->var, 'workspaceName')]
+ );
+ }
+ }
- return
- $this->nodeFactory->createMethodCall(
- $this->nodeFactory->createMethodCall(
- new Variable('contentRepository'),
- 'findWorkspaces'
+ return null;
+ }
+ });
+
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if ($visitor->changed) {
+ $node->expr = $newExpr;
+
+ return [
+ new Nop(), // Needed, to render the comment below
+ self::withTodoComment(
+ 'Check if you could change your code to work with the WorkspaceName value object instead and make this code aware of multiple Content Repositories.',
+ self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))),
),
- 'getBaseWorkspaces',
- [$this->nodeFactory->createPropertyFetch($node->var, 'workspaceName')]
- );
+ $node,
+ ];
+ }
+
+ return null;
}
}
diff --git a/src/ContentRepository90/Rules/WorkspaceGetDescriptionRector.php b/src/ContentRepository90/Rules/WorkspaceGetDescriptionRector.php
index 0db925c..d19a4c0 100644
--- a/src/ContentRepository90/Rules/WorkspaceGetDescriptionRector.php
+++ b/src/ContentRepository90/Rules/WorkspaceGetDescriptionRector.php
@@ -4,22 +4,25 @@
namespace Neos\Rector\ContentRepository90\Rules;
+use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
-use PhpParser\Node\Expr\Variable;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
-final class WorkspaceGetDescriptionRector extends AbstractRector
+final class WorkspaceGetDescriptionRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector,
- )
+ public function __construct()
{
}
@@ -33,39 +36,68 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
public function refactor(Node $node): ?Node
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'getDescription')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getDescription'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ $this->changed = true;
+
+ return $this->nodeFactory->createPropertyFetch(
+ $this->nodeFactory->createPropertyFetch(
+ $this->this_workspaceService_getWorkspaceMetadata(
+ $this->contentRepositoryId_fromString('default'),
+ $this->nodeFactory->createPropertyFetch($node->var, 'workspaceName')
+ ),
+ 'description',
+ ), 'value'
+ );
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::todoComment('Make this code aware of multiple Content Repositories.')
- ],
+ $node->expr = $newExpr;
+
+ return self::withTodoComment(
+ 'Make this code aware of multiple Content Repositories.',
$node
);
-
- return
- $this->nodeFactory->createPropertyFetch(
- $this->nodeFactory->createPropertyFetch(
- $this->this_workspaceService_getWorkspaceMetadata(
- $this->contentRepositoryId_fromString('default'),
- $this->nodeFactory->createPropertyFetch($node->var, 'workspaceName')
- ),
- 'description',
- ), 'value'
- );
}
}
diff --git a/src/ContentRepository90/Rules/WorkspaceGetNameRector.php b/src/ContentRepository90/Rules/WorkspaceGetNameRector.php
index 3df578b..40f5c8a 100644
--- a/src/ContentRepository90/Rules/WorkspaceGetNameRector.php
+++ b/src/ContentRepository90/Rules/WorkspaceGetNameRector.php
@@ -4,21 +4,25 @@
namespace Neos\Rector\ContentRepository90\Rules;
+use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
-final class WorkspaceGetNameRector extends AbstractRector
+final class WorkspaceGetNameRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector,
- )
+ public function __construct()
{
}
@@ -32,31 +36,61 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
public function refactor(Node $node): ?Node
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'getName')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getName'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ $this->changed = true;
+
+ $propertyFetchAggregateId = $this->nodeFactory->createPropertyFetch($node->var, 'workspaceName');
+ return $this->nodeFactory->createPropertyFetch($propertyFetchAggregateId, 'value');
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::todoComment('Check if you could change your code to work with the WorkspaceName value object instead.')
- ],
+ $node->expr = $newExpr;
+
+ return self::withTodoComment(
+ 'Check if you could change your code to work with the WorkspaceName value object instead.',
$node
);
-
- $propertyFetchAggregateId = $this->nodeFactory->createPropertyFetch($node->var, 'workspaceName');
- return $this->nodeFactory->createPropertyFetch($propertyFetchAggregateId, 'value');
}
}
diff --git a/src/ContentRepository90/Rules/WorkspaceGetTitleRector.php b/src/ContentRepository90/Rules/WorkspaceGetTitleRector.php
index 642bec2..c63af74 100644
--- a/src/ContentRepository90/Rules/WorkspaceGetTitleRector.php
+++ b/src/ContentRepository90/Rules/WorkspaceGetTitleRector.php
@@ -4,22 +4,25 @@
namespace Neos\Rector\ContentRepository90\Rules;
+use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
-use PhpParser\Node\Expr\Variable;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
-final class WorkspaceGetTitleRector extends AbstractRector
+final class WorkspaceGetTitleRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector,
- )
+ public function __construct()
{
}
@@ -33,39 +36,68 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
public function refactor(Node $node): ?Node
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'getTitle')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'getTitle'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ $this->changed = true;
+
+ return $this->nodeFactory->createPropertyFetch(
+ $this->nodeFactory->createPropertyFetch(
+ $this->this_workspaceService_getWorkspaceMetadata(
+ $this->contentRepositoryId_fromString('default'),
+ $this->nodeFactory->createPropertyFetch($node->var, 'workspaceName')
+ ),
+ 'title',
+ ), 'value'
+ );
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::todoComment('Make this code aware of multiple Content Repositories.')
- ],
+ $node->expr = $newExpr;
+
+ return self::withTodoComment(
+ 'Make this code aware of multiple Content Repositories.',
$node
);
-
- return
- $this->nodeFactory->createPropertyFetch(
- $this->nodeFactory->createPropertyFetch(
- $this->this_workspaceService_getWorkspaceMetadata(
- $this->contentRepositoryId_fromString('default'),
- $this->nodeFactory->createPropertyFetch($node->var, 'workspaceName')
- ),
- 'title',
- ), 'value'
- );
}
}
diff --git a/src/ContentRepository90/Rules/WorkspacePublishNodeRector.php b/src/ContentRepository90/Rules/WorkspacePublishNodeRector.php
index c34348d..b5c2011 100644
--- a/src/ContentRepository90/Rules/WorkspacePublishNodeRector.php
+++ b/src/ContentRepository90/Rules/WorkspacePublishNodeRector.php
@@ -4,22 +4,25 @@
namespace Neos\Rector\ContentRepository90\Rules;
+use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
-use PhpParser\Node\Expr\Variable;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
-final class WorkspacePublishNodeRector extends AbstractRector
+final class WorkspacePublishNodeRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector,
- )
+ public function __construct()
{
}
@@ -33,39 +36,68 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
public function refactor(Node $node): ?Node
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'publishNode')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'publishNode'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ $this->changed = true;
+
+ return $this->nodeFactory->createMethodCall(
+ $this->this_workspacePublishingService(),
+ 'publishChangesInDocument',
+ [
+ $this->contentRepositoryId_fromString('default'),
+ $this->nodeFactory->createPropertyFetch($node->var, 'workspaceName'),
+ $node->args[0]
+ ]
+ );
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::todoComment('Check if this matches your requirements as this is not a 100% replacement. Make this code aware of multiple Content Repositories.')
- ],
+ $node->expr = $newExpr;
+
+ return self::withTodoComment(
+ 'Check if this matches your requirements as this is not a 100% replacement. Make this code aware of multiple Content Repositories.',
$node
);
-
- return
- $this->nodeFactory->createMethodCall(
- $this->this_workspacePublishingService(),
- 'publishChangesInDocument',
- [
- $this->contentRepositoryId_fromString('default'),
- $this->nodeFactory->createPropertyFetch($node->var, 'workspaceName'),
- $node->args[0]
- ]
- );
}
}
diff --git a/src/ContentRepository90/Rules/WorkspacePublishRector.php b/src/ContentRepository90/Rules/WorkspacePublishRector.php
index a613364..dd10170 100644
--- a/src/ContentRepository90/Rules/WorkspacePublishRector.php
+++ b/src/ContentRepository90/Rules/WorkspacePublishRector.php
@@ -4,22 +4,25 @@
namespace Neos\Rector\ContentRepository90\Rules;
+use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
-use PhpParser\Node\Expr\Variable;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
-final class WorkspacePublishRector extends AbstractRector
+final class WorkspacePublishRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector,
- )
+ public function __construct()
{
}
@@ -33,38 +36,67 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
public function refactor(Node $node): ?Node
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'publish')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'publish'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ $this->changed = true;
+
+ return $this->nodeFactory->createMethodCall(
+ $this->this_workspacePublishingService(),
+ 'publishWorkspace',
+ [
+ $this->contentRepositoryId_fromString('default'),
+ $this->nodeFactory->createPropertyFetch($node->var, 'workspaceName')
+ ]
+ );
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::todoComment('Make this code aware of multiple Content Repositories.')
- ],
+ $node->expr = $newExpr;
+
+ return self::withTodoComment(
+ 'Make this code aware of multiple Content Repositories.',
$node
);
-
- return
- $this->nodeFactory->createMethodCall(
- $this->this_workspacePublishingService(),
- 'publishWorkspace',
- [
- $this->contentRepositoryId_fromString('default'),
- $this->nodeFactory->createPropertyFetch($node->var, 'workspaceName')
- ]
- );
}
}
diff --git a/src/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector.php b/src/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector.php
index ae0c29c..9ef72fc 100644
--- a/src/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector.php
+++ b/src/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector.php
@@ -7,18 +7,23 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
use PhpParser\Node\Expr;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class WorkspaceRepositoryCountByNameRector extends AbstractRector
+final class WorkspaceRepositoryCountByNameRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
@@ -32,39 +37,70 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node): ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Repository\WorkspaceRepository::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'countByName')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'countByName'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Repository\WorkspaceRepository::class))) {
+ $this->changed = true;
+
+ return new Node\Expr\Ternary(
+ new Node\Expr\BinaryOp\NotIdentical(
+ $this->contentRepository_findWorkspaceByName($this->workspaceName_fromString($node->args[0]->value)),
+ new Expr\ConstFetch(new Node\Name('null'))
+ ),
+ new Node\Scalar\LNumber(1),
+ new Node\Scalar\LNumber(0)
+ );
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
+ $node->expr = $newExpr;
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))),
- self::todoComment('remove ternary operator (...? 1 : 0 ) - unnecessary complexity',)
- ],
- $node
- );
-
- return new Node\Expr\Ternary(
- new Node\Expr\BinaryOp\NotIdentical(
- $this->contentRepository_findWorkspaceByName($this->workspaceName_fromString($node->args[0]->value)),
- new Expr\ConstFetch(new Node\Name('null'))
+ return [
+ self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))),
+ self::withTodoComment(
+ 'remove ternary operator (...? 1 : 0 ) - unnecessary complexity',
+ $node
),
- new Node\Scalar\LNumber(1),
- new Node\Scalar\LNumber(0)
- );
+ ];
}
}
diff --git a/src/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector.php b/src/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector.php
index 49741a4..27043a4 100644
--- a/src/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector.php
+++ b/src/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector.php
@@ -6,19 +6,24 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\Variable;
+use PhpParser\Node\Identifier;
+use PhpParser\Node\Stmt\Nop;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class WorkspaceRepositoryFindByBaseWorkspaceRector extends AbstractRector
+final class WorkspaceRepositoryFindByBaseWorkspaceRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- )
+ public function __construct()
{
}
@@ -33,43 +38,74 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node): ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Repository\WorkspaceRepository::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'findByBaseWorkspace')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'findByBaseWorkspace'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Repository\WorkspaceRepository::class))) {
+ $this->changed = true;
+
+ return $this->nodeFactory->createMethodCall(
+ $this->nodeFactory->createMethodCall(
+ new Variable('contentRepository'),
+ 'findWorkspaces',
+ []
+ ),
+ 'getDependantWorkspaces',
+ [
+ $this->workspaceName_fromString($node->args[0]->value)
+ ]
+ );
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
+ $node->expr = $newExpr;
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::withTodoComment(
- 'Make this code aware of multiple Content Repositories.',
- self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default')))),
- ],
- $node
- );
-
- return $this->nodeFactory->createMethodCall(
- $this->nodeFactory->createMethodCall(
- new Variable('contentRepository'),
- 'findWorkspaces',
- []
+ return [
+ new Nop(), // Needed, to render the comment below
+ self::withTodoComment(
+ 'Make this code aware of multiple Content Repositories.',
+ self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))),
),
- 'getDependantWorkspaces',
- [
- $this->workspaceName_fromString($node->args[0]->value)
- ]
- );
+ $node,
+ ];
}
}
diff --git a/src/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector.php b/src/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector.php
index 139d36d..67bb2b6 100644
--- a/src/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector.php
+++ b/src/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector.php
@@ -6,19 +6,24 @@
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
-use PhpParser\Node\Expr;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\Node\Stmt\Nop;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-final class WorkspaceRepositoryFindByIdentifierRector extends AbstractRector
+final class WorkspaceRepositoryFindByIdentifierRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- ) {
+ public function __construct()
+ {
}
@@ -32,34 +37,66 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
- public function refactor(Node $node): ?Node
+ public function refactor(Node $node): ?array
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Repository\WorkspaceRepository::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'findByIdentifier')) {
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(
+ $visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ public bool $changed = false,
+ public ?Node\Expr $nodeVar = null,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'findByIdentifier'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Domain\Repository\WorkspaceRepository::class))) {
+ $this->changed = true;
+
+ return $this->contentRepository_findWorkspaceByName(
+ $this->workspaceName_fromString($node->args[0]->value)
+ );
+ }
+ }
+ return null;
+ }
+ });
+
+ /** @var Node\Expr $newExpr */
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if (!$visitor->changed) {
return null;
}
+ $node->expr = $newExpr;
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::withTodoComment(
- 'Make this code aware of multiple Content Repositories.',
- self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default')))),
- ],
- $node
- );
-
- return
- $this->contentRepository_findWorkspaceByName($this->workspaceName_fromString($node->args[0]->value));
+ return [
+ new Nop(), // Needed, to render the comment below
+ self::withTodoComment(
+ 'Make this code aware of multiple Content Repositories.',
+ self::assign('contentRepository', $this->this_contentRepositoryRegistry_get($this->contentRepositoryId_fromString('default'))),
+ ),
+ $node,
+ ];
}
}
diff --git a/src/ContentRepository90/Rules/WorkspaceSetDescriptionRector.php b/src/ContentRepository90/Rules/WorkspaceSetDescriptionRector.php
index c7b5bf5..faab7c7 100644
--- a/src/ContentRepository90/Rules/WorkspaceSetDescriptionRector.php
+++ b/src/ContentRepository90/Rules/WorkspaceSetDescriptionRector.php
@@ -4,25 +4,26 @@
namespace Neos\Rector\ContentRepository90\Rules;
+use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
+use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
-use PhpParser\Node\Expr\Variable;
+use PhpParser\Node\Expr\MethodCall;
+use PhpParser\Node\Identifier;
+use PhpParser\Node\Scalar\String_;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
-use Neos\ContentRepository\Core\SharedModel\Workspace\Workspace;
-final class WorkspaceSetDescriptionRector extends AbstractRector
+final class WorkspaceSetDescriptionRector extends AbstractRector implements DocumentedRuleInterface
{
use AllTraits;
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector,
- )
- {
- }
-
public function getRuleDefinition(): RuleDefinition
{
return CodeSampleLoader::fromFile('"Workspace::setDescription()" will be rewritten', __CLASS__);
@@ -33,37 +34,61 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
public function refactor(Node $node): ?Node
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'setDescription')) {
- return null;
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor($visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ private readonly NodeFactory $nodeFactory,
+ public bool $changed = false,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'setDescription'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ $this->changed = true;
+
+ $serviceCall = $this->nodeFactory->createMethodCall(
+ $this->nodeFactory->createPropertyFetch('this', 'workspaceService'),
+ 'setWorkspaceDescription',
+ [
+ $this->nodeFactory->createStaticCall(ContentRepositoryId::class, 'fromString', [new String_('default')]),
+ $this->nodeFactory->createPropertyFetch($node->var, 'workspaceName'),
+ $this->nodeFactory->createStaticCall(\Neos\Neos\Domain\Model\WorkspaceDescription::class, 'fromString', [$node->args[0]])
+ ]
+ );
+ return $serviceCall;
+ }
+ }
+ return null;
+ }
+ });
+
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if ($visitor->changed) {
+ $node->expr = $newExpr;
+ self::withTodoComment('Make this code aware of multiple Content Repositories.', $node);
+ return $node;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::todoComment('Make this code aware of multiple Content Repositories.')
- ],
- $node
- );
- return
- $this->nodeFactory->createMethodCall(
- $this->this_workspaceService(),
- 'setWorkspaceDescription',
- [$this->contentRepositoryId_fromString('default'),
- $this->nodeFactory->createPropertyFetch($node->var, 'workspaceName'),
- $this->nodeFactory->createStaticCall(\Neos\Neos\Domain\Model\WorkspaceDescription::class, 'fromString', [$node->args[0]])
- ]
- );
+ return null;
}
}
diff --git a/src/ContentRepository90/Rules/WorkspaceSetTitleRector.php b/src/ContentRepository90/Rules/WorkspaceSetTitleRector.php
index 172e156..af93856 100644
--- a/src/ContentRepository90/Rules/WorkspaceSetTitleRector.php
+++ b/src/ContentRepository90/Rules/WorkspaceSetTitleRector.php
@@ -1,69 +1,91 @@
>
- */
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
public function refactor(Node $node): ?Node
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isName($node->name, 'setTitle')) {
- return null;
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor($visitor = new class($this->nodeTypeResolver, $this->nodeFactory) extends NodeVisitorAbstract {
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ private readonly NodeFactory $nodeFactory,
+ public bool $changed = false,
+ ) {
+ }
+
+ public function leaveNode(Node $node)
+ {
+ if (
+ $node instanceof MethodCall &&
+ $node->name instanceof Identifier &&
+ $node->name->toString() === 'setTitle'
+ ) {
+ if ($this->nodeTypeResolver->isObjectType($node->var, new ObjectType(Workspace::class))) {
+ $this->changed = true;
+
+ $serviceCall = $this->nodeFactory->createMethodCall(
+ $this->nodeFactory->createPropertyFetch('this', 'workspaceService'),
+ 'setWorkspaceTitle',
+ [
+ $this->nodeFactory->createStaticCall(ContentRepositoryId::class, 'fromString', [new String_('default')]),
+ $this->nodeFactory->createPropertyFetch($node->var, 'workspaceName'),
+ $this->nodeFactory->createStaticCall(\Neos\Neos\Domain\Model\WorkspaceTitle::class, 'fromString', [$node->args[0]])
+ ]
+ );
+ return $serviceCall;
+ }
+ }
+ return null;
+ }
+ });
+
+ $newExpr = $traverser->traverse([$node->expr])[0];
+
+ if ($visitor->changed) {
+ $node->expr = $newExpr;
+ self::withTodoComment('Make this code aware of multiple Content Repositories.', $node);
+ return $node;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::todoComment('Make this code aware of multiple Content Repositories.')
- ],
- $node
- );
- return
- $this->nodeFactory->createMethodCall(
- $this->this_workspaceService(),
- 'setWorkspaceTitle',
- [$this->contentRepositoryId_fromString('default'),
- $this->nodeFactory->createPropertyFetch($node->var, 'workspaceName'),
- $this->nodeFactory->createStaticCall(\Neos\Neos\Domain\Model\WorkspaceTitle::class, 'fromString', [$node->args[0]])
- ]
- );
+ return null;
}
-}
+}
\ No newline at end of file
diff --git a/src/ContentRepository90/Rules/YamlDimensionConfigRector.php b/src/ContentRepository90/Rules/YamlDimensionConfigRector.php
deleted file mode 100644
index 0998c75..0000000
--- a/src/ContentRepository90/Rules/YamlDimensionConfigRector.php
+++ /dev/null
@@ -1,115 +0,0 @@
- we assume the file has already been processed.
- return $fileContent;
- }
-
- if (!isset($parsed['Neos']['ContentRepository']['contentDimensions'])) {
- // we do not have a Neos.ContentRepository.contentDimensions key; so we do not need
- // to process this file
- return $fileContent;
- }
-
- $defaultDimensionSpacePoint = [];
- $uriPathSegments = [];
- foreach ($parsed['Neos']['ContentRepository']['contentDimensions'] as $dimensionName => $oldDimensionConfig) {
- $errors = [];
- $uriPathSegmentsForDimension = [
- 'dimensionIdentifier' => $dimensionName,
- 'dimensionValueMapping##' => YamlWithComments::comment('dimensionValue => uriPathSegment (empty uriPathSegment allowed)'),
- 'dimensionValueMapping' => []
- ];
- $newContentDimensionConfig = [];
-
- if (isset($oldDimensionConfig['label'])) {
- $newContentDimensionConfig['label'] = $oldDimensionConfig['label'];
- }
- if (isset($oldDimensionConfig['icon'])) {
- $newContentDimensionConfig['icon'] = $oldDimensionConfig['icon'];
- }
-
- if (isset($oldDimensionConfig['default'])) {
- $defaultDimensionSpacePoint[$dimensionName] = $oldDimensionConfig['default'];
- } else {
- $errors[] = sprintf('TODO: FIXME: For preset "%s", did not find any default dimension value underneath "default". The defaultDimensionSpacePoint might be incomplete.', $presetName);
- }
- foreach ($oldDimensionConfig['presets'] as $presetName => $presetConfig) {
- // we need to use the last dimension value as the the new dimension value name; because that is
- // what the dimension migrator expects.
- //
- // The PresetName is discarded
- // TODO: PresetName as comment
- $dimensionValueConfig = [];
- if (isset($presetConfig['label'])) {
- $dimensionValueConfig['label'] = $presetConfig['label'];
- }
- if (isset($presetConfig['icon'])) {
- $dimensionValueConfig['icon'] = $presetConfig['icon'];
- }
-
-
- if (!isset($presetConfig['values'])) {
- $errors[] = sprintf('TODO: FIXME: For preset "%s", did not find any dimension values underneath "values"', $presetName);
- } else {
- $valuesExceptLast = $presetConfig['values'];
- $valuesExceptLast = array_reverse($valuesExceptLast);
- $lastValue = array_pop($valuesExceptLast);
- $currentValuePath = &$newContentDimensionConfig['values'];
- foreach ($valuesExceptLast as $value) {
- $currentValuePath = &$currentValuePath[$value]['specializations'];
- }
- $currentValuePath[$lastValue] = $dimensionValueConfig;
-
- if (isset($presetConfig['uriSegment'])) {
- $uriPathSegmentsForDimension['dimensionValueMapping'][$lastValue] = $presetConfig['uriSegment'];
- } else {
- $errors[] = sprintf('TODO: FIXME: For preset "%s", did not find any uriSegment.', $presetName);
- }
- }
- }
-
- if ($errors) {
- $parsed['Neos']['ContentRepositoryRegistry']['contentRepositories']['default']['contentDimensions'][$dimensionName . '##'] = YamlWithComments::comment(implode("\n", $errors));
- }
- $parsed['Neos']['ContentRepositoryRegistry']['contentRepositories']['default']['contentDimensions'][$dimensionName] = $newContentDimensionConfig;
- $uriPathSegments[] = $uriPathSegmentsForDimension;
- }
- $parsed['Neos']['ContentRepository']['contentDimensions'] = [];
- $parsed = Arrays::removeEmptyElementsRecursively($parsed);
-
- $parsed['Neos']['Neos']['sites']['*']['contentDimensions'] = [
- 'defaultDimensionSpacePoint##' => YamlWithComments::comment('defaultDimensionSpacePoint is used for the homepage (URL /)'),
- 'defaultDimensionSpacePoint' => $defaultDimensionSpacePoint,
- 'resolver' => [
- 'factoryClassName' => 'Neos\Neos\FrontendRouting\DimensionResolution\Resolver\UriPathResolverFactory',
- 'options' => [
- 'segments' => $uriPathSegments
- ]
- ]
- ];
-
- return YamlWithComments::dump($parsed);
- }
-}
diff --git a/src/ContentRepository90/Rules/YamlRoutePartHandlerRector.php b/src/ContentRepository90/Rules/YamlRoutePartHandlerRector.php
deleted file mode 100644
index a7b33a0..0000000
--- a/src/ContentRepository90/Rules/YamlRoutePartHandlerRector.php
+++ /dev/null
@@ -1,49 +0,0 @@
- $routeConfig) {
- if (!is_array($routeConfig)) {
- continue;
- }
- if (!isset($routeConfig['routeParts']) || !is_array($routeConfig['routeParts'])) {
- continue;
- }
-
- $handlerToReplace = [
- \Neos\Neos\Routing\FrontendNodeRoutePartHandler::class,
- \Neos\Neos\Routing\FrontendNodeRoutePartHandlerInterface::class,
- ];
-
- foreach ($routeConfig['routeParts'] as $routePartKey => $routePart) {
- if (isset($routePart['handler']) && in_array($routePart['handler'], $handlerToReplace)) {
- $parsed[$routeConfigKey]['routeParts'][$routePartKey]['handler'] = \Neos\Neos\FrontendRouting\FrontendNodeRoutePartHandlerInterface::class;
- }
- }
- }
-
- return YamlWithComments::dump($parsed);
- }
-}
diff --git a/src/Core/FusionProcessing/AfxParser/AfxParserException.php b/src/Core/FusionProcessing/AfxParser/AfxParserException.php
deleted file mode 100644
index 8bf5f48..0000000
--- a/src/Core/FusionProcessing/AfxParser/AfxParserException.php
+++ /dev/null
@@ -1,22 +0,0 @@
-isOpeningBracket()) {
- $lexer->consume();
- }
-
- $identifier = Identifier::parse($lexer);
-
- try {
- $attributes = [];
- $children = [];
-
- if ($lexer->isWhitespace()) {
- while ($lexer->isWhitespace()) {
- $lexer->consume();
- }
-
- while (!$lexer->isForwardSlash() && !$lexer->isClosingBracket()) {
- if ($lexer->isOpeningBrace()) {
- $attributes[] = [
- 'type' => 'spread',
- 'payload' => Spread::parse($lexer)
- ];
- } else {
- $attributes[] = [
- 'type' => 'prop',
- 'payload' => Prop::parse($lexer)
- ];
- }
- while ($lexer->isWhitespace()) {
- $lexer->consume();
- }
- }
- }
-
- if ($lexer->isForwardSlash()) {
- $lexer->consume();
-
- if ($lexer->isClosingBracket()) {
- $lexer->consume();
-
- return [
- 'identifier' => $identifier,
- 'attributes' => $attributes,
- 'children' => $children,
- 'selfClosing' => true
- ];
- } else {
- throw new AfxParserException(sprintf('Self closing tag "%s" misses closing bracket.', $identifier), 1557860567);
- }
- }
-
- if ($lexer->isClosingBracket()) {
- $lexer->consume();
- } else {
- throw new AfxParserException(sprintf('Tag "%s" did not end with closing bracket.', $identifier), 1557860573);
- }
-
- $children = AfxNodeList::parse($lexer);
-
- if ($lexer->isOpeningBracket()) {
- $lexer->consume();
-
- if ($lexer->isForwardSlash()) {
- $lexer->consume();
- } else {
- throw new AfxParserException(sprintf(
- 'Opening-bracket for closing of tag "%s" was not followed by slash.',
- $identifier
- ), 1557860584);
- }
- } else {
- throw new AfxParserException(sprintf(
- 'Opening-bracket for closing of tag "%s" expected.',
- $identifier
- ), 1557860587);
- }
-
- $closingIdentifier = Identifier::parse($lexer);
-
- if ($closingIdentifier !== $identifier) {
- throw new AfxParserException(sprintf(
- 'Closing-tag identifier "%s" did not match opening-tag identifier "%s".',
- $closingIdentifier,
- $identifier
- ), 1557860595);
- }
-
- if ($lexer->isClosingBracket()) {
- $lexer->consume();
- return [
- 'identifier' => $identifier,
- 'attributes' => $attributes,
- 'children' => $children,
- 'selfClosing' => false
- ];
- } else {
- throw new AfxParserException(sprintf('Closing tag "%s" did not end with closing-bracket.', $identifier), 1557860618);
- }
-
- if ($lexer->isEnd()) {
- throw new AfxParserException(sprintf('Tag was %s is not closed.', $identifier), 1557860622);
- }
- } catch (AfxParserException $e) {
- throw new AfxParserException(sprintf('<%s> %s', $identifier, $e->getMessage()), 1557860627);
- }
- }
-}
diff --git a/src/Core/FusionProcessing/AfxParser/Expression/AfxNodeList.php b/src/Core/FusionProcessing/AfxParser/Expression/AfxNodeList.php
deleted file mode 100644
index 8dfc6ef..0000000
--- a/src/Core/FusionProcessing/AfxParser/Expression/AfxNodeList.php
+++ /dev/null
@@ -1,90 +0,0 @@
-isEnd()) {
- if ($lexer->isOpeningBracket()) {
- $lexer->consume();
- if ($currentText !== '') {
- $contents[] = [
- 'type' => 'text',
- 'payload' => $currentText
- ];
- }
- if ($lexer->isForwardSlash()) {
- $lexer->rewind();
- return $contents;
- }
- if ($lexer->isExclamationMark()) {
- $lexer->rewind();
- $contents[] = [
- 'type' => 'comment',
- 'payload' => Comment::parse($lexer)
- ];
- $currentText = '';
- continue;
- } else {
- $lexer->rewind();
- $contents[] = [
- 'type' => 'node',
- 'payload' => AfxNode::parse($lexer)
- ];
- $currentText = '';
- continue;
- }
- }
-
- if ($lexer->isOpeningBrace()) {
- if ($currentText) {
- $contents[] = [
- 'type' => 'text',
- 'payload' => $currentText
- ];
- }
-
- $contents[] = [
- 'type' => 'expression',
- 'payload' => Expression::parse($lexer)
- ];
- $currentText = '';
- continue;
- }
-
- $currentText .= $lexer->consume();
- }
-
- if ($lexer->isEnd() && $currentText !== '') {
- $contents[] = [
- 'type' => 'text',
- 'payload' => $currentText
- ];
- }
-
- return $contents;
- }
-}
diff --git a/src/Core/FusionProcessing/AfxParser/Expression/Comment.php b/src/Core/FusionProcessing/AfxParser/Expression/Comment.php
deleted file mode 100644
index 7811bad..0000000
--- a/src/Core/FusionProcessing/AfxParser/Expression/Comment.php
+++ /dev/null
@@ -1,54 +0,0 @@
-isOpeningBracket() && $lexer->peek(4) === '') {
- $lexer->consume();
- $lexer->consume();
- $lexer->consume();
- return $currentComment;
- }
- if ($lexer->isEnd()) {
- throw new AfxParserException(sprintf('Comment not closed.'));
- }
- $currentComment .= $lexer->consume();
- }
- }
-}
diff --git a/src/Core/FusionProcessing/AfxParser/Expression/Expression.php b/src/Core/FusionProcessing/AfxParser/Expression/Expression.php
deleted file mode 100644
index 7fa001c..0000000
--- a/src/Core/FusionProcessing/AfxParser/Expression/Expression.php
+++ /dev/null
@@ -1,67 +0,0 @@
-isOpeningBrace()) {
- $lexer->consume();
- } else {
- throw new AfxParserException('Expression without braces', 1557860467);
- }
- $fromOffset = $lexer->characterPosition;
- while (true) {
- if ($lexer->isEnd()) {
- throw new AfxParserException(sprintf('Unfinished Expression "%s"', $contents), 1557860496);
- }
-
- if ($lexer->isOpeningBrace()) {
- $braceCount++;
- }
-
- if ($lexer->isClosingBrace()) {
- if ($braceCount === 0) {
- $toOffset = $lexer->characterPosition;
- $lexer->consume();
- return [
- 'from' => $fromOffset,
- 'to' => $toOffset,
- 'contents' => $contents
- ];
- }
-
- $braceCount--;
- }
-
- $contents .= $lexer->consume();
- }
- }
-}
diff --git a/src/Core/FusionProcessing/AfxParser/Expression/Identifier.php b/src/Core/FusionProcessing/AfxParser/Expression/Identifier.php
deleted file mode 100644
index 7473e4e..0000000
--- a/src/Core/FusionProcessing/AfxParser/Expression/Identifier.php
+++ /dev/null
@@ -1,64 +0,0 @@
-isAlphaNumeric():
- case $lexer->isDot():
- case $lexer->isColon():
- case $lexer->isMinus():
- case $lexer->isUnderscore():
- case $lexer->isAt():
- case $lexer->isDoubleQuote():
- case $lexer->isSingleQuote():
- case $lexer->isBackSlash() && $lexer->peek(2) === '\"':
- case $lexer->isBackSlash() && $lexer->peek(2) === '\\\'':
- $identifier .= $lexer->consume();
- break;
- case $lexer->isEqualSign():
- case $lexer->isWhiteSpace():
- case $lexer->isClosingBracket():
- case $lexer->isForwardSlash():
- return $identifier;
- break;
- default:
- $unexpected_character = $lexer->consume();
- throw new AfxParserException(sprintf(
- 'Unexpected character "%s" in identifier "%s"',
- $unexpected_character,
- $identifier
- ), 1557860650);
- }
- }
- }
-}
diff --git a/src/Core/FusionProcessing/AfxParser/Expression/Prop.php b/src/Core/FusionProcessing/AfxParser/Expression/Prop.php
deleted file mode 100644
index c95c525..0000000
--- a/src/Core/FusionProcessing/AfxParser/Expression/Prop.php
+++ /dev/null
@@ -1,71 +0,0 @@
-isEqualSign()) {
- $lexer->consume();
- switch (true) {
- case $lexer->isSingleQuote():
- case $lexer->isDoubleQuote():
- $value = [
- 'type' => 'string',
- 'payload' => StringLiteral::parse($lexer),
- 'identifier' => $identifier
- ];
- break;
-
- case $lexer->isOpeningBrace():
- $value = [
- 'type' => 'expression',
- 'payload' => Expression::parse($lexer),
- 'identifier' => $identifier
- ];
- break;
- default:
- throw new AfxParserException(sprintf(
- 'Prop-assignment "%s" was not followed by quotes or braces',
- $identifier
- ), 1557860545);
- }
- } elseif ($lexer->isWhiteSpace() || $lexer->isForwardSlash() || $lexer->isClosingBracket()) {
- $value = [
- 'type' => 'boolean',
- 'payload' => true,
- 'identifier' => $identifier
- ];
- } else {
- throw new AfxParserException(sprintf('Prop identifier "%s" is neither assignment nor boolean', $identifier), 1557860552);
- }
-
- return $value;
- }
-}
diff --git a/src/Core/FusionProcessing/AfxParser/Expression/Spread.php b/src/Core/FusionProcessing/AfxParser/Expression/Spread.php
deleted file mode 100644
index 268784a..0000000
--- a/src/Core/FusionProcessing/AfxParser/Expression/Spread.php
+++ /dev/null
@@ -1,74 +0,0 @@
-isOpeningBrace() && $lexer->peek(4) === '{...') {
- $lexer->consume();
- $lexer->consume();
- $lexer->consume();
- $lexer->consume();
- } else {
- throw new AfxParserException('Spread without braces', 1557860522);
- }
-
- $fromOffset = $lexer->characterPosition;
- while (true) {
- if ($lexer->isEnd()) {
- throw new AfxParserException(sprintf('Unfinished Spread "%s"', $contents), 1557860526);
- }
-
- if ($lexer->isOpeningBrace()) {
- $braceCount++;
- }
-
- if ($lexer->isClosingBrace()) {
- if ($braceCount === 0) {
- $toOffset = $lexer->characterPosition;
- $lexer->consume();
- return [
- 'type' => 'expression',
- 'payload' => [
- 'from' => $fromOffset,
- 'to' => $toOffset,
- 'contents' => $contents
- ]
- ];
- }
-
- $braceCount--;
- }
-
- $contents .= $lexer->consume();
- }
- }
-}
diff --git a/src/Core/FusionProcessing/AfxParser/Expression/StringLiteral.php b/src/Core/FusionProcessing/AfxParser/Expression/StringLiteral.php
deleted file mode 100644
index dbbfe0b..0000000
--- a/src/Core/FusionProcessing/AfxParser/Expression/StringLiteral.php
+++ /dev/null
@@ -1,67 +0,0 @@
-isSingleQuote() || $lexer->isDoubleQuote()) {
- $openingQuoteSign = $lexer->consume();
- } else {
- throw new AfxParserException('Unquoted String literal', 1557860514);
- }
-
- while (true) {
- if ($lexer->isEnd()) {
- throw new AfxParserException(sprintf('Unfinished string literal "%s"', $contents), 1557860504);
- }
-
- if ($lexer->isBackSlash() && !$willBeEscaped) {
- $willBeEscaped = true;
- $lexer->consume();
- continue;
- }
-
- if ($lexer->isSingleQuote() || $lexer->isDoubleQuote()) {
- $closingQuoteSign = $lexer->consume();
- if (!$willBeEscaped && $openingQuoteSign === $closingQuoteSign) {
- return $contents;
- }
-
- $contents .= $closingQuoteSign;
- $willBeEscaped = false;
- continue;
- }
-
- $contents .= $lexer->consume();
- $willBeEscaped = false;
- }
- }
-}
diff --git a/src/Core/FusionProcessing/AfxParser/Lexer.php b/src/Core/FusionProcessing/AfxParser/Lexer.php
deleted file mode 100644
index 42c18fc..0000000
--- a/src/Core/FusionProcessing/AfxParser/Lexer.php
+++ /dev/null
@@ -1,287 +0,0 @@
-string = $string;
- $this->currentCharacter = ($string !== '') ? $string[0] : null;
- $this->characterPosition = 0;
- }
-
- /**
- * Checks if the current character is whitespace
- *
- * @return boolean
- */
- public function isWhiteSpace(): bool
- {
- return ctype_space($this->currentCharacter);
- }
-
- /**
- * Checks if the current character is a letter
- *
- * @return boolean
- */
- public function isAlpha(): bool
- {
- return ctype_alpha($this->currentCharacter);
- }
-
- /**
- * Checks if the current character is alpha-numeric
- *
- * @return boolean
- */
- public function isAlphaNumeric(): bool
- {
- return ctype_alnum($this->currentCharacter);
- }
-
- /**
- * Checks if the current character is a colon
- *
- * @return boolean
- */
- public function isColon(): bool
- {
- return $this->currentCharacter === ':';
- }
-
- /**
- * Checks if the current character is a dot
- *
- * @return boolean
- */
- public function isDot(): bool
- {
- return $this->currentCharacter === '.';
- }
-
- /**
- * Checks if the current character is a @
- *
- * @return boolean
- */
- public function isAt(): bool
- {
- return $this->currentCharacter === '@';
- }
-
- /**
- * Checks if the current character is a minus
- *
- * @return boolean
- */
- public function isMinus(): bool
- {
- return $this->currentCharacter === '-';
- }
-
- /**
- * Checks if the current character is an underscore
- *
- * @return boolean
- */
- public function isUnderscore(): bool
- {
- return $this->currentCharacter === '_';
- }
-
- /**
- * Checks if the current character is an equal sign
- *
- * @return boolean
- */
- public function isEqualSign(): bool
- {
- return $this->currentCharacter === '=';
- }
-
- /**
- * Checks if the current character is an opening bracket
- *
- * @return boolean
- */
- public function isOpeningBracket(): bool
- {
- return $this->currentCharacter === '<';
- }
-
- /**
- * Checks if the current character is a closing bracket
- *
- * @return boolean
- */
- public function isClosingBracket(): bool
- {
- return $this->currentCharacter === '>';
- }
-
- /**
- * Checks if the current character is an opening curly brace
- *
- * @return boolean
- */
- public function isOpeningBrace(): bool
- {
- return $this->currentCharacter === '{';
- }
-
- /**
- * Checks if the current character is a closing curly brace
- *
- * @return boolean
- */
- public function isClosingBrace(): bool
- {
- return $this->currentCharacter === '}';
- }
-
- /**
- * Checks if the current character is a forward slash
- *
- * @return boolean
- */
- public function isForwardSlash(): bool
- {
- return $this->currentCharacter === '/';
- }
-
- /**
- * Checks if the current character is a back slash
- *
- * @return boolean
- */
- public function isBackSlash(): bool
- {
- return $this->currentCharacter === '\\';
- }
-
- /**
- * Checks if the current character is a single quote
- *
- * @return boolean
- */
- public function isSingleQuote(): bool
- {
- return $this->currentCharacter === '\'';
- }
-
- /**
- * Checks if the current character is a double quote
- *
- * @return boolean
- */
- public function isDoubleQuote(): bool
- {
- return $this->currentCharacter === '"';
- }
-
- /**
- * Checks if the current character is an exclamation mark
- *
- * @return boolean
- */
- public function isExclamationMark(): bool
- {
- return $this->currentCharacter === '!';
- }
-
- /**
- * Checks if the iteration has ended
- *
- * @return boolean
- */
- public function isEnd(): bool
- {
- return $this->currentCharacter === null;
- }
-
- /**
- * Rewinds the iteration by one step
- *
- * @return void
- */
- public function rewind(): void
- {
- $this->currentCharacter = $this->string[--$this->characterPosition];
- }
-
- /**
- * Peek several characters in advance and return the next n characters
- *
- * @param int $characterNumber
- * @return string|null
- */
- public function peek($characterNumber = 1): ?string
- {
- if ($this->characterPosition < strlen($this->string) - 1) {
- return substr($this->string, $this->characterPosition, $characterNumber);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the current character and moves one step forward
- *
- * @return string|null
- */
- public function consume(): ?string
- {
- $c = $this->currentCharacter;
- if ($this->characterPosition < strlen($this->string) - 1) {
- $this->currentCharacter = $this->string[++$this->characterPosition];
- } else {
- $this->currentCharacter = null;
- }
-
- return $c;
- }
-}
diff --git a/src/Core/FusionProcessing/AfxParser/Parser.php b/src/Core/FusionProcessing/AfxParser/Parser.php
deleted file mode 100644
index 01b69ec..0000000
--- a/src/Core/FusionProcessing/AfxParser/Parser.php
+++ /dev/null
@@ -1,44 +0,0 @@
-lexer = new Lexer($string);
- }
-
- /**
- * @return array
- * @throws AfxParserException
- */
- public function parse(): array
- {
- return Expression\AfxNodeList::parse($this->lexer);
- }
-}
diff --git a/src/Core/FusionProcessing/EelExpressionTransformer.php b/src/Core/FusionProcessing/EelExpressionTransformer.php
deleted file mode 100644
index 3a6bcce..0000000
--- a/src/Core/FusionProcessing/EelExpressionTransformer.php
+++ /dev/null
@@ -1,230 +0,0 @@
-findAllEelExpressions();
-
- // apply processing function on Eel expressions
- $eelExpressions = $eelExpressions->map(
- fn(EelExpressionPosition $expressionPosition) => $expressionPosition->withEelExpression(
- $processingFunction($expressionPosition->eelExpression, $expressionPosition->fusionPath)
- )
- );
-
- return new self($this->render($eelExpressions));
- }
-
- /**
- * @throws ParserException
- * @throws AfxParserException
- */
- public function addCommentsIfRegexMatches(string $regex, string $comment): self
- {
- $regexCommentTemplatePair = new RegexCommentTemplatePair($regex, $comment);
- return $this->addCommentsIfRegexesMatch([$regexCommentTemplatePair]);
- }
-
- /**
- * @param RegexCommentTemplatePair[] $regexCommentTemplatePairs
- * @throws AfxParserException
- * @throws ParserException
- */
- public function addCommentsIfRegexesMatch(array $regexCommentTemplatePairs): self
- {
- $eelExpressions = $this->findAllEelExpressions();
-
- $comments = [];
- // fill $comments
- foreach ($regexCommentTemplatePairs as $regexCommentTemplatePair) {
- $eelExpressions->map(
- function (EelExpressionPosition $expressionPosition) use ($regexCommentTemplatePair, &$comments) {
- $comments = array_merge(
- $comments,
- $this->getPrecedingCommentsForEelExpressionPosition($expressionPosition, $regexCommentTemplatePair->regex, $regexCommentTemplatePair->template)
- );
- return $expressionPosition;
- }
- );
- }
-
- $comments = $this->replaceLinePlaceholderWithinCommentTemplates($comments);
-
- if (count($comments)) {
- $precedingComments = array_map(fn($comment) => $comment->text, $comments);
- return new EelExpressionTransformer(implode("\n", $precedingComments) . "\n" . $this->fileContent);
- } else {
- return $this;
- }
- }
-
- /** @return PrecedingFusionFileComment[] */
- private function getPrecedingCommentsForEelExpressionPosition(EelExpressionPosition $expressionPosition, string $regex, string $template): array
- {
- $comments = [];
-
- $matches = [];
- if (preg_match_all($regex, $expressionPosition->eelExpression, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) {
- foreach ($matches as $match) {
- // $match[0][0] => the fully matched string
- // $match[0][1] => the start offset of the string
- $offsetOfFullMatch = $match[0][1];
- $lineNumberOfMatch = substr_count($this->fileContent, "\n", 0, $expressionPosition->fromOffset + $offsetOfFullMatch);
- // we add one because the number of counted new line characters will be one less than the actual line number
- $lineNumberOfMatch += 1;
- // avoid adding the same comment multiple times per line by using an explicit array key
- $commentKey = sha1($lineNumberOfMatch . $regex . $template);
- $comments[$commentKey] = new PrecedingFusionFileComment($lineNumberOfMatch, $template);
- }
- }
-
- return $comments;
- }
-
- /**
- * @param PrecedingFusionFileComment[] $comments
- * @return PrecedingFusionFileComment[]
- */
- private function replaceLinePlaceholderWithinCommentTemplates(array $comments): array
- {
- foreach ($comments as $comment) {
- $finalLineNumber = $comment->lineNumberOfMatch + count($comments);
- $comment->text = str_replace('%LINE', (string)$finalLineNumber, $comment->template);
- }
- return $comments;
- }
-
- /**
- * @throws ParserException
- * @throws AfxParserException
- */
- public function findAllEelExpressions(): EelExpressionPositions
- {
- $eelExpressions = CustomObjectTreeParser::findEelExpressions($this->fileContent);
- $afxExpressions = CustomObjectTreeParser::findAfxExpressions($this->fileContent);
- foreach ($afxExpressions as $afxExpression) {
- $parser = new AfxParser\Parser($afxExpression->code);
- $ast = $parser->parse();
- $eelExpressionsInAfx = self::findEelExpressionsInAfxAst($ast);
- $eelExpressionsInAfx = $eelExpressionsInAfx->withOffset($afxExpression->fromOffset);
-
- $eelExpressions = $eelExpressions->addAndSort($eelExpressionsInAfx);
- }
- return $eelExpressions;
- }
-
- /**
- * @param array $afxAst
- * @return EelExpressionPositions
- */
- private static function findEelExpressionsInAfxAst(array $afxAst): EelExpressionPositions
- {
- $result = [];
- foreach ($afxAst as $afxElement) {
- self::findEelExpressionsInAfxAstElement($afxElement, $result);
- }
- return EelExpressionPositions::fromArray($result);
- }
-
- /**
- * @param array $afxElement
- * @param EelExpressionPosition[] $result
- * @return void
- */
- private static function findEelExpressionsInAfxAstElement(array $afxElement, array &$result): void
- {
- if ($afxElement['type'] === 'text') {
- return;
- }
- if ($afxElement['type'] === 'string') {
- return;
- }
- if ($afxElement['type'] === 'node') {
- foreach ($afxElement['payload']['attributes'] as $attribute) {
- self::findEelExpressionsInAfxAstElement($attribute, $result);
- }
- foreach ($afxElement['payload']['children'] as $child) {
- self::findEelExpressionsInAfxAstElement($child, $result);
- }
- }
- if ($afxElement['type'] === 'prop') {
- self::findEelExpressionsInAfxAstElement($afxElement['payload'], $result);
- }
- if ($afxElement['type'] === 'spread') {
- // We found an Eel expression in a spread operation
- $result[] = new EelExpressionPosition(
- $afxElement['payload']['payload']['contents'],
- $afxElement['payload']['payload']['from'] + 1,
- $afxElement['payload']['payload']['to'] + 1,
- null
- );
- return;
- }
-
- if ($afxElement['type'] === 'expression') {
- // We found an Eel expression
- $result[] = new EelExpressionPosition(
- $afxElement['payload']['contents'],
- $afxElement['payload']['from'] + 1,
- $afxElement['payload']['to'] + 1,
- null
- );
- }
- }
-
- private function render(EelExpressionPositions $eelExpressions): string
- {
- if ($eelExpressions->isEmpty()) {
- return $this->fileContent;
- }
-
- // Render [fusion] [1st eel expression]
- $processedFusionString = substr($this->fileContent, 0, $eelExpressions->first()->fromOffset);
- $processedFusionString .= $eelExpressions->first()->eelExpression;
- $toOffsetOfLastSeenEelExpression = $eelExpressions->first()->toOffset;
-
- // Render all Eel expressions (2...n)
- foreach ($eelExpressions->withoutFirst() as $eelExpression) {
- $processedFusionString .= substr($this->fileContent, $toOffsetOfLastSeenEelExpression, $eelExpression->fromOffset - $toOffsetOfLastSeenEelExpression);
- $processedFusionString .= $eelExpression->eelExpression;
- $toOffsetOfLastSeenEelExpression = $eelExpression->toOffset;
- }
- // render remaining Fusion in File
- $processedFusionString .= substr($this->fileContent, $toOffsetOfLastSeenEelExpression);
-
- return $processedFusionString;
- }
-
- public function getProcessedContent(): string
- {
- return $this->fileContent;
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/Cache/CacheSegmentParser.php b/src/Core/FusionProcessing/Fusion/Cache/CacheSegmentParser.php
deleted file mode 100644
index 61bac1b..0000000
--- a/src/Core/FusionProcessing/Fusion/Cache/CacheSegmentParser.php
+++ /dev/null
@@ -1,314 +0,0 @@
-randomCacheMarker = $randomCacheMarker;
- $this->randomCacheMarkerLength = strlen($randomCacheMarker);
- $this->content = $content;
- $this->outerSegmentContent = '';
- $currentPosition = 0;
- $nextStartPosition = $this->calculateNextTokenPosition($currentPosition, ContentCache::CACHE_SEGMENT_START_TOKEN);
- while ($nextStartPosition !== false) {
- $part = $this->extractContent($currentPosition, $nextStartPosition);
- $this->output .= $part;
- $this->outerSegmentContent .= $part;
- $result = $this->parseSegment($nextStartPosition);
- $this->output .= $result['cleanContent'];
- $this->outerSegmentContent .= $result['embed'];
- $currentPosition = $this->calculateCurrentPosition($result['endPosition']);
- $nextStartPosition = $this->calculateNextTokenPosition($currentPosition, ContentCache::CACHE_SEGMENT_START_TOKEN);
- }
-
- $nextEndPosition = $this->calculateNextTokenPosition($currentPosition, ContentCache::CACHE_SEGMENT_END_TOKEN);
- if ($nextEndPosition !== false) {
- throw new Exception(sprintf('Exceeding segment end token after position %d', $currentPosition), 1391853689);
- }
-
- $currentPosition = isset($result['endPosition']) ? $this->calculateCurrentPosition($result['endPosition']) : $currentPosition;
- $part = $this->extractContent($currentPosition);
- $this->output .= $part;
- $this->outerSegmentContent .= $part;
- // we no longer need the content
- unset($this->content);
- }
-
- /**
- * Parses a segment at current position diving down into nested segments.
- *
- * The returned segmentData array has the following keys:
- * - identifier -> The identifier of this entry for cached segments (or the eval expression for everything else)
- * - type -> The type of segment (one of the ContentCache::SEGMENT_TYPE_* constants)
- * - context -> eventual context information saved for a cached segment (optional)
- * - metadata -> cache entry metadata like tags
- * - content -> the content of this segment including embed code for sub segments
- * - cleanContent -> the raw content without any cache references for this segment and all sub segments
- * - embed -> the placeholder content for this segment to be used in "content" of parent segments
- *
- * @param integer $currentPosition
- * @return array
- * @throws Exception
- */
- protected function parseSegment($currentPosition)
- {
- $nextStartPosition = $this->calculateNextTokenPosition($currentPosition, ContentCache::CACHE_SEGMENT_START_TOKEN);
- if ($nextStartPosition !== $currentPosition) {
- throw new Exception(sprintf('The current position (%d) is not the start of a segment, next start position %d', $currentPosition, $nextStartPosition), 1472464124);
- }
-
- $segmentData = [
- 'identifier' => '',
- 'type' => '',
- 'context' => '',
- 'metadata' => '',
- 'content' => '',
- 'cleanContent' => '',
- 'embed' => ''
- ];
-
- $nextEndPosition = $this->calculateNextTokenPosition($currentPosition, ContentCache::CACHE_SEGMENT_END_TOKEN);
- $currentPosition = $this->calculateCurrentPosition($nextStartPosition);
- $nextStartPosition = $this->calculateNextTokenPosition($currentPosition, ContentCache::CACHE_SEGMENT_START_TOKEN);
-
- $nextIdentifierSeparatorPosition = $this->calculateNextTokenPosition($currentPosition, ContentCache::CACHE_SEGMENT_SEPARATOR_TOKEN);
- $nextSecondIdentifierSeparatorPosition = $this->calculateNextTokenPosition($nextIdentifierSeparatorPosition + 1, ContentCache::CACHE_SEGMENT_SEPARATOR_TOKEN);
-
- if ($nextIdentifierSeparatorPosition === false || $nextSecondIdentifierSeparatorPosition === false
- || $nextStartPosition !== false && $nextStartPosition < $nextSecondIdentifierSeparatorPosition
- || $nextEndPosition !== false && $nextEndPosition < $nextSecondIdentifierSeparatorPosition
- ) {
- throw new Exception(sprintf('Missing segment separator token after position %d', $currentPosition), 1391855139);
- }
-
- $identifier = $this->extractContent($currentPosition, $nextIdentifierSeparatorPosition);
- $contextOrMetadata = $this->extractContent($this->calculateCurrentPosition($nextIdentifierSeparatorPosition), $nextSecondIdentifierSeparatorPosition);
-
- $segmentData['identifier'] = $identifier;
- $segmentData['type'] = ContentCache::SEGMENT_TYPE_CACHED;
- $segmentData['metadata'] = $contextOrMetadata;
- $segmentData['context'] = $contextOrMetadata;
-
- if (strpos($identifier, 'eval=') === 0) {
- $segmentData['type'] = ContentCache::SEGMENT_TYPE_UNCACHED;
- unset($segmentData['metadata']);
- $this->uncachedPartCount++;
- }
-
- if (strpos($identifier, 'evalCached=') === 0) {
- $segmentData['type'] = ContentCache::SEGMENT_TYPE_DYNAMICCACHED;
- $segmentData['identifier'] = substr($identifier, 11);
- $additionalData = json_decode($contextOrMetadata, true);
- $segmentData['metadata'] = $additionalData['metadata'];
- $this->uncachedPartCount++;
- }
-
- $currentPosition = $this->calculateCurrentPosition($nextSecondIdentifierSeparatorPosition);
- $segmentData = $this->extractContentAndSubSegments($currentPosition, $segmentData);
-
- if ($segmentData['type'] === ContentCache::SEGMENT_TYPE_CACHED || $segmentData['type'] === ContentCache::SEGMENT_TYPE_DYNAMICCACHED) {
- $this->cacheSegments[$identifier] = $this->reduceSegmentDataToCacheRelevantInformation($segmentData);
- }
-
- return $segmentData;
- }
-
- /**
- * @param integer $currentPosition
- * @param array $segmentData
- * @return array
- */
- protected function extractContentAndSubSegments($currentPosition, array $segmentData)
- {
- $nextStartPosition = $this->calculateNextTokenPosition($currentPosition, ContentCache::CACHE_SEGMENT_START_TOKEN);
- $nextEndPosition = $this->calculateNextTokenPosition($currentPosition, ContentCache::CACHE_SEGMENT_END_TOKEN);
-
- $segmentData['content'] = '';
- $segmentData['cleanContent'] = '';
- while ($nextStartPosition !== false && $nextStartPosition < $nextEndPosition) {
- $segmentContent = $this->extractContent($currentPosition, $nextStartPosition);
- $segmentData['content'] .= $segmentContent;
- $segmentData['cleanContent'] .= $segmentContent;
-
- $nextLevelData = $this->parseSegment($nextStartPosition);
- $segmentData['content'] .= $nextLevelData['embed'];
- $segmentData['cleanContent'] .= $nextLevelData['cleanContent'];
-
- $currentPosition = $this->calculateCurrentPosition($nextLevelData['endPosition']);
- $nextStartPosition = $this->calculateNextTokenPosition($currentPosition, ContentCache::CACHE_SEGMENT_START_TOKEN);
- $nextEndPosition = $this->calculateNextTokenPosition($currentPosition, ContentCache::CACHE_SEGMENT_END_TOKEN);
- }
-
- /** @phpstan-ignore-next-line: $toPosition expects int|null but int|false given. Is this a real case? */
- $remainingContent = $this->extractContent($currentPosition, $nextEndPosition);
- $segmentData['content'] .= $remainingContent;
- $segmentData['cleanContent'] .= $remainingContent;
- $segmentData['endPosition'] = $nextEndPosition;
-
- if ($segmentData['type'] === ContentCache::SEGMENT_TYPE_UNCACHED) {
- $segmentData['embed'] = ContentCache::CACHE_SEGMENT_START_TOKEN . ContentCache::CACHE_SEGMENT_MARKER . $segmentData['identifier'] . ContentCache::CACHE_SEGMENT_SEPARATOR_TOKEN . ContentCache::CACHE_SEGMENT_MARKER . $segmentData['context'] . ContentCache::CACHE_SEGMENT_END_TOKEN . ContentCache::CACHE_SEGMENT_MARKER;
- } elseif ($segmentData['type'] === ContentCache::SEGMENT_TYPE_DYNAMICCACHED) {
- $segmentData['embed'] = ContentCache::CACHE_SEGMENT_START_TOKEN . ContentCache::CACHE_SEGMENT_MARKER . 'evalCached=' . $segmentData['identifier'] . ContentCache::CACHE_SEGMENT_SEPARATOR_TOKEN . ContentCache::CACHE_SEGMENT_MARKER . $segmentData['context'] . ContentCache::CACHE_SEGMENT_END_TOKEN . ContentCache::CACHE_SEGMENT_MARKER;
- } else {
- $segmentData['embed'] = ContentCache::CACHE_SEGMENT_START_TOKEN . ContentCache::CACHE_SEGMENT_MARKER . $segmentData['identifier'] . ContentCache::CACHE_SEGMENT_END_TOKEN . ContentCache::CACHE_SEGMENT_MARKER;
- }
-
- return $segmentData;
- }
-
- /**
- * Make sure that we keep only necessary information for caching and strip all internal segment data.
- *
- * @param array $segmentData
- * @return array
- */
- protected function reduceSegmentDataToCacheRelevantInformation(array $segmentData)
- {
- return [
- 'identifier' => $segmentData['identifier'],
- 'type' => $segmentData['type'],
- 'content' => $segmentData['content'],
- 'metadata' => $segmentData['metadata']
- ];
- }
-
- /**
- * @param integer $fromPosition
- * @param integer|null $toPosition
- * @return string
- */
- protected function extractContent($fromPosition, $toPosition = null)
- {
- // substr behaves differently if the third parameter is not given or if it's null, so we need to take this detour
- if ($toPosition === null) {
- return substr($this->content, $fromPosition);
- }
-
- return substr($this->content, $fromPosition, ($toPosition - $fromPosition));
- }
-
- /**
- * Calculates a position assuming that the given position is a token followed by the random cache marker
- *
- * @param int $position
- * @return int
- */
- protected function calculateCurrentPosition($position)
- {
- return $position + 1 + $this->randomCacheMarkerLength;
- }
-
- /**
- * Find the next position of the given token (one of the ContentCache::CACHE_SEGMENT_*_TOKEN constants) in the parsed content.
- *
- * @param integer $currentPosition The position to start searching from
- * @param string $token the token to search for (will internally be appeneded by the randomCacheMarker)
- * @return integer|false Position of the token or false if the token was not found
- */
- protected function calculateNextTokenPosition($currentPosition, $token)
- {
- return strpos($this->content, $token . $this->randomCacheMarker, $currentPosition);
- }
-
- /**
- * Returns the fully intact content as originally given to extractRenderedSegments() but without the markers. This
- * content is suitable for being used as output for the user.
- *
- * @return string
- */
- public function getOutput()
- {
- return $this->output;
- }
-
- /**
- * Returns an array with extracted content segments, including the type (if they can be cached or not) and tags to
- * be used for their entries when the segments are stored in a persistent cache.
- *
- * @return array
- */
- public function getCacheSegments()
- {
- return $this->cacheSegments;
- }
-
- /**
- * @return integer
- */
- public function getUncachedPartCount()
- {
- return $this->uncachedPartCount;
- }
-
- /**
- * @return string
- */
- public function getOuterSegmentContent()
- {
- return $this->outerSegmentContent;
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/Cache/ContentCache.php b/src/Core/FusionProcessing/Fusion/Cache/ContentCache.php
deleted file mode 100644
index e11272f..0000000
--- a/src/Core/FusionProcessing/Fusion/Cache/ContentCache.php
+++ /dev/null
@@ -1,384 +0,0 @@
-[a-f0-9]+)\x03CONTENT_CACHE/";
- public const EVAL_PLACEHOLDER_REGEX = "/\x02CONTENT_CACHE(?P[^\x02\x1f\x03]+)\x1fCONTENT_CACHE(?P[^\x02\x1f\x03]+)\x03CONTENT_CACHE/";
-
- public const MAXIMUM_NESTING_LEVEL = 32;
-
- /**
- * A cache entry tag that will be used by default to flush an entry on "every" change - whatever that means to
- * the application.
- */
- public const TAG_EVERYTHING = 'Everything';
-
- public const SEGMENT_TYPE_CACHED = 'cached';
- public const SEGMENT_TYPE_UNCACHED = 'uncached';
- public const SEGMENT_TYPE_DYNAMICCACHED = 'dynamiccached';
-
- /**
- * @var StringFrontend
- * @Flow\Inject
- */
- protected $cache;
-
- /**
- * @var Context
- * @Flow\Inject
- */
- protected $securityContext;
-
- /**
- * @var string
- */
- protected $randomCacheMarker;
-
- /**
- * ContentCache constructor
- */
- public function __construct()
- {
- $this->randomCacheMarker = Algorithms::generateRandomString(13);
- }
-
- /**
- * Takes the given content and adds markers for later use as a cached content segment.
- *
- * This function will add a start and an end token to the beginning and end of the content and generate a cache
- * identifier based on the current Fusion path and additional values which were defined in the Fusion
- * configuration by the site integrator.
- *
- * The whole cache segment (START TOKEN + IDENTIFIER + SEPARATOR TOKEN + original content + END TOKEN) is returned
- * as a string.
- *
- * This method is called by the Fusion Runtime while rendering a Fusion object.
- *
- * @param string $content The (partial) content which should potentially be cached later on
- * @param string $fusionPath The Fusion path that rendered the content, for example "page/body/parts/breadcrumbMenu"
- * @param array $cacheIdentifierValues The values (simple type or implementing CacheAwareInterface) that should be used to create a cache identifier, will be sorted by keys for consistent ordering
- * @param array $tags Tags to add to the cache entry
- * @param integer $lifetime Lifetime of the cache segment in seconds. NULL for the default lifetime and 0 for unlimited lifetime.
- * @return string The original content, but with additional markers and a cache identifier added
- */
- public function createCacheSegment($content, $fusionPath, array $cacheIdentifierValues, array $tags = [], $lifetime = null)
- {
- $cacheIdentifier = $this->renderContentCacheEntryIdentifier($fusionPath, $cacheIdentifierValues);
- $metadata = implode(',', $tags);
- if ($lifetime !== null) {
- $metadata .= ';' . $lifetime;
- }
- return self::CACHE_SEGMENT_START_TOKEN . $this->randomCacheMarker . $cacheIdentifier . self::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . $metadata . self::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . $content . self::CACHE_SEGMENT_END_TOKEN . $this->randomCacheMarker;
- }
-
- /**
- * Similar to createCacheSegment() creates a content segment with markers added, but in contrast to that function
- * this method is used for rendering a segment which is not supposed to be cached.
- *
- * This method is called by the Fusion Runtime while rendering a Fusion object.
- *
- * @param string $content The content rendered by the Fusion Runtime
- * @param string $fusionPath The Fusion path that rendered the content, for example "page/body/parts/breadcrumbMenu"
- * @param array $serializedContext Serialized Fusion context variables which are needed to correctly render the specified Fusion object
- * @return string The original content, but with additional markers added
- */
- public function createUncachedSegment($content, $fusionPath, array $serializedContext)
- {
- return self::CACHE_SEGMENT_START_TOKEN . $this->randomCacheMarker . 'eval=' . $fusionPath . self::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . json_encode(['context' => $serializedContext]) . self::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . $content . self::CACHE_SEGMENT_END_TOKEN . $this->randomCacheMarker;
- }
-
- /**
- * Similar to createUncachedSegment() creates a content segment with markers added, but in contrast to that function
- * this method is used for rendering a segment which will be evaluated at runtime but can still be cached.
- *
- * This method is called by the Fusion Runtime while rendering a Fusion object.
- *
- * @param string $content The content rendered by the Fusion Runtime
- * @param string $fusionPath The Fusion path that rendered the content, for example "page/body/parts/breadcrumbMenu"
- * @param array $serializedContext Serialized Fusion context variables which are needed to correctly render the specified Fusion object
- * @param array $cacheIdentifierValues
- * @param array $tags Tags to add to the cache entry
- * @param integer $lifetime Lifetime of the cache segment in seconds. NULL for the default lifetime and 0 for unlimited lifetime.
- * @param string $cacheDiscriminator The evaluated cache discriminator value
- * @return string The original content, but with additional markers added
- */
- public function createDynamicCachedSegment($content, $fusionPath, array $serializedContext, array $cacheIdentifierValues, array $tags, $lifetime, $cacheDiscriminator)
- {
- $metadata = implode(',', $tags);
- if ($lifetime !== null) {
- $metadata .= ';' . $lifetime;
- }
- $cacheDiscriminator = md5($cacheDiscriminator);
- $identifier = $this->renderContentCacheEntryIdentifier($fusionPath, $cacheIdentifierValues) . '_' . $cacheDiscriminator;
- $segmentData = [
- 'path' => $fusionPath,
- 'metadata' => $metadata,
- 'context' => $serializedContext,
- ];
-
- return self::CACHE_SEGMENT_START_TOKEN . $this->randomCacheMarker . 'evalCached=' . $identifier . self::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . json_encode($segmentData) . self::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . $content . self::CACHE_SEGMENT_END_TOKEN . $this->randomCacheMarker;
- }
-
- /**
- * Renders an identifier for a content cache entry
- *
- * @param string $fusionPath
- * @param array $cacheIdentifierValues
- * @return string An MD5 hash built from the fusionPath and certain elements of the given identifier values
- * @throws CacheException If an invalid entry identifier value is given
- */
- protected function renderContentCacheEntryIdentifier($fusionPath, array $cacheIdentifierValues)
- {
- ksort($cacheIdentifierValues);
-
- $identifierSource = '';
- foreach ($cacheIdentifierValues as $key => $value) {
- if ($value instanceof CacheAwareInterface) {
- $identifierSource .= $key . '=' . $value->getCacheEntryIdentifier() . '&';
- } elseif (is_string($value) || is_bool($value) || is_integer($value)) {
- $identifierSource .= $key . '=' . $value . '&';
- } elseif ($value !== null) {
- throw new CacheException(sprintf('Invalid cache entry identifier @cache.entryIdentifier.%s for path "%s". A entry identifier value must be a string or implement CacheAwareInterface.', $key, $fusionPath), 1395846615);
- }
- }
- $identifierSource .= 'securityContextHash=' . $this->securityContext->getContextHash();
-
- return md5($fusionPath . '@' . $identifierSource);
- }
-
- /**
- * Takes a string of content which includes cache segment markers, extracts the marked segments, writes those
- * segments which can be cached to the actual cache and returns the cleaned up original content without markers.
- *
- * This method is called by the Fusion Runtime while rendering a Fusion object.
- *
- * @param string $content The content with an outer cache segment
- * @param boolean $storeCacheEntries Whether to store extracted cache segments in the cache
- * @return string The (pure) content without cache segment markers
- */
- public function processCacheSegments($content, $storeCacheEntries = true)
- {
- $parser = new CacheSegmentParser($content, $this->randomCacheMarker);
-
- if ($storeCacheEntries) {
- $segments = $parser->getCacheSegments();
-
- foreach ($segments as $segment) {
- $metadata = explode(';', $segment['metadata']);
- $tagsValue = $metadata[0] === '' ? [] : ($metadata[0] === '*' ? false : explode(',', $metadata[0]));
- // false means we do not need to store the cache entry again (because it was previously fetched)
- if ($tagsValue !== false) {
- $lifetime = isset($metadata[1]) ? (integer)$metadata[1] : null;
- $this->cache->set($segment['identifier'], $segment['content'], $this->sanitizeTags($tagsValue), $lifetime);
- }
- }
- }
-
- return $parser->getOutput();
- }
-
- /**
- * Tries to retrieve the specified content segment from the cache – further nested inline segments are retrieved
- * as well and segments which were not cacheable are rendered.
- *
- * @param \Closure $uncachedCommandCallback A callback to process commands in uncached segments
- * @param string $fusionPath Fusion path identifying the Fusion object to retrieve from the content cache
- * @param array $cacheIdentifierValues Further values which play into the cache identifier hash, must be the same as the ones specified while the cache entry was written
- * @param boolean $addCacheSegmentMarkersToPlaceholders If cache segment markers should be added – this makes sense if the cached segment is about to be included in a not-yet-cached segment
- * @param string|false $cacheDiscriminator The evaluated cache discriminator value, if any and false if the cache discriminator is disabled for the current context
- * @return string|false The segment with replaced cache placeholders, or false if a segment was missing in the cache
- * @throws Exception
- */
- public function getCachedSegment($uncachedCommandCallback, $fusionPath, $cacheIdentifierValues, $addCacheSegmentMarkersToPlaceholders = false, $cacheDiscriminator = null)
- {
- // If $addCacheSegmentMarkersToPlaceholders was set, the outer segment was a cache miss and we need to re-evaluate dynamic cached segments.
- if ($cacheDiscriminator === false || ($addCacheSegmentMarkersToPlaceholders && $cacheDiscriminator !== null)) {
- return false;
- }
- $cacheIdentifier = $this->renderContentCacheEntryIdentifier($fusionPath, $cacheIdentifierValues);
- if ($cacheDiscriminator !== null) {
- $cacheIdentifier .= '_' . md5($cacheDiscriminator);
- }
- $content = $this->cache->get($cacheIdentifier);
-
- if ($content === false) {
- return false;
- }
-
- $i = 0;
- do {
- $replaced = $this->replaceCachePlaceholders($content, $addCacheSegmentMarkersToPlaceholders);
- if ($replaced === false) {
- return false;
- }
- $replaced += $this->replaceUncachedPlaceholders($uncachedCommandCallback, $content);
- if ($i > self::MAXIMUM_NESTING_LEVEL) {
- throw new Exception('Maximum cache segment level reached', 1391873620);
- }
- $i++;
- } while ($replaced > 0);
-
- if ($addCacheSegmentMarkersToPlaceholders) {
- return self::CACHE_SEGMENT_START_TOKEN . $this->randomCacheMarker . $cacheIdentifier . self::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . '*' . self::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . $content . self::CACHE_SEGMENT_END_TOKEN . $this->randomCacheMarker;
- } else {
- return $content;
- }
- }
-
- /**
- * Find cache placeholders in a cached segment and return the identifiers
- *
- * @param string $content
- * @param boolean $addCacheSegmentMarkersToPlaceholders
- * @return integer|boolean Number of replaced placeholders or false if a placeholder couldn't be found
- */
- protected function replaceCachePlaceholders(&$content, $addCacheSegmentMarkersToPlaceholders)
- {
- $cache = $this->cache;
- $foundMissingIdentifier = false;
- $content = preg_replace_callback(self::CACHE_PLACEHOLDER_REGEX, function ($match) use ($cache, &$foundMissingIdentifier, $addCacheSegmentMarkersToPlaceholders) {
- $identifier = $match['identifier'];
- $entry = $cache->get($identifier);
- if ($entry !== false) {
- if ($addCacheSegmentMarkersToPlaceholders) {
- return ContentCache::CACHE_SEGMENT_START_TOKEN . $this->randomCacheMarker . $identifier . ContentCache::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . '*' . ContentCache::CACHE_SEGMENT_SEPARATOR_TOKEN . $this->randomCacheMarker . $entry . ContentCache::CACHE_SEGMENT_END_TOKEN . $this->randomCacheMarker;
- } else {
- return $entry;
- }
- } else {
- $foundMissingIdentifier = true;
- return '';
- }
- }, $content, -1, $count);
- if ($foundMissingIdentifier) {
- return false;
- }
- return $count;
- }
-
- /**
- * Replace segments which are marked as not-cacheable by their actual content by invoking the Fusion Runtime.
- *
- * @param \Closure $uncachedCommandCallback
- * @param string $content The content potentially containing not cacheable segments marked by the respective tokens
- * @return integer Number of replaced placeholders
- */
- protected function replaceUncachedPlaceholders(\Closure $uncachedCommandCallback, &$content)
- {
- $cache = $this->cache;
- $content = preg_replace_callback(self::EVAL_PLACEHOLDER_REGEX, function ($match) use ($uncachedCommandCallback, $cache) {
- $command = $match['command'];
- $additionalData = json_decode($match['data'], true);
-
- return $uncachedCommandCallback($command, $additionalData, $cache);
- }, $content, -1, $count);
- return $count;
- }
-
- /**
- * Flush content cache entries by tag
- *
- * @param string $tag A tag value that was assigned to a cache entry in Fusion, for example "Everything", "Node_[…]", "NodeType_[…]", "DescendantOf_[…]" whereas "…" is the node identifier or node type respectively
- * @return integer The number of cache entries which actually have been flushed
- */
- public function flushByTag($tag)
- {
- return $this->cache->flushByTag($this->sanitizeTag($tag));
- }
-
- /**
- * Flush content cache entries by tags
- *
- * @param array $tags values that were assigned to a cache entry in Fusion, for example "Everything", "Node_[…]", "NodeType_[…]", "DescendantOf_[…]" whereas "…" is the node identifier or node type respectively
- * @return integer The number of cache entries which actually have been flushed
- */
- public function flushByTags(array $tags): int
- {
- return $this->cache->flushByTags($this->sanitizeTags($tags));
- }
-
- /**
- * Flush all content cache entries
- *
- * @return void
- */
- public function flush()
- {
- $this->cache->flush();
- }
-
- /**
- * Sanitizes the given tag for use with the cache framework
- *
- * @param string $tag A tag which possibly contains non-allowed characters, for example "NodeType_Acme.Com:Page"
- * @return string A cleaned up tag, for example "NodeType_Acme_Com-Page"
- */
- protected function sanitizeTag($tag)
- {
- return strtr($tag, '.:', '_-');
- }
-
- /**
- * Sanitizes multiple tags with sanitizeTag()
- *
- * @param array $tags Multiple tags
- * @return array The sanitized tags
- */
- protected function sanitizeTags(array $tags)
- {
- foreach ($tags as $key => $value) {
- $tags[$key] = $this->sanitizeTag($value);
- }
- return $tags;
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/Cache/FileMonitorListener.php b/src/Core/FusionProcessing/Fusion/Cache/FileMonitorListener.php
deleted file mode 100644
index 6107fa3..0000000
--- a/src/Core/FusionProcessing/Fusion/Cache/FileMonitorListener.php
+++ /dev/null
@@ -1,62 +0,0 @@
-flowCacheManager = $flowCacheManager;
- }
-
- /**
- * @param string $fileMonitorIdentifier
- * @param array $changedFiles
- * @return void
- */
- public function flushContentCacheOnFileChanges($fileMonitorIdentifier, array $changedFiles)
- {
- $fileMonitorsThatTriggerContentCacheFlush = [
- 'ContentRepository_NodeTypesConfiguration',
- 'Fusion_Files',
- 'Fluid_TemplateFiles',
- 'Flow_ClassFiles',
- 'Flow_ConfigurationFiles',
- 'Flow_TranslationFiles'
- ];
-
- if (in_array($fileMonitorIdentifier, $fileMonitorsThatTriggerContentCacheFlush)) {
- $this->flowCacheManager->getCache('Neos_Fusion_Content')->flush();
- }
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/Cache/FusionContextSerializer.php b/src/Core/FusionProcessing/Fusion/Cache/FusionContextSerializer.php
deleted file mode 100644
index a0a35e7..0000000
--- a/src/Core/FusionProcessing/Fusion/Cache/FusionContextSerializer.php
+++ /dev/null
@@ -1,55 +0,0 @@
- $context
- */
- public function denormalize(mixed $data, string $type, string $format = null, array $context = [])
- {
- return $this->propertyMapper->convert($data, $type);
- }
-
- /**
- * @param array $context
- * @return array
- */
- public function normalize(mixed $object, string $format = null, array $context = [])
- {
- return $this->propertyMapper->convert($object, 'string');
- }
-
- public function supportsDenormalization(mixed $data, string $type, string $format = null)
- {
- return true;
- }
-
- public function supportsNormalization(mixed $data, string $format = null)
- {
- return true;
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/Cache/ParserCache.php b/src/Core/FusionProcessing/Fusion/Cache/ParserCache.php
deleted file mode 100644
index 5102018..0000000
--- a/src/Core/FusionProcessing/Fusion/Cache/ParserCache.php
+++ /dev/null
@@ -1,148 +0,0 @@
-enableCache === false) {
- return $generateValueToCache();
- }
- if ($contextPathAndFilename === null) {
- return $generateValueToCache();
- }
- if (str_contains($contextPathAndFilename, 'resource://')) {
- $contextPathAndFilename = $this->getAbsolutePathForPackageRessourceUri($contextPathAndFilename);
- }
- if (str_contains($contextPathAndFilename, 'nodetypes://')) {
- $contextPathAndFilename = $this->getAbsolutePathForNodeTypesUri($contextPathAndFilename);
- }
- $fusionFileRealPath = realpath($contextPathAndFilename);
- if ($fusionFileRealPath === false) {
- // should not happen as the file would not been able to be read in the first place.
- throw new \RuntimeException("Couldn't resolve realpath for: '$contextPathAndFilename'", 1705409467);
- }
- $identifier = $this->getCacheIdentifierForAbsoluteUnixStyleFilePathWithoutDirectoryTraversal($fusionFileRealPath);
- return $this->cacheForIdentifier($identifier, $generateValueToCache);
- }
-
- public function cacheForDsl(string $identifier, string $code, \Closure $generateValueToCache): mixed
- {
- if ($this->enableCache === false) {
- return $generateValueToCache();
- }
- $identifier = $this->getCacheIdentifierForDslCode($identifier, $code);
- return $this->cacheForIdentifier($identifier, $generateValueToCache);
- }
-
- private function cacheForIdentifier(string $identifier, \Closure $generateValueToCache): mixed
- {
- $value = $this->parsePartialsCache->get($identifier);
- if ($value !== false) {
- return $value;
- }
- $value = $generateValueToCache();
- if ($value !== false) {
- // in the rare edge-case of a fusion dsl returning `false` we cannot cache it,
- // as the above get would be ignored. This is an acceptable compromise.
- $this->parsePartialsCache->set($identifier, $value);
- }
- return $value;
- }
-
- /**
- * Uses the same technique to resolve a package resource URI like Flow.
- *
- * resource://My.Site/Private/Fusion/Foo/Bar.fusion
- * ->
- * FLOW_PATH_ROOT/Packages/Sites/My.Package/Resources/Private/Fusion/Foo/Bar.fusion
- *
- * {@see \Neos\Flow\ResourceManagement\Streams\ResourceStreamWrapper::evaluateResourcePath()}
- * {@link https://github.com/neos/flow-development-collection/issues/2687}
- *
- * @throws \InvalidArgumentException
- */
- private function getAbsolutePathForPackageRessourceUri(string $requestedPath): string
- {
- $resourceUriParts = UnicodeFunctions::parse_url($requestedPath);
-
- if ((isset($resourceUriParts['scheme']) === false
- || $resourceUriParts['scheme'] !== 'resource')) {
- throw new \InvalidArgumentException("Unsupported stream wrapper: '$requestedPath'");
- }
-
- /** @var FlowPackageInterface $package */
- $package = $this->packageManager->getPackage($resourceUriParts['host']);
- return Files::concatenatePaths([$package->getResourcesPath(), $resourceUriParts['path']]);
- }
-
- /**
- * Uses the same technique to resolve a package nodetypes URI like Neos.
- *
- * nodetypes://My.Site/Foo/Bar.fusion
- * ->
- * FLOW_PATH_ROOT/Packages/Sites/My.Package/NodeTypes/Foo/Bar.fusion
- *
- * {@see \Neos\Neos\ResourceManagement\NodeTypesStreamWrapper::evaluateNodeTypesPath}
- *
- * @throws \InvalidArgumentException
- */
- private function getAbsolutePathForNodeTypesUri(string $requestedPath): string
- {
- $nodeTypeUriParts = UnicodeFunctions::parse_url($requestedPath);
-
- if ((isset($nodeTypeUriParts['scheme']) === false
- || $nodeTypeUriParts['scheme'] !== 'nodetypes')) {
- throw new \InvalidArgumentException("Unsupported stream wrapper: '$requestedPath'");
- }
-
- $package = $this->packageManager->getPackage($nodeTypeUriParts['host']);
- return Files::concatenatePaths([$package->getPackagePath(), 'NodeTypes', $nodeTypeUriParts['path']]);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/Cache/ParserCacheFlusher.php b/src/Core/FusionProcessing/Fusion/Cache/ParserCacheFlusher.php
deleted file mode 100644
index 7a98478..0000000
--- a/src/Core/FusionProcessing/Fusion/Cache/ParserCacheFlusher.php
+++ /dev/null
@@ -1,80 +0,0 @@
-flowCacheManager = $flowCacheManager;
- }
-
- /**
- * @param string $fileMonitorIdentifier
- * @param array $changedFiles
- * @return void
- */
- public function flushPartialCacheOnFileChanges($fileMonitorIdentifier, array $changedFiles)
- {
- if ($fileMonitorIdentifier !== 'Fusion_Files') {
- return;
- }
-
- $identifiersToFlush = [];
- foreach ($changedFiles as $changedFile => $status) {
- // flow returns linux style file paths without directory traversal from the file monitor.
- // As discovered via https://github.com/neos/neos-development-collection/issues/4915 the paths will point to symlinks instead of the actual file.
- // Thus, we still need to invoke `realpath` as the cache invalidation otherwise would not work (due to a different hash)
- // But attempting to use realpath on removed/moved files fails because it surely cannot be resolved via file system.
- if ($status === ChangeDetectionStrategyInterface::STATUS_DELETED) {
- // Ignoring removed files means we cannot flush removed files, but this is a compromise for now.
- // See https://github.com/neos/neos-development-collection/issues/4415 as reminder that flushing is disabled for deleted files
- continue;
- }
- $fusionFileRealPath = realpath($changedFile);
- if ($fusionFileRealPath === false) {
- // should not happen as we ignored deleted files beforehand.
- throw new \RuntimeException("Couldn't resolve realpath for: '$changedFile'", 1709122619);
- }
- $identifiersToFlush[] = $this->getCacheIdentifierForAbsoluteUnixStyleFilePathWithoutDirectoryTraversal($fusionFileRealPath);
- }
-
- if ($identifiersToFlush !== []) {
- $partialsCache = $this->flowCacheManager->getCache('Neos_Fusion_ParsePartials');
- foreach ($identifiersToFlush as $identifierToFlush) {
- if ($partialsCache->has($identifierToFlush)) {
- $partialsCache->remove($identifierToFlush);
- }
- }
- }
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/Cache/ParserCacheIdentifierTrait.php b/src/Core/FusionProcessing/Fusion/Cache/ParserCacheIdentifierTrait.php
deleted file mode 100644
index e9b564c..0000000
--- a/src/Core/FusionProcessing/Fusion/Cache/ParserCacheIdentifierTrait.php
+++ /dev/null
@@ -1,51 +0,0 @@
-runtime = $runtime;
- }
-
- public function injectSerializer(NormalizerInterface&DenormalizerInterface $serializer): void
- {
- $this->serializer = $serializer;
- }
-
- /**
- * Adds a tag built from the given key and value.
- *
- * @throws Exception
- */
- public function addTag(string $tag): void
- {
- $tag = trim($tag);
- if ($tag === '') {
- throw new Exception('Tag Value must not be empty', 1448264367);
- }
- $this->tags[$tag] = true;
- }
-
- /**
- * Resets the assigned tags, returning the previously set tags.
- *
- * @return array
- */
- protected function flushTags()
- {
- $tags = array_keys($this->tags);
- $this->tags = [];
- return $tags;
- }
-
- /**
- * Enter an evaluation
- *
- * Needs to be called right before evaluation of a path starts to check the cache mode and set internal state
- * like the cache entry point.
- *
- * @param array $configuration
- * @param string $fusionPath
- * @return array An evaluate context array that needs to be passed to subsequent calls to pass the current state
- * @throws Exception
- */
- public function enter(array $configuration, $fusionPath)
- {
- $cacheForPathEnabled = isset($configuration['mode']) && ($configuration['mode'] === 'cached' || $configuration['mode'] === 'dynamic');
- $cacheForPathDisabled = isset($configuration['mode']) && ($configuration['mode'] === 'uncached' || $configuration['mode'] === 'dynamic');
-
- if ($cacheForPathDisabled && (!isset($configuration['context']) || $configuration['context'] === [])) {
- throw new Exception(sprintf('Missing @cache.context configuration for path "%s". An uncached segment must have one or more context variable names configured.', $fusionPath), 1395922119);
- }
-
- $currentPathIsEntryPoint = false;
- if ($this->enableContentCache && $cacheForPathEnabled) {
- if ($this->inCacheEntryPoint === null) {
- $this->inCacheEntryPoint = true;
- $currentPathIsEntryPoint = true;
- }
- }
-
- return [
- 'configuration' => $configuration,
- 'fusionPath' => $fusionPath,
- 'cacheForPathEnabled' => $cacheForPathEnabled,
- 'cacheForPathDisabled' => $cacheForPathDisabled,
- 'currentPathIsEntryPoint' => $currentPathIsEntryPoint
- ];
- }
-
- /**
- * Check for cached evaluation and or collect metadata for evaluation
- *
- * Try to get a cached segment for the current path and return that with all uncached segments evaluated if it
- * exists. Otherwise metadata for the cache lifetime is collected (if configured) for nested evaluations (to find the
- * minimum maximumLifetime).
- *
- * @param array $evaluateContext The current evaluation context
- * @param object $fusionObject The current Fusion object (for "this" in evaluations)
- * @return array Cache hit state as boolean and value as mixed
- */
- public function preEvaluate(array &$evaluateContext, $fusionObject)
- {
- if ($this->enableContentCache) {
- if ($evaluateContext['cacheForPathEnabled'] && $evaluateContext['cacheForPathDisabled']) {
- $evaluateContext['cacheDiscriminator'] = $this->runtime->evaluate($evaluateContext['fusionPath'] . '/__meta/cache/entryDiscriminator');
- }
- if ($evaluateContext['cacheForPathEnabled']) {
- $evaluateContext['cacheIdentifierValues'] = $this->buildCacheIdentifierValues($evaluateContext['configuration'], $evaluateContext['fusionPath'], $fusionObject);
- $cacheDiscriminator = isset($evaluateContext['cacheDiscriminator']) ? $evaluateContext['cacheDiscriminator'] : null;
- $segment = $this->contentCache->getCachedSegment(function ($command, $additionalData, $cache) {
- if (strpos($command, 'eval=') === 0) {
- $unserializedContext = $this->unserializeContext($additionalData['context']);
- $path = substr($command, 5);
- $result = $this->evaluateUncached($path, $unserializedContext);
- return $result;
- } elseif (strpos($command, 'evalCached=') === 0) {
- /*
- * Why do we need the following line:
- * - in "enter" the cache context is decided upon which contains "currentPathIsEntryPoint".
- * - This can not happen in nested segments as the topmost entry point should be the only one active
- * - the result of a "currentPathIsEntryPoint" is that on postProcess cache segments are parsed from the content.
- * - To get "currentPathIsEntryPoint" only on topmost segments, the state "$this->inCacheEntryPoint" is used.
- * This state can have two values "true" and "null", in case it's true a topmost segment existed and "currentPathIsEntryPoint" will not be set
- * - A dynamic cache segment that we resolve here is to be seen independently from the parent cached entry as it is a forking point for content
- * It must create cache segment tokens in order to properly cache, but those also need to be removed from the result.
- * Therefore a dynamic cache entry must always have "currentPathIsEntryPoint" to make sure the markers are parsed regardless of the caching status of the upper levels
- * To make that happen the state "$this->inCacheEntryPoint" must be reset to null.
- */
- $previouslyInCacheEntryPoint = $this->inCacheEntryPoint;
- $this->inCacheEntryPoint = null;
-
- $unserializedContext = $this->unserializeContext($additionalData['context']);
- $this->runtime->pushContextArray($unserializedContext);
- $result = $this->runtime->evaluate($additionalData['path']);
- $this->runtime->popContext();
- $this->inCacheEntryPoint = $previouslyInCacheEntryPoint;
- return $result;
- } else {
- throw new Exception(sprintf('Unknown uncached command "%s"', $command), 1392837596);
- }
- }, $evaluateContext['fusionPath'], $evaluateContext['cacheIdentifierValues'], $this->addCacheSegmentMarkersToPlaceholders, $cacheDiscriminator);
- if ($segment !== false) {
- return [true, $segment];
- } else {
- $this->addCacheSegmentMarkersToPlaceholders = true;
- }
-
- $this->cacheMetadata[] = ['lifetime' => null];
- }
-
-
- if (isset($evaluateContext['configuration']['maximumLifetime'])) {
- $maximumLifetime = $this->runtime->evaluate($evaluateContext['fusionPath'] . '/__meta/cache/maximumLifetime', $fusionObject);
-
- if ($maximumLifetime !== null && $this->cacheMetadata !== []) {
- $parentCacheMetadata = &$this->cacheMetadata[count($this->cacheMetadata) - 1];
-
- if ($parentCacheMetadata['lifetime'] === null) {
- $parentCacheMetadata['lifetime'] = (int)$maximumLifetime;
- } elseif ($maximumLifetime > 0) {
- $parentCacheMetadata['lifetime'] = min((int)$parentCacheMetadata['lifetime'], (int)$maximumLifetime);
- }
- }
- }
- }
- return [false, null];
- }
-
- /**
- * Post process output for caching information
- *
- * The content cache stores cache segments with markers inside the generated content. This method creates cache
- * segments and will process the final outer result (currentPathIsEntryPoint) to remove all cache markers and
- * store cache entries.
- *
- * @param array $evaluateContext The current evaluation context
- * @param object $fusionObject The current Fusion object (for "this" in evaluations)
- * @param mixed $output The generated output after caching information was removed
- * @return mixed The post-processed output with cache segment markers or cleaned for the entry point
- */
- public function postProcess(array $evaluateContext, $fusionObject, $output)
- {
- if ($this->enableContentCache && $evaluateContext['cacheForPathEnabled'] && $evaluateContext['cacheForPathDisabled']) {
- $contextArray = $this->runtime->getCurrentContext();
- if (isset($evaluateContext['configuration']['context'])) {
- $contextVariables = [];
- foreach ($evaluateContext['configuration']['context'] as $contextVariableName) {
- $contextVariables[$contextVariableName] = $contextArray[$contextVariableName];
- }
- } else {
- $contextVariables = $contextArray;
- }
- $cacheTags = $this->buildCacheTags($evaluateContext['configuration'], $evaluateContext['fusionPath'], $fusionObject);
- $cacheMetadata = array_pop($this->cacheMetadata);
- $output = $this->contentCache->createDynamicCachedSegment($output, $evaluateContext['fusionPath'], $this->serializeContext($contextVariables), $evaluateContext['cacheIdentifierValues'], $cacheTags, $cacheMetadata['lifetime'], (string)$evaluateContext['cacheDiscriminator']);
- } elseif ($this->enableContentCache && $evaluateContext['cacheForPathEnabled']) {
- $cacheTags = $this->buildCacheTags($evaluateContext['configuration'], $evaluateContext['fusionPath'], $fusionObject);
- $cacheMetadata = array_pop($this->cacheMetadata);
- $output = $this->contentCache->createCacheSegment($output, $evaluateContext['fusionPath'], $evaluateContext['cacheIdentifierValues'], $cacheTags, $cacheMetadata['lifetime']);
- } elseif ($this->enableContentCache && $evaluateContext['cacheForPathDisabled'] && $this->inCacheEntryPoint) {
- $contextArray = $this->runtime->getCurrentContext();
- if (isset($evaluateContext['configuration']['context'])) {
- $contextVariables = [];
- foreach ($evaluateContext['configuration']['context'] as $contextVariableName) {
- if (isset($contextArray[$contextVariableName])) {
- $contextVariables[$contextVariableName] = $contextArray[$contextVariableName];
- } else {
- $contextVariables[$contextVariableName] = null;
- }
- }
- } else {
- $contextVariables = $contextArray;
- }
- $output = $this->contentCache->createUncachedSegment($output, $evaluateContext['fusionPath'], $this->serializeContext($contextVariables));
- }
-
- if ($evaluateContext['cacheForPathEnabled'] && $evaluateContext['currentPathIsEntryPoint']) {
- $output = $this->contentCache->processCacheSegments($output, $this->enableContentCache);
- $this->inCacheEntryPoint = null;
- $this->addCacheSegmentMarkersToPlaceholders = false;
- }
-
- return $output;
- }
-
- /**
- * Leave the evaluation of a path
- *
- * Has to be called in the same function calling enter() for every return path.
- *
- * @param array $evaluateContext The current evaluation context
- * @return void
- */
- public function leave(array $evaluateContext)
- {
- if ($evaluateContext['currentPathIsEntryPoint']) {
- $this->inCacheEntryPoint = null;
- }
- }
-
- /**
- * Evaluate a Fusion path with a given context without content caching
- *
- * This is used to render uncached segments "out of band" in getCachedSegment of ContentCache.
- *
- * @param string $path
- * @param array $contextArray
- * @return mixed
- *
- * TODO Find another way of disabling the cache (especially to allow cached content inside uncached content)
- */
- public function evaluateUncached($path, array $contextArray)
- {
- $previousEnableContentCache = $this->enableContentCache;
- $this->enableContentCache = false;
- $this->runtime->pushContextArray($contextArray);
- $result = $this->runtime->evaluate($path);
- $this->runtime->popContext();
- $this->enableContentCache = $previousEnableContentCache;
- return $result;
- }
-
- /**
- * Builds an array of additional key / values which must go into the calculation of the cache entry identifier for
- * a cached content segment.
- *
- * @param array $configuration
- * @param string $fusionPath
- * @param object $fusionObject The actual Fusion object
- * @return array
- */
- protected function buildCacheIdentifierValues(array $configuration, $fusionPath, $fusionObject)
- {
- $objectType = '';
- if (isset($configuration['entryIdentifier']['__objectType'])) {
- $objectType = '<' . $configuration['entryIdentifier']['__objectType'] . '>';
- }
- return $this->runtime->evaluate($fusionPath . '/__meta/cache/entryIdentifier' . $objectType, $fusionObject);
- }
-
- /**
- * Builds an array of string which must be used as tags for the cache entry identifier of a specific cached content segment.
- *
- * @param array $configuration
- * @param string $fusionPath
- * @param object $fusionObject The actual Fusion object
- * @return array
- */
- protected function buildCacheTags(array $configuration, $fusionPath, $fusionObject)
- {
- $cacheTags = [];
- if (isset($configuration['entryTags'])) {
- foreach ($configuration['entryTags'] as $tagKey => $tagValue) {
- $tagValue = $this->runtime->evaluate($fusionPath . '/__meta/cache/entryTags/' . $tagKey, $fusionObject);
- if (is_array($tagValue)) {
- $cacheTags = array_merge($cacheTags, $tagValue);
- } elseif ((string)$tagValue !== '') {
- $cacheTags[] = $tagValue;
- }
- }
- foreach ($this->flushTags() as $tagKey => $tagValue) {
- $cacheTags[] = $tagValue;
- }
- } else {
- $cacheTags = [ContentCache::TAG_EVERYTHING];
- }
- return array_unique($cacheTags);
- }
-
- /**
- * Encodes an array of context variables to its serialized representation
- * {@see self::unserializeContext()}
- *
- * @param array $contextVariables
- * @return array
- */
- protected function serializeContext(array $contextVariables): array
- {
- $serializedContextArray = [];
- foreach ($contextVariables as $variableName => $contextValue) {
- if ($contextValue !== null) {
- $serializedContextArray[$variableName]['type'] = TypeHandling::getTypeForValue($contextValue);
- $serializedContextArray[$variableName]['value'] = $this->serializer->normalize($contextValue);
- }
- }
-
- return $serializedContextArray;
- }
-
- /**
- * Decodes and serialized array of context variables to its original values
- * {@see self::serializeContext()}
- *
- * @param array $contextArray
- * @return array
- */
- protected function unserializeContext(array $contextArray): array
- {
- $unserializedContext = [];
- foreach ($contextArray as $variableName => $typeAndValue) {
- $value = $this->serializer->denormalize($typeAndValue['value'], $typeAndValue['type']);
- $unserializedContext[$variableName] = $value;
- }
-
- return $unserializedContext;
- }
-
- /**
- * @param boolean $enableContentCache
- * @return void
- */
- public function setEnableContentCache($enableContentCache)
- {
- $this->enableContentCache = $enableContentCache;
- }
-
- /**
- * @return boolean
- */
- public function getEnableContentCache()
- {
- return $this->enableContentCache;
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/DslFactory.php b/src/Core/FusionProcessing/Fusion/DslFactory.php
deleted file mode 100644
index a270879..0000000
--- a/src/Core/FusionProcessing/Fusion/DslFactory.php
+++ /dev/null
@@ -1,53 +0,0 @@
->|null
- */
- protected $dslSettings;
-
- /**
- * @param string $identifier
- * @return DslInterface
- * @throws Fusion\Exception
- */
- public function create(string $identifier): DslInterface
- {
- if (is_array($this->dslSettings) && isset($this->dslSettings[$identifier])) {
- $dslObjectName = $this->dslSettings[$identifier];
- if (!class_exists($dslObjectName)) {
- throw new Fusion\Exception(sprintf('The fusion dsl-object %s was not found.', $dslObjectName), 1490776462);
- }
- $dslObject = new $dslObjectName();
- if (!$dslObject instanceof DslInterface) {
- throw new Fusion\Exception(sprintf('The fusion dsl-object was of type %s but was supposed to be of type %s', get_class($dslObject), DslInterface::class), 1490776470);
- }
- return new $dslObject();
- }
- throw new Fusion\Exception(sprintf('The fusion dsl-object for the key %s was not configured', $identifier), 1490776550);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/DslInterface.php b/src/Core/FusionProcessing/Fusion/DslInterface.php
deleted file mode 100644
index 09037d9..0000000
--- a/src/Core/FusionProcessing/Fusion/DslInterface.php
+++ /dev/null
@@ -1,54 +0,0 @@
-Hello World
- * `
- * The returned string must be a valid fusion string,
- * which is parsed again:
- *
- * Neos.Fusion:Tag {
- * tagName = 'div'
- * content = 'Hello World'
- * }
- *
- * @api
- */
-interface DslInterface
-{
- /**
- * Transpile the given dsl-code to fusion-code
- *
- * @param string $code
- * @return string
- * @throws Fusion\Exception
- */
- public function transpile(string $code): string;
-}
diff --git a/src/Core/FusionProcessing/Fusion/EelNeosDeprecationTracer.php b/src/Core/FusionProcessing/Fusion/EelNeosDeprecationTracer.php
deleted file mode 100644
index 2231294..0000000
--- a/src/Core/FusionProcessing/Fusion/EelNeosDeprecationTracer.php
+++ /dev/null
@@ -1,96 +0,0 @@
- true,
- 'accessroles' => true,
- 'accessible' => true,
- 'autocreated' => true,
- 'cacheentryidentifier' => true,
- 'childnodes' => true,
- 'contentobject' => true,
- 'context' => true,
- 'contextpath' => true,
- 'creationdatetime' => true,
- 'depth' => true,
- 'dimensions' => true,
- 'hidden' => true,
- 'hiddenafterdatetime' => true,
- 'hiddenbeforedatetime' => true,
- 'hiddeninindex' => true,
- 'identifier' => true,
- 'index' => true,
- 'label' => true,
- 'lastmodificationdatetime' => true,
- 'lastpublicationdatetime' => true,
- 'nodeaggregateidentifier' => true,
- 'nodedata' => true,
- 'nodename' => true,
- 'nodetype' => true,
- 'numberofchildnodes' => true,
- 'othernodevariants' => true,
- 'parent' => true,
- 'parentpath' => true,
- 'path' => true,
- 'primarychildnode' => true,
- 'propertynames' => true,
- 'removed' => true,
- 'root' => true,
- 'tethered' => true,
- 'visible' => true,
- 'workspace' => true,
- ];
-
- public function __construct(
- private readonly string $eelExpression,
- private readonly bool $throwExceptions,
- ) {
- }
-
- public function recordPropertyAccess(object $object, string $propertyName): void
- {
- if (
- // deliberate cross package reference from Neos.Fusion to simplify the wiring of this temporary migration helper
- $object instanceof Node
- && array_key_exists(strtolower($propertyName), self::LEGACY_NODE_FIELDS)
- ) {
- $this->logDeprecationOrThrowException(
- sprintf('The node field "%s" is removed in "%s"', $propertyName, $this->eelExpression)
- );
- }
- }
-
- public function recordMethodCall(object $object, string $methodName, array $arguments): void
- {
- }
-
- public function recordFunctionCall(callable $function, string $functionName, array $arguments): void
- {
- }
-
- private function logDeprecationOrThrowException(string $message): void
- {
- if ($this->throwExceptions) {
- throw new \RuntimeException($message);
- } else {
- $this->logger->debug($message);
- }
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ExceptionHandlers/AbsorbingHandler.php b/src/Core/FusionProcessing/Fusion/ExceptionHandlers/AbsorbingHandler.php
deleted file mode 100644
index 641d7b0..0000000
--- a/src/Core/FusionProcessing/Fusion/ExceptionHandlers/AbsorbingHandler.php
+++ /dev/null
@@ -1,65 +0,0 @@
-systemLogger->debug('Absorbed Exception: ' . $exception->getMessage(), ['fusionPath' => $fusionPath, 'referenceCode' => $referenceCode, 'FLOW_LOG_ENVIRONMENT' => ['packageKey' => 'Neos.Fusion', 'className' => self::class, 'methodName' => 'handle']]);
- $this->throwableStorage->logThrowable($exception);
- return '';
- }
-
- /**
- * The absorbing handler is meant to catch loose evaluation errors (like missing assets) in a useful way,
- * therefor caching is desired.
- *
- * @param string $fusionPath
- * @param \Exception $exception
- * @return boolean
- */
- protected function exceptionDisablesCache($fusionPath, \Exception $exception)
- {
- return false;
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ExceptionHandlers/AbstractRenderingExceptionHandler.php b/src/Core/FusionProcessing/Fusion/ExceptionHandlers/AbstractRenderingExceptionHandler.php
deleted file mode 100644
index bcd12ad..0000000
--- a/src/Core/FusionProcessing/Fusion/ExceptionHandlers/AbstractRenderingExceptionHandler.php
+++ /dev/null
@@ -1,130 +0,0 @@
-runtime = $runtime;
- }
-
- /**
- * Returns current Fusion runtime
- *
- * @return Runtime
- */
- protected function getRuntime()
- {
- return $this->runtime;
- }
-
- /**
- * Handle an Exception thrown while rendering Fusion
- *
- * @param string $fusionPath
- * @param \Exception $exception
- * @return string
- * @throws StopActionException|SecurityException
- */
- public function handleRenderingException($fusionPath, \Exception $exception)
- {
- if ($exception instanceof StopActionException || $exception instanceof SecurityException) {
- throw $exception;
- }
- if ($exception instanceof Exceptions\RuntimeException) {
- $fusionPath = $exception->getFusionPath();
- /** @var \Exception $exception */
- $exception = $exception->getPrevious();
- }
- if ($this->exceptionDisablesCache($fusionPath, $exception)) {
- $this->runtime->setEnableContentCache(false);
- }
- $referenceCode = ($exception instanceof \Neos\Flow\Exception) ? $exception->getReferenceCode() : null;
- return $this->handle($fusionPath, $exception, $referenceCode);
- }
-
- /**
- * Handles an Exception thrown while rendering Fusion
- *
- * @param string $fusionPath path causing the exception
- * @param \Exception $exception exception to handle
- * @param string|null $referenceCode
- * @return string
- */
- abstract protected function handle($fusionPath, \Exception $exception, $referenceCode);
-
- /**
- * breaks the given path to multiple line to allow a nicer formatted logging
- *
- * example:
- * formatScriptPath('page/body/content/main', ''):
- * page/body/content/main
- *
- * formatScriptPath('page/body/content/main', '\n\t\t'):
- * page/
- * body/
- * content/
- * main'
- *
- * @param string $fusionPath path to format
- * @param string $delimiter path element delimiter
- * @param bool $escapeHtml indicates whether to escape html-characters in the given path
- * @return string
- */
- protected function formatScriptPath($fusionPath, $delimiter, $escapeHtml = true)
- {
- if ($escapeHtml) {
- $fusionPath = htmlspecialchars($fusionPath);
- }
- // TODO: hardcoded parsing?! where is the library for that
- $elements = explode('/', $fusionPath);
-
- return implode('/' . $delimiter, $elements);
- }
-
- /**
- * Can be used to determine if handling the exception should disable the cache or not.
- *
- * @param string $fusionPath The Fusion-Path that triggered the Exception
- * @param \Exception $exception
- * @return boolean Should caching be disabled?
- */
- protected function exceptionDisablesCache($fusionPath, \Exception $exception)
- {
- return true;
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ExceptionHandlers/BubblingHandler.php b/src/Core/FusionProcessing/Fusion/ExceptionHandlers/BubblingHandler.php
deleted file mode 100644
index de69a2f..0000000
--- a/src/Core/FusionProcessing/Fusion/ExceptionHandlers/BubblingHandler.php
+++ /dev/null
@@ -1,58 +0,0 @@
-environment->getContext();
- if ($context->isDevelopment()) {
- $handler = new HtmlMessageHandler();
- } else {
- $handler = new XmlCommentHandler();
- }
- $handler->setRuntime($this->getRuntime());
- return $handler->handleRenderingException($fusionPath, $exception);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ExceptionHandlers/HtmlMessageHandler.php b/src/Core/FusionProcessing/Fusion/ExceptionHandlers/HtmlMessageHandler.php
deleted file mode 100644
index ef39f2d..0000000
--- a/src/Core/FusionProcessing/Fusion/ExceptionHandlers/HtmlMessageHandler.php
+++ /dev/null
@@ -1,136 +0,0 @@
-logger = $logger;
- }
-
- /**
- * @param ThrowableStorageInterface $throwableStorage
- */
- public function injectThrowableStorage(ThrowableStorageInterface $throwableStorage): void
- {
- $this->throwableStorage = $throwableStorage;
- }
-
- /**
- * @param bool $renderTechnicalDetails whether or not to render technical details (i.e. the Fusion stacktrace) in the exception message
- */
- public function __construct(bool $renderTechnicalDetails = true)
- {
- $this->renderTechnicalDetails = $renderTechnicalDetails;
- }
-
- /**
- * Renders the exception in HTML for display
- *
- * @param string $fusionPath path causing the exception
- * @param \Exception $exception exception to handle
- * @param string|null $referenceCode
- * @return string
- */
- protected function handle($fusionPath, \Exception $exception, $referenceCode)
- {
- $messageBody = '';
- if ($this->renderTechnicalDetails) {
- $messageBody .= sprintf('%s
', htmlspecialchars($exception->getMessage()));
- $messageBody .= sprintf('%s
', $this->formatFusionPath($fusionPath));
- }
-
- if ($referenceCode) {
- $messageBody .= sprintf('%s
', $this->formatErrorCodeMessage($referenceCode));
- }
-
- $message = sprintf(
- '' .
- '%s
',
- $messageBody
- );
-
- $logMessage = $this->throwableStorage->logThrowable($exception);
- $this->logger->error($logMessage, LogEnvironment::fromMethodName(__METHOD__));
- return $message;
- }
-
- /**
- * Renders a message depicting the user where to find further information
- * for the given reference code.
- *
- * @param string $referenceCode
- * @return string A rendered message with the reference code containing HTML
- */
- protected function formatErrorCodeMessage($referenceCode)
- {
- return ($referenceCode ? 'For a full stacktrace, open Data/Logs/Exceptions/' . $referenceCode . '.txt' : '');
- }
-
- /**
- * Renders an indented multi-line stack-trace for the given Fusion path.
- *
- * example:
- *
- * default/body/content/
- *
- * is rendered as
- *
- * default/
- * body/
- * content/
- *
- * @param string $fusionPath
- * @return string Multi-line stack trace for the given Fusion path
- */
- protected function formatFusionPath($fusionPath)
- {
- $pathSegments = [];
- $spacer = '';
- foreach (explode('/', $fusionPath) as $segment) {
- $pathSegments[] = $spacer . $segment . '/';
- $spacer .= ' ';
- }
- return htmlentities(implode("\n", $pathSegments));
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ExceptionHandlers/PlainTextHandler.php b/src/Core/FusionProcessing/Fusion/ExceptionHandlers/PlainTextHandler.php
deleted file mode 100644
index c610eed..0000000
--- a/src/Core/FusionProcessing/Fusion/ExceptionHandlers/PlainTextHandler.php
+++ /dev/null
@@ -1,48 +0,0 @@
-formatScriptPath($fusionPath, "\n\t", false),
- strip_tags($exception->getMessage()),
- $referenceCode
- );
- } else {
- return sprintf(
- 'Exception while rendering %s: %s',
- $this->formatScriptPath($fusionPath, "\n\t", false),
- strip_tags($exception->getMessage())
- );
- }
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ExceptionHandlers/ThrowingHandler.php b/src/Core/FusionProcessing/Fusion/ExceptionHandlers/ThrowingHandler.php
deleted file mode 100644
index 16d170c..0000000
--- a/src/Core/FusionProcessing/Fusion/ExceptionHandlers/ThrowingHandler.php
+++ /dev/null
@@ -1,52 +0,0 @@
-logger = $logger;
- }
-
- /**
- * @param ThrowableStorageInterface $throwableStorage
- */
- public function injectThrowableStorage(ThrowableStorageInterface $throwableStorage): void
- {
- $this->throwableStorage = $throwableStorage;
- }
-
- /**
- * Provides an XML comment containing the exception
- *
- * @param string $fusionPath path causing the exception
- * @param \Exception $exception exception to handle
- * @param string|null $referenceCode
- * @return string
- */
- protected function handle($fusionPath, \Exception $exception, $referenceCode)
- {
- $logMessage = $this->throwableStorage->logThrowable($exception);
- $this->logger->error($logMessage, LogEnvironment::fromMethodName(__METHOD__));
- if (isset($referenceCode)) {
- return sprintf(
- '',
- $this->formatScriptPath($fusionPath, ''),
- htmlspecialchars($exception->getMessage()),
- $referenceCode
- );
- } else {
- return sprintf(
- '',
- $this->formatScriptPath($fusionPath, ''),
- htmlspecialchars($exception->getMessage())
- );
- }
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/FusionConfiguration.php b/src/Core/FusionProcessing/Fusion/FusionConfiguration.php
deleted file mode 100644
index d6ab1e3..0000000
--- a/src/Core/FusionProcessing/Fusion/FusionConfiguration.php
+++ /dev/null
@@ -1,50 +0,0 @@
- $fusionConfiguration The representation of the configuration as array is fully internal and only allowed to be accessed by the Runtime
- */
- private function __construct(
- private array $fusionConfiguration
- ) {
- }
-
- /**
- * @internal
- * @param array $fusionConfiguration
- */
- public static function fromArray(array $fusionConfiguration): self
- {
- return new self($fusionConfiguration);
- }
-
- /**
- * @internal
- * @return array
- */
- public function toArray(): array
- {
- return $this->fusionConfiguration;
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/FusionGlobals.php b/src/Core/FusionProcessing/Fusion/FusionGlobals.php
deleted file mode 100644
index 1e0595f..0000000
--- a/src/Core/FusionProcessing/Fusion/FusionGlobals.php
+++ /dev/null
@@ -1,82 +0,0 @@
- $value
- */
- private function __construct(
- public array $value
- ) {
- }
-
- public static function empty(): self
- {
- return new self([]);
- }
-
- /**
- * @param array $variables
- */
- public static function fromArray(array $variables): self
- {
- return new self($variables);
- }
-
- /**
- * Access the possible current request or other globals:
- *
- * $actionRequest = $this->runtime->fusionGlobals->get('request');
- * if (!$actionRequest instanceof ActionRequest) {
- * // fallback or error
- * }
- *
- */
- public function get(string $name): mixed
- {
- return $this->value[$name] ?? null;
- }
-
- public function has(string $name): bool
- {
- return array_key_exists($name, $this->value);
- }
-
- public function merge(FusionGlobals $other): self
- {
- return new self(
- [...$this->value, ...$other->value]
- );
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/FusionSourceCode.php b/src/Core/FusionProcessing/Fusion/FusionSourceCode.php
deleted file mode 100644
index fec9130..0000000
--- a/src/Core/FusionProcessing/Fusion/FusionSourceCode.php
+++ /dev/null
@@ -1,66 +0,0 @@
- file_get_contents($filePath));
- }
-
- /**
- * Watch out for unexpected behaviour {@link https://github.com/neos/neos-development-collection/issues/3835}
- */
- public static function fromDangerousPotentiallyDifferingSourceCodeAndFilePath(string $sourceCode, string $filePath): self
- {
- return new self($filePath, $sourceCode);
- }
-
- public function getSourceCode(): string
- {
- return $this->sourceCodeOrFactory instanceof \Closure
- ? $this->sourceCodeOrFactory = ($this->sourceCodeOrFactory)()
- : $this->sourceCodeOrFactory;
- }
-
- public function getFilePath(): ?string
- {
- return $this->filePath;
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/FusionSourceCodeCollection.php b/src/Core/FusionProcessing/Fusion/FusionSourceCodeCollection.php
deleted file mode 100644
index 26a043a..0000000
--- a/src/Core/FusionProcessing/Fusion/FusionSourceCodeCollection.php
+++ /dev/null
@@ -1,103 +0,0 @@
-
- * @internal The Fusion parsing is considered internal.
- * For interacting with Fusion from the outside a FusionView should be used.
- */
-final class FusionSourceCodeCollection implements \IteratorAggregate, \Countable
-{
- /** @var array */
- private array $fusionCodeCollection;
-
- /**
- * @Flow\Autowiring(false)
- * @param $fusionSourceCode array
- */
- public function __construct(FusionSourceCode ...$fusionSourceCode)
- {
- $this->fusionCodeCollection = self::deduplicateItemsAndKeepLast($fusionSourceCode);
- }
-
- public static function fromFilePath(string $filePath): self
- {
- return new self(FusionSourceCode::fromFilePath($filePath));
- }
-
- public static function fromString(string $string): self
- {
- return new self(FusionSourceCode::fromString($string));
- }
-
- public static function tryFromFilePath(string $filePath): self
- {
- if (!is_readable($filePath)) {
- return self::empty();
- }
- return self::fromFilePath($filePath);
- }
-
- /**
- * @deprecated with Neos 9, remove me :)
- */
- public static function tryFromPackageRootFusion(string $packageKey): self
- {
- $fusionPathAndFilename = sprintf('resource://%s/Private/Fusion/Root.fusion', $packageKey);
- return self::tryFromFilePath($fusionPathAndFilename);
- }
-
- public static function empty(): self
- {
- return new self();
- }
-
- public function union(FusionSourceCodeCollection $other): self
- {
- return new self(...$this->fusionCodeCollection, ...$other->fusionCodeCollection);
- }
-
- public function getIterator(): \Traversable
- {
- yield from $this->fusionCodeCollection;
- }
-
- public function count(): int
- {
- return count($this->fusionCodeCollection);
- }
-
- /**
- * @param array $fusionSourceCode
- * @return array
- */
- private static function deduplicateItemsAndKeepLast(array $fusionSourceCode): array
- {
- $deduplicated = [];
- $includedFilePathsAndTheirPreviousIndex = [];
- foreach ($fusionSourceCode as $index => $sourceCode) {
- if (isset($includedFilePathsAndTheirPreviousIndex[$sourceCode->getFilePath()])) {
- unset($deduplicated[$includedFilePathsAndTheirPreviousIndex[$sourceCode->getFilePath()]]);
- }
- $deduplicated[$index] = $sourceCode;
- if ($sourceCode->getFilePath()) {
- $includedFilePathsAndTheirPreviousIndex[$sourceCode->getFilePath()] = $index;
- }
- }
- return array_values($deduplicated);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/IllegalEntryFusionPathValueException.php b/src/Core/FusionProcessing/Fusion/IllegalEntryFusionPathValueException.php
deleted file mode 100644
index fbf23e1..0000000
--- a/src/Core/FusionProcessing/Fusion/IllegalEntryFusionPathValueException.php
+++ /dev/null
@@ -1,9 +0,0 @@
-runtime->fusionGlobals->get('request');
- * if (!$actionRequest instanceof ActionRequest) {
- * // fallback or error
- * }
- *
- * To get an {@see UriBuilder} proceed with:
- *
- * $uriBuilder = new UriBuilder();
- * $uriBuilder->setRequest($actionRequest);
- *
- * WARNING regarding {@see Runtime::getControllerContext()}:
- * Invoking this backwards-compatible layer is possibly unsafe, if the rendering was not started
- * in {@see self::renderResponse()} or no `request` global is available. This will raise an exception.
- *
- * @deprecated with Neos 9.0 can be removed with 10
- * @internal
- */
-final class LegacyFusionControllerContext
-{
- /**
- * @Flow\Inject
- * @var FlashMessageService
- */
- protected $flashMessageService;
-
- public function __construct(
- private readonly ActionRequest $request,
- private readonly ActionResponse $legacyActionResponseForCurrentRendering
- ) {
- }
-
- /**
- * To migrate the use case of fetching the active request, please look into {@see FusionGlobals::get()} instead.
- * By convention, an {@see ActionRequest} will be available as `request`:
- *
- * $actionRequest = $this->runtime->fusionGlobals->get('request');
- * if (!$actionRequest instanceof ActionRequest) {
- * // fallback or error
- * }
- *
- * @deprecated with Neos 9.0 can be removed with 10
- */
- public function getRequest(): ActionRequest
- {
- return $this->request;
- }
-
- /**
- * To migrate the use case of getting the UriBuilder please use this instead:
- *
- * $actionRequest = $this->runtime->fusionGlobals->get('request');
- * if (!$actionRequest instanceof ActionRequest) {
- * // fallback or error
- * }
- * $uriBuilder = new UriBuilder();
- * $uriBuilder->setRequest($actionRequest);
- *
- * @deprecated with Neos 9.0 can be removed with 10
- */
- public function getUriBuilder(): UriBuilder
- {
- $uriBuilder = new UriBuilder();
- $uriBuilder->setRequest($this->request);
- return $uriBuilder;
- }
-
- /**
- * To migrate this use case please use {@see FlashMessageService::getFlashMessageContainerForRequest()} in
- * combination with fetching the active request as described here {@see getRequest} instead.
- *
- * @deprecated with Neos 9.0 can be removed with 10
- */
- public function getFlashMessageContainer(): FlashMessageContainer
- {
- return $this->flashMessageService->getFlashMessageContainerForRequest($this->request);
- }
-
- /**
- * PURELY INTERNAL with partially undefined behaviour!!!
- *
- * Gives access to the legacy mutable action response simulation {@see Runtime::withSimulatedLegacyControllerContext()}
- *
- * Initially it was possible to mutate the current response of the active MVC controller through this getter.
- *
- * While *HIGHLY* internal behaviour and *ONLY* to be used by Neos.Fusion.Form or Neos.Neos:Plugin
- * this legacy layer is in place to still allow this functionality.
- *
- * @deprecated with Neos 9.0 can be removed with 10
- * @internal THIS SHOULD NEVER BE CALLED ON USER-LAND
- */
- public function getResponse(): ActionResponse
- {
- // expose action response to be possibly mutated in neos forms or fusion plugins.
- // this behaviour is highly internal and deprecated!
- return $this->legacyActionResponseForCurrentRendering;
- }
-
- /**
- * The method {@see ControllerContext::getArguments()} was removed without replacement.
- */
- // public function getArguments(): Arguments;
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/AbstractNode.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/AbstractNode.php
deleted file mode 100644
index fdbc0cd..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/AbstractNode.php
+++ /dev/null
@@ -1,25 +0,0 @@
-visitAssignedObjectPath($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/Block.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/Block.php
deleted file mode 100644
index b00a01d..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/Block.php
+++ /dev/null
@@ -1,32 +0,0 @@
-visitBlock($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/BoolValue.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/BoolValue.php
deleted file mode 100644
index c52e8a0..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/BoolValue.php
+++ /dev/null
@@ -1,32 +0,0 @@
-visitBoolValue($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/DslExpressionValue.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/DslExpressionValue.php
deleted file mode 100644
index f1d7b84..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/DslExpressionValue.php
+++ /dev/null
@@ -1,33 +0,0 @@
-visitDslExpressionValue($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/EelExpressionValue.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/EelExpressionValue.php
deleted file mode 100644
index 546c33b..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/EelExpressionValue.php
+++ /dev/null
@@ -1,32 +0,0 @@
-visitEelExpressionValue($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/FloatValue.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/FloatValue.php
deleted file mode 100644
index ea1a2f3..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/FloatValue.php
+++ /dev/null
@@ -1,32 +0,0 @@
-visitFloatValue($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/FusionFile.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/FusionFile.php
deleted file mode 100644
index 21253c0..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/FusionFile.php
+++ /dev/null
@@ -1,33 +0,0 @@
-visitFusionFile($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/FusionObjectValue.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/FusionObjectValue.php
deleted file mode 100644
index 57d49cc..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/FusionObjectValue.php
+++ /dev/null
@@ -1,32 +0,0 @@
-visitFusionObjectValue($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/IncludeStatement.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/IncludeStatement.php
deleted file mode 100644
index dfa8b3e..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/IncludeStatement.php
+++ /dev/null
@@ -1,32 +0,0 @@
-visitIncludeStatement($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/IntValue.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/IntValue.php
deleted file mode 100644
index ea9d42a..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/IntValue.php
+++ /dev/null
@@ -1,32 +0,0 @@
-visitIntValue($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/MetaPathSegment.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/MetaPathSegment.php
deleted file mode 100644
index 21b4f39..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/MetaPathSegment.php
+++ /dev/null
@@ -1,32 +0,0 @@
-visitMetaPathSegment($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/NullValue.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/NullValue.php
deleted file mode 100644
index 8a24322..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/NullValue.php
+++ /dev/null
@@ -1,27 +0,0 @@
-visitNullValue($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ObjectPath.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ObjectPath.php
deleted file mode 100644
index 965e4eb..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ObjectPath.php
+++ /dev/null
@@ -1,37 +0,0 @@
-segments = $segments;
- }
-
- public function visit(AstNodeVisitorInterface $visitor, mixed ...$args)
- {
- return $visitor->visitObjectPath($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ObjectStatement.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ObjectStatement.php
deleted file mode 100644
index 398a9bd..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ObjectStatement.php
+++ /dev/null
@@ -1,35 +0,0 @@
-visitObjectStatement($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/PathSegment.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/PathSegment.php
deleted file mode 100644
index 7d8b626..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/PathSegment.php
+++ /dev/null
@@ -1,32 +0,0 @@
-visitPathSegment($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/PrototypePathSegment.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/PrototypePathSegment.php
deleted file mode 100644
index ee8499a..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/PrototypePathSegment.php
+++ /dev/null
@@ -1,32 +0,0 @@
-visitPrototypePathSegment($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/StatementList.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/StatementList.php
deleted file mode 100644
index dee27d1..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/StatementList.php
+++ /dev/null
@@ -1,37 +0,0 @@
-statements = $statements;
- }
-
- public function visit(AstNodeVisitorInterface $visitor, mixed ...$args)
- {
- return $visitor->visitStatementList($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/StringValue.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/StringValue.php
deleted file mode 100644
index 2929318..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/StringValue.php
+++ /dev/null
@@ -1,32 +0,0 @@
-visitStringValue($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ValueAssignment.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ValueAssignment.php
deleted file mode 100644
index cee3661..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ValueAssignment.php
+++ /dev/null
@@ -1,32 +0,0 @@
-visitValueAssignment($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ValueCopy.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ValueCopy.php
deleted file mode 100644
index 1b243a4..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ValueCopy.php
+++ /dev/null
@@ -1,32 +0,0 @@
-visitValueCopy($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ValueUnset.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ValueUnset.php
deleted file mode 100644
index bb252db..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Ast/ValueUnset.php
+++ /dev/null
@@ -1,27 +0,0 @@
-visitValueUnset($this, ...$args);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/AstNodeVisitorInterface.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/AstNodeVisitorInterface.php
deleted file mode 100644
index 7866836..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/AstNodeVisitorInterface.php
+++ /dev/null
@@ -1,64 +0,0 @@
-[^/]+)/ # Acme.Demo/
- (?:Private/Fusion/)? # ignore default path Private/Fusion/
- (?:\.{1,2}/)* # ignore any kind of ./ or ../ greedy (also ./../../../)
- (?.*) # left over is a small clean file name with folders.
- `x
- REGEX;
-
- protected int $fluentCode;
- protected \Closure $fluentMessageCreator;
- protected ?\Throwable $fluentPrevious = null;
-
- protected ?string $fluentFile;
- protected string $fluentFusion;
- protected int $fluentCursor;
- protected bool $fluentShowColumn = true;
-
- protected string $headingMessagePart;
- protected string $asciiPreviewMessagePart;
- protected string $helperMessagePart;
-
- public function __construct()
- {
- }
-
- public function getHeadingMessagePart(): string
- {
- return $this->headingMessagePart;
- }
-
- public function getAsciiPreviewMessagePart(): string
- {
- return $this->asciiPreviewMessagePart;
- }
-
- public function getHelperMessagePart(): string
- {
- return $this->helperMessagePart;
- }
-
- public function setCode(int $code): self
- {
- $this->fluentCode = $code;
- return $this;
- }
-
- public function setFile(?string $file): self
- {
- $this->fluentFile = $file;
- return $this;
- }
-
- public function setFusion(string $fusion): self
- {
- $this->fluentFusion = $fusion;
- return $this;
- }
-
- public function setCursor(int $cursor): self
- {
- $this->fluentCursor = $cursor;
- return $this;
- }
-
- public function setPrevious(?\Exception $previous): self
- {
- $this->fluentPrevious = $previous;
- return $this;
- }
-
- public function setHideColumnInformation(): self
- {
- $this->fluentShowColumn = false;
- return $this;
- }
-
- /**
- * @param callable(MessageLinePart $next, MessageLinePart $prev): string $messageCreator
- */
- public function setMessageCreator(callable $messageCreator): self
- {
- if ($messageCreator instanceof \Closure === false) {
- $messageCreator = \Closure::fromCallable($messageCreator);
- }
- $this->fluentMessageCreator = $messageCreator;
- return $this;
- }
-
- public function setMessage(string $message): self
- {
- return $this->setMessageCreator(static function () use ($message) {
- return $message;
- });
- }
-
- public function build(): self
- {
- $fullMessage = $this->renderAndInitializeFullMessage();
- parent::__construct($fullMessage, $this->fluentCode, $this->fluentPrevious);
- return $this;
- }
-
- protected function renderAndInitializeFullMessage(): string
- {
- list(
- $lineNumberCursor,
- $linePartAfterCursor,
- $linePartBeforeCursor
- ) = self::splitAtCursorGetLinePartsAndLineNumber($this->fluentFusion, $this->fluentCursor);
-
- $isEof = strlen($this->fluentFusion) === $this->fluentCursor;
- $nextLine = new MessageLinePart($linePartAfterCursor, $isEof);
- $prevLine = new MessageLinePart($linePartBeforeCursor);
-
- $columnNumber = mb_strlen($linePartBeforeCursor) + 1;
-
- $this->headingMessagePart = self::generateHeadingByFileName($this->fluentFile);
- $this->asciiPreviewMessagePart = self::renderErrorLinePreview(
- $this->fluentFile,
- $linePartBeforeCursor . $linePartAfterCursor,
- $lineNumberCursor,
- $columnNumber,
- $this->fluentShowColumn
- );
- $this->helperMessagePart = ($this->fluentMessageCreator)(
- $nextLine,
- $prevLine,
- );
-
- $fullMessage = $this->headingMessagePart . PHP_EOL . $this->asciiPreviewMessagePart . PHP_EOL . $this->helperMessagePart;
- return $fullMessage;
- }
-
- protected static function renderErrorLinePreview(
- ?string $fileName,
- string $currentLine,
- int $lineNumber,
- int $columnNumber,
- bool $renderColumnDetails = true
- ): string {
- $fileNameAndPosition = ($fileName ?? '') . ":$lineNumber" . ($renderColumnDetails ? ":$columnNumber" : '');
-
- $arrowColumn = '';
- if ($renderColumnDetails) {
- $spaceToArrow = str_repeat(' ', $columnNumber - 1);
- $arrowColumn = "$spaceToArrow^— column $columnNumber";
- }
-
- // convert the string length of a number to spaces, '72' becomes ' '.
- $indentLine = str_repeat(' ', strlen((string)$lineNumber));
-
- return <<char()) {
- case '/':
- if ($next->char(1) === '*') {
- return "Unclosed comment.";
- }
- return "Unexpected single {$next->charPrint()}. You can start a comment with '//' or '/*' or '#'.";
- case '"':
- case '\'':
- return "Unclosed quoted path.";
- case '{':
- return "Unexpected block start. The opening brace must be on the same line with its declaration, like: 'path {' or 'prototype(Foo:Bar) {'.";
- case '}':
- return "Unexpected block end. Check your number of curly braces.";
- }
- return "Unexpected statement starting with: {$next->charPrint()}. " . self::VALID_OBJECT_PATH;
- }
-
- public static function forParseEndOfStatement(MessageLinePart $next, MessageLinePart $prev): string
- {
- switch ($next->char()) {
- case '/':
- if ($next->char(1) === '*') {
- return "Unclosed comment.";
- }
- return "Unexpected single {$next->charPrint()}. You can start a comment with '//' or '/*' or '#'.";
- }
- return "Expected end of a statement but found {$next->linePrint()}.";
- }
-
- public static function forParsePathSegment(MessageLinePart $next, MessageLinePart $prev): string
- {
- switch ($next->char()) {
- case '"':
- case '\'':
- return "A quoted object path starting with {$next->charPrint()} was not closed.";
- case ' ':
- if ($prev->char(-1) === '.') {
- return "No is allowed after a separating '.' in an object path.";
- }
- return "Unexpected {$next->charPrint()} in object path.";
- }
- return "Unexpected object path starting with: {$next->charPrint()}. " . self::VALID_OBJECT_PATH;
- }
-
- public static function forPathSegmentPrototypeName(MessageLinePart $next, MessageLinePart $prev): string
- {
- if (preg_match('/^[a-zA-Z0-9.]++(?!:)/', $next->line()) === 1) {
- return "Prototype name without namespace starting with {$next->charPrint()} - Default namespaces were removed. You might want to add 'Neos.Fusion:' in front.";
- }
- if (str_starts_with(trim($next->line()), ')')) {
- return "A prototype name must be set. Unexpected char {$next->charPrint()}.";
- }
- return "Unexpected prototype name starting with: {$next->linePrint()}.";
- }
-
- public static function forParsePathOrOperator(MessageLinePart $next, MessageLinePart $prev): string
- {
- if (preg_match('/.*namespace\s*:\s*$/', $prev->line()) === 1) {
- return "It looks like you want to declare a namespace alias. The feature to alias namespaces was removed.";
- }
- if (preg_match('/.*include\s*$/', $prev->line()) === 1) {
- return "Did you want to include a Fusion file? 'include: FileName.fusion'.";
- }
- if ($prev->char(-1) === ' ' && $next->char() === '.') {
- return "Nested paths, separated by {$next->charPrint()} cannot contain spaces.";
- }
- if ($prev->char(-1) === ' ') {
- // it might be an operator since there was space
- return "Unknown operator starting with {$next->charPrint()}. (Or you have unwanted spaces in your object path).";
- }
- if ($next->char() === '(') {
- return "An unquoted path segment cannot contain {$next->charPrint()}. Did you want to declare a prototype? 'prototype(Foo:Bar)'.";
- }
- if ($next->char() === '') {
- return "Object path without operator or block start. Found: {$next->charPrint()}.";
- }
- return "Unknown operator or path segment at {$next->charPrint()}. Unquoted paths can contain only alphanumerics and [:_-]. Otherwise, put them in quotes.";
- }
-
- public static function forParseDslExpression(MessageLinePart $next, MessageLinePart $prev): string
- {
- return "A dsl expression starting with {$next->linePrint(1)} was not closed.";
- }
-
- public static function forParsePathValue(MessageLinePart $next, MessageLinePart $prev): string
- {
- if (preg_match('/^[a-zA-Z0-9.]++(?!:)/', $next->line()) === 1) {
- return "Unexpected {$next->linePrint()} in value assignment - It looks like an object without namespace. Default namespaces were removed. You might want to add 'Neos.Fusion:' in front.";
- }
- switch ($next->char()) {
- case '':
- return "No value specified in assignment.";
- case '"':
- return "Unclosed quoted string.";
- case '\'':
- return "Unclosed char sequence.";
- case '`':
- return "Template literals without DSL identifier are not supported.";
- case '$':
- if ($next->char(1) === '{') {
- return "Unclosed eel expression.";
- }
- return "Did you want to start an eel expression: '\${...}'?";
- }
- return "Unexpected character in assignment starting with {$next->charPrint()}.";
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/ExceptionMessage/MessageLinePart.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/ExceptionMessage/MessageLinePart.php
deleted file mode 100644
index 75f469e..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/ExceptionMessage/MessageLinePart.php
+++ /dev/null
@@ -1,88 +0,0 @@
-linePart, $offset);
- }
-
- public function linePrint(int $offset = 0): string
- {
- $line = $this->line($offset);
- if (mb_strlen($line) > 1) {
- return "'$line'";
- }
- return $this->charPrint($offset);
- }
-
- public function char(int $index = 0): string
- {
- if ($index < 0 && mb_strlen($this->linePart) < abs($index)) {
- // prevent mb_substr returning first char if out of bounds
- return '';
- }
- return mb_substr($this->linePart, $index, 1);
- }
-
- public function charPrint(int $index = 0): string
- {
- if ($this->isEof) {
- return '';
- }
- return self::printable($this->char($index));
- }
-
- protected static function printable(string $char): string
- {
- if ($char === '') {
- return '';
- }
-
- // https://github.com/parsica-php/parsica/blob/main/src/Internal/Ascii.php
- return match (mb_ord($char)) {
- 0 => "",
- 9 => "",
- 10 => "",
- 11 => "",
- 13 => "",
- 25 => "",
- 27 => "",
- 32 => "",
- 34 => "",
- 39 => "",
- 47 => "",
- 92 => "",
- 130 => "",
- 132 => "",
- 145 => "",
- 146 => "",
- 147 => "",
- 148 => "",
- 160 => "",
- default => "'$char'",
- };
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/FilePatternResolver.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/FilePatternResolver.php
deleted file mode 100644
index 591d33d..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/FilePatternResolver.php
+++ /dev/null
@@ -1,159 +0,0 @@
-
- [^*/]* # simple case: path segment without '*' stop at '/'
- (?:
- /[^*] # special case '/' no followed '*' is matched
- [^*/]* # simple case again - unrolled loop following Jeffrey Friedl
- )*
- )
- /\*\*/\* # the recursive include /**/*
- (?P
- [^*/]* # optional file end like .fusion or even -special.fusion but no further globbing or folders allowed
- )$`x
- REGEX;
-
- protected const SIMPLE_GLOB_PATTERN = <<<'REGEX'
- `^(?P
- [^*/]* # simple case: path segment without '*' stop at '/'
- (?:
- /[^*] # special case '/' no followed '*' is matched
- [^*/]* # simple case again - unrolled loop following Jeffrey Friedl
- )*
- )
- /\* # the simple glob include /*
- (?P
- [^*/]* # optional file end like .fusion or even -special.fusion but no further globbing or folders allowed
- )$`x
- REGEX;
-
- /**
- * @param string $filePattern
- * @param string|null $filePathForRelativeResolves
- * @param string $defaultFileEndForUnspecificGlobbing
- * @return list
- * @throws Fusion\Exception
- */
- public static function resolveFilesByPattern(string $filePattern, ?string $filePathForRelativeResolves, string $defaultFileEndForUnspecificGlobbing): array
- {
- $filePattern = trim($filePattern);
- if ($filePattern === '') {
- throw new Fusion\Exception("cannot resolve empty pattern: '$filePattern'", 1636144288);
- }
- if (str_contains($filePattern, '\\')) {
- throw new Fusion\Exception("cannot resolve non-unix style pattern: '$filePattern'", 1688112067799);
- }
- $isAbsoluteWindowsPath = preg_match('`^[a-zA-Z]:/[^/]`', $filePattern) === 1;
- if ($filePattern[0] === '/' || $isAbsoluteWindowsPath) {
- throw new Fusion\Exception("cannot resolve absolute pattern: '$filePattern'", 1636144292);
- }
- if (self::isPatternStreamWrapper($filePattern) === false) {
- $filePattern = self::resolveRelativePath($filePattern, $filePathForRelativeResolves);
- }
- if (str_contains($filePattern, '*') === false) {
- return [$filePattern];
- }
- return self::parseGlobPatternAndResolveFiles($filePattern, $defaultFileEndForUnspecificGlobbing);
- }
-
- protected static function isPatternStreamWrapper(string $filePattern): bool
- {
- if (preg_match('`^(?P[^:]+)://`', $filePattern, $matches) !== 1) {
- return false;
- }
- $streamWrapper = $matches['protocol'];
- if (in_array($streamWrapper, stream_get_wrappers(), true) === false) {
- throw new Fusion\Exception("Unable to find the stream wrapper '$streamWrapper' while resolving the pattern: '$filePattern'", 1636144734);
- }
- return true;
- }
-
- protected static function resolveRelativePath(string $filePattern, ?string $filePathForRelativeResolves): string
- {
- if ($filePathForRelativeResolves === null) {
- throw new Fusion\Exception('Relative file resolves are only possible with the argument $filePathForRelativeResolves passed.', 1636144731);
- }
- return Files::concatenatePaths([dirname($filePathForRelativeResolves), $filePattern]);
- }
-
- /**
- * @return list
- */
- protected static function parseGlobPatternAndResolveFiles(string $filePattern, string $defaultFileNameEnd): array
- {
- $matches = null;
- $fileIteratorCreator = match (1) {
- // We use the flag SKIP_DOTS, as it might not be allowed to access `..` and we only are interested in files
- // We use the flag UNIX_PATHS, so that stream wrapper paths are always valid on windows https://github.com/neos/neos-development-collection/issues/4358
-
- // Match recursive wildcard globbing '/**/*?'
- preg_match(self::RECURSIVE_GLOB_PATTERN, $filePattern, $matches) => static function (string $dir): \Iterator {
- $recursiveDirectoryIterator = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS|\FilesystemIterator::UNIX_PATHS);
- return new \RecursiveIteratorIterator($recursiveDirectoryIterator);
- },
-
- // Match simple wildcard globbing '/*?'
- preg_match(self::SIMPLE_GLOB_PATTERN, $filePattern, $matches) => static function (string $dir): \Iterator {
- return new \FilesystemIterator($dir, \FilesystemIterator::SKIP_DOTS|\FilesystemIterator::UNIX_PATHS);
- },
-
- default => throw new Fusion\Exception("The include glob pattern '$filePattern' is invalid. Only globbing with /**/* or /* is supported.", 1636144713),
- };
-
- /** @var array{base: string, end: string} $matches */
- $basePath = $matches['base'];
- $fileNameEnd = $matches['end'] === '' ? $defaultFileNameEnd : $matches['end'];
-
- if (is_dir($basePath) === false) {
- throw new Fusion\Exception("The path '$basePath' of the glob pattern '$filePattern' does not point to a directory.", 1636144717);
- }
-
- $fileIterator = $fileIteratorCreator($basePath);
- return self::iterateOverFilesAndSelectByFileEnding($fileIterator, $fileNameEnd);
- }
-
- /**
- * @param \Iterator|\SplFileInfo[] $fileIterator
- * @param string $fileNameEnd when file matches this ending it will be included.
- * @return list
- */
- protected static function iterateOverFilesAndSelectByFileEnding(\Iterator $fileIterator, string $fileNameEnd): array
- {
- $files = [];
- foreach ($fileIterator as $fileInfo) {
- if ($fileInfo->isDir()) {
- continue;
- }
- $pathAndFilename = $fileInfo->getPathname();
-
- if (str_ends_with($pathAndFilename, $fileNameEnd)) {
- $files[] = $pathAndFilename;
- }
- }
- return $files;
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Lexer.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Lexer.php
deleted file mode 100644
index 0b83c37..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Lexer.php
+++ /dev/null
@@ -1,182 +0,0 @@
-
- (?>
- { (?P>exp) } # match object literal expression recursively
- |[^{}"']+ # simple eel expression without quoted strings
- |"[^"\\]* # double quoted strings with possibly escaped double quotes
- (?:
- \\. # escaped character (quote)
- [^"\\]* # unrolled loop following Jeffrey E.F. Friedl
- )*"
- |'[^'\\]* # single quoted strings with possibly escaped single quotes
- (?:
- \\. # escaped character (quote)
- [^'\\]* # unrolled loop following Jeffrey E.F. Friedl
- )*'
- )*
- )}
- /x
- REGEX;
-
- protected const TOKEN_REGEX = [
- Token::SLASH_COMMENT => '/^\\/\\/.*/',
- Token::HASH_COMMENT => '/^#.*/',
- Token::MULTILINE_COMMENT => <<<'REGEX'
- `^
- /\* # start of a comment '/*'
- [^*]* # consume until special case '*'
- \*+ # consume all '*'
- (?:
- [^/] # break if its the end: '/'
- [^*]* # unrolled loop following Jeffrey E.F. Friedl
- \*+
- )*
- / # the end of a comment.
- `x
- REGEX,
-
- Token::NEWLINE => '/^[\n\r]+/',
- Token::SPACE => '/^[ \t]+/',
-
- // VALUE ASSIGNMENT
- Token::TRUE_VALUE => '/^(?>true|TRUE)\\b/',
- Token::FALSE_VALUE => '/^(?>false|FALSE)\\b/',
- Token::NULL_VALUE => '/^(?>null|NULL)\\b/',
- Token::INTEGER => '/^-?[0-9]+/',
- Token::FLOAT => '/^-?[0-9]+\.[0-9]+/',
-
- Token::DSL_EXPRESSION_START => '/^[a-zA-Z0-9\.]++(?=`)/',
- Token::DSL_EXPRESSION_CONTENT => '/^`[^`]*+`/',
- Token::EEL_EXPRESSION => self::PATTERN_EEL_EXPRESSION,
-
- // Object type part
- Token::FUSION_OBJECT_NAME => '/^[0-9a-zA-Z.]+:[0-9a-zA-Z.]+/',
-
- // Keywords
- Token::INCLUDE => '/^include\\s*:/',
-
- // Object path segments
- Token::PROTOTYPE_START => '/^prototype\(/',
- Token::META_PATH_START => '/^@/',
- Token::OBJECT_PATH_PART => '/^[a-zA-Z0-9_:-]+/',
-
- // Operators
- Token::ASSIGNMENT => '/^=/',
- Token::COPY => '/^',
- Token::UNSET => '/^>/',
-
- // Symbols
- Token::DOT => '/^\./',
- Token::COLON => '/^:/',
- Token::RPAREN => '/^\)/',
- Token::LBRACE => '/^{/',
- Token::RBRACE => '/^}/',
-
- // Strings
- Token::STRING_DOUBLE_QUOTED => <<<'REGEX'
- /^
- "[^"\\]* # double quoted strings with possibly escaped double quotes
- (?:
- \\. # escaped character (quote)
- [^"\\]* # unrolled loop following Jeffrey E.F. Friedl
- )*
- "
- /x
- REGEX,
- Token::STRING_SINGLE_QUOTED => <<<'REGEX'
- /^
- '[^'\\]* # single quoted strings with possibly escaped single quotes
- (?:
- \\. # escaped character (quote)
- [^'\\]* # unrolled loop following Jeffrey E.F. Friedl
- )*
- '
- /x
- REGEX,
-
- Token::FILE_PATTERN => '`^[a-zA-Z0-9.*:/_-]+`',
- ];
-
- protected string $code = '';
-
- protected int $codeLen = 0;
-
- protected int $cursor = 0;
-
- protected ?Token $lookahead = null;
-
- public function __construct(string $code)
- {
- $code = str_replace(["\r\n", "\r"], "\n", $code);
- $this->code = $code;
- $this->codeLen = strlen($code);
- }
-
- public function getCode(): string
- {
- return $this->code;
- }
-
- public function getCursor(): int
- {
- return $this->cursor;
- }
-
- public function consumeLookahead(): Token
- {
- $token = $this->lookahead;
- $this->lookahead = null;
- if ($token === null) {
- throw new \LogicException('Cannot consume lookahead.', 1705652155);
- }
- return $token;
- }
-
- public function getCachedLookaheadOrTryToGenerateLookaheadForTokenAndGetLookahead(int $tokenType): ?Token
- {
- if ($this->lookahead !== null) {
- return $this->lookahead;
- }
- if ($this->cursor === $this->codeLen) {
- return $this->lookahead = new Token(Token::EOF, '');
- }
- if ($tokenType === Token::EOF) {
- return null;
- }
-
- $regexForToken = self::TOKEN_REGEX[$tokenType];
-
- $remainingCode = substr($this->code, $this->cursor);
-
- if (preg_match($regexForToken, $remainingCode, $matches) !== 1) {
- return null;
- }
-
- $this->cursor += \strlen($matches[0]);
-
- return $this->lookahead = new Token($tokenType, $matches[0]);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/MergedArrayTree.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/MergedArrayTree.php
deleted file mode 100644
index 8bfd62c..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/MergedArrayTree.php
+++ /dev/null
@@ -1,125 +0,0 @@
-tree;
- }
-
- public function removeValueInTree(array $path): void
- {
- $this->tree = Arrays::unsetValueByPath($this->tree, $path);
- $this->setValueInTree($path, ['__stopInheritanceChain' => true]);
- }
-
- public function copyValueInTree(array $targetPath, array $sourcePath): void
- {
- $originalValue = Arrays::getValueByPath($this->tree, $sourcePath);
- $this->setValueInTree($targetPath, $originalValue);
- }
-
- /**
- * @param scalar|null|array $value The value to assign, either a scalar type or an array with __eelExpression etc.
- */
- public function setValueInTree(array $path, $value): void
- {
- self::arraySetOrMergeValueByPathWithCallback($this->tree, $path, $value, static function ($simpleType) {
- return [
- '__value' => $simpleType,
- '__eelExpression' => null,
- '__objectType' => null
- ];
- });
- }
-
- protected static function arraySetOrMergeValueByPathWithCallback(array &$subject, array $path, mixed $value, callable $toArray): void
- {
- // points to the current path element, but inside the tree.
- $pointer = &$subject;
- foreach ($path as $pathSegment) {
- // can be null because `&$foo['undefined'] === null`
- if ($pointer === null) {
- $pointer = [];
- }
- if (is_array($pointer) === false) {
- $pointer = $toArray($pointer);
- }
- // set pointer to current path (we can access undefined indexes due to &)
- $pointer = &$pointer[$pathSegment];
- }
- // we got a reference &$pointer of the $path in the $subject array, setting the final value:
- if (is_array($pointer)) {
- $arrayValue = is_array($value) ? $value : $toArray($value);
- $pointer = Arrays::arrayMergeRecursiveOverrule($pointer, $arrayValue);
- return;
- }
- $pointer = $value;
- }
-
- /**
- * Precalculate merged configuration for inherited prototypes.
- *
- * @throws Fusion\Exception
- */
- public function buildPrototypeHierarchy(): void
- {
- if (isset($this->tree['__prototypes']) === false) {
- return;
- }
-
- foreach (array_keys($this->tree['__prototypes']) as $prototypeName) {
- $prototypeInheritanceHierarchy = [];
- $currentPrototypeName = $prototypeName;
- while (isset($this->tree['__prototypes'][$currentPrototypeName]['__prototypeObjectName'])) {
- $currentPrototypeName = $this->tree['__prototypes'][$currentPrototypeName]['__prototypeObjectName'];
- array_unshift($prototypeInheritanceHierarchy, $currentPrototypeName);
- if ($prototypeName === $currentPrototypeName) {
- throw new Fusion\Exception(sprintf('Recursive inheritance found for prototype "%s". Prototype chain: %s', $prototypeName, implode(' < ', array_reverse($prototypeInheritanceHierarchy))), 1492801503);
- }
- }
-
- if (count($prototypeInheritanceHierarchy)) {
- // prototype chain from most *general* to most *specific* WITHOUT the current node type!
- $this->tree['__prototypes'][$prototypeName]['__prototypeChain'] = $prototypeInheritanceHierarchy;
- }
- }
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/MergedArrayTreeVisitor.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/MergedArrayTreeVisitor.php
deleted file mode 100644
index 63bcaab..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/MergedArrayTreeVisitor.php
+++ /dev/null
@@ -1,317 +0,0 @@
-contextPathAndFilename = $fusionFile->contextPathAndFileName;
- $fusionFile->statementList->visit($this);
- return $this->mergedArrayTree;
- }
-
- public function visitStatementList(StatementList $statementList)
- {
- foreach ($statementList->statements as $statement) {
- $statement->visit($this);
- }
- }
-
- public function visitIncludeStatement(IncludeStatement $includeStatement)
- {
- ($this->handleFileInclude)($this->mergedArrayTree, $includeStatement->filePattern, $this->contextPathAndFilename);
- }
-
- private function isRootPrototypeDeclaration(ObjectStatement $objectStatement): bool
- {
- if (!$objectStatement->operation instanceof ValueCopy) {
- return false;
- }
-
- $prototypePath = $objectStatement->path;
- $inheritingPrototypePath = $objectStatement->operation->assignedObjectPath->objectPath;
-
- return \count($prototypePath->segments) === 1 && $prototypePath->segments[0] instanceof PrototypePathSegment
- && \count($inheritingPrototypePath->segments) === 1 && $inheritingPrototypePath->segments[0] instanceof PrototypePathSegment;
- }
-
- public function visitObjectStatement(ObjectStatement $objectStatement)
- {
- $this->currentObjectStatementCursor = $objectStatement->cursor;
-
- $currentPath = $objectStatement->path->visit($this, $this->getCurrentObjectPathPrefix());
-
- $objectStatement->operation?->visit($this, $currentPath);
-
- $wasPreviouslyInPrototypeDeclaration = $this->isInsidePrototypeDeclaration;
- $this->isInsidePrototypeDeclaration = $this->isRootPrototypeDeclaration($objectStatement);
-
- $objectStatement->block?->visit($this, $currentPath);
-
- $this->isInsidePrototypeDeclaration = $wasPreviouslyInPrototypeDeclaration;
- }
-
- public function visitBlock(Block $block, array $currentPath = null)
- {
- $currentPath ?? throw new \BadMethodCallException('$currentPath is required.');
-
- array_push($this->currentObjectPathStack, $currentPath);
-
- $block->statementList->visit($this);
-
- array_pop($this->currentObjectPathStack);
- }
-
- public function visitObjectPath(ObjectPath $objectPath, array $objectPathPrefix = []): array
- {
- $path = $objectPathPrefix;
- foreach ($objectPath->segments as $segment) {
- $path = [...$path, ...$segment->visit($this)];
- }
- return $path;
- }
-
- public function visitMetaPathSegment(MetaPathSegment $metaPathSegment): array
- {
- if ($metaPathSegment->identifier === "private" && !$this->isInsidePrototypeDeclaration) {
- throw $this->prepareParserException(new ParserException())
- ->setCode(1677101592)
- ->setMessage("@private can only be declared inside a root prototype declaration.")
- ->build();
- }
- return ['__meta', $metaPathSegment->identifier];
- }
-
- public function visitPrototypePathSegment(PrototypePathSegment $prototypePathSegment): array
- {
- return ['__prototypes', $prototypePathSegment->identifier];
- }
-
- public function visitPathSegment(PathSegment $pathSegment): array
- {
- $key = stripslashes($pathSegment->identifier);
- self::validateParseTreeKey($key);
- return [$key];
- }
-
- public function visitValueAssignment(ValueAssignment $valueAssignment, array $currentPath = null)
- {
- $currentPath ?? throw new \BadMethodCallException('$currentPath is required.');
-
- $value = $valueAssignment->pathValue->visit($this);
- $this->mergedArrayTree->setValueInTree($currentPath, $value);
- }
-
- public function visitFusionObjectValue(FusionObjectValue $fusionObjectValue)
- {
- return [
- '__objectType' => $fusionObjectValue->value, '__value' => null, '__eelExpression' => null
- ];
- }
-
- public function visitDslExpressionValue(DslExpressionValue $dslExpressionValue)
- {
- try {
- return ($this->handleDslTranspile)($dslExpressionValue->identifier, $dslExpressionValue->code);
- } catch (ParserException $e) {
- throw $e;
- } catch (\Exception $e) {
- // convert all exceptions from dsl transpilation to fusion exception and add file and line info
- throw $this->prepareParserException(new ParserException())
- ->setCode(1180600696)
- ->setMessage($e->getMessage())
- ->build();
- }
- }
-
- public function visitEelExpressionValue(EelExpressionValue $eelExpressionValue)
- {
- $eelWithoutNewLines = str_replace("\n", '', $eelExpressionValue->value);
- return [
- '__eelExpression' => $eelWithoutNewLines, '__value' => null, '__objectType' => null
- ];
- }
-
- public function visitFloatValue(FloatValue $floatValue)
- {
- return $floatValue->value;
- }
-
- public function visitIntValue(IntValue $intValue)
- {
- return $intValue->value;
- }
-
- public function visitBoolValue(BoolValue $boolValue)
- {
- return $boolValue->value;
- }
-
- public function visitNullValue(NullValue $nullValue)
- {
- return null;
- }
-
- public function visitStringValue(StringValue $stringValue): string
- {
- return $stringValue->value;
- }
-
- public function visitValueCopy(ValueCopy $valueCopy, array $currentPath = null)
- {
- $currentPath ?? throw new \BadMethodCallException('$currentPath is required.');
-
- $sourcePath = $valueCopy->assignedObjectPath->visit($this, $this->mergedArrayTree->getParentPath($currentPath));
-
- $currentPathsPrototype = $this->mergedArrayTree->pathIsPrototype($currentPath);
- $sourcePathIsPrototype = $this->mergedArrayTree->pathIsPrototype($sourcePath);
- if ($currentPathsPrototype && $sourcePathIsPrototype) {
- // both are a prototype definition
- if (count($currentPath) !== 2 || count($sourcePath) !== 2) {
- // one of the path has not a length of 2: this means
- // at least one path is nested (f.e. foo.prototype(Bar))
- // Currently, it is not supported to override the prototypical inheritance in
- // parts of the Fusion rendering tree.
- // Although this might work conceptually, it makes reasoning about the prototypical
- // inheritance tree a lot more complex; that's why we forbid it right away.
- throw $this->prepareParserException(new ParserException())
- ->setCode(1358418019)
- ->setMessage('Cannot inherit, when one of the sides is nested (e.g. foo.prototype(Bar)). Setting up prototype inheritance is only supported at the top level: prototype(Foo) < prototype(Bar)')
- ->build();
- }
- // it must be of the form "prototype(Foo) < prototype(Bar)"
- $currentPath[] = '__prototypeObjectName';
- $this->mergedArrayTree->setValueInTree($currentPath, end($sourcePath));
- return;
- }
-
- if ($currentPathsPrototype xor $sourcePathIsPrototype) {
- // Only one of "source" or "target" is a prototype. We do not support copying a
- // non-prototype value to a prototype value or vice-versa.
- throw $this->prepareParserException(new ParserException())
- ->setCode(1358418015)
- ->setMessage("Cannot inherit, when one of the sides is no prototype definition of the form prototype(Foo). It is only allowed to build inheritance chains with prototype objects.")
- ->build();
- }
-
- $this->mergedArrayTree->copyValueInTree($currentPath, $sourcePath);
- }
-
- public function visitAssignedObjectPath(AssignedObjectPath $assignedObjectPath, array $relativePath = [])
- {
- $path = [];
- if ($assignedObjectPath->isRelative) {
- $path = $relativePath;
- }
- return $assignedObjectPath->objectPath->visit($this, $path);
- }
-
- public function visitValueUnset(ValueUnset $valueUnset, array $currentPath = null)
- {
- $currentPath ?? throw new \BadMethodCallException('$currentPath is required.');
-
- $this->mergedArrayTree->removeValueInTree($currentPath);
- }
-
- protected function getCurrentObjectPathPrefix(): array
- {
- $lastElementOfStack = end($this->currentObjectPathStack);
- return ($lastElementOfStack === false) ? [] : $lastElementOfStack;
- }
-
- protected function validateParseTreeKey(string $pathKey)
- {
- if ($pathKey === '') {
- throw $this->prepareParserException(new ParserException())
- ->setCode(1646988838)
- ->setMessage("A path must not be empty.")
- ->build();
- }
- if (str_starts_with($pathKey, '__')
- && in_array($pathKey, \Neos\Rector\Core\FusionProcessing\Fusion\Parser::$reservedParseTreeKeys, true)) {
- throw $this->prepareParserException(new ParserException())
- ->setCode(1437065270)
- ->setMessage("Reversed key '$pathKey' used.")
- ->build();
- }
- if (str_contains($pathKey, "\n")) {
- $cleaned = str_replace("\n", '', $pathKey);
- throw $this->prepareParserException(new ParserException())
- ->setCode(1644068086)
- ->setMessage("Key '$cleaned' cannot contain newlines.")
- ->build();
- }
- }
-
- protected function prepareParserException(ParserException $parserException): ParserException
- {
- if ($this->contextPathAndFilename === null) {
- $fusionCode = '';
- } else {
- $fusionCode = file_get_contents($this->contextPathAndFilename) ?: '';
- }
- return $parserException
- ->setHideColumnInformation()
- ->setFile($this->contextPathAndFilename)
- ->setFusion($fusionCode)
- ->setCursor($this->currentObjectStatementCursor);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/ObjectTreeParser.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/ObjectTreeParser.php
deleted file mode 100644
index 3a53b05..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/ObjectTreeParser.php
+++ /dev/null
@@ -1,537 +0,0 @@
-lexer = $lexer;
- $this->contextPathAndFilename = $contextPathAndFilename;
- }
-
- public static function parse(FusionSourceCode $fusionCode): FusionFile
- {
- $lexer = new Lexer($fusionCode->getSourceCode());
- $parser = new self($lexer, $fusionCode->getFilePath());
- return $parser->parseFusionFile();
- }
-
- /**
- * Consume the current token.
- * Can only consume if accept was called before.
- *
- * @return Token
- */
- protected function consume(): Token
- {
- return $this->lexer->consumeLookahead();
- }
-
- /**
- * Accepts a token of a given type.
- * The Lexer will look up the regex for the token and try to match it on the current string.
- * First match wins.
- *
- * @param int $tokenType
- * @return bool
- */
- protected function accept(int $tokenType): bool
- {
- $token = $this->lexer->getCachedLookaheadOrTryToGenerateLookaheadForTokenAndGetLookahead($tokenType);
- if ($token === null) {
- return false;
- }
- return $token->getType() === $tokenType;
- }
-
- /**
- * Expects a token of a given type.
- * The Lexer will look up the regex for the token and try to match it on the current string.
- * First match wins.
- *
- * @param int $tokenType
- * @return Token
- * @throws ParserUnexpectedCharException
- */
- protected function expect(int $tokenType): Token
- {
- $token = $this->lexer->getCachedLookaheadOrTryToGenerateLookaheadForTokenAndGetLookahead($tokenType);
- if ($token === null || $token->getType() !== $tokenType) {
- $tokenReadable = Token::typeToString($tokenType);
- throw new ParserUnexpectedCharException("Expected token: '$tokenReadable'.", 1646988824);
- }
- return $this->lexer->consumeLookahead();
- }
-
- /**
- * Checks, if the token type matches the current, if so consume it and return true.
- * @param int $tokenType
- * @return bool
- */
- protected function lazyExpect(int $tokenType): bool
- {
- $token = $this->lexer->getCachedLookaheadOrTryToGenerateLookaheadForTokenAndGetLookahead($tokenType);
- if ($token === null || $token->getType() !== $tokenType) {
- return false;
- }
- $this->lexer->consumeLookahead();
- return true;
- }
-
- /**
- * OptionalBigGap
- * = ( NEWLINE / OptionalSmallGap )*
- */
- protected function lazyBigGap(): void
- {
- while (true) {
- switch (true) {
- case $this->accept(Token::SPACE):
- case $this->accept(Token::NEWLINE):
- case $this->accept(Token::SLASH_COMMENT):
- case $this->accept(Token::HASH_COMMENT):
- case $this->accept(Token::MULTILINE_COMMENT):
- $this->consume();
- break;
-
- default:
- return;
- }
- }
- }
-
- /**
- * OptionalSmallGap
- * = ( SPACE / SLASH_COMMENT / HASH_COMMENT / MULTILINE_COMMENT )*
- */
- protected function lazySmallGap(): void
- {
- while (true) {
- switch (true) {
- case $this->accept(Token::SPACE):
- case $this->accept(Token::SLASH_COMMENT):
- case $this->accept(Token::HASH_COMMENT):
- case $this->accept(Token::MULTILINE_COMMENT):
- $this->consume();
- break;
-
- default:
- return;
- }
- }
- }
-
- /**
- * FusionFile
- * = StatementList
- */
- protected function parseFusionFile(): FusionFile
- {
- try {
- return new FusionFile($this->parseStatementList(), $this->contextPathAndFilename);
- } catch (ParserException $e) {
- throw $e;
- } catch (ParserUnexpectedCharException $e) {
- throw $this->prepareParserException(new ParserException())
- ->setCode($e->getCode())
- ->setMessageCreator(function (MessageLinePart $nextLine) use ($e) {
- return "Unexpected char {$nextLine->charPrint()}. {$e->getMessage()}";
- })
- ->setPrevious($e)
- ->build();
- } catch (Fusion\Exception $e) {
- throw $this->prepareParserException(new ParserException())
- ->setCode($e->getCode())
- ->setMessage('Exception while parsing: ' . $e->getMessage())
- ->setHideColumnInformation()
- ->setPrevious($e)
- ->build();
- }
- }
-
- /**
- * StatementList
- * = ( Statement )*
- *
- * @param ?int $stopLookahead When this tokenType is encountered the loop will be stopped
- */
- protected function parseStatementList(?int $stopLookahead = null): StatementList
- {
- $statements = [];
- $this->lazyBigGap();
- while ($this->accept(Token::EOF) === false
- && ($stopLookahead === null || $this->accept($stopLookahead) === false)) {
- $statements[] = $this->parseStatement();
- $this->lazyBigGap();
- }
- return new StatementList(...$statements);
- }
-
- /**
- * Statement
- * = IncludeStatement / ObjectStatement
- */
- protected function parseStatement(): AbstractStatement
- {
- // watch out for the order, its regex matching and first one wins.
- switch (true) {
- case $this->accept(Token::INCLUDE):
- return $this->parseIncludeStatement();
-
- case $this->accept(Token::PROTOTYPE_START):
- case $this->accept(Token::OBJECT_PATH_PART):
- case $this->accept(Token::META_PATH_START):
- case $this->accept(Token::STRING_SINGLE_QUOTED):
- case $this->accept(Token::STRING_DOUBLE_QUOTED):
- return $this->parseObjectStatement();
- }
-
- throw $this->prepareParserException(new ParserException())
- ->setCode(1646988828)
- ->setMessageCreator([MessageCreator::class, 'forParseStatement'])
- ->build();
- }
-
- /**
- * IncludeStatement
- * = INCLUDE ( STRING / CHAR / FILE_PATTERN ) EndOfStatement
- */
- protected function parseIncludeStatement(): IncludeStatement
- {
- $this->expect(Token::INCLUDE);
- $this->lazyExpect(Token::SPACE);
-
- switch (true) {
- case $this->accept(Token::STRING_DOUBLE_QUOTED):
- case $this->accept(Token::STRING_SINGLE_QUOTED):
- $stringWrapped = $this->consume()->getValue();
- $filePattern = substr($stringWrapped, 1, -1);
- break;
- case $this->accept(Token::FILE_PATTERN):
- $filePattern = $this->consume()->getValue();
- break;
- default:
- throw new ParserUnexpectedCharException('Expected file pattern in quotes or [a-zA-Z0-9.*:/_-]', 1646988832);
- }
-
- $this->parseEndOfStatement();
-
- return new IncludeStatement($filePattern);
- }
-
- /**
- * ObjectStatement
- * = ObjectPath ( ValueAssignment / ValueUnset / ValueCopy )? ( Block / EndOfStatement )
- */
- protected function parseObjectStatement(): ObjectStatement
- {
- $currentPath = $this->parseObjectPath();
- $this->lazyExpect(Token::SPACE);
- $cursorAfterObjectPath = $this->lexer->getCursor();
-
- $operation = match (true) {
- $this->accept(Token::ASSIGNMENT) => $this->parseValueAssignment(),
- $this->accept(Token::UNSET) => $this->parseValueUnset(),
- $this->accept(Token::COPY) => $this->parseValueCopy(),
- default => null
- };
-
- $this->lazyExpect(Token::SPACE);
-
- if ($this->accept(Token::LBRACE)) {
- $block = $this->parseBlock();
- return new ObjectStatement($currentPath, $operation, $block, $cursorAfterObjectPath);
- }
-
- if ($operation === null) {
- throw $this->prepareParserException(new ParserException())
- ->setCode(1646988835)
- ->setMessageCreator([MessageCreator::class, 'forParsePathOrOperator'])
- ->setCursor($cursorAfterObjectPath)
- ->build();
- }
-
- $this->parseEndOfStatement();
- return new ObjectStatement($currentPath, $operation, null, $cursorAfterObjectPath);
- }
-
- /**
- * ObjectPath
- * = PathSegment ( '.' PathSegment )*
- *
- */
- protected function parseObjectPath(): ObjectPath
- {
- $segments = [];
- do {
- $segments[] = $this->parsePathSegment();
- } while ($this->lazyExpect(Token::DOT));
- return new ObjectPath(...$segments);
- }
-
- /**
- * PathSegment
- * = ( PROTOTYPE_START FUSION_OBJECT_NAME ')' / OBJECT_PATH_PART / '@' OBJECT_PATH_PART / STRING / CHAR )
- */
- protected function parsePathSegment(): AbstractPathSegment
- {
- switch (true) {
- case $this->accept(Token::PROTOTYPE_START):
- $this->consume();
- try {
- $prototypeName = $this->expect(Token::FUSION_OBJECT_NAME)->getValue();
- } catch (Fusion\Exception) {
- throw $this->prepareParserException(new ParserException())
- ->setCode(1646991578)
- ->setMessageCreator([MessageCreator::class, 'forPathSegmentPrototypeName'])
- ->build();
- }
- $this->expect(Token::RPAREN);
- return new PrototypePathSegment($prototypeName);
-
- case $this->accept(Token::OBJECT_PATH_PART):
- $pathKey = $this->consume()->getValue();
- return new PathSegment($pathKey);
-
- case $this->accept(Token::META_PATH_START):
- $this->consume();
- $metaPathSegmentKey = $this->expect(Token::OBJECT_PATH_PART)->getValue();
- return new MetaPathSegment($metaPathSegmentKey);
-
- case $this->accept(Token::STRING_DOUBLE_QUOTED):
- case $this->accept(Token::STRING_SINGLE_QUOTED):
- $stringWrapped = $this->consume()->getValue();
- $quotedPathKey = substr($stringWrapped, 1, -1);
- return new PathSegment($quotedPathKey);
- }
-
- throw $this->prepareParserException(new ParserException())
- ->setCode(1635708755)
- ->setMessageCreator([MessageCreator::class, 'forParsePathSegment'])
- ->build();
- }
-
- /**
- * ValueAssignment
- * = ASSIGNMENT PathValue
- */
- protected function parseValueAssignment(): ValueAssignment
- {
- $this->expect(Token::ASSIGNMENT);
- $this->lazyExpect(Token::SPACE);
- $value = $this->parsePathValue();
- return new ValueAssignment($value);
- }
-
- /**
- * PathValue
- * = ( CHAR / STRING / DSL_EXPRESSION / FusionObject / EelExpression )
- */
- protected function parsePathValue(): AbstractPathValue
- {
- // watch out for the order, its regex matching and first one wins.
- // sorted by likelihood
- switch (true) {
- case $this->accept(Token::STRING_SINGLE_QUOTED):
- $charWrapped = $this->consume()->getValue();
- $stringContent = substr($charWrapped, 1, -1);
- return new StringValue(stripslashes($stringContent));
-
- case $this->accept(Token::STRING_DOUBLE_QUOTED):
- $stringWrapped = $this->consume()->getValue();
- $stringContent = substr($stringWrapped, 1, -1);
- return new StringValue(stripcslashes($stringContent));
-
- case $this->accept(Token::FUSION_OBJECT_NAME):
- return new FusionObjectValue($this->consume()->getValue());
-
- case $this->accept(Token::DSL_EXPRESSION_START):
- return $this->parseDslExpression();
-
- case $this->accept(Token::EEL_EXPRESSION):
- $eelWrapped = $this->consume()->getValue();
- $eelContent = substr($eelWrapped, 2, -1);
- return new EelExpressionValue($eelContent);
-
- case $this->accept(Token::FLOAT):
- return new FloatValue((float)$this->consume()->getValue());
-
- case $this->accept(Token::INTEGER):
- return new IntValue((int)$this->consume()->getValue());
-
- case $this->accept(Token::TRUE_VALUE):
- $this->consume();
- return new BoolValue(true);
-
- case $this->accept(Token::FALSE_VALUE):
- $this->consume();
- return new BoolValue(false);
-
- case $this->accept(Token::NULL_VALUE):
- $this->consume();
- return new NullValue();
- }
-
- throw $this->prepareParserException(new ParserException())
- ->setCode(1646988841)
- ->setMessageCreator([MessageCreator::class, 'forParsePathValue'])
- ->build();
- }
-
- /**
- * DslExpression
- * = DSL_EXPRESSION_START DSL_EXPRESSION_CONTENT
- */
- protected function parseDslExpression(): DslExpressionValue
- {
- $dslIdentifier = $this->expect(Token::DSL_EXPRESSION_START)->getValue();
- try {
- $dslCode = $this->expect(Token::DSL_EXPRESSION_CONTENT)->getValue();
- } catch (Fusion\Exception) {
- throw $this->prepareParserException(new ParserException())
- ->setCode(1490714685)
- ->setMessageCreator([MessageCreator::class, 'forParseDslExpression'])
- ->build();
- }
- $dslCode = substr($dslCode, 1, -1);
- return new DslExpressionValue($dslIdentifier, $dslCode);
- }
-
- /**
- * ValueUnset
- * = UNSET
- */
- protected function parseValueUnset(): ValueUnset
- {
- $this->expect(Token::UNSET);
- return new ValueUnset();
- }
-
- /**
- * ValueCopy
- * = COPY ObjectPathAssignment
- */
- protected function parseValueCopy(): ValueCopy
- {
- $this->expect(Token::COPY);
- $this->lazyExpect(Token::SPACE);
- $sourcePath = $this->parseAssignedObjectPath();
- return new ValueCopy($sourcePath);
- }
-
- /**
- * AssignedObjectPath
- * = '.'? ObjectPath
- */
- protected function parseAssignedObjectPath(): AssignedObjectPath
- {
- $isRelative = $this->lazyExpect(Token::DOT);
- return new AssignedObjectPath($this->parseObjectPath(), $isRelative);
- }
-
- /**
- * Block:
- * = '{' StatementList? '}'
- */
- protected function parseBlock(): Block
- {
- $this->expect(Token::LBRACE);
- $cursorPositionStartOfBlock = $this->lexer->getCursor() - 1;
- $this->parseEndOfStatement();
-
- $statementList = $this->parseStatementList(Token::RBRACE);
-
- try {
- $this->expect(Token::RBRACE);
- } catch (Fusion\Exception) {
- throw $this->prepareParserException(new ParserException())
- ->setCode(1646988844)
- ->setMessage('No closing brace "}" matched this starting block. Encountered .')
- ->setCursor($cursorPositionStartOfBlock)
- ->build();
- }
-
- return new Block($statementList);
- }
-
- /**
- * EndOfStatement
- * = ( EOF / NEWLINE )
- */
- protected function parseEndOfStatement(): void
- {
- $this->lazySmallGap();
-
- if ($this->accept(Token::EOF)) {
- return;
- }
- if ($this->accept(Token::NEWLINE)) {
- $this->consume();
- return;
- }
- throw $this->prepareParserException(new ParserException())
- ->setCode(1635878683)
- ->setMessageCreator([MessageCreator::class, 'forParseEndOfStatement'])
- ->build();
- }
-
- protected function prepareParserException(ParserException $parserException): ParserException
- {
- return $parserException
- ->setFile($this->contextPathAndFilename)
- ->setFusion($this->lexer->getCode())
- ->setCursor($this->lexer->getCursor());
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Token.php b/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Token.php
deleted file mode 100644
index 30f896c..0000000
--- a/src/Core/FusionProcessing/Fusion/ObjectTreeParser/Token.php
+++ /dev/null
@@ -1,110 +0,0 @@
-type;
- }
-
- public function getValue(): string
- {
- return $this->value;
- }
-
- /**
- * Returns the constant representation of a given type.
- *
- * @param int $type The type as an integer
- *
- * @return string The string representation
- * @throws \LogicException
- */
- public static function typeToString(int $type): string
- {
- $stringRepresentation = array_search($type, static::getConstants(), true);
-
- if (is_string($stringRepresentation) === false) {
- throw new \LogicException("Token of type '$type' does not exist", 1637307344);
- }
- return $stringRepresentation;
- }
-
- /**
- * @Flow\CompileStatic
- * @return array
- */
- protected static function getConstants(): array
- {
- $reflection = new \ReflectionClass(self::class);
- return $reflection->getConstants();
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/Parser.php b/src/Core/FusionProcessing/Fusion/Parser.php
deleted file mode 100644
index e5e9f31..0000000
--- a/src/Core/FusionProcessing/Fusion/Parser.php
+++ /dev/null
@@ -1,156 +0,0 @@
-
- */
- public static array $reservedParseTreeKeys = ['__meta', '__prototypes', '__stopInheritanceChain', '__prototypeObjectName', '__prototypeChain', '__value', '__objectType', '__eelExpression'];
-
- /**
- * @Flow\Inject
- * @var DslFactory
- */
- protected $dslFactory;
-
- /**
- * @Flow\Inject
- * @var ParserCache
- */
- protected $parserCache;
-
- /**
- * Parses the given Fusion source code, resolves includes and returns a merged array tree
- * as the result.
- *
- * @param FusionSourceCodeCollection $sourceCode The Fusion source code to parse
- * @return FusionConfiguration The fusion configuration for the Fusion runtime
- * @throws Fusion\Exception
- */
- public function parseFromSource(FusionSourceCodeCollection $sourceCode): FusionConfiguration
- {
- $mergedArrayTree = new MergedArrayTree([]);
-
- foreach ($sourceCode as $fusionSourceCode) {
- $this->getMergedArrayTreeVisitor($mergedArrayTree)->visitFusionFile(
- $this->parseToFusionFile($fusionSourceCode)
- );
- }
-
- $mergedArrayTree->buildPrototypeHierarchy();
- return FusionConfiguration::fromArray($mergedArrayTree->getTree());
- }
-
- /**
- * Parses the given Fusion source code, resolves includes and returns a merged array tree
- * as the result.
- *
- * @param string $sourceCode The Fusion source code to parse
- * @param string|null $contextPathAndFilename An optional path and filename used for relative Fusion file includes
- * @param array $mergedArrayTreeUntilNow Used internally for keeping track of the built merged array tree
- * @return array The merged array tree for the Fusion runtime, generated from the source code
- * @throws Fusion\Exception
- * @deprecated with Neos 8.3 – will be removed with Neos 9.0, use {@link parseFromSource} instead
- */
- public function parse(string $sourceCode, ?string $contextPathAndFilename = null, array $mergedArrayTreeUntilNow = []): array
- {
- // legacy mapping
- $fusionSourceCode = $contextPathAndFilename === null
- ? FusionSourceCode::fromString($sourceCode)
- : FusionSourceCode::fromDangerousPotentiallyDifferingSourceCodeAndFilePath($sourceCode, $contextPathAndFilename);
-
- $mergedArrayTree = new MergedArrayTree($mergedArrayTreeUntilNow);
-
- $this->getMergedArrayTreeVisitor($mergedArrayTree)->visitFusionFile(
- $this->parseToFusionFile($fusionSourceCode)
- );
-
- $mergedArrayTree->buildPrototypeHierarchy();
- return $mergedArrayTree->getTree();
- }
-
- protected function handleFileInclude(MergedArrayTree $mergedArrayTree, string $filePattern, ?string $contextPathAndFilename): void
- {
- $filesToInclude = FilePatternResolver::resolveFilesByPattern($filePattern, $contextPathAndFilename, '.fusion');
- foreach ($filesToInclude as $file) {
- if (is_readable($file) === false) {
- throw new Fusion\Exception("Could not read file '$file' of pattern '$filePattern'.", 1347977017);
- }
- // Check if not trying to recursively include the current file via globbing
- if ($contextPathAndFilename === null
- || stat($contextPathAndFilename) !== stat($file)) {
- $fusionFile = $this->parseToFusionFile(FusionSourceCode::fromFilePath($file));
- $this->getMergedArrayTreeVisitor($mergedArrayTree)->visitFusionFile($fusionFile);
- }
- }
- }
-
- protected function handleDslTranspile(string $identifier, string $code): mixed
- {
- return $this->parserCache->cacheForDsl(
- $identifier,
- $code,
- function () use ($identifier, $code) {
- $dslObject = $this->dslFactory->create($identifier);
-
- $transpiledFusion = $dslObject->transpile($code);
-
- $fusionFile = ObjectTreeParser::parse(FusionSourceCode::fromString('value = ' . $transpiledFusion));
-
- $mergedArrayTree = $this->getMergedArrayTreeVisitor(new MergedArrayTree([]))->visitFusionFile($fusionFile);
-
- $temporaryAst = $mergedArrayTree->getTree();
-
- $dslValue = $temporaryAst['value'];
-
- return $dslValue;
- }
- );
- }
-
- protected function getMergedArrayTreeVisitor(MergedArrayTree $mergedArrayTree): MergedArrayTreeVisitor
- {
- return new MergedArrayTreeVisitor(
- $mergedArrayTree,
- fn (...$args) => $this->handleFileInclude(...$args),
- fn (...$args) => $this->handleDslTranspile(...$args)
- );
- }
-
- protected function parseToFusionFile(FusionSourceCode $fusionCode): FusionFile
- {
- return $this->parserCache->cacheForFusionFile(
- $fusionCode->getFilePath(),
- fn () => ObjectTreeParser::parse($fusionCode)
- );
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/Runtime.php b/src/Core/FusionProcessing/Fusion/Runtime.php
deleted file mode 100644
index bcf1df6..0000000
--- a/src/Core/FusionProcessing/Fusion/Runtime.php
+++ /dev/null
@@ -1,1076 +0,0 @@
-runtimeConfiguration = new RuntimeConfiguration(
- $fusionConfiguration->toArray()
- );
- $this->runtimeContentCache = new RuntimeContentCache($this);
- $this->fusionGlobals = $fusionGlobals;
- }
-
- /**
- * Inject settings of this package
- *
- * @param array $settings The settings
- * @return void
- */
- public function injectSettings(array $settings)
- {
- $this->settings = $settings;
- if (isset($this->settings['debugMode'])) {
- $this->setDebugMode($this->settings['debugMode'] === true);
- }
- if (isset($this->settings['enableContentCache'])) {
- $this->setEnableContentCache($this->settings['enableContentCache'] === true);
- }
- }
-
- /**
- * Add a tag to the current cache segment
- *
- * During Fusion rendering the method can be used to add tag dynamicaly for the current cache segment.
- *
- * @throws Exceptions
- */
- public function addCacheTag(string $tag): void
- {
- if ($this->runtimeContentCache->getEnableContentCache() === false) {
- return;
- }
- $this->runtimeContentCache->addTag($tag);
- }
-
- /**
- * Completely replace the context array with the new $contextArray.
- *
- * Warning unlike in Fusion's \@context or {@see Runtime::pushContext()},
- * no checks are imposed to prevent overriding Fusion globals like "request".
- * Relying on this behaviour is highly discouraged but leveraged by Neos.Fusion.Form {@see FusionGlobals}.
- *
- * @internal purely internal method, should not be called outside Neos.Fusion.
- * @param array $contextArray
- * @return void
- */
- public function pushContextArray(array $contextArray)
- {
- $this->contextStack[] = $contextArray;
- $this->currentContext = $contextArray;
- }
-
- /**
- * Push a new context object to the rendering stack.
- * It is disallowed to replace global variables {@see FusionGlobals}.
- *
- * @param string $key the key inside the context
- * @param mixed $context
- * @return void
- */
- public function pushContext($key, $context)
- {
- if ($this->fusionGlobals->has($key)) {
- throw new Exception(sprintf('Overriding Fusion global variable "%s" via @context is not allowed.', $key), 1694284229044);
- }
- $newContext = $this->currentContext;
- $newContext[$key] = $context;
- $this->contextStack[] = $newContext;
- $this->currentContext = $newContext;
- }
-
- /**
- * Remove the topmost context objects and return them
- *
- * @return array the topmost context objects as associative array
- */
- public function popContext()
- {
- $lastItem = array_pop($this->contextStack);
- $this->currentContext = empty($this->contextStack) ? [] : end($this->contextStack);
- return $lastItem;
- }
-
- /**
- * Get the current context array.
- * This PHP context api unlike Fusion, doesn't include the Fusion globals {@see FusionGlobals}.
- * The globals can be accessed via {@see Runtime::$fusionGlobals}.
- *
- * @return array the array of current context objects
- */
- public function getCurrentContext()
- {
- return $this->currentContext;
- }
-
- public function popApplyValues(array $paths): void
- {
- foreach ($paths as $path) {
- unset($this->currentApplyValues[$path]);
- }
- }
-
- /**
- * @return string
- */
- public function getLastEvaluationStatus()
- {
- return $this->lastEvaluationStatus;
- }
-
- /**
- * Entry point to render a Fusion path with the context.
- *
- * A ResponseInterface will be returned, if a Neos.Fusion:Http.Message was defined in the entry path,
- * or if Neos.Fusion.Form or Neos.Neos:Plugin were used in the path.
- *
- * In all other simple cases a StreamInterface will be returned.
- *
- * @param string $entryFusionPath the absolute fusion path to render (without leading slash)
- * @param array $contextVariables the context variables that will be available during the rendering.
- * @throws IllegalEntryFusionPathValueException The Fusion path rendered to a value that is not a compatible http response body: string|\Stringable|null
- */
- public function renderEntryPathWithContext(string $entryFusionPath, array $contextVariables): ResponseInterface|StreamInterface
- {
- // Like in pushContext, we don't allow to overrule fusion globals
- foreach ($contextVariables as $key => $_) {
- if ($this->fusionGlobals->has($key)) {
- throw new Exception(sprintf('Overriding Fusion global variable "%s" via @context is not allowed.', $key), 1706452063);
- }
- }
- // replace any previously assigned values
- $this->pushContextArray($contextVariables);
-
- return $this->withSimulatedLegacyControllerContext(function () use ($entryFusionPath) {
- try {
- $output = $this->render($entryFusionPath);
- } catch (RuntimeException $exception) {
- throw $exception->getWrappedException();
- } finally {
- $this->popContext();
- }
-
- // Parse potential raw http response possibly rendered via "Neos.Fusion:Http.Message"
- /** {@see \Neos\Fusion\FusionObjects\HttpResponseImplementation} */
- $outputStringHasHttpPreamble = is_string($output) && str_starts_with($output, 'HTTP/');
- if ($outputStringHasHttpPreamble) {
- return Message::parseResponse($output);
- }
-
- if ($output instanceof StreamInterface) {
- // if someone manages to return a stream *g
- return $output;
- }
-
- if (!is_string($output) && !$output instanceof \Stringable && $output !== null) {
- throw new IllegalEntryFusionPathValueException(sprintf('Fusion entry path "%s" is expected to render a compatible http response body: string|\Stringable|null. Got %s instead.', $entryFusionPath, get_debug_type($output)), 1706454898);
- }
-
- return $this->createStream((string)$output);
- });
- }
-
- /**
- * Render an absolute Fusion path and return the result.
- *
- * Compared to $this->evaluate, this adds some more comments helpful for debugging.
- *
- * @param string $fusionPath
- * @return mixed
- * @throws \Exception
- * @throws SecurityException
- */
- public function render($fusionPath)
- {
- try {
- $output = $this->evaluate($fusionPath, null, self::BEHAVIOR_EXCEPTION);
- if ($this->debugMode) {
- $output = sprintf(
- '%1$s%4$s%1$s',
- chr(10),
- $fusionPath,
- implode(', ', array_keys($this->currentContext)),
- $output
- );
- }
- } catch (SecurityException $securityException) {
- throw $securityException;
- } catch (\Exception $exception) {
- $output = $this->handleRenderingException($fusionPath, $exception);
- }
-
- return $output;
- }
-
- /**
- * Handle an Exception thrown while rendering Fusion according to
- * settings specified in Neos.Fusion.rendering.exceptionHandler or {@exceptionHandler}
- *
- * @param string $fusionPath
- * @param \Exception $exception
- * @param boolean $useInnerExceptionHandler
- * @return string
- * @throws Exception
- * @throws InvalidConfigurationException
- * @throws SecurityException
- * @throws StopActionException
- */
- public function handleRenderingException(string $fusionPath, \Exception $exception, bool $useInnerExceptionHandler = false)
- {
- if ($exceptionHandler = $this->overriddenExceptionHandler) {
- $exceptionHandler->setRuntime($this);
- return $exceptionHandler->handleRenderingException($fusionPath, $exception);
- }
-
- $fusionConfiguration = $this->runtimeConfiguration->forPath($fusionPath);
-
- $useLocalExceptionHandler = isset($fusionConfiguration['__meta']['exceptionHandler']);
- $exceptionHandlerClass = $useLocalExceptionHandler
- // use local configured @exceptionHandler
- ? $fusionConfiguration['__meta']['exceptionHandler']
- // use global configured exception handler
- : $this->settings['rendering'][$useInnerExceptionHandler ? 'innerExceptionHandler' : 'exceptionHandler'];
-
- $exceptionHandler = null;
- if ($this->objectManager->isRegistered($exceptionHandlerClass)) {
- $exceptionHandler = $this->objectManager->get($exceptionHandlerClass);
- }
-
- if ($exceptionHandler instanceof AbstractRenderingExceptionHandler === false) {
- $usedExceptionHandler = $useLocalExceptionHandler
- ? 'property "@exceptionHandler"'
- : 'setting "Neos.Fusion.rendering.exceptionHandler"';
-
- throw new InvalidConfigurationException(<<setRuntime($this);
- if (array_key_exists('__objectType', $fusionConfiguration)) {
- $fusionPath .= "<{$fusionConfiguration['__objectType']}>";
- }
- return $exceptionHandler->handleRenderingException($fusionPath, $exception);
- }
-
- /**
- * Determine if the given Fusion path is renderable, which means it exists
- * and has an implementation.
- *
- * @param string $fusionPath
- * @return boolean
- * @throws Exception
- */
- public function canRender($fusionPath)
- {
- $fusionConfiguration = $this->runtimeConfiguration->forPath($fusionPath);
-
- if (isset($fusionConfiguration['__eelExpression']) || isset($fusionConfiguration['__value'])) {
- return true;
- }
-
- if (isset($fusionConfiguration['__meta']['class']) && isset($fusionConfiguration['__objectType'])) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Evaluate an absolute Fusion path and return the result
- *
- * @param string $fusionPath
- * @param mixed $contextObject The object which will be "this" in Eel expressions. ONLY FOR INTERNAL USE!
- * @param (Runtime::BEHAVIOR_EXCEPTION|Runtime::BEHAVIOR_RETURNNULL) $behaviorIfPathNotFound
- * @return mixed
- *
- * @throws StopActionException
- * @throws SecurityException
- * @throws Exception
- * @throws RuntimeException
- * @throws InvalidConfigurationException
- */
- public function evaluate(string $fusionPath, $contextObject = null, string $behaviorIfPathNotFound = self::BEHAVIOR_RETURNNULL)
- {
- $this->lastEvaluationStatus = self::EVALUATION_EXECUTED;
-
- $fusionConfiguration = $this->runtimeConfiguration->forPath($fusionPath);
-
- if (isset($this->currentApplyValues[$fusionPath])) {
- // the $fusionPath is an @apply value
- // we evaluate @if and @process
- // when the @apply value is lazy we trigger the evaluation
- // we return directly
- if (isset($fusionConfiguration['__meta']['if']) && $this->evaluateIfCondition($fusionConfiguration, $fusionPath, $contextObject) === false) {
- return null;
- }
- $appliedValue = $this->currentApplyValues[$fusionPath]['value'];
- if (isset($this->currentApplyValues[$fusionPath]['lazy'])) {
- $appliedValue = $appliedValue();
- }
- if (isset($fusionConfiguration['__meta']['process'])) {
- $appliedValue = $this->evaluateProcessors($appliedValue, $fusionConfiguration, $fusionPath, $contextObject);
- }
- return $appliedValue;
- }
-
- if (isset($fusionConfiguration['__eelExpression']) || isset($fusionConfiguration['__value'])) {
- // fast path for expression or value
- try {
- return $this->evaluateExpressionOrValueInternal($fusionPath, $fusionConfiguration, $contextObject);
- } catch (StopActionException | ForwardException | SecurityException | RuntimeException $exception) {
- throw $exception;
- } catch (\Exception $exception) {
- return $this->handleRenderingException($fusionPath, $exception, true);
- }
- }
-
- // render fusion object
- $cacheContext = $this->runtimeContentCache->enter($fusionConfiguration['__meta']['cache'] ?? [], $fusionPath);
- $needToPopContext = false;
- $applyPathsToPop = [];
- try {
- if (isset($fusionConfiguration['__meta']['class']) === false
- || isset($fusionConfiguration['__objectType']) === false) {
- // fusion object not found / cannot be rendered
- $this->throwExceptionForUnrenderablePathIfNeeded($fusionPath, $fusionConfiguration, $behaviorIfPathNotFound);
- $this->lastEvaluationStatus = self::EVALUATION_SKIPPED;
- return null;
- }
-
- $applyPathsToPop = $this->prepareApplyValuesForFusionPath($fusionPath, $fusionConfiguration);
- $fusionObject = $this->instantiatefusionObject($fusionPath, $fusionConfiguration, $applyPathsToPop);
- $needToPopContext = $this->prepareContextForFusionObject($fusionObject, $fusionPath, $fusionConfiguration, $cacheContext);
- return $this->evaluateObjectOrRetrieveFromCache($fusionObject, $fusionPath, $fusionConfiguration, $cacheContext);
- } catch (
- StopActionException
- | SecurityException
- | RuntimeException
- | Exception\MissingFusionImplementationException
- | Exception\MissingFusionObjectException
- $exception
- ) {
- throw $exception;
- } catch (\Exception $exception) {
- return $this->handleRenderingException($fusionPath, $exception, true);
- } finally {
- // ends the evaluation of a fusion path
- if ($needToPopContext) {
- $this->popContext();
- }
- if ($applyPathsToPop !== []) {
- $this->popApplyValues($applyPathsToPop);
- }
- $this->runtimeContentCache->leave($cacheContext);
- }
- }
-
- /**
- * Does the evaluation of a Fusion instance, first checking the cache and if conditions and afterwards applying processors.
- *
- * @param AbstractFusionObject $fusionObject
- * @param string $fusionPath
- * @param array $fusionConfiguration
- * @param array $cacheContext
- * @return mixed
- */
- protected function evaluateObjectOrRetrieveFromCache($fusionObject, $fusionPath, $fusionConfiguration, $cacheContext)
- {
- $output = null;
- $evaluationStatus = self::EVALUATION_SKIPPED;
- [$cacheHit, $cachedResult] = $this->runtimeContentCache->preEvaluate($cacheContext, $fusionObject);
- if ($cacheHit) {
- return $cachedResult;
- }
-
- $evaluateObject = true;
- if (isset($fusionConfiguration['__meta']['if']) && $this->evaluateIfCondition($fusionConfiguration, $fusionPath, $fusionObject) === false) {
- $evaluateObject = false;
- }
-
- if ($evaluateObject) {
- $output = $fusionObject->evaluate();
- $evaluationStatus = self::EVALUATION_EXECUTED;
- }
-
- $this->lastEvaluationStatus = $evaluationStatus;
-
- if ($evaluateObject && isset($fusionConfiguration['__meta']['process'])) {
- $output = $this->evaluateProcessors($output, $fusionConfiguration, $fusionPath, $fusionObject);
- }
- $output = $this->runtimeContentCache->postProcess($cacheContext, $fusionObject, $output);
- return $output;
- }
-
- /**
- * Evaluates an EEL expression or value, checking if conditions first and applying processors.
- *
- * @param string $fusionPath the Fusion path up to now
- * @param array $fusionConfiguration Fusion configuration for the expression or value
- * @param \Neos\Fusion\FusionObjects\AbstractFusionObject $contextObject An optional object for the "this" value inside the context
- * @return mixed The result of the evaluation
- * @throws Exception
- */
- protected function evaluateExpressionOrValueInternal($fusionPath, $fusionConfiguration, $contextObject)
- {
- if (isset($fusionConfiguration['__meta']['if']) && $this->evaluateIfCondition($fusionConfiguration, $fusionPath, $contextObject) === false) {
- $this->lastEvaluationStatus = self::EVALUATION_SKIPPED;
-
- return null;
- }
-
- if (isset($fusionConfiguration['__eelExpression'])) {
- $evaluatedValue = $this->evaluateEelExpression($fusionConfiguration['__eelExpression'], $contextObject);
- } else {
- // must be simple type, as this is the only place where this method is called.
- $evaluatedValue = $fusionConfiguration['__value'];
- }
-
- if (isset($fusionConfiguration['__meta']['process'])) {
- $evaluatedValue = $this->evaluateProcessors($evaluatedValue, $fusionConfiguration, $fusionPath, $contextObject);
- }
-
- return $evaluatedValue;
- }
-
- /**
- * Possibly prepares a new "@apply" context for the current fusionPath and pushes it to the stack.
- * Returns true to express that new properties were pushed and have to be popped during finalizePathEvaluation.
- *
- * Since "@apply" are not inherited every call of this method leads to a completely new "@apply"
- * context, which is null by default.
- *
- * @param string $fusionPath
- * @param array $fusionConfiguration
- * @return array Paths to pop
- * @throws Exception
- * @throws RuntimeException
- * @throws SecurityException
- * @throws StopActionException
- */
- protected function prepareApplyValuesForFusionPath($fusionPath, $fusionConfiguration): array
- {
- $spreadValues = $this->evaluateApplyValues($fusionConfiguration, $fusionPath);
- if ($spreadValues === null) {
- return [];
- }
-
- foreach ($spreadValues as $path => $entry) {
- $this->currentApplyValues[$path] = $entry;
- }
- return array_keys($spreadValues);
- }
-
- /**
- * Possibly prepares a new context for the current FusionObject and cache context and pushes it to the stack.
- * Returns if a new context was pushed to the stack or not.
- *
- * @param AbstractFusionObject $fusionObject
- * @param string $fusionPath
- * @param array $fusionConfiguration
- * @param array $cacheContext
- * @return boolean
- * @throws Exception
- * @throws RuntimeException
- * @throws SecurityException
- * @throws StopActionException
- */
- protected function prepareContextForFusionObject(AbstractFusionObject $fusionObject, $fusionPath, $fusionConfiguration, $cacheContext)
- {
- if ($cacheContext['cacheForPathDisabled'] === true) {
- $newContextArray = [];
- foreach ($cacheContext['configuration']['context'] as $contextVariableName) {
- if (isset($this->currentContext[$contextVariableName])) {
- $newContextArray[$contextVariableName] = $this->currentContext[$contextVariableName];
- }
- }
- }
-
- if (isset($fusionConfiguration['__meta']['context'])) {
- $newContextArray ??= $this->currentContext;
- foreach ($fusionConfiguration['__meta']['context'] as $contextKey => $contextValue) {
- if ($this->fusionGlobals->has($contextKey)) {
- throw new Exception(sprintf('Overriding Fusion global variable "%s" via @context is not allowed.', $contextKey), 1706452069);
- }
- $newContextArray[$contextKey] = $this->evaluate($fusionPath . '/__meta/context/' . $contextKey, $fusionObject, self::BEHAVIOR_EXCEPTION);
- }
- }
-
- if (isset($newContextArray)) {
- $this->pushContextArray($newContextArray);
- return true;
- }
-
- return false;
- }
-
- /**
- * Instantiates a Fusion object specified by the given path and configuration
- *
- * @param string $fusionPath Path to the configuration for this object instance
- * @param array $fusionConfiguration Configuration at the given path
- * @param array $applyValuePaths Apply value paths for this object
- * @return AbstractFusionObject
- * @throws Exception
- */
- protected function instantiateFusionObject($fusionPath, $fusionConfiguration, array $applyValuePaths)
- {
- $fusionObjectType = $fusionConfiguration['__objectType'];
-
- $fusionObjectClassName = $fusionConfiguration['__meta']['class'] ?? null;
-
- if (!preg_match('#<[^>]*>$#', $fusionPath)) {
- // Only add Fusion object type to last path part if not already set
- $fusionPath .= '<' . $fusionObjectType . '>';
- }
- if (!class_exists($fusionObjectClassName)) {
- throw new Exception(<<shouldAssignPropertiesToFusionObject($fusionObject)) {
- /** @var $fusionObject AbstractArrayFusionObject */
- if (isset($fusionConfiguration['__meta']['ignoreProperties'])) {
- $evaluatedIgnores = $this->evaluate($fusionPath . '/__meta/ignoreProperties', $fusionObject);
- $fusionObject->setIgnoreProperties(is_array($evaluatedIgnores) ? $evaluatedIgnores : []);
- }
- $this->assignPropertiesToFusionObject($fusionObject, $fusionConfiguration, $applyValuePaths);
- }
- return $fusionObject;
- }
-
- /**
- * Is the given object an array like object that should get all properties assigned to iterate or process internally
- *
- * @psalm-assert-if-true AbstractArrayFusionObject $fusionObject
- */
- protected function shouldAssignPropertiesToFusionObject(AbstractFusionObject $fusionObject): bool
- {
- return $fusionObject instanceof AbstractArrayFusionObject;
- }
-
- /**
- * Assigns paths to the Array-Fusion object
- */
- protected function assignPropertiesToFusionObject(AbstractArrayFusionObject $fusionObject, array $fusionConfiguration, array $applyValuePaths): void
- {
- foreach ($fusionConfiguration as $key => $value) {
- // skip keys which start with __, as they are purely internal.
- if (is_string($key) && $key[0] === '_' && $key[1] === '_' && in_array($key, Parser::$reservedParseTreeKeys, true)) {
- continue;
- }
-
- ObjectAccess::setProperty($fusionObject, $key, $value);
- }
-
- if ($applyValuePaths !== []) {
- foreach ($applyValuePaths as $path) {
- $entry = $this->currentApplyValues[$path];
- $key = $entry['key'];
- if (isset($entry['lazy'])) {
- $valueAst = [
- '__eelExpression' => null,
- // Mark this property as not having a simple value in the AST -
- // the object implementation has to evaluate the key through the Runtime
- '__objectType' => 'Neos.Fusion:Lazy',
- '__value' => null
- ];
- } else {
- $valueAst = [
- '__eelExpression' => null,
- '__objectType' => null,
- '__value' => $entry['value']
- ];
- }
-
- // merge existing meta-configuration to valueAst
- // to preserve @if, @process and @position informations
- if ($meta = Arrays::getValueByPath($fusionConfiguration, [$key, '__meta'])) {
- $valueAst['__meta'] = $meta;
- }
-
- ObjectAccess::setProperty($fusionObject, $entry['key'], $valueAst);
- }
- }
- }
-
- /**
- * Evaluate an Eel expression
- *
- * @param string $expression The Eel expression to evaluate
- * @param \Neos\Fusion\FusionObjects\AbstractFusionObject $contextObject An optional object for the "this" value inside the context
- * @return mixed The result of the evaluated Eel expression
- * @throws Exception
- */
- protected function evaluateEelExpression($expression, AbstractFusionObject $contextObject = null)
- {
- if ($expression[0] !== '$' || $expression[1] !== '{') {
- // We still assume this is an EEL expression and wrap the markers for backwards compatibility.
- $expression = '${' . $expression . '}';
- }
-
- $contextVariables = array_merge($this->fusionGlobals->value, $this->currentContext);
-
- if (isset($contextVariables['this'])) {
- throw new Exception('Context variable "this" not allowed, as it is already reserved for a pointer to the current Fusion object.', 1344325044);
- }
- $contextVariables['this'] = $contextObject;
-
- /** @phpstan-ignore-next-line the mind of the great phpstan can and will not comprehend this */
- if ($this->eelEvaluator instanceof \Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy) {
- $this->eelEvaluator->_activateDependency();
- }
-
- $tracer = match ($this->settings['deprecationTracer'] ?? null) {
- 'LOG' => new EelNeosDeprecationTracer($expression, false),
- 'EXCEPTION' => new EelNeosDeprecationTracer($expression, true),
- default => null
- };
-
- return EelUtility::evaluateEelExpression($expression, $this->eelEvaluator, $contextVariables, [], $tracer);
- }
-
- /**
- * Evaluate "@apply" for the given fusion key.
- *
- * If apply-definitions are found they are evaluated and the returned keys are combined.
- * The result is returned as array with the following structure:
- *
- * [
- * 'fusionPath/key_1' => ['key' => 'key_1', 'value' => 'evaluated value 1'],
- * 'fusionPath/key_2' => ['key' => 'key_2', 'value' => 'evaluated value 2']
- * ]
- *
- * If no apply-expression is defined null is returned instead.
- *
- * @param array $configurationWithEventualProperties
- * @param string $fusionPath
- * @return array|null
- */
- protected function evaluateApplyValues($configurationWithEventualProperties, $fusionPath): ?array
- {
- if (isset($configurationWithEventualProperties['__meta']['apply'])) {
- $fusionObjectType = $configurationWithEventualProperties['__objectType'];
- if (!preg_match('#<[^>]*>$#', $fusionPath)) {
- // Only add Fusion object type to last path part if not already set
- $fusionPath .= '<' . $fusionObjectType . '>';
- }
- $combinedApplyValues = [];
- $propertiesConfiguration = $configurationWithEventualProperties['__meta']['apply'];
- $positionalArraySorter = new PositionalArraySorter($propertiesConfiguration, '__meta.position');
- foreach ($positionalArraySorter->getSortedKeys() as $key) {
- // skip keys which start with __, as they are purely internal.
- if (is_string($key) && $key[0] === '_' && $key[1] === '_' && in_array($key, Parser::$reservedParseTreeKeys, true)) {
- continue;
- }
-
- $singleApplyPath = $fusionPath . '/__meta/apply/' . $key;
- if (isset($propertiesConfiguration[$key]['__meta']['if']) && $this->evaluateIfCondition($propertiesConfiguration[$key], $singleApplyPath) === false) {
- continue;
- }
- if (isset($propertiesConfiguration[$key]['expression'])) {
- $singleApplyPath .= '/expression';
- }
- $singleApplyValues = $this->evaluate($singleApplyPath, null, self::BEHAVIOR_EXCEPTION);
- if ($singleApplyValues !== null || $this->getLastEvaluationStatus() !== static::EVALUATION_SKIPPED) {
- if (is_array($singleApplyValues)) {
- foreach ($singleApplyValues as $key => $value) {
- // skip keys which start with __, as they are purely internal.
- if (is_string($key) && $key[0] === '_' && $key[1] === '_' && in_array($key, Parser::$reservedParseTreeKeys, true)) {
- continue;
- }
-
- $combinedApplyValues[$fusionPath . '/' . $key] = [
- 'key' => $key,
- 'value' => $value
- ];
- }
- } elseif ($singleApplyValues instanceof \Iterator && $singleApplyValues instanceof \ArrayAccess) {
- for ($singleApplyValues->rewind(); ($key = $singleApplyValues->key()) !== null; $singleApplyValues->next()) {
- $combinedApplyValues[$fusionPath . '/' . $key] = [
- 'key' => $key,
- 'value' => function () use ($singleApplyValues, $key) {
- return $singleApplyValues[$key];
- },
- 'lazy' => true
- ];
- }
- }
- }
- }
- return $combinedApplyValues;
- }
-
- return null;
- }
-
- /**
- * Evaluate processors on given value.
- *
- * @param mixed $valueToProcess
- * @param array $configurationWithEventualProcessors
- * @param string $fusionPath
- * @param AbstractFusionObject $contextObject
- * @return mixed
- */
- protected function evaluateProcessors($valueToProcess, $configurationWithEventualProcessors, $fusionPath, AbstractFusionObject $contextObject = null)
- {
- $processorConfiguration = $configurationWithEventualProcessors['__meta']['process'];
- $positionalArraySorter = new PositionalArraySorter($processorConfiguration, '__meta.position');
- foreach ($positionalArraySorter->getSortedKeys() as $key) {
- $processorPath = $fusionPath . '/__meta/process/' . $key;
- if (isset($processorConfiguration[$key]['__meta']['if']) && $this->evaluateIfCondition($processorConfiguration[$key], $processorPath, $contextObject) === false) {
- continue;
- }
-
- # If there is only the internal "__stopInheritanceChain" path set, skip evaluation
- if (isset($processorConfiguration[$key]['__stopInheritanceChain']) && count($processorConfiguration[$key]) === 1) {
- continue;
- }
-
- if (isset($processorConfiguration[$key]['expression'])) {
- $processorPath .= '/expression';
- }
-
- $this->pushContext('value', $valueToProcess);
- $result = $this->evaluate($processorPath, $contextObject, self::BEHAVIOR_EXCEPTION);
- if ($result !== null || $this->getLastEvaluationStatus() !== static::EVALUATION_SKIPPED) {
- $valueToProcess = $result;
- }
- $this->popContext();
- }
-
- return $valueToProcess;
- }
-
- /**
- * Evaluate eventually existing meta "@if" conditionals inside the given configuration and path.
- *
- * @param array $configurationWithEventualIf
- * @param string $configurationPath
- * @param AbstractFusionObject $contextObject
- * @return boolean
- */
- protected function evaluateIfCondition($configurationWithEventualIf, $configurationPath, AbstractFusionObject $contextObject = null)
- {
- foreach ($configurationWithEventualIf['__meta']['if'] as $conditionKey => $conditionValue) {
- $conditionValue = $this->evaluate($configurationPath . '/__meta/if/' . $conditionKey, $contextObject, self::BEHAVIOR_EXCEPTION);
- if ((bool)$conditionValue === false) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Checks and throws an exception for an unrenderable path.
- *
- * @param string $fusionPath The Fusion path that cannot be rendered
- * @param array $fusionConfiguration
- * @param string $behaviorIfPathNotFound One of the BEHAVIOR_* constants
- * @throws Exception\MissingFusionImplementationException
- * @throws Exception\MissingFusionObjectException
- * @return void
- */
- protected function throwExceptionForUnrenderablePathIfNeeded($fusionPath, $fusionConfiguration, $behaviorIfPathNotFound)
- {
- if (isset($fusionConfiguration['__objectType'])) {
- $objectType = $fusionConfiguration['__objectType'];
- throw new Exceptions\MissingFusionImplementationException(<<legacyActionResponseForCurrentRendering !== null) {
- throw new Exception('Recursion detected in `Runtime::renderResponse`. This entry point is only allowed to be invoked once per rendering.', 1706993940);
- }
- $this->legacyActionResponseForCurrentRendering = new ActionResponse();
-
- // actual rendering
- $httpResponseOrStream = null;
- try {
- $httpResponseOrStream = $renderer();
- } finally {
- $toBeMergedLegacyActionResponse = $this->legacyActionResponseForCurrentRendering;
- // reset for next render
- $this->legacyActionResponseForCurrentRendering = null;
- }
-
- // transfer possible headers that have been set dynamically
- foreach ($toBeMergedLegacyActionResponse->buildHttpResponse()->getHeaders() as $name => $values) {
- if ($httpResponseOrStream instanceof StreamInterface) {
- $httpResponseOrStream = new Response(body: $httpResponseOrStream);
- }
- $httpResponseOrStream = $httpResponseOrStream->withAddedHeader($name, $values);
- }
- // if the status code is 200 we assume it's the default and will not overrule it
- if ($toBeMergedLegacyActionResponse->getStatusCode() !== 200) {
- if ($httpResponseOrStream instanceof StreamInterface) {
- $httpResponseOrStream = new Response(body: $httpResponseOrStream);
- }
- $httpResponseOrStream = $httpResponseOrStream->withStatus($toBeMergedLegacyActionResponse->getStatusCode());
- }
-
- return $httpResponseOrStream;
- }
-
- /**
- * The concept of the controller context inside Fusion has been deprecated.
- *
- * For further information and migration strategies, please look into {@see LegacyFusionControllerContext}
- *
- * WARNING:
- * Invoking this backwards-compatible layer is possibly unsafe, if the rendering was not started
- * in {@see self::renderEntryPathWithContext()} or no `request` global is available. This will raise an exception.
- *
- * @deprecated with Neos 9.0
- * @internal
- * @throws Exception if unsafe call
- */
- public function getControllerContext(): LegacyFusionControllerContext
- {
- // legacy controller context layer
- $actionRequest = $this->fusionGlobals->get('request');
- if ($this->legacyActionResponseForCurrentRendering === null || !$actionRequest instanceof ActionRequest) {
- throw new Exception(sprintf('Fusions simulated legacy controller context is only available inside `Runtime::renderResponse` and when the Fusion global "request" is an ActionRequest.'), 1706458355);
- }
-
- return new LegacyFusionControllerContext(
- $actionRequest,
- // expose action response to be possibly mutated in neos forms or fusion plugins.
- // this behaviour is highly internal and deprecated!
- $this->legacyActionResponseForCurrentRendering
- );
- }
-
- /**
- * Configures this runtime to override the default exception handler configured in the settings
- * or via Fusion's \@exceptionHandler {@see AbstractRenderingExceptionHandler}.
- *
- * In combination with the throwing handler {@see ThrowingHandler} this can be used to rethrow all exceptions.
- * This is helpfully for renderings in CLI context or testing.
- */
- public function overrideExceptionHandler(AbstractRenderingExceptionHandler $exceptionHandler): void
- {
- $this->overriddenExceptionHandler = $exceptionHandler;
- }
-
- /**
- * @param boolean $debugMode
- * @return void
- */
- public function setDebugMode($debugMode)
- {
- $this->debugMode = $debugMode;
- }
-
- /**
- * @return boolean
- */
- public function isDebugMode()
- {
- return $this->debugMode;
- }
-
- /**
- * If the Fusion content cache should be enabled at all
- *
- * @param boolean $flag
- * @return void
- */
- public function setEnableContentCache($flag)
- {
- $this->runtimeContentCache->setEnableContentCache($flag);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/RuntimeConfiguration.php b/src/Core/FusionProcessing/Fusion/RuntimeConfiguration.php
deleted file mode 100644
index ea586b6..0000000
--- a/src/Core/FusionProcessing/Fusion/RuntimeConfiguration.php
+++ /dev/null
@@ -1,250 +0,0 @@
-fusionConfiguration = $fusionConfiguration;
-
- $this->simpleTypeToArrayClosure = function ($simpleType) {
- return $simpleType === null ? null : [
- '__eelExpression' => null,
- '__value' => $simpleType,
- '__objectType' => null
- ];
- };
-
- $this->shouldOverrideFirstClosure = function ($key, $firstValue, $secondValue): bool {
- return is_array($secondValue) && isset($secondValue['__stopInheritanceChain']);
- };
- }
-
- /**
- * Get the expanded Fusion configuration for the given path
- *
- * @param string $fusionPath
- * @return array
- * @throws Exception
- */
- public function forPath(string $fusionPath): array
- {
- // Fast path if complete Fusion path is in configuration cache
- if (isset($this->pathCache[$fusionPath])) {
- return $this->pathCache[$fusionPath]['c'];
- }
-
- if ($fusionPath === '') {
- throw new Exception('Fusion path cannot be empty.', 1695308681);
- }
-
- // Find longest prefix of path that already is in path cache
- $pathUntilNow = '';
- $fusionPathLength = strlen($fusionPath);
- $offset = $fusionPathLength;
- $currentPrototypeDefinitions = [];
- while (($offset = strrpos($fusionPath, '/', -($fusionPathLength - $offset + 1))) != false) {
- $pathPrefix = substr($fusionPath, 0, $offset);
- if (isset($this->pathCache[$pathPrefix])) {
- $pathUntilNow = $pathPrefix;
- $configuration = $this->pathCache[$pathPrefix]['c'];
- $currentPrototypeDefinitions = $this->pathCache[$pathUntilNow]['p'];
- break;
- }
- }
-
- // No prefix was found, build configuration for path from the root
- if ($pathUntilNow === '') {
- $configuration = $this->fusionConfiguration;
- $currentPrototypeDefinitions = [];
- if (isset($configuration['__prototypes'])) {
- $currentPrototypeDefinitions = $configuration['__prototypes'];
- }
- }
- assert(isset($configuration));
-
- // Build configuration for the remaining path parts
- $remainingPath = substr($fusionPath, $pathUntilNow === '' ? 0 : strlen($pathUntilNow) + 1);
- /** @var non-empty-list $pathParts */
- $pathParts = explode('/', $remainingPath);
- foreach ($pathParts as $pathPart) {
- if ($pathUntilNow === '') {
- $pathUntilNow = $pathPart;
- } else {
- $pathUntilNow .= '/' . $pathPart;
- }
- if (isset($this->pathCache[$pathUntilNow])) {
- $configuration = $this->pathCache[$pathUntilNow]['c'];
- $currentPrototypeDefinitions = $this->pathCache[$pathUntilNow]['p'];
- continue;
- }
-
- $configuration = $this->matchCurrentPathPart($pathPart, $configuration, $currentPrototypeDefinitions);
- $this->pathCache[$pathUntilNow]['c'] = $configuration;
- $this->pathCache[$pathUntilNow]['p'] = $currentPrototypeDefinitions;
- }
-
- return $configuration;
- }
-
- /**
- * Matches the current path segment and prepares the configuration.
- *
- * @param string $pathPart
- * @param array $previousConfiguration
- * @param array $currentPrototypeDefinitions
- * @return array
- * @throws Exception
- */
- private function matchCurrentPathPart(string $pathPart, array $previousConfiguration, array &$currentPrototypeDefinitions): array
- {
- if (preg_match('#^([^<]*)(<(.*?)>)?$#', $pathPart, $matches) !== 1) {
- throw new Exception('Path Part ' . $pathPart . ' not well-formed', 1332494645);
- }
-
- $currentPathSegment = $matches[1];
- $configuration = [];
-
- if (isset($previousConfiguration[$currentPathSegment])) {
- $configuration = is_array($previousConfiguration[$currentPathSegment]) ? $previousConfiguration[$currentPathSegment] : $this->simpleTypeToArrayClosure->__invoke($previousConfiguration[$currentPathSegment]);
- }
-
- if (isset($configuration['__prototypes'])) {
- $currentPrototypeDefinitions = Arrays::arrayMergeRecursiveOverruleWithCallback(
- $currentPrototypeDefinitions,
- $configuration['__prototypes'],
- $this->simpleTypeToArrayClosure,
- $this->shouldOverrideFirstClosure
- );
- }
-
- $currentPathSegmentType = null;
- if (isset($configuration['__objectType'])) {
- $currentPathSegmentType = $configuration['__objectType'];
- }
- if (isset($matches[3])) {
- $currentPathSegmentType = $matches[3];
- }
-
- if ($currentPathSegmentType !== null) {
- $configuration['__objectType'] = $currentPathSegmentType;
- $configuration = $this->mergePrototypesWithConfigurationForPathSegment(
- $configuration,
- $currentPrototypeDefinitions
- );
- }
-
- if (is_array($configuration) && !isset($configuration['__value']) && !isset($configuration['__eelExpression']) && !isset($configuration['__meta']['class']) && !isset($configuration['__objectType']) && isset($configuration['__meta']['process'])) {
- $configuration['__value'] = '';
- }
-
- return $configuration;
- }
-
- /**
- * Merges the prototype chain into the configuration.
- *
- * @param array $configuration
- * @param array $currentPrototypeDefinitions
- * @return array
- * @throws Exception
- */
- private function mergePrototypesWithConfigurationForPathSegment(array $configuration, array &$currentPrototypeDefinitions): array
- {
- $currentPathSegmentType = $configuration['__objectType'];
-
- if (isset($currentPrototypeDefinitions[$currentPathSegmentType])) {
- $prototypeMergingOrder = [$currentPathSegmentType];
- if (isset($currentPrototypeDefinitions[$currentPathSegmentType]['__prototypeChain'])) {
- $prototypeMergingOrder = array_merge(
- $currentPrototypeDefinitions[$currentPathSegmentType]['__prototypeChain'],
- $prototypeMergingOrder
- );
- }
-
- $currentPrototypeWithInheritanceTakenIntoAccount = [];
-
- foreach ($prototypeMergingOrder as $prototypeName) {
- if (!array_key_exists($prototypeName, $currentPrototypeDefinitions)) {
- throw new Exception(sprintf(
- 'The Fusion object `%s` which you tried to inherit from does not exist. Maybe you have a typo on the right hand side of your inheritance statement for `%s`.',
- $prototypeName,
- $currentPathSegmentType
- ), 1427134340);
- }
-
- $currentPrototypeWithInheritanceTakenIntoAccount = Arrays::arrayMergeRecursiveOverruleWithCallback(
- $currentPrototypeWithInheritanceTakenIntoAccount,
- $currentPrototypeDefinitions[$prototypeName],
- $this->simpleTypeToArrayClosure,
- $this->shouldOverrideFirstClosure
- );
- }
-
- // We merge the already flattened prototype with the current configuration (in that order),
- // to make sure that the current configuration (not being defined in the prototype) wins.
- $configuration = Arrays::arrayMergeRecursiveOverruleWithCallback(
- $currentPrototypeWithInheritanceTakenIntoAccount,
- $configuration,
- $this->simpleTypeToArrayClosure,
- $this->shouldOverrideFirstClosure
- );
-
- // If context-dependent prototypes are set (such as prototype("foo").prototype("baz")),
- // we update the current prototype definitions.
- if (isset($currentPrototypeWithInheritanceTakenIntoAccount['__prototypes'])) {
- $currentPrototypeDefinitions = Arrays::arrayMergeRecursiveOverruleWithCallback(
- $currentPrototypeDefinitions,
- $currentPrototypeWithInheritanceTakenIntoAccount['__prototypes'],
- $this->simpleTypeToArrayClosure,
- $this->shouldOverrideFirstClosure
- );
- }
- }
-
- return $configuration;
- }
-
- /**
- * No API, internal use for testing
- *
- * @param string $fusionPath
- * @return bool
- * @internal
- */
- public function isPathCached(string $fusionPath): bool
- {
- return isset($this->pathCache[$fusionPath]);
- }
-}
diff --git a/src/Core/FusionProcessing/Fusion/RuntimeFactory.php b/src/Core/FusionProcessing/Fusion/RuntimeFactory.php
deleted file mode 100644
index e29f775..0000000
--- a/src/Core/FusionProcessing/Fusion/RuntimeFactory.php
+++ /dev/null
@@ -1,83 +0,0 @@
-
- */
- protected ?array $defaultContextConfiguration;
-
- /**
- * @param array $fusionConfiguration
- * @deprecated with Neos 8.3 might be removed with Neos 9.0 use {@link createFromConfiguration} instead.
- */
- public function create(array $fusionConfiguration, ControllerContext $controllerContext = null): Runtime
- {
- $defaultContextVariables = EelUtility::getDefaultContextVariables(
- $this->defaultContextConfiguration ?? []
- );
- return new Runtime(
- FusionConfiguration::fromArray($fusionConfiguration),
- FusionGlobals::fromArray(
- [
- ...$defaultContextVariables,
- 'request' => $controllerContext?->getRequest() ?? ActionRequest::fromHttpRequest(ServerRequest::fromGlobals()),
- ]
- )
- );
- }
-
- public function createFromConfiguration(
- FusionConfiguration $fusionConfiguration,
- FusionGlobals $fusionGlobals
- ): Runtime {
- $fusionGlobalHelpers = FusionGlobals::fromArray(
- EelUtility::getDefaultContextVariables(
- $this->defaultContextConfiguration ?? []
- )
- );
- return new Runtime($fusionConfiguration, $fusionGlobalHelpers->merge($fusionGlobals));
- }
-
- public function createFromSourceCode(
- FusionSourceCodeCollection $sourceCode,
- FusionGlobals $fusionGlobals
- ): Runtime {
- return $this->createFromConfiguration(
- $this->fusionParser->parseFromSource($sourceCode),
- $fusionGlobals
- );
- }
-}
diff --git a/src/Core/FusionProcessing/FusionFileProcessor.php b/src/Core/FusionProcessing/FusionFileProcessor.php
deleted file mode 100644
index 8edc7fd..0000000
--- a/src/Core/FusionProcessing/FusionFileProcessor.php
+++ /dev/null
@@ -1,54 +0,0 @@
-getFilePath(), '.fusion');
- }
-
- public function process(File $file, Configuration $configuration): array
- {
- $systemErrorsAndFileDiffs = [Bridge::SYSTEM_ERRORS => [], Bridge::FILE_DIFFS => []];
- if ($this->fusionRectors === []) {
- return $systemErrorsAndFileDiffs;
- }
- $oldFileContent = $file->getFileContent();
- $newFileContent = $file->getFileContent();
- foreach ($this->fusionRectors as $fusionRector) {
- $newFileContent = $fusionRector->refactorFileContent($file->getFileContent());
- if ($oldFileContent === $newFileContent) {
- continue;
- }
- $file->changeFileContent($newFileContent);
- }
- if ($oldFileContent !== $newFileContent) {
- $fileDiff = $this->fileDiffFactory->createFileDiff($file, $oldFileContent, $newFileContent);
- $systemErrorsAndFileDiffs[Bridge::FILE_DIFFS][] = $fileDiff;
- }
- return $systemErrorsAndFileDiffs;
- }
-
- public function getSupportedFileExtensions(): array
- {
- return ['fusion'];
- }
-}
diff --git a/src/Core/FusionProcessing/FusionRectorInterface.php b/src/Core/FusionProcessing/FusionRectorInterface.php
deleted file mode 100644
index 0fd19df..0000000
--- a/src/Core/FusionProcessing/FusionRectorInterface.php
+++ /dev/null
@@ -1,12 +0,0 @@
-parseFusionFile();
- $eelExpressionPositions = EelExpressionPositions::fromArray($parser->foundEelExpressions);
-
- // enrich $eelExpressionPositions by filling fusionPath -> needed for some context sensitive transformations
- $eelExpressionPathBuilder = new EelExpressionPathBuilderVisitor(
- $eelExpressionPositions
- );
- $fusionFile->visit($eelExpressionPathBuilder);
-
- return $eelExpressionPositions;
- }
-
- /**
- * @return AfxExpressionPosition[]
- * @throws ParserException
- */
- public static function findAfxExpressions(string $sourceCode, ?string $contextPathAndFilename = null): array
- {
- $lexer = new Lexer($sourceCode);
- $parser = new self($lexer, $contextPathAndFilename);
- $parser->parseFusionFile();
- return $parser->foundAfxExpressions;
- }
-
- /**
- * @throws ParserException
- */
- protected function parsePathValue(): AbstractPathValue
- {
- $fromOffset = $this->lexer->getCursor();
- $result = parent::parsePathValue();
- if ($result instanceof EelExpressionValue) {
- $toOffset = $this->lexer->getCursor();
- $this->foundEelExpressions[] = new EelExpressionPosition($result->value, $fromOffset + 2, $toOffset - 1, $result);
- }
- return $result;
- }
-
- /**
- * @throws ParserException
- */
- protected function parseDslExpression(): DslExpressionValue
- {
- $fromOffset = $this->lexer->getCursor();
- $result = parent::parseDslExpression();
- $toOffset = $this->lexer->getCursor();
-
- if ($result->identifier === 'afx') {
- $this->foundAfxExpressions[] = new AfxExpressionPosition($result->code, $fromOffset, $toOffset);
- }
- return $result;
- }
-}
diff --git a/src/Core/FusionProcessing/Helper/EelExpressionPathBuilderVisitor.php b/src/Core/FusionProcessing/Helper/EelExpressionPathBuilderVisitor.php
deleted file mode 100644
index 6217aaa..0000000
--- a/src/Core/FusionProcessing/Helper/EelExpressionPathBuilderVisitor.php
+++ /dev/null
@@ -1,36 +0,0 @@
- false,
- fn() => [],
- );
- }
-
- public function visitValueAssignment(ValueAssignment $valueAssignment, array $currentPath = null)
- {
- $currentPath ?? throw new \BadMethodCallException('$currentPath is required.');
-
- // send currentPath to eel expression value
- $valueAssignment->pathValue->visit($this, $currentPath);
- }
-
- public function visitEelExpressionValue(EelExpressionValue $eelExpressionValue, array $currentPath = null)
- {
- $eelExpressionPosition = $this->eelExpressionPositions->byEelExpressionValue($eelExpressionValue);
- if ($eelExpressionPosition) {
- $eelExpressionPosition->fusionPath = FusionPath::create($currentPath);
- }
- }
-}
diff --git a/src/Core/FusionProcessing/Helper/EelExpressionPosition.php b/src/Core/FusionProcessing/Helper/EelExpressionPosition.php
deleted file mode 100644
index 0d4bd86..0000000
--- a/src/Core/FusionProcessing/Helper/EelExpressionPosition.php
+++ /dev/null
@@ -1,42 +0,0 @@
-fusionPath = FusionPath::createEmpty();
- }
-
- public function withOffset(int $offset): self
- {
- return new self(
- $this->eelExpression,
- $this->fromOffset + $offset,
- $this->toOffset + $offset,
- $this->eelExpressionValue
- );
- }
-
- public function withEelExpression(string $eelExpression)
- {
- return new self(
- $eelExpression,
- $this->fromOffset,
- $this->toOffset,
- $this->eelExpressionValue
- );
- }
-}
diff --git a/src/Core/FusionProcessing/Helper/EelExpressionPositions.php b/src/Core/FusionProcessing/Helper/EelExpressionPositions.php
deleted file mode 100644
index b4e4501..0000000
--- a/src/Core/FusionProcessing/Helper/EelExpressionPositions.php
+++ /dev/null
@@ -1,78 +0,0 @@
-elements = $eelExpressionPositions;
- }
-
- public static function fromArray(array $eelExpressionPositions): self
- {
- return new self(...$eelExpressionPositions);
- }
-
- /**
- * @return Traversable
- */
- public function getIterator(): Traversable
- {
- return new \ArrayIterator($this->elements);
- }
-
- public function withOffset(int $offset): self
- {
- return $this->map(fn(EelExpressionPosition $expressionPosition) => $expressionPosition->withOffset($offset));
- }
-
- public function map(\Closure $mapFn): self
- {
- return new EelExpressionPositions(...array_map($mapFn, $this->elements));
- }
-
- public function addAndSort(EelExpressionPositions $other): self
- {
- $elements = array_merge($this->elements, $other->elements);
- usort($elements, fn(EelExpressionPosition $a, EelExpressionPosition $b) => $a->fromOffset <=> $b->fromOffset);
-
- return new self(...$elements);
- }
-
- public function isEmpty(): bool
- {
- return empty($this->elements);
- }
-
- public function first(): EelExpressionPosition
- {
- return reset($this->elements);
- }
-
- public function withoutFirst(): self
- {
- $elements = $this->elements;
- array_shift($elements);
- return new self(...$elements);
- }
-
- public function byEelExpressionValue(EelExpressionValue $eelExpressionValue): ?EelExpressionPosition
- {
- foreach ($this->elements as $element) {
- if ($element->eelExpressionValue === $eelExpressionValue) {
- return $element;
- }
- }
- return null;
- }
-}
diff --git a/src/Core/FusionProcessing/Helper/FusionPath.php b/src/Core/FusionProcessing/Helper/FusionPath.php
deleted file mode 100644
index bc76d4b..0000000
--- a/src/Core/FusionProcessing/Helper/FusionPath.php
+++ /dev/null
@@ -1,42 +0,0 @@
-fusionPath) === 6
- // f.e. count($expectedSegments) === 3
- // $this->fusionPath 0 | 1 | 2 | 3 | 4 | 5
- // $expectedSegments ----------
- // $expectedSegments -----------
- // $expectedSegments -----------
- // $expectedSegments ----------
- for ($startOffset = 0; $startOffset <= count($this->fusionPath) - count($expectedSegments); $startOffset++) {
- if (array_slice($this->fusionPath, $startOffset, count($expectedSegments)) === $expectedSegments) {
- return true;
- }
- }
-
- return false;
- }
-}
diff --git a/src/Core/FusionProcessing/Helper/PrecedingFusionFileComment.php b/src/Core/FusionProcessing/Helper/PrecedingFusionFileComment.php
deleted file mode 100644
index 59b799e..0000000
--- a/src/Core/FusionProcessing/Helper/PrecedingFusionFileComment.php
+++ /dev/null
@@ -1,16 +0,0 @@
-getFilePath(), '.yaml');
- }
-
- public function process(File $file, Configuration $configuration): array
- {
- $systemErrorsAndFileDiffs = [Bridge::SYSTEM_ERRORS => [], Bridge::FILE_DIFFS => []];
- if ($this->yamlRectors === []) {
- return $systemErrorsAndFileDiffs;
- }
- $oldFileContent = $file->getFileContent();
- $newFileContent = $file->getFileContent();
- foreach ($this->yamlRectors as $yamlRector) {
- $newFileContent = $yamlRector->refactorFileContent($file->getFileContent());
- if ($oldFileContent === $newFileContent) {
- continue;
- }
- $file->changeFileContent($newFileContent);
- }
- if ($oldFileContent !== $newFileContent) {
- $fileDiff = $this->fileDiffFactory->createFileDiff($file, $oldFileContent, $newFileContent);
- $systemErrorsAndFileDiffs[Bridge::FILE_DIFFS][] = $fileDiff;
- }
- return $systemErrorsAndFileDiffs;
- }
-
- public function getSupportedFileExtensions(): array
- {
- return ['yaml'];
- }
-}
diff --git a/src/Core/YamlProcessing/YamlRectorInterface.php b/src/Core/YamlProcessing/YamlRectorInterface.php
deleted file mode 100644
index e29a662..0000000
--- a/src/Core/YamlProcessing/YamlRectorInterface.php
+++ /dev/null
@@ -1,12 +0,0 @@
- our assumption is that we hit some backtracking limit of the regex engine. By using .+
- // instead, we seem to reduce the amount of backtracking, fixing the problem (hopefully everywhere :) )
-
- // first, replace the comment keys of the form 'bla##': ...
- $yamlAsString = preg_replace_callback("|(\s*)'.+##': '##([a-zA-Z0-9+=]+)'|m", function ($a) {
- $indentation = $a[1];
- $comment = base64_decode($a[2]);
- $commentLines = explode("\n", $comment);
- $prefix = $indentation . '# ';
- return $prefix . implode("\n" . $prefix, $commentLines);
- }, $yamlAsString);
-
- // second, replace the comment keys of the form - '##...'
- $yamlAsString = preg_replace_callback("|^(\s*)- '##([a-zA-Z0-9+=]+)'$|m", function ($a) {
- $indentation = $a[1];
- $comment = base64_decode($a[2]);
- $commentLines = explode("\n", $comment);
- $prefix = $indentation . '# ';
- return $prefix . implode("\n" . $prefix, $commentLines);
- }, $yamlAsString);
-
- return $yamlAsString;
- }
-
- /**
- * sort the keys appended with "##" (signifying comments) BEFORE the entry where the comment should apply.
- *
- * @param array $in
- * @return array
- */
- private static function sort(array $in): array
- {
- $keysToSort = [];
- foreach ($in as $key => $value) {
- if (is_string($key) && str_ends_with($key, '##')) {
- $keysToSort[] = $key;
- }
- }
-
- foreach ($keysToSort as $key) {
- // https://stackoverflow.com/a/38655962
- $new_element = [$key => $in[$key]];
-
- // if needed, find the insertion index by key
- $index = array_search(substr($key, 0, -2), array_keys($in));
- if ($index !== false) {
- // add element at index (note the last array_slice argument)
- $in = array_slice($in, 0, $index, true) + $new_element + array_slice($in, $index, null, true);
- }
- }
-
- foreach ($in as $key => $value) {
- if (is_array($value)) {
- $in[$key] = self::sort($value);
- }
- }
-
- return $in;
- }
-}
diff --git a/src/Generic/Rules/FusionFlowQueryNodePropertyToWarningCommentRector.php b/src/Generic/Rules/FusionFlowQueryNodePropertyToWarningCommentRector.php
deleted file mode 100644
index fbc2914..0000000
--- a/src/Generic/Rules/FusionFlowQueryNodePropertyToWarningCommentRector.php
+++ /dev/null
@@ -1,64 +0,0 @@
-fusionFlowQueryNodePropertyToWarningComments as $flowQueryNodePropertyToWarningComment) {
- $property = $flowQueryNodePropertyToWarningComment->property;
- $regexWarningMessagePairs[] = new RegexCommentTemplatePair(
- "/\.property\(('|\")$property('|\")\)/",
- (string)self::todoCommentAttribute($flowQueryNodePropertyToWarningComment->warningMessage)
- );
-
- }
-
- return EelExpressionTransformer::parse($fileContent)
- ->addCommentsIfRegexesMatch($regexWarningMessagePairs)
- ->getProcessedContent();
-
- }
-
- /**
- * @param FusionFlowQueryNodePropertyToWarningComment[] $configuration
- */
- public function configure(array $configuration): void
- {
- Assert::allIsAOf($configuration, FusionFlowQueryNodePropertyToWarningComment::class);
- $this->fusionFlowQueryNodePropertyToWarningComments = $configuration;
- }
-}
diff --git a/src/Generic/Rules/FusionNodePropertyPathToWarningCommentRector.php b/src/Generic/Rules/FusionNodePropertyPathToWarningCommentRector.php
deleted file mode 100644
index 4127fa2..0000000
--- a/src/Generic/Rules/FusionNodePropertyPathToWarningCommentRector.php
+++ /dev/null
@@ -1,71 +0,0 @@
-fusionNodePropertyPathToWarningComments as $fusionNodePropertyPathToWarningComment) {
-
- // escape the fusion path separator "."
- $propertyPath = str_replace('.', '\.', $fusionNodePropertyPathToWarningComment->propertyPath);
-
- $regexWarningMessagePairs[] = new RegexCommentTemplatePair(
- "/(node|site|documentNode)\.$propertyPath/",
- (string)self::todoCommentAttribute($fusionNodePropertyPathToWarningComment->warningMessage)
- );
-
- }
-
- return EelExpressionTransformer::parse($fileContent)
- ->addCommentsIfRegexesMatch($regexWarningMessagePairs)
- ->getProcessedContent()
- ;
-
- }
-
- /**
- * @param FusionNodePropertyPathToWarningComment[] $configuration
- */
- public function configure(array $configuration): void
- {
- Assert::allIsAOf($configuration, FusionNodePropertyPathToWarningComment::class);
- $this->fusionNodePropertyPathToWarningComments = $configuration;
- }
-}
diff --git a/src/Generic/Rules/FusionPrototypeNameAddCommentRector.php b/src/Generic/Rules/FusionPrototypeNameAddCommentRector.php
deleted file mode 100644
index 70dff89..0000000
--- a/src/Generic/Rules/FusionPrototypeNameAddCommentRector.php
+++ /dev/null
@@ -1,54 +0,0 @@
-fusionPrototypeNameAddComments as $fusionPrototypeNameAddComment) {
- $matches = [];
- $pattern = '/(^|[=\s\(<\/])(' . $fusionPrototypeNameAddComment->name . ')([\s\{\)\/>]|$)/';
- preg_match($pattern, $fileContent, $matches);
-
- if (count($matches) > 0) {
- $comments[] = "// " . $fusionPrototypeNameAddComment->comment;
- }
- }
-
- if (count($comments) > 0) {
- $fileContent = implode("\n", $comments) . "\n" . $fileContent;
- }
-
- return $fileContent;
- }
-
- /**
- * @param FusionPrototypeNameAddComment[] $configuration
- */
- public function configure(array $configuration): void
- {
- Assert::allIsAOf($configuration, FusionPrototypeNameAddComment::class);
- $this->fusionPrototypeNameAddComments = $configuration;
- }
-}
diff --git a/src/Generic/Rules/FusionReplacePrototypeNameRector.php b/src/Generic/Rules/FusionReplacePrototypeNameRector.php
deleted file mode 100644
index d18cb79..0000000
--- a/src/Generic/Rules/FusionReplacePrototypeNameRector.php
+++ /dev/null
@@ -1,59 +0,0 @@
-fusionPrototypeNameReplacements as $fusionPrototypeNameReplacement) {
- $replacementCount = 0;
- if ($fusionPrototypeNameReplacement->skipPrototypeDefinitions) {
- $pattern = '/(^|[=\s<\/])(' . $fusionPrototypeNameReplacement->oldName . ')([\s{\/>]|$)/';
- } else {
- $pattern = '/(^|[=\s(<\/])(' . $fusionPrototypeNameReplacement->oldName . ')([\s{)\/>]|$)/';
- }
- $replacement = '$1' . $fusionPrototypeNameReplacement->newName . '$3';
- $fileContent = preg_replace($pattern, $replacement, $fileContent, count: $replacementCount);
-
- if ($replacementCount > 0 && $fusionPrototypeNameReplacement->comment !== null) {
- $comments[] = '// TODO 9.0 migration: ' . $fusionPrototypeNameReplacement->comment;
- }
- }
-
- if (count($comments) > 0) {
- $fileContent = implode("\n", $comments) . "\n" . $fileContent;
- }
-
- return $fileContent;
- }
-
- /**
- * @param FusionNodePropertyPathToWarningComment[] $configuration
- */
- public function configure(array $configuration): void
- {
- Assert::allIsAOf($configuration, FusionPrototypeNameReplacement::class);
- $this->fusionPrototypeNameReplacements = $configuration;
- }
-}
diff --git a/src/Generic/Rules/InjectServiceIfNeededRector.php b/src/Generic/Rules/InjectServiceIfNeededRector.php
index c83948b..59263de 100644
--- a/src/Generic/Rules/InjectServiceIfNeededRector.php
+++ b/src/Generic/Rules/InjectServiceIfNeededRector.php
@@ -4,22 +4,23 @@
namespace Neos\Rector\Generic\Rules;
-use Neos\Rector\Utility\CodeSampleLoader;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
+use Neos\Rector\Generic\ValueObject\AddInjection;
+use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\Property;
-use Rector\Core\NodeManipulator\ClassInsertManipulator;
-use Rector\Core\Rector\AbstractRector;
+use Rector\Contract\Rector\ConfigurableRectorInterface;
+use Rector\NodeManipulator\ClassInsertManipulator;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
use Webmozart\Assert\Assert;
-use Neos\Rector\Generic\ValueObject\AddInjection;
-use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
// Modelled after https://raw.githubusercontent.com/sabbelasichon/typo3-rector/main/src/Rector/v10/v2/InjectEnvironmentServiceIfNeededInResponseRector.php
-final class InjectServiceIfNeededRector extends AbstractRector implements ConfigurableRectorInterface
+final class InjectServiceIfNeededRector extends AbstractRector implements ConfigurableRectorInterface, DocumentedRuleInterface
{
/**
* @var AddInjection[]
diff --git a/src/Generic/Rules/MethodCallToPropertyFetchRector.php b/src/Generic/Rules/MethodCallToPropertyFetchRector.php
new file mode 100644
index 0000000..bb0c719
--- /dev/null
+++ b/src/Generic/Rules/MethodCallToPropertyFetchRector.php
@@ -0,0 +1,83 @@
+getFirstname()` to property fetch `$this->firstname`', [new ConfiguredCodeSample(<<<'CODE_SAMPLE'
+class SomeClass
+{
+ public function run()
+ {
+ $this->getFirstname();
+ }
+}
+CODE_SAMPLE
+ , <<<'CODE_SAMPLE'
+class SomeClass
+{
+ public function run()
+ {
+ $this->firstname;
+ }
+}
+CODE_SAMPLE
+ , [new MethodCallToPropertyFetch('ExamplePersonClass', 'getFirstname', 'firstname')])]);
+ }
+
+ /**
+ * @return array>
+ */
+ public function getNodeTypes(): array
+ {
+ return [MethodCall::class];
+ }
+
+ /**
+ * @param MethodCall $node
+ */
+ public function refactor(Node $node): ?Node
+ {
+ foreach ($this->methodCallsToPropertyFetches as $methodCallToPropertyFetch) {
+ if (!$this->isName($node->name, $methodCallToPropertyFetch->getOldMethod())) {
+ continue;
+ }
+ if (!$this->isObjectType($node->var, $methodCallToPropertyFetch->getOldObjectType())) {
+ continue;
+ }
+ return $this->nodeFactory->createPropertyFetch($node->var, $methodCallToPropertyFetch->getNewProperty());
+ }
+ return null;
+ }
+
+ /**
+ * @param mixed[] $configuration
+ */
+ public function configure(array $configuration): void
+ {
+ Assert::allIsAOf($configuration, MethodCallToPropertyFetch::class);
+ $this->methodCallsToPropertyFetches = $configuration;
+ }
+}
diff --git a/src/Generic/Rules/MethodCallToWarningCommentRector.php b/src/Generic/Rules/MethodCallToWarningCommentRector.php
index eb2f196..ef72b26 100644
--- a/src/Generic/Rules/MethodCallToWarningCommentRector.php
+++ b/src/Generic/Rules/MethodCallToWarningCommentRector.php
@@ -4,18 +4,20 @@
namespace Neos\Rector\Generic\Rules;
+use Neos\ContentRepository\Domain\Model\Node as NodeLegacyStub;
use Neos\Rector\Generic\ValueObject\MethodCallToWarningComment;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
use PHPStan\Type\ObjectType;
-use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\Contract\Rector\ConfigurableRectorInterface;
+use Rector\PhpParser\Node\BetterNodeFinder;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
use Webmozart\Assert\Assert;
-use Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub;
-final class MethodCallToWarningCommentRector extends AbstractRector implements ConfigurableRectorInterface
+final class MethodCallToWarningCommentRector extends AbstractRector implements ConfigurableRectorInterface, DocumentedRuleInterface
{
use AllTraits;
@@ -25,9 +27,8 @@ final class MethodCallToWarningCommentRector extends AbstractRector implements C
private array $methodCallsToWarningComments = [];
public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- )
- {
+ private BetterNodeFinder $betterNodeFinder,
+ ) {
}
public function getRuleDefinition(): RuleDefinition
@@ -42,40 +43,38 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
public function refactor(Node $node): ?Node
{
- assert($node instanceof Node\Expr\MethodCall);
+ if (!in_array('expr', $node->getSubNodeNames())) {
+ return null;
+ }
+
foreach ($this->methodCallsToWarningComments as $methodCallToWarningComment) {
- if (!$this->isName($node->name, $methodCallToWarningComment->methodName)) {
- continue;
- }
- if (!$this->isObjectType($node->var, new ObjectType($methodCallToWarningComment->objectType))) {
- continue;
+ $methodCall = $this->betterNodeFinder->findFirst($node, function (Node $subNode) use ($methodCallToWarningComment) {
+ return $subNode instanceof MethodCall
+ && $this->isObjectType($subNode->var, new ObjectType($methodCallToWarningComment->objectType))
+ && $this->isName($subNode->name, $methodCallToWarningComment->methodName);
+ });
+ if ($methodCall) {
+ return self::withTodoComment(
+ sprintf($methodCallToWarningComment->warningMessage, $methodCallToWarningComment->objectType, $methodCallToWarningComment->methodName),
+ $node
+ );
}
-
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::todoComment(sprintf($methodCallToWarningComment->warningMessage, $methodCallToWarningComment->objectType, $methodCallToWarningComment->methodName))
- ],
- $node
- );
-
- return $node;
}
return null;
}
-
/**
* @param mixed[] $configuration
*/
- public function configure(array $configuration) : void
+ public function configure(array $configuration): void
{
Assert::allIsAOf($configuration, MethodCallToWarningComment::class);
$this->methodCallsToWarningComments = $configuration;
diff --git a/src/Generic/Rules/ObjectInstantiationToWarningCommentRector.php b/src/Generic/Rules/ObjectInstantiationToWarningCommentRector.php
index 32c7f61..2048fe4 100644
--- a/src/Generic/Rules/ObjectInstantiationToWarningCommentRector.php
+++ b/src/Generic/Rules/ObjectInstantiationToWarningCommentRector.php
@@ -4,19 +4,24 @@
namespace Neos\Rector\Generic\Rules;
+use Neos\Rector\ContentRepository90\Rules\AllTraits;
use Neos\Rector\Generic\ValueObject\ObjectInstantiationToWarningComment;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
use PhpParser\Node\Name;
+use PhpParser\NodeTraverser;
+use PhpParser\NodeVisitorAbstract;
use PHPStan\Type\ObjectType;
-use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
-use Rector\Core\Rector\AbstractRector;
-use Rector\NodeTypeResolver\Node\AttributeKey;
+use Rector\Contract\Rector\ConfigurableRectorInterface;
+use Rector\NodeTypeResolver\NodeTypeResolver;
+use Rector\PhpParser\Node\NodeFactory;
use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
use Webmozart\Assert\Assert;
-final class ObjectInstantiationToWarningCommentRector extends AbstractRector implements ConfigurableRectorInterface
+final class ObjectInstantiationToWarningCommentRector extends AbstractRector implements ConfigurableRectorInterface, DocumentedRuleInterface
{
use AllTraits;
@@ -25,9 +30,8 @@ final class ObjectInstantiationToWarningCommentRector extends AbstractRector imp
*/
private array $objectInstantiationToWarningComments = [];
- public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector,
- ) {
+ public function __construct()
+ {
}
public function getRuleDefinition(): RuleDefinition
@@ -42,36 +46,58 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [Name::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Name $node
+ * @param Node\Stmt $node
*/
public function refactor(Node $node): ?Node
{
- assert($node instanceof Name);
-
- if ($node->getAttribute(AttributeKey::PARENT_NODE) instanceof Node\Stmt\UseUse) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- foreach ($this->objectInstantiationToWarningComments as $objectInstantiationToWarningComment) {
- if (!$this->isObjectType($node, new ObjectType($objectInstantiationToWarningComment->className))) {
- continue;
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor($visitor = new class($this->nodeTypeResolver, $this->nodeFactory, $this->objectInstantiationToWarningComments) extends NodeVisitorAbstract {
+ use AllTraits;
+
+ public function __construct(
+ private readonly NodeTypeResolver $nodeTypeResolver,
+ protected NodeFactory $nodeFactory,
+ private readonly array $objectInstantiationToWarningComments,
+ public bool $changed = false,
+ public ?string $commentToAdd = null,
+ ) {
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::todoComment(sprintf($objectInstantiationToWarningComment->warningMessage, $objectInstantiationToWarningComment->className))
- ],
- $node
- );
+ public function leaveNode(Node $node)
+ {
+ if ($node instanceof Name) {
+ foreach ($this->objectInstantiationToWarningComments as $objectInstantiationToWarningComment) {
+ if ($node && $this->nodeTypeResolver->isObjectType($node, new ObjectType($objectInstantiationToWarningComment->className))) {
+ $this->changed = true;
+ $this->commentToAdd = sprintf($objectInstantiationToWarningComment->warningMessage, $objectInstantiationToWarningComment->className);
+ return null;
+ }
+ }
+ }
+
+ return null;
+ }
+ });
+ $traverser->traverse([$node->expr])[0];
+
+ if ($visitor->changed) {
+ return
+ self::withTodoComment(
+ $visitor->commentToAdd,
+ $node
+ );
}
- return $node;
+ return null;
}
-
/**
* @param mixed[] $configuration
*/
diff --git a/src/Generic/Rules/RemoveDuplicateCommentRector.php b/src/Generic/Rules/RemoveDuplicateCommentRector.php
deleted file mode 100644
index d932256..0000000
--- a/src/Generic/Rules/RemoveDuplicateCommentRector.php
+++ /dev/null
@@ -1,106 +0,0 @@
-
- */
- private $seenCommentsInFiles;
-
- public function __construct(
- )
- {
- }
-
- public function getRuleDefinition(): RuleDefinition
- {
- return CodeSampleLoader::fromFile('"Warning comments for various non-supported use cases', __CLASS__);
- }
-
- /**
- * @return array>
- */
- public function getNodeTypes(): array
- {
- return [Node::class];
- }
-
- /**
- * @param Node $node
- */
- public function refactor(Node $node): ?Node
- {
- if (self::commentContains90Comment($node)) {
- $filePath = $this->file->getFilePath();
- $changedComments = false;
- $newComments = [];
- foreach ($node->getComments() as $comment) {
- $lineNumbers = $this->seenCommentsInFiles[$filePath][$comment->getText()] ?? [];
-
- if (self::isDuplicate($comment, $lineNumbers)) {
- $changedComments = true;
-
- if ($node instanceof Node\Stmt\Nop) {
- $node->setAttribute('comments', []);
- $this->removeNode($node);
- return $node;
- }
- } else {
- $newComments[] = $comment;
- }
- if (array_search($comment->getStartLine(), $lineNumbers) === false) {
- $this->seenCommentsInFiles[$filePath][$comment->getText()][] = $comment->getStartLine();
- }
- }
-
- if ($changedComments) {
- $node->setAttribute('comments', $newComments);
- }
- }
-
- return null;
- }
-
- private static function isDuplicate(\PhpParser\Comment $comment, array $lineNumbers)
- {
- if (count($lineNumbers) > 0 && $comment->getStartLine() === -1) {
- return true;
- }
- foreach ($lineNumbers as $lineNumber) {
- $delta = $comment->getStartLine() - $lineNumber;
- if ($delta > 0 && $delta < 4) {
- return true;
- }
- }
- return false;
- }
-
- private static function commentContains90Comment(Node $node): bool
- {
- foreach ($node->getComments() as $comment) {
- if (str_contains($comment->getText(), '// TODO 9.0')) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/src/Generic/Rules/RemoveInjectionsRector.php b/src/Generic/Rules/RemoveInjectionsRector.php
index 5aacd0c..12bb4bd 100644
--- a/src/Generic/Rules/RemoveInjectionsRector.php
+++ b/src/Generic/Rules/RemoveInjectionsRector.php
@@ -7,14 +7,16 @@
use Neos\Rector\Generic\ValueObject\RemoveInjection;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\NodeVisitor;
use PHPStan\Type\ObjectType;
-use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToRemoveCollector;
+use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
+use Rector\Contract\Rector\ConfigurableRectorInterface;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
use Webmozart\Assert\Assert;
-final class RemoveInjectionsRector extends AbstractRector implements ConfigurableRectorInterface
+final class RemoveInjectionsRector extends AbstractRector implements ConfigurableRectorInterface, DocumentedRuleInterface
{
use AllTraits;
@@ -24,7 +26,7 @@ final class RemoveInjectionsRector extends AbstractRector implements Configurabl
private array $injectionsToRemove = [];
public function __construct(
- private readonly NodesToRemoveCollector $nodesToRemoveCollector
+ protected PhpDocInfoFactory $phpDocInfoFactory,
) {
}
@@ -44,16 +46,15 @@ public function getNodeTypes(): array
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt\Property $node
*/
- public function refactor(Node $node): ?Node
+ public function refactor(Node $node)
{
assert($node instanceof Node\Stmt\Property);
foreach ($this->injectionsToRemove as $removeInjection) {
if ($this->isObjectType($node, new ObjectType($removeInjection->objectType))) {
if (self::hasFlowInjectAttribute($node->attrGroups) || $this->hasFlowInjectDocComment($node)) {
- $this->removeNode($node);
- return $node;
+ return NodeVisitor::REMOVE_NODE;
}
}
}
diff --git a/src/Generic/Rules/RemoveParentClassRector.php b/src/Generic/Rules/RemoveParentClassRector.php
index 6d5cf1c..6aaa6eb 100644
--- a/src/Generic/Rules/RemoveParentClassRector.php
+++ b/src/Generic/Rules/RemoveParentClassRector.php
@@ -4,17 +4,14 @@
namespace Neos\Rector\Generic\Rules;
-use Neos\Rector\Generic\ValueObject\RemoveInjection;
use Neos\Rector\Generic\ValueObject\RemoveParentClass;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Comment;
use PhpParser\Node;
use PHPStan\Type\ObjectType;
-use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
-use Rector\Core\Rector\AbstractRector;
-use Rector\NodeTypeResolver\NodeTypeResolver;
-use Rector\PostRector\Collector\NodesToRemoveCollector;
-use Rector\Removing\Rector\Class_\RemoveParentRector;
+use Rector\Contract\Rector\ConfigurableRectorInterface;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
use Webmozart\Assert\Assert;
@@ -22,7 +19,7 @@
* This is a re-write of {@see RemoveParentRector}, but working with non existing parent classes as well (and
* supports adding comments)
*/
-final class RemoveParentClassRector extends AbstractRector implements ConfigurableRectorInterface
+final class RemoveParentClassRector extends AbstractRector implements ConfigurableRectorInterface, DocumentedRuleInterface
{
/**
@@ -30,8 +27,8 @@ final class RemoveParentClassRector extends AbstractRector implements Configurab
*/
private array $parentClassesToRemove = [];
- public function __construct(
- ) {
+ public function __construct()
+ {
}
public function getRuleDefinition(): RuleDefinition
diff --git a/src/Generic/Rules/SignalSlotToWarningCommentRector.php b/src/Generic/Rules/SignalSlotToWarningCommentRector.php
index cd8f99e..3496a79 100644
--- a/src/Generic/Rules/SignalSlotToWarningCommentRector.php
+++ b/src/Generic/Rules/SignalSlotToWarningCommentRector.php
@@ -8,14 +8,16 @@
use Neos\Rector\Generic\ValueObject\SignalSlotToWarningComment;
use Neos\Rector\Utility\CodeSampleLoader;
use PhpParser\Node;
+use PhpParser\Node\Expr\MethodCall;
use PHPStan\Type\ObjectType;
-use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
-use Rector\Core\Rector\AbstractRector;
-use Rector\PostRector\Collector\NodesToAddCollector;
+use Rector\Contract\Rector\ConfigurableRectorInterface;
+use Rector\PhpParser\Node\BetterNodeFinder;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
use Webmozart\Assert\Assert;
-final class SignalSlotToWarningCommentRector extends AbstractRector implements ConfigurableRectorInterface
+final class SignalSlotToWarningCommentRector extends AbstractRector implements ConfigurableRectorInterface, DocumentedRuleInterface
{
use AllTraits;
@@ -25,9 +27,8 @@ final class SignalSlotToWarningCommentRector extends AbstractRector implements C
private array $signalSlotToWarningComments = [];
public function __construct(
- private readonly NodesToAddCollector $nodesToAddCollector
- )
- {
+ private BetterNodeFinder $betterNodeFinder,
+ ) {
}
public function getRuleDefinition(): RuleDefinition
@@ -42,53 +43,53 @@ public function getRuleDefinition(): RuleDefinition
*/
public function getNodeTypes(): array
{
- return [\PhpParser\Node\Expr\MethodCall::class];
+ return [Node\Stmt::class];
}
/**
- * @param \PhpParser\Node\Expr\MethodCall $node
+ * @param Node\Stmt $node
*/
public function refactor(Node $node): ?Node
{
- assert($node instanceof Node\Expr\MethodCall);
-
- if (!$this->isName($node->name, 'connect')) {
+ if (!in_array('expr', $node->getSubNodeNames())) {
return null;
}
- if (!$this->isObjectType($node->var, new ObjectType(Dispatcher::class))) {
+ $methodCall = $this->betterNodeFinder->findFirst($node, function (Node $subNode) {
+ return $subNode instanceof MethodCall
+ && $this->isObjectType($subNode->var, new ObjectType(Dispatcher::class))
+ && $this->isName($subNode->name, 'connect');
+ });
+
+ if (!$methodCall instanceof MethodCall) {
return null;
}
foreach ($this->signalSlotToWarningComments as $signalSlotToWarningComment) {
$className = null;
- if ($node->args[0]->value instanceof Node\Expr\ClassConstFetch) {
- $className = (string) $node->args[0]->value->class;
- } elseif ($node->args[0]->value instanceof Node\Scalar) {
- $className = (string)$node->args[0]->value->value;
+ if ($methodCall->args[0]->value instanceof Node\Expr\ClassConstFetch) {
+ $className = (string)$methodCall->args[0]->value->class;
+ } elseif ($methodCall->args[0]->value instanceof Node\Scalar) {
+ $className = (string)$methodCall->args[0]->value->value;
}
- if ($className !== $signalSlotToWarningComment->className){
+ if ($className !== $signalSlotToWarningComment->className) {
continue;
}
$methodName = null;
- if ($node->args[1]->value instanceof Node\Scalar\String_) {
- $methodName = (string)$node->args[1]->value->value;
+ if ($methodCall->args[1]->value instanceof Node\Scalar\String_) {
+ $methodName = (string)$methodCall->args[1]->value->value;
}
if ($methodName !== $signalSlotToWarningComment->signalName) {
continue;
}
- $this->nodesToAddCollector->addNodesBeforeNode(
- [
- self::todoComment($signalSlotToWarningComment->warningMessage)
- ],
+ return self::withTodoComment(
+ $signalSlotToWarningComment->warningMessage,
$node
);
-
- return $node;
}
return null;
}
@@ -97,7 +98,7 @@ public function refactor(Node $node): ?Node
/**
* @param mixed[] $configuration
*/
- public function configure(array $configuration) : void
+ public function configure(array $configuration): void
{
Assert::allIsAOf($configuration, SignalSlotToWarningComment::class);
$this->signalSlotToWarningComments = $configuration;
diff --git a/src/Generic/Rules/ToStringToMethodCallOrPropertyFetchRector.php b/src/Generic/Rules/ToStringToMethodCallOrPropertyFetchRector.php
index 07c4988..4441151 100644
--- a/src/Generic/Rules/ToStringToMethodCallOrPropertyFetchRector.php
+++ b/src/Generic/Rules/ToStringToMethodCallOrPropertyFetchRector.php
@@ -12,20 +12,21 @@
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Identifier;
use PHPStan\Type\ObjectType;
-use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
-use Rector\Core\Rector\AbstractRector;
+use Rector\Contract\Rector\ConfigurableRectorInterface;
+use Rector\Rector\AbstractRector;
+use Symplify\RuleDocGenerator\Contract\DocumentedRuleInterface;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
use Webmozart\Assert\Assert;
-final class ToStringToMethodCallOrPropertyFetchRector extends AbstractRector implements ConfigurableRectorInterface
+final class ToStringToMethodCallOrPropertyFetchRector extends AbstractRector implements ConfigurableRectorInterface, DocumentedRuleInterface
{
/**
* @var array
*/
private array $methodAndPropertyNamesByType = [];
- public function getRuleDefinition() : RuleDefinition
+ public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition('Turns defined code uses of "__toString()" method to specific method calls or property fetches.', [new ConfiguredCodeSample(<<<'CODE_SAMPLE'
$someValue = new SomeObject;
@@ -43,7 +44,7 @@ public function getRuleDefinition() : RuleDefinition
/**
* @return array>
*/
- public function getNodeTypes() : array
+ public function getNodeTypes(): array
{
return [String_::class, MethodCall::class, Concat::class, FuncCall::class];
}
@@ -51,7 +52,7 @@ public function getNodeTypes() : array
/**
* @param String_|MethodCall|Concat $node
*/
- public function refactor(Node $node) : ?Node
+ public function refactor(Node $node): ?Node
{
if ($node instanceof String_) {
return $this->processStringNode($node);
@@ -68,7 +69,7 @@ public function refactor(Node $node) : ?Node
/**
* @param mixed[] $configuration
*/
- public function configure(array $configuration) : void
+ public function configure(array $configuration): void
{
Assert::allString(\array_keys($configuration));
Assert::allString($configuration);
@@ -76,7 +77,7 @@ public function configure(array $configuration) : void
$this->methodAndPropertyNamesByType = $configuration;
}
- private function processStringNode(String_ $string) : ?Node
+ private function processStringNode(String_ $string): ?Node
{
foreach ($this->methodAndPropertyNamesByType as $type => $methodOrPropertyName) {
if (!$this->isObjectType($string->expr, new ObjectType($type))) {
@@ -87,7 +88,7 @@ private function processStringNode(String_ $string) : ?Node
return null;
}
- private function processConcatNode(Concat $concat) : ?Node
+ private function processConcatNode(Concat $concat): ?Node
{
foreach ($this->methodAndPropertyNamesByType as $type => $methodOrPropertyName) {
if ($this->isObjectType($concat->left, new ObjectType($type))) {
@@ -100,7 +101,7 @@ private function processConcatNode(Concat $concat) : ?Node
return $concat;
}
- private function processFuncCallNode(FuncCall $funcCall) : ?Node
+ private function processFuncCallNode(FuncCall $funcCall): ?Node
{
if (!$this->isName($funcCall, 'sprintf')) {
return null;
@@ -118,7 +119,7 @@ private function processFuncCallNode(FuncCall $funcCall) : ?Node
return $funcCall;
}
- private function processMethodCall(MethodCall $methodCall) : ?Node
+ private function processMethodCall(MethodCall $methodCall): ?Node
{
foreach ($this->methodAndPropertyNamesByType as $type => $methodOrPropertyName) {
if (!$this->isObjectType($methodCall->var, new ObjectType($type))) {
diff --git a/src/Generic/Rules/Traits/FunctionsTrait.php b/src/Generic/Rules/Traits/FunctionsTrait.php
index 8ca0e0c..522b068 100644
--- a/src/Generic/Rules/Traits/FunctionsTrait.php
+++ b/src/Generic/Rules/Traits/FunctionsTrait.php
@@ -8,14 +8,11 @@
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Stmt\Expression;
-use PhpParser\Node\Stmt\Nop;
+use Rector\PhpParser\Node\NodeFactory;
trait FunctionsTrait
{
- /**
- * @var \Rector\Core\PhpParser\Node\NodeFactory
- */
- protected $nodeFactory;
+ protected NodeFactory $nodeFactory;
private function iteratorToArray(Expr $inner): Expr
{
@@ -39,25 +36,25 @@ private static function assign(string $variableName, Expr $value): Expression
);
}
- private static function todoComment(string $commentText): Nop
+ private static function todoComment(string $commentText): Comment
{
- return new Nop([
- 'comments' => [
- new Comment('// TODO 9.0 migration: ' . $commentText)
- ]
- ]);
+ return new Comment('// TODO 9.0 migration: ' . $commentText);
}
- private static function withTodoComment(string $commentText, \PhpParser\NodeAbstract $attachmentNode): \PhpParser\Node
+ private static function withTodoComment(string $commentText, \PhpParser\Node $attachmentNode): \PhpParser\Node
{
- $attachmentNode->setAttribute('comments', [
- new Comment('// TODO 9.0 migration: ' . $commentText)
- ]);
- return $attachmentNode;
- }
+ $newText = '// TODO 9.0 migration: ' . $commentText;
- private static function todoCommentAttribute(string $commentText): Comment
- {
- return new Comment('// TODO 9.0 migration: ' . $commentText);
+ $comments = $attachmentNode->getAttribute('comments') ?? [];
+
+ foreach ($comments as $comment) {
+ if ($comment instanceof Comment && $comment->getText() === $newText) {
+ return $attachmentNode;
+ }
+ }
+
+ $comments[] = new Comment($newText);
+ $attachmentNode->setAttribute('comments', $comments);
+ return $attachmentNode;
}
}
diff --git a/src/Generic/ValueObject/FusionFlowQueryNodePropertyToWarningComment.php b/src/Generic/ValueObject/FusionFlowQueryNodePropertyToWarningComment.php
index 00cf664..28b425b 100644
--- a/src/Generic/ValueObject/FusionFlowQueryNodePropertyToWarningComment.php
+++ b/src/Generic/ValueObject/FusionFlowQueryNodePropertyToWarningComment.php
@@ -9,8 +9,7 @@ class FusionFlowQueryNodePropertyToWarningComment
public function __construct(
public readonly string $property,
public readonly string $warningMessage,
- )
- {
+ ) {
}
diff --git a/src/Generic/ValueObject/FusionNodePropertyPathToWarningComment.php b/src/Generic/ValueObject/FusionNodePropertyPathToWarningComment.php
index 124e7c3..67e30e0 100644
--- a/src/Generic/ValueObject/FusionNodePropertyPathToWarningComment.php
+++ b/src/Generic/ValueObject/FusionNodePropertyPathToWarningComment.php
@@ -9,7 +9,6 @@ class FusionNodePropertyPathToWarningComment
public function __construct(
public readonly string $propertyPath,
public readonly string $warningMessage,
- )
- {
+ ) {
}
}
diff --git a/src/Generic/ValueObject/MethodCallToPropertyFetch.php b/src/Generic/ValueObject/MethodCallToPropertyFetch.php
new file mode 100644
index 0000000..a30be6a
--- /dev/null
+++ b/src/Generic/ValueObject/MethodCallToPropertyFetch.php
@@ -0,0 +1,49 @@
+oldType = $oldType;
+ $this->oldMethod = $oldMethod;
+ $this->newProperty = $newProperty;
+ RectorAssert::className($oldType);
+ RectorAssert::methodName($oldMethod);
+ RectorAssert::propertyName($newProperty);
+ }
+
+ public function getOldObjectType(): ObjectType
+ {
+ return new ObjectType($this->oldType);
+ }
+
+ public function getNewProperty(): string
+ {
+ return $this->newProperty;
+ }
+
+ public function getOldMethod(): string
+ {
+ return $this->oldMethod;
+ }
+}
diff --git a/src/Generic/ValueObject/MethodCallToWarningComment.php b/src/Generic/ValueObject/MethodCallToWarningComment.php
index ee1e7e0..8544051 100644
--- a/src/Generic/ValueObject/MethodCallToWarningComment.php
+++ b/src/Generic/ValueObject/MethodCallToWarningComment.php
@@ -9,7 +9,6 @@ public function __construct(
public readonly string $objectType,
public readonly string $methodName,
public readonly string $warningMessage,
- )
- {
+ ) {
}
}
diff --git a/src/Generic/ValueObject/RemoveInjection.php b/src/Generic/ValueObject/RemoveInjection.php
index 35b61e3..5702d85 100644
--- a/src/Generic/ValueObject/RemoveInjection.php
+++ b/src/Generic/ValueObject/RemoveInjection.php
@@ -7,7 +7,6 @@ class RemoveInjection
{
public function __construct(
public readonly string $objectType,
- )
- {
+ ) {
}
}
diff --git a/src/Generic/ValueObject/RemoveParentClass.php b/src/Generic/ValueObject/RemoveParentClass.php
index 1383a61..16285b4 100644
--- a/src/Generic/ValueObject/RemoveParentClass.php
+++ b/src/Generic/ValueObject/RemoveParentClass.php
@@ -8,7 +8,6 @@ class RemoveParentClass
public function __construct(
public readonly string $parentClassName,
public readonly string $comment,
- )
- {
+ ) {
}
}
diff --git a/src/Generic/ValueObject/SignalSlotToWarningComment.php b/src/Generic/ValueObject/SignalSlotToWarningComment.php
index 26ef73c..1f63dfd 100644
--- a/src/Generic/ValueObject/SignalSlotToWarningComment.php
+++ b/src/Generic/ValueObject/SignalSlotToWarningComment.php
@@ -9,7 +9,6 @@ public function __construct(
public readonly string $className,
public readonly string $signalName,
public readonly string $warningMessage,
- )
- {
+ ) {
}
}
diff --git a/src/NeosRectorSets.php b/src/NeosRectorSets.php
index e109d2e..7d8d066 100644
--- a/src/NeosRectorSets.php
+++ b/src/NeosRectorSets.php
@@ -3,12 +3,9 @@
namespace Neos\Rector;
-use Rector\Set\Contract\SetListInterface;
-
-class NeosRectorSets implements SetListInterface
+class NeosRectorSets
{
public const CONTENTREPOSITORY_9_0 = __DIR__ . '/../config/set/contentrepository-90.php';
- public const NEOS_8_4 = __DIR__ . '/../config/set/neos-84.php';
public const ANNOTATIONS_TO_ATTRIBUTES = __DIR__ . '/../config/set/flow-annotations-to-attributes.php';
}
diff --git a/src/Utility/CodeSampleLoader.php b/src/Utility/CodeSampleLoader.php
index 4e4cc94..5cbb47f 100644
--- a/src/Utility/CodeSampleLoader.php
+++ b/src/Utility/CodeSampleLoader.php
@@ -27,7 +27,7 @@ static function fromFile(string $description, string $rectorClassName, array $co
}
$files = glob($folderName . '*.inc');
$file = reset($files);
- list($beforeCode, $afterCode) = explode('-----', file_get_contents($file));
+ [$beforeCode, $afterCode] = explode('-----', file_get_contents($file));
if (!empty($codeSampleConfiguration)) {
$codeSample = new ConfiguredCodeSample(trim($beforeCode), trim($afterCode), $codeSampleConfiguration);
} else {
diff --git a/tests/ContentRepository90/Rules/ContentDimensionCombinatorGetAllAllowedCombinationsRector/ContentDimensionCombinatorGetAllAllowedCombinationsRectorTest.php b/tests/ContentRepository90/Rules/ContentDimensionCombinatorGetAllAllowedCombinationsRector/ContentDimensionCombinatorGetAllAllowedCombinationsRectorTest.php
new file mode 100644
index 0000000..f9c19f6
--- /dev/null
+++ b/tests/ContentRepository90/Rules/ContentDimensionCombinatorGetAllAllowedCombinationsRector/ContentDimensionCombinatorGetAllAllowedCombinationsRectorTest.php
@@ -0,0 +1,30 @@
+doTestFile($fileInfo);
+ }
+
+ /**
+ * @return \Iterator
+ */
+ public static function provideData(): \Iterator
+ {
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ }
+
+ public function provideConfigFilePath(): string
+ {
+ return __DIR__ . '/config/configured_rule.php';
+ }
+}
diff --git a/tests/ContentRepository90/Rules/ContentDimensionCombinatorGetAllAllowedCombinationsRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/ContentDimensionCombinatorGetAllAllowedCombinationsRector/Fixture/some_class.php.inc
index c102695..f0f48c8 100644
--- a/tests/ContentRepository90/Rules/ContentDimensionCombinatorGetAllAllowedCombinationsRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/ContentDimensionCombinatorGetAllAllowedCombinationsRector/Fixture/some_class.php.inc
@@ -35,7 +35,6 @@ class SomeClass
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$dimensionSpacePoints = $contentRepository->getVariationGraph()->getDimensionSpacePoints();
// TODO 9.0 migration: try to directly work with $dimensionSpacePoints, instead of converting them to the legacy dimension format
-
$combinations = array_map(fn(\Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint $dimensionSpacePoint) => $dimensionSpacePoint->toLegacyDimensionArray(), iterator_to_array($dimensionSpacePoints));
foreach ($combinations as $combination) {
}
diff --git a/tests/ContentRepository90/Rules/ContentDimensionCombinatorGetAllAllowedCombinationsRector/config/configured_rule.php b/tests/ContentRepository90/Rules/ContentDimensionCombinatorGetAllAllowedCombinationsRector/config/configured_rule.php
index 3580822..29658ef 100644
--- a/tests/ContentRepository90/Rules/ContentDimensionCombinatorGetAllAllowedCombinationsRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/ContentDimensionCombinatorGetAllAllowedCombinationsRector/config/configured_rule.php
@@ -4,7 +4,6 @@
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(\Neos\Rector\ContentRepository90\Rules\ContentDimensionCombinatorGetAllAllowedCombinationsRector::class);
- $rectorConfig->rule(\Neos\Rector\Generic\Rules\RemoveDuplicateCommentRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([\Neos\Rector\ContentRepository90\Rules\ContentDimensionCombinatorGetAllAllowedCombinationsRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/ContentRepositoryUtilityRenderValidNodeNameRector/ContentRepositoryUtilityRenderValidNodeNameTest.php b/tests/ContentRepository90/Rules/ContentRepositoryUtilityRenderValidNodeNameRector/ContentRepositoryUtilityRenderValidNodeNameTest.php
index 6fd3052..7b7cf41 100644
--- a/tests/ContentRepository90/Rules/ContentRepositoryUtilityRenderValidNodeNameRector/ContentRepositoryUtilityRenderValidNodeNameTest.php
+++ b/tests/ContentRepository90/Rules/ContentRepositoryUtilityRenderValidNodeNameRector/ContentRepositoryUtilityRenderValidNodeNameTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\ContextGetFirstLevelNodeCacheRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\ContentRepositoryUtilityRenderValidNodeNameRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class ContentRepositoryUtilityRenderValidNodeNameTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/ContentRepositoryUtilityRenderValidNodeNameRector/config/configured_rule.php b/tests/ContentRepository90/Rules/ContentRepositoryUtilityRenderValidNodeNameRector/config/configured_rule.php
index 1a3c7b9..abc51c6 100644
--- a/tests/ContentRepository90/Rules/ContentRepositoryUtilityRenderValidNodeNameRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/ContentRepositoryUtilityRenderValidNodeNameRector/config/configured_rule.php
@@ -3,10 +3,7 @@
declare (strict_types=1);
use Rector\Config\RectorConfig;
-use Neos\Rector\Generic\Rules\InjectServiceIfNeededRector;
-use Neos\Rector\Generic\ValueObject\AddInjection;
-use Neos\Neos\Domain\Service\RenderingModeService;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(\Neos\Rector\ContentRepository90\Rules\ContentRepositoryUtilityRenderValidNodeNameRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([\Neos\Rector\ContentRepository90\Rules\ContentRepositoryUtilityRenderValidNodeNameRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/ContextGetCurrentRenderingModeRectorTest.php b/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/ContextGetCurrentRenderingModeRectorTest.php
index c0ff104..21e17ba 100644
--- a/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/ContextGetCurrentRenderingModeRectorTest.php
+++ b/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/ContextGetCurrentRenderingModeRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\ContextGetFirstLevelNodeCacheRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\ContextGetCurrentRenderingModeRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class ContextGetCurrentRenderingModeRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/Fixture/some_class2.php.inc b/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/Fixture/some_class2.php.inc
index fed3457..e0de0d9 100644
--- a/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/Fixture/some_class2.php.inc
+++ b/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/Fixture/some_class2.php.inc
@@ -2,7 +2,7 @@
class SomeClass
{
- public function run(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub $node)
+ public function run(\Neos\ContentRepository\Domain\Model\Node $node)
{
$context = $node->getContext();
$renderingMode = $context->getCurrentRenderingMode();
@@ -17,7 +17,7 @@ class SomeClass
{
#[\Neos\Flow\Annotations\Inject]
protected \Neos\Neos\Domain\Service\RenderingModeService $renderingModeService;
- public function run(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub $node)
+ public function run(\Neos\ContentRepository\Domain\Model\Node $node)
{
$context = $node->getContext();
$renderingMode = $this->renderingModeService->findByCurrentUser();
diff --git a/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/Fixture/some_class3.php.inc b/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/Fixture/some_class3.php.inc
index 49e6c99..b346c5e 100644
--- a/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/Fixture/some_class3.php.inc
+++ b/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/Fixture/some_class3.php.inc
@@ -2,7 +2,7 @@
class SomeClass
{
- public function run(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub $node)
+ public function run(\Neos\ContentRepository\Domain\Model\Node $node)
{
$renderingMode = $node->getContext()->getCurrentRenderingMode();
}
@@ -16,7 +16,7 @@ class SomeClass
{
#[\Neos\Flow\Annotations\Inject]
protected \Neos\Neos\Domain\Service\RenderingModeService $renderingModeService;
- public function run(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub $node)
+ public function run(\Neos\ContentRepository\Domain\Model\Node $node)
{
$renderingMode = $this->renderingModeService->findByCurrentUser();
}
diff --git a/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/config/configured_rule.php b/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/config/configured_rule.php
index df0a952..df6d957 100644
--- a/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/ContextGetCurrentRenderingModeRector/config/configured_rule.php
@@ -2,15 +2,15 @@
declare (strict_types=1);
-use Rector\Config\RectorConfig;
+use Neos\Neos\Domain\Service\RenderingModeService;
use Neos\Rector\Generic\Rules\InjectServiceIfNeededRector;
use Neos\Rector\Generic\ValueObject\AddInjection;
-use Neos\Neos\Domain\Service\RenderingModeService;
+use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(\Neos\Rector\ContentRepository90\Rules\ContextGetCurrentRenderingModeRector::class);
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([\Neos\Rector\ContentRepository90\Rules\ContextGetCurrentRenderingModeRector::class]);
- $rectorConfig->ruleWithConfiguration(InjectServiceIfNeededRector::class, [
- new AddInjection('renderingModeService', RenderingModeService::class)
- ]);
-};
+$rectorConfig->withConfiguredRule(InjectServiceIfNeededRector::class, [
+ new AddInjection('renderingModeService', RenderingModeService::class)
+]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/ContextGetFirstLevelNodeCacheRector/ContextGetFirstLevelNodeCacheRectorTest.php b/tests/ContentRepository90/Rules/ContextGetFirstLevelNodeCacheRector/ContextGetFirstLevelNodeCacheRectorTest.php
index 23a7cce..4fd0d2d 100644
--- a/tests/ContentRepository90/Rules/ContextGetFirstLevelNodeCacheRector/ContextGetFirstLevelNodeCacheRectorTest.php
+++ b/tests/ContentRepository90/Rules/ContextGetFirstLevelNodeCacheRector/ContextGetFirstLevelNodeCacheRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\ContentRepository90\Rules\ContextGetFirstLevelNodeCacheRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class ContextGetFirstLevelNodeCacheRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/ContextGetFirstLevelNodeCacheRector/config/configured_rule.php b/tests/ContentRepository90/Rules/ContextGetFirstLevelNodeCacheRector/config/configured_rule.php
index 9249ccf..f982078 100644
--- a/tests/ContentRepository90/Rules/ContextGetFirstLevelNodeCacheRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/ContextGetFirstLevelNodeCacheRector/config/configured_rule.php
@@ -4,6 +4,6 @@
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(\Neos\Rector\ContentRepository90\Rules\ContextGetFirstLevelNodeCacheRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([\Neos\Rector\ContentRepository90\Rules\ContextGetFirstLevelNodeCacheRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/ContextIsInBackendRector/ContextIsInBackendTest.php b/tests/ContentRepository90/Rules/ContextIsInBackendRector/ContextIsInBackendTest.php
index ae1386c..a1de2a5 100644
--- a/tests/ContentRepository90/Rules/ContextIsInBackendRector/ContextIsInBackendTest.php
+++ b/tests/ContentRepository90/Rules/ContextIsInBackendRector/ContextIsInBackendTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\ContextGetFirstLevelNodeCacheRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\ContextIsInBackendRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class ContextIsInBackendTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/ContextIsInBackendRector/Fixture/some_class2.php.inc b/tests/ContentRepository90/Rules/ContextIsInBackendRector/Fixture/some_class2.php.inc
index eaad4d4..561f46c 100644
--- a/tests/ContentRepository90/Rules/ContextIsInBackendRector/Fixture/some_class2.php.inc
+++ b/tests/ContentRepository90/Rules/ContextIsInBackendRector/Fixture/some_class2.php.inc
@@ -2,7 +2,7 @@
class SomeClass
{
- public function run(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub $node)
+ public function run(\Neos\ContentRepository\Domain\Model\Node $node)
{
$context = $node->getContext();
$isInBackend = $context->isInBackend();
@@ -17,7 +17,7 @@ class SomeClass
{
#[\Neos\Flow\Annotations\Inject]
protected \Neos\Neos\Domain\Service\RenderingModeService $renderingModeService;
- public function run(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub $node)
+ public function run(\Neos\ContentRepository\Domain\Model\Node $node)
{
$context = $node->getContext();
$isInBackend = $this->renderingModeService->findByCurrentUser()->isEdit;
diff --git a/tests/ContentRepository90/Rules/ContextIsInBackendRector/Fixture/some_class3.php.inc b/tests/ContentRepository90/Rules/ContextIsInBackendRector/Fixture/some_class3.php.inc
index 24ac5a9..596704f 100644
--- a/tests/ContentRepository90/Rules/ContextIsInBackendRector/Fixture/some_class3.php.inc
+++ b/tests/ContentRepository90/Rules/ContextIsInBackendRector/Fixture/some_class3.php.inc
@@ -4,7 +4,7 @@ use Neos\ContentRepository\Domain\Model\NodeInterface;
class SomeClass
{
- public function run(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub $node)
+ public function run(NodeInterface $node)
{
if ($node->getContext()->isInBackend() && $foo == 'bar') {
return true;
@@ -22,7 +22,7 @@ class SomeClass
{
#[\Neos\Flow\Annotations\Inject]
protected \Neos\Neos\Domain\Service\RenderingModeService $renderingModeService;
- public function run(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub $node)
+ public function run(NodeInterface $node)
{
if ($this->renderingModeService->findByCurrentUser()->isEdit && $foo == 'bar') {
return true;
diff --git a/tests/ContentRepository90/Rules/ContextIsInBackendRector/config/configured_rule.php b/tests/ContentRepository90/Rules/ContextIsInBackendRector/config/configured_rule.php
index 56732dc..9737c9b 100644
--- a/tests/ContentRepository90/Rules/ContextIsInBackendRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/ContextIsInBackendRector/config/configured_rule.php
@@ -2,15 +2,15 @@
declare (strict_types=1);
-use Rector\Config\RectorConfig;
+use Neos\Neos\Domain\Service\RenderingModeService;
use Neos\Rector\Generic\Rules\InjectServiceIfNeededRector;
use Neos\Rector\Generic\ValueObject\AddInjection;
-use Neos\Neos\Domain\Service\RenderingModeService;
+use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(\Neos\Rector\ContentRepository90\Rules\ContextIsInBackendRector::class);
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([\Neos\Rector\ContentRepository90\Rules\ContextIsInBackendRector::class]);
- $rectorConfig->ruleWithConfiguration(InjectServiceIfNeededRector::class, [
- new AddInjection('renderingModeService', RenderingModeService::class)
- ]);
-};
+$rectorConfig->withConfiguredRule(InjectServiceIfNeededRector::class, [
+ new AddInjection('renderingModeService', RenderingModeService::class)
+]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/ContextIsLiveRector/ContextIsLiveTest.php b/tests/ContentRepository90/Rules/ContextIsLiveRector/ContextIsLiveTest.php
index 8b3bbbe..d68cfd4 100644
--- a/tests/ContentRepository90/Rules/ContextIsLiveRector/ContextIsLiveTest.php
+++ b/tests/ContentRepository90/Rules/ContextIsLiveRector/ContextIsLiveTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\ContextGetFirstLevelNodeCacheRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\ContextIsLiveRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class ContextIsLiveTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/ContextIsLiveRector/Fixture/some_class2.php.inc b/tests/ContentRepository90/Rules/ContextIsLiveRector/Fixture/some_class2.php.inc
index bb23761..91cf85d 100644
--- a/tests/ContentRepository90/Rules/ContextIsLiveRector/Fixture/some_class2.php.inc
+++ b/tests/ContentRepository90/Rules/ContextIsLiveRector/Fixture/some_class2.php.inc
@@ -2,7 +2,7 @@
class SomeClass
{
- public function run(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub $node)
+ public function run(\Neos\ContentRepository\Domain\Model\Node $node)
{
$context = $node->getContext();
$isLive = $context->isLive();
@@ -17,7 +17,7 @@ class SomeClass
{
#[\Neos\Flow\Annotations\Inject]
protected \Neos\Neos\Domain\Service\RenderingModeService $renderingModeService;
- public function run(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub $node)
+ public function run(\Neos\ContentRepository\Domain\Model\Node $node)
{
$context = $node->getContext();
$isLive = !$this->renderingModeService->findByCurrentUser()->isEdit && !$this->renderingModeService->findByCurrentUser()->isPreview;
diff --git a/tests/ContentRepository90/Rules/ContextIsLiveRector/Fixture/some_class3.php.inc b/tests/ContentRepository90/Rules/ContextIsLiveRector/Fixture/some_class3.php.inc
index ac78aee..70f9db1 100644
--- a/tests/ContentRepository90/Rules/ContextIsLiveRector/Fixture/some_class3.php.inc
+++ b/tests/ContentRepository90/Rules/ContextIsLiveRector/Fixture/some_class3.php.inc
@@ -4,7 +4,7 @@ use Neos\ContentRepository\Domain\Model\NodeInterface;
class SomeClass
{
- public function run(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub $node)
+ public function run(\Neos\ContentRepository\Domain\Model\Node $node)
{
if ($node->getContext()->isLive() && $foo == 'bar') {
return true;
@@ -22,7 +22,7 @@ class SomeClass
{
#[\Neos\Flow\Annotations\Inject]
protected \Neos\Neos\Domain\Service\RenderingModeService $renderingModeService;
- public function run(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub $node)
+ public function run(\Neos\ContentRepository\Domain\Model\Node $node)
{
if (!$this->renderingModeService->findByCurrentUser()->isEdit && !$this->renderingModeService->findByCurrentUser()->isPreview && $foo == 'bar') {
return true;
diff --git a/tests/ContentRepository90/Rules/ContextIsLiveRector/config/configured_rule.php b/tests/ContentRepository90/Rules/ContextIsLiveRector/config/configured_rule.php
index c04481b..7d4ccfb 100644
--- a/tests/ContentRepository90/Rules/ContextIsLiveRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/ContextIsLiveRector/config/configured_rule.php
@@ -2,15 +2,15 @@
declare (strict_types=1);
-use Rector\Config\RectorConfig;
+use Neos\Neos\Domain\Service\RenderingModeService;
use Neos\Rector\Generic\Rules\InjectServiceIfNeededRector;
use Neos\Rector\Generic\ValueObject\AddInjection;
-use Neos\Neos\Domain\Service\RenderingModeService;
+use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(\Neos\Rector\ContentRepository90\Rules\ContextIsLiveRector::class);
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([\Neos\Rector\ContentRepository90\Rules\ContextIsLiveRector::class]);
- $rectorConfig->ruleWithConfiguration(InjectServiceIfNeededRector::class, [
- new AddInjection('renderingModeService', RenderingModeService::class)
- ]);
-};
+$rectorConfig->withConfiguredRule(InjectServiceIfNeededRector::class, [
+ new AddInjection('renderingModeService', RenderingModeService::class)
+]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/FusionCacheLifetimeRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionCacheLifetimeRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index 8bb4a8e..0000000
--- a/tests/ContentRepository90/Rules/FusionCacheLifetimeRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,17 +0,0 @@
-prototype(My.Namespace:Value) < prototype(Neos.Fusion:Value) {
-
- lifetime = ${q(node).cacheLifetime()}
-
- @cache.maximumLifetime = ${q(node).context({'invisibleContentShown': true}).find('[instanceof Neos.Neos:Content]').cacheLifetime()}
-
-}
------
-// TODO 9.0 migration: Line 5: You may need to remove ".cacheLifetime()" as this FlowQuery Operation has been removed. This is not needed anymore as the concept of timeable node visibility has changed. See https://github.com/neos/timeable-node-visibility
-// TODO 9.0 migration: Line 7: You may need to remove ".cacheLifetime()" as this FlowQuery Operation has been removed. This is not needed anymore as the concept of timeable node visibility has changed. See https://github.com/neos/timeable-node-visibility
-prototype(My.Namespace:Value) < prototype(Neos.Fusion:Value) {
-
- lifetime = ${q(node).cacheLifetime()}
-
- @cache.maximumLifetime = ${q(node).context({'invisibleContentShown': true}).find('[instanceof Neos.Neos:Content]').cacheLifetime()}
-
-}
\ No newline at end of file
diff --git a/tests/ContentRepository90/Rules/FusionCacheLifetimeRector/FusionCacheLifetimeRectorTest.php b/tests/ContentRepository90/Rules/FusionCacheLifetimeRector/FusionCacheLifetimeRectorTest.php
deleted file mode 100644
index a601e2c..0000000
--- a/tests/ContentRepository90/Rules/FusionCacheLifetimeRector/FusionCacheLifetimeRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionCacheLifetimeRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionCacheLifetimeRector/config/configured_rule.php
deleted file mode 100644
index ecdd240..0000000
--- a/tests/ContentRepository90/Rules/FusionCacheLifetimeRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionCacheLifetimeRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index 65cb70d..0000000
--- a/tests/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,31 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
- @cache {
- entryIdentifier {
- foo = ${node}
- }
- }
- @cache.entryIdentifier.foo2 = ${documentNode}
- @cache {
- entryIdentifier.foo3 = ${site}
- entryIdentifier.foo4 = ${someOtherObject}
- }
- }
-}
------
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
- @cache {
- entryIdentifier {
- foo = ${Neos.Caching.entryIdentifierForNode(node)}
- }
- }
- @cache.entryIdentifier.foo2 = ${Neos.Caching.entryIdentifierForNode(documentNode)}
- @cache {
- entryIdentifier.foo3 = ${Neos.Caching.entryIdentifierForNode(site)}
- entryIdentifier.foo4 = ${someOtherObject}
- }
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector/Fixture/some_file2.fusion.inc b/tests/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector/Fixture/some_file2.fusion.inc
deleted file mode 100644
index bccc7a1..0000000
--- a/tests/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector/Fixture/some_file2.fusion.inc
+++ /dev/null
@@ -1,31 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
- @cache {
- entryIdentifier {
- foo = ${Neos.Caching.entryIdentifierForNode(node)}
- }
- }
- @cache.entryIdentifier.foo2 = ${Neos.Caching.entryIdentifierForNode(documentNode)}
- @cache {
- entryIdentifier.foo3 = ${Neos.Caching.entryIdentifierForNode(site)}
- entryIdentifier.foo4 = ${someOtherObject}
- }
- }
-}
------
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
- @cache {
- entryIdentifier {
- foo = ${Neos.Caching.entryIdentifierForNode(node)}
- }
- }
- @cache.entryIdentifier.foo2 = ${Neos.Caching.entryIdentifierForNode(documentNode)}
- @cache {
- entryIdentifier.foo3 = ${Neos.Caching.entryIdentifierForNode(site)}
- entryIdentifier.foo4 = ${someOtherObject}
- }
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector/FusionCachingNodeInEntryIdentifierRectorTest.php b/tests/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector/FusionCachingNodeInEntryIdentifierRectorTest.php
deleted file mode 100644
index a6d462a..0000000
--- a/tests/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector/FusionCachingNodeInEntryIdentifierRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector/config/configured_rule.php
deleted file mode 100644
index cb077c7..0000000
--- a/tests/ContentRepository90/Rules/FusionCachingNodeInEntryIdentifierRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionCachingNodeInEntryIdentifierRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionContextCurrentRenderingModeRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionContextCurrentRenderingModeRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index 8dcd68e..0000000
--- a/tests/ContentRepository90/Rules/FusionContextCurrentRenderingModeRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,42 +0,0 @@
-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']}
- 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`
-
- `
- }
-}
------
-// 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 = ${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`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionContextCurrentRenderingModeRector/FusionContextCurrentRenderingModeRectorTest.php b/tests/ContentRepository90/Rules/FusionContextCurrentRenderingModeRector/FusionContextCurrentRenderingModeRectorTest.php
deleted file mode 100644
index 8fc413a..0000000
--- a/tests/ContentRepository90/Rules/FusionContextCurrentRenderingModeRector/FusionContextCurrentRenderingModeRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionContextCurrentRenderingModeRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionContextCurrentRenderingModeRector/config/configured_rule.php
deleted file mode 100644
index c24ab5e..0000000
--- a/tests/ContentRepository90/Rules/FusionContextCurrentRenderingModeRector/config/configured_rule.php
+++ /dev/null
@@ -1,17 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(\Neos\Rector\Core\FusionProcessing\FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionContextCurrentRenderingModeRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionContextCurrentSiteRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionContextCurrentSiteRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index 3df767f..0000000
--- a/tests/ContentRepository90/Rules/FusionContextCurrentSiteRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,27 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
- renderer = Neos.Fusion:Component {
- attributes = ${node.context.currentSite.siteResourcesPackageKey || site.context.currentSite.siteResourcesPackageKey || documentNode.context.currentSite.siteResourcesPackageKey}
- renderer = afx`
-
- `
- somethingDifferent = ${node.context.currentSiteNode}
- }
-}
------
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
- renderer = Neos.Fusion:Component {
- attributes = ${Neos.Site.findBySiteNode(site).siteResourcesPackageKey || Neos.Site.findBySiteNode(site).siteResourcesPackageKey || Neos.Site.findBySiteNode(site).siteResourcesPackageKey}
- renderer = afx`
-
- `
- somethingDifferent = ${node.context.currentSiteNode}
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionContextCurrentSiteRector/FusionContextCurrentSiteRectorTest.php b/tests/ContentRepository90/Rules/FusionContextCurrentSiteRector/FusionContextCurrentSiteRectorTest.php
deleted file mode 100644
index 3d59d75..0000000
--- a/tests/ContentRepository90/Rules/FusionContextCurrentSiteRector/FusionContextCurrentSiteRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionContextCurrentSiteRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionContextCurrentSiteRector/config/configured_rule.php
deleted file mode 100644
index 2e2243d..0000000
--- a/tests/ContentRepository90/Rules/FusionContextCurrentSiteRector/config/configured_rule.php
+++ /dev/null
@@ -1,17 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(\Neos\Rector\Core\FusionProcessing\FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionContextCurrentSiteRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionContextGetWorkspaceNameRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionContextGetWorkspaceNameRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index f78762a..0000000
--- a/tests/ContentRepository90/Rules/FusionContextGetWorkspaceNameRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,34 +0,0 @@
-prototype(Neos.Context:Prototype) < prototype(Neos.Fusion:Component) {
-
- workspaceName = ${node.context.workspaceName}
- workspaceNameByWorkspace = ${node.context.workspace.name}
-
- attributes = ${node.context.workspaceName || site.context.workspaceName || documentNode.context.workspaceName}
-
-
- renderer = afx`
-
- `
-}
------
-// TODO 9.0 migration: Line 14: You very likely need to rewrite "VARIABLE.context.workspaceName" to "VARIABLE.workspaceName". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.
-prototype(Neos.Context:Prototype) < prototype(Neos.Fusion:Component) {
-
- workspaceName = ${node.workspaceName}
- workspaceNameByWorkspace = ${node.workspaceName}
-
- attributes = ${node.workspaceName || site.workspaceName || documentNode.workspaceName}
-
-
- renderer = afx`
-
- `
-}
diff --git a/tests/ContentRepository90/Rules/FusionContextGetWorkspaceNameRector/FusionContextGetWorkspaceNameRectorTest.php b/tests/ContentRepository90/Rules/FusionContextGetWorkspaceNameRector/FusionContextGetWorkspaceNameRectorTest.php
deleted file mode 100644
index 3722422..0000000
--- a/tests/ContentRepository90/Rules/FusionContextGetWorkspaceNameRector/FusionContextGetWorkspaceNameRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionContextGetWorkspaceNameRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionContextGetWorkspaceNameRector/config/configured_rule.php
deleted file mode 100644
index 95cfe63..0000000
--- a/tests/ContentRepository90/Rules/FusionContextGetWorkspaceNameRector/config/configured_rule.php
+++ /dev/null
@@ -1,18 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(\Neos\Rector\Core\FusionProcessing\FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionContextGetWorkspaceNameRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionContextGetWorkspaceRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionContextGetWorkspaceRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index 95f26f0..0000000
--- a/tests/ContentRepository90/Rules/FusionContextGetWorkspaceRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,40 +0,0 @@
-prototype(Neos.Context:Prototype) < prototype(Neos.Fusion:Component) {
-
- workspace = ${node.context.workspace}
- workspaceName = ${node.context.workspaceName}
- workspaceNameByWorkspace = ${node.context.workspace.name}
-
- attributes = ${node.context.workspace || site.context.workspace || documentNode.context.workspace}
-
-
- renderer = afx`
-
- `
-}
------
-// TODO 9.0 migration: Line 8: You very likely need to rewrite "VARIABLE.context.workspace" as the "context" of nodes has been removed without a direct replacement in Neos 9. If you really need the workspace in fusion you need to create a dedicated helper yourself which should ideally do ALL the complex logic in php directly and return the computed result.
-// TODO 9.0 migration: Line 10: You very likely need to rewrite "VARIABLE.context.workspace" as the "context" of nodes has been removed without a direct replacement in Neos 9. If you really need the workspace in fusion you need to create a dedicated helper yourself which should ideally do ALL the complex logic in php directly and return the computed result.
-// TODO 9.0 migration: Line 12: You very likely need to rewrite "VARIABLE.context.workspace" as the "context" of nodes has been removed without a direct replacement in Neos 9. If you really need the workspace in fusion you need to create a dedicated helper yourself which should ideally do ALL the complex logic in php directly and return the computed result.
-// TODO 9.0 migration: Line 18: You very likely need to rewrite "VARIABLE.context.workspace" as the "context" of nodes has been removed without a direct replacement in Neos 9. If you really need the workspace in fusion you need to create a dedicated helper yourself which should ideally do ALL the complex logic in php directly and return the computed result.
-// TODO 9.0 migration: Line 19: You very likely need to rewrite "VARIABLE.context.workspace" as the "context" of nodes has been removed without a direct replacement in Neos 9. If you really need the workspace in fusion you need to create a dedicated helper yourself which should ideally do ALL the complex logic in php directly and return the computed result.
-prototype(Neos.Context:Prototype) < prototype(Neos.Fusion:Component) {
-
- workspace = ${node.context.workspace}
- workspaceName = ${node.context.workspaceName}
- workspaceNameByWorkspace = ${node.context.workspace.name}
-
- attributes = ${node.context.workspace || site.context.workspace || documentNode.context.workspace}
-
-
- renderer = afx`
-
- `
-}
diff --git a/tests/ContentRepository90/Rules/FusionContextGetWorkspaceRector/FusionContextGetWorkspaceRectorTest.php b/tests/ContentRepository90/Rules/FusionContextGetWorkspaceRector/FusionContextGetWorkspaceRectorTest.php
deleted file mode 100644
index 93ce5c7..0000000
--- a/tests/ContentRepository90/Rules/FusionContextGetWorkspaceRector/FusionContextGetWorkspaceRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionContextGetWorkspaceRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionContextGetWorkspaceRector/config/configured_rule.php
deleted file mode 100644
index 908e746..0000000
--- a/tests/ContentRepository90/Rules/FusionContextGetWorkspaceRector/config/configured_rule.php
+++ /dev/null
@@ -1,18 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(\Neos\Rector\Core\FusionProcessing\FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionContextGetWorkspaceRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionContextInBackendRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionContextInBackendRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index 7f870cf..0000000
--- a/tests/ContentRepository90/Rules/FusionContextInBackendRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,64 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${node.context.inBackend || site.context.inBackend || documentNode.context.inBackend}
-
- #
- # 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`
-
- `
- }
-}
------
-// 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 {
-
- #
- # pass down props
- #
- attributes = ${renderingMode.isEdit || renderingMode.isEdit || renderingMode.isEdit}
-
- #
- # 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`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionContextInBackendRector/FusionContextInBackendRectorTest.php b/tests/ContentRepository90/Rules/FusionContextInBackendRector/FusionContextInBackendRectorTest.php
deleted file mode 100644
index 918d63e..0000000
--- a/tests/ContentRepository90/Rules/FusionContextInBackendRector/FusionContextInBackendRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionContextInBackendRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionContextInBackendRector/config/configured_rule.php
deleted file mode 100644
index 9ddbab4..0000000
--- a/tests/ContentRepository90/Rules/FusionContextInBackendRector/config/configured_rule.php
+++ /dev/null
@@ -1,17 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(\Neos\Rector\Core\FusionProcessing\FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionContextInBackendRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionContextLiveRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionContextLiveRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index ae0e5e0..0000000
--- a/tests/ContentRepository90/Rules/FusionContextLiveRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,64 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${node.context.live || site.context.live || documentNode.context.live}
-
- #
- # 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`
-
- `
- }
-}
------
-// 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 {
-
- #
- # pass down props
- #
- attributes = ${!renderingMode.isEdit || !renderingMode.isEdit || !renderingMode.isEdit}
-
- #
- # 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`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionContextLiveRector/FusionContextLiveRectorTest.php b/tests/ContentRepository90/Rules/FusionContextLiveRector/FusionContextLiveRectorTest.php
deleted file mode 100644
index c325c16..0000000
--- a/tests/ContentRepository90/Rules/FusionContextLiveRector/FusionContextLiveRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionContextLiveRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionContextLiveRector/config/configured_rule.php
deleted file mode 100644
index 263f9b6..0000000
--- a/tests/ContentRepository90/Rules/FusionContextLiveRector/config/configured_rule.php
+++ /dev/null
@@ -1,17 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(\Neos\Rector\Core\FusionProcessing\FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionContextLiveRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionFlowQueryContextRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionFlowQueryContextRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index 69e5ade..0000000
--- a/tests/ContentRepository90/Rules/FusionFlowQueryContextRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,44 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- empty = ${q(node).context()}
- workspaceName = ${q(node).context({'workspaceName': 'other-workspace'})}
- dimensions = ${q(node).context({"dimensions": {'language': ['de']}})}
- invisibleContentShown = ${q(node).context({'invisibleContentShown': true})}
-
- currentDateTime = ${q(node).context({'currentDateTime': 'other-workspace'})}
- targetDimensions = ${q(node).context({"targetDimensions": {'language': ['de']}})}
- removedContentShown = ${q(node).context({'removedContentShown': true})}
- inaccessibleContentShown = ${q(node).context({"inaccessibleContentShown": true})}
-
- mixedRemovedContentShown = ${q(node).context({'workspaceName': 'other-workspace', 'removedContentShown': true})}
- mixedTargetDimensions = ${q(node).context({'targetDimensions': {'language': ['de']}, 'dimensions': {'language': ['de']}})}
-
- variables = ${q(site).context({'dimensions': this.dimensions.dimensions, 'targetDimensions': this.dimensions.targetDimensions})}
-
-}
------
-// TODO 9.0 migration: Line 15: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.
-// TODO 9.0 migration: Line 16: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.
-// TODO 9.0 migration: Line 17: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.
-// TODO 9.0 migration: Line 18: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.
-// TODO 9.0 migration: Line 20: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.
-// TODO 9.0 migration: Line 21: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.
-// TODO 9.0 migration: Line 23: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- empty = ${q(node).context()}
- workspaceName = ${q(node).context({'workspaceName': 'other-workspace'})}
- dimensions = ${q(node).context({"dimensions": {'language': ['de']}})}
- invisibleContentShown = ${q(node).context({'invisibleContentShown': true})}
-
- currentDateTime = ${q(node).context({'currentDateTime': 'other-workspace'})}
- targetDimensions = ${q(node).context({"targetDimensions": {'language': ['de']}})}
- removedContentShown = ${q(node).context({'removedContentShown': true})}
- inaccessibleContentShown = ${q(node).context({"inaccessibleContentShown": true})}
-
- mixedRemovedContentShown = ${q(node).context({'workspaceName': 'other-workspace', 'removedContentShown': true})}
- mixedTargetDimensions = ${q(node).context({'targetDimensions': {'language': ['de']}, 'dimensions': {'language': ['de']}})}
-
- variables = ${q(site).context({'dimensions': this.dimensions.dimensions, 'targetDimensions': this.dimensions.targetDimensions})}
-
-}
diff --git a/tests/ContentRepository90/Rules/FusionFlowQueryContextRector/FusionQueryContextRectorTest.php b/tests/ContentRepository90/Rules/FusionFlowQueryContextRector/FusionQueryContextRectorTest.php
deleted file mode 100644
index bd334cd..0000000
--- a/tests/ContentRepository90/Rules/FusionFlowQueryContextRector/FusionQueryContextRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionFlowQueryContextRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionFlowQueryContextRector/config/configured_rule.php
deleted file mode 100644
index 0acfb92..0000000
--- a/tests/ContentRepository90/Rules/FusionFlowQueryContextRector/config/configured_rule.php
+++ /dev/null
@@ -1,18 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(\Neos\Rector\Core\FusionProcessing\FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionFlowQueryContextRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionNodeAggregateIdentifierRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeAggregateIdentifierRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index 64e6342..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeAggregateIdentifierRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,36 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${node.nodeAggregateIdentifier || documentNode.nodeAggregateIdentifier}
- renderer = afx`
-
- `
- }
-}
------
-// TODO 9.0 migration: Line 13: You may need to rewrite "VARIABLE.nodeAggregateIdentifier" to VARIABLE.aggregateId. 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.aggregateId || documentNode.aggregateId}
- renderer = afx`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeAggregateIdentifierRector/FusionNodeAggregateIdentifierRectorTest.php b/tests/ContentRepository90/Rules/FusionNodeAggregateIdentifierRector/FusionNodeAggregateIdentifierRectorTest.php
deleted file mode 100644
index 389e4cf..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeAggregateIdentifierRector/FusionNodeAggregateIdentifierRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeAggregateIdentifierRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionNodeAggregateIdentifierRector/config/configured_rule.php
deleted file mode 100644
index afbf8eb..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeAggregateIdentifierRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionNodeAggregateIdentifierRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionNodeAutoCreatedRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeAutoCreatedRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index 055e153..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeAutoCreatedRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,64 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${node.autoCreated || documentNode.autoCreated}
-
- #
- # 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`
-
- `
- }
-}
------
-// 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.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`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeAutoCreatedRector/FusionNodeAutoCreatedRectorTest.php b/tests/ContentRepository90/Rules/FusionNodeAutoCreatedRector/FusionNodeAutoCreatedRectorTest.php
deleted file mode 100644
index 5efd9aa..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeAutoCreatedRector/FusionNodeAutoCreatedRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeAutoCreatedRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionNodeAutoCreatedRector/config/configured_rule.php
deleted file mode 100644
index ef9ec1d..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeAutoCreatedRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionNodeAutoCreatedRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionNodeContextPathRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeContextPathRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index ee8a622..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeContextPathRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,69 +0,0 @@
-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")}
- 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`
-
- `
- }
-}
------
-// 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 = ${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`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeContextPathRector/FusionNodeContextPathRectorTest.php b/tests/ContentRepository90/Rules/FusionNodeContextPathRector/FusionNodeContextPathRectorTest.php
deleted file mode 100644
index 8d8888f..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeContextPathRector/FusionNodeContextPathRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeContextPathRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionNodeContextPathRector/config/configured_rule.php
deleted file mode 100644
index b05ebef..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeContextPathRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionNodeContextPathRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionNodeDepthRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeDepthRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index fb608fe..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeDepthRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,72 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${node.depth || documentNode.depth || q(node).property('_depth') || q(documentNode).property("_depth")}
- foo = ${q(bar).property('_depth') || q(bar).property("_depth")}
- boo = ${q(nodes).first().property('_depth') || q(nodes).first().property("_depth")}
-
- #
- # 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`
-
- `
- }
-}
------
-// 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 {
-
- #
- # pass down props
- #
- 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`
- #
- 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`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeDepthRector/Fixture/some_file2.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeDepthRector/Fixture/some_file2.fusion.inc
deleted file mode 100644
index fd72ce2..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeDepthRector/Fixture/some_file2.fusion.inc
+++ /dev/null
@@ -1,64 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${this.node.depth || this.documentNode.depth}
-
- #
- # 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`
-
- `
- }
-}
------
-// 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.
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${Neos.Node.depth(this.node) || Neos.Node.depth(this.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()}
-
- renderer = afx`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeDepthRector/FusionNodeDepthRectorTest.php b/tests/ContentRepository90/Rules/FusionNodeDepthRector/FusionNodeDepthRectorTest.php
deleted file mode 100644
index 49b4d74..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeDepthRector/FusionNodeDepthRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeDepthRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionNodeDepthRector/config/configured_rule.php
deleted file mode 100644
index 3bb5e5a..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeDepthRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionNodeDepthRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionNodeHiddenAfterDateTimeRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeHiddenAfterDateTimeRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index e7c3d16..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeHiddenAfterDateTimeRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,44 +0,0 @@
-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")}
-
- renderer = afx`
-
- `
- }
-}
------
-// 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 = ${q(node).property("disableAfterDateTime") || q(documentNode).property("disableAfterDateTime")}
- attributes2 = ${q(node).property("disableAfterDateTime")}
-
- renderer = afx`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeHiddenAfterDateTimeRector/FusionNodeHiddenAfterDateTimeRectorTest.php b/tests/ContentRepository90/Rules/FusionNodeHiddenAfterDateTimeRector/FusionNodeHiddenAfterDateTimeRectorTest.php
deleted file mode 100644
index 96ccff4..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeHiddenAfterDateTimeRector/FusionNodeHiddenAfterDateTimeRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeHiddenAfterDateTimeRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionNodeHiddenAfterDateTimeRector/config/configured_rule.php
deleted file mode 100644
index c577bd3..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeHiddenAfterDateTimeRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionNodeHiddenAfterDateTimeRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionNodeHiddenBeforeDateTimeRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeHiddenBeforeDateTimeRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index b1797ac..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeHiddenBeforeDateTimeRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,44 +0,0 @@
-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")}
-
- renderer = afx`
-
- `
- }
-}
------
-// 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 = ${q(node).property("enableAfterDateTime") || q(documentNode).property("enableAfterDateTime")}
- attribute2 = ${q(node).property("enableAfterDateTime")}
-
- renderer = afx`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeHiddenBeforeDateTimeRector/FusionNodeHiddenBeforeDateTimeRectorTest.php b/tests/ContentRepository90/Rules/FusionNodeHiddenBeforeDateTimeRector/FusionNodeHiddenBeforeDateTimeRectorTest.php
deleted file mode 100644
index 5fd1299..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeHiddenBeforeDateTimeRector/FusionNodeHiddenBeforeDateTimeRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeHiddenBeforeDateTimeRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionNodeHiddenBeforeDateTimeRector/config/configured_rule.php
deleted file mode 100644
index eb328bb..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeHiddenBeforeDateTimeRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionNodeHiddenBeforeDateTimeRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionNodeHiddenInIndexRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeHiddenInIndexRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index cba1886..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeHiddenInIndexRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,64 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${node.hiddenInIndex || documentNode.hiddenInIndex || site.hiddenInIndex || q(node).property('_hiddenInIndex') || q(documentNode).property("_hiddenInIndex")}
-
- #
- # 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`
-
- `
- }
-}
------
-// 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 {
-
- #
- # pass down props
- #
- 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`
- #
- 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`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeHiddenInIndexRector/FusionNodeHiddenInIndexRectorTest.php b/tests/ContentRepository90/Rules/FusionNodeHiddenInIndexRector/FusionNodeHiddenInIndexRectorTest.php
deleted file mode 100644
index 14c9175..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeHiddenInIndexRector/FusionNodeHiddenInIndexRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeHiddenInIndexRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionNodeHiddenInIndexRector/config/configured_rule.php
deleted file mode 100644
index 96550f2..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeHiddenInIndexRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionNodeHiddenInIndexRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionNodeHiddenRector/Fixture/flow_query_property.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeHiddenRector/Fixture/flow_query_property.fusion.inc
deleted file mode 100644
index d5742c9..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeHiddenRector/Fixture/flow_query_property.fusion.inc
+++ /dev/null
@@ -1,14 +0,0 @@
-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')}
- flowQuery = ${q(someOtherVariable).first().property('_hidden')}
- inAfx = afx``
-}
------
-// 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 = ${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``
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeHiddenRector/Fixture/node_getter.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeHiddenRector/Fixture/node_getter.fusion.inc
deleted file mode 100644
index f93ad82..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeHiddenRector/Fixture/node_getter.fusion.inc
+++ /dev/null
@@ -1,12 +0,0 @@
-prototype(Neos.Rector:Test) < prototype(Neos.Fusion:Value) {
- node = ${node.hidden || documentNode.hidden || site.hidden}
- otherVariable = ${someOtherVariable.hidden}
- inAfx = afx``
-}
------
-// TODO 9.0 migration: Line 4: You may need to rewrite "VARIABLE.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 = ${Neos.Node.isDisabled(node) || Neos.Node.isDisabled(documentNode) || Neos.Node.isDisabled(site)}
- otherVariable = ${someOtherVariable.hidden}
- inAfx = afx``
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeHiddenRector/FusionNodeHiddenRectorTest.php b/tests/ContentRepository90/Rules/FusionNodeHiddenRector/FusionNodeHiddenRectorTest.php
deleted file mode 100644
index 4bcd3cd..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeHiddenRector/FusionNodeHiddenRectorTest.php
+++ /dev/null
@@ -1,30 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeHiddenRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionNodeHiddenRector/config/configured_rule.php
deleted file mode 100644
index 280df62..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeHiddenRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionNodeHiddenRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionNodeIdentifierRector/Fixture/flow_query_property.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeIdentifierRector/Fixture/flow_query_property.fusion.inc
deleted file mode 100644
index 8537795..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeIdentifierRector/Fixture/flow_query_property.fusion.inc
+++ /dev/null
@@ -1,35 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${q(node).property("_identifier") || q(documentNode).property("_identifier")}
- renderer = afx`
-
- `
- }
-}
------
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${node.aggregateId || documentNode.aggregateId}
- renderer = afx`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeIdentifierRector/Fixture/node_getter.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeIdentifierRector/Fixture/node_getter.fusion.inc
deleted file mode 100644
index 5ca4cd7..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeIdentifierRector/Fixture/node_getter.fusion.inc
+++ /dev/null
@@ -1,36 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${node.identifier || documentNode.identifier}
- renderer = afx`
-
- `
- }
-}
------
-// TODO 9.0 migration: Line 13: You may need to rewrite "VARIABLE.identifier" to "VARIABLE.aggregateId". 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.aggregateId || documentNode.aggregateId}
- renderer = afx`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeIdentifierRector/FusionNodeIdentifierRectorTest.php b/tests/ContentRepository90/Rules/FusionNodeIdentifierRector/FusionNodeIdentifierRectorTest.php
deleted file mode 100644
index 39e608f..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeIdentifierRector/FusionNodeIdentifierRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeIdentifierRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionNodeIdentifierRector/config/configured_rule.php
deleted file mode 100644
index 8d7b0f8..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeIdentifierRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionNodeIdentifierRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionNodeLabelRector/Fixture/flow_query_property.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeLabelRector/Fixture/flow_query_property.fusion.inc
deleted file mode 100644
index 55b8b8d..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeLabelRector/Fixture/flow_query_property.fusion.inc
+++ /dev/null
@@ -1,11 +0,0 @@
-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``
-}
------
-prototype(Neos.Rector:Test) < prototype(Neos.Fusion:Value) {
- node = ${Neos.Node.label(node) || Neos.Node.label(documentNode) || Neos.Node.label(site)}
- otherVariable = ${Neos.Node.label(someOtherVariable)}
- inAfx = afx``
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeLabelRector/Fixture/node_getter.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeLabelRector/Fixture/node_getter.fusion.inc
deleted file mode 100644
index 54ddfd9..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeLabelRector/Fixture/node_getter.fusion.inc
+++ /dev/null
@@ -1,12 +0,0 @@
-prototype(Neos.Rector:Test) < prototype(Neos.Fusion:Value) {
- node = ${node.label || documentNode.label || site.label}
- otherVariable = ${someOtherVariable.label}
- inAfx = afx``
-}
------
-// TODO 9.0 migration: Line 4: You very likely need to rewrite "VARIABLE.label" to "Neos.Node.label(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 = ${Neos.Node.label(node) || Neos.Node.label(documentNode) || Neos.Node.label(site)}
- otherVariable = ${someOtherVariable.label}
- inAfx = afx``
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeLabelRector/FusionNodeLabelRectorTest.php b/tests/ContentRepository90/Rules/FusionNodeLabelRector/FusionNodeLabelRectorTest.php
deleted file mode 100644
index 6dcc128..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeLabelRector/FusionNodeLabelRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeLabelRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionNodeLabelRector/config/configured_rule.php
deleted file mode 100644
index e87d492..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeLabelRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionNodeLabelRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/Fixture/flow_query_property.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/Fixture/flow_query_property.fusion.inc
deleted file mode 100644
index d3f4d3d..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/Fixture/flow_query_property.fusion.inc
+++ /dev/null
@@ -1,15 +0,0 @@
-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``
-}
------
-prototype(Neos.Rector:Test) < prototype(Neos.Fusion:Value) {
- 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``
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/Fixture/node_getter.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/Fixture/node_getter.fusion.inc
deleted file mode 100644
index 96e0ac6..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/Fixture/node_getter.fusion.inc
+++ /dev/null
@@ -1,14 +0,0 @@
-prototype(Neos.Rector:Test) < prototype(Neos.Fusion:Value) {
- node = ${node.nodeType || documentNode.nodeType || site.nodeType}
- otherVariable = ${someOtherVariable.nodeType}
- inAfx = afx``
- dontReplaceThis = ${node.nodeTypeName}
-}
------
-// TODO 9.0 migration: Line 4: You very likely need to rewrite "VARIABLE.nodeType" to "Neos.Node.nodeType(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 = ${Neos.Node.nodeType(node) || Neos.Node.nodeType(documentNode) || Neos.Node.nodeType(site)}
- otherVariable = ${someOtherVariable.nodeType}
- inAfx = afx``
- dontReplaceThis = ${node.nodeTypeName}
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/Fixture/node_nodeTypeName_flow_query_property.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/Fixture/node_nodeTypeName_flow_query_property.fusion.inc
deleted file mode 100644
index 056e6e9..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/Fixture/node_nodeTypeName_flow_query_property.fusion.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-prototype(Neos.Rector:Test) < prototype(Neos.Fusion:Value) {
- node = ${q(node).property('_nodeType.name') || q(documentNode).property("_nodeType.name") || q(site).property("_nodeType.name")}
- otherVariable = ${q(someOtherVariable).property('_nodeType.name')}
- inAfx = afx``
- dontReplaceThis = ${q(node).property('_nodeTypesname')}
-}
------
-prototype(Neos.Rector:Test) < prototype(Neos.Fusion:Value) {
- node = ${node.nodeTypeName || documentNode.nodeTypeName || site.nodeTypeName}
- otherVariable = ${someOtherVariable.nodeTypeName}
- inAfx = afx``
- dontReplaceThis = ${q(node).property('_nodeTypesname')}
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/Fixture/node_nodeTypeName_getter.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/Fixture/node_nodeTypeName_getter.fusion.inc
deleted file mode 100644
index e3103cb..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/Fixture/node_nodeTypeName_getter.fusion.inc
+++ /dev/null
@@ -1,12 +0,0 @@
-prototype(Neos.Rector:Test) < prototype(Neos.Fusion:Value) {
- node = ${node.nodeType.name || documentNode.nodeType.name || site.nodeType.name}
- otherVariable = ${someOtherVariable.nodeType.name}
- inAfx = afx``
-}
------
-// TODO 9.0 migration: Line 4: You very likely need to rewrite "VARIABLE.nodeType" to "Neos.Node.nodeType(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 = ${node.nodeTypeName || documentNode.nodeTypeName || site.nodeTypeName}
- otherVariable = ${someOtherVariable.nodeType.name}
- inAfx = afx``
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/FusionNodeNodeTypeRectorTest.php b/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/FusionNodeNodeTypeRectorTest.php
deleted file mode 100644
index f281af8..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/FusionNodeNodeTypeRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/config/configured_rule.php
deleted file mode 100644
index 1425cf5..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeNodeTypeRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionNodeNodeTypeRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionNodeParentRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeParentRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index 0396cda..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeParentRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,44 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${node.parent || documentNode.parent}
-
- renderer = afx`
-
- `
- }
-}
------
-// 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 {
-
- #
- # pass down props
- #
- attributes = ${q(node).parent().get(0) || q(documentNode).parent().get(0)}
-
- renderer = afx`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeParentRector/FusionNodeParentRectorTest.php b/tests/ContentRepository90/Rules/FusionNodeParentRector/FusionNodeParentRectorTest.php
deleted file mode 100644
index 43f050e..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeParentRector/FusionNodeParentRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeParentRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionNodeParentRector/config/configured_rule.php
deleted file mode 100644
index 11160bf..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeParentRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionNodeParentRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionNodePathRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionNodePathRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index 01ff46b..0000000
--- a/tests/ContentRepository90/Rules/FusionNodePathRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,71 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${node.path || documentNode.path || q(node).property('_path') || q(documentNode).property("_path")}
- foo = ${q(bar).property('_path') || q(bar).property("_path")}
- boo = ${q(nodes).first().property('_path') || q(nodes).first().property("_path")}
-
- #
- # 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`
-
- `
- }
-}
------
-// 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 {
-
- #
- # pass down props
- #
- 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`
- #
- 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`
-
- `
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodePathRector/FusionNodePathRectorTest.php b/tests/ContentRepository90/Rules/FusionNodePathRector/FusionNodePathRectorTest.php
deleted file mode 100644
index 70d7bc9..0000000
--- a/tests/ContentRepository90/Rules/FusionNodePathRector/FusionNodePathRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodePathRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionNodePathRector/config/configured_rule.php
deleted file mode 100644
index 5af7f1d..0000000
--- a/tests/ContentRepository90/Rules/FusionNodePathRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionNodePathRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionNodeTypeNameRector/Fixture/some_file.fusion.inc b/tests/ContentRepository90/Rules/FusionNodeTypeNameRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index 19b5d73..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeTypeNameRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,36 +0,0 @@
-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}
-renderer = afx`
-
-`
-}
-}
------
-// 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 {
-
-#
-# pass down props
-#
-attributes = ${node.nodeTypeName || documentNode.nodeTypeName}
-renderer = afx`
-
-`
-}
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeTypeNameRector/FusionNodeTypeNameRectorTest.php b/tests/ContentRepository90/Rules/FusionNodeTypeNameRector/FusionNodeTypeNameRectorTest.php
deleted file mode 100644
index c5a7d79..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeTypeNameRector/FusionNodeTypeNameRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/FusionNodeTypeNameRector/config/configured_rule.php b/tests/ContentRepository90/Rules/FusionNodeTypeNameRector/config/configured_rule.php
deleted file mode 100644
index 6453e6b..0000000
--- a/tests/ContentRepository90/Rules/FusionNodeTypeNameRector/config/configured_rule.php
+++ /dev/null
@@ -1,19 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(FusionNodeTypeNameRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/NodeFactoryResetRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeFactoryResetRector/Fixture/some_class.php.inc
index 8f21f82..ad62bd7 100644
--- a/tests/ContentRepository90/Rules/NodeFactoryResetRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeFactoryResetRector/Fixture/some_class.php.inc
@@ -12,6 +12,7 @@ class SomeClass
public function run()
{
$this->nodeFactory->reset();
+ return $this->nodeFactory->reset();
}
}
@@ -30,6 +31,7 @@ class SomeClass
protected $nodeFactory;
public function run()
{
+ return;
}
}
diff --git a/tests/ContentRepository90/Rules/NodeFactoryResetRector/NodeFactoryResetRectorTest.php b/tests/ContentRepository90/Rules/NodeFactoryResetRector/NodeFactoryResetRectorTest.php
index 417c43d..d21f368 100644
--- a/tests/ContentRepository90/Rules/NodeFactoryResetRector/NodeFactoryResetRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeFactoryResetRector/NodeFactoryResetRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeFactoryResetRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeFactoryResetRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return self::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeFactoryResetRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeFactoryResetRector/config/configured_rule.php
index 5508836..30724e0 100644
--- a/tests/ContentRepository90/Rules/NodeFactoryResetRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeFactoryResetRector/config/configured_rule.php
@@ -4,6 +4,6 @@
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(\Neos\Rector\ContentRepository90\Rules\NodeFactoryResetRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([\Neos\Rector\ContentRepository90\Rules\NodeFactoryResetRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeFindParentNodeRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeFindParentNodeRector/Fixture/some_class.php.inc
index c682d29..3e55b50 100644
--- a/tests/ContentRepository90/Rules/NodeFindParentNodeRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeFindParentNodeRector/Fixture/some_class.php.inc
@@ -1,10 +1,10 @@
findParentNode();
}
@@ -14,11 +14,11 @@ class SomeClass
-----
contentRepositoryRegistry->subgraphForNode($node);
$parentNode = $subgraph->findParentNode($node->aggregateId);
diff --git a/tests/ContentRepository90/Rules/NodeFindParentNodeRector/NodeFindParentNodeRectorTest.php b/tests/ContentRepository90/Rules/NodeFindParentNodeRector/NodeFindParentNodeRectorTest.php
index 022532d..3396ecd 100644
--- a/tests/ContentRepository90/Rules/NodeFindParentNodeRector/NodeFindParentNodeRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeFindParentNodeRector/NodeFindParentNodeRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetChildNodesRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeFindParentNodeRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeFindParentNodeRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeFindParentNodeRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeFindParentNodeRector/config/configured_rule.php
index 1eeab0c..8510d54 100644
--- a/tests/ContentRepository90/Rules/NodeFindParentNodeRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeFindParentNodeRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\NodeFindParentNodeRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(NodeFindParentNodeRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeFindParentNodeRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeGetContextPathRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeGetContextPathRector/Fixture/some_class.php.inc
index 3207ac7..bf3b768 100644
--- a/tests/ContentRepository90/Rules/NodeGetContextPathRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeGetContextPathRector/Fixture/some_class.php.inc
@@ -1,10 +1,10 @@
getContextPath();
}
@@ -14,11 +14,11 @@ class SomeClass
-----
toJson();
}
diff --git a/tests/ContentRepository90/Rules/NodeGetContextPathRector/NodeGetContextPathRectorTest.php b/tests/ContentRepository90/Rules/NodeGetContextPathRector/NodeGetContextPathRectorTest.php
index 744db26..08351c5 100644
--- a/tests/ContentRepository90/Rules/NodeGetContextPathRector/NodeGetContextPathRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeGetContextPathRector/NodeGetContextPathRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\Rules\NodeGetDepthRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetContextPathRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeGetContextPathRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeGetContextPathRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeGetContextPathRector/config/configured_rule.php
index 358d331..4c5bd67 100644
--- a/tests/ContentRepository90/Rules/NodeGetContextPathRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeGetContextPathRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\NodeGetContextPathRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(NodeGetContextPathRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeGetContextPathRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeGetDepthRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeGetDepthRector/Fixture/some_class.php.inc
index f683082..b6b6fb7 100644
--- a/tests/ContentRepository90/Rules/NodeGetDepthRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeGetDepthRector/Fixture/some_class.php.inc
@@ -1,10 +1,10 @@
getDepth();
}
@@ -14,11 +14,11 @@ class SomeClass
-----
contentRepositoryRegistry->subgraphForNode($node);
return $subgraph->findNodePath($node->aggregateId)->getDepth();
diff --git a/tests/ContentRepository90/Rules/NodeGetDepthRector/NodeGetDepthRectorTest.php b/tests/ContentRepository90/Rules/NodeGetDepthRector/NodeGetDepthRectorTest.php
index 83df65e..41ee7ec 100644
--- a/tests/ContentRepository90/Rules/NodeGetDepthRector/NodeGetDepthRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeGetDepthRector/NodeGetDepthRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\Rules\NodeGetDepthRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetDepthRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeGetDepthRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeGetDepthRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeGetDepthRector/config/configured_rule.php
index dc1d2f5..c92370e 100644
--- a/tests/ContentRepository90/Rules/NodeGetDepthRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeGetDepthRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\NodeGetDepthRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(NodeGetDepthRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeGetDepthRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/Fixture/some_class.php.inc
index bd3d24d..415b3cf 100644
--- a/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/Fixture/some_class.php.inc
@@ -1,17 +1,17 @@
getHiddenBeforeDateTime();
$node->setHiddenBeforeDateTime($dateTime);
}
- public function nodeHiddenAfterDateTime(NodeLegacyStub $node)
+ public function nodeHiddenAfterDateTime(Node $node)
{
$dateTime = $node->getHiddenAfterDateTime();
@@ -23,31 +23,27 @@ class SomeClass
-----
getProperty('enableAfterDateTime');
+
// TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details.
// Use the "SetNodeProperties" command to change property values for "enableAfterDateTime" or "disableAfterDateTime".
-
-
$node->setHiddenBeforeDateTime($dateTime);
}
- public function nodeHiddenAfterDateTime(NodeLegacyStub $node)
+ public function nodeHiddenAfterDateTime(Node $node)
{
// TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details.
-
$dateTime = $node->getProperty('disableAfterDateTime');
+
// TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details.
// Use the "SetNodeProperties" command to change property values for "enableAfterDateTime" or "disableAfterDateTime".
-
-
$node->setHiddenAfterDateTime($dateTime);
}
}
diff --git a/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/NodeGetHiddenBeforeAfterDateTimeRectorTest.php b/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/NodeGetHiddenBeforeAfterDateTimeRectorTest.php
index ba3e814..6e60463 100644
--- a/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/NodeGetHiddenBeforeAfterDateTimeRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/NodeGetHiddenBeforeAfterDateTimeRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\Rules\NodeGetDepthRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetHiddenBeforeAfterDateTimeRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeGetHiddenBeforeAfterDateTimeRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/config/configured_rule.php
index 2e3f4c8..32b1c30 100644
--- a/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\NodeGetHiddenBeforeAfterDateTimeRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(NodeGetHiddenBeforeAfterDateTimeRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeGetHiddenBeforeAfterDateTimeRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeGetIdentifierRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeGetIdentifierRector/Fixture/some_class.php.inc
index 071db1c..6e4f479 100644
--- a/tests/ContentRepository90/Rules/NodeGetIdentifierRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeGetIdentifierRector/Fixture/some_class.php.inc
@@ -1,10 +1,10 @@
getIdentifier();
}
@@ -14,14 +14,13 @@ class SomeClass
-----
aggregateId->value;
}
}
diff --git a/tests/ContentRepository90/Rules/NodeGetIdentifierRector/NodeGetIdentifierRectorTest.php b/tests/ContentRepository90/Rules/NodeGetIdentifierRector/NodeGetIdentifierRectorTest.php
index e60b0a6..704b496 100644
--- a/tests/ContentRepository90/Rules/NodeGetIdentifierRector/NodeGetIdentifierRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeGetIdentifierRector/NodeGetIdentifierRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetChildNodesRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetIdentifierRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeGetIdentifierRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeGetIdentifierRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeGetIdentifierRector/config/configured_rule.php
index ac45316..f8e8fb5 100644
--- a/tests/ContentRepository90/Rules/NodeGetIdentifierRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeGetIdentifierRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\NodeGetIdentifierRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(NodeGetIdentifierRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeGetIdentifierRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector/Fixture/some_class.php.inc
index 8852dea..30f07cc 100644
--- a/tests/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector/Fixture/some_class.php.inc
@@ -1,10 +1,10 @@
getNodeType();
$nodeTypeName = $nodeType->getName();
@@ -17,11 +17,11 @@ class SomeClass
-----
getNodeType();
$nodeTypeName = $nodeType->getName();
diff --git a/tests/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector/NodeGetNodeTypeGetNameRectorTest.php b/tests/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector/NodeGetNodeTypeGetNameRectorTest.php
index 0bc35e1..07af8d8 100644
--- a/tests/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector/NodeGetNodeTypeGetNameRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector/NodeGetNodeTypeGetNameRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetChildNodesRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetNodeTypeGetNameRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeGetNodeTypeGetNameRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector/config/configured_rule.php
index c54d308..13235f4 100644
--- a/tests/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeGetNodeTypeGetNameRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\NodeGetNodeTypeGetNameRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(NodeGetNodeTypeGetNameRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeGetNodeTypeGetNameRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/Fixture/withnode.php.inc
similarity index 60%
rename from tests/ContentRepository90/Rules/NodeGetNodeTypeRector/Fixture/some_class.php.inc
rename to tests/ContentRepository90/Rules/NodeGetNodeTypeRector/Fixture/withnode.php.inc
index 7658245..5eb3367 100644
--- a/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/Fixture/withnode.php.inc
@@ -1,10 +1,10 @@
getNodeType();
}
@@ -14,11 +14,11 @@ class SomeClass
-----
contentRepositoryRegistry->get($node->contentRepositoryId);
$nodeType = $contentRepository->getNodeTypeManager()->getNodeType($node->nodeTypeName);
diff --git a/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/Fixture/withnodeinterface.php.inc b/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/Fixture/withnodeinterface.php.inc
new file mode 100644
index 0000000..54925d5
--- /dev/null
+++ b/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/Fixture/withnodeinterface.php.inc
@@ -0,0 +1,28 @@
+getNodeType();
+ }
+}
+
+?>
+-----
+contentRepositoryRegistry->get($node->contentRepositoryId);
+ $nodeType = $contentRepository->getNodeTypeManager()->getNodeType($node->nodeTypeName);
+ }
+}
+
+?>
diff --git a/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/Fixture/withtraversablenodeinterface.php.inc b/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/Fixture/withtraversablenodeinterface.php.inc
new file mode 100644
index 0000000..1de45d1
--- /dev/null
+++ b/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/Fixture/withtraversablenodeinterface.php.inc
@@ -0,0 +1,28 @@
+getNodeType();
+ }
+}
+
+?>
+-----
+contentRepositoryRegistry->get($node->contentRepositoryId);
+ $nodeType = $contentRepository->getNodeTypeManager()->getNodeType($node->nodeTypeName);
+ }
+}
+
+?>
diff --git a/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/NodeGetNodeTypeRectorTest.php b/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/NodeGetNodeTypeRectorTest.php
index c8d6e0c..e5527bd 100644
--- a/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/NodeGetNodeTypeRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/NodeGetNodeTypeRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetChildNodesRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetNodeTypeRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeGetNodeTypeRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/config/configured_rule.php
index 6174f08..7f72f27 100644
--- a/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeGetNodeTypeRector/config/configured_rule.php
@@ -2,10 +2,9 @@
declare (strict_types=1);
-use Neos\Rector\ContentRepository90\Rules\NodeGetNodeTypeGetNameRector;
use Neos\Rector\ContentRepository90\Rules\NodeGetNodeTypeRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(NodeGetNodeTypeRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeGetNodeTypeRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeGetParentRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeGetParentRector/Fixture/some_class.php.inc
index 06a1d0e..258f867 100644
--- a/tests/ContentRepository90/Rules/NodeGetParentRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeGetParentRector/Fixture/some_class.php.inc
@@ -1,10 +1,10 @@
getParent();
}
@@ -14,11 +14,11 @@ class SomeClass
-----
contentRepositoryRegistry->subgraphForNode($node);
return $subgraph->findParentNode($node->aggregateId);
diff --git a/tests/ContentRepository90/Rules/NodeGetParentRector/NodeGetParentRectorTest.php b/tests/ContentRepository90/Rules/NodeGetParentRector/NodeGetParentRectorTest.php
index a735a45..ebf0756 100644
--- a/tests/ContentRepository90/Rules/NodeGetParentRector/NodeGetParentRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeGetParentRector/NodeGetParentRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetParentRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeGetParentRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeGetParentRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeGetParentRector/config/configured_rule.php
index c3cc0fd..8b24ac9 100644
--- a/tests/ContentRepository90/Rules/NodeGetParentRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeGetParentRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\NodeGetParentRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(NodeGetParentRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeGetParentRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeGetPropertyNamesRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeGetPropertyNamesRector/Fixture/some_class.php.inc
index 694d817..4fe34ea 100644
--- a/tests/ContentRepository90/Rules/NodeGetPropertyNamesRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeGetPropertyNamesRector/Fixture/some_class.php.inc
@@ -1,10 +1,10 @@
getPropertyNames();
}
@@ -14,11 +14,11 @@ class SomeClass
-----
properties));
}
diff --git a/tests/ContentRepository90/Rules/NodeGetPropertyNamesRector/NodeGetPropertyNamesRectorTest.php b/tests/ContentRepository90/Rules/NodeGetPropertyNamesRector/NodeGetPropertyNamesRectorTest.php
index a489e9c..d05c963 100644
--- a/tests/ContentRepository90/Rules/NodeGetPropertyNamesRector/NodeGetPropertyNamesRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeGetPropertyNamesRector/NodeGetPropertyNamesRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetChildNodesRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetPropertyNamesRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeGetPropertyNamesRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeGetPropertyNamesRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeGetPropertyNamesRector/config/configured_rule.php
index d1c0772..b2d2d52 100644
--- a/tests/ContentRepository90/Rules/NodeGetPropertyNamesRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeGetPropertyNamesRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\NodeGetPropertyNamesRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(NodeGetPropertyNamesRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeGetPropertyNamesRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/Fixture/some_class.php.inc
index 6444805..4302eee 100644
--- a/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/Fixture/some_class.php.inc
@@ -1,10 +1,10 @@
isAutoCreated();
}
@@ -14,11 +14,11 @@ class SomeClass
-----
classification->isTethered();
}
diff --git a/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/NodeIsAutoCreatedRectorTest.php b/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/NodeIsAutoCreatedRectorTest.php
index 152981c..f87aa1b 100644
--- a/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/NodeIsAutoCreatedRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/NodeIsAutoCreatedRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\Rules\NodeGetDepthRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeIsAutoCreatedRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeIsAutoCreatedRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/config/configured_rule.php
index f0cbb95..fa3b57f 100644
--- a/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\NodeIsAutoCreatedRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(NodeIsAutoCreatedRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeIsAutoCreatedRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeIsHiddenInIndexRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeIsHiddenInIndexRector/Fixture/some_class.php.inc
index b60ff94..735b08d 100644
--- a/tests/ContentRepository90/Rules/NodeIsHiddenInIndexRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeIsHiddenInIndexRector/Fixture/some_class.php.inc
@@ -1,10 +1,10 @@
isHiddenInIndex();
}
@@ -14,11 +14,11 @@ class SomeClass
-----
getProperty('hiddenInMenu');
}
diff --git a/tests/ContentRepository90/Rules/NodeIsHiddenInIndexRector/NodeIsHiddenInIndexRectorTest.php b/tests/ContentRepository90/Rules/NodeIsHiddenInIndexRector/NodeIsHiddenInIndexRectorTest.php
index bf8da32..fe61737 100644
--- a/tests/ContentRepository90/Rules/NodeIsHiddenInIndexRector/NodeIsHiddenInIndexRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeIsHiddenInIndexRector/NodeIsHiddenInIndexRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\Rules\NodeIsHiddenInIndexRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeIsHiddenInIndexRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeIsHiddenInIndexRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeIsHiddenInIndexRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeIsHiddenInIndexRector/config/configured_rule.php
index 80d48c5..7e3a032 100644
--- a/tests/ContentRepository90/Rules/NodeIsHiddenInIndexRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeIsHiddenInIndexRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\NodeIsHiddenInIndexRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(NodeIsHiddenInIndexRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeIsHiddenInIndexRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeLabelGeneratorRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeLabelGeneratorRector/Fixture/some_class.php.inc
index 1b1e69d..d6beb71 100644
--- a/tests/ContentRepository90/Rules/NodeLabelGeneratorRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeLabelGeneratorRector/Fixture/some_class.php.inc
@@ -1,10 +1,10 @@
getLabel();
}
@@ -14,13 +14,13 @@ class SomeClass
-----
nodeLabelGenerator->getLabel($node);
}
diff --git a/tests/ContentRepository90/Rules/NodeLabelGeneratorRector/NodeLabelGeneratorRectorTest.php b/tests/ContentRepository90/Rules/NodeLabelGeneratorRector/NodeLabelGeneratorRectorTest.php
index 1f03fe9..df37b5b 100644
--- a/tests/ContentRepository90/Rules/NodeLabelGeneratorRector/NodeLabelGeneratorRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeLabelGeneratorRector/NodeLabelGeneratorRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeLabelGeneratorRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeLabelGeneratorRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeLabelGeneratorRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeLabelGeneratorRector/config/configured_rule.php
index 4b1c2ce..fd2dfe6 100644
--- a/tests/ContentRepository90/Rules/NodeLabelGeneratorRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeLabelGeneratorRector/config/configured_rule.php
@@ -8,10 +8,10 @@
use Neos\Rector\Generic\ValueObject\AddInjection;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(NodeLabelGeneratorRector::class);
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeLabelGeneratorRector::class]);
- $rectorConfig->ruleWithConfiguration(InjectServiceIfNeededRector::class, [
- new AddInjection('nodeLabelGenerator', NodeLabelGeneratorInterface::class),
- ]);
-};
\ No newline at end of file
+$rectorConfig->withConfiguredRule(InjectServiceIfNeededRector::class, [
+ new AddInjection('nodeLabelGenerator', NodeLabelGeneratorInterface::class),
+]);
+return $rectorConfig;
\ No newline at end of file
diff --git a/tests/ContentRepository90/Rules/NodeSearchServiceRector/Fixture/node-search-service-interface.php.inc b/tests/ContentRepository90/Rules/NodeSearchServiceRector/Fixture/node-search-service-interface.php.inc
index b3fcb2f..d391132 100644
--- a/tests/ContentRepository90/Rules/NodeSearchServiceRector/Fixture/node-search-service-interface.php.inc
+++ b/tests/ContentRepository90/Rules/NodeSearchServiceRector/Fixture/node-search-service-interface.php.inc
@@ -12,11 +12,11 @@ class SomeClass extends AnotherClass
*/
private $nodeSearchServiceInterface;
- public function startingPointNodeIsGiven(Node $node, Context $context)
+ public function startingPointNodeIsGiven(Node $startingNode, Context $context)
{
$term = "term";
$searchNodeTypes = [];
- $nodes = $this->nodeSearchServiceInterface->findByProperties($term, $searchNodeTypes, $context, $node);
+ $nodes = $this->nodeSearchServiceInterface->findByProperties($term, $searchNodeTypes, $context, $startingNode);
}
public function startingPointNodeIsNotGiven(Context $context)
@@ -42,19 +42,21 @@ class SomeClass extends AnotherClass
*/
private $nodeSearchServiceInterface;
- public function startingPointNodeIsGiven(Node $node, Context $context)
+ public function startingPointNodeIsGiven(Node $startingNode, Context $context)
{
$term = "term";
$searchNodeTypes = [];
+
// TODO 9.0 migration: This could be a suitable replacement. Please check if all your requirements are still fulfilled.
- $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
- $nodes = $subgraph->findDescendantNodes($node->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindDescendantNodesFilter::create(nodeTypes: \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\NodeType\NodeTypeCriteria::create(\Neos\ContentRepository\Core\NodeType\NodeTypeNames::fromStringArray($searchNodeTypes), \Neos\ContentRepository\Core\NodeType\NodeTypeNames::createEmpty()), searchTerm: $term));
+ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($startingNode);
+ $nodes = $subgraph->findDescendantNodes($startingNode->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindDescendantNodesFilter::create(nodeTypes: \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\NodeType\NodeTypeCriteria::create(\Neos\ContentRepository\Core\NodeType\NodeTypeNames::fromStringArray($searchNodeTypes), \Neos\ContentRepository\Core\NodeType\NodeTypeNames::createEmpty()), searchTerm: $term));
}
public function startingPointNodeIsNotGiven(Context $context)
{
$term = "term";
$searchNodeTypes = [];
+
// TODO 9.0 migration: The replacement needs a node as starting point for the search. Please provide a node, to make this replacement working.
$node = 'we-need-a-node-here';
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
diff --git a/tests/ContentRepository90/Rules/NodeSearchServiceRector/Fixture/node-search-service.php.inc b/tests/ContentRepository90/Rules/NodeSearchServiceRector/Fixture/node-search-service.php.inc
index 7ef9e5d..9f191ed 100644
--- a/tests/ContentRepository90/Rules/NodeSearchServiceRector/Fixture/node-search-service.php.inc
+++ b/tests/ContentRepository90/Rules/NodeSearchServiceRector/Fixture/node-search-service.php.inc
@@ -12,11 +12,11 @@ class SomeClass extends AnotherClass
*/
private $nodeSearchService;
- public function startingPointNodeIsGiven(Node $node, Context $context)
+ public function startingPointNodeIsGiven(Node $startingNode, Context $context)
{
$term = "term";
$searchNodeTypes = [];
- $nodes = $this->nodeSearchService->findByProperties($term, $searchNodeTypes, $context, $node);
+ $nodes = $this->nodeSearchService->findByProperties($term, $searchNodeTypes, $context, $startingNode);
}
public function startingPointNodeIsNotGiven(Context $context)
@@ -42,19 +42,21 @@ class SomeClass extends AnotherClass
*/
private $nodeSearchService;
- public function startingPointNodeIsGiven(Node $node, Context $context)
+ public function startingPointNodeIsGiven(Node $startingNode, Context $context)
{
$term = "term";
$searchNodeTypes = [];
+
// TODO 9.0 migration: This could be a suitable replacement. Please check if all your requirements are still fulfilled.
- $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
- $nodes = $subgraph->findDescendantNodes($node->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindDescendantNodesFilter::create(nodeTypes: \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\NodeType\NodeTypeCriteria::create(\Neos\ContentRepository\Core\NodeType\NodeTypeNames::fromStringArray($searchNodeTypes), \Neos\ContentRepository\Core\NodeType\NodeTypeNames::createEmpty()), searchTerm: $term));
+ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($startingNode);
+ $nodes = $subgraph->findDescendantNodes($startingNode->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindDescendantNodesFilter::create(nodeTypes: \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\NodeType\NodeTypeCriteria::create(\Neos\ContentRepository\Core\NodeType\NodeTypeNames::fromStringArray($searchNodeTypes), \Neos\ContentRepository\Core\NodeType\NodeTypeNames::createEmpty()), searchTerm: $term));
}
public function startingPointNodeIsNotGiven(Context $context)
{
$term = "term";
$searchNodeTypes = [];
+
// TODO 9.0 migration: The replacement needs a node as starting point for the search. Please provide a node, to make this replacement working.
$node = 'we-need-a-node-here';
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
diff --git a/tests/ContentRepository90/Rules/NodeSearchServiceRector/NodeSearchServiceRectorTest.php b/tests/ContentRepository90/Rules/NodeSearchServiceRector/NodeSearchServiceRectorTest.php
index 45f47ab..3cf19ee 100644
--- a/tests/ContentRepository90/Rules/NodeSearchServiceRector/NodeSearchServiceRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeSearchServiceRector/NodeSearchServiceRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetChildNodesRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeSearchServiceRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeSearchServiceRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeSearchServiceRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeSearchServiceRector/config/configured_rule.php
index 0ef16f1..8357006 100644
--- a/tests/ContentRepository90/Rules/NodeSearchServiceRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeSearchServiceRector/config/configured_rule.php
@@ -2,11 +2,9 @@
declare (strict_types=1);
-use Neos\Rector\ContentRepository90\Rules\NodeGetNodeTypeGetNameRector;
-use Neos\Rector\ContentRepository90\Rules\NodeGetNodeTypeRector;
use Neos\Rector\ContentRepository90\Rules\NodeSearchServiceRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(NodeSearchServiceRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeSearchServiceRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/Fixture/some_class.php.inc
index ec7f5b3..64ab973 100644
--- a/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/Fixture/some_class.php.inc
@@ -1,11 +1,11 @@
getNodeType();
@@ -19,18 +19,19 @@ class SomeClass
-----
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'));
diff --git a/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/NodeTypeAllowsGrandchildNodeTypeTest.php b/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/NodeTypeAllowsGrandchildNodeTypeTest.php
index caf58c8..003cd6e 100644
--- a/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/NodeTypeAllowsGrandchildNodeTypeTest.php
+++ b/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/NodeTypeAllowsGrandchildNodeTypeTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetParentRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeTypeAllowsGrandchildNodeTypeRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeTypeAllowsGrandchildNodeTypeTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/config/configured_rule.php
index 01d2de1..8fdb1d5 100644
--- a/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeTypeAllowsGrandchildNodeTypeRector/config/configured_rule.php
@@ -2,16 +2,16 @@
declare (strict_types=1);
-use Rector\Config\RectorConfig;
-use Neos\Rector\Generic\Rules\InjectServiceIfNeededRector;
-use Neos\Rector\Generic\ValueObject\AddInjection;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Rector\ContentRepository90\Rules\NodeTypeAllowsGrandchildNodeTypeRector;
+use Neos\Rector\Generic\Rules\InjectServiceIfNeededRector;
+use Neos\Rector\Generic\ValueObject\AddInjection;
+use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(NodeTypeAllowsGrandchildNodeTypeRector::class);
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeTypeAllowsGrandchildNodeTypeRector::class]);
- $rectorConfig->ruleWithConfiguration(InjectServiceIfNeededRector::class, [
- new AddInjection('contentRepositoryRegistry', ContentRepositoryRegistry::class),
- ]);
-};
+$rectorConfig->withConfiguredRule(InjectServiceIfNeededRector::class, [
+ new AddInjection('contentRepositoryRegistry', ContentRepositoryRegistry::class),
+]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/Fixture/some_class.php.inc
index fe09c0d..7a9c9eb 100644
--- a/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/Fixture/some_class.php.inc
@@ -1,10 +1,10 @@
getNodeType();
$childNodes = $nodeType->getAutoCreatedChildNodes();
@@ -15,15 +15,14 @@ class SomeClass
-----
getNodeType();
// TODO 9.0 migration: NodeType::tetheredNodeTypeDefinitions() is not a 1:1 replacement of NodeType::getAutoCreatedChildNodes(). You need to change your code to work with new TetheredNodeTypeDefinition object.
-
$childNodes = $nodeType->tetheredNodeTypeDefinitions;
}
}
diff --git a/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/NodeTypeGetAutoCreatedChildNodesTest.php b/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/NodeTypeGetAutoCreatedChildNodesTest.php
index 11b6617..015aa13 100644
--- a/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/NodeTypeGetAutoCreatedChildNodesTest.php
+++ b/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/NodeTypeGetAutoCreatedChildNodesTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetParentRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeTypeGetAutoCreatedChildNodesRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeTypeGetAutoCreatedChildNodesTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/config/configured_rule.php
index 5c678bb..1081f41 100644
--- a/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeTypeGetAutoCreatedChildNodesRector/config/configured_rule.php
@@ -2,16 +2,16 @@
declare (strict_types=1);
-use Rector\Config\RectorConfig;
+use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Rector\ContentRepository90\Rules\NodeTypeGetAutoCreatedChildNodesRector;
use Neos\Rector\Generic\Rules\InjectServiceIfNeededRector;
use Neos\Rector\Generic\ValueObject\AddInjection;
-use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
+use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(NodeTypeGetAutoCreatedChildNodesRector::class);
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeTypeGetAutoCreatedChildNodesRector::class]);
- $rectorConfig->ruleWithConfiguration(InjectServiceIfNeededRector::class, [
- new AddInjection('contentRepositoryRegistry', ContentRepositoryRegistry::class),
- ]);
-};
+$rectorConfig->withConfiguredRule(InjectServiceIfNeededRector::class, [
+ new AddInjection('contentRepositoryRegistry', ContentRepositoryRegistry::class),
+]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/Fixture/default.php.inc b/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/Fixture/default.php.inc
index 297413a..d216d7b 100644
--- a/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/Fixture/default.php.inc
+++ b/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/Fixture/default.php.inc
@@ -1,12 +1,11 @@
-
getNodeType();
@@ -18,17 +17,18 @@ class SomeClass
-----
getNodeType();
+
// TODO 9.0 migration: Make this code aware of multiple Content Repositories. If you have a Node object around you can use $node->contentRepositoryId.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$type = $contentRepository->getNodeTypeManager()->getNodeType($nodeType->tetheredNodeTypeDefinitions->get($nodeName));
diff --git a/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/NodeTypeGetTypeOfAutoCreatedChildNodeTest.php b/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/NodeTypeGetTypeOfAutoCreatedChildNodeTest.php
index e2e32ec..10ea3be 100644
--- a/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/NodeTypeGetTypeOfAutoCreatedChildNodeTest.php
+++ b/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/NodeTypeGetTypeOfAutoCreatedChildNodeTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeGetParentRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeTypeGetTypeOfAutoCreatedChildNodeRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeTypeGetTypeOfAutoCreatedChildNodeTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/config/configured_rule.php
index c6e4889..bc482d1 100644
--- a/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeTypeGetTypeOfAutoCreatedChildNodeRector/config/configured_rule.php
@@ -2,16 +2,16 @@
declare (strict_types=1);
-use Rector\Config\RectorConfig;
-use Neos\Rector\Generic\Rules\InjectServiceIfNeededRector;
-use Neos\Rector\Generic\ValueObject\AddInjection;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Rector\ContentRepository90\Rules\NodeTypeGetTypeOfAutoCreatedChildNodeRector;
+use Neos\Rector\Generic\Rules\InjectServiceIfNeededRector;
+use Neos\Rector\Generic\ValueObject\AddInjection;
+use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(NodeTypeGetTypeOfAutoCreatedChildNodeRector::class);
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeTypeGetTypeOfAutoCreatedChildNodeRector::class]);
- $rectorConfig->ruleWithConfiguration(InjectServiceIfNeededRector::class, [
- new AddInjection('contentRepositoryRegistry', ContentRepositoryRegistry::class),
- ]);
-};
+$rectorConfig->withConfiguredRule(InjectServiceIfNeededRector::class, [
+ new AddInjection('contentRepositoryRegistry', ContentRepositoryRegistry::class),
+]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/NodeTypeManagerAccessRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeTypeManagerAccessRector/Fixture/some_class.php.inc
index 235bf23..dcf28b0 100644
--- a/tests/ContentRepository90/Rules/NodeTypeManagerAccessRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/NodeTypeManagerAccessRector/Fixture/some_class.php.inc
@@ -27,6 +27,7 @@ class SomeClass
public function run()
{
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
+
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$nt = $contentRepository->getNodeTypeManager()->getNodeTypes(false);
}
diff --git a/tests/ContentRepository90/Rules/NodeTypeManagerAccessRector/NodeTypeManagerAccessRectorTest.php b/tests/ContentRepository90/Rules/NodeTypeManagerAccessRector/NodeTypeManagerAccessRectorTest.php
index 4949c65..421b207 100644
--- a/tests/ContentRepository90/Rules/NodeTypeManagerAccessRector/NodeTypeManagerAccessRectorTest.php
+++ b/tests/ContentRepository90/Rules/NodeTypeManagerAccessRector/NodeTypeManagerAccessRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\ContentRepository90\Rules\NodeTypeManagerAccessRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeTypeManagerAccessRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/NodeTypeManagerAccessRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeTypeManagerAccessRector/config/configured_rule.php
index caead7c..6a15203 100644
--- a/tests/ContentRepository90/Rules/NodeTypeManagerAccessRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/NodeTypeManagerAccessRector/config/configured_rule.php
@@ -4,6 +4,6 @@
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(\Neos\Rector\ContentRepository90\Rules\NodeTypeManagerAccessRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([\Neos\Rector\ContentRepository90\Rules\NodeTypeManagerAccessRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector/Fixture/some_class.php.inc
index 7c1f8c5..1ada296 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector/Fixture/some_class.php.inc
@@ -7,6 +7,8 @@ class SomeClass
public function run(Workspace $workspace)
{
$baseWorkspace = $workspace->getBaseWorkspace();
+
+ return $workspace->getBaseWorkspace();
}
}
@@ -20,9 +22,15 @@ class SomeClass
{
public function run(Workspace $workspace)
{
+
// TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead and make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$baseWorkspace = $contentRepository->findWorkspaceByName($workspace->baseWorkspaceName);
+
+ // TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead and make this code aware of multiple Content Repositories.
+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
+
+ return $contentRepository->findWorkspaceByName($workspace->baseWorkspaceName);
}
}
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector/WorkspaceGetBaseWorkspaceRectorTest.php b/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector/WorkspaceGetBaseWorkspaceRectorTest.php
index e328b0d..22c56fe 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector/WorkspaceGetBaseWorkspaceRectorTest.php
+++ b/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector/WorkspaceGetBaseWorkspaceRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceGetNameRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceGetBaseWorkspaceRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class WorkspaceGetBaseWorkspaceRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector/config/configured_rule.php b/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector/config/configured_rule.php
index 225f01d..31f2aa1 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspaceRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\WorkspaceGetBaseWorkspaceRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(WorkspaceGetBaseWorkspaceRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([WorkspaceGetBaseWorkspaceRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector/Fixture/some_class.php.inc
index c28deaf..100df04 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector/Fixture/some_class.php.inc
@@ -7,6 +7,8 @@ class SomeClass
public function run(Workspace $workspace)
{
$baseWorkspaces = $workspace->getBaseWorkspaces();
+
+ return $workspace->getBaseWorkspaces();
}
}
@@ -20,9 +22,15 @@ class SomeClass
{
public function run(Workspace $workspace)
{
+
// TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead and make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$baseWorkspaces = $contentRepository->findWorkspaces()->getBaseWorkspaces($workspace->workspaceName);
+
+ // TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead and make this code aware of multiple Content Repositories.
+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
+
+ return $contentRepository->findWorkspaces()->getBaseWorkspaces($workspace->workspaceName);
}
}
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector/WorkspaceGetBaseWorkspacesRectorTest.php b/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector/WorkspaceGetBaseWorkspacesRectorTest.php
index 359a53b..78daee1 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector/WorkspaceGetBaseWorkspacesRectorTest.php
+++ b/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector/WorkspaceGetBaseWorkspacesRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceGetNameRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceGetBaseWorkspacesRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class WorkspaceGetBaseWorkspacesRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector/config/configured_rule.php b/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector/config/configured_rule.php
index 391f78e..04242ad 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/WorkspaceGetBaseWorkspacesRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\WorkspaceGetBaseWorkspacesRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(WorkspaceGetBaseWorkspacesRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([WorkspaceGetBaseWorkspacesRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetDescriptionRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/WorkspaceGetDescriptionRector/Fixture/some_class.php.inc
index fa97068..f83e51d 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetDescriptionRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/WorkspaceGetDescriptionRector/Fixture/some_class.php.inc
@@ -21,7 +21,6 @@ class SomeClass
public function run(Workspace $workspace)
{
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
-
$description = $this->workspaceService->getWorkspaceMetadata(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName)->description->value;
}
}
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetDescriptionRector/WorkspaceGetDescriptionRectorTest.php b/tests/ContentRepository90/Rules/WorkspaceGetDescriptionRector/WorkspaceGetDescriptionRectorTest.php
index f0a4839..e9c8b7b 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetDescriptionRector/WorkspaceGetDescriptionRectorTest.php
+++ b/tests/ContentRepository90/Rules/WorkspaceGetDescriptionRector/WorkspaceGetDescriptionRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceGetNameRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceGetDescriptionRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class WorkspaceGetDescriptionRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetDescriptionRector/config/configured_rule.php b/tests/ContentRepository90/Rules/WorkspaceGetDescriptionRector/config/configured_rule.php
index 14a3e25..2c24314 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetDescriptionRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/WorkspaceGetDescriptionRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\WorkspaceGetDescriptionRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(WorkspaceGetDescriptionRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([WorkspaceGetDescriptionRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetNameRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/WorkspaceGetNameRector/Fixture/some_class.php.inc
index cd5ea25..d25531d 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetNameRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/WorkspaceGetNameRector/Fixture/some_class.php.inc
@@ -21,7 +21,6 @@ class SomeClass
public function run(Workspace $workspace)
{
// TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead.
-
$workspaceName = $workspace->workspaceName->value;
}
}
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetNameRector/WorkspaceGetNameRectorTest.php b/tests/ContentRepository90/Rules/WorkspaceGetNameRector/WorkspaceGetNameRectorTest.php
index d9e1657..ee07382 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetNameRector/WorkspaceGetNameRectorTest.php
+++ b/tests/ContentRepository90/Rules/WorkspaceGetNameRector/WorkspaceGetNameRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceGetNameRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class WorkspaceGetNameRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetNameRector/config/configured_rule.php b/tests/ContentRepository90/Rules/WorkspaceGetNameRector/config/configured_rule.php
index 981a24c..c20577d 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetNameRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/WorkspaceGetNameRector/config/configured_rule.php
@@ -2,9 +2,9 @@
declare (strict_types=1);
-use Rector\Config\RectorConfig;
use Neos\Rector\ContentRepository90\Rules\WorkspaceGetNameRector;
+use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(WorkspaceGetNameRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([WorkspaceGetNameRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetTitleRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/WorkspaceGetTitleRector/Fixture/some_class.php.inc
index 8eb8184..dd50d87 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetTitleRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/WorkspaceGetTitleRector/Fixture/some_class.php.inc
@@ -21,7 +21,6 @@ class SomeClass
public function run(Workspace $workspace)
{
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
-
$title = $this->workspaceService->getWorkspaceMetadata(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName)->title->value;
}
}
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetTitleRector/WorkspaceGetTitleRectorTest.php b/tests/ContentRepository90/Rules/WorkspaceGetTitleRector/WorkspaceGetTitleRectorTest.php
index c142b45..b464d93 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetTitleRector/WorkspaceGetTitleRectorTest.php
+++ b/tests/ContentRepository90/Rules/WorkspaceGetTitleRector/WorkspaceGetTitleRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceGetNameRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceGetTitleRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class WorkspaceGetTitleRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/WorkspaceGetTitleRector/config/configured_rule.php b/tests/ContentRepository90/Rules/WorkspaceGetTitleRector/config/configured_rule.php
index 89a4613..e45706d 100644
--- a/tests/ContentRepository90/Rules/WorkspaceGetTitleRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/WorkspaceGetTitleRector/config/configured_rule.php
@@ -2,9 +2,9 @@
declare (strict_types=1);
-use Rector\Config\RectorConfig;
use Neos\Rector\ContentRepository90\Rules\WorkspaceGetTitleRector;
+use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(WorkspaceGetTitleRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([WorkspaceGetTitleRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/WorkspacePublishNodeRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/WorkspacePublishNodeRector/Fixture/some_class.php.inc
index 30a8076..14617eb 100644
--- a/tests/ContentRepository90/Rules/WorkspacePublishNodeRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/WorkspacePublishNodeRector/Fixture/some_class.php.inc
@@ -23,7 +23,6 @@ class SomeClass
public function run(Workspace $workspace, NodeInterface $node)
{
// TODO 9.0 migration: Check if this matches your requirements as this is not a 100% replacement. Make this code aware of multiple Content Repositories.
-
$this->workspacePublishingService->publishChangesInDocument(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, $node);
}
}
diff --git a/tests/ContentRepository90/Rules/WorkspacePublishNodeRector/WorkspacePublishNodeRectorTest.php b/tests/ContentRepository90/Rules/WorkspacePublishNodeRector/WorkspacePublishNodeRectorTest.php
index 026d6b8..7c1cd17 100644
--- a/tests/ContentRepository90/Rules/WorkspacePublishNodeRector/WorkspacePublishNodeRectorTest.php
+++ b/tests/ContentRepository90/Rules/WorkspacePublishNodeRector/WorkspacePublishNodeRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceGetNameRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspacePublishNodeRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class WorkspacePublishNodeRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/WorkspacePublishNodeRector/config/configured_rule.php b/tests/ContentRepository90/Rules/WorkspacePublishNodeRector/config/configured_rule.php
index 6d21776..89fea93 100644
--- a/tests/ContentRepository90/Rules/WorkspacePublishNodeRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/WorkspacePublishNodeRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\WorkspacePublishNodeRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(WorkspacePublishNodeRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([WorkspacePublishNodeRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/WorkspacePublishRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/WorkspacePublishRector/Fixture/some_class.php.inc
index 711d0da..901fce4 100644
--- a/tests/ContentRepository90/Rules/WorkspacePublishRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/WorkspacePublishRector/Fixture/some_class.php.inc
@@ -21,7 +21,6 @@ class SomeClass
public function run(Workspace $workspace)
{
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
-
$this->workspacePublishingService->publishWorkspace(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName);
}
}
diff --git a/tests/ContentRepository90/Rules/WorkspacePublishRector/WorkspacePublishRectorTest.php b/tests/ContentRepository90/Rules/WorkspacePublishRector/WorkspacePublishRectorTest.php
index b81720f..268ed83 100644
--- a/tests/ContentRepository90/Rules/WorkspacePublishRector/WorkspacePublishRectorTest.php
+++ b/tests/ContentRepository90/Rules/WorkspacePublishRector/WorkspacePublishRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceGetNameRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspacePublishRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class WorkspacePublishRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/WorkspacePublishRector/config/configured_rule.php b/tests/ContentRepository90/Rules/WorkspacePublishRector/config/configured_rule.php
index 7bd8914..37b92c0 100644
--- a/tests/ContentRepository90/Rules/WorkspacePublishRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/WorkspacePublishRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\WorkspacePublishRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(WorkspacePublishRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([WorkspacePublishRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector/Fixture/some_class.php.inc
index ef57124..69d6f85 100644
--- a/tests/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector/Fixture/some_class.php.inc
@@ -34,7 +34,6 @@ class SomeClass
{
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
// TODO 9.0 migration: remove ternary operator (...? 1 : 0 ) - unnecessary complexity
-
return $contentRepository->findWorkspaceByName(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($workspace)) !== null ? 1 : 0;
}
}
diff --git a/tests/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector/WorkspaceRepositoryCountByNameRectorTest.php b/tests/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector/WorkspaceRepositoryCountByNameRectorTest.php
index c4658e6..ea8d4ce 100644
--- a/tests/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector/WorkspaceRepositoryCountByNameRectorTest.php
+++ b/tests/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector/WorkspaceRepositoryCountByNameRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceRepositoryCountByNameRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class WorkspaceRepositoryCountByNameRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector/config/configured_rule.php b/tests/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector/config/configured_rule.php
index d7871db..628d9d5 100644
--- a/tests/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/WorkspaceRepositoryCountByNameRector/config/configured_rule.php
@@ -4,6 +4,6 @@
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(\Neos\Rector\ContentRepository90\Rules\WorkspaceRepositoryCountByNameRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([\Neos\Rector\ContentRepository90\Rules\WorkspaceRepositoryCountByNameRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector/Fixture/some_class.php.inc
index 8e8b084..ee78897 100644
--- a/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector/Fixture/some_class.php.inc
@@ -14,7 +14,7 @@ class SomeClass extends AnotherClass
public function findWorkspace($workspaceIdentifier)
{
- $workspace = $this->workspaceRepository->findByIdentifier($workspaceIdentifier);
+ $dependentWorkspaces = $this->workspaceRepository->findByBaseWorkspace($workspaceIdentifier);
}
}
@@ -35,9 +35,10 @@ class SomeClass extends AnotherClass
public function findWorkspace($workspaceIdentifier)
{
+
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
- $workspace = $contentRepository->findWorkspaceByName(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($workspaceIdentifier));
+ $dependentWorkspaces = $contentRepository->findWorkspaces()->getDependantWorkspaces(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($workspaceIdentifier));
}
}
diff --git a/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector/WorkspaceRepositoryFindByBaseWorkspaceRectorTest.php b/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector/WorkspaceRepositoryFindByBaseWorkspaceRectorTest.php
similarity index 68%
rename from tests/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector/WorkspaceRepositoryFindByBaseWorkspaceRectorTest.php
rename to tests/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector/WorkspaceRepositoryFindByBaseWorkspaceRectorTest.php
index 0b4cdfe..ba17e75 100644
--- a/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector/WorkspaceRepositoryFindByBaseWorkspaceRectorTest.php
+++ b/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector/WorkspaceRepositoryFindByBaseWorkspaceRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceRepositoryCountByNameRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceRepositoryFindByBaseWorkspaceRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class WorkspaceRepositoryFindByBaseWorkspaceRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector/config/configured_rule.php b/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector/config/configured_rule.php
index 3dea9d7..8fd9464 100644
--- a/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector/config/configured_rule.php
@@ -4,6 +4,6 @@
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(\Neos\Rector\ContentRepository90\Rules\WorkspaceRepositoryFindByIdentifierRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([\Neos\Rector\ContentRepository90\Rules\WorkspaceRepositoryFindByBaseWorkspaceRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector/Fixture/some_class.php.inc
index 3b92304..7f0ec19 100644
--- a/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector/Fixture/some_class.php.inc
@@ -14,7 +14,7 @@ class SomeClass extends AnotherClass
public function findWorkspace($workspaceIdentifier)
{
- $dependentWorkspaces = $this->workspaceRepository->findByBaseWorkspace($workspaceIdentifier);
+ $workspace = $this->workspaceRepository->findByIdentifier($workspaceIdentifier);
}
}
@@ -35,9 +35,10 @@ class SomeClass extends AnotherClass
public function findWorkspace($workspaceIdentifier)
{
+
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
- $dependentWorkspaces = $contentRepository->findWorkspaces()->getDependantWorkspaces(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($workspaceIdentifier));
+ $workspace = $contentRepository->findWorkspaceByName(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($workspaceIdentifier));
}
}
diff --git a/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector/WorkspaceRepositoryFindByIdentifierRectorTest.php b/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector/WorkspaceRepositoryFindByIdentifierRectorTest.php
similarity index 68%
rename from tests/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector/WorkspaceRepositoryFindByIdentifierRectorTest.php
rename to tests/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector/WorkspaceRepositoryFindByIdentifierRectorTest.php
index ec7a86c..7e88abe 100644
--- a/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByBaseWorkspaceRector/WorkspaceRepositoryFindByIdentifierRectorTest.php
+++ b/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector/WorkspaceRepositoryFindByIdentifierRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceRepositoryCountByNameRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceRepositoryFindByIdentifierRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class WorkspaceRepositoryFindByIdentifierRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector/config/configured_rule.php b/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector/config/configured_rule.php
index 23b315a..e045094 100644
--- a/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/WorkspaceRepositoryFindByIdentifierRector/config/configured_rule.php
@@ -4,6 +4,6 @@
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(\Neos\Rector\ContentRepository90\Rules\WorkspaceRepositoryFindByBaseWorkspaceRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([\Neos\Rector\ContentRepository90\Rules\WorkspaceRepositoryFindByIdentifierRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/WorkspaceSetDescriptionRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/WorkspaceSetDescriptionRector/Fixture/some_class.php.inc
index 252f7c1..555d7ad 100644
--- a/tests/ContentRepository90/Rules/WorkspaceSetDescriptionRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/WorkspaceSetDescriptionRector/Fixture/some_class.php.inc
@@ -8,6 +8,11 @@ class SomeClass
{
$workspace->setDescription("description");
}
+
+ public function get(Workspace $workspace)
+ {
+ return $workspace->setDescription("description");
+ }
}
?>
@@ -21,9 +26,14 @@ class SomeClass
public function run(Workspace $workspace)
{
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
-
$this->workspaceService->setWorkspaceDescription(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, \Neos\Neos\Domain\Model\WorkspaceDescription::fromString("description"));
}
+
+ public function get(Workspace $workspace)
+ {
+ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
+ return $this->workspaceService->setWorkspaceDescription(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, \Neos\Neos\Domain\Model\WorkspaceDescription::fromString("description"));
+ }
}
?>
diff --git a/tests/ContentRepository90/Rules/WorkspaceSetDescriptionRector/WorkspaceSetDescriptionRectorTest.php b/tests/ContentRepository90/Rules/WorkspaceSetDescriptionRector/WorkspaceSetDescriptionRectorTest.php
index b731fae..68f948f 100644
--- a/tests/ContentRepository90/Rules/WorkspaceSetDescriptionRector/WorkspaceSetDescriptionRectorTest.php
+++ b/tests/ContentRepository90/Rules/WorkspaceSetDescriptionRector/WorkspaceSetDescriptionRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceGetNameRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceSetDescriptionRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class WorkspaceSetDescriptionRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/WorkspaceSetDescriptionRector/config/configured_rule.php b/tests/ContentRepository90/Rules/WorkspaceSetDescriptionRector/config/configured_rule.php
index cf73aec..1c08a06 100644
--- a/tests/ContentRepository90/Rules/WorkspaceSetDescriptionRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/WorkspaceSetDescriptionRector/config/configured_rule.php
@@ -5,6 +5,6 @@
use Neos\Rector\ContentRepository90\Rules\WorkspaceSetDescriptionRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(WorkspaceSetDescriptionRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([WorkspaceSetDescriptionRector::class]);
+return $rectorConfig;
diff --git a/tests/ContentRepository90/Rules/WorkspaceSetTitleRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/WorkspaceSetTitleRector/Fixture/some_class.php.inc
index d05b372..7151d52 100644
--- a/tests/ContentRepository90/Rules/WorkspaceSetTitleRector/Fixture/some_class.php.inc
+++ b/tests/ContentRepository90/Rules/WorkspaceSetTitleRector/Fixture/some_class.php.inc
@@ -7,6 +7,18 @@ class SomeClass
public function run(Workspace $workspace)
{
$workspace->setTitle("title");
+ $bar = $workspace->setTitle("title");
+
+ $foo = $this->getWorkspace()->setTitle("title");
+ }
+
+ public function get(Workspace $workspace)
+ {
+ return $workspace->setTitle("title");
+ }
+
+ public function getWorkspace(): Workspace {
+ return Workspace::create('default');
}
}
@@ -21,8 +33,22 @@ class SomeClass
public function run(Workspace $workspace)
{
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
-
$this->workspaceService->setWorkspaceTitle(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, \Neos\Neos\Domain\Model\WorkspaceTitle::fromString("title"));
+ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
+ $bar = $this->workspaceService->setWorkspaceTitle(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, \Neos\Neos\Domain\Model\WorkspaceTitle::fromString("title"));
+
+ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
+ $foo = $this->workspaceService->setWorkspaceTitle(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $this->getWorkspace()->workspaceName, \Neos\Neos\Domain\Model\WorkspaceTitle::fromString("title"));
+ }
+
+ public function get(Workspace $workspace)
+ {
+ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
+ return $this->workspaceService->setWorkspaceTitle(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, \Neos\Neos\Domain\Model\WorkspaceTitle::fromString("title"));
+ }
+
+ public function getWorkspace(): Workspace {
+ return Workspace::create('default');
}
}
diff --git a/tests/ContentRepository90/Rules/WorkspaceSetTitleRector/WorkspaceSetTitleRectorTest.php b/tests/ContentRepository90/Rules/WorkspaceSetTitleRector/WorkspaceSetTitleRectorTest.php
index e8b3c3e..9251236 100644
--- a/tests/ContentRepository90/Rules/WorkspaceSetTitleRector/WorkspaceSetTitleRectorTest.php
+++ b/tests/ContentRepository90/Rules/WorkspaceSetTitleRector/WorkspaceSetTitleRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceGetNameRector;
+namespace Neos\Rector\Tests\ContentRepository90\Rules\WorkspaceSetTitleRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class WorkspaceSetTitleRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/ContentRepository90/Rules/WorkspaceSetTitleRector/config/configured_rule.php b/tests/ContentRepository90/Rules/WorkspaceSetTitleRector/config/configured_rule.php
index 6a26158..0eef368 100644
--- a/tests/ContentRepository90/Rules/WorkspaceSetTitleRector/config/configured_rule.php
+++ b/tests/ContentRepository90/Rules/WorkspaceSetTitleRector/config/configured_rule.php
@@ -5,6 +5,5 @@
use Neos\Rector\ContentRepository90\Rules\WorkspaceSetTitleRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->rule(WorkspaceSetTitleRector::class);
-};
+return RectorConfig::configure()
+ ->withRules([WorkspaceSetTitleRector::class]);
diff --git a/tests/ContentRepository90/Rules/YamlDimensionConfigRector/Fixture/SingleDimension1.yaml.inc b/tests/ContentRepository90/Rules/YamlDimensionConfigRector/Fixture/SingleDimension1.yaml.inc
deleted file mode 100644
index d7c24f4..0000000
--- a/tests/ContentRepository90/Rules/YamlDimensionConfigRector/Fixture/SingleDimension1.yaml.inc
+++ /dev/null
@@ -1,64 +0,0 @@
-# some YAML with comments
-Neos:
- ContentRepository:
- contentDimensions:
- language:
- label: 'Neos.Demo:Main:contentDimensions.language'
- icon: icon-language
- default: en_US
- defaultPreset: en_US
- presets:
- en_US:
- label: 'English (US)'
- values:
- - en_US
- # The default preset can also have an empty uriSegment value.
- # https://docs.neos.io/cms/manual/content-repository/content-dimensions#behind-the-scenes-routing
- uriSegment: en
- en_UK:
- label: 'English (UK)'
- values:
- - en_UK
- - en_US
- uriSegment: uk
- de:
- label: Deutsch
- values:
- - de
- uriSegment: de
-
------
-Neos:
- ContentRepositoryRegistry:
- contentRepositories:
- default:
- contentDimensions:
- language:
- label: 'Neos.Demo:Main:contentDimensions.language'
- icon: icon-language
- values:
- en_US:
- label: 'English (US)'
- specializations:
- en_UK:
- label: 'English (UK)'
- de:
- label: Deutsch
- Neos:
- sites:
- '*':
- contentDimensions:
- # defaultDimensionSpacePoint is used for the homepage (URL /)
- defaultDimensionSpacePoint:
- language: en_US
- resolver:
- factoryClassName: Neos\Neos\FrontendRouting\DimensionResolution\Resolver\UriPathResolverFactory
- options:
- segments:
- -
- dimensionIdentifier: language
- # dimensionValue => uriPathSegment (empty uriPathSegment allowed)
- dimensionValueMapping:
- en_US: en
- en_UK: uk
- de: de
diff --git a/tests/ContentRepository90/Rules/YamlDimensionConfigRector/Fixture/SingleDimension2.yaml.inc b/tests/ContentRepository90/Rules/YamlDimensionConfigRector/Fixture/SingleDimension2.yaml.inc
deleted file mode 100644
index 86e8570..0000000
--- a/tests/ContentRepository90/Rules/YamlDimensionConfigRector/Fixture/SingleDimension2.yaml.inc
+++ /dev/null
@@ -1,44 +0,0 @@
-# some YAML with comments
-Neos:
- ContentRepository:
- contentDimensions:
- language:
- label: 'Neos.Demo:Main:contentDimensions.language'
- icon: icon-language
- default: en_US
- defaultPreset: en_US
- presets:
- en_US:
- label: 'English (US)'
- uriSegment: en
- values:
- - en_US
-
------
-Neos:
- ContentRepositoryRegistry:
- contentRepositories:
- default:
- contentDimensions:
- language:
- label: 'Neos.Demo:Main:contentDimensions.language'
- icon: icon-language
- values:
- en_US:
- label: 'English (US)'
- Neos:
- sites:
- '*':
- contentDimensions:
- # defaultDimensionSpacePoint is used for the homepage (URL /)
- defaultDimensionSpacePoint:
- language: en_US
- resolver:
- factoryClassName: Neos\Neos\FrontendRouting\DimensionResolution\Resolver\UriPathResolverFactory
- options:
- segments:
- -
- dimensionIdentifier: language
- # dimensionValue => uriPathSegment (empty uriPathSegment allowed)
- dimensionValueMapping:
- en_US: en
diff --git a/tests/ContentRepository90/Rules/YamlDimensionConfigRector/Fixture/SingleDimension3.yaml.inc b/tests/ContentRepository90/Rules/YamlDimensionConfigRector/Fixture/SingleDimension3.yaml.inc
deleted file mode 100644
index ec18575..0000000
--- a/tests/ContentRepository90/Rules/YamlDimensionConfigRector/Fixture/SingleDimension3.yaml.inc
+++ /dev/null
@@ -1,40 +0,0 @@
-# some YAML with comments
-Neos:
- ContentRepository:
- contentDimensions:
- language:
- label: 'Neos.Demo:Main:contentDimensions.language'
- icon: icon-language
- default: en_US
- defaultPreset: en_US
- presets:
- en_US:
- label: 'English (US)'
- uriSegment: en
- # no values here, should produce error
-
------
-Neos:
- ContentRepositoryRegistry:
- contentRepositories:
- default:
- contentDimensions:
- # TODO: FIXME: For preset "en_US", did not find any dimension values underneath "values"
- language:
- label: 'Neos.Demo:Main:contentDimensions.language'
- icon: icon-language
- Neos:
- sites:
- '*':
- contentDimensions:
- # defaultDimensionSpacePoint is used for the homepage (URL /)
- defaultDimensionSpacePoint:
- language: en_US
- resolver:
- factoryClassName: Neos\Neos\FrontendRouting\DimensionResolution\Resolver\UriPathResolverFactory
- options:
- segments:
- -
- dimensionIdentifier: language
- # dimensionValue => uriPathSegment (empty uriPathSegment allowed)
- dimensionValueMapping: { }
diff --git a/tests/ContentRepository90/Rules/YamlDimensionConfigRector/Fixture/zz_NoDimensions.yaml.inc b/tests/ContentRepository90/Rules/YamlDimensionConfigRector/Fixture/zz_NoDimensions.yaml.inc
deleted file mode 100644
index c307762..0000000
--- a/tests/ContentRepository90/Rules/YamlDimensionConfigRector/Fixture/zz_NoDimensions.yaml.inc
+++ /dev/null
@@ -1,9 +0,0 @@
-# some YAML with comments
-Foo:
- bar: true
-baz: bla
------
-# some YAML with comments
-Foo:
- bar: true
-baz: bla
diff --git a/tests/ContentRepository90/Rules/YamlDimensionConfigRector/YamlDimensionConfigRectorTest.php b/tests/ContentRepository90/Rules/YamlDimensionConfigRector/YamlDimensionConfigRectorTest.php
deleted file mode 100644
index d4321ed..0000000
--- a/tests/ContentRepository90/Rules/YamlDimensionConfigRector/YamlDimensionConfigRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.yaml.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/YamlDimensionConfigRector/config/configured_rule.php b/tests/ContentRepository90/Rules/YamlDimensionConfigRector/config/configured_rule.php
deleted file mode 100644
index ad8b9ed..0000000
--- a/tests/ContentRepository90/Rules/YamlDimensionConfigRector/config/configured_rule.php
+++ /dev/null
@@ -1,16 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(\Neos\Rector\Core\YamlProcessing\YamlFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for yaml files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(Neos\Rector\ContentRepository90\Rules\YamlDimensionConfigRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/YamlRoutePartHandlerRector/Fixture/Routes.yaml.inc b/tests/ContentRepository90/Rules/YamlRoutePartHandlerRector/Fixture/Routes.yaml.inc
deleted file mode 100644
index 332bc17..0000000
--- a/tests/ContentRepository90/Rules/YamlRoutePartHandlerRector/Fixture/Routes.yaml.inc
+++ /dev/null
@@ -1,52 +0,0 @@
-- name: 'ATOM Package Feed'
- uriPattern: '{node}.atom'
- defaults:
- '@package': 'Neos.Neos'
- '@controller': 'Frontend\Node'
- '@action': 'show'
- '@format': 'atom'
- routeParts:
- 'node':
- handler: 'Neos\Neos\Routing\FrontendNodeRoutePartHandler'
--
- name: Preview
- uriPattern: neos/preview
- defaults:
- '@action': preview
- appendExceedingArguments: true
--
- name: 'Default Frontend'
- uriPattern: '{node}'
- routeParts:
- 'node':
- handler: 'Neos\Neos\Routing\FrontendNodeRoutePartHandlerInterface'
- options:
- uriPathSuffix: ''
- appendExceedingArguments: true
------
--
- name: 'ATOM Package Feed'
- uriPattern: '{node}.atom'
- defaults:
- '@package': Neos.Neos
- '@controller': Frontend\Node
- '@action': show
- '@format': atom
- routeParts:
- node:
- handler: Neos\Neos\FrontendRouting\FrontendNodeRoutePartHandlerInterface
--
- name: Preview
- uriPattern: neos/preview
- defaults:
- '@action': preview
- appendExceedingArguments: true
--
- name: 'Default Frontend'
- uriPattern: '{node}'
- routeParts:
- node:
- handler: Neos\Neos\FrontendRouting\FrontendNodeRoutePartHandlerInterface
- options:
- uriPathSuffix: ''
- appendExceedingArguments: true
diff --git a/tests/ContentRepository90/Rules/YamlRoutePartHandlerRector/YamlRoutePartHandlerRectorTest.php b/tests/ContentRepository90/Rules/YamlRoutePartHandlerRector/YamlRoutePartHandlerRectorTest.php
deleted file mode 100644
index 60160f9..0000000
--- a/tests/ContentRepository90/Rules/YamlRoutePartHandlerRector/YamlRoutePartHandlerRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.yaml.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/ContentRepository90/Rules/YamlRoutePartHandlerRector/config/configured_rule.php b/tests/ContentRepository90/Rules/YamlRoutePartHandlerRector/config/configured_rule.php
deleted file mode 100644
index 7c5d4d1..0000000
--- a/tests/ContentRepository90/Rules/YamlRoutePartHandlerRector/config/configured_rule.php
+++ /dev/null
@@ -1,17 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(\Neos\Rector\Core\YamlProcessing\YamlFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for yaml files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->rule(Neos\Rector\ContentRepository90\Rules\YamlRoutePartHandlerRector::class);
-};
diff --git a/tests/Core/YamlProcessing/YamlWithCommentsTest.php b/tests/Core/YamlProcessing/YamlWithCommentsTest.php
deleted file mode 100644
index de53274..0000000
--- a/tests/Core/YamlProcessing/YamlWithCommentsTest.php
+++ /dev/null
@@ -1,67 +0,0 @@
- [
- 'myValue' => 'foo',
- 'isAbstract' => true,
- 'isAbstract##' => YamlWithComments::comment( 'foo'),
- 'myValue2' => 'bla',
- ],
- 'Neos.Neos:Foo##' => YamlWithComments::comment("My commentMy commentMy\ncommentMy commentMy commentMy commentMy commentMy commentMy commentMy\ncommentMy commentMy commentMy commentMy commentMy commentMy commentMy commentMy commentMy comment"),
- ];
-
- $expected = <<assertEquals(trim($expected), trim(YamlWithComments::dump($x)));
- }
-
- /**
- * @test
- */
- public function yamlGenerationWithCommentsAndNumberKeys()
- {
- $x = [
- 'Neos.Neos:Foo' => [
- 'volumes' => [
- 'a',
- 'b',
- YamlWithComments::comment('Mein Kommentar'),
- 'c'
- ],
- ],
- ];
-
- $expected = <<assertEquals(trim($expected), trim(YamlWithComments::dump($x)));
- }
-}
diff --git a/tests/Generic/Rules/FusionFlowQueryNodePropertyToWarningCommentRector/Fixture/some_file.fusion.inc b/tests/Generic/Rules/FusionFlowQueryNodePropertyToWarningCommentRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index 7648c27..0000000
--- a/tests/Generic/Rules/FusionFlowQueryNodePropertyToWarningCommentRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,27 +0,0 @@
-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")}
-
- }
-}
------
-// 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")}
-
- }
-}
diff --git a/tests/Generic/Rules/FusionFlowQueryNodePropertyToWarningCommentRector/FusionFlowQueryNodePropertyToWarningCommentRectorTest.php b/tests/Generic/Rules/FusionFlowQueryNodePropertyToWarningCommentRector/FusionFlowQueryNodePropertyToWarningCommentRectorTest.php
deleted file mode 100644
index c374713..0000000
--- a/tests/Generic/Rules/FusionFlowQueryNodePropertyToWarningCommentRector/FusionFlowQueryNodePropertyToWarningCommentRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/Generic/Rules/FusionFlowQueryNodePropertyToWarningCommentRector/config/configured_rule.php b/tests/Generic/Rules/FusionFlowQueryNodePropertyToWarningCommentRector/config/configured_rule.php
deleted file mode 100644
index 2a330e2..0000000
--- a/tests/Generic/Rules/FusionFlowQueryNodePropertyToWarningCommentRector/config/configured_rule.php
+++ /dev/null
@@ -1,23 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->ruleWithConfiguration(FusionFlowQueryNodePropertyToWarningCommentRector::class, [
- 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.'),
- new FusionFlowQueryNodePropertyToWarningComment('_contextPath', 'Line %LINE: !! 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.'),
- ]);
-};
diff --git a/tests/Generic/Rules/FusionNodePropertyPathToWarningCommentRector/Fixture/some_file.fusion.inc b/tests/Generic/Rules/FusionNodePropertyPathToWarningCommentRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index e463459..0000000
--- a/tests/Generic/Rules/FusionNodePropertyPathToWarningCommentRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,105 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${node.removed || site.removed || documentNode.hiddenBeforeDateTime}
- attributes2 = ${node.hiddenBeforeDateTime || site.hiddenBeforeDateTime || documentNode.removed}
- attributes3 = ${node.hiddenAfterDateTime || site.hiddenAfterDateTime || documentNode.hiddenAfterDateTime}
- attributes4 = ${node.foo.bar}
- attributes5 = ${node.fooXbar}
-
- #
- # 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`
-
-
-
- `
- }
-}
------
-// TODO 9.0 migration: Line 20: !! node.removed - the new CR *never* returns removed nodes; so you can simplify your code and just assume removed == FALSE in all scenarios.
-// TODO 9.0 migration: Line 21: !! node.removed - the new CR *never* returns removed nodes; so you can simplify your code and just assume removed == FALSE in all scenarios.
-// TODO 9.0 migration: Line 42: !! node.removed - the new CR *never* returns removed nodes; so you can simplify your code and just assume removed == FALSE in all scenarios.
-// TODO 9.0 migration: Line 54: !! node.removed - the new CR *never* returns removed nodes; so you can simplify your code and just assume removed == FALSE in all scenarios.
-// TODO 9.0 migration: Line 20: !! 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.
-// TODO 9.0 migration: Line 21: !! 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.
-// TODO 9.0 migration: Line 46: !! 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.
-// TODO 9.0 migration: Line 48: !! 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.
-// TODO 9.0 migration: Line 22: !! 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.
-// TODO 9.0 migration: Line 40: !! 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.
-// TODO 9.0 migration: Line 52: !! 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.
-// TODO 9.0 migration: Line 23: !! node.foo.bar is not supported anymore.
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- #
- # pass down props
- #
- attributes = ${node.removed || site.removed || documentNode.hiddenBeforeDateTime}
- attributes2 = ${node.hiddenBeforeDateTime || site.hiddenBeforeDateTime || documentNode.removed}
- attributes3 = ${node.hiddenAfterDateTime || site.hiddenAfterDateTime || documentNode.hiddenAfterDateTime}
- attributes4 = ${node.foo.bar}
- attributes5 = ${node.fooXbar}
-
- #
- # 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`
-
-
-
- `
- }
-}
diff --git a/tests/Generic/Rules/FusionNodePropertyPathToWarningCommentRector/FusionNodePropertyPathToWarningCommentRectorTest.php b/tests/Generic/Rules/FusionNodePropertyPathToWarningCommentRector/FusionNodePropertyPathToWarningCommentRectorTest.php
deleted file mode 100644
index 1229c23..0000000
--- a/tests/Generic/Rules/FusionNodePropertyPathToWarningCommentRector/FusionNodePropertyPathToWarningCommentRectorTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/Generic/Rules/FusionNodePropertyPathToWarningCommentRector/config/configured_rule.php b/tests/Generic/Rules/FusionNodePropertyPathToWarningCommentRector/config/configured_rule.php
deleted file mode 100644
index 3d458a7..0000000
--- a/tests/Generic/Rules/FusionNodePropertyPathToWarningCommentRector/config/configured_rule.php
+++ /dev/null
@@ -1,25 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $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.'),
- ]);
-};
diff --git a/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/primary1.fusion.inc b/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/primary1.fusion.inc
deleted file mode 100644
index 19c6aca..0000000
--- a/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/primary1.fusion.inc
+++ /dev/null
@@ -1,26 +0,0 @@
-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) {
-
-}
------
-// 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) {
-
-}
diff --git a/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/primary2.fusion.inc b/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/primary2.fusion.inc
deleted file mode 100644
index 9041b3b..0000000
--- a/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/primary2.fusion.inc
+++ /dev/null
@@ -1,8 +0,0 @@
-prototype(My.Evil:Component) < prototype(Neos.Neos:PrimaryContent) {
-
-}
------
-// TODO 9.0 migration: You need to refactor "Neos.Neos:PrimaryContent" to use "Neos.Neos:ContentCollection" instead.
-prototype(My.Evil:Component) < prototype(Neos.Neos:PrimaryContent) {
-
-}
diff --git a/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/some_file.fusion.inc b/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index d5c6d0c..0000000
--- a/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,33 +0,0 @@
-prototype(Neos.Neos:SomethingOld) < prototype(Neos.Neos:Raw) {
-
- foo = Neos.Neos:Foo
-
- renderer = Neos.Neos:Raw {
-
- old = Neos.Neos:SomethingOld
-
- renderer = afx`
-
-
-
- `
- }
-}
------
-// Neos.Neos:Raw: Add this comment to top of file.
-// Neos.Neos:Foo: Add this comment to top of file.
-prototype(Neos.Neos:SomethingOld) < prototype(Neos.Neos:Raw) {
-
- foo = Neos.Neos:Foo
-
- renderer = Neos.Neos:Raw {
-
- old = Neos.Neos:SomethingOld
-
- renderer = afx`
-
-
-
- `
- }
-}
diff --git a/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/FusionPrototypeNameCommentTest.php b/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/FusionPrototypeNameCommentTest.php
deleted file mode 100644
index 06aad40..0000000
--- a/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/FusionPrototypeNameCommentTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/config/configured_rule.php b/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/config/configured_rule.php
deleted file mode 100644
index b9b780f..0000000
--- a/tests/Generic/Rules/FusionPrototypeNameAddCommentRector/config/configured_rule.php
+++ /dev/null
@@ -1,25 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->ruleWithConfiguration(FusionPrototypeNameAddCommentRector::class, [
- new FusionPrototypeNameAddComment('Neos.Neos:Raw', 'Neos.Neos:Raw: Add this comment to top of file.'),
- new FusionPrototypeNameAddComment('Neos.Neos:Foo', 'Neos.Neos:Foo: Add this comment to top of file.'),
- new FusionPrototypeNameAddComment('Neos.Neos:Bar', 'Neos.Neos:Bar: Add this comment NOT to top of file.'),
- new FusionPrototypeNameAddComment('Neos.Neos:PrimaryContent', 'TODO 9.0 migration: You need to refactor "Neos.Neos:PrimaryContent" to use "Neos.Neos:ContentCollection" instead.'),
- ]);
-};
diff --git a/tests/Generic/Rules/FusionReplacePrototypeNameRector/Fixture/skip_prototype_definition.fusion.inc b/tests/Generic/Rules/FusionReplacePrototypeNameRector/Fixture/skip_prototype_definition.fusion.inc
deleted file mode 100644
index e8899e0..0000000
--- a/tests/Generic/Rules/FusionReplacePrototypeNameRector/Fixture/skip_prototype_definition.fusion.inc
+++ /dev/null
@@ -1,17 +0,0 @@
-prototype(Neos.Neos:Foo) < prototype(Neos.Neos:Bar) {
-
- raw = Neos.Neos:Foo
- renderer = afx`
-
- `
-}
------
-// 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:FooReplaced
- renderer = afx`
-
- `
-}
diff --git a/tests/Generic/Rules/FusionReplacePrototypeNameRector/Fixture/some_file.fusion.inc b/tests/Generic/Rules/FusionReplacePrototypeNameRector/Fixture/some_file.fusion.inc
deleted file mode 100644
index a3ded36..0000000
--- a/tests/Generic/Rules/FusionReplacePrototypeNameRector/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,37 +0,0 @@
-prototype(Neos.Neos:SomethingOld) < prototype(Neos.Neos:Raw) {
-
- raw = Neos.Neos:Raw
- rawer = Neos.Neos:Rawer
-
- renderer = Neos.Neos:Raw {
-
- old = Neos.Neos:SomethingOld
- older = Neos.Neos:SomethingOlder
-
- renderer = afx`
-
-
-
- `
- }
-}
------
-// TODO 9.0 migration: Neos.Neos:Raw: This comment should be added on top of the file.
-// TODO 9.0 migration: Neos.Neos:SomethingOlder: This comment should be added on top of the file.
-prototype(Neos.Neos:SomethingNew) < prototype(Neos.Neos:NewRaw) {
-
- raw = Neos.Neos:NewRaw
- rawer = Neos.Neos:Rawer
-
- renderer = Neos.Neos:NewRaw {
-
- old = Neos.Neos:SomethingNew
- older = Neos.Neos:SomethingNewer
-
- renderer = afx`
-
-
-
- `
- }
-}
diff --git a/tests/Generic/Rules/FusionReplacePrototypeNameRector/FusionPrototypeNameReplacementTest.php b/tests/Generic/Rules/FusionReplacePrototypeNameRector/FusionPrototypeNameReplacementTest.php
deleted file mode 100644
index b958371..0000000
--- a/tests/Generic/Rules/FusionReplacePrototypeNameRector/FusionPrototypeNameReplacementTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/Generic/Rules/FusionReplacePrototypeNameRector/config/configured_rule.php b/tests/Generic/Rules/FusionReplacePrototypeNameRector/config/configured_rule.php
deleted file mode 100644
index 0dde646..0000000
--- a/tests/Generic/Rules/FusionReplacePrototypeNameRector/config/configured_rule.php
+++ /dev/null
@@ -1,27 +0,0 @@
-services();
- $services->defaults()
- ->public()
- ->autowire()
- ->autoconfigure();
- $services->set(FusionFileProcessor::class);
- $rectorConfig->disableParallel(); // does not work for fusion files - see https://github.com/rectorphp/rector-src/pull/2597#issuecomment-1190120688
-
- $rectorConfig->ruleWithConfiguration(FusionReplacePrototypeNameRector::class, [
- new FusionPrototypeNameReplacement('Neos.Neos:Raw', 'Neos.Neos:NewRaw', 'Neos.Neos:Raw: This comment should be added on top of the file.'),
- new FusionPrototypeNameReplacement('Neos.Neos:NotExisting', 'Neos.Neos:NewNotExisting', 'Neos.Neos:NotExisting: This comment should NOT be added on top of the file.'),
- new FusionPrototypeNameReplacement('Neos.Neos:SomethingOld', 'Neos.Neos:SomethingNew'),
- new FusionPrototypeNameReplacement('Neos.Neos:SomethingOlder', 'Neos.Neos:SomethingNewer', 'Neos.Neos:SomethingOlder: This comment should be added on top of the file.'),
- new FusionPrototypeNameReplacement('Neos.Neos:Foo', 'Neos.Neos:FooReplaced', 'Neos.Neos:FooReplaced: This comment should be added on top of the file.', true),
- new FusionPrototypeNameReplacement('Neos.Neos:Bar', 'Neos.Neos:BarReplaced', 'Neos.Neos:BarReplaced: This comment should be added on top of the file.', true),
- ]);
-};
diff --git a/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/needs_both.php.inc b/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/needs_both.php.inc
index c561c44..07baac7 100644
--- a/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/needs_both.php.inc
+++ b/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/needs_both.php.inc
@@ -1,10 +1,10 @@
contentRepositoryRegistry->subgraphForNode($node);
$currentRenderingMode = $this->renderingModeService->findByCurrentUser();
@@ -15,7 +15,7 @@ class SomeClass
-----
contentRepositoryRegistry->subgraphForNode($node);
$currentRenderingMode = $this->renderingModeService->findByCurrentUser();
diff --git a/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/needs_content_repository_registry.php.inc b/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/needs_content_repository_registry.php.inc
index 25bf258..8f7f086 100644
--- a/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/needs_content_repository_registry.php.inc
+++ b/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/needs_content_repository_registry.php.inc
@@ -1,10 +1,10 @@
contentRepositoryRegistry->subgraphForNode($node);
}
@@ -14,13 +14,13 @@ class SomeClass
-----
contentRepositoryRegistry->subgraphForNode($node);
}
diff --git a/tests/Generic/Rules/InjectServiceIfNeededRector/InjectServiceIfNeededRectorTest.php b/tests/Generic/Rules/InjectServiceIfNeededRector/InjectServiceIfNeededRectorTest.php
index f32b892..7327092 100644
--- a/tests/Generic/Rules/InjectServiceIfNeededRector/InjectServiceIfNeededRectorTest.php
+++ b/tests/Generic/Rules/InjectServiceIfNeededRector/InjectServiceIfNeededRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\Generic\Rules\InjectContentRepositoryRegistryIfNeededRector;
+namespace Neos\Rector\Tests\Generic\Rules\InjectServiceIfNeededRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class InjectServiceIfNeededRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Generic/Rules/InjectServiceIfNeededRector/config/configured_rule.php b/tests/Generic/Rules/InjectServiceIfNeededRector/config/configured_rule.php
index bf064b1..c87af1a 100644
--- a/tests/Generic/Rules/InjectServiceIfNeededRector/config/configured_rule.php
+++ b/tests/Generic/Rules/InjectServiceIfNeededRector/config/configured_rule.php
@@ -1,17 +1,18 @@
ruleWithConfiguration(InjectServiceIfNeededRector::class, [
- new AddInjection('contentRepositoryRegistry', ContentRepositoryRegistry::class),
- new AddInjection('renderingModeService', RenderingModeService::class),
- ]);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withConfiguredRule(InjectServiceIfNeededRector::class, [
+ new AddInjection('contentRepositoryRegistry', ContentRepositoryRegistry::class),
+ new AddInjection('renderingModeService', RenderingModeService::class),
+]);
+return $rectorConfig;
diff --git a/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/Fixture/new-object-fqcn.php.inc b/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/Fixture/new-object-fqcn.php.inc
index 98736fe..4eddc49 100644
--- a/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/Fixture/new-object-fqcn.php.inc
+++ b/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/Fixture/new-object-fqcn.php.inc
@@ -21,7 +21,6 @@ class Package extends BasePackage
public function boot()
{
// TODO 9.0 migration: This is a comment
-
$myComment = new \My\Class\To\Comment();
}
}
diff --git a/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/Fixture/new-object-nested.php.inc b/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/Fixture/new-object-nested.php.inc
index 7e73f1e..f66224e 100644
--- a/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/Fixture/new-object-nested.php.inc
+++ b/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/Fixture/new-object-nested.php.inc
@@ -23,7 +23,6 @@ class Package extends BasePackage
public function boot()
{
// TODO 9.0 migration: This is a comment
-
$author = (new Comment(['author']))->getAutor();
}
}
diff --git a/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/Fixture/new-object.php.inc b/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/Fixture/new-object.php.inc
index 7e4a20b..8e34832 100644
--- a/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/Fixture/new-object.php.inc
+++ b/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/Fixture/new-object.php.inc
@@ -23,7 +23,6 @@ class Package extends BasePackage
public function boot()
{
// TODO 9.0 migration: This is a comment
-
$myComment = new Comment();
}
}
diff --git a/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/ObjectInstantiationToWarningCommentRectorTest.php b/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/ObjectInstantiationToWarningCommentRectorTest.php
index a9d0a81..a74e719 100644
--- a/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/ObjectInstantiationToWarningCommentRectorTest.php
+++ b/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/ObjectInstantiationToWarningCommentRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\Generic\Rules\ToStringToPropertyFetchRector;
+namespace Neos\Rector\Tests\Generic\Rules\ObjectInstantiationToWarningCommentRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class ObjectInstantiationToWarningCommentRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/config/configured_rule.php b/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/config/configured_rule.php
index 8fe4b6e..3286c1b 100644
--- a/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/config/configured_rule.php
+++ b/tests/Generic/Rules/ObjectInstantiationToWarningCommentRector/config/configured_rule.php
@@ -6,8 +6,8 @@
use Neos\Rector\Generic\ValueObject\ObjectInstantiationToWarningComment;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig): void {
- $rectorConfig->ruleWithConfiguration(ObjectInstantiationToWarningCommentRector::class, [
- new ObjectInstantiationToWarningComment(\My\Class\To\Comment::class, 'This is a comment'),
- ]);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withConfiguredRule(ObjectInstantiationToWarningCommentRector::class, [
+ new ObjectInstantiationToWarningComment(\My\Class\To\Comment::class, 'This is a comment'),
+]);
+return $rectorConfig;
diff --git a/tests/Generic/Rules/RemoveDuplicateCommentRector/Fixture/some_class.php.inc b/tests/Generic/Rules/RemoveDuplicateCommentRector/Fixture/some_class.php.inc
deleted file mode 100644
index 125684d..0000000
--- a/tests/Generic/Rules/RemoveDuplicateCommentRector/Fixture/some_class.php.inc
+++ /dev/null
@@ -1,18 +0,0 @@
-
------
-
diff --git a/tests/Generic/Rules/RemoveDuplicateCommentRector/RemoveDuplicateCommentRector.php b/tests/Generic/Rules/RemoveDuplicateCommentRector/RemoveDuplicateCommentRector.php
deleted file mode 100644
index c57735e..0000000
--- a/tests/Generic/Rules/RemoveDuplicateCommentRector/RemoveDuplicateCommentRector.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/Generic/Rules/RemoveDuplicateCommentRector/config/configured_rule.php b/tests/Generic/Rules/RemoveDuplicateCommentRector/config/configured_rule.php
deleted file mode 100644
index 945aa5c..0000000
--- a/tests/Generic/Rules/RemoveDuplicateCommentRector/config/configured_rule.php
+++ /dev/null
@@ -1,8 +0,0 @@
-rule(\Neos\Rector\Generic\Rules\RemoveDuplicateCommentRector::class);
-};
diff --git a/tests/Generic/Rules/RemoveInjectionsRector/Fixture/some_class.php.inc b/tests/Generic/Rules/RemoveInjectionsRector/Fixture/some_class.php.inc
index d5ce93a..2e0d3ab 100644
--- a/tests/Generic/Rules/RemoveInjectionsRector/Fixture/some_class.php.inc
+++ b/tests/Generic/Rules/RemoveInjectionsRector/Fixture/some_class.php.inc
@@ -12,13 +12,13 @@ class SomeClass
protected $foo = null;
/**
- * @var Baz;
+ * @var Baz
*/
protected $foo2 = null;
/**
* @Flow\Inject
- * @var Baz;
+ * @var Baz
*/
protected $foo3 = null;
@@ -41,7 +41,7 @@ use Neos\Flow\Annotations as Flow;
class SomeClass
{
/**
- * @var Baz;
+ * @var Baz
*/
protected $foo2 = null;
diff --git a/tests/Generic/Rules/RemoveInjectionsRector/RemoveInjectionsRectorTest.php b/tests/Generic/Rules/RemoveInjectionsRector/RemoveInjectionsRectorTest.php
index a684ca3..e00a6ca 100644
--- a/tests/Generic/Rules/RemoveInjectionsRector/RemoveInjectionsRectorTest.php
+++ b/tests/Generic/Rules/RemoveInjectionsRector/RemoveInjectionsRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\Generic\Rules\RemoveInjectionsRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class RemoveInjectionsRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Generic/Rules/RemoveInjectionsRector/config/configured_rule.php b/tests/Generic/Rules/RemoveInjectionsRector/config/configured_rule.php
index 47d32c4..24edf7b 100644
--- a/tests/Generic/Rules/RemoveInjectionsRector/config/configured_rule.php
+++ b/tests/Generic/Rules/RemoveInjectionsRector/config/configured_rule.php
@@ -5,8 +5,9 @@
use Neos\Rector\Generic\Rules\RemoveInjectionsRector;
use Neos\Rector\Generic\ValueObject\RemoveInjection;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->ruleWithConfiguration(RemoveInjectionsRector::class, [
+
+return RectorConfig::configure()
+ ->withConfiguredRule(RemoveInjectionsRector::class, [
new RemoveInjection(\Foo\Bar\Baz::class)
]);
-};
+
diff --git a/tests/Generic/Rules/RemoveParentClassRector/RemoveParentClassRectorTest.php b/tests/Generic/Rules/RemoveParentClassRector/RemoveParentClassRectorTest.php
index 32e3430..5757b9f 100644
--- a/tests/Generic/Rules/RemoveParentClassRector/RemoveParentClassRectorTest.php
+++ b/tests/Generic/Rules/RemoveParentClassRector/RemoveParentClassRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\Rules\RemoveParentClassRector;
+namespace Neos\Rector\Tests\Generic\Rules\RemoveParentClassRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class RemoveParentClassRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Generic/Rules/RemoveParentClassRector/config/configured_rule.php b/tests/Generic/Rules/RemoveParentClassRector/config/configured_rule.php
index 20736b1..fd7de31 100644
--- a/tests/Generic/Rules/RemoveParentClassRector/config/configured_rule.php
+++ b/tests/Generic/Rules/RemoveParentClassRector/config/configured_rule.php
@@ -5,8 +5,9 @@
use Neos\Rector\Generic\Rules\RemoveParentClassRector;
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::class, '// TODO: Neos 9.0 Migration: Stuff')
- ]);
-};
+
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withConfiguredRule(RemoveParentClassRector::class, [
+ new RemoveParentClass(\Foo\Bar\Baz::class, '// TODO: Neos 9.0 Migration: Stuff')
+]);
+return $rectorConfig;
diff --git a/tests/Generic/Rules/SignalSlotToWarningCommentRector/Fixture/some_class.php.inc b/tests/Generic/Rules/SignalSlotToWarningCommentRector/Fixture/some_class.php.inc
index fa40b54..3bba80a 100644
--- a/tests/Generic/Rules/SignalSlotToWarningCommentRector/Fixture/some_class.php.inc
+++ b/tests/Generic/Rules/SignalSlotToWarningCommentRector/Fixture/some_class.php.inc
@@ -3,7 +3,7 @@
use Neos\Flow\Core\Bootstrap;
use Neos\Flow\Package\Package as BasePackage;
use Neos\Flow\SignalSlot\Dispatcher;
-use Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub;
+use Neos\ContentRepository\Domain\Model\Node;
class Package extends BasePackage
{
@@ -13,21 +13,21 @@ class Package extends BasePackage
$dispatcher = $bootstrap->getSignalSlotDispatcher();
$dispatcher->connect(
- NodeLegacyStub::class,
+ Node::class,
'beforeMove',
SomeOtherClass::class,
'someMethod'
);
$dispatcher->connect(
- 'Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub',
+ 'Neos\ContentRepository\Domain\Model\Node',
'afterMove',
SomeOtherClass::class,
'someMethod'
);
$dispatcher->connect(
- NodeLegacyStub::class,
+ Node::class,
'otherMethod',
SomeOtherClass::class,
'someMethod'
@@ -49,7 +49,7 @@ class Package extends BasePackage
use Neos\Flow\Core\Bootstrap;
use Neos\Flow\Package\Package as BasePackage;
use Neos\Flow\SignalSlot\Dispatcher;
-use Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub;
+use Neos\ContentRepository\Domain\Model\Node;
class Package extends BasePackage
{
@@ -57,27 +57,25 @@ class Package extends BasePackage
{
/** @var Dispatcher $dispatcher */
$dispatcher = $bootstrap->getSignalSlotDispatcher();
- // TODO 9.0 migration: Signal "beforeMove" doesn't exist anymore
-
+ // TODO 9.0 migration: Signal "beforeMove" doesn't exist anymore
$dispatcher->connect(
- NodeLegacyStub::class,
+ Node::class,
'beforeMove',
SomeOtherClass::class,
'someMethod'
);
- // TODO 9.0 migration: Signal "afterMove" doesn't exist anymore
-
+ // TODO 9.0 migration: Signal "afterMove" doesn't exist anymore
$dispatcher->connect(
- 'Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub',
+ 'Neos\ContentRepository\Domain\Model\Node',
'afterMove',
SomeOtherClass::class,
'someMethod'
);
$dispatcher->connect(
- NodeLegacyStub::class,
+ Node::class,
'otherMethod',
SomeOtherClass::class,
'someMethod'
diff --git a/tests/Generic/Rules/SignalSlotToWarningCommentRector/SignalSlotToWarningCommentRectorTest.php b/tests/Generic/Rules/SignalSlotToWarningCommentRector/SignalSlotToWarningCommentRectorTest.php
index d0babec..44d4915 100644
--- a/tests/Generic/Rules/SignalSlotToWarningCommentRector/SignalSlotToWarningCommentRectorTest.php
+++ b/tests/Generic/Rules/SignalSlotToWarningCommentRector/SignalSlotToWarningCommentRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\Generic\Rules\ToStringToPropertyFetchRector;
+namespace Neos\Rector\Tests\Generic\Rules\SignalSlotToWarningCommentRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class SignalSlotToWarningCommentRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Generic/Rules/SignalSlotToWarningCommentRector/config/configured_rule.php b/tests/Generic/Rules/SignalSlotToWarningCommentRector/config/configured_rule.php
index af98d4e..777e535 100644
--- a/tests/Generic/Rules/SignalSlotToWarningCommentRector/config/configured_rule.php
+++ b/tests/Generic/Rules/SignalSlotToWarningCommentRector/config/configured_rule.php
@@ -6,9 +6,9 @@
use Neos\Rector\Generic\ValueObject\SignalSlotToWarningComment;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->ruleWithConfiguration(SignalSlotToWarningCommentRector::class, [
- new SignalSlotToWarningComment(Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class, 'beforeMove', 'Signal "beforeMove" doesn\'t exist anymore'),
- new SignalSlotToWarningComment(Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class, 'afterMove', 'Signal "afterMove" doesn\'t exist anymore'),
- ]);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withConfiguredRule(SignalSlotToWarningCommentRector::class, [
+ new SignalSlotToWarningComment(Neos\ContentRepository\Domain\Model\Node::class, 'beforeMove', 'Signal "beforeMove" doesn\'t exist anymore'),
+ new SignalSlotToWarningComment(Neos\ContentRepository\Domain\Model\Node::class, 'afterMove', 'Signal "afterMove" doesn\'t exist anymore'),
+]);
+return $rectorConfig;
diff --git a/tests/Generic/Rules/ToStringToMethodCallOrPropertyFetchRector/ToStringToMethodCallOrPropertyFetchRectorTest.php b/tests/Generic/Rules/ToStringToMethodCallOrPropertyFetchRector/ToStringToMethodCallOrPropertyFetchRectorTest.php
index a6ec114..84d40ba 100644
--- a/tests/Generic/Rules/ToStringToMethodCallOrPropertyFetchRector/ToStringToMethodCallOrPropertyFetchRectorTest.php
+++ b/tests/Generic/Rules/ToStringToMethodCallOrPropertyFetchRector/ToStringToMethodCallOrPropertyFetchRectorTest.php
@@ -2,15 +2,14 @@
declare(strict_types=1);
-namespace Neos\Rector\Tests\Generic\Rules\ToStringToPropertyFetchRector;
+namespace Neos\Rector\Tests\Generic\Rules\ToStringToMethodCallOrPropertyFetchRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class ToStringToMethodCallOrPropertyFetchRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Generic/Rules/ToStringToMethodCallOrPropertyFetchRector/config/configured_rule.php b/tests/Generic/Rules/ToStringToMethodCallOrPropertyFetchRector/config/configured_rule.php
index 74d577d..7febec6 100644
--- a/tests/Generic/Rules/ToStringToMethodCallOrPropertyFetchRector/config/configured_rule.php
+++ b/tests/Generic/Rules/ToStringToMethodCallOrPropertyFetchRector/config/configured_rule.php
@@ -5,9 +5,9 @@
use Neos\Rector\Generic\Rules\ToStringToMethodCallOrPropertyFetchRector;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->ruleWithConfiguration(ToStringToMethodCallOrPropertyFetchRector::class, [
- 'SomeObject' => 'methodName()',
- 'SomeOtherObject' => 'propertyName',
- ]);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withConfiguredRule(ToStringToMethodCallOrPropertyFetchRector::class, [
+ 'SomeObject' => 'methodName()',
+ 'SomeOtherObject' => 'propertyName',
+]);
+return $rectorConfig;
diff --git a/tests/Rules/AnnotationToAttributeRector/AnnotationToAttributeTest.php b/tests/Rules/AnnotationToAttributeRector/AnnotationToAttributeTest.php
deleted file mode 100644
index 1483174..0000000
--- a/tests/Rules/AnnotationToAttributeRector/AnnotationToAttributeTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/config/configured_rule.php';
- }
-}
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/aspect.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/aspect.php.inc
deleted file mode 100644
index 8f0b5a4..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/aspect.php.inc
+++ /dev/null
@@ -1,87 +0,0 @@
-getPublicPackageResourceUri())")
- */
- public function around(JoinPointInterface $joinPoint)
- {
- }
- /**
- * @Flow\Before("method(Neos\Flow\ResourceManagement\ResourceManager->getPublicPackageResourceUri())")
- */
- public function before(JoinPointInterface $joinPoint)
- {
- }
- /**
- * @Flow\AfterReturning("method(Neos\Flow\ResourceManagement\ResourceManager->getPublicPackageResourceUri())")
- */
- public function afterReturning(JoinPointInterface $joinPoint)
- {
- }
- /**
- * @Flow\AfterThrowing("method(Neos\Flow\ResourceManagement\ResourceManager->getPublicPackageResourceUri())")
- */
- public function afterThrowing(JoinPointInterface $joinPoint)
- {
- }
- /**
- * @Flow\After("method(Neos\Flow\ResourceManagement\ResourceManager->getPublicPackageResourceUri())")
- */
- public function after(JoinPointInterface $joinPoint)
- {
- }
- /**
- * @Flow\Pointcut("method(Neos\Flow\ResourceManagement\ResourceManager->getPublicPackageResourceUri())")
- */
- public function pointcut(PointcutFilterInterface $joinPoint)
- {
- }
-}
-
-?>
------
-getPublicPackageResourceUri())')]
- public function around(JoinPointInterface $joinPoint)
- {
- }
- #[Flow\Before('method(Neos\Flow\ResourceManagement\ResourceManager->getPublicPackageResourceUri())')]
- public function before(JoinPointInterface $joinPoint)
- {
- }
- #[Flow\AfterReturning('method(Neos\Flow\ResourceManagement\ResourceManager->getPublicPackageResourceUri())')]
- public function afterReturning(JoinPointInterface $joinPoint)
- {
- }
- #[Flow\AfterThrowing('method(Neos\Flow\ResourceManagement\ResourceManager->getPublicPackageResourceUri())')]
- public function afterThrowing(JoinPointInterface $joinPoint)
- {
- }
- #[Flow\After('method(Neos\Flow\ResourceManagement\ResourceManager->getPublicPackageResourceUri())')]
- public function after(JoinPointInterface $joinPoint)
- {
- }
- #[Flow\Pointcut('method(Neos\Flow\ResourceManagement\ResourceManager->getPublicPackageResourceUri())')]
- public function pointcut(PointcutFilterInterface $joinPoint)
- {
- }
-}
-
-?>
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/autowiring.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/autowiring.php.inc
deleted file mode 100644
index 6b2e5d3..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/autowiring.php.inc
+++ /dev/null
@@ -1,33 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/compilestatic.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/compilestatic.php.inc
deleted file mode 100644
index 5a42940..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/compilestatic.php.inc
+++ /dev/null
@@ -1,29 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/entity.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/entity.php.inc
deleted file mode 100644
index c5dc239..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/entity.php.inc
+++ /dev/null
@@ -1,23 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/entitywithrepository.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/entitywithrepository.php.inc
deleted file mode 100644
index 23d1d4d..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/entitywithrepository.php.inc
+++ /dev/null
@@ -1,23 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/flushescaches.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/flushescaches.php.inc
deleted file mode 100644
index 7fd8a44..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/flushescaches.php.inc
+++ /dev/null
@@ -1,29 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/identity.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/identity.php.inc
deleted file mode 100644
index 3aa9598..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/identity.php.inc
+++ /dev/null
@@ -1,25 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/ignorevalidation.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/ignorevalidation.php.inc
deleted file mode 100644
index d3c34ca..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/ignorevalidation.php.inc
+++ /dev/null
@@ -1,39 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/inject.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/inject.php.inc
deleted file mode 100644
index 7f8cdee..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/inject.php.inc
+++ /dev/null
@@ -1,27 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/injectconfiguration.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/injectconfiguration.php.inc
deleted file mode 100644
index ca375e0..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/injectconfiguration.php.inc
+++ /dev/null
@@ -1,25 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/internal.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/internal.php.inc
deleted file mode 100644
index 09a2784..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/internal.php.inc
+++ /dev/null
@@ -1,29 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/lazy.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/lazy.php.inc
deleted file mode 100644
index 7ed6414..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/lazy.php.inc
+++ /dev/null
@@ -1,29 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/maprequestbody.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/maprequestbody.php.inc
deleted file mode 100644
index 77d7d6b..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/maprequestbody.php.inc
+++ /dev/null
@@ -1,29 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/proxy.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/proxy.php.inc
deleted file mode 100644
index 7bd5402..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/proxy.php.inc
+++ /dev/null
@@ -1,23 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/scope.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/scope.php.inc
deleted file mode 100644
index c1b62fc..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/scope.php.inc
+++ /dev/null
@@ -1,23 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/session.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/session.php.inc
deleted file mode 100644
index 4590a5d..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/session.php.inc
+++ /dev/null
@@ -1,29 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/signal.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/signal.php.inc
deleted file mode 100644
index e15d869..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/signal.php.inc
+++ /dev/null
@@ -1,29 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/skipcsrfprotection.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/skipcsrfprotection.php.inc
deleted file mode 100644
index a0f23e1..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/skipcsrfprotection.php.inc
+++ /dev/null
@@ -1,29 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/transient.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/transient.php.inc
deleted file mode 100644
index 741908f..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/transient.php.inc
+++ /dev/null
@@ -1,25 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/validate.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/validate.php.inc
deleted file mode 100644
index 82cafe1..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/validate.php.inc
+++ /dev/null
@@ -1,39 +0,0 @@
-
------
- 0, 'maximum' => 40])]
- protected $foo;
-
- #[Flow\Validate(type: 'StringLength', options: ['minimum' => 0, 'maximum' => 40])]
- #[Flow\Validate(argumentName: 'resource', type: 'NotEmpty')]
- public function someAction(Resource $resource, string $resourceType = ''): void
- {
- }
-}
-
-?>
diff --git a/tests/Rules/AnnotationToAttributeRector/Fixture/value_object.php.inc b/tests/Rules/AnnotationToAttributeRector/Fixture/value_object.php.inc
deleted file mode 100644
index 2d87361..0000000
--- a/tests/Rules/AnnotationToAttributeRector/Fixture/value_object.php.inc
+++ /dev/null
@@ -1,23 +0,0 @@
-
------
-
diff --git a/tests/Rules/AnnotationToAttributeRector/config/configured_rule.php b/tests/Rules/AnnotationToAttributeRector/config/configured_rule.php
deleted file mode 100644
index 5a6f864..0000000
--- a/tests/Rules/AnnotationToAttributeRector/config/configured_rule.php
+++ /dev/null
@@ -1,11 +0,0 @@
-sets([
- \Neos\Rector\NeosRectorSets::ANNOTATIONS_TO_ATTRIBUTES
- ]);
-};
diff --git a/tests/Rules/ContextFactoryToLegacyContextStubRector/ContextFactoryToLegacyContextStubRectorTest.php b/tests/Rules/ContextFactoryToLegacyContextStubRector/ContextFactoryToLegacyContextStubRectorTest.php
index 4cfc39d..56a0841 100644
--- a/tests/Rules/ContextFactoryToLegacyContextStubRector/ContextFactoryToLegacyContextStubRectorTest.php
+++ b/tests/Rules/ContextFactoryToLegacyContextStubRector/ContextFactoryToLegacyContextStubRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\Rules\ContextFactoryToLegacyContextStubRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class ContextFactoryToLegacyContextStubRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Rules/ContextFactoryToLegacyContextStubRector/config/configured_rule.php b/tests/Rules/ContextFactoryToLegacyContextStubRector/config/configured_rule.php
index 62f4bf7..f087fe3 100644
--- a/tests/Rules/ContextFactoryToLegacyContextStubRector/config/configured_rule.php
+++ b/tests/Rules/ContextFactoryToLegacyContextStubRector/config/configured_rule.php
@@ -7,10 +7,10 @@
use Rector\Config\RectorConfig;
use Rector\Renaming\Rector\Name\RenameClassRector;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->rule(ContextFactoryToLegacyContextStubRector::class);
- $rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
- 'Neos\ContentRepository\Domain\Service\Context' => LegacyContextStub::class,
- 'Neos\Neos\Domain\Service\ContentContext' => LegacyContextStub::class,
- ]);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([ContextFactoryToLegacyContextStubRector::class]);
+$rectorConfig->withConfiguredRule(RenameClassRector::class, [
+ 'Neos\ContentRepository\Domain\Service\Context' => LegacyContextStub::class,
+ 'Neos\Neos\Domain\Service\ContentContext' => LegacyContextStub::class,
+]);
+return $rectorConfig;
diff --git a/tests/Rules/ContextGetRootNodeRector/ContextGetRootNodeRectorTest.php b/tests/Rules/ContextGetRootNodeRector/ContextGetRootNodeRectorTest.php
index 10c2c35..fd82ff9 100644
--- a/tests/Rules/ContextGetRootNodeRector/ContextGetRootNodeRectorTest.php
+++ b/tests/Rules/ContextGetRootNodeRector/ContextGetRootNodeRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\Rules\ContextGetRootNodeRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class ContextGetRootNodeRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Rules/ContextGetRootNodeRector/Fixture/some_class.php.inc b/tests/Rules/ContextGetRootNodeRector/Fixture/some_class.php.inc
index f403227..0bc0a74 100644
--- a/tests/Rules/ContextGetRootNodeRector/Fixture/some_class.php.inc
+++ b/tests/Rules/ContextGetRootNodeRector/Fixture/some_class.php.inc
@@ -20,6 +20,7 @@ class SomeClass
{
public function run(\Neos\Rector\ContentRepository90\Legacy\LegacyContextStub $context)
{
+
// TODO 9.0 migration: !! MEGA DIRTY CODE! Ensure to rewrite this; by getting rid of LegacyContextStub.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$workspace = $contentRepository->findWorkspaceByName(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($context->workspaceName ?? 'live'));
diff --git a/tests/Rules/ContextGetRootNodeRector/config/configured_rule.php b/tests/Rules/ContextGetRootNodeRector/config/configured_rule.php
index 57b001f..4ac41a9 100644
--- a/tests/Rules/ContextGetRootNodeRector/config/configured_rule.php
+++ b/tests/Rules/ContextGetRootNodeRector/config/configured_rule.php
@@ -1,12 +1,12 @@
rule(ContextGetRootNodeRector::class);
- $rectorConfig->rule(\Neos\Rector\Generic\Rules\RemoveDuplicateCommentRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([ContextGetRootNodeRector::class]);
+return $rectorConfig;
diff --git a/tests/Rules/MethodCallToWarningCommentRector/Fixture/some_class.php.inc b/tests/Rules/MethodCallToWarningCommentRector/Fixture/some_class.php.inc
index 284b0af..7286e24 100644
--- a/tests/Rules/MethodCallToWarningCommentRector/Fixture/some_class.php.inc
+++ b/tests/Rules/MethodCallToWarningCommentRector/Fixture/some_class.php.inc
@@ -1,10 +1,10 @@
getNode();
return $node->getWorkspace();
@@ -15,17 +15,15 @@ class SomeClass
-----
getNode();
// TODO 9.0 migration: !! 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.
-
return $node->getWorkspace();
}
}
diff --git a/tests/Rules/MethodCallToWarningCommentRector/MethodCallToWarningCommentRectorTest.php b/tests/Rules/MethodCallToWarningCommentRector/MethodCallToWarningCommentRectorTest.php
index 8b08f15..c6fb5f8 100644
--- a/tests/Rules/MethodCallToWarningCommentRector/MethodCallToWarningCommentRectorTest.php
+++ b/tests/Rules/MethodCallToWarningCommentRector/MethodCallToWarningCommentRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\Rules\MethodCallToWarningCommentRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class MethodCallToWarningCommentRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Rules/MethodCallToWarningCommentRector/config/configured_rule.php b/tests/Rules/MethodCallToWarningCommentRector/config/configured_rule.php
index a63a3a4..e8ea991 100644
--- a/tests/Rules/MethodCallToWarningCommentRector/config/configured_rule.php
+++ b/tests/Rules/MethodCallToWarningCommentRector/config/configured_rule.php
@@ -2,13 +2,14 @@
declare (strict_types=1);
-use Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub;
+use Neos\ContentRepository\Domain\Model\Node;
use Neos\Rector\Generic\Rules\MethodCallToWarningCommentRector;
use Neos\Rector\Generic\ValueObject\MethodCallToWarningComment;
use Rector\Config\RectorConfig;
-return static function (RectorConfig $rectorConfig) : void {
- $rectorConfig->ruleWithConfiguration(MethodCallToWarningCommentRector::class, [
- new MethodCallToWarningComment(NodeLegacyStub::class, '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.'),
- new MethodCallToWarningComment(NodeLegacyStub::class, 'getNode', '!! %%1$s::%%2$s() has been removed.'),
- ]);
-};
+
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withConfiguredRule(MethodCallToWarningCommentRector::class, [
+ new MethodCallToWarningComment(Node::class, '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.'),
+ new MethodCallToWarningComment(Node::class, 'getNode', '!! %1$s::%2$s() has been removed.'),
+]);
+return $rectorConfig;
diff --git a/tests/Rules/NodeGetChildNodesRector/Fixture/all-with-pagination-named-arguments.php.inc b/tests/Rules/NodeGetChildNodesRector/Fixture/all-with-pagination-named-arguments.php.inc
index 8ab3219..38e0a98 100644
--- a/tests/Rules/NodeGetChildNodesRector/Fixture/all-with-pagination-named-arguments.php.inc
+++ b/tests/Rules/NodeGetChildNodesRector/Fixture/all-with-pagination-named-arguments.php.inc
@@ -1,10 +1,10 @@
getChildNodes(offset: 100, limit: 10) as $node) {
}
@@ -15,15 +15,14 @@ class SomeClass
-----
contentRepositoryRegistry->subgraphForNode($node);
// TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call.
-
foreach (iterator_to_array($subgraph->findChildNodes($node->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter::create(pagination: ['limit' => 10, 'offset' => 100]))) as $node) {
}
}
diff --git a/tests/Rules/NodeGetChildNodesRector/Fixture/all-with-pagination.php.inc b/tests/Rules/NodeGetChildNodesRector/Fixture/all-with-pagination.php.inc
index 30f7dad..1fef9be 100644
--- a/tests/Rules/NodeGetChildNodesRector/Fixture/all-with-pagination.php.inc
+++ b/tests/Rules/NodeGetChildNodesRector/Fixture/all-with-pagination.php.inc
@@ -1,10 +1,10 @@
getChildNodes(null, 10,100) as $node) {
}
@@ -15,15 +15,14 @@ class SomeClass
-----
contentRepositoryRegistry->subgraphForNode($node);
// TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call.
-
foreach (iterator_to_array($subgraph->findChildNodes($node->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter::create(pagination: ['limit' => 10, 'offset' => 100]))) as $node) {
}
}
diff --git a/tests/Rules/NodeGetChildNodesRector/Fixture/all.php.inc b/tests/Rules/NodeGetChildNodesRector/Fixture/all.php.inc
index 075c2cd..80a5398 100644
--- a/tests/Rules/NodeGetChildNodesRector/Fixture/all.php.inc
+++ b/tests/Rules/NodeGetChildNodesRector/Fixture/all.php.inc
@@ -1,10 +1,10 @@
getChildNodes() as $node) {
}
@@ -15,15 +15,14 @@ class SomeClass
-----
contentRepositoryRegistry->subgraphForNode($node);
// TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call.
-
foreach (iterator_to_array($subgraph->findChildNodes($node->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter::create())) as $node) {
}
}
diff --git a/tests/Rules/NodeGetChildNodesRector/Fixture/nodetype-filter-with-pagination.php.inc b/tests/Rules/NodeGetChildNodesRector/Fixture/nodetype-filter-with-pagination.php.inc
index b3d5cbe..6d5c69e 100644
--- a/tests/Rules/NodeGetChildNodesRector/Fixture/nodetype-filter-with-pagination.php.inc
+++ b/tests/Rules/NodeGetChildNodesRector/Fixture/nodetype-filter-with-pagination.php.inc
@@ -1,10 +1,10 @@
getChildNodes('Neos.Neos:Document', 10, 100) as $node) {
}
@@ -15,15 +15,14 @@ class SomeClass
-----
contentRepositoryRegistry->subgraphForNode($node);
// TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call.
-
foreach (iterator_to_array($subgraph->findChildNodes($node->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter::create(nodeTypeConstraints: 'Neos.Neos:Document', pagination: ['limit' => 10, 'offset' => 100]))) as $node) {
}
}
diff --git a/tests/Rules/NodeGetChildNodesRector/Fixture/nodetype-filter.php.inc b/tests/Rules/NodeGetChildNodesRector/Fixture/nodetype-filter.php.inc
index 20ec2f3..b4283f9 100644
--- a/tests/Rules/NodeGetChildNodesRector/Fixture/nodetype-filter.php.inc
+++ b/tests/Rules/NodeGetChildNodesRector/Fixture/nodetype-filter.php.inc
@@ -1,10 +1,10 @@
getChildNodes('Neos.Neos:Document') as $node) {
}
@@ -15,15 +15,14 @@ class SomeClass
-----
contentRepositoryRegistry->subgraphForNode($node);
// TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call.
-
foreach (iterator_to_array($subgraph->findChildNodes($node->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter::create(nodeTypeConstraints: 'Neos.Neos:Document'))) as $node) {
}
}
diff --git a/tests/Rules/NodeGetChildNodesRector/NodeGetChildNodesRectorTest.php b/tests/Rules/NodeGetChildNodesRector/NodeGetChildNodesRectorTest.php
index ab5c460..859b307 100644
--- a/tests/Rules/NodeGetChildNodesRector/NodeGetChildNodesRectorTest.php
+++ b/tests/Rules/NodeGetChildNodesRector/NodeGetChildNodesRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\Rules\NodeGetChildNodesRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeGetChildNodesRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Rules/NodeGetChildNodesRector/config/configured_rule.php b/tests/Rules/NodeGetChildNodesRector/config/configured_rule.php
index 3111b94..a5e6398 100644
--- a/tests/Rules/NodeGetChildNodesRector/config/configured_rule.php
+++ b/tests/Rules/NodeGetChildNodesRector/config/configured_rule.php
@@ -1,10 +1,12 @@
rule(NodeGetChildNodesRector::class);
-};
+
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeGetChildNodesRector::class]);
+return $rectorConfig;
diff --git a/tests/Rules/NodeGetContextGetWorkspaceNameRector/Fixture/some_class.php.inc b/tests/Rules/NodeGetContextGetWorkspaceNameRector/Fixture/some_class.php.inc
index a599177..beeb93d 100644
--- a/tests/Rules/NodeGetContextGetWorkspaceNameRector/Fixture/some_class.php.inc
+++ b/tests/Rules/NodeGetContextGetWorkspaceNameRector/Fixture/some_class.php.inc
@@ -1,10 +1,10 @@
getContext()->getWorkspaceName();
}
@@ -14,11 +14,11 @@ class SomeClass
-----
workspaceName;
}
diff --git a/tests/Rules/NodeGetContextGetWorkspaceNameRector/NodeGetContextGetWorkspaceNameRectorTest.php b/tests/Rules/NodeGetContextGetWorkspaceNameRector/NodeGetContextGetWorkspaceNameRectorTest.php
index e180b7b..2f7c0ba 100644
--- a/tests/Rules/NodeGetContextGetWorkspaceNameRector/NodeGetContextGetWorkspaceNameRectorTest.php
+++ b/tests/Rules/NodeGetContextGetWorkspaceNameRector/NodeGetContextGetWorkspaceNameRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\Rules\NodeGetContextGetWorkspaceNameRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeGetContextGetWorkspaceNameRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Rules/NodeGetContextGetWorkspaceNameRector/config/configured_rule.php b/tests/Rules/NodeGetContextGetWorkspaceNameRector/config/configured_rule.php
index 60509c5..20811ce 100644
--- a/tests/Rules/NodeGetContextGetWorkspaceNameRector/config/configured_rule.php
+++ b/tests/Rules/NodeGetContextGetWorkspaceNameRector/config/configured_rule.php
@@ -1,10 +1,12 @@
rule(NodeGetContextGetWorkspaceNameRector::class);
-};
+
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeGetContextGetWorkspaceNameRector::class]);
+return $rectorConfig;
diff --git a/tests/Rules/NodeGetContextGetWorkspaceRector/Fixture/some_class.php.inc b/tests/Rules/NodeGetContextGetWorkspaceRector/Fixture/some_class.php.inc
index f1e2a01..71a67e4 100644
--- a/tests/Rules/NodeGetContextGetWorkspaceRector/Fixture/some_class.php.inc
+++ b/tests/Rules/NodeGetContextGetWorkspaceRector/Fixture/some_class.php.inc
@@ -1,11 +1,21 @@
node;
+ }
+
+ public function run(Node $node)
{
+ $workspace = $this->getNode()->getContext()->getWorkspace();
+
+ $workspace = $this->node->getContext()->getWorkspace();
+
return $node->getContext()->getWorkspace();
}
}
@@ -14,13 +24,25 @@ class SomeClass
-----
node;
+ }
+
+ public function run(Node $node)
{
+ $contentRepository = $this->contentRepositoryRegistry->get($this->getNode()->contentRepositoryId);
+ $workspace = $contentRepository->findWorkspaceByName($this->getNode()->workspaceName);
+ $contentRepository = $this->contentRepositoryRegistry->get($this->node->contentRepositoryId);
+
+ $workspace = $contentRepository->findWorkspaceByName($this->node->workspaceName);
$contentRepository = $this->contentRepositoryRegistry->get($node->contentRepositoryId);
+
return $contentRepository->findWorkspaceByName($node->workspaceName);
}
}
diff --git a/tests/Rules/NodeGetContextGetWorkspaceRector/NodeGetContextGetWorkspaceRectorTest.php b/tests/Rules/NodeGetContextGetWorkspaceRector/NodeGetContextGetWorkspaceRectorTest.php
index b2cea63..cbc0d1b 100644
--- a/tests/Rules/NodeGetContextGetWorkspaceRector/NodeGetContextGetWorkspaceRectorTest.php
+++ b/tests/Rules/NodeGetContextGetWorkspaceRector/NodeGetContextGetWorkspaceRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\Rules\NodeGetContextGetWorkspaceRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeGetContextGetWorkspaceRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Rules/NodeGetContextGetWorkspaceRector/config/configured_rule.php b/tests/Rules/NodeGetContextGetWorkspaceRector/config/configured_rule.php
index 0f853b9..4cda4fb 100644
--- a/tests/Rules/NodeGetContextGetWorkspaceRector/config/configured_rule.php
+++ b/tests/Rules/NodeGetContextGetWorkspaceRector/config/configured_rule.php
@@ -1,10 +1,12 @@
rule(NodeGetContextGetWorkspaceRector::class);
-};
+
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeGetContextGetWorkspaceRector::class]);
+return $rectorConfig;
diff --git a/tests/Rules/NodeGetDimensionsRector/Fixture/some_class.php.inc b/tests/Rules/NodeGetDimensionsRector/Fixture/some_class.php.inc
index 28ceab0..b66483f 100644
--- a/tests/Rules/NodeGetDimensionsRector/Fixture/some_class.php.inc
+++ b/tests/Rules/NodeGetDimensionsRector/Fixture/some_class.php.inc
@@ -1,11 +1,15 @@
getDimensions()[0];
+
+ $dimensions = MyFoo::do($node->getDimensions());
+
return $node->getDimensions();
}
}
@@ -14,14 +18,19 @@ class SomeClass
-----
originDimensionSpacePoint->toLegacyDimensionArray()[0];
+ // TODO 9.0 migration: Try to remove the toLegacyDimensionArray() call and make your codebase more typesafe.
+ $dimensions = MyFoo::do($node->originDimensionSpacePoint->toLegacyDimensionArray());
+
+ // TODO 9.0 migration: Try to remove the toLegacyDimensionArray() call and make your codebase more typesafe.
return $node->originDimensionSpacePoint->toLegacyDimensionArray();
}
}
diff --git a/tests/Rules/NodeGetDimensionsRector/NodeGetDimensionsRectorTest.php b/tests/Rules/NodeGetDimensionsRector/NodeGetDimensionsRectorTest.php
index 26ad153..7408883 100644
--- a/tests/Rules/NodeGetDimensionsRector/NodeGetDimensionsRectorTest.php
+++ b/tests/Rules/NodeGetDimensionsRector/NodeGetDimensionsRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\Rules\NodeGetDimensionsRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeGetDimensionsRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Rules/NodeGetDimensionsRector/config/configured_rule.php b/tests/Rules/NodeGetDimensionsRector/config/configured_rule.php
index 3353627..c3b50a0 100644
--- a/tests/Rules/NodeGetDimensionsRector/config/configured_rule.php
+++ b/tests/Rules/NodeGetDimensionsRector/config/configured_rule.php
@@ -1,10 +1,12 @@
rule(NodeGetDimensionsRector::class);
-};
+
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeGetDimensionsRector::class]);
+return $rectorConfig;
diff --git a/tests/Rules/NodeGetPathRector/Fixture/some_class.php.inc b/tests/Rules/NodeGetPathRector/Fixture/some_class.php.inc
index 1d43bbb..a1a3e78 100644
--- a/tests/Rules/NodeGetPathRector/Fixture/some_class.php.inc
+++ b/tests/Rules/NodeGetPathRector/Fixture/some_class.php.inc
@@ -1,30 +1,73 @@
getPath();
+ }
+
+ public function getPathByGetNode()
+ {
+ $path = $this->getNode()->getPath();
+ }
+
+ public function getPath(Node $node)
{
return $node->getPath();
}
+
+ public function getPathAsParameter(Node $node)
+ {
+ $path = MyFoo::do($node->getPath());
+ }
}
?>
-----
contentRepositoryRegistry->subgraphForNode($node);
// TODO 9.0 migration: Try to remove the (string) cast and make your code more type-safe.
+ $path = (string) $subgraph->findNodePath($node->aggregateId);
+ }
+ public function getPathByGetNode()
+ {
+ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($this->getNode());
+ // TODO 9.0 migration: Try to remove the (string) cast and make your code more type-safe.
+ $path = (string) $subgraph->findNodePath($this->getNode()->aggregateId);
+ }
+
+ public function getPath(Node $node)
+ {
+ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
+ // TODO 9.0 migration: Try to remove the (string) cast and make your code more type-safe.
return (string) $subgraph->findNodePath($node->aggregateId);
}
+
+ public function getPathAsParameter(Node $node)
+ {
+ $subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
+ // TODO 9.0 migration: Try to remove the (string) cast and make your code more type-safe.
+ $path = MyFoo::do((string) $subgraph->findNodePath($node->aggregateId));
+ }
}
?>
diff --git a/tests/Rules/NodeGetPathRector/NodeGetPathRectorTest.php b/tests/Rules/NodeGetPathRector/NodeGetPathRectorTest.php
index cfab9f2..8036e76 100644
--- a/tests/Rules/NodeGetPathRector/NodeGetPathRectorTest.php
+++ b/tests/Rules/NodeGetPathRector/NodeGetPathRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\Rules\NodeGetPathRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeGetPathRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Rules/NodeGetPathRector/config/configured_rule.php b/tests/Rules/NodeGetPathRector/config/configured_rule.php
index e0f3516..51cc916 100644
--- a/tests/Rules/NodeGetPathRector/config/configured_rule.php
+++ b/tests/Rules/NodeGetPathRector/config/configured_rule.php
@@ -1,10 +1,10 @@
rule(NodeGetPathRector::class);
-};
+
+return RectorConfig::configure()
+ ->withRules([NodeGetPathRector::class]);
+
diff --git a/tests/Rules/NodeIsHiddenRector/Fixture/some_class.php.inc b/tests/Rules/NodeIsHiddenRector/Fixture/some_class.php.inc
index 9b28b35..cee7549 100644
--- a/tests/Rules/NodeIsHiddenRector/Fixture/some_class.php.inc
+++ b/tests/Rules/NodeIsHiddenRector/Fixture/some_class.php.inc
@@ -1,10 +1,10 @@
isHidden();
}
@@ -14,11 +14,11 @@ class SomeClass
-----
tags->contain(\Neos\Neos\Domain\SubtreeTagging\NeosSubtreeTag::disabled());
}
diff --git a/tests/Rules/NodeIsHiddenRector/NodeIsHiddenRectorTest.php b/tests/Rules/NodeIsHiddenRector/NodeIsHiddenRectorTest.php
index d59efca..cd15c9d 100644
--- a/tests/Rules/NodeIsHiddenRector/NodeIsHiddenRectorTest.php
+++ b/tests/Rules/NodeIsHiddenRector/NodeIsHiddenRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\Rules\NodeIsHiddenRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeIsHiddenRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Rules/NodeIsHiddenRector/config/configured_rule.php b/tests/Rules/NodeIsHiddenRector/config/configured_rule.php
index fd99f03..5690499 100644
--- a/tests/Rules/NodeIsHiddenRector/config/configured_rule.php
+++ b/tests/Rules/NodeIsHiddenRector/config/configured_rule.php
@@ -1,10 +1,12 @@
rule(NodeIsHiddenRector::class);
-};
+
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeIsHiddenRector::class]);
+return $rectorConfig;
diff --git a/tests/Rules/NodeTypeGetNameRector/NodeTypeGetNameRectorTest.php b/tests/Rules/NodeTypeGetNameRector/NodeTypeGetNameRectorTest.php
index f56bda0..506af7f 100644
--- a/tests/Rules/NodeTypeGetNameRector/NodeTypeGetNameRectorTest.php
+++ b/tests/Rules/NodeTypeGetNameRector/NodeTypeGetNameRectorTest.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\Rules\NodeTypeGetNameRector;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class NodeTypeGetNameRectorTest extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,9 +18,9 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
- return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture');
+ return static::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}
public function provideConfigFilePath(): string
diff --git a/tests/Rules/NodeTypeGetNameRector/config/configured_rule.php b/tests/Rules/NodeTypeGetNameRector/config/configured_rule.php
index e36b0ea..07f550a 100644
--- a/tests/Rules/NodeTypeGetNameRector/config/configured_rule.php
+++ b/tests/Rules/NodeTypeGetNameRector/config/configured_rule.php
@@ -1,11 +1,12 @@
rule(NodeTypeGetNameRector::class);
-};
+$rectorConfig = RectorConfig::configure();
+$rectorConfig->withRules([NodeTypeGetNameRector::class]);
+return $rectorConfig;
diff --git a/tests/Sets/ContentRepository90/ContentRepository90Test.php b/tests/Sets/ContentRepository90/ContentRepository90Test.php
index df251ad..8f61234 100644
--- a/tests/Sets/ContentRepository90/ContentRepository90Test.php
+++ b/tests/Sets/ContentRepository90/ContentRepository90Test.php
@@ -4,13 +4,12 @@
namespace Neos\Rector\Tests\Sets\ContentRepository90;
+use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class ContentRepository90Test extends AbstractRectorTestCase
{
- /**
- * @dataProvider provideData()
- */
+ #[DataProvider('provideData')]
public function test(string $fileInfo): void
{
$this->doTestFile($fileInfo);
@@ -19,11 +18,10 @@ public function test(string $fileInfo): void
/**
* @return \Iterator
*/
- public function provideData(): \Iterator
+ public static function provideData(): \Iterator
{
$append = new \AppendIterator();
- $append->append($this->yieldFilesFromDirectory(__DIR__ . '/Fixture'));
- $append->append($this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc'));
+ $append->append(self::yieldFilesFromDirectory(__DIR__ . '/Fixture'));
return $append;
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Context/content-context.fusion.inc b/tests/Sets/ContentRepository90/Fixture/Context/content-context.fusion.inc
deleted file mode 100644
index f61801b..0000000
--- a/tests/Sets/ContentRepository90/Fixture/Context/content-context.fusion.inc
+++ /dev/null
@@ -1,39 +0,0 @@
-prototype(Neos.Context:Prototype) < prototype(Neos.Fusion:Component) {
-
- currentSite = ${node.context.currentSite}
- currentSiteNode = ${node.context.currentSiteNode}
- currentDomain = ${node.context.currentDomain}
-
- isLive = ${node.context.isLive}
- isInBackend = ${node.context.isInBackend}
-
- preview = ${node.context.currentRenderingMode.preview}
- edit = ${node.context.currentRenderingMode.edit}
- name = ${node.context.currentRenderingMode.name}
- currentRenderingMode = ${node.context.currentRenderingMode}
-
- properties = ${node.context.properties}
-
-}
------
-// TODO 9.0 migration: Line 19: !! node.context.properties is removed in Neos 9.0.
-// TODO 9.0 migration: Line 9: !! node.context.currentDomain is removed in Neos 9.0.
-// TODO 9.0 migration: Line 8: !! node.context.currentSiteNode is removed in Neos 9.0. Check if you can't simply use ${site}.
-// TODO 9.0 migration: Line 14: 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.Context:Prototype) < prototype(Neos.Fusion:Component) {
-
- currentSite = ${Neos.Site.findBySiteNode(site)}
- currentSiteNode = ${node.context.currentSiteNode}
- currentDomain = ${node.context.currentDomain}
-
- isLive = ${node.context.isLive}
- isInBackend = ${node.context.isInBackend}
-
- preview = ${renderingMode.isPreview}
- edit = ${renderingMode.isEdit}
- name = ${renderingMode.name}
- currentRenderingMode = ${node.context.currentRenderingMode}
-
- properties = ${node.context.properties}
-
-}
diff --git a/tests/Sets/ContentRepository90/Fixture/Context/context-current-rendering-mode.fusion.inc b/tests/Sets/ContentRepository90/Fixture/Context/context-current-rendering-mode.fusion.inc
deleted file mode 100644
index 8dcd68e..0000000
--- a/tests/Sets/ContentRepository90/Fixture/Context/context-current-rendering-mode.fusion.inc
+++ /dev/null
@@ -1,42 +0,0 @@
-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']}
- 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`
-
- `
- }
-}
------
-// 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 = ${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`
-
- `
- }
-}
diff --git a/tests/Sets/ContentRepository90/Fixture/Context/context-current-site.fusion.inc b/tests/Sets/ContentRepository90/Fixture/Context/context-current-site.fusion.inc
deleted file mode 100644
index e016d3e..0000000
--- a/tests/Sets/ContentRepository90/Fixture/Context/context-current-site.fusion.inc
+++ /dev/null
@@ -1,16 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
- renderer = Neos.Fusion:Component {
- attributes = ${node.context.currentSite.siteResourcesPackageKey || site.context.currentSite.siteResourcesPackageKey || documentNode.context.currentSite.siteResourcesPackageKey}
- site = ${node.context.currentSite || site.context.currentSite || documentNode.context.currentSite}
- currentSiteNode = ${node.context.currentSiteNode}
- }
-}
------
-// TODO 9.0 migration: Line 6: !! node.context.currentSiteNode is removed in Neos 9.0. Check if you can't simply use ${site}.
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
- renderer = Neos.Fusion:Component {
- attributes = ${Neos.Site.findBySiteNode(site).siteResourcesPackageKey || Neos.Site.findBySiteNode(site).siteResourcesPackageKey || Neos.Site.findBySiteNode(site).siteResourcesPackageKey}
- site = ${Neos.Site.findBySiteNode(site) || Neos.Site.findBySiteNode(site) || Neos.Site.findBySiteNode(site)}
- currentSiteNode = ${node.context.currentSiteNode}
- }
-}
diff --git a/tests/Sets/ContentRepository90/Fixture/Context/context.fusion.inc b/tests/Sets/ContentRepository90/Fixture/Context/context.fusion.inc
deleted file mode 100644
index 6713d31..0000000
--- a/tests/Sets/ContentRepository90/Fixture/Context/context.fusion.inc
+++ /dev/null
@@ -1,54 +0,0 @@
-prototype(Neos.Context:Prototype) < prototype(Neos.Fusion:Component) {
-
- workspaceName = ${node.context.workspaceName}
- workspaceNameByWorkspace = ${node.context.workspace.name}
- rootNode = ${node.context.rootNode}
-
- currentDateTime = ${node.context.currentDateTime}
- dimensions = ${node.context.dimensions}
- properties = ${node.context.properties}
-
- targetDimensions = ${node.context.targetDimensions}
- targetDimensionValues = ${node.context.targetDimensionValues}
-
- workspace = ${node.context.workspace}
- workspaceSomeProperty = ${node.context.workspace.someProperty}
-
- isInaccessibleContentShown = ${node.context.isInaccessibleContentShown}
- isInvisibleContentShown = ${node.context.isInvisibleContentShown}
- isRemovedContentShown = ${node.context.isRemovedContentShown}
-
-}
------
-// TODO 9.0 migration: Line 16: !! node.context.rootNode is removed in Neos 9.0.
-// TODO 9.0 migration: Line 18: !! node.context.currentDateTime is removed in Neos 9.0.
-// TODO 9.0 migration: Line 19: !! node.context.dimensions is removed in Neos 9.0. You can get node DimensionSpacePoints via node.dimensionSpacePoints now or use the `Neos.Dimension.*` helper.
-// TODO 9.0 migration: Line 20: !! node.context.properties is removed in Neos 9.0.
-// TODO 9.0 migration: Line 22: !! node.context.targetDimensions is removed in Neos 9.0.
-// TODO 9.0 migration: Line 23: !! node.context.targetDimensionValues is removed in Neos 9.0.
-// TODO 9.0 migration: Line 28: !! node.context.isInaccessibleContentShown is removed in Neos 9.0.
-// TODO 9.0 migration: Line 29: !! node.context.isInvisibleContentShown is removed in Neos 9.0.
-// TODO 9.0 migration: Line 30: !! node.context.isRemovedContentShown is removed in Neos 9.0.
-// TODO 9.0 migration: Line 16: You very likely need to rewrite "VARIABLE.context.workspace" as the "context" of nodes has been removed without a direct replacement in Neos 9. If you really need the workspace in fusion you need to create a dedicated helper yourself which should ideally do ALL the complex logic in php directly and return the computed result.
-// TODO 9.0 migration: Line 17: You very likely need to rewrite "VARIABLE.context.workspace" as the "context" of nodes has been removed without a direct replacement in Neos 9. If you really need the workspace in fusion you need to create a dedicated helper yourself which should ideally do ALL the complex logic in php directly and return the computed result.
-prototype(Neos.Context:Prototype) < prototype(Neos.Fusion:Component) {
-
- workspaceName = ${node.workspaceName}
- workspaceNameByWorkspace = ${node.workspaceName}
- rootNode = ${node.context.rootNode}
-
- currentDateTime = ${node.context.currentDateTime}
- dimensions = ${node.context.dimensions}
- properties = ${node.context.properties}
-
- targetDimensions = ${node.context.targetDimensions}
- targetDimensionValues = ${node.context.targetDimensionValues}
-
- workspace = ${node.context.workspace}
- workspaceSomeProperty = ${node.context.workspace.someProperty}
-
- isInaccessibleContentShown = ${node.context.isInaccessibleContentShown}
- isInvisibleContentShown = ${node.context.isInvisibleContentShown}
- isRemovedContentShown = ${node.context.isRemovedContentShown}
-
-}
diff --git a/tests/Sets/ContentRepository90/Fixture/Context/create-content-context.php.inc b/tests/Sets/ContentRepository90/Fixture/Context/create-content-context.php.inc
index 0500ad8..526bdee 100644
--- a/tests/Sets/ContentRepository90/Fixture/Context/create-content-context.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Context/create-content-context.php.inc
@@ -37,20 +37,16 @@ class CreateContentContextClassTest extends AnotherClass
$workspaceName = "workspacename";
$dimensions = [];
// TODO 9.0 migration: !! CreateContentContextTrait::createContentContext() is removed in Neos 9.0.
-
$context = $this->createContentContext($workspaceName, $dimensions);
// TODO 9.0 migration: !! ContentContext::getCurrentSite() is removed in Neos 9.0.
-
$context->getCurrentSite();
}
public function bar(NodeData $nodeData)
{
// TODO 9.0 migration: !! CreateContentContextTrait::createContextMatchingNodeData() is removed in Neos 9.0.
-
$context = $this->createContextMatchingNodeData($nodeData);
// TODO 9.0 migration: !! ContentContext::getCurrentSite() is removed in Neos 9.0.
-
$context->getCurrentSite();
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Fusion/cache-lifetime.fusion.inc b/tests/Sets/ContentRepository90/Fixture/Fusion/cache-lifetime.fusion.inc
deleted file mode 100644
index 69363f6..0000000
--- a/tests/Sets/ContentRepository90/Fixture/Fusion/cache-lifetime.fusion.inc
+++ /dev/null
@@ -1,17 +0,0 @@
-prototype(My.Namespace:Value) < prototype(Neos.Fusion:Value) {
-
- lifetime = ${q(node).cacheLifetime()}
-
- @cache.maximumLifetime = ${q(node).context({'invisibleContentShown': true}).find('[instanceof Neos.Neos:Content]').cacheLifetime()}
-
-}
------
-// TODO 9.0 migration: Line 5: You may need to remove ".cacheLifetime()" as this FlowQuery Operation has been removed. This is not needed anymore as the concept of timeable node visibility has changed. See https://github.com/neos/timeable-node-visibility
-// TODO 9.0 migration: Line 7: You may need to remove ".cacheLifetime()" as this FlowQuery Operation has been removed. This is not needed anymore as the concept of timeable node visibility has changed. See https://github.com/neos/timeable-node-visibility
-prototype(My.Namespace:Value) < prototype(Neos.Fusion:Value) {
-
- lifetime = ${q(node).cacheLifetime()}
-
- @cache.maximumLifetime = ${q(node).context({'invisibleContentShown': true}).find('[instanceof Neos.Neos:Content]').cacheLifetime()}
-
-}
diff --git a/tests/Sets/ContentRepository90/Fixture/Fusion/flow-query-context.fusion.inc b/tests/Sets/ContentRepository90/Fixture/Fusion/flow-query-context.fusion.inc
deleted file mode 100644
index 69e5ade..0000000
--- a/tests/Sets/ContentRepository90/Fixture/Fusion/flow-query-context.fusion.inc
+++ /dev/null
@@ -1,44 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- empty = ${q(node).context()}
- workspaceName = ${q(node).context({'workspaceName': 'other-workspace'})}
- dimensions = ${q(node).context({"dimensions": {'language': ['de']}})}
- invisibleContentShown = ${q(node).context({'invisibleContentShown': true})}
-
- currentDateTime = ${q(node).context({'currentDateTime': 'other-workspace'})}
- targetDimensions = ${q(node).context({"targetDimensions": {'language': ['de']}})}
- removedContentShown = ${q(node).context({'removedContentShown': true})}
- inaccessibleContentShown = ${q(node).context({"inaccessibleContentShown": true})}
-
- mixedRemovedContentShown = ${q(node).context({'workspaceName': 'other-workspace', 'removedContentShown': true})}
- mixedTargetDimensions = ${q(node).context({'targetDimensions': {'language': ['de']}, 'dimensions': {'language': ['de']}})}
-
- variables = ${q(site).context({'dimensions': this.dimensions.dimensions, 'targetDimensions': this.dimensions.targetDimensions})}
-
-}
------
-// TODO 9.0 migration: Line 15: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.
-// TODO 9.0 migration: Line 16: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.
-// TODO 9.0 migration: Line 17: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.
-// TODO 9.0 migration: Line 18: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.
-// TODO 9.0 migration: Line 20: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.
-// TODO 9.0 migration: Line 21: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.
-// TODO 9.0 migration: Line 23: The "context()" FlowQuery operation has changed and does not support the following properties anymore: targetDimensions,currentDateTime,removedContentShown,inaccessibleContentShown.
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- empty = ${q(node).context()}
- workspaceName = ${q(node).context({'workspaceName': 'other-workspace'})}
- dimensions = ${q(node).context({"dimensions": {'language': ['de']}})}
- invisibleContentShown = ${q(node).context({'invisibleContentShown': true})}
-
- currentDateTime = ${q(node).context({'currentDateTime': 'other-workspace'})}
- targetDimensions = ${q(node).context({"targetDimensions": {'language': ['de']}})}
- removedContentShown = ${q(node).context({'removedContentShown': true})}
- inaccessibleContentShown = ${q(node).context({"inaccessibleContentShown": true})}
-
- mixedRemovedContentShown = ${q(node).context({'workspaceName': 'other-workspace', 'removedContentShown': true})}
- mixedTargetDimensions = ${q(node).context({'targetDimensions': {'language': ['de']}, 'dimensions': {'language': ['de']}})}
-
- variables = ${q(site).context({'dimensions': this.dimensions.dimensions, 'targetDimensions': this.dimensions.targetDimensions})}
-
-}
diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-copy.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-copy.php.inc
index b375b8e..eb5d17e 100644
--- a/tests/Sets/ContentRepository90/Fixture/Node/node-copy.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Node/node-copy.php.inc
@@ -26,13 +26,10 @@ class SomeClass extends AnotherClass
public function node(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node, \Neos\ContentRepository\Core\Projection\ContentGraph\Node $otherNode)
{
// TODO 9.0 migration: !! Node::copyBefore() is not supported by the new CR. Use the "NodeDuplicationService::copyNodesRecursively" to copy a node.
-
$node->copyBefore($otherNode);
// TODO 9.0 migration: !! Node::copyInto() is not supported by the new CR. Use the "NodeDuplicationService::copyNodesRecursively" to copy a node.
-
$node->copyInto($otherNode);
// TODO 9.0 migration: !! Node::copyAfter() is not supported by the new CR. Use the "NodeDuplicationService::copyNodesRecursively" to copy a node.
-
$node->copyAfter($otherNode);
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-get-parent.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-get-parent.php.inc
index 05aa8ea..1b6f31c 100644
--- a/tests/Sets/ContentRepository90/Fixture/Node/node-get-parent.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Node/node-get-parent.php.inc
@@ -9,23 +9,29 @@ class SomeClass extends AnotherClass
{
public function node(\Neos\ContentRepository\Domain\Model\Node $node)
{
- $node->getParent()->getName();
+ $parentNode = $node->getParent();
+ $parentNode->getName();
- $node->findParentNode()->getName();
+ $parentNode = $node->findParentNode();
+ $parentNode->getName();
}
public function nodeInterface(\Neos\ContentRepository\Domain\Model\NodeInterface $node)
{
- $node->getParent()->getName();
+ $parentNode = $node->getParent();
+ $parentNode->getName();
- $node->findParentNode()->getName();
+ $parentNode = $node->findParentNode();
+ $parentNode->getName();
}
public function traversableNodeInterface(\Neos\ContentRepository\Domain\Projection\Content\TraversableNodeInterface $node)
{
- $node->getParent()->getName();
+ $parentNode = $node->getParent();
+ $parentNode->getName();
- $node->findParentNode()->getName();
+ $parentNode = $node->findParentNode();
+ $parentNode->getName();
}
}
@@ -44,28 +50,34 @@ class SomeClass extends AnotherClass
public function node(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node)
{
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
- $subgraph->findParentNode($node->aggregateId)->nodeName;
+ $parentNode = $subgraph->findParentNode($node->aggregateId);
+ $parentNode->nodeName;
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
- $subgraph->findParentNode($node->aggregateId)->nodeName;
+ $parentNode = $subgraph->findParentNode($node->aggregateId);
+ $parentNode->nodeName;
}
public function nodeInterface(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node)
{
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
- $subgraph->findParentNode($node->aggregateId)->nodeName;
+ $parentNode = $subgraph->findParentNode($node->aggregateId);
+ $parentNode->nodeName;
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
- $subgraph->findParentNode($node->aggregateId)->nodeName;
+ $parentNode = $subgraph->findParentNode($node->aggregateId);
+ $parentNode->nodeName;
}
public function traversableNodeInterface(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node)
{
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
- $subgraph->findParentNode($node->aggregateId)->nodeName;
+ $parentNode = $subgraph->findParentNode($node->aggregateId);
+ $parentNode->nodeName;
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
- $subgraph->findParentNode($node->aggregateId)->nodeName;
+ $parentNode = $subgraph->findParentNode($node->aggregateId);
+ $parentNode->nodeName;
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-hidden-before-after-date-time.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-hidden-before-after-date-time.php.inc
index 8fa4070..8a47dbf 100644
--- a/tests/Sets/ContentRepository90/Fixture/Node/node-hidden-before-after-date-time.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Node/node-hidden-before-after-date-time.php.inc
@@ -33,24 +33,20 @@ class SomeClass extends AnotherClass
public function nodeHiddenBeforeDateTime(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node)
{
// TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details.
-
$dateTime = $node->getProperty('enableAfterDateTime');
+
// TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details.
// Use the "SetNodeProperties" command to change property values for "enableAfterDateTime" or "disableAfterDateTime".
-
-
$node->setHiddenBeforeDateTime($dateTime);
}
public function nodeHiddenAfterDateTime(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node)
{
// TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details.
-
$dateTime = $node->getProperty('disableAfterDateTime');
+
// TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details.
// Use the "SetNodeProperties" command to change property values for "enableAfterDateTime" or "disableAfterDateTime".
-
-
$node->setHiddenAfterDateTime($dateTime);
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-hidden-in-index.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-hidden-in-index.php.inc
index b820145..5ad1665 100644
--- a/tests/Sets/ContentRepository90/Fixture/Node/node-hidden-in-index.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Node/node-hidden-in-index.php.inc
@@ -25,7 +25,6 @@ class SomeClass extends AnotherClass
{
$isHidden = $node->getProperty('hiddenInMenu');
// TODO 9.0 migration: !! Node::setHiddenInIndex() is not supported by the new CR. Use the "SetNodeProperties" command to change the property value for "hiddenInMenu".
-
$node->setHiddenInIndex(false);
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-hidden.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-hidden.php.inc
index 74dc76f..244c047 100644
--- a/tests/Sets/ContentRepository90/Fixture/Node/node-hidden.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Node/node-hidden.php.inc
@@ -27,12 +27,10 @@ class SomeClass extends AnotherClass
public function node(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node)
{
$hidden = $node->tags->contain(\Neos\Neos\Domain\SubtreeTagging\NeosSubtreeTag::disabled());
- // TODO 9.0 migration: !! Node::setHidden() is not supported by the new CR. Use the "EnableNodeAggregate" or "DisableNodeAggregate" command to change the visibility of the node.
-
+ // TODO 9.0 migration: !! Node::setHidden() is not supported by the new CR. Use the "EnableNodeAggregate" or "DisableNodeAggregate" command to change the visibility of the node.
$node->setHidden(false);
// TODO 9.0 migration: !! Node::setHidden() is not supported by the new CR. Use the "EnableNodeAggregate" or "DisableNodeAggregate" command to change the visibility of the node.
-
$node->setHidden(true);
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-move.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-move.php.inc
index 62b867e..bf25d14 100644
--- a/tests/Sets/ContentRepository90/Fixture/Node/node-move.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Node/node-move.php.inc
@@ -26,13 +26,10 @@ class SomeClass extends AnotherClass
public function node(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node, \Neos\ContentRepository\Core\Projection\ContentGraph\Node $otherNode)
{
// TODO 9.0 migration: !! Node::moveBefore() is not supported by the new CR. Use the "MoveNodeAggregate" command to move a node.
-
$node->moveBefore($otherNode);
// TODO 9.0 migration: !! Node::moveInto() is not supported by the new CR. Use the "MoveNodeAggregate" command to move a node.
-
$node->moveInto($otherNode);
// TODO 9.0 migration: !! Node::moveAfter() is not supported by the new CR. Use the "MoveNodeAggregate" command to move a node.
-
$node->moveAfter($otherNode);
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-name.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-name.php.inc
index 691a826..91980a5 100644
--- a/tests/Sets/ContentRepository90/Fixture/Node/node-name.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Node/node-name.php.inc
@@ -25,9 +25,8 @@ class SomeClass extends AnotherClass
public function node(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node)
{
$nodeName = $node->nodeName;
- // TODO 9.0 migration: !! Node::setName() is not supported by the new CR. Use the "ChangeNodeAggregateName" command to change the node name.
-
+ // TODO 9.0 migration: !! Node::setName() is not supported by the new CR. Use the "ChangeNodeAggregateName" command to change the node name.
$node->setName('newName');
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-properties.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-properties.php.inc
index d26e56f..df87938 100644
--- a/tests/Sets/ContentRepository90/Fixture/Node/node-properties.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Node/node-properties.php.inc
@@ -31,13 +31,11 @@ class SomeClass extends AnotherClass
{
$value = $node->getProperty('foo');
$bool = $node->hasProperty('foo');
- // TODO 9.0 migration: !! Node::setProperty() is not supported by the new CR. Use the "SetNodeProperties" command to change property values.
-
+ // TODO 9.0 migration: !! Node::setProperty() is not supported by the new CR. Use the "SetNodeProperties" command to change property values.
$node->setProperty('foo', 'bar');
- // TODO 9.0 migration: !! Node::removeProperty() is not supported by the new CR. Use the "SetNodeProperties" command to remove a property values.
-
+ // TODO 9.0 migration: !! Node::removeProperty() is not supported by the new CR. Use the "SetNodeProperties" command to remove a property values.
$node->removeProperty('bar');
$propertyNames = array_keys(iterator_to_array($node->properties));
diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-remove.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-remove.php.inc
index 2acc3bb..4092ec9 100644
--- a/tests/Sets/ContentRepository90/Fixture/Node/node-remove.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Node/node-remove.php.inc
@@ -25,10 +25,8 @@ class SomeClass extends AnotherClass
public function node(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node)
{
// TODO 9.0 migration: !! Node::remove() is not supported by the new CR. Use the "RemoveNodeAggregate" command to remove a node.
-
$node->remove();
// TODO 9.0 migration: !! Node::setRemoved() is not supported by the new CR. Use the "RemoveNodeAggregate" command to remove a node.
-
$node->setRemoved(false);
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Signals/Context.php.inc b/tests/Sets/ContentRepository90/Fixture/Signals/Context.php.inc
index b165ee2..74a2e48 100644
--- a/tests/Sets/ContentRepository90/Fixture/Signals/Context.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Signals/Context.php.inc
@@ -42,12 +42,10 @@ class Package extends BasePackage
* @var Dispatcher
*/
$dispatcher = $bootstrap->getSignalSlotDispatcher();
- // TODO 9.0 migration: The signal "beforeAdoptNode" on "Context" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
+ // TODO 9.0 migration: The signal "beforeAdoptNode" on "Context" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
$dispatcher->connect(\Neos\Rector\ContentRepository90\Legacy\LegacyContextStub::class, 'beforeAdoptNode', function () { return 'foo'; });
// TODO 9.0 migration: The signal "afterAdoptNode" on "Context" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect('Neos\ContentRepository\Domain\Service\Context', 'afterAdoptNode', RouterCachingService::class, 'flushCaches');
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Signals/Node.php.inc b/tests/Sets/ContentRepository90/Fixture/Signals/Node.php.inc
index 2d6e526..4e98f0c 100644
--- a/tests/Sets/ContentRepository90/Fixture/Signals/Node.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Signals/Node.php.inc
@@ -52,42 +52,30 @@ class Package extends BasePackage
* @var Dispatcher
*/
$dispatcher = $bootstrap->getSignalSlotDispatcher();
- // TODO 9.0 migration: The signal "beforeNodeMove" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
+ // TODO 9.0 migration: The signal "beforeNodeMove" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
$dispatcher->connect(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class, 'beforeNodeMove', function () { return 'foo'; });
// TODO 9.0 migration: The signal "afterNodeMove" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect('Neos\ContentRepository\Domain\Model\Node', 'afterNodeMove', RouterCachingService::class, 'flushCaches');
// TODO 9.0 migration: The signal "beforeNodeCopy" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class, 'beforeNodeCopy', function () { return 'foo'; });
// TODO 9.0 migration: The signal "afterNodeCopy" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect('Neos\ContentRepository\Domain\Model\Node', 'afterNodeCopy', RouterCachingService::class, 'flushCaches');
// TODO 9.0 migration: The signal "nodePathChanged" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class, 'nodePathChanged', function () { return 'foo'; });
// TODO 9.0 migration: The signal "beforeNodeCreate" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect('Neos\ContentRepository\Domain\Model\Node', 'beforeNodeCreate', RouterCachingService::class, 'flushCaches');
// TODO 9.0 migration: The signal "afterNodeCreate" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class, 'afterNodeCreate', function () { return 'foo'; });
// TODO 9.0 migration: The signal "nodeAdded" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect('Neos\ContentRepository\Domain\Model\Node', 'nodeAdded', RouterCachingService::class, 'flushCaches');
// TODO 9.0 migration: The signal "nodeUpdated" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class, 'nodeUpdated', function () { return 'foo'; });
// TODO 9.0 migration: The signal "nodeRemoved" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect('Neos\ContentRepository\Domain\Model\Node', 'nodeRemoved', RouterCachingService::class, 'flushCaches');
// TODO 9.0 migration: The signal "beforeNodePropertyChange" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class, 'beforeNodePropertyChange', function () { return 'foo'; });
// TODO 9.0 migration: The signal "nodePropertyChanged" on "Node" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect('Neos\ContentRepository\Domain\Model\Node', 'nodePropertyChanged', RouterCachingService::class, 'flushCaches');
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Signals/NodeData.php.inc b/tests/Sets/ContentRepository90/Fixture/Signals/NodeData.php.inc
index 343ea11..db622ac 100644
--- a/tests/Sets/ContentRepository90/Fixture/Signals/NodeData.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Signals/NodeData.php.inc
@@ -42,12 +42,10 @@ class Package extends BasePackage
* @var Dispatcher
*/
$dispatcher = $bootstrap->getSignalSlotDispatcher();
- // TODO 9.0 migration: The signal "nodePathChanged" on "NodeData" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
+ // TODO 9.0 migration: The signal "nodePathChanged" on "NodeData" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
$dispatcher->connect(\Neos\ContentRepository\Domain\Model\NodeData::class, 'nodePathChanged', function () { return 'foo'; });
// TODO 9.0 migration: The signal "nodePathChanged" on "NodeData" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect('Neos\ContentRepository\Domain\Model\NodeData', 'nodePathChanged', RouterCachingService::class, 'flushCaches');
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Signals/NodeDataRepository.php.inc b/tests/Sets/ContentRepository90/Fixture/Signals/NodeDataRepository.php.inc
index bb19523..255e71f 100644
--- a/tests/Sets/ContentRepository90/Fixture/Signals/NodeDataRepository.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Signals/NodeDataRepository.php.inc
@@ -42,12 +42,10 @@ class Package extends BasePackage
* @var Dispatcher
*/
$dispatcher = $bootstrap->getSignalSlotDispatcher();
- // TODO 9.0 migration: The signal "repositoryObjectsPersisted" on "NodeDataRepository" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
+ // TODO 9.0 migration: The signal "repositoryObjectsPersisted" on "NodeDataRepository" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
$dispatcher->connect(\Neos\ContentRepository\Domain\Repository\NodeDataRepository::class, 'repositoryObjectsPersisted', function () { return 'foo'; });
// TODO 9.0 migration: The signal "repositoryObjectsPersisted" on "NodeDataRepository" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect('Neos\ContentRepository\Domain\Repository\NodeDataRepository', 'repositoryObjectsPersisted', RouterCachingService::class, 'flushCaches');
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Signals/PublishingService.php.inc b/tests/Sets/ContentRepository90/Fixture/Signals/PublishingService.php.inc
index 2acc97b..f14527f 100644
--- a/tests/Sets/ContentRepository90/Fixture/Signals/PublishingService.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Signals/PublishingService.php.inc
@@ -45,19 +45,15 @@ class Package extends BasePackage
* @var Dispatcher
*/
$dispatcher = $bootstrap->getSignalSlotDispatcher();
- // TODO 9.0 migration: The signal "nodePublished" on "PublishingService" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
+ // TODO 9.0 migration: The signal "nodePublished" on "PublishingService" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
$dispatcher->connect(\Neos\ContentRepository\Domain\Service\PublishingService::class, 'nodePublished', function () { return 'foo'; });
// TODO 9.0 migration: The signal "nodeDiscarded" on "PublishingService" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect('Neos\ContentRepository\Domain\Service\PublishingService', 'nodeDiscarded', RouterCachingService::class, 'flushCaches');
- // TODO 9.0 migration: The signal "nodePublished" on "PublishingService" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
+ // TODO 9.0 migration: The signal "nodePublished" on "PublishingService" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
$dispatcher->connect(\Neos\Neos\Service\PublishingService::class, 'nodePublished', function () { return 'foo'; });
// TODO 9.0 migration: The signal "nodeDiscarded" on "PublishingService" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect('Neos\Neos\Service\PublishingService', 'nodeDiscarded', RouterCachingService::class, 'flushCaches');
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Signals/Workspace.php.inc b/tests/Sets/ContentRepository90/Fixture/Signals/Workspace.php.inc
index e75214c..57d48c9 100644
--- a/tests/Sets/ContentRepository90/Fixture/Signals/Workspace.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Signals/Workspace.php.inc
@@ -43,15 +43,12 @@ class Package extends BasePackage
* @var Dispatcher
*/
$dispatcher = $bootstrap->getSignalSlotDispatcher();
- // TODO 9.0 migration: The signal "baseWorkspaceChanged" on "Workspace" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
+ // TODO 9.0 migration: The signal "baseWorkspaceChanged" on "Workspace" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
$dispatcher->connect(\Neos\ContentRepository\Core\SharedModel\Workspace\Workspace::class, 'baseWorkspaceChanged', function () { return 'foo'; });
// TODO 9.0 migration: The signal "beforeNodePublishing" on "Workspace" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect('Neos\ContentRepository\Domain\Model\Workspace', 'beforeNodePublishing', RouterCachingService::class, 'flushCaches');
// TODO 9.0 migration: The signal "afterNodePublishing" on "Workspace" has been removed. Please check https://docs.neos.io/api/upgrade-instructions/9/signals-and-slots for further information, how to replace a signal.
-
$dispatcher->connect(\Neos\ContentRepository\Core\SharedModel\Workspace\Workspace::class, 'afterNodePublishing', function () { return 'foo'; });
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/Workspace/workspace-repository.php.inc b/tests/Sets/ContentRepository90/Fixture/Workspace/workspace-repository.php.inc
index 7275b1d..46bbe85 100644
--- a/tests/Sets/ContentRepository90/Fixture/Workspace/workspace-repository.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/Workspace/workspace-repository.php.inc
@@ -33,9 +33,11 @@ class SomeClass extends AnotherClass
public function findWorkspace($workspaceIdentifier)
{
+
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$workspace = $contentRepository->findWorkspaceByName(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($workspaceIdentifier));
+
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$dependentWorkspaces = $contentRepository->findWorkspaces()->getDependantWorkspaces(\Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName::fromString($workspaceIdentifier));
diff --git a/tests/Sets/ContentRepository90/Fixture/node-data.php.inc b/tests/Sets/ContentRepository90/Fixture/node-data.php.inc
index e901fdf..d1c9556 100644
--- a/tests/Sets/ContentRepository90/Fixture/node-data.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/node-data.php.inc
@@ -54,104 +54,71 @@ class SomeClass {
public function foo(NodeData $nodeData)
{
// TODO 9.0 migration: !! NodeData::createNodeData is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->createNodeData();
// TODO 9.0 migration: !! NodeData::createNodeDataFromTemplate is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->createNodeDataFromTemplate();
// TODO 9.0 migration: !! NodeData::createShadow is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->createShadow();
// TODO 9.0 migration: !! NodeData::createSingleNodeData is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->createSingleNodeData();
// TODO 9.0 migration: !! NodeData::getContextPath is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->getContextPath();
// TODO 9.0 migration: !! NodeData::getDepth is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->getDepth();
// TODO 9.0 migration: !! NodeData::getDimensions is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->getDimensions();
// TODO 9.0 migration: !! NodeData::getDimensionsHash is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->getDimensionsHash();
// TODO 9.0 migration: !! NodeData::getDimensionValues is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->getDimensionValues();
// TODO 9.0 migration: !! NodeData::getIdentifier is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->getIdentifier();
// TODO 9.0 migration: !! NodeData::getIndex is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->getIndex();
// TODO 9.0 migration: !! NodeData::getMovedTo is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->getMovedTo();
// TODO 9.0 migration: !! NodeData::getName is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->getName();
// TODO 9.0 migration: !! NodeData::getNumberOfChildNodes is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->getNumberOfChildNodes();
// TODO 9.0 migration: !! NodeData::getParent is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->getParent();
// TODO 9.0 migration: !! NodeData::getParentPath is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->getParentPath();
// TODO 9.0 migration: !! NodeData::getPath is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->getPath();
// TODO 9.0 migration: !! NodeData::getWorkspace is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->getWorkspace();
// TODO 9.0 migration: !! NodeData::hasAccessRestrictions is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->hasAccessRestrictions();
// TODO 9.0 migration: !! NodeData::isAccessible is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->isAccessible();
// TODO 9.0 migration: !! NodeData::isInternal is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->isInternal();
// TODO 9.0 migration: !! NodeData::isRemoved is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->isRemoved();
// TODO 9.0 migration: !! NodeData::isVisible is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->isVisible();
// TODO 9.0 migration: !! NodeData::matchesWorkspaceAndDimensions is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->matchesWorkspaceAndDimensions();
$nodeData->move();
// TODO 9.0 migration: !! NodeData::remove is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->remove();
// TODO 9.0 migration: !! NodeData::setDimensions is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->setDimensions();
// TODO 9.0 migration: !! NodeData::setIdentifier is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->setIdentifier();
// TODO 9.0 migration: !! NodeData::setIndex is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->setIndex();
// TODO 9.0 migration: !! NodeData::setMovedTo is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->setMovedTo();
// TODO 9.0 migration: !! NodeData::setPath is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->setPath();
// TODO 9.0 migration: !! NodeData::setRemoved is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->setRemoved();
// TODO 9.0 migration: !! NodeData::setWorkspace is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->setWorkspace();
// TODO 9.0 migration: !! NodeData::similarize is removed in Neos 9.0 - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.
-
$nodeData->similarize();
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/node-search-service.php.inc b/tests/Sets/ContentRepository90/Fixture/node-search-service.php.inc
index 8b21742..778422d 100644
--- a/tests/Sets/ContentRepository90/Fixture/node-search-service.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/node-search-service.php.inc
@@ -59,6 +59,7 @@ class SomeClass extends AnotherClass
{
$term = "term";
$searchNodeTypes = [];
+
// TODO 9.0 migration: This could be a suitable replacement. Please check if all your requirements are still fulfilled.
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
$nodes = $subgraph->findDescendantNodes($node->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindDescendantNodesFilter::create(nodeTypes: \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\NodeType\NodeTypeCriteria::create(\Neos\ContentRepository\Core\NodeType\NodeTypeNames::fromStringArray($searchNodeTypes), \Neos\ContentRepository\Core\NodeType\NodeTypeNames::createEmpty()), searchTerm: $term));
@@ -68,6 +69,7 @@ class SomeClass extends AnotherClass
{
$term = "term";
$searchNodeTypes = [];
+
// TODO 9.0 migration: The replacement needs a node as starting point for the search. Please provide a node, to make this replacement working.
$node = 'we-need-a-node-here';
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
@@ -78,6 +80,7 @@ class SomeClass extends AnotherClass
{
$term = "term";
$searchNodeTypes = [];
+
// TODO 9.0 migration: This could be a suitable replacement. Please check if all your requirements are still fulfilled.
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
$nodes = $subgraph->findDescendantNodes($node->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindDescendantNodesFilter::create(nodeTypes: \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\NodeType\NodeTypeCriteria::create(\Neos\ContentRepository\Core\NodeType\NodeTypeNames::fromStringArray($searchNodeTypes), \Neos\ContentRepository\Core\NodeType\NodeTypeNames::createEmpty()), searchTerm: $term));
diff --git a/tests/Sets/ContentRepository90/Fixture/node-template.php.inc b/tests/Sets/ContentRepository90/Fixture/node-template.php.inc
index 19e5588..f76dbd9 100644
--- a/tests/Sets/ContentRepository90/Fixture/node-template.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/node-template.php.inc
@@ -24,22 +24,16 @@ class SomeClass {
public function foo()
{
// TODO 9.0 migration: !! NodeTemplate is removed in Neos 9.0. Use the "CreateNodeAggregateWithNode" command to create new nodes or "CreateNodeVariant" command to create variants of an existing node in other dimensions.
-
$nodeTemplate = new NodeTemplate();
// TODO 9.0 migration: !! NodeTemplate::getIdentifier is removed in Neos 9.0. Use the "CreateNodeAggregateWithNode" command to create new nodes or "CreateNodeVariant" command to create variants of an existing node in other dimensions.
-
$nodeTemplate->getIdentifier();
// TODO 9.0 migration: !! NodeTemplate::getName is removed in Neos 9.0. Use the "CreateNodeAggregateWithNode" command to create new nodes or "CreateNodeVariant" command to create variants of an existing node in other dimensions.
-
$nodeTemplate->getName();
// TODO 9.0 migration: !! NodeTemplate::getWorkspace is removed in Neos 9.0. Use the "CreateNodeAggregateWithNode" command to create new nodes or "CreateNodeVariant" command to create variants of an existing node in other dimensions.
-
$nodeTemplate->getWorkspace();
// TODO 9.0 migration: !! NodeTemplate::setIdentifier is removed in Neos 9.0. Use the "CreateNodeAggregateWithNode" command to create new nodes or "CreateNodeVariant" command to create variants of an existing node in other dimensions.
-
$nodeTemplate->setIdentifier();
// TODO 9.0 migration: !! NodeTemplate::setName is removed in Neos 9.0. Use the "CreateNodeAggregateWithNode" command to create new nodes or "CreateNodeVariant" command to create variants of an existing node in other dimensions.
-
$nodeTemplate->setName();
}
}
diff --git a/tests/Sets/ContentRepository90/Fixture/nodetype-constraints.php.inc b/tests/Sets/ContentRepository90/Fixture/nodetype-constraints.php.inc
index 810464e..d27768a 100644
--- a/tests/Sets/ContentRepository90/Fixture/nodetype-constraints.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/nodetype-constraints.php.inc
@@ -48,31 +48,24 @@ class SomeClass
public function doSomething()
{
// TODO 9.0 migration: !! The "NodeTypeConstraintFactory" has been removed in Neos 9. Please use the proper filter in subgraph finders e.g. "FindChildNodesFilter" for ContentSubgraphInterface::findChildNodes().
-
$constraints = $this->nodeTypeConstraintFactory->parseFilterString('Neos.Neos:Document');
}
public function doSomethingElse()
{
// TODO 9.0 migration: !! NodeTypeConstraints is removed in Neos 9.0. Please use the proper filter in subgraph finders e.g. "FindChildNodesFilter" for ContentSubgraphInterface::findChildNodes().
-
$constraints = new NodeTypeConstraints();
- // TODO 9.0 migration: !! NodeTypeConstraints has been removed in Neos 9. Please use the proper filter in subgraph finders e.g. "FindChildNodesFilter" for ContentSubgraphInterface::findChildNodes().
-
+ // TODO 9.0 migration: !! NodeTypeConstraints has been removed in Neos 9. Please use the proper filter in subgraph finders e.g. "FindChildNodesFilter" for ContentSubgraphInterface::findChildNodes().
$constraints->asLegacyNodeTypeFilterString();
// TODO 9.0 migration: !! NodeTypeConstraints has been removed in Neos 9. Please use the proper filter in subgraph finders e.g. "FindChildNodesFilter" for ContentSubgraphInterface::findChildNodes().
-
$constraints->getExplicitlyAllowedNodeTypeNames();
// TODO 9.0 migration: !! NodeTypeConstraints has been removed in Neos 9. Please use the proper filter in subgraph finders e.g. "FindChildNodesFilter" for ContentSubgraphInterface::findChildNodes().
-
$constraints->getExplicitlyDisallowedNodeTypeNames();
// TODO 9.0 migration: !! NodeTypeConstraints has been removed in Neos 9. Please use the proper filter in subgraph finders e.g. "FindChildNodesFilter" for ContentSubgraphInterface::findChildNodes().
-
$constraints->isWildcardAllowed();
$constraints->matches();
// TODO 9.0 migration: !! NodeTypeConstraints has been removed in Neos 9. Please use the proper filter in subgraph finders e.g. "FindChildNodesFilter" for ContentSubgraphInterface::findChildNodes().
-
$constraints->withExplicitlyDisallowedNodeType();
}
diff --git a/tests/Sets/ContentRepository90/Fixture/nodetype-manager.php.inc b/tests/Sets/ContentRepository90/Fixture/nodetype-manager.php.inc
index 6dff573..d8aa52d 100644
--- a/tests/Sets/ContentRepository90/Fixture/nodetype-manager.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/nodetype-manager.php.inc
@@ -70,6 +70,7 @@ class Storage
if ($node === null) {
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
+
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$node = $this->node()->createNode($vendor, $contentRepository->getNodeTypeManager()->getNodeType('Neos.MarketPlace:Vendor'));
$node->setProperty('uriPathSegment', $vendor);
@@ -78,7 +79,6 @@ class Storage
$nodeTypeManager = $this->getNodeTypeManager();
// TODO 9.0 migration: !! NodeTypeManager::createNodeType() was never implemented and is removed in Neos 9.0.
-
$nodeTypeManager->createNodeType('Neos.MarketPlace:New');
return $node;
}
@@ -86,6 +86,7 @@ class Storage
public function getNodeTypeManager(): \Neos\ContentRepository\Core\NodeType\NodeTypeManager
{
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
+
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
return $contentRepository->getNodeTypeManager();
}
diff --git a/tests/Sets/ContentRepository90/Fixture/primary-content.fusion.inc b/tests/Sets/ContentRepository90/Fixture/primary-content.fusion.inc
deleted file mode 100644
index 646d2f3..0000000
--- a/tests/Sets/ContentRepository90/Fixture/primary-content.fusion.inc
+++ /dev/null
@@ -1,22 +0,0 @@
-prototype(Neos.Neos:PrimaryContent) {
- myArticle {
- condition = ${q(node).is('[instanceof My.Site:Article]')}
- renderer = My.Site:ArticleRenderer
- }
-}
-
-content = Neos.Neos:PrimaryContent {
- nodePath = 'main'
-}
------
-// TODO 9.0 migration: "Neos.Neos:PrimaryContent" has been removed without a complete replacement. We replaced all usages with "Neos.Neos:ContentCollection" but not the prototype definition. Please check the replacements and if you have overridden the "Neos.Neos:PrimaryContent" prototype and rewrite it for your needs.
-prototype(Neos.Neos:PrimaryContent) {
- myArticle {
- condition = ${q(node).is('[instanceof My.Site:Article]')}
- renderer = My.Site:ArticleRenderer
- }
-}
-
-content = Neos.Neos:ContentCollection {
- nodePath = 'main'
-}
diff --git a/tests/Sets/ContentRepository90/Fixture/rename-node-interface-classes.php.inc b/tests/Sets/ContentRepository90/Fixture/rename-node-interface-classes.php.inc
index 2a12d8c..6d10b61 100644
--- a/tests/Sets/ContentRepository90/Fixture/rename-node-interface-classes.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/rename-node-interface-classes.php.inc
@@ -34,9 +34,8 @@ class SomeClass extends AnotherClass
public function foo(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node, \Neos\ContentRepository\Core\Projection\ContentGraph\Node $targetNode)
{
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);
- // TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call.
-
/** @var array<\Neos\ContentRepository\Core\Projection\ContentGraph\Node> $childNodes */
+ // TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call.
$childNodes = iterator_to_array($subgraph->findChildNodes($node->aggregateId, \Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter::create()));
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($targetNode);
diff --git a/tests/Sets/ContentRepository90/Fixture/workspace.php.inc b/tests/Sets/ContentRepository90/Fixture/workspace.php.inc
index 53a05c1..9d9e1bf 100644
--- a/tests/Sets/ContentRepository90/Fixture/workspace.php.inc
+++ b/tests/Sets/ContentRepository90/Fixture/workspace.php.inc
@@ -68,80 +68,65 @@ class SomeClass extends AnotherClass
protected \Neos\Neos\Domain\Service\WorkspaceService $workspaceService;
public function test(\Neos\ContentRepository\Core\SharedModel\Workspace\Workspace $workspace)
{
+
// TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead and make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$baseWorkspace = $contentRepository->findWorkspaceByName($workspace->baseWorkspaceName);
+
// TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead and make this code aware of multiple Content Repositories.
$contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'));
$baseWorkspaces = $contentRepository->findWorkspaces()->getBaseWorkspaces($workspace->workspaceName);
- // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
-
- $title = $this->workspaceService->getWorkspaceMetadata(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName)->title->value;
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
+ $title = $this->workspaceService->getWorkspaceMetadata(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName)->title->value;
-
+ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$description = $this->workspaceService->getWorkspaceMetadata(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName)->description->value;
- // TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead.
-
+ // TODO 9.0 migration: Check if you could change your code to work with the WorkspaceName value object instead.
$name = $workspace->workspaceName->value;
- // TODO 9.0 migration: !! Workspace::getNodeCount() has been removed in Neos 9.0 without a replacement.
-
+ // TODO 9.0 migration: !! Workspace::getNodeCount() has been removed in Neos 9.0 without a replacement.
$workspace->getNodeCount();
- // TODO 9.0 migration: !! Workspace::getOwner() has been removed in Neos 9.0. Use WorkspaceService::getWorkspaceMetadata()->ownerUserId to get the userId of the owner.
-
+ // TODO 9.0 migration: !! Workspace::getOwner() has been removed in Neos 9.0. Use WorkspaceService::getWorkspaceMetadata()->ownerUserId to get the userId of the owner.
$workspace->getOwner();
- // TODO 9.0 migration: !! Workspace::getRootNodeData() has been removed in Neos 9.0 without a replacement.
-
+ // TODO 9.0 migration: !! Workspace::getRootNodeData() has been removed in Neos 9.0 without a replacement.
$workspace->getRootNodeData();
- // TODO 9.0 migration: !! Workspace::isInternalWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()
-
+ // TODO 9.0 migration: !! Workspace::isInternalWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()
$workspace->isInternalWorkspace();
- // TODO 9.0 migration: !! Workspace::isPersonalWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()
-
+ // TODO 9.0 migration: !! Workspace::isPersonalWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()
$workspace->isPersonalWorkspace();
- // TODO 9.0 migration: !! Workspace::isPrivateWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()
-
+ // TODO 9.0 migration: !! Workspace::isPrivateWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()
$workspace->isPrivateWorkspace();
- // TODO 9.0 migration: !! Workspace::isPublicWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()
-
+ // TODO 9.0 migration: !! Workspace::isPublicWorkspace() has been removed in Neos 9.0. Please use the new Workspace permission api instead. See ContentRepositoryAuthorizationService::getWorkspacePermissions()
$workspace->isPublicWorkspace();
- // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
-
+ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$this->workspacePublishingService->publishWorkspace(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName);
- // TODO 9.0 migration: Check if this matches your requirements as this is not a 100% replacement. Make this code aware of multiple Content Repositories.
-
+ // TODO 9.0 migration: Check if this matches your requirements as this is not a 100% replacement. Make this code aware of multiple Content Repositories.
$this->workspacePublishingService->publishChangesInDocument(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, $node);
- // TODO 9.0 migration: !! Workspace::publishNodes() has been removed in Neos 9.0. Use the \Neos\Neos\Domain\Service\WorkspacePublishingService to publish a workspace or changes in a document.
-
+ // TODO 9.0 migration: !! Workspace::publishNodes() has been removed in Neos 9.0. Use the \Neos\Neos\Domain\Service\WorkspacePublishingService to publish a workspace or changes in a document.
$workspace->publishNodes([$node], $targetWorkspace);
- // TODO 9.0 migration: !! Workspace::setBaseWorkspace() is not supported by the new CR. Use the "ChangeBaseWorkspace" command to change the baseWorkspace of a workspace.
-
+ // TODO 9.0 migration: !! Workspace::setBaseWorkspace() is not supported by the new CR. Use the "ChangeBaseWorkspace" command to change the baseWorkspace of a workspace.
$workspace->setBaseWorkspace($baseWorkspace);
- // TODO 9.0 migration: !! Workspace::setOwner() has been removed in Neos 9.0. You can set the owner of a workspace during creation WorkspaceService::createPersonalWorkspace().
-
+ // TODO 9.0 migration: !! Workspace::setOwner() has been removed in Neos 9.0. You can set the owner of a workspace during creation WorkspaceService::createPersonalWorkspace().
$workspace->setOwner($user);
- // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
-
- $this->workspaceService->setWorkspaceDescription(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, \Neos\Neos\Domain\Model\WorkspaceDescription::fromString("description"));
// TODO 9.0 migration: Make this code aware of multiple Content Repositories.
+ $this->workspaceService->setWorkspaceDescription(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, \Neos\Neos\Domain\Model\WorkspaceDescription::fromString("description"));
-
+ // TODO 9.0 migration: Make this code aware of multiple Content Repositories.
$this->workspaceService->setWorkspaceTitle(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default'), $workspace->workspaceName, \Neos\Neos\Domain\Model\WorkspaceTitle::fromString("title"));
}
}
diff --git a/tests/Sets/Neos84/Fixture/some_class.php.inc b/tests/Sets/Neos84/Fixture/some_class.php.inc
deleted file mode 100644
index 354e367..0000000
--- a/tests/Sets/Neos84/Fixture/some_class.php.inc
+++ /dev/null
@@ -1,27 +0,0 @@
-
------
-
diff --git a/tests/Sets/Neos84/Fixture/some_file.fusion.inc b/tests/Sets/Neos84/Fixture/some_file.fusion.inc
deleted file mode 100644
index fd76417..0000000
--- a/tests/Sets/Neos84/Fixture/some_file.fusion.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- }
-}
------
-prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {
-
- renderer = Neos.Fusion:Component {
-
- }
-}
diff --git a/tests/Sets/Neos84/Neos84Test.php b/tests/Sets/Neos84/Neos84Test.php
deleted file mode 100644
index 3f07d03..0000000
--- a/tests/Sets/Neos84/Neos84Test.php
+++ /dev/null
@@ -1,33 +0,0 @@
-doTestFile($fileInfo);
- }
-
- /**
- * @return \Iterator
- */
- public function provideData(): \Iterator
- {
- $append = new \AppendIterator();
- $append->append($this->yieldFilesFromDirectory(__DIR__ . '/Fixture'));
- $append->append($this->yieldFilesFromDirectory(__DIR__ . '/Fixture', '*.fusion.inc'));
- return $append;
- }
-
- public function provideConfigFilePath(): string
- {
- return __DIR__ . '/../../../config/set/neos-84.php';
- }
-}