Skip to content

Commit bbd9a68

Browse files
committed
Add open-resource type
See phpstan/phpstan#10399
1 parent 72289d7 commit bbd9a68

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/PhpDoc/TypeNodeResolver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ private function resolveIdentifierTypeNode(IdentifierTypeNode $typeNode, NameSco
358358

359359
return new ResourceType();
360360

361+
case 'open-resource':
361362
case 'closed-resource':
362363
return new ResourceType();
363364

tests/PHPStan/Analyser/data/more-types.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Foo
1111
* @param pure-callable $pureCallable
1212
* @param callable-array $callableArray
1313
* @param closed-resource $closedResource
14+
* @param open-resource $openResource
1415
* @param enum-string $enumString
1516
* @param non-empty-literal-string $nonEmptyLiteralString
1617
* @param non-empty-scalar $nonEmptyScalar
@@ -21,6 +22,7 @@ public function doFoo(
2122
$pureCallable,
2223
$callableArray,
2324
$closedResource,
25+
$openResource,
2426
$enumString,
2527
$nonEmptyLiteralString,
2628
$nonEmptyScalar,
@@ -31,6 +33,7 @@ public function doFoo(
3133
assertType('callable(): mixed', $pureCallable);
3234
assertType('array&callable(): mixed', $callableArray);
3335
assertType('resource', $closedResource);
36+
assertType('resource', $openResource);
3437
assertType('class-string', $enumString);
3538
assertType('literal-string&non-empty-string', $nonEmptyLiteralString);
3639
assertType('float|int<min, -1>|int<1, max>|non-falsy-string|true', $nonEmptyScalar);

0 commit comments

Comments
 (0)