Don't add value of (default/static) objects to the signature

This commit is contained in:
Arjen van der Meijden 2019-07-30 11:09:02 +02:00
parent 67631723d2
commit a80e56c460
2 changed files with 15 additions and 1 deletions

View File

@ -140,7 +140,7 @@ class ReflectionClassResource implements SelfCheckingResourceInterface, \Seriali
foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) {
yield $p->getDocComment().$p;
yield print_r(isset($defaults[$p->name]) ? $defaults[$p->name] : null, true);
yield print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, true);
}
}

View File

@ -170,6 +170,15 @@ EOPHP;
$res = new ReflectionClassResource(new \ReflectionClass(TestServiceSubscriber::class));
$this->assertTrue($res->isFresh(0));
}
public function testIgnoresObjectsInSignature()
{
$res = new ReflectionClassResource(new \ReflectionClass(TestServiceWithStaticProperty::class));
$this->assertTrue($res->isFresh(0));
TestServiceWithStaticProperty::$initializedObject = new TestServiceWithStaticProperty();
$this->assertTrue($res->isFresh(0));
}
}
interface DummyInterface
@ -195,3 +204,8 @@ class TestServiceSubscriber implements ServiceSubscriberInterface
return self::$subscribedServices;
}
}
class TestServiceWithStaticProperty
{
public static $initializedObject;
}