Skip to content

Commit 1943171

Browse files
Merge branch '3.4' into 4.3
* 3.4: Fix travis script minor fix for wrong case [HttpFoundation] Fix `getMaxFilesize` [Cache] fix warning on PHP 7.4 [Console] fix warning on PHP 7.4 Don't add value of (default/static) objects to the signature fix(yml): fix comment in milti line value
2 parents a17a2ae + 5b3060c commit 1943171

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Resource/ReflectionClassResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private function generateSignature(\ReflectionClass $class)
136136

137137
foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
138138
yield $p->getDocComment().$p;
139-
yield print_r(isset($defaults[$p->name]) ? $defaults[$p->name] : null, true);
139+
yield print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, true);
140140
}
141141
}
142142

Tests/Resource/ReflectionClassResourceTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ public function testServiceSubscriber()
185185
$res = new ReflectionClassResource(new \ReflectionClass(TestServiceSubscriber::class));
186186
$this->assertTrue($res->isFresh(0));
187187
}
188+
189+
public function testIgnoresObjectsInSignature()
190+
{
191+
$res = new ReflectionClassResource(new \ReflectionClass(TestServiceWithStaticProperty::class));
192+
$this->assertTrue($res->isFresh(0));
193+
194+
TestServiceWithStaticProperty::$initializedObject = new TestServiceWithStaticProperty();
195+
$this->assertTrue($res->isFresh(0));
196+
}
188197
}
189198

190199
interface DummyInterface
@@ -224,3 +233,8 @@ public static function getSubscribedServices()
224233
return self::$subscribedServices;
225234
}
226235
}
236+
237+
class TestServiceWithStaticProperty
238+
{
239+
public static $initializedObject;
240+
}

0 commit comments

Comments
 (0)