Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Reflection stubs #10091

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dictionaries/CallMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10631,7 +10631,7 @@
'ReflectionParameter::getDefaultValue' => ['mixed'],
'ReflectionParameter::getDefaultValueConstantName' => ['?string'],
'ReflectionParameter::getName' => ['string'],
'ReflectionParameter::getPosition' => ['int'],
'ReflectionParameter::getPosition' => ['int<0, max>'],
'ReflectionParameter::getType' => ['?ReflectionType'],
'ReflectionParameter::hasType' => ['bool'],
'ReflectionParameter::isArray' => ['bool'],
Expand Down
2 changes: 1 addition & 1 deletion dictionaries/CallMap_historical.php
Original file line number Diff line number Diff line change
Expand Up @@ -5969,7 +5969,7 @@
'ReflectionParameter::getDefaultValue' => ['mixed'],
'ReflectionParameter::getDefaultValueConstantName' => ['?string'],
'ReflectionParameter::getName' => ['string'],
'ReflectionParameter::getPosition' => ['int'],
'ReflectionParameter::getPosition' => ['int<0, max>'],
'ReflectionParameter::getType' => ['?ReflectionType'],
'ReflectionParameter::hasType' => ['bool'],
'ReflectionParameter::isArray' => ['bool'],
Expand Down
2 changes: 1 addition & 1 deletion stubs/Php80.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ReflectionAttribute

/**
* @psalm-pure
* @return int-mask-of<Attribute::TARGET_*>
* @return Attribute::TARGET_*
*/
public function getTarget() : int
{
Expand Down
10 changes: 5 additions & 5 deletions stubs/Reflection.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ abstract class ReflectionFunctionAbstract implements Reflector
* @since 8.0
* @template TClass as object
* @param class-string<TClass>|null $name
* @return ($name is null ? array<ReflectionAttribute<object>> : array<ReflectionAttribute<TClass>>)
* @return ($name is null ? list<ReflectionAttribute<object>> : list<ReflectionAttribute<TClass>>)
*/
public function getAttributes(?string $name = null, int $flags = 0): array {}
}
Expand Down Expand Up @@ -463,7 +463,7 @@ class ReflectionProperty implements Reflector
* @since 8.0
* @template TClass as object
* @param class-string<TClass>|null $name
* @return ($name is null ? array<ReflectionAttribute<object>> : array<ReflectionAttribute<TClass>>)
* @return ($name is null ? list<ReflectionAttribute<object>> : list<ReflectionAttribute<TClass>>)
*/
public function getAttributes(?string $name = null, int $flags = 0): array {}

Expand Down Expand Up @@ -540,7 +540,7 @@ class ReflectionProperty implements Reflector
class ReflectionMethod extends ReflectionFunctionAbstract
{
/**
* @var string
* @var non-empty-string
* @readonly
*/
public $name;
Expand Down Expand Up @@ -599,7 +599,7 @@ class ReflectionClassConstant implements Reflector
* @since 8.0
* @template TClass as object
* @param class-string<TClass>|null $name
* @return ($name is null ? array<ReflectionAttribute<object>> : array<ReflectionAttribute<TClass>>)
* @return ($name is null ? list<ReflectionAttribute<object>> : list<ReflectionAttribute<TClass>>)
*/
public function getAttributes(?string $name = null, int $flags = 0): array {}

Expand Down Expand Up @@ -635,7 +635,7 @@ class ReflectionParameter implements Reflector {
* @since 8.0
* @template TClass as object
* @param class-string<TClass>|null $name
* @return ($name is null ? array<ReflectionAttribute<object>> : array<ReflectionAttribute<TClass>>)
* @return ($name is null ? list<ReflectionAttribute<object>> : list<ReflectionAttribute<TClass>>)
*/
public function getAttributes(?string $name = null, int $flags = 0): array {}

Expand Down
Loading