Skip to content

Commit 718a503

Browse files
authored
Replace usages of getLine with getNewLine (#709)
1 parent 641ee1e commit 718a503

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/Rules/Deprecations/ConditionManagerCreateInstanceContextConfigurationRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function processNode(Node $node, Scope $scope): array
4747
if ($keyType instanceof ConstantStringType && $keyType->getValue() === 'context') {
4848
return [
4949
RuleErrorBuilder::message('Passing context values to plugins via configuration is deprecated in drupal:9.1.0 and will be removed before drupal:10.0.0. Instead, call ::setContextValue() on the plugin itself. See https://www.drupal.org/node/3120980')
50-
->line($node->getLine())
50+
->line($node->getStartLine())
5151
->build()
5252
];
5353
}

src/Rules/Drupal/LoadIncludes.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function processNode(Node $node, Scope $scope): array
5353
ModuleHandlerInterface::class,
5454
$moduleName
5555
))
56-
->line($node->getLine())
56+
->line($node->getStartLine())
5757
->build()
5858
];
5959
}
@@ -69,7 +69,7 @@ public function processNode(Node $node, Scope $scope): array
6969
$module->getPath() . '/' . $filename,
7070
ModuleHandlerInterface::class
7171
))
72-
->line($node->getLine())
72+
->line($node->getStartLine())
7373
->build()
7474
];
7575
} catch (\Throwable $e) {
@@ -78,7 +78,7 @@ public function processNode(Node $node, Scope $scope): array
7878
'A file could not be loaded from %s::loadInclude',
7979
ModuleHandlerInterface::class
8080
))
81-
->line($node->getLine())
81+
->line($node->getStartLine())
8282
->build()
8383
];
8484
}

src/Rules/Drupal/ModuleLoadInclude.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function processNode(Node $node, Scope $scope): array
4646
$filename,
4747
$moduleName
4848
))
49-
->line($node->getLine())
49+
->line($node->getStartLine())
5050
->build()
5151
];
5252
}
@@ -60,13 +60,13 @@ public function processNode(Node $node, Scope $scope): array
6060
'File %s could not be loaded from module_load_include.',
6161
$module->getPath() . '/' . $filename
6262
))
63-
->line($node->getLine())
63+
->line($node->getStartLine())
6464
->build()
6565
];
6666
} catch (\Throwable $e) {
6767
return [
6868
RuleErrorBuilder::message('A file could not be loaded from module_load_include')
69-
->line($node->getLine())
69+
->line($node->getStartLine())
7070
->build()
7171
];
7272
}

src/Rules/Drupal/RenderCallbackRule.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function processNode(Node $node, Scope $scope): array
9696
if (!$value instanceof Node\Expr\Array_) {
9797
return [
9898
RuleErrorBuilder::message(sprintf('The "%s" expects a callable array with arguments.', $keyChecked))
99-
->line($node->getLine())->build()
99+
->line($node->getStartLine())->build()
100100
];
101101
}
102102
if (count($value->items) === 0) {
@@ -112,7 +112,7 @@ public function processNode(Node $node, Scope $scope): array
112112
if (!$value instanceof Node\Expr\Array_) {
113113
return [
114114
RuleErrorBuilder::message(sprintf('The "%s" render array value expects an array of callbacks.', $keyChecked))
115-
->line($node->getLine())->build()
115+
->line($node->getStartLine())->build()
116116
];
117117
}
118118
if (count($value->items) === 0) {
@@ -141,7 +141,7 @@ private function doProcessNode(Node\Expr $node, Scope $scope, string $keyChecked
141141
]);
142142

143143
$errors = [];
144-
$errorLine = $node->getLine();
144+
$errorLine = $node->getStartLine();
145145
$type = $this->getType($node, $scope);
146146

147147
foreach ($type->getConstantStrings() as $constantStringType) {

src/Rules/Drupal/Tests/BrowserTestBaseDefaultThemeRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function processNode(Node $node, Scope $scope): array
9595
if ($defaultTheme === null || $defaultTheme === '') {
9696
return [
9797
RuleErrorBuilder::message('Drupal\Tests\BrowserTestBase::$defaultTheme is required. See https://www.drupal.org/node/3083055, which includes recommendations on which theme to use.')
98-
->line($node->getLine())->build(),
98+
->line($node->getStartLine())->build(),
9999
];
100100
}
101101
return [];

0 commit comments

Comments
 (0)