From 70bd4c5ffbf2b821dacb458cf118d5276a36e809 Mon Sep 17 00:00:00 2001 From: Denny Lubitz Date: Wed, 1 Nov 2023 19:51:58 +0100 Subject: [PATCH] TASK Refector context methods --- config/set/contentrepository-90.php | 44 +++++++++---------- .../Legacy/NodeLegacyStub.php | 3 ++ .../Rules/NodeFindParentNodeRector.php | 2 +- .../Rules/NodeGetChildNodesRector.php | 2 +- .../NodeGetContextGetWorkspaceNameRector.php | 2 +- .../NodeGetContextGetWorkspaceRector.php | 2 +- .../Rules/NodeGetDepthRector.php | 2 +- .../Rules/NodeGetDimensionsRector.php | 2 +- .../Rules/NodeGetIdentifierRector.php | 2 +- .../Rules/NodeGetParentRector.php | 2 +- .../Rules/NodeGetPathRector.php | 2 +- .../Rules/NodeIsHiddenInIndexRector.php | 2 +- .../Rules/NodeIsHiddenRector.php | 2 +- .../MethodCallToWarningCommentRector.php | 3 +- .../Fixture/some_class.php.inc | 8 ++-- .../Fixture/some_class.php.inc | 8 ++-- .../Fixture/some_class.php.inc | 8 ++-- .../Fixture/some_class.php.inc | 8 ++-- .../Fixture/some_class.php.inc | 8 ++-- ...lready_content_repository_registry.php.inc | 8 ++-- .../Fixture/needs_both.php.inc | 8 ++-- .../needs_content_repository_registry.php.inc | 8 ++-- .../Fixture/some_class.php.inc | 8 ++-- .../config/configured_rule.php | 4 +- ...ll-with-pagination-named-arguments.php.inc | 8 ++-- .../Fixture/all-with-pagination.php.inc | 8 ++-- .../Fixture/all.php.inc | 8 ++-- .../nodetype-filter-with-pagination.php.inc | 8 ++-- .../Fixture/nodetype-filter.php.inc | 8 ++-- .../Fixture/some_class.php.inc | 8 ++-- .../Fixture/some_class.php.inc | 8 ++-- .../Fixture/some_class.php.inc | 8 ++-- .../Fixture/some_class.php.inc | 8 ++-- .../Fixture/some_class.php.inc | 8 ++-- 34 files changed, 116 insertions(+), 112 deletions(-) diff --git a/config/set/contentrepository-90.php b/config/set/contentrepository-90.php index 5280d6e..feab09f 100644 --- a/config/set/contentrepository-90.php +++ b/config/set/contentrepository-90.php @@ -95,37 +95,37 @@ */ // setName // getName - $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(Node::class, 'getName', 'nodeName'); + $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getName', 'nodeName'); // getLabel -> compatible with ES CR node (nothing to do) // setProperty // hasProperty -> compatible with ES CR Node (nothing to do) // getProperty -> compatible with ES CR Node (nothing to do) // removeProperty // getProperties -> PropertyCollectionInterface - $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(Node::class, 'getProperties', 'properties'); + $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getProperties', 'properties'); // getPropertyNames // setContentObject -> DEPRECATED / NON-FUNCTIONAL - $methodCallToWarningComments[] = new MethodCallToWarningComment(Node::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).'); + $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(Node::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).'); + $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(Node::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).'); + $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 // getNodeType: NodeType - $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(Node::class, 'getNodeType', 'nodeType'); + $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getNodeType', 'nodeType'); // setHidden // isHidden $rectorConfig->rule(NodeIsHiddenRector::class); // TODO: Fusion NodeAccess // setHiddenBeforeDateTime - $methodCallToWarningComments[] = new MethodCallToWarningComment(Node::class, 'setHiddenBeforeDateTime', '!! Node::setHiddenBeforeDateTime() 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.'); + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setHiddenBeforeDateTime', '!! Node::setHiddenBeforeDateTime() 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.'); // getHiddenBeforeDateTime - $methodCallToWarningComments[] = new MethodCallToWarningComment(Node::class, 'getHiddenBeforeDateTime', '!! Node::getHiddenBeforeDateTime() 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.'); + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getHiddenBeforeDateTime', '!! Node::getHiddenBeforeDateTime() 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.'); $fusionNodePropertyPathToWarningComments[] = 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.'); // setHiddenAfterDateTime - $methodCallToWarningComments[] = new MethodCallToWarningComment(Node::class, 'setHiddenAfterDateTime', '!! Node::setHiddenAfterDateTime() 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.'); + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setHiddenAfterDateTime', '!! Node::setHiddenAfterDateTime() 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.'); // getHiddenAfterDateTime - $methodCallToWarningComments[] = new MethodCallToWarningComment(Node::class, 'getHiddenAfterDateTime', '!! Node::getHiddenAfterDateTime() 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.'); + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getHiddenAfterDateTime', '!! Node::getHiddenAfterDateTime() 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.'); $fusionNodePropertyPathToWarningComments[] = 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.'); // setHiddenInIndex // isHiddenInIndex @@ -133,9 +133,9 @@ // Fusion: .hiddenInIndex -> node.properties._hiddenInIndex $rectorConfig->rule(FusionNodeHiddenInIndexRector::class); // setAccessRoles - $methodCallToWarningComments[] = new MethodCallToWarningComment(Node::class, 'setAccessRoles', '!! Node::setAccessRoles() is not supported by the new CR.'); + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setAccessRoles', '!! Node::setAccessRoles() is not supported by the new CR.'); // getAccessRoles - $methodCallToWarningComments[] = new MethodCallToWarningComment(Node::class, 'getAccessRoles', '!! Node::getAccessRoles() is not supported by the new CR.'); + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getAccessRoles', '!! Node::getAccessRoles() is not supported by the new CR.'); // getPath $rectorConfig->rule(NodeGetPathRector::class); // Fusion: .depth -> Neos.NodeAccess.depth(node) @@ -149,16 +149,16 @@ // Fusion: .depth -> Neos.Node.depth(node) $rectorConfig->rule(FusionNodeDepthRector::class); // setWorkspace -> internal - $methodCallToWarningComments[] = new MethodCallToWarningComment(Node::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.'); + $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(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.'); + $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->rule(NodeGetIdentifierRector::class); $rectorConfig->rule(FusionNodeIdentifierRector::class); // setIndex -> internal - $methodCallToWarningComments[] = new MethodCallToWarningComment(Node::class, 'setIndex', '!! Node::setIndex() was always internal. To reorder nodes, use the "MoveNodeAggregate" command'); + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setIndex', '!! Node::setIndex() was always internal. To reorder nodes, use the "MoveNodeAggregate" command'); // getIndex - $methodCallToWarningComments[] = new MethodCallToWarningComment(Node::class, 'getIndex', '!! Node::getIndex() is not supported. You can fetch all siblings and inspect the ordering'); + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getIndex', '!! Node::getIndex() is not supported. You can fetch all siblings and inspect the ordering'); // getParent -> Node $rectorConfig->rule(NodeGetParentRector::class); // Fusion: .parent -> Neos.NodeAccess.findParent(node) @@ -175,7 +175,7 @@ // remove() // setRemoved() // isRemoved() - $methodCallToWarningComments[] = new MethodCallToWarningComment(Node::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.'); + $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() @@ -188,7 +188,7 @@ // copyAfter() // copyInto() // getNodeData() - $methodCallToWarningComments[] = new MethodCallToWarningComment(Node::class, 'getNodeData', '!! Node::getNodeData() - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.'); + $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); @@ -210,13 +210,13 @@ // isTethered() // getContentStreamIdentifier() -> threw exception in <= Neos 8.0 - so nobody could have used this // getNodeAggregateIdentifier() - $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(Node::class, 'getNodeAggregateIdentifier', 'nodeAggregateId'); + $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getNodeAggregateIdentifier', 'nodeAggregateId'); $rectorConfig->rule(rectorClass: FusionNodeAggregateIdentifierRector::class); // getNodeTypeName() - $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(Node::class, 'getNodeTypeName', 'nodeTypeName'); + $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(NodeLegacyStub::class, 'getNodeTypeName', 'nodeTypeName'); // getNodeType() ** (included/compatible in old NodeInterface) // getNodeName() - $methodCallToPropertyFetches[] = new MethodCallToPropertyFetch(Node::class, 'getNodeName', 'nodeName'); + $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) @@ -383,7 +383,7 @@ ]); $rectorConfig->ruleWithConfiguration(RenameClassRector::class, [ - LegacyContextStub::class => Node::class, + LegacyContextStub::class => NodeLegacyStub::class, ]); // Should run LAST - as other rules above might create $this->contentRepositoryRegistry calls. diff --git a/src/ContentRepository90/Legacy/NodeLegacyStub.php b/src/ContentRepository90/Legacy/NodeLegacyStub.php index db57d22..820c658 100644 --- a/src/ContentRepository90/Legacy/NodeLegacyStub.php +++ b/src/ContentRepository90/Legacy/NodeLegacyStub.php @@ -2,6 +2,9 @@ namespace Neos\Rector\ContentRepository90\Legacy; +/** + * @deprecated + */ class NodeLegacyStub { diff --git a/src/ContentRepository90/Rules/NodeFindParentNodeRector.php b/src/ContentRepository90/Rules/NodeFindParentNodeRector.php index eb283dc..18c9deb 100644 --- a/src/ContentRepository90/Rules/NodeFindParentNodeRector.php +++ b/src/ContentRepository90/Rules/NodeFindParentNodeRector.php @@ -41,7 +41,7 @@ public function refactor(Node $node): ?Node { assert($node instanceof Node\Expr\MethodCall); - if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class))) { + if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) { return null; } if (!$this->isName($node->name, 'findParentNode')) { diff --git a/src/ContentRepository90/Rules/NodeGetChildNodesRector.php b/src/ContentRepository90/Rules/NodeGetChildNodesRector.php index cfd1029..eafa683 100644 --- a/src/ContentRepository90/Rules/NodeGetChildNodesRector.php +++ b/src/ContentRepository90/Rules/NodeGetChildNodesRector.php @@ -39,7 +39,7 @@ public function refactor(Node $node) : ?Node { assert($node instanceof Node\Expr\MethodCall); - if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class))) { + if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) { return null; } if (!$this->isName($node->name, 'getChildNodes')) { diff --git a/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceNameRector.php b/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceNameRector.php index 08c25d2..defc1c8 100644 --- a/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceNameRector.php +++ b/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceNameRector.php @@ -51,7 +51,7 @@ public function refactor(Node $node): ?Node return null; } - if (!$this->isObjectType($node->var->var, new ObjectType(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class))) { + if (!$this->isObjectType($node->var->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) { return null; } diff --git a/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceRector.php b/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceRector.php index 486150c..a63c834 100644 --- a/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceRector.php +++ b/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceRector.php @@ -51,7 +51,7 @@ public function refactor(Node $node): ?Node return null; } - if (!$this->isObjectType($node->var->var, new ObjectType(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class))) { + if (!$this->isObjectType($node->var->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) { return null; } diff --git a/src/ContentRepository90/Rules/NodeGetDepthRector.php b/src/ContentRepository90/Rules/NodeGetDepthRector.php index b278821..e232dc9 100644 --- a/src/ContentRepository90/Rules/NodeGetDepthRector.php +++ b/src/ContentRepository90/Rules/NodeGetDepthRector.php @@ -39,7 +39,7 @@ public function refactor(Node $node) : ?Node { assert($node instanceof Node\Expr\MethodCall); - if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class))) { + if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) { return null; } if (!$this->isName($node->name, 'getDepth')) { diff --git a/src/ContentRepository90/Rules/NodeGetDimensionsRector.php b/src/ContentRepository90/Rules/NodeGetDimensionsRector.php index ded3438..88c9704 100644 --- a/src/ContentRepository90/Rules/NodeGetDimensionsRector.php +++ b/src/ContentRepository90/Rules/NodeGetDimensionsRector.php @@ -39,7 +39,7 @@ public function refactor(Node $node) : ?Node { assert($node instanceof Node\Expr\MethodCall); - if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class))) { + if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) { return null; } if (!$this->isName($node->name, 'getDimensions')) { diff --git a/src/ContentRepository90/Rules/NodeGetIdentifierRector.php b/src/ContentRepository90/Rules/NodeGetIdentifierRector.php index bbe5599..e75b64b 100644 --- a/src/ContentRepository90/Rules/NodeGetIdentifierRector.php +++ b/src/ContentRepository90/Rules/NodeGetIdentifierRector.php @@ -40,7 +40,7 @@ public function refactor(Node $node): ?Node { assert($node instanceof Node\Expr\MethodCall); - if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class))) { + if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) { return null; } if (!$this->isName($node->name, 'getIdentifier')) { diff --git a/src/ContentRepository90/Rules/NodeGetParentRector.php b/src/ContentRepository90/Rules/NodeGetParentRector.php index b2059fa..a05627e 100644 --- a/src/ContentRepository90/Rules/NodeGetParentRector.php +++ b/src/ContentRepository90/Rules/NodeGetParentRector.php @@ -39,7 +39,7 @@ public function refactor(Node $node) : ?Node { assert($node instanceof Node\Expr\MethodCall); - if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class))) { + if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) { return null; } if (!$this->isName($node->name, 'getParent')) { diff --git a/src/ContentRepository90/Rules/NodeGetPathRector.php b/src/ContentRepository90/Rules/NodeGetPathRector.php index 9711e82..f5d69f8 100644 --- a/src/ContentRepository90/Rules/NodeGetPathRector.php +++ b/src/ContentRepository90/Rules/NodeGetPathRector.php @@ -39,7 +39,7 @@ public function refactor(Node $node) : ?Node { assert($node instanceof Node\Expr\MethodCall); - if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class))) { + if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) { return null; } if (!$this->isName($node->name, 'getPath')) { diff --git a/src/ContentRepository90/Rules/NodeIsHiddenInIndexRector.php b/src/ContentRepository90/Rules/NodeIsHiddenInIndexRector.php index 38ae4c0..96f618a 100644 --- a/src/ContentRepository90/Rules/NodeIsHiddenInIndexRector.php +++ b/src/ContentRepository90/Rules/NodeIsHiddenInIndexRector.php @@ -41,7 +41,7 @@ public function refactor(Node $node) : ?Node { assert($node instanceof MethodCall); - if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class))) { + if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) { return null; } if (!$this->isName($node->name, 'isHiddenInIndex')) { diff --git a/src/ContentRepository90/Rules/NodeIsHiddenRector.php b/src/ContentRepository90/Rules/NodeIsHiddenRector.php index 3a4275f..6e35f89 100644 --- a/src/ContentRepository90/Rules/NodeIsHiddenRector.php +++ b/src/ContentRepository90/Rules/NodeIsHiddenRector.php @@ -41,7 +41,7 @@ public function refactor(Node $node) : ?Node { assert($node instanceof Node\Expr\MethodCall); - if (!$this->isObjectType($node->var, new ObjectType(\Neos\ContentRepository\Core\Projection\ContentGraph\Node::class))) { + if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) { return null; } if (!$this->isName($node->name, 'isHidden')) { diff --git a/src/Generic/Rules/MethodCallToWarningCommentRector.php b/src/Generic/Rules/MethodCallToWarningCommentRector.php index 222d2f3..25bf7aa 100644 --- a/src/Generic/Rules/MethodCallToWarningCommentRector.php +++ b/src/Generic/Rules/MethodCallToWarningCommentRector.php @@ -13,6 +13,7 @@ use Rector\PostRector\Collector\NodesToAddCollector; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; use Webmozart\Assert\Assert; +use Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub; final class MethodCallToWarningCommentRector extends AbstractRector implements ConfigurableRectorInterface { @@ -32,7 +33,7 @@ public function __construct( public function getRuleDefinition(): RuleDefinition { return CodeSampleLoader::fromFile('"Warning comments for various non-supported use cases', __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(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.') ]); } diff --git a/tests/ContentRepository90/Rules/NodeFindParentNodeRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeFindParentNodeRector/Fixture/some_class.php.inc index 40dd79d..23f4f45 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->nodeAggregateId); diff --git a/tests/ContentRepository90/Rules/NodeGetDepthRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeGetDepthRector/Fixture/some_class.php.inc index 0c1396b..9f86276 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->nodeAggregateId)->getDepth(); diff --git a/tests/ContentRepository90/Rules/NodeGetIdentifierRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeGetIdentifierRector/Fixture/some_class.php.inc index 49720be..394c30f 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,11 +14,11 @@ class SomeClass ----- getParent(); } @@ -14,11 +14,11 @@ class SomeClass ----- contentRepositoryRegistry->subgraphForNode($node); return $subgraph->findParentNode($node->nodeAggregateId); diff --git a/tests/ContentRepository90/Rules/NodeIsHiddenInIndexRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeIsHiddenInIndexRector/Fixture/some_class.php.inc index c1f4459..9806675 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('_hiddenInIndex'); } diff --git a/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/has_already_content_repository_registry.php.inc b/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/has_already_content_repository_registry.php.inc index 3b22f18..815bb24 100644 --- a/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/has_already_content_repository_registry.php.inc +++ b/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/has_already_content_repository_registry.php.inc @@ -1,13 +1,13 @@ contentRepositoryRegistry->subgraphForNode($node); } @@ -17,14 +17,14 @@ class SomeClass ----- contentRepositoryRegistry->subgraphForNode($node); } diff --git a/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/needs_both.php.inc b/tests/Generic/Rules/InjectServiceIfNeededRector/Fixture/needs_both.php.inc index 1bac25c..c561c44 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 d0e544c..25bf258 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/Rules/MethodCallToWarningCommentRector/Fixture/some_class.php.inc b/tests/Rules/MethodCallToWarningCommentRector/Fixture/some_class.php.inc index 8196f48..8718bab 100644 --- a/tests/Rules/MethodCallToWarningCommentRector/Fixture/some_class.php.inc +++ b/tests/Rules/MethodCallToWarningCommentRector/Fixture/some_class.php.inc @@ -1,10 +1,10 @@ getWorkspace(); } @@ -14,11 +14,11 @@ class SomeClass ----- ruleWithConfiguration(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(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.') ]); }; 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 fd73667..59fa267 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,11 +15,11 @@ class SomeClass ----- contentRepositoryRegistry->subgraphForNode($node); // TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call. diff --git a/tests/Rules/NodeGetChildNodesRector/Fixture/all-with-pagination.php.inc b/tests/Rules/NodeGetChildNodesRector/Fixture/all-with-pagination.php.inc index dc78754..cae4318 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,11 +15,11 @@ class SomeClass ----- contentRepositoryRegistry->subgraphForNode($node); // TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call. diff --git a/tests/Rules/NodeGetChildNodesRector/Fixture/all.php.inc b/tests/Rules/NodeGetChildNodesRector/Fixture/all.php.inc index 0471fcc..89db80b 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,11 +15,11 @@ class SomeClass ----- contentRepositoryRegistry->subgraphForNode($node); // TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call. 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 5db707c..1668dbf 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,11 +15,11 @@ class SomeClass ----- contentRepositoryRegistry->subgraphForNode($node); // TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call. diff --git a/tests/Rules/NodeGetChildNodesRector/Fixture/nodetype-filter.php.inc b/tests/Rules/NodeGetChildNodesRector/Fixture/nodetype-filter.php.inc index f2f5868..6f322d6 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,11 +15,11 @@ class SomeClass ----- contentRepositoryRegistry->subgraphForNode($node); // TODO 9.0 migration: Try to remove the iterator_to_array($nodes) call. diff --git a/tests/Rules/NodeGetContextGetWorkspaceNameRector/Fixture/some_class.php.inc b/tests/Rules/NodeGetContextGetWorkspaceNameRector/Fixture/some_class.php.inc index 06e335a..f246d9f 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 ----- contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryId); return $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId($node->subgraphIdentity->contentStreamId)->workspaceName; diff --git a/tests/Rules/NodeGetContextGetWorkspaceRector/Fixture/some_class.php.inc b/tests/Rules/NodeGetContextGetWorkspaceRector/Fixture/some_class.php.inc index 47b2614..c50a036 100644 --- a/tests/Rules/NodeGetContextGetWorkspaceRector/Fixture/some_class.php.inc +++ b/tests/Rules/NodeGetContextGetWorkspaceRector/Fixture/some_class.php.inc @@ -1,10 +1,10 @@ getContext()->getWorkspace(); } @@ -14,11 +14,11 @@ class SomeClass ----- contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryId); return $contentRepository->getWorkspaceFinder()->findOneByCurrentContentStreamId($node->subgraphIdentity->contentStreamId); diff --git a/tests/Rules/NodeGetDimensionsRector/Fixture/some_class.php.inc b/tests/Rules/NodeGetDimensionsRector/Fixture/some_class.php.inc index 896692f..28ceab0 100644 --- a/tests/Rules/NodeGetDimensionsRector/Fixture/some_class.php.inc +++ b/tests/Rules/NodeGetDimensionsRector/Fixture/some_class.php.inc @@ -1,10 +1,10 @@ getDimensions(); } @@ -14,11 +14,11 @@ class SomeClass ----- getPath(); } @@ -14,11 +14,11 @@ class SomeClass ----- contentRepositoryRegistry->subgraphForNode($node); // TODO 9.0 migration: Try to remove the (string) cast and make your code more type-safe. diff --git a/tests/Rules/NodeIsHiddenRector/Fixture/some_class.php.inc b/tests/Rules/NodeIsHiddenRector/Fixture/some_class.php.inc index 21c3ccb..1c44129 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 ----- contentRepositoryRegistry->get($node->subgraphIdentity->contentRepositoryId); $nodeHiddenStateFinder = $contentRepository->projectionState(\Neos\ContentRepository\Core\Projection\NodeHiddenState\NodeHiddenStateFinder::class);