Skip to content

Commit

Permalink
Don't add value of (default/static) objects to the signature
Browse files Browse the repository at this point in the history
  • Loading branch information
arjenm committed Jul 30, 2019
1 parent 6763172 commit a80e56c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Expand Up @@ -140,7 +140,7 @@ private function generateSignature(\ReflectionClass $class)

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);
}
}

Expand Down
Expand Up @@ -170,6 +170,15 @@ public function testServiceSubscriber()
$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
Expand All @@ -195,3 +204,8 @@ public static function getSubscribedServices()
return self::$subscribedServices;
}
}

class TestServiceWithStaticProperty
{
public static $initializedObject;
}

0 comments on commit a80e56c

Please sign in to comment.