Skip to content

Commit

Permalink
Fix method signatures for ReflectionProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Jan 16, 2022
1 parent 3c726e7 commit 96b6e16
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dictionaries/CallMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11605,16 +11605,16 @@
'ReflectionProperty::getModifiers' => ['int'],
'ReflectionProperty::getName' => ['string'],
'ReflectionProperty::getType' => ['?ReflectionType'],
'ReflectionProperty::getValue' => ['mixed', 'object='=>'object'],
'ReflectionProperty::getValue' => ['mixed', 'object='=>'object|null'],
'ReflectionProperty::hasType' => ['bool'],
'ReflectionProperty::isDefault' => ['bool'],
'ReflectionProperty::isPrivate' => ['bool'],
'ReflectionProperty::isProtected' => ['bool'],
'ReflectionProperty::isPublic' => ['bool'],
'ReflectionProperty::isStatic' => ['bool'],
'ReflectionProperty::setAccessible' => ['void', 'visible'=>'bool'],
'ReflectionProperty::setValue' => ['void', 'object'=>'null|object', 'value'=>''],
'ReflectionProperty::setValue\'1' => ['void', 'value'=>''],
'ReflectionProperty::setValue' => ['void', 'objectOrValue'=>'mixed', 'value='=>'mixed'],
'ReflectionProperty::setValue\'1' => ['void', 'value'=>'mixed'],
'ReflectionType::__clone' => ['void'],
'ReflectionType::__toString' => ['string'],
'ReflectionType::allowsNull' => ['bool'],
Expand Down
24 changes: 24 additions & 0 deletions tests/MethodSignatureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,30 @@ public function __soapCall(
$this->analyzeFile('somefile.php', new Context());
}

public function testExtendReflectionPropertyOnPhp8(): void
{
$this->project_analyzer->setPhpVersion('8.0', 'tests');

$this->addFile(
'MyReflectionProperty.php',
'<?php
class MyReflectionProperty extends ReflectionProperty
{
public function getValue(?object $object = null): mixed
{
return parent::getValue($object);
}
public function setValue(mixed $objectOrValue, mixed $value = null): void
{
parent::setValue($objectOrValue, $value);
}
}'
);

$this->analyzeFile('MyReflectionProperty.php', new Context());
}

/**
* @return iterable<string,array{string,assertions?:array<string,string>,error_levels?:string[]}>
*/
Expand Down

0 comments on commit 96b6e16

Please sign in to comment.