1--TEST--
2Attributes make use of closure scope.
3--FILE--
4<?php
5
6class Test1
7{
8    private const FOO = 'bar';
9}
10
11class C1
12{
13    private const FOO = 'foo';
14
15    public static function foo()
16    {
17        return #[A1(self::class, self::FOO)] function (#[A1(self::class, self::FOO)] $p) { };
18    }
19}
20
21$ref = new \ReflectionFunction(C1::foo());
22print_r($ref->getAttributes()[0]->getArguments());
23print_r($ref->getParameters()[0]->getAttributes()[0]->getArguments());
24
25echo "\n";
26
27$ref = new \ReflectionFunction(C1::foo()->bindTo(null, Test1::class));
28print_r($ref->getAttributes()[0]->getArguments());
29print_r($ref->getParameters()[0]->getAttributes()[0]->getArguments());
30
31?>
32--EXPECT--
33Array
34(
35    [0] => C1
36    [1] => foo
37)
38Array
39(
40    [0] => C1
41    [1] => foo
42)
43
44Array
45(
46    [0] => Test1
47    [1] => bar
48)
49Array
50(
51    [0] => Test1
52    [1] => bar
53)
54