Skip to content

Commit b91b7b5

Browse files
committed
Added PHP_BUILD_DATE type (PHP 8.5+)
1 parent 3435c3b commit b91b7b5

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Analyser/ConstantResolver.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ public function resolvePredefinedConstant(string $resolvedConstantName): ?Type
159159

160160
return $this->createInteger($minVersion, $maxVersion);
161161
}
162+
// added in PHP 8.5
163+
if ($resolvedConstantName === 'PHP_BUILD_DATE') {
164+
return new IntersectionType([
165+
new StringType(),
166+
new AccessoryNonFalsyStringType(),
167+
]);
168+
}
162169
if ($resolvedConstantName === 'PHP_ZTS') {
163170
return new UnionType([
164171
new ConstantIntegerType(0),
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
use function PHPStan\Testing\assertType;
4+
5+
assertType('non-falsy-string', PHP_BUILD_DATE);

0 commit comments

Comments
 (0)