]> granicus.if.org Git - php/commit
Add $filter parameter for ReflectionClass::(getConstants|getReflectionConstants)
authorGabriel Caruso <carusogabriel34@gmail.com>
Sat, 30 May 2020 22:17:31 +0000 (00:17 +0200)
committerGabriel Caruso <carusogabriel34@gmail.com>
Sun, 7 Jun 2020 13:57:48 +0000 (15:57 +0200)
commit7439941d55ea9cf7e1280b6b30f596e34a56512c
treecc289f8b99ce19ef3c8453543966d6f829fd2995
parent84492f5b50e9c0075e7a9d10a4de38f0674a0197
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.
NEWS
UPGRADING
ext/reflection/php_reflection.c
ext/reflection/php_reflection.stub.php
ext/reflection/php_reflection_arginfo.h
ext/reflection/tests/ReflectionClass_getConstants_filter.phpt [new file with mode: 0644]
ext/reflection/tests/ReflectionClass_getReflectionConstants_filter.phpt [new file with mode: 0644]
ext/reflection/tests/ReflectionClass_toString_001.phpt