diff --git a/.php_cs.dist b/.php_cs.dist index ac3e985281..b28505eb45 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -8,8 +8,9 @@ return PhpCsFixer\Config::create() ->setRules([ '@Symfony' => true, '@Symfony:risky' => true, - '@PHPUnit48Migration:risky' => true, - 'php_unit_no_expectation_annotation' => false, // part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice + '@PHPUnit75Migration:risky' => true, + 'php_unit_dedicate_assert' => ['target' => '3.5'], + 'phpdoc_no_empty_return' => false, // triggers almost always false positive 'array_syntax' => ['syntax' => 'short'], 'fopen_flags' => false, 'ordered_imports' => true, diff --git a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php index 591f58a62f..8c8bc56be5 100644 --- a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php +++ b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php @@ -165,7 +165,7 @@ class ConsoleLoggerTest extends TestCase if (method_exists($this, 'createPartialMock')) { $dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']); } else { - $dummy = $this->getMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']); + $dummy = $this->createPartialMock('Symfony\Component\Console\Tests\Logger\DummyTest', ['__toString']); } $dummy->method('__toString')->willReturn('DUMMY'); diff --git a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php index f18809a5a2..aa7ae56b52 100644 --- a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php +++ b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Debug\Tests\Exception; use PHPUnit\Framework\TestCase; +use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait; use Symfony\Component\Debug\Exception\FatalThrowableError; use Symfony\Component\Debug\Exception\FlattenException; use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException; @@ -35,6 +36,8 @@ use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException; */ class FlattenExceptionTest extends TestCase { + use ForwardCompatTestTrait; + public function testStatusCode() { $flattened = FlattenException::create(new \RuntimeException(), 403); @@ -297,7 +300,7 @@ class FlattenExceptionTest extends TestCase // assertEquals() does not like NAN values. $this->assertEquals($array[$i][0], 'float'); - $this->assertTrue(is_nan($array[$i++][1])); + $this->assertNan($array[$i++][1]); } public function testRecursionInArguments() diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index d607285196..3738d98a38 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -912,8 +912,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface * This methods allows for simple registration of service definition * with a fluid interface. * - * @param string $id The service identifier - * @param string $class|null The service class + * @param string $id The service identifier + * @param string|null $class The service class * * @return Definition A Definition instance */ diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 0e3142a2de..395f53ede1 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -571,7 +571,7 @@ class YamlFileLoader extends FileLoader /** * Parses a callable. * - * @param string|array $callable A callable reference + * @param string|array $callable A callable reference * * @throws InvalidArgumentException When errors occur * diff --git a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php index 4b089936e7..6f627fec3a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Config/ContainerParametersResourceCheckerTest.php @@ -55,15 +55,15 @@ class ContainerParametersResourceCheckerTest extends TestCase public function isFreshProvider() { - yield 'not fresh on missing parameter' => [function (\PHPUnit_Framework_MockObject_MockObject $container) { + yield 'not fresh on missing parameter' => [function (\PHPUnit\Framework\MockObject\MockObject $container) { $container->method('hasParameter')->with('locales')->willReturn(false); }, false]; - yield 'not fresh on different value' => [function (\PHPUnit_Framework_MockObject_MockObject $container) { + yield 'not fresh on different value' => [function (\PHPUnit\Framework\MockObject\MockObject $container) { $container->method('getParameter')->with('locales')->willReturn(['nl', 'es']); }, false]; - yield 'fresh on every identical parameters' => [function (\PHPUnit_Framework_MockObject_MockObject $container) { + yield 'fresh on every identical parameters' => [function (\PHPUnit\Framework\MockObject\MockObject $container) { $container->expects($this->exactly(2))->method('hasParameter')->willReturn(true); $container->expects($this->exactly(2))->method('getParameter') ->withConsecutive( diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index ee449bad47..1bdafdc373 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -13,7 +13,6 @@ namespace Symfony\Component\DependencyInjection\Tests; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait; -use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index 65835539bb..cad17cbc96 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -29,7 +29,6 @@ use Symfony\Component\DependencyInjection\EnvVarProcessorInterface; use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\DependencyInjection\Parameter; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ServiceLocator; diff --git a/src/Symfony/Component/ErrorRenderer/Resources/assets/images/symfony-ghost.svg.php b/src/Symfony/Component/ErrorRenderer/Resources/assets/images/symfony-ghost.svg.php index 1a245e3f98..4b2f9c1b9b 100644 --- a/src/Symfony/Component/ErrorRenderer/Resources/assets/images/symfony-ghost.svg.php +++ b/src/Symfony/Component/ErrorRenderer/Resources/assets/images/symfony-ghost.svg.php @@ -1 +1 @@ -addElementToGhost() ?> +addElementToGhost(); ?> diff --git a/src/Symfony/Component/ErrorRenderer/Resources/views/error.html.php b/src/Symfony/Component/ErrorRenderer/Resources/views/error.html.php index 8981b17399..5416d03c8c 100644 --- a/src/Symfony/Component/ErrorRenderer/Resources/views/error.html.php +++ b/src/Symfony/Component/ErrorRenderer/Resources/views/error.html.php @@ -1,15 +1,15 @@ - + - An Error Occurred: <?= $statusText ?> - + An Error Occurred: <?= $statusText; ?> +

Oops! An Error Occurred

-

The server returned a " ".

+

The server returned a " ".

Something is broken. Please let us know what you were doing when this error occurred. diff --git a/src/Symfony/Component/ErrorRenderer/Resources/views/exception.html.php b/src/Symfony/Component/ErrorRenderer/Resources/views/exception.html.php index 1dd6bd2b9c..b470b5622b 100644 --- a/src/Symfony/Component/ErrorRenderer/Resources/views/exception.html.php +++ b/src/Symfony/Component/ErrorRenderer/Resources/views/exception.html.php @@ -1,25 +1,25 @@ -

+
-

formatFileFromText(nl2br($exceptionMessage)) ?>

+

formatFileFromText(nl2br($exceptionMessage)); ?>

- include('assets/images/symfony-ghost.svg.php') ?> + include('assets/images/symfony-ghost.svg.php'); ?>
@@ -31,8 +31,8 @@ toArray(); $exceptionWithUserCode = []; - $exceptionAsArrayCount = \count($exceptionAsArray); - $last = \count($exceptionAsArray) - 1; + $exceptionAsArrayCount = count($exceptionAsArray); + $last = count($exceptionAsArray) - 1; foreach ($exceptionAsArray as $i => $e) { foreach ($e['trace'] as $trace) { if ($trace['file'] && false === mb_strpos($trace['file'], '/vendor/') && false === mb_strpos($trace['file'], '/var/cache/') && $i < $last) { @@ -43,7 +43,7 @@ ?>

1) { ?> - Exceptions + Exceptions Exception @@ -55,7 +55,7 @@ echo $this->include('views/traces.html.php', [ 'exception' => $e, 'index' => $i + 1, - 'expand' => \in_array($i, $exceptionWithUserCode, true) || ([] === $exceptionWithUserCode && 0 === $i), + 'expand' => in_array($i, $exceptionWithUserCode, true) || ([] === $exceptionWithUserCode && 0 === $i), ]); } ?> @@ -63,15 +63,15 @@

-
+

Logs - countErrors()) { ?>countErrors() ?> + countErrors()) { ?>countErrors(); ?>

getLogs()) { ?> - include('views/logs.html.php', ['logs' => $logger->getLogs()]) ?> + include('views/logs.html.php', ['logs' => $logger->getLogs()]); ?>

No log messages

@@ -84,7 +84,7 @@

1) { ?> - Stack Traces + Stack Traces Stack Trace @@ -108,7 +108,7 @@

Output content

- +
diff --git a/src/Symfony/Component/ErrorRenderer/Resources/views/exception_full.html.php b/src/Symfony/Component/ErrorRenderer/Resources/views/exception_full.html.php index 09ed0cb57e..7ce8de0666 100644 --- a/src/Symfony/Component/ErrorRenderer/Resources/views/exception_full.html.php +++ b/src/Symfony/Component/ErrorRenderer/Resources/views/exception_full.html.php @@ -1,41 +1,41 @@ - + - + - <?= $_message ?> - - - + <?= $_message; ?> + + +
- include('views/exception.html.php', $context) ?> + include('views/exception.html.php', $context); ?> - + diff --git a/src/Symfony/Component/ErrorRenderer/Resources/views/logs.html.php b/src/Symfony/Component/ErrorRenderer/Resources/views/logs.html.php index ccd64f7f14..010d33adad 100644 --- a/src/Symfony/Component/ErrorRenderer/Resources/views/logs.html.php +++ b/src/Symfony/Component/ErrorRenderer/Resources/views/logs.html.php @@ -1,5 +1,5 @@ - + @@ -19,20 +19,20 @@ $severity = $log['context']['exception']['severity'] ?? false; $status = E_DEPRECATED === $severity || E_USER_DEPRECATED === $severity ? 'warning' : 'normal'; } ?> - data-filter-channel="escape($log['channel']) ?>" + data-filter-channel="escape($log['channel']); ?>" diff --git a/src/Symfony/Component/ErrorRenderer/Resources/views/trace.html.php b/src/Symfony/Component/ErrorRenderer/Resources/views/trace.html.php index 08aa0d2bde..3112af4abe 100644 --- a/src/Symfony/Component/ErrorRenderer/Resources/views/trace.html.php +++ b/src/Symfony/Component/ErrorRenderer/Resources/views/trace.html.php @@ -1,11 +1,11 @@ -
+
- include('assets/images/icon-minus-square.svg') ?> - include('assets/images/icon-plus-square.svg') ?> + include('assets/images/icon-minus-square.svg'); ?> + include('assets/images/icon-plus-square.svg'); ?> - abbrClass($trace['class']) ?>(formatArgs($trace['args']) ?>) + abbrClass($trace['class']); ?>(formatArgs($trace['args']); ?>) @@ -17,24 +17,24 @@ ?> in - - + + - - + + - (line ) + (line )
-
+
fileExcerpt($trace['file'], $trace['line'], 5), [ '#DD0000' => 'var(--highlight-string)', '#007700' => 'var(--highlight-keyword)', '#0000BB' => 'var(--highlight-default)', '#FF8000' => 'var(--highlight-comment)', - ]) ?> + ]); ?>
diff --git a/src/Symfony/Component/ErrorRenderer/Resources/views/traces.html.php b/src/Symfony/Component/ErrorRenderer/Resources/views/traces.html.php index 40b5207c7d..d587b058e2 100644 --- a/src/Symfony/Component/ErrorRenderer/Resources/views/traces.html.php +++ b/src/Symfony/Component/ErrorRenderer/Resources/views/traces.html.php @@ -1,24 +1,24 @@ -
+
- +

- include('assets/images/icon-minus-square-o.svg') ?> - include('assets/images/icon-plus-square-o.svg') ?> + include('assets/images/icon-minus-square-o.svg'); ?> + include('assets/images/icon-plus-square-o.svg'); ?> - 1 ? '\\' : '' ?> + 1 ? '\\' : ''; ?> - +

1) { ?> -

escape($exception['message']) ?>

+

escape($exception['message']); ?>

-
+
$trace) { @@ -27,13 +27,13 @@ if ($displayCodeSnippet) { $isFirstUserCode = false; } ?> -
+
include('views/trace.html.php', [ 'prefix' => $index, 'i' => $i, 'trace' => $trace, 'style' => $isVendorTrace ? 'compact' : ($displayCodeSnippet ? 'expanded' : ''), - ]) ?> + ]); ?>
diff --git a/src/Symfony/Component/ErrorRenderer/Resources/views/traces_text.html.php b/src/Symfony/Component/ErrorRenderer/Resources/views/traces_text.html.php index a247ad5fd3..1b06954dcd 100644 --- a/src/Symfony/Component/ErrorRenderer/Resources/views/traces_text.html.php +++ b/src/Symfony/Component/ErrorRenderer/Resources/views/traces_text.html.php @@ -1,20 +1,20 @@
Level
- escape($log['priorityName']) ?> - format('H:i:s') ?> + escape($log['priorityName']); ?> + format('H:i:s'); ?> - escape($log['channel']) ?> + escape($log['channel']); ?> - formatLogMessage($log['message'], $log['context']) ?> + formatLogMessage($log['message'], $log['context']); ?> -
+
- - +
+

1) { ?> - [/] + [/] - - include('assets/images/icon-minus-square-o.svg') ?> - include('assets/images/icon-plus-square-o.svg') ?> + + include('assets/images/icon-minus-square-o.svg'); ?> + include('assets/images/icon-plus-square-o.svg'); ?>

@@ -31,7 +31,7 @@ echo 'at '.$trace['class'].$trace['type'].$trace['function'].'('.$this->formatArgsAsText($trace['args']).')'; } if ($trace['file'] && $trace['line']) { - echo ($trace['function'] ? "\n (" : 'at ').strtr(strip_tags($this->formatFile($trace['file'], $trace['line'])), [' at line '.$trace['line'] => '']).':'.$trace['line'].($trace['function'] ? ')' : ''); + echo($trace['function'] ? "\n (" : 'at ').strtr(strip_tags($this->formatFile($trace['file'], $trace['line'])), [' at line '.$trace['line'] => '']).':'.$trace['line'].($trace['function'] ? ')' : ''); } } ?> diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php index c4e8c7a3d6..8be0c99e13 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php @@ -509,6 +509,7 @@ class NumberToLocalizedStringTransformerTest extends TestCase /** * @dataProvider nanRepresentationProvider + * * @see https://github.com/symfony/symfony/issues/3161 */ public function testReverseTransformDisallowsNaN($nan) diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php index 98df91d7e8..7e47a74ed4 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php @@ -28,7 +28,6 @@ class ButtonTypeTest extends BaseTypeTest } /** - * * @param string $emptyData * @param null $expectedData */ diff --git a/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php index d0bc82e759..49e69ef190 100644 --- a/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php +++ b/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php @@ -20,11 +20,7 @@ class TranslationFilesTest extends TestCase */ public function testTranslationFileIsValid($filePath) { - if (class_exists('PHPUnit_Util_XML')) { - \PHPUnit_Util_XML::loadfile($filePath, false, false, true); - } else { - \PHPUnit\Util\XML::loadfile($filePath, false, false, true); - } + \PHPUnit\Util\XML::loadfile($filePath, false, false, true); $this->addToAssertionCount(1); } diff --git a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php index 1c8c064c3d..dad38b8ae2 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php @@ -142,7 +142,7 @@ class LoggerTest extends TestCase if (method_exists($this, 'createPartialMock')) { $dummy = $this->createPartialMock(DummyTest::class, ['__toString']); } else { - $dummy = $this->getMock(DummyTest::class, ['__toString']); + $dummy = $this->createPartialMock(DummyTest::class, ['__toString']); } $dummy->expects($this->atLeastOnce()) ->method('__toString') diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php index a53d8f8d03..2c40eae729 100644 --- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php +++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimezoneTransformer.php @@ -92,8 +92,8 @@ class TimezoneTransformer extends Transformer * * @return string A timezone identifier * - * @see http://php.net/manual/en/timezones.others.php - * @see http://www.twinsun.com/tz/tz-link.htm + * @see http://php.net/manual/en/timezones.others.php + * @see http://www.twinsun.com/tz/tz-link.htm * * @throws NotImplementedException When the GMT time zone have minutes offset different than zero * @throws \InvalidArgumentException When the value can not be matched with pattern diff --git a/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php b/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php index 15b7522671..8b37bcfbc1 100644 --- a/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php +++ b/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Lock\Tests\Store; -use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait; use Symfony\Component\Lock\Exception\LockExpiredException; use Symfony\Component\Lock\Key; use Symfony\Component\Lock\PersistingStoreInterface; diff --git a/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php index 77a97860fe..27a458c99b 100644 --- a/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/PdoStoreTest.php @@ -69,6 +69,7 @@ class PdoStoreTest extends AbstractStoreTest public function testInvalidTtlConstruct() { $this->expectException('Symfony\Component\Lock\Exception\InvalidTtlException'); + return new PdoStore('sqlite:'.self::$dbFile, [], 0.1, 0.1); } } diff --git a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php index f4e0d9e6e8..bc21d272fc 100644 --- a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php @@ -20,11 +20,7 @@ class TranslationFilesTest extends TestCase */ public function testTranslationFileIsValid($filePath) { - if (class_exists('PHPUnit_Util_XML')) { - \PHPUnit_Util_XML::loadfile($filePath, false, false, true); - } else { - \PHPUnit\Util\XML::loadfile($filePath, false, false, true); - } + \PHPUnit\Util\XML::loadfile($filePath, false, false, true); $this->addToAssertionCount(1); } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php index 8b7a2f45af..36ebb4de32 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php @@ -55,6 +55,7 @@ class GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest extends Greate { $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); $this->expectExceptionMessage('The "propertyPath" option of the "Symfony\Component\Validator\Constraints\PositiveOrZero" constraint cannot be set.'); + return new PositiveOrZero(['propertyPath' => 'field']); } @@ -62,6 +63,7 @@ class GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest extends Greate { $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); $this->expectExceptionMessage('The "value" option of the "Symfony\Component\Validator\Constraints\PositiveOrZero" constraint cannot be set.'); + return new PositiveOrZero(['value' => 0]); } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php index 7aa647df45..639efffd2d 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php @@ -53,6 +53,7 @@ class GreaterThanValidatorWithPositiveConstraintTest extends GreaterThanValidato { $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); $this->expectExceptionMessage('The "propertyPath" option of the "Symfony\Component\Validator\Constraints\Positive" constraint cannot be set.'); + return new Positive(['propertyPath' => 'field']); } @@ -60,6 +61,7 @@ class GreaterThanValidatorWithPositiveConstraintTest extends GreaterThanValidato { $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); $this->expectExceptionMessage('The "value" option of the "Symfony\Component\Validator\Constraints\Positive" constraint cannot be set.'); + return new Positive(['value' => 0]); } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php index 2967d82d44..47b9484808 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php @@ -53,6 +53,7 @@ class LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest extends LessThanO { $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); $this->expectExceptionMessage('The "propertyPath" option of the "Symfony\Component\Validator\Constraints\NegativeOrZero" constraint cannot be set.'); + return new NegativeOrZero(['propertyPath' => 'field']); } @@ -60,6 +61,7 @@ class LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest extends LessThanO { $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); $this->expectExceptionMessage('The "value" option of the "Symfony\Component\Validator\Constraints\NegativeOrZero" constraint cannot be set.'); + return new NegativeOrZero(['value' => 0]); } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php index e38bdc4b5e..8809355c35 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php @@ -53,6 +53,7 @@ class LessThanValidatorWithNegativeConstraintTest extends LessThanValidatorTest { $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); $this->expectExceptionMessage('The "propertyPath" option of the "Symfony\Component\Validator\Constraints\Negative" constraint cannot be set.'); + return new Negative(['propertyPath' => 'field']); } @@ -60,6 +61,7 @@ class LessThanValidatorWithNegativeConstraintTest extends LessThanValidatorTest { $this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); $this->expectExceptionMessage('The "value" option of the "Symfony\Component\Validator\Constraints\Negative" constraint cannot be set.'); + return new Negative(['value' => 0]); } diff --git a/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php index 64b3f78934..56ff24d2fd 100644 --- a/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php +++ b/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php @@ -20,11 +20,7 @@ class TranslationFilesTest extends TestCase */ public function testTranslationFileIsValid($filePath) { - if (class_exists('PHPUnit_Util_XML')) { - \PHPUnit_Util_XML::loadfile($filePath, false, false, true); - } else { - \PHPUnit\Util\XML::loadfile($filePath, false, false, true); - } + \PHPUnit\Util\XML::loadfile($filePath, false, false, true); $this->addToAssertionCount(1); } diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index 2dcf9ddbab..140c15d011 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -656,7 +656,6 @@ class InlineTest extends TestCase } /** - * * @dataProvider getNotPhpCompatibleMappingKeyData */ public function testImplicitStringCastingOfMappingKeysIsDeprecated($yaml, $expected) diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index 9807487740..49f3ad8b59 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -13,7 +13,6 @@ namespace Symfony\Component\Yaml\Tests; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\ForwardCompatTestTrait; -use Symfony\Component\Yaml\Exception\ParseException; use Symfony\Component\Yaml\Parser; use Symfony\Component\Yaml\Tag\TaggedValue; use Symfony\Component\Yaml\Yaml; @@ -786,7 +785,6 @@ EOF } /** - * * > It is an error for two equal keys to appear in the same mapping node. * > In such a case the YAML processor may continue, ignoring the second * > "key: value" pair and issuing an appropriate warning. This strategy