Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MixedType returns valid properties, methods and constants
- Loading branch information
1 parent
8085989
commit eb8947d
Showing
6 changed files
with
236 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Reflection\Dummy; | ||
|
||
use PHPStan\Broker\Broker; | ||
use PHPStan\Reflection\ClassMemberReflection; | ||
use PHPStan\Reflection\ClassReflection; | ||
use PHPStan\Reflection\MethodReflection; | ||
use PHPStan\Type\MixedType; | ||
use PHPStan\Type\Type; | ||
|
||
class DummyMethodReflection implements MethodReflection | ||
{ | ||
|
||
/** @var string */ | ||
private $name; | ||
|
||
public function __construct(string $name) | ||
{ | ||
$this->name = $name; | ||
} | ||
|
||
public function getDeclaringClass(): ClassReflection | ||
{ | ||
$broker = Broker::getInstance(); | ||
|
||
return $broker->getClass(\stdClass::class); | ||
} | ||
|
||
public function isStatic(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function isPrivate(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function isPublic(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function getName(): string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
public function getPrototype(): ClassMemberReflection | ||
{ | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return \PHPStan\Reflection\ParameterReflection[] | ||
*/ | ||
public function getParameters(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function isVariadic(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function getReturnType(): Type | ||
{ | ||
return new MixedType(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Reflection\Dummy; | ||
|
||
use PHPStan\Broker\Broker; | ||
use PHPStan\Reflection\ClassReflection; | ||
use PHPStan\Reflection\PropertyReflection; | ||
use PHPStan\Type\MixedType; | ||
use PHPStan\Type\Type; | ||
|
||
class DummyPropertyReflection implements PropertyReflection | ||
{ | ||
|
||
public function getDeclaringClass(): ClassReflection | ||
{ | ||
$broker = Broker::getInstance(); | ||
|
||
return $broker->getClass(\stdClass::class); | ||
} | ||
|
||
public function isStatic(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function isPrivate(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function isPublic(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function getType(): Type | ||
{ | ||
return new MixedType(); | ||
} | ||
|
||
public function isReadable(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function isWritable(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace MixedElements; | ||
|
||
function ($mixed) { | ||
die; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters