Skip to content

Commit

Permalink
Add open-resource type
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jan 7, 2024
1 parent 72289d7 commit bbd9a68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/PhpDoc/TypeNodeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ private function resolveIdentifierTypeNode(IdentifierTypeNode $typeNode, NameSco

return new ResourceType();

case 'open-resource':
case 'closed-resource':
return new ResourceType();

Expand Down
3 changes: 3 additions & 0 deletions tests/PHPStan/Analyser/data/more-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Foo
* @param pure-callable $pureCallable
* @param callable-array $callableArray
* @param closed-resource $closedResource
* @param open-resource $openResource
* @param enum-string $enumString
* @param non-empty-literal-string $nonEmptyLiteralString
* @param non-empty-scalar $nonEmptyScalar
Expand All @@ -21,6 +22,7 @@ public function doFoo(
$pureCallable,
$callableArray,
$closedResource,
$openResource,
$enumString,
$nonEmptyLiteralString,
$nonEmptyScalar,
Expand All @@ -31,6 +33,7 @@ public function doFoo(
assertType('callable(): mixed', $pureCallable);
assertType('array&callable(): mixed', $callableArray);
assertType('resource', $closedResource);
assertType('resource', $openResource);
assertType('class-string', $enumString);
assertType('literal-string&non-empty-string', $nonEmptyLiteralString);
assertType('float|int<min, -1>|int<1, max>|non-falsy-string|true', $nonEmptyScalar);
Expand Down

0 comments on commit bbd9a68

Please sign in to comment.