-
-
Notifications
You must be signed in to change notification settings - Fork 863
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for class constant visibility
- Loading branch information
1 parent
ee8e316
commit 67c4046
Showing
10 changed files
with
310 additions
and
5 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
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,8 @@ | ||
includes: | ||
- phpstan.neon | ||
|
||
parameters: | ||
ignoreErrors: | ||
- '#has unknown class ReflectionClassConstant as its type#' | ||
- '#has invalid typehint type ReflectionClassConstant#' | ||
- '#Call to an undefined method ReflectionClass::getReflectionConstant#' |
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,15 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Reflection; | ||
|
||
interface ClassConstantReflection extends ClassMemberReflection | ||
{ | ||
|
||
public function getName(): string; | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getValue(); | ||
|
||
} |
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,56 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Reflection; | ||
|
||
class ClassConstantWithVisibilityReflection implements ClassConstantReflection | ||
{ | ||
|
||
/** @var \PHPStan\Reflection\ClassReflection */ | ||
private $declaringClass; | ||
|
||
/** @var \ReflectionClassConstant */ | ||
private $reflection; | ||
|
||
public function __construct( | ||
ClassReflection $declaringClass, | ||
\ReflectionClassConstant $reflection | ||
) | ||
{ | ||
$this->declaringClass = $declaringClass; | ||
$this->reflection = $reflection; | ||
} | ||
|
||
public function getName(): string | ||
{ | ||
return $this->reflection->getName(); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getValue() | ||
{ | ||
return $this->reflection->getValue(); | ||
} | ||
|
||
public function getDeclaringClass(): ClassReflection | ||
{ | ||
return $this->declaringClass; | ||
} | ||
|
||
public function isStatic(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function isPrivate(): bool | ||
{ | ||
return $this->reflection->isPrivate(); | ||
} | ||
|
||
public function isPublic(): bool | ||
{ | ||
return $this->reflection->isPublic(); | ||
} | ||
|
||
} |
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,66 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Reflection; | ||
|
||
class ObsoleteClassConstantReflection implements ClassConstantReflection | ||
{ | ||
|
||
/** @var \PHPStan\Reflection\ClassReflection */ | ||
private $declaringClass; | ||
|
||
/** @var string */ | ||
private $name; | ||
|
||
/** @var mixed */ | ||
private $value; | ||
|
||
/** | ||
* @param \PHPStan\Reflection\ClassReflection $declaringClass | ||
* @param string $name | ||
* @param mixed $value | ||
*/ | ||
public function __construct( | ||
ClassReflection $declaringClass, | ||
string $name, | ||
$value | ||
) | ||
{ | ||
$this->declaringClass = $declaringClass; | ||
$this->name = $name; | ||
$this->value = $value; | ||
} | ||
|
||
public function getName(): string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getValue() | ||
{ | ||
return $this->value; | ||
} | ||
|
||
public function getDeclaringClass(): ClassReflection | ||
{ | ||
return $this->declaringClass; | ||
} | ||
|
||
public function isStatic(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function isPrivate(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function isPublic(): 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
Oops, something went wrong.