Skip to content

Commit 6809ba5

Browse files
committed
fix
1 parent a509065 commit 6809ba5

4 files changed

Lines changed: 31 additions & 4 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php // lint < 8.1
2+
3+
namespace PropertiesNamespacePhp81;
4+
5+
use PropertiesNamespace\Bar;
6+
use function PHPStan\Testing\assertType;
7+
8+
use SomeNamespace\Amet as Dolor;
9+
use SomeGroupNamespace\{One, Two as Too, Three};
10+
11+
/**
12+
* @property-read string $documentElement
13+
*/
14+
abstract class Foo extends Bar
15+
{
16+
public function doFoo()
17+
{
18+
assertType('string', $this->documentElement);
19+
}
20+
21+
}

tests/PHPStan/Analyser/nsrt/properties.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<?php
1+
<?php // lint >= 8.1
22

33
namespace PropertiesNamespace;
44

55
use function PHPStan\Testing\assertType;
66

77
use SomeNamespace\Amet as Dolor;
88
use SomeGroupNamespace\{One, Two as Too, Three};
9+
use const PHP_VERSION_ID;
910

1011
/**
1112
* @property-read string $overriddenReadOnlyProperty
@@ -166,7 +167,7 @@ public function doFoo()
166167
assertType('PropertiesNamespace\Bar', $this->implicitInheritDocProperty);
167168
assertType('int', $this->readOnlyProperty);
168169
assertType('string', $this->overriddenReadOnlyProperty);
169-
assertType(PHP_VERSION_ID < 80100 ? 'string' : 'DOMElement|null', $this->documentElement);
170+
assertType('DOMElement|null', $this->documentElement);
170171
}
171172

172173
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php // lint < 8.3
2+
3+
use function PHPStan\Testing\assertType;
4+
5+
assertType('array{2.0, 3.0, 4.0, 5.0}', range(2, 5, 1.0));

tests/PHPStan/Analyser/nsrt/range-function.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php // lint >= 8.3
22

33
use function PHPStan\Testing\assertType;
44

@@ -14,7 +14,7 @@
1414
assertType('array{2, 3, 4, 5}', range(2, 5));
1515
assertType('array{2, 4}', range(2, 5, 2));
1616
assertType('array{2, 0}', range(2, '', 2));
17-
assertType(PHP_VERSION_ID < 80300 ? 'array{2.0, 3.0, 4.0, 5.0}' : 'array{2, 3, 4, 5}', range(2, 5, 1.0));
17+
assertType('array{2, 3, 4, 5}', range(2, 5, 1.0));
1818
assertType('array{2.1, 3.1, 4.1}', range(2.1, 5));
1919
assertType('non-empty-list<int>', range(2, 5, $integer));
2020
assertType('non-empty-list<float|int>', range($float, 5, $integer));

0 commit comments

Comments
 (0)