diff --git a/config/set/contentrepository-90.php b/config/set/contentrepository-90.php
index 9990f63..fa10b9c 100644
--- a/config/set/contentrepository-90.php
+++ b/config/set/contentrepository-90.php
@@ -28,7 +28,6 @@
use Neos\Rector\ContentRepository90\Rules\FusionNodeParentRector;
use Neos\Rector\ContentRepository90\Rules\FusionNodePathRector;
use Neos\Rector\ContentRepository90\Rules\FusionNodeTypeNameRector;
-use Neos\Rector\ContentRepository90\Rules\FusionPrimaryContentRector;
use Neos\Rector\ContentRepository90\Rules\NodeFactoryResetRector;
use Neos\Rector\ContentRepository90\Rules\NodeFindParentNodeRector;
use Neos\Rector\ContentRepository90\Rules\NodeGetChildNodesRector;
@@ -45,7 +44,6 @@
use Neos\Rector\ContentRepository90\Rules\NodeTypeGetAutoCreatedChildNodesRector;
use Neos\Rector\ContentRepository90\Rules\NodeTypeGetNameRector;
use Neos\Rector\ContentRepository90\Rules\NodeTypeGetTypeOfAutoCreatedChildNodeRector;
-use Neos\Rector\ContentRepository90\Rules\NodeTypeHasAutoCreatedChildNodesRector;
use Neos\Rector\ContentRepository90\Rules\WorkspaceGetNameRector;
use Neos\Rector\ContentRepository90\Rules\WorkspaceRepositoryCountByNameRector;
use Neos\Rector\ContentRepository90\Rules\YamlDimensionConfigRector;
@@ -70,6 +68,7 @@
use Neos\Rector\ContentRepository90\Rules\FusionNodeHiddenBeforeDateTimeRector;
use Neos\Rector\Generic\Rules\FusionReplacePrototypeNameRector;
use Neos\Rector\Generic\ValueObject\FusionPrototypeNameReplacement;
+use Neos\Rector\Generic\ValueObject\FusionPrototypeNameAddComment;
return static function (RectorConfig $rectorConfig): void {
// Register FusionFileProcessor. All Fusion Rectors will be auto-registered at this processor.
@@ -380,8 +379,12 @@
/**
* Neos.Neos:PrimaryContent
+ * Neos.Fusion:Attributes
*/
- $rectorConfig->rule(FusionPrimaryContentRector::class);
+ $rectorConfig->ruleWithConfiguration(FusionPrototypeNameAddComment::class, [
+ new FusionPrototypeNameAddComment("Neos.Neos:PrimaryContent", 'TODO 9.0 migration: You need to refactor "Neos.Neos:PrimaryContent" to use "Neos.Neos:ContentCollection" instead.'),
+ 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')
+ ]);
/**
* SPECIAL rules
diff --git a/src/ContentRepository90/Rules/FusionPrimaryContentRector.php b/src/ContentRepository90/Rules/FusionPrimaryContentRector.php
deleted file mode 100644
index 270378d..0000000
--- a/src/ContentRepository90/Rules/FusionPrimaryContentRector.php
+++ /dev/null
@@ -1,29 +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/ValueObject/FusionPrototypeNameAddComment.php b/src/Generic/ValueObject/FusionPrototypeNameAddComment.php
new file mode 100644
index 0000000..5e43fe3
--- /dev/null
+++ b/src/Generic/ValueObject/FusionPrototypeNameAddComment.php
@@ -0,0 +1,13 @@
+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(FusionPrimaryContentRector::class);
-};
diff --git a/tests/ContentRepository90/Rules/FusionPrimaryContentRector/Fixture/some_file.fusion.inc b/tests/Generic/Rules/FusionPrototypeNameAddComment/Fixture/primary1.fusion.inc
similarity index 100%
rename from tests/ContentRepository90/Rules/FusionPrimaryContentRector/Fixture/some_file.fusion.inc
rename to tests/Generic/Rules/FusionPrototypeNameAddComment/Fixture/primary1.fusion.inc
diff --git a/tests/ContentRepository90/Rules/FusionPrimaryContentRector/Fixture/some_file2.fusion.inc b/tests/Generic/Rules/FusionPrototypeNameAddComment/Fixture/primary2.fusion.inc
similarity index 100%
rename from tests/ContentRepository90/Rules/FusionPrimaryContentRector/Fixture/some_file2.fusion.inc
rename to tests/Generic/Rules/FusionPrototypeNameAddComment/Fixture/primary2.fusion.inc
diff --git a/tests/Generic/Rules/FusionPrototypeNameAddComment/Fixture/some_file.fusion.inc b/tests/Generic/Rules/FusionPrototypeNameAddComment/Fixture/some_file.fusion.inc
new file mode 100644
index 0000000..d5c6d0c
--- /dev/null
+++ b/tests/Generic/Rules/FusionPrototypeNameAddComment/Fixture/some_file.fusion.inc
@@ -0,0 +1,33 @@
+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/ContentRepository90/Rules/FusionPrimaryContentRector/FusionPrimaryContentRectorTest.php b/tests/Generic/Rules/FusionPrototypeNameAddComment/FusionPrototypeNameCommentTest.php
similarity index 75%
rename from tests/ContentRepository90/Rules/FusionPrimaryContentRector/FusionPrimaryContentRectorTest.php
rename to tests/Generic/Rules/FusionPrototypeNameAddComment/FusionPrototypeNameCommentTest.php
index 83b6d46..0431bec 100644
--- a/tests/ContentRepository90/Rules/FusionPrimaryContentRector/FusionPrimaryContentRectorTest.php
+++ b/tests/Generic/Rules/FusionPrototypeNameAddComment/FusionPrototypeNameCommentTest.php
@@ -1,10 +1,12 @@
-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.'),
+ ]);
+};