From eb75781ccd0549aca241128aaa1ee58984c2ade8 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 16 Jan 2019 07:59:14 +0100 Subject: [PATCH] simplified PHPUnit exception expectations --- .../Security/User/EntityUserProviderTest.php | 4 ++-- .../Component/BrowserKit/Tests/CookieTest.php | 4 ++-- .../Console/Tests/Command/CommandTest.php | 2 +- .../Formatter/OutputFormatterStyleTest.php | 4 ++-- .../CssSelector/Tests/Parser/ParserTest.php | 2 +- .../Tests/Parser/TokenStreamTest.php | 4 ++-- .../Tests/ContainerBuilderTest.php | 2 +- .../EventDispatcher/Tests/GenericEventTest.php | 2 +- .../DateIntervalToArrayTransformerTest.php | 4 ++-- .../DateIntervalToStringTransformerTest.php | 8 ++++---- ...ateTimeToLocalizedStringTransformerTest.php | 2 +- .../DateTimeToStringTransformerTest.php | 8 ++++---- .../DateTimeToTimestampTransformerTest.php | 4 ++-- .../MoneyToLocalizedStringTransformerTest.php | 4 ++-- ...PercentToLocalizedStringTransformerTest.php | 4 ++-- .../Extension/Core/Type/CollectionTypeTest.php | 2 +- .../Component/Form/Tests/FormBuilderTest.php | 4 ++-- .../HttpFoundation/Tests/File/FileTest.php | 2 +- .../Tests/File/MimeType/MimeTypeTest.php | 6 +++--- .../Tests/File/UploadedFileTest.php | 2 +- .../Tests/Config/FileLocatorTest.php | 2 +- .../AbstractNumberFormatterTest.php | 6 +++--- .../Ldap/Tests/Adapter/ExtLdap/AdapterTest.php | 2 +- .../Tests/Adapter/ExtLdap/LdapManagerTest.php | 18 +++++++++--------- src/Symfony/Component/Ldap/Tests/LdapTest.php | 2 +- .../Tests/Generator/UrlGeneratorTest.php | 2 +- .../Routing/Tests/Matcher/UrlMatcherTest.php | 6 +++--- .../Templating/Tests/PhpEngineTest.php | 2 +- .../Tests/Catalogue/AbstractOperationTest.php | 2 +- .../Validator/Tests/ConstraintTest.php | 10 +++++----- .../Tests/Mapping/ClassMetadataTest.php | 4 ++-- .../Tests/Mapping/GetterMetadataTest.php | 2 +- .../Tests/Mapping/Loader/XmlFileLoaderTest.php | 4 ++-- .../Mapping/Loader/YamlFileLoaderTest.php | 2 +- .../Tests/Mapping/MemberMetadataTest.php | 2 +- .../Tests/Mapping/PropertyMetadataTest.php | 4 ++-- 36 files changed, 72 insertions(+), 72 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php index 9d0f79948b..aa09feecda 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php @@ -105,7 +105,7 @@ class EntityUserProviderTest extends TestCase $user1 = new User(null, null, 'user1'); $provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name'); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}( + $this->expectException( 'InvalidArgumentException', 'You cannot refresh a user from the EntityUserProvider that does not contain an identifier. The user object has to be serialized with its own identifier mapped by Doctrine' ); @@ -125,7 +125,7 @@ class EntityUserProviderTest extends TestCase $provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name'); $user2 = new User(1, 2, 'user2'); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}( + $this->expectException( 'Symfony\Component\Security\Core\Exception\UsernameNotFoundException', 'User with id {"id1":1,"id2":2} not found' ); diff --git a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php index 41628b7014..838da8ef14 100644 --- a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php @@ -103,7 +103,7 @@ class CookieTest extends TestCase public function testFromStringThrowsAnExceptionIfCookieIsNotValid() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException'); + $this->expectException('InvalidArgumentException'); Cookie::fromString('foo'); } @@ -116,7 +116,7 @@ class CookieTest extends TestCase public function testFromStringThrowsAnExceptionIfUrlIsNotValid() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException'); + $this->expectException('InvalidArgumentException'); Cookie::fromString('foo=bar', 'foobar'); } diff --git a/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/src/Symfony/Component/Console/Tests/Command/CommandTest.php index 41df51b3e1..2ee16423b6 100644 --- a/src/Symfony/Component/Console/Tests/Command/CommandTest.php +++ b/src/Symfony/Component/Console/Tests/Command/CommandTest.php @@ -188,7 +188,7 @@ class CommandTest extends TestCase public function testSetAliasesNull() { $command = new \TestCommand(); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException'); + $this->expectException('InvalidArgumentException'); $command->setAliases(null); } diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php index 6b67578446..4f2c73415d 100644 --- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php +++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php @@ -41,7 +41,7 @@ class OutputFormatterStyleTest extends TestCase $style->setForeground('default'); $this->assertEquals("\033[39mfoo\033[39m", $style->apply('foo')); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException'); + $this->expectException('InvalidArgumentException'); $style->setForeground('undefined-color'); } @@ -58,7 +58,7 @@ class OutputFormatterStyleTest extends TestCase $style->setBackground('default'); $this->assertEquals("\033[49mfoo\033[49m", $style->apply('foo')); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException'); + $this->expectException('InvalidArgumentException'); $style->setBackground('undefined-color'); } diff --git a/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php b/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php index 024be8101e..66403d4f49 100644 --- a/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php +++ b/src/Symfony/Component/CssSelector/Tests/Parser/ParserTest.php @@ -89,7 +89,7 @@ class ParserTest extends TestCase /** @var FunctionNode $function */ $function = $selectors[0]->getTree(); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException'); + $this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException'); Parser::parseSeries($function->getArguments()); } diff --git a/src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php b/src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php index 44c751ac86..fb47625a89 100644 --- a/src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php +++ b/src/Symfony/Component/CssSelector/Tests/Parser/TokenStreamTest.php @@ -53,7 +53,7 @@ class TokenStreamTest extends TestCase public function testFailToGetNextIdentifier() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException'); + $this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException'); $stream = new TokenStream(); $stream->push(new Token(Token::TYPE_DELIMITER, '.', 2)); @@ -73,7 +73,7 @@ class TokenStreamTest extends TestCase public function testFailToGetNextIdentifierOrStar() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\CssSelector\Exception\SyntaxErrorException'); + $this->expectException('Symfony\Component\CssSelector\Exception\SyntaxErrorException'); $stream = new TokenStream(); $stream->push(new Token(Token::TYPE_DELIMITER, '.', 2)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index d8a671b583..b09da4621b 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -1008,7 +1008,7 @@ class ContainerBuilderTest extends TestCase $container->registerExtension($extension = new \ProjectExtension()); $this->assertSame($container->getExtension('project'), $extension, '->registerExtension() registers an extension'); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException'); + $this->expectException('LogicException'); $container->getExtension('no_registered'); } diff --git a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php index b63f69df14..44485c9930 100644 --- a/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php +++ b/src/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php @@ -92,7 +92,7 @@ class GenericEventTest extends TestCase $this->assertEquals('Event', $this->event['name']); // test getting invalid arg - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException'); + $this->expectException('InvalidArgumentException'); $this->assertFalse($this->event['nameNotExist']); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php index a75fe1145c..f05f321da7 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php @@ -176,7 +176,7 @@ class DateIntervalToArrayTransformerTest extends DateIntervalTestCase { $transformer = new DateIntervalToArrayTransformer(); $this->assertNull($transformer->reverseTransform(null)); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UnexpectedTypeException::class); + $this->expectException(UnexpectedTypeException::class); $transformer->reverseTransform('12345'); } @@ -184,7 +184,7 @@ class DateIntervalToArrayTransformerTest extends DateIntervalTestCase { $transformer = new DateIntervalToArrayTransformer(); $input = array('years' => '1'); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class); + $this->expectException(TransformationFailedException::class); $transformer->reverseTransform($input); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php index 389e0c161d..0029e2fda7 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php @@ -75,7 +75,7 @@ class DateIntervalToStringTransformerTest extends DateIntervalTestCase public function testTransformExpectsDateTime() { $transformer = new DateIntervalToStringTransformer(); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UnexpectedTypeException::class); + $this->expectException(UnexpectedTypeException::class); $transformer->transform('1234'); } @@ -96,7 +96,7 @@ class DateIntervalToStringTransformerTest extends DateIntervalTestCase { $reverseTransformer = new DateIntervalToStringTransformer($format, true); $interval = new \DateInterval($output); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class); + $this->expectException(TransformationFailedException::class); $this->assertDateIntervalEquals($interval, $reverseTransformer->reverseTransform($input)); } @@ -109,14 +109,14 @@ class DateIntervalToStringTransformerTest extends DateIntervalTestCase public function testReverseTransformExpectsString() { $reverseTransformer = new DateIntervalToStringTransformer(); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UnexpectedTypeException::class); + $this->expectException(UnexpectedTypeException::class); $reverseTransformer->reverseTransform(1234); } public function testReverseTransformExpectsValidIntervalString() { $reverseTransformer = new DateIntervalToStringTransformer(); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(TransformationFailedException::class); + $this->expectException(TransformationFailedException::class); $reverseTransformer->reverseTransform('10Y'); } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php index 5653efabd8..ea25c7320e 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php @@ -196,7 +196,7 @@ class DateTimeToLocalizedStringTransformerTest extends TestCase // HOW TO REPRODUCE? - //$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException'); + //$this->expectException('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException'); //$transformer->transform(1.5); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php index c4d04e0e0f..cc2681b305 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php @@ -111,7 +111,7 @@ class DateTimeToStringTransformerTest extends TestCase { $transformer = new DateTimeToStringTransformer(); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException'); + $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException'); $transformer->transform('1234'); } @@ -150,7 +150,7 @@ class DateTimeToStringTransformerTest extends TestCase { $reverseTransformer = new DateTimeToStringTransformer(); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException'); + $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException'); $reverseTransformer->reverseTransform(1234); } @@ -159,7 +159,7 @@ class DateTimeToStringTransformerTest extends TestCase { $reverseTransformer = new DateTimeToStringTransformer(); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException'); + $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException'); $reverseTransformer->reverseTransform('2010-2010-2010'); } @@ -168,7 +168,7 @@ class DateTimeToStringTransformerTest extends TestCase { $reverseTransformer = new DateTimeToStringTransformer(); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException'); + $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException'); $reverseTransformer->reverseTransform('2010-04-31'); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php index ecd5b70b97..4462108cf8 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php @@ -72,7 +72,7 @@ class DateTimeToTimestampTransformerTest extends TestCase { $transformer = new DateTimeToTimestampTransformer(); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException'); + $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException'); $transformer->transform('1234'); } @@ -109,7 +109,7 @@ class DateTimeToTimestampTransformerTest extends TestCase { $reverseTransformer = new DateTimeToTimestampTransformer(); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException'); + $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException'); $reverseTransformer->reverseTransform('2010-2010-2010'); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php index d9fafdff13..0fbf8af6c2 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php @@ -33,7 +33,7 @@ class MoneyToLocalizedStringTransformerTest extends TestCase { $transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException'); + $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException'); $transformer->transform('abcd'); } @@ -61,7 +61,7 @@ class MoneyToLocalizedStringTransformerTest extends TestCase { $transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException'); + $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException'); $transformer->reverseTransform(12345); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php index 3467e891c9..4d7909d3a6 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php @@ -106,7 +106,7 @@ class PercentToLocalizedStringTransformerTest extends TestCase { $transformer = new PercentToLocalizedStringTransformer(); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException'); + $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException'); $transformer->transform('foo'); } @@ -115,7 +115,7 @@ class PercentToLocalizedStringTransformerTest extends TestCase { $transformer = new PercentToLocalizedStringTransformer(); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\TransformationFailedException'); + $this->expectException('Symfony\Component\Form\Exception\TransformationFailedException'); $transformer->reverseTransform(1); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php index 9393c99dc0..56ae48ce70 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php @@ -61,7 +61,7 @@ class CollectionTypeTest extends BaseTypeTest $form = $this->factory->create(static::TESTED_TYPE, null, array( 'entry_type' => TextTypeTest::TESTED_TYPE, )); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\UnexpectedTypeException'); + $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException'); $form->setData(new \stdClass()); } diff --git a/src/Symfony/Component/Form/Tests/FormBuilderTest.php b/src/Symfony/Component/Form/Tests/FormBuilderTest.php index 0326f545af..d0adfb5508 100644 --- a/src/Symfony/Component/Form/Tests/FormBuilderTest.php +++ b/src/Symfony/Component/Form/Tests/FormBuilderTest.php @@ -51,13 +51,13 @@ class FormBuilderTest extends TestCase public function testAddNameNoStringAndNoInteger() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\UnexpectedTypeException'); + $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException'); $this->builder->add(true); } public function testAddTypeNoString() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Form\Exception\UnexpectedTypeException'); + $this->expectException('Symfony\Component\Form\Exception\UnexpectedTypeException'); $this->builder->add('foo', 1234); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php index dbd9c44bd8..8935a4310c 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php @@ -64,7 +64,7 @@ class FileTest extends TestCase public function testConstructWhenFileNotExists() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException'); + $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException'); new File(__DIR__.'/Fixtures/not_here'); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php index bb88807ab0..3960988a6a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php @@ -29,7 +29,7 @@ class MimeTypeTest extends TestCase public function testGuessImageWithDirectory() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException'); + $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException'); MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/directory'); } @@ -53,7 +53,7 @@ class MimeTypeTest extends TestCase public function testGuessWithIncorrectPath() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException'); + $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException'); MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/not_here'); } @@ -72,7 +72,7 @@ class MimeTypeTest extends TestCase @chmod($path, 0333); if ('0333' == substr(sprintf('%o', fileperms($path)), -4)) { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException'); + $this->expectException('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException'); MimeTypeGuesser::getInstance()->guess($path); } else { $this->markTestSkipped('Can not verify chmod operations, change of file permissions failed'); diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php index 6a0b550d79..89eb359dbc 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php @@ -33,7 +33,7 @@ class UploadedFileTest extends TestCase public function testConstructWhenFileNotExists() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException'); + $this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException'); new UploadedFile( __DIR__.'/Fixtures/not_here', diff --git a/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php b/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php index 6265f02755..ca1b3191bd 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Config/FileLocatorTest.php @@ -30,7 +30,7 @@ class FileLocatorTest extends TestCase $kernel ->expects($this->never()) ->method('locateResource'); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('LogicException'); + $this->expectException('LogicException'); $locator->locate('/some/path'); } diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php index 89be79574d..560306df78 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php @@ -329,7 +329,7 @@ abstract class AbstractNumberFormatterTest extends TestCase $exceptionCode = 'PHPUnit_Framework_Error_Warning'; } - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode); + $this->expectException($exceptionCode); $formatter->format($value, NumberFormatter::TYPE_CURRENCY); } @@ -712,7 +712,7 @@ abstract class AbstractNumberFormatterTest extends TestCase $exceptionCode = 'PHPUnit_Framework_Error_Warning'; } - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode); + $this->expectException($exceptionCode); $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); $formatter->parse('1', NumberFormatter::TYPE_DEFAULT); @@ -838,7 +838,7 @@ abstract class AbstractNumberFormatterTest extends TestCase $exceptionCode = 'PHPUnit_Framework_Error_Warning'; } - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}($exceptionCode); + $this->expectException($exceptionCode); $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); $formatter->parse('1', NumberFormatter::TYPE_CURRENCY); diff --git a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/AdapterTest.php b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/AdapterTest.php index f238361879..fbd49359dd 100644 --- a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/AdapterTest.php +++ b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/AdapterTest.php @@ -74,7 +74,7 @@ class AdapterTest extends LdapTestCase public function testLdapQueryWithoutBind() { $ldap = new Adapter($this->getLdapConfig()); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(NotBoundException::class); + $this->expectException(NotBoundException::class); $query = $ldap->createQuery('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))', array()); $query->execute(); } diff --git a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php index 94acb3e349..2ce82b219f 100644 --- a/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php +++ b/src/Symfony/Component/Ldap/Tests/Adapter/ExtLdap/LdapManagerTest.php @@ -61,7 +61,7 @@ class LdapManagerTest extends LdapTestCase */ public function testLdapAddInvalidEntry() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(LdapException::class); + $this->expectException(LdapException::class); $this->executeSearchQuery(1); // The entry is missing a subject name @@ -107,7 +107,7 @@ class LdapManagerTest extends LdapTestCase public function testLdapUnboundAdd() { $this->adapter = new Adapter($this->getLdapConfig()); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(NotBoundException::class); + $this->expectException(NotBoundException::class); $em = $this->adapter->getEntryManager(); $em->add(new Entry('')); } @@ -118,7 +118,7 @@ class LdapManagerTest extends LdapTestCase public function testLdapUnboundRemove() { $this->adapter = new Adapter($this->getLdapConfig()); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(NotBoundException::class); + $this->expectException(NotBoundException::class); $em = $this->adapter->getEntryManager(); $em->remove(new Entry('')); } @@ -129,7 +129,7 @@ class LdapManagerTest extends LdapTestCase public function testLdapUnboundUpdate() { $this->adapter = new Adapter($this->getLdapConfig()); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(NotBoundException::class); + $this->expectException(NotBoundException::class); $em = $this->adapter->getEntryManager(); $em->update(new Entry('')); } @@ -224,7 +224,7 @@ class LdapManagerTest extends LdapTestCase $result = $this->executeSearchQuery(1); $entry = $result[0]; - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(LdapException::class); + $this->expectException(LdapException::class); $entryManager->removeAttributeValues($entry, 'mail', array('fabpot@example.org')); } @@ -236,7 +236,7 @@ class LdapManagerTest extends LdapTestCase $result = $this->executeSearchQuery(1); $entry = $result[0]; - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(LdapException::class); + $this->expectException(LdapException::class); $entryManager->addAttributeValues($entry, 'mail', $entry->getAttribute('mail')); } @@ -248,7 +248,7 @@ class LdapManagerTest extends LdapTestCase $result = $this->executeSearchQuery(1); $entry = $result[0]; - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UpdateOperationException::class); + $this->expectException(UpdateOperationException::class); $entryManager->applyOperations($entry->getDn(), array(new UpdateOperation(LDAP_MODIFY_BATCH_REMOVE_ALL, 'mail', array()))); } @@ -260,7 +260,7 @@ class LdapManagerTest extends LdapTestCase $result = $this->executeSearchQuery(1); $entry = $result[0]; - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UpdateOperationException::class); + $this->expectException(UpdateOperationException::class); $entryManager->applyOperations($entry->getDn(), array(new UpdateOperation(512, 'mail', array()))); } @@ -337,7 +337,7 @@ class LdapManagerTest extends LdapTestCase $result = $this->executeSearchQuery(1); $entry = $result[0]; - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(UpdateOperationException::class); + $this->expectException(UpdateOperationException::class); $entryManager->applyOperations($entry->getDn(), $duplicateIterator); } diff --git a/src/Symfony/Component/Ldap/Tests/LdapTest.php b/src/Symfony/Component/Ldap/Tests/LdapTest.php index 17184323f4..139bb6952e 100644 --- a/src/Symfony/Component/Ldap/Tests/LdapTest.php +++ b/src/Symfony/Component/Ldap/Tests/LdapTest.php @@ -78,7 +78,7 @@ class LdapTest extends TestCase public function testCreateWithInvalidAdapterName() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(DriverNotFoundException::class); + $this->expectException(DriverNotFoundException::class); Ldap::create('foo'); } } diff --git a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php index bb248d0fcd..44edbe7828 100644 --- a/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php +++ b/src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php @@ -368,7 +368,7 @@ class UrlGeneratorTest extends TestCase // The default requirement for 'x' should not allow the separator '.' in this case because it would otherwise match everything // and following optional variables like _format could never match. - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\InvalidParameterException'); + $this->expectException('Symfony\Component\Routing\Exception\InvalidParameterException'); $generator->generate('test', array('x' => 'do.t', 'y' => '123', 'z' => 'bar', '_format' => 'xml')); } diff --git a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php index 791fb5ecb3..dbb9b85b83 100644 --- a/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php +++ b/src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php @@ -231,7 +231,7 @@ class UrlMatcherTest extends TestCase $matcher = $this->getUrlMatcher($collection); $this->assertEquals(array('_route' => 'foo'), $matcher->match('/foo1')); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException'); + $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException'); $this->assertEquals(array(), $matcher->match('/foo')); } @@ -300,7 +300,7 @@ class UrlMatcherTest extends TestCase // z and _format are optional. $this->assertEquals(array('w' => 'wwwww', 'x' => 'x', 'y' => 'y', 'z' => 'default-z', '_format' => 'html', '_route' => 'test'), $matcher->match('/wwwwwxy')); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException'); + $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException'); $matcher->match('/wxy.html'); } @@ -315,7 +315,7 @@ class UrlMatcherTest extends TestCase // Usually the character in front of an optional parameter can be left out, e.g. with pattern '/get/{what}' just '/get' would match. // But here the 't' in 'get' is not a separating character, so it makes no sense to match without it. - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Routing\Exception\ResourceNotFoundException'); + $this->expectException('Symfony\Component\Routing\Exception\ResourceNotFoundException'); $matcher->match('/ge'); } diff --git a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php index f677c3028d..0102f85af5 100644 --- a/src/Symfony/Component/Templating/Tests/PhpEngineTest.php +++ b/src/Symfony/Component/Templating/Tests/PhpEngineTest.php @@ -86,7 +86,7 @@ class PhpEngineTest extends TestCase $foo = new \Symfony\Component\Templating\Tests\Fixtures\SimpleHelper('foo'); $engine->set($foo); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('\LogicException'); + $this->expectException('\LogicException'); unset($engine['foo']); } diff --git a/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php b/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php index 90cf4a5dc3..cc098881d3 100644 --- a/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php +++ b/src/Symfony/Component/Translation/Tests/Catalogue/AbstractOperationTest.php @@ -41,7 +41,7 @@ abstract class AbstractOperationTest extends TestCase public function testGetMessagesFromUnknownDomain() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException'); + $this->expectException('InvalidArgumentException'); $this->createOperation( new MessageCatalogue('en'), new MessageCatalogue('en') diff --git a/src/Symfony/Component/Validator/Tests/ConstraintTest.php b/src/Symfony/Component/Validator/Tests/ConstraintTest.php index a05741490f..7c21d601ae 100644 --- a/src/Symfony/Component/Validator/Tests/ConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/ConstraintTest.php @@ -35,7 +35,7 @@ class ConstraintTest extends TestCase public function testSetNotExistingPropertyThrowsException() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\InvalidOptionsException'); + $this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException'); new ConstraintA(array( 'foo' => 'bar', @@ -46,14 +46,14 @@ class ConstraintTest extends TestCase { $constraint = new ConstraintA(); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\InvalidOptionsException'); + $this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException'); $constraint->foo = 'bar'; } public function testInvalidAndRequiredOptionsPassed() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\InvalidOptionsException'); + $this->expectException('Symfony\Component\Validator\Exception\InvalidOptionsException'); new ConstraintC(array( 'option1' => 'default', @@ -101,14 +101,14 @@ class ConstraintTest extends TestCase public function testSetUndefinedDefaultProperty() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); + $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); new ConstraintB('foo'); } public function testRequiredOptionsMustBeDefined() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\MissingOptionsException'); + $this->expectException('Symfony\Component\Validator\Exception\MissingOptionsException'); new ConstraintC(); } diff --git a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php index a3f8a8c1ec..361899b9f5 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataTest.php @@ -40,14 +40,14 @@ class ClassMetadataTest extends TestCase public function testAddConstraintDoesNotAcceptValid() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); + $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); $this->metadata->addConstraint(new Valid()); } public function testAddConstraintRequiresClassConstraints() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); + $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); $this->metadata->addConstraint(new PropertyConstraint()); } diff --git a/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php index 05aef47e84..ac4ea5668a 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php @@ -21,7 +21,7 @@ class GetterMetadataTest extends TestCase public function testInvalidPropertyName() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ValidatorException'); + $this->expectException('Symfony\Component\Validator\Exception\ValidatorException'); new GetterMetadata(self::CLASSNAME, 'foobar'); } diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php index 100e4fa062..affdaf3c37 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php @@ -114,7 +114,7 @@ class XmlFileLoaderTest extends TestCase $loader = new XmlFileLoader(__DIR__.'/withdoctype.xml'); $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('\Symfony\Component\Validator\Exception\MappingException'); + $this->expectException('\Symfony\Component\Validator\Exception\MappingException'); $loader->loadClassMetadata($metadata); } @@ -129,7 +129,7 @@ class XmlFileLoaderTest extends TestCase try { $loader->loadClassMetadata($metadata); } catch (MappingException $e) { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('\Symfony\Component\Validator\Exception\MappingException'); + $this->expectException('\Symfony\Component\Validator\Exception\MappingException'); $loader->loadClassMetadata($metadata); } } diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php index 9920fb0737..4b2bbcb62f 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php @@ -69,7 +69,7 @@ class YamlFileLoaderTest extends TestCase $loader->loadClassMetadata($metadata); } catch (\InvalidArgumentException $e) { // Call again. Again an exception should be thrown - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); $loader->loadClassMetadata($metadata); } } diff --git a/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php index 593f90faa6..d7736de340 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/MemberMetadataTest.php @@ -38,7 +38,7 @@ class MemberMetadataTest extends TestCase public function testAddConstraintRequiresClassConstraints() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); + $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); $this->metadata->addConstraint(new ClassConstraint()); } diff --git a/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php b/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php index 9fea435dff..7902625219 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php @@ -22,7 +22,7 @@ class PropertyMetadataTest extends TestCase public function testInvalidPropertyName() { - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ValidatorException'); + $this->expectException('Symfony\Component\Validator\Exception\ValidatorException'); new PropertyMetadata(self::CLASSNAME, 'foobar'); } @@ -50,7 +50,7 @@ class PropertyMetadataTest extends TestCase $metadata = new PropertyMetadata(self::CLASSNAME, 'internal'); $metadata->name = 'test'; - $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ValidatorException'); + $this->expectException('Symfony\Component\Validator\Exception\ValidatorException'); $metadata->getPropertyValue($entity); } }