Skip to content

Commit 9c30772

Browse files
Merge branch '5.2' into 5.3
* 5.2: [HttpClient] fix compat with cURL <= 7.37 Remove Debug component from patch-types.php [Config] fix tracking attributes in ReflectionClassResource [Process] Fix incorrect parameter type [HttpFoundation] Handle tentative return types
2 parents a5ef5a9 + 82a7f66 commit 9c30772

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

Resource/ReflectionClassResource.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ private function computeHash(): string
121121

122122
private function generateSignature(\ReflectionClass $class): iterable
123123
{
124+
if (\PHP_VERSION_ID >= 80000) {
125+
$attributes = [];
126+
foreach ($class->getAttributes() as $a) {
127+
$attributes[] = [$a->getName(), $a->getArguments()];
128+
}
129+
yield print_r($attributes, true);
130+
$attributes = [];
131+
}
132+
124133
yield $class->getDocComment();
125134
yield (int) $class->isFinal();
126135
yield (int) $class->isAbstract();
@@ -137,6 +146,14 @@ private function generateSignature(\ReflectionClass $class): iterable
137146
$defaults = $class->getDefaultProperties();
138147

139148
foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
149+
if (\PHP_VERSION_ID >= 80000) {
150+
foreach ($p->getAttributes() as $a) {
151+
$attributes[] = [$a->getName(), $a->getArguments()];
152+
}
153+
yield print_r($attributes, true);
154+
$attributes = [];
155+
}
156+
140157
yield $p->getDocComment();
141158
yield $p->isDefault() ? '<default>' : '';
142159
yield $p->isPublic() ? 'public' : 'protected';
@@ -147,9 +164,25 @@ private function generateSignature(\ReflectionClass $class): iterable
147164
}
148165

149166
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) {
167+
if (\PHP_VERSION_ID >= 80000) {
168+
foreach ($m->getAttributes() as $a) {
169+
$attributes[] = [$a->getName(), $a->getArguments()];
170+
}
171+
yield print_r($attributes, true);
172+
$attributes = [];
173+
}
174+
150175
$defaults = [];
151176
$parametersWithUndefinedConstants = [];
152177
foreach ($m->getParameters() as $p) {
178+
if (\PHP_VERSION_ID >= 80000) {
179+
foreach ($p->getAttributes() as $a) {
180+
$attributes[] = [$a->getName(), $a->getArguments()];
181+
}
182+
yield print_r($attributes, true);
183+
$attributes = [];
184+
}
185+
153186
if (!$p->isDefaultValueAvailable()) {
154187
$defaults[$p->name] = null;
155188

Tests/Resource/ReflectionClassResourceTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ public function provideHashedSignature(): iterable
121121
{
122122
yield [false, 0, "// line change\n\n"];
123123
yield [true, 0, '/** class docblock */'];
124+
125+
if (\PHP_VERSION_ID >= 80000) {
126+
yield [true, 0, '#[Foo]'];
127+
}
128+
124129
yield [true, 1, 'abstract class %s'];
125130
yield [true, 1, 'final class %s'];
126131
yield [true, 1, 'class %s extends Exception'];
@@ -140,6 +145,12 @@ public function provideHashedSignature(): iterable
140145
yield [false, 11, "public function pub(\$arg = null) {\nreturn 123;\n}"];
141146
yield [true, 12, '/** prot docblock */'];
142147
yield [true, 13, 'protected function prot($a = [123]) {}'];
148+
149+
if (\PHP_VERSION_ID >= 80000) {
150+
yield [true, 13, '#[Foo] protected function prot($a = []) {}'];
151+
yield [true, 13, 'protected function prot(#[Foo] $a = []) {}'];
152+
}
153+
143154
yield [false, 14, '/** priv docblock */'];
144155
yield [false, 15, ''];
145156

0 commit comments

Comments
 (0)