1--TEST--
2ReflectionClass::getConstants() with $filter
3--FILE--
4<?php
5class A {
6    public const PUBLIC_CONST = 'BAR';
7    public const ANOTHER_PUBLIC_CONST = 'BAZ';
8    protected const PROTECTED_CONST = 'FOO';
9    private const PRIVATE_CONST = 'QUOZ';
10}
11
12class B {
13  public const PUBLIC_CONST = 'BAR';
14  protected const ANOTHER_PROTECTED_CONST = 'BAZ';
15  protected const PROTECTED_CONST = 'FOO';
16  private const PRIVATE_CONST = 'QUOZ';
17}
18
19class C {
20  public const PUBLIC_CONST = 'BAR';
21  protected const PROTECTED_CONST = 'FOO';
22  private const PRIVATE_CONST = 'QUOZ';
23  private const ANOTHER_PRIVATE_CONST = 'BAZ';
24}
25
26$reflectionClassA = new ReflectionClass(A::class);
27var_dump($reflectionClassA->getConstants(ReflectionClassConstant::IS_PUBLIC));
28
29$reflectionClassB = new ReflectionClass(B::class);
30var_dump($reflectionClassB->getConstants(ReflectionClassConstant::IS_PROTECTED));
31
32$reflectionClassC = new ReflectionClass(C::class);
33var_dump($reflectionClassC->getConstants(ReflectionClassConstant::IS_PRIVATE));
34?>
35--EXPECTF--
36array(%d) {
37  ["PUBLIC_CONST"]=>
38  string(%d) "BAR"
39  ["ANOTHER_PUBLIC_CONST"]=>
40  string(%d) "BAZ"
41}
42array(%d) {
43  ["ANOTHER_PROTECTED_CONST"]=>
44  string(%d) "BAZ"
45  ["PROTECTED_CONST"]=>
46  string(%d) "FOO"
47}
48array(%d) {
49  ["PRIVATE_CONST"]=>
50  string(%d) "QUOZ"
51  ["ANOTHER_PRIVATE_CONST"]=>
52  string(%d) "BAZ"
53}
54