/** * {@inheritDoc} */ public function checkSignature(ReflectionClass $class, array $parameters) { $propertyName = 'signature' . $this->signatureGenerator->generateSignatureKey($parameters); $signature = $this->signatureGenerator->generateSignature($parameters); $defaultProperties = $class->getDefaultProperties(); if (!isset($defaultProperties[$propertyName])) { throw MissingSignatureException::fromMissingSignature($class, $parameters, $signature); } if ($defaultProperties[$propertyName] !== $signature) { throw InvalidSignatureException::fromInvalidSignature($class, $parameters, $defaultProperties[$propertyName], $signature); } }
public function testFromInvalidSignature() { $exception = InvalidSignatureException::fromInvalidSignature(new ReflectionClass(__CLASS__), array('foo' => 'bar', 'baz' => 'tab'), 'blah', 'expected-signature'); $this->assertInstanceOf('ProxyManager\\Signature\\Exception\\InvalidSignatureException', $exception); $this->assertSame('Found signature "blah" for class "' . __CLASS__ . '" does not correspond to expected signature "expected-signature" for 2 parameters', $exception->getMessage()); }