diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7924d63c05..90b434aa2a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -82,9 +82,8 @@ jobs: echo "::endgroup::" - name: Run tests - run: ./phpunit --verbose --group integration + run: ./phpunit --group integration env: - SYMFONY_DEPRECATIONS_HELPER: 'max[indirect]=7' REDIS_HOST: localhost REDIS_CLUSTER_HOSTS: 'localhost:7000 localhost:7001 localhost:7002 localhost:7003 localhost:7004 localhost:7005' MESSENGER_REDIS_DSN: redis://127.0.0.1:7006/messages @@ -96,6 +95,6 @@ jobs: run: | [ -d .phpunit ] && mv .phpunit .phpunit.bak wget -q https://github.com/symfony/binary-utils/releases/download/v0.1/vulcain_0.1.3_Linux_x86_64.tar.gz -O - | tar xz && mv vulcain /usr/local/bin - docker run --rm -e COMPOSER_ROOT_VERSION -e SYMFONY_VERSION -v $(pwd):/app -v $(which composer):/usr/local/bin/composer -v /usr/local/bin/vulcain:/usr/local/bin/vulcain -w /app php:7.4-alpine ./phpunit --verbose src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php --filter testHttp2Push + docker run --rm -e COMPOSER_ROOT_VERSION -e SYMFONY_VERSION -v $(pwd):/app -v $(which composer):/usr/local/bin/composer -v /usr/local/bin/vulcain:/usr/local/bin/vulcain -w /app php:7.4-alpine ./phpunit src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php --filter testHttp2Push sudo rm -rf .phpunit [ -d .phpunit.bak ] && mv .phpunit.bak .phpunit diff --git a/composer.json b/composer.json index 71050660f2..4e390fd55e 100644 --- a/composer.json +++ b/composer.json @@ -104,7 +104,7 @@ "doctrine/cache": "~1.6", "doctrine/collections": "~1.0", "doctrine/data-fixtures": "1.0.*", - "doctrine/dbal": "~2.4,<=2.10.2", + "doctrine/dbal": "~2.4", "doctrine/orm": "~2.4,>=2.4.5", "doctrine/reflection": "~1.0", "doctrine/doctrine-bundle": "^2.0", diff --git a/phpunit b/phpunit index fbce26d8ed..713594fc19 100755 --- a/phpunit +++ b/phpunit @@ -21,14 +21,4 @@ if (!getenv('SYMFONY_PATCH_TYPE_DECLARATIONS')) { putenv('SYMFONY_PATCH_TYPE_DECLARATIONS=deprecations=1'); } putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit'); - -if (!getenv('SYMFONY_DEPRECATIONS_HELPER')) { - foreach ($_SERVER['argv'] as $v) { - if (false !== strpos($v, 'Bridge/Doctrine')) { - putenv('SYMFONY_DEPRECATIONS_HELPER=max[indirect]=7'); - break; - } - } -} - require __DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit'; diff --git a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php index be850277e6..4882a1fee2 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php @@ -25,7 +25,7 @@ class DoctrineTransactionMiddlewareTest extends MiddlewareTestCase private $entityManager; private $middleware; - public function setUp(): void + protected function setUp(): void { $this->connection = $this->createMock(Connection::class); diff --git a/src/Symfony/Bridge/Doctrine/composer.json b/src/Symfony/Bridge/Doctrine/composer.json index 2e777733a6..bf8b981f58 100644 --- a/src/Symfony/Bridge/Doctrine/composer.json +++ b/src/Symfony/Bridge/Doctrine/composer.json @@ -42,7 +42,7 @@ "doctrine/cache": "~1.6", "doctrine/collections": "~1.0", "doctrine/data-fixtures": "1.0.*", - "doctrine/dbal": "~2.4,<=2.10.2", + "doctrine/dbal": "~2.4", "doctrine/orm": "^2.6.3", "doctrine/reflection": "~1.0" }, diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php index fd6d059e44..403d23cdd5 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php @@ -22,6 +22,7 @@ class DeprecationTest extends TestCase use SetUpTearDownTrait; private static $vendorDir; + private static $prefixDirsPsr4; private static function getVendorDir() { @@ -151,22 +152,6 @@ class DeprecationTest extends TestCase public function providerGetTypeDetectsSelf() { - foreach (get_declared_classes() as $class) { - if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) { - $r = new \ReflectionClass($class); - $v = \dirname(\dirname($r->getFileName())); - if (file_exists($v.'/composer/installed.json')) { - $loader = require $v.'/autoload.php'; - $reflection = new \ReflectionClass($loader); - $prop = $reflection->getProperty('prefixDirsPsr4'); - $prop->setAccessible(true); - $currentValue = $prop->getValue($loader); - $currentValue['Symfony\\Bridge\\PhpUnit\\'] = [realpath(__DIR__.'/../..')]; - $prop->setValue($loader, $currentValue); - } - } - } - return [ 'not_from_vendors_file' => [Deprecation::TYPE_SELF, '', 'MyClass1', __FILE__], 'nonexistent_file' => [Deprecation::TYPE_UNDETERMINED, '', 'MyClass1', 'dummy_vendor_path'], @@ -276,8 +261,32 @@ class DeprecationTest extends TestCase rmdir($dir); } + private static function doSetupBeforeClass() + { + foreach (get_declared_classes() as $class) { + if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) { + $r = new \ReflectionClass($class); + $v = \dirname(\dirname($r->getFileName())); + if (file_exists($v.'/composer/installed.json')) { + $loader = require $v.'/autoload.php'; + $reflection = new \ReflectionClass($loader); + $prop = $reflection->getProperty('prefixDirsPsr4'); + $prop->setAccessible(true); + $currentValue = $prop->getValue($loader); + self::$prefixDirsPsr4[] = [$prop, $loader, $currentValue]; + $currentValue['Symfony\\Bridge\\PhpUnit\\'] = [realpath(__DIR__.'/../..')]; + $prop->setValue($loader, $currentValue); + } + } + } + } + private static function doTearDownAfterClass() { + foreach (self::$prefixDirsPsr4 as [$prop, $loader, $prefixDirsPsr4]) { + $prop->setValue($loader, $prefixDirsPsr4); + } + self::removeDir(self::getVendorDir().'/myfakevendor'); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index b02b6a489c..e94d1f2408 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -105,7 +105,7 @@ EOT $targetArg = $kernel->getProjectDir().'/'.$targetArg; if (!is_dir($targetArg)) { - throw new InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target'))); + throw new InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $targetArg)); } } diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php index 311c41ec66..5a1b3300fd 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php @@ -149,7 +149,7 @@ class ExprBuilderTest extends TestCase /** * @dataProvider castToArrayValues */ - public function testcastToArrayExpression($configValue, $expectedValue) + public function testCastToArrayExpression($configValue, $expectedValue) { $test = $this->getTestBuilder() ->castToArray() diff --git a/src/Symfony/Component/Console/Tests/TerminalTest.php b/src/Symfony/Component/Console/Tests/TerminalTest.php index f135edf8b0..c2d36fe0ab 100644 --- a/src/Symfony/Component/Console/Tests/TerminalTest.php +++ b/src/Symfony/Component/Console/Tests/TerminalTest.php @@ -60,7 +60,7 @@ class TerminalTest extends TestCase $this->assertSame(60, $terminal->getHeight()); } - public function test_zero_values() + public function testZeroValues() { putenv('COLUMNS=0'); putenv('LINES=0'); diff --git a/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php b/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php index 824f21599c..741590b1bf 100644 --- a/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php +++ b/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php @@ -40,6 +40,9 @@ interface EventSubscriberInterface * * ['eventName' => ['methodName', $priority]] * * ['eventName' => [['methodName1', $priority], ['methodName2']]] * + * The code must not depend on runtime state as it will only be called at compile time. + * All logic depending on runtime state must be put into the individual methods handling the events. + * * @return array The event names to listen to */ public static function getSubscribedEvents(); diff --git a/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php b/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php index 8ea1e717c6..cf537a4c24 100644 --- a/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/SemaphoreStoreTest.php @@ -48,7 +48,7 @@ class SemaphoreStoreTest extends AbstractStoreTest private function getOpenedSemaphores() { if ('Darwin' === PHP_OS) { - $lines = explode(PHP_EOL, trim(`ipcs -s`)); + $lines = explode(PHP_EOL, trim(shell_exec('ipcs -s'))); if (-1 === $start = array_search('Semaphores:', $lines)) { throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore list, got '.implode(PHP_EOL, $lines)); } @@ -56,7 +56,7 @@ class SemaphoreStoreTest extends AbstractStoreTest return \count(\array_slice($lines, ++$start)); } - $lines = explode(PHP_EOL, trim(`LC_ALL=C ipcs -su`)); + $lines = explode(PHP_EOL, trim(shell_exec('LC_ALL=C ipcs -su'))); if ('------ Semaphore Status --------' !== $lines[0]) { throw new \Exception('Failed to extract list of opened semaphores. Expected a Semaphore status, got '.implode(PHP_EOL, $lines)); } diff --git a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php index d2058799ec..82cdcff73f 100644 --- a/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php +++ b/src/Symfony/Component/Mailer/Bridge/Mailchimp/Transport/MandrillHttpTransport.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Mailer\Bridge\Mailchimp\Transport; use Psr\Log\LoggerInterface; -use Symfony\Component\Mailer\Envelope; use Symfony\Component\Mailer\Exception\HttpTransportException; use Symfony\Component\Mailer\SentMessage; use Symfony\Component\Mailer\Transport\AbstractHttpTransport; diff --git a/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php b/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php index b2799af03c..fb5ecf76bb 100644 --- a/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php +++ b/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php @@ -326,7 +326,7 @@ class Connection // If we get a 404 for the queue, it means we need to set up the exchange & queue. $this->setupExchangeAndQueues(); - return $this->get(); + return $this->get($queueName); } throw $e; diff --git a/src/Symfony/Component/Mime/Test/Constraint/EmailAddressContains.php b/src/Symfony/Component/Mime/Test/Constraint/EmailAddressContains.php index 58ef360c50..c751c3d45f 100644 --- a/src/Symfony/Component/Mime/Test/Constraint/EmailAddressContains.php +++ b/src/Symfony/Component/Mime/Test/Constraint/EmailAddressContains.php @@ -48,7 +48,7 @@ final class EmailAddressContains extends Constraint $header = $message->getHeaders()->get($this->headerName); if ($header instanceof MailboxHeader) { - return $this->expectedValue === $header->Address()->getAddress(); + return $this->expectedValue === $header->getAddress()->getAddress(); } elseif ($header instanceof MailboxListHeader) { foreach ($header->getAddresses() as $address) { if ($this->expectedValue === $address->getAddress()) { diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/UsernamePasswordToken.php b/src/Symfony/Component/Security/Core/Authentication/Token/UsernamePasswordToken.php index b9eaa68246..eefe75d2d3 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Token/UsernamePasswordToken.php +++ b/src/Symfony/Component/Security/Core/Authentication/Token/UsernamePasswordToken.php @@ -26,7 +26,6 @@ class UsernamePasswordToken extends AbstractToken /** * @param string|\Stringable|UserInterface $user The username (like a nickname, email address, etc.) or a UserInterface instance * @param mixed $credentials - * @param string $providerKey * @param string[] $roles * * @throws \InvalidArgumentException diff --git a/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php b/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php index 7fd29175bd..3974fa828b 100644 --- a/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php +++ b/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php @@ -60,7 +60,7 @@ class AccessDecisionManager implements AccessDecisionManagerInterface */ public function decide(TokenInterface $token, array $attributes, $object = null/*, bool $allowMultipleAttributes = false*/) { - $allowMultipleAttributes = 3 < func_num_args() && func_get_arg(3); + $allowMultipleAttributes = 3 < \func_num_args() && func_get_arg(3); // Special case for AccessListener, do not remove the right side of the condition before 6.0 if (\count($attributes) > 1 && !$allowMultipleAttributes) { diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index d89fecf8bc..c234b48e07 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -600,7 +600,7 @@ return function (root, x) { */ return; } - + e.preventDefault(); search.className = search.className.replace(/\bsf-dump-search-hidden\b/, ''); searchInput.focus();