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 29b3386 commit c1d087a
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/',
'Neos.Node.serializedNodeAddress($1)',
'/(node|documentNode|site)\.contextPath([^\w(]|$)/',
'Neos.Node.serializedNodeAddress($1)$2',
$eelExpression
))
->addCommentsIfRegexMatches(
'/\.contextPath/',
'/\.contextPath([^\w(]|$)/',
'// 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/',
'Neos.Node.depth($1$2)',
'/([a-zA-Z.]+)?(site|node|documentNode)\.depth([^\w(]|$)/',
'Neos.Node.depth($1$2)$3',
$eelExpression
))
->addCommentsIfRegexMatches(
'/\.depth([^(]|$)/',
'/\.depth([^\w(]|$)/',
'// 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/',
'$1.property(\'hiddenInIndex\')',
'/(node|documentNode|site)\.hiddenInIndex([^\w(]|$)/',
'$1.property(\'hiddenInIndex\')$2',
$eelExpression
))
->addCommentsIfRegexMatches(
'/\.hiddenInIndex$/',
'/\.hiddenInIndex([^\w(]|$)/',
'// 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/',
'Neos.Node.path($1)',
'/(node|documentNode|site)\.path([^\w(]|$)/',
'Neos.Node.path($1)$2',
$eelExpression
))
->addCommentsIfRegexMatches(
'/\.path([^(]|$)/',
'/\.path([^\w(]|$)/',
'// 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 c1d087a

Please sign in to comment.