Skip to content

Commit

Permalink
BUGFIX Regex for fetching node properties
Browse files Browse the repository at this point in the history
  • Loading branch information
dlubitz committed Jun 17, 2024
1 parent c1d087a commit 03dba3f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/ContentRepository90/Rules/FusionNodeContextPathRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public function refactorFileContent(string $fileContent): string
{
return EelExpressionTransformer::parse($fileContent)
->process(fn(string $eelExpression) => preg_replace(
'/(node|documentNode|site)\.contextPath([^\w(]|$)/',
'Neos.Node.serializedNodeAddress($1)$2',
'/(node|documentNode|site)\.contextPath\b(?!\.|\()/',
'Neos.Node.serializedNodeAddress($1)',
$eelExpression
))
->addCommentsIfRegexMatches(
'/\.contextPath([^\w(]|$)/',
'/\.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(
Expand Down
6 changes: 3 additions & 3 deletions src/ContentRepository90/Rules/FusionNodeDepthRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public function refactorFileContent(string $fileContent): string
{
return EelExpressionTransformer::parse($fileContent)
->process(fn(string $eelExpression) => preg_replace(
'/([a-zA-Z.]+)?(site|node|documentNode)\.depth([^\w(]|$)/',
'Neos.Node.depth($1$2)$3',
'/([a-zA-Z.]+)?(site|node|documentNode)\.depth\b(?!\.|\()/',
'Neos.Node.depth($1$2)',
$eelExpression
))
->addCommentsIfRegexMatches(
'/\.depth([^\w(]|$)/',
'/\.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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public function refactorFileContent(string $fileContent): string
{
return EelExpressionTransformer::parse($fileContent)
->process(fn(string $eelExpression) => preg_replace(
'/(node|documentNode|site)\.hiddenInIndex([^\w(]|$)/',
'$1.property(\'hiddenInIndex\')$2',
'/(node|documentNode|site)\.hiddenInIndex\b(?!\.|\()/',
'$1.property(\'hiddenInIndex\')',
$eelExpression
))
->addCommentsIfRegexMatches(
'/\.hiddenInIndex([^\w(]|$)/',
'/\.hiddenInIndex\b(?!\.|\()/',
'// TODO 9.0 migration: Line %LINE: You may need to rewrite "VARIABLE.hiddenInIndex" to VARIABLE.property(\'hiddenInIndex\'). We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
)
->process(fn(string $eelExpression) => preg_replace(
Expand Down
6 changes: 3 additions & 3 deletions src/ContentRepository90/Rules/FusionNodePathRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public function refactorFileContent(string $fileContent): string
{
return EelExpressionTransformer::parse($fileContent)
->process(fn(string $eelExpression) => preg_replace(
'/(node|documentNode|site)\.path([^\w(]|$)/',
'Neos.Node.path($1)$2',
'/(node|documentNode|site)\.path\b(?!\.|\()/',
'Neos.Node.path($1)',
$eelExpression
))
->addCommentsIfRegexMatches(
'/\.path([^\w(]|$)/',
'/\.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(
Expand Down

0 comments on commit 03dba3f

Please sign in to comment.