mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Add $filter parameter for ReflectionClass::(getConstants|getReflectionConstants)
This solves [#79628](https://bugs.php.net/79628). Similar to `ReflectionClass::getMethods()` and `ReflectionClass::getProperties()`, this new `$filter` argument allows the filtering of constants defined in a class by their visibility. For that, we create three new constants for `ReflectionClassConstant`: * `IS_PUBLIC` * `IS_PROTECTED` * `IS_PRIVATE` Closes GH-5649.
This commit is contained in:
parent
84492f5b50
commit
7439941d55
8 changed files with 188 additions and 22 deletions
|
@ -263,10 +263,10 @@ class ReflectionClass implements Reflector
|
|||
public function hasConstant(string $name) {}
|
||||
|
||||
/** @return array|null */
|
||||
public function getConstants() {}
|
||||
public function getConstants(int $filter = ReflectionClassConstant::IS_PUBLIC | ReflectionClassConstant::IS_PROTECTED | ReflectionClassConstant::IS_PRIVATE) {}
|
||||
|
||||
/** @return ReflectionClassConstant[] */
|
||||
public function getReflectionConstants() {}
|
||||
public function getReflectionConstants(int $filter = ReflectionClassConstant::IS_PUBLIC | ReflectionClassConstant::IS_PROTECTED | ReflectionClassConstant::IS_PRIVATE) {}
|
||||
|
||||
/** @return mixed */
|
||||
public function getConstant(string $name) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue