Skip to content

Commit 5e79938

Browse files
gobamglaman
authored andcommitted
Fix sample constant messages to updated deprecation messages (#96)
* Fix sample constant messages to updated deprecation messages * Further grammar fix * Fix tests for new message text * Should fix the class closing brace phpcf fail
1 parent 1d73e1a commit 5e79938

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/Rules/Deprecations/AccessDeprecatedConstant.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public function processNode(Node $node, Scope $scope): array
4040
// nikic/php-parser does not have any comments above the comment.
4141
// possibly due to PHP's internal reflection capabilities?
4242
$deprecatedConstants = [
43-
'DATETIME_STORAGE_TIMEZONE' => 'Deprecated in Drupal 8.5.x and will be removed before Drupal 9.0.x. Use \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::STORAGE_TIMEZONE instead.',
44-
'DATETIME_DATETIME_STORAGE_FORMAT' => 'Deprecated in Drupal 8.5.x and will be removed before Drupal 9.0.x. Use \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::DATETIME_STORAGE_FORMAT instead.',
45-
'DATETIME_DATE_STORAGE_FORMAT' => 'Deprecated in Drupal 8.5.x and will be removed before Drupal 9.0.x. Use \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::DATE_STORAGE_FORMAT instead.',
43+
'DATETIME_STORAGE_TIMEZONE' => 'Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::STORAGE_TIMEZONE instead.',
44+
'DATETIME_DATETIME_STORAGE_FORMAT' => 'Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::DATETIME_STORAGE_FORMAT instead.',
45+
'DATETIME_DATE_STORAGE_FORMAT' => 'Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::DATE_STORAGE_FORMAT instead.',
4646
];
4747
$constantName = $this->broker->resolveConstantName($node->name, $scope);
4848
if (isset($deprecatedConstants[$constantName])) {
@@ -52,5 +52,4 @@ public function processNode(Node $node, Scope $scope): array
5252
}
5353
return [];
5454
}
55-
5655
}

tests/src/DeprecationRulesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public function dataDeprecatedSamples(): \Generator
4242
__DIR__ . '/../fixtures/drupal/modules/phpstan_fixtures/src/DeprecatedGlobalConstants.php',
4343
2,
4444
[
45-
'Call to deprecated constant DATETIME_STORAGE_TIMEZONE: Deprecated in Drupal 8.5.x and will be removed before Drupal 9.0.x. Use \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::STORAGE_TIMEZONE instead.',
46-
'Call to deprecated constant DATETIME_DATE_STORAGE_FORMAT: Deprecated in Drupal 8.5.x and will be removed before Drupal 9.0.x. Use \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::DATE_STORAGE_FORMAT instead.',
45+
'Call to deprecated constant DATETIME_STORAGE_TIMEZONE: Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::STORAGE_TIMEZONE instead.',
46+
'Call to deprecated constant DATETIME_DATE_STORAGE_FORMAT: Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use \Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface::DATE_STORAGE_FORMAT instead.',
4747
]
4848
];
4949
}

0 commit comments

Comments
 (0)