Skip to content

Commit 740944e

Browse files
committed
Test detection of deprecated constants
1 parent decb05d commit 740944e

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Drupal\phpstan_fixtures;
4+
5+
class DeprecatedGlobalConstants {
6+
public function test() {
7+
$date = new \DateTime();
8+
$date->setTimezone(new \DateTimeZone(DATETIME_STORAGE_TIMEZONE));
9+
$date->format(DATETIME_DATE_STORAGE_FORMAT);
10+
}
11+
}

tests/src/DeprecationRulesTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,13 @@ public function dataDeprecatedSamples(): \Generator
3838
in Drupal 8.0.0, will be removed before Drupal 9.0.0.'
3939
]
4040
];
41+
yield [
42+
__DIR__ . '/../fixtures/drupal/modules/phpstan_fixtures/src/DeprecatedGlobalConstants.php',
43+
2,
44+
[
45+
'Call to deprecated constant DATETIME_STORAGE_TIMEZONE.',
46+
'Call to deprecated constant DATETIME_DATE_STORAGE_FORMAT.',
47+
]
48+
];
4149
}
4250
}

0 commit comments

Comments
 (0)