diff --git a/.github/patch-types.php b/.github/patch-types.php new file mode 100644 index 0000000000000..56a1cb4b1b129 --- /dev/null +++ b/.github/patch-types.php @@ -0,0 +1,33 @@ +getClassMap() as $class => $file) { + switch (true) { + case 0 !== strpos($class, $prefix): + case 0 === strpos($class, 'Symfony\Polyfill\\'): + case 0 === strpos($class, 'Symfony\Component\Security\Acl\\'): + case false !== strpos($file, '/symfony/phpunit-bridge/'): + case false !== strpos($file, '/src/Symfony/Bridge/PhpUnit/'): + case false !== strpos($file, '/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Article.php'): + case false !== strpos($file, '/src/Symfony/Component/Config/Tests/Fixtures/BadParent.php'): + case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Compiler/OptionalServiceClass.php'): + case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ParentNotExists.php'): + case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/BadClasses/MissingParent.php'): + case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/'): + case false !== strpos($file, '/src/Symfony/Component/VarDumper/Tests/Fixtures/NotLoadableClass.php'): + continue 2; + } + + class_exists($class); +} + +Symfony\Component\ErrorHandler\DebugClassLoader::disable(); + diff --git a/.travis.yml b/.travis.yml index 184398c68f5aa..8d5ca7e09f6ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,12 +25,7 @@ env: matrix: include: - - php: 7.1 - env: php_extra="7.2" - - php: 7.3 - env: deps=high - php: 7.4snapshot - env: deps=low fast_finish: true cache: @@ -75,14 +70,12 @@ before_install: cp .composer/* ~/.composer/ export PHPUNIT=$(readlink -f ./phpunit) export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data" - export COMPOSER_UP='composer update --no-progress --no-suggest --ansi' + export COMPOSER_UP='composer update --no-progress --no-suggest --ansi --optimize-autoloader' export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n') find ~/.phpenv -name xdebug.ini -delete - if [[ $TRAVIS_PHP_VERSION = 7.4* && $deps ]]; then + if [[ $TRAVIS_PHP_VERSION = 7.4* ]]; then export PHPUNIT_X="$PHPUNIT_X,issue-32995" - elif [[ $TRAVIS_PHP_VERSION = 7.4* ]]; then - export PHPUNIT_X="$PHPUNIT --group issue-32995" fi nanoseconds () { @@ -163,6 +156,7 @@ before_install: - | # Install extra PHP extensions for PHP in $TRAVIS_PHP_VERSION $php_extra; do + continue export PHP=$PHP phpenv global $PHP INI=~/.phpenv/versions/$PHP/etc/conf.d/travis.ini @@ -270,6 +264,9 @@ install: ([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; composer config platform.ext-mongodb 1.6.0; composer require --dev --no-update mongodb/mongodb) tfold 'composer update' $COMPOSER_UP tfold 'phpunit install' ./phpunit install + + php .github/patch-types.php + if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" elif [[ $deps = low ]]; then diff --git a/composer.json b/composer.json index 93d6b029d8c12..1350051ca76b5 100644 --- a/composer.json +++ b/composer.json @@ -142,11 +142,13 @@ "src/Symfony/Bridge/ProxyManager/Legacy/ProxiedMethodReturnExpression.php" ], "exclude-from-classmap": [ - "**/Tests/" ] }, "autoload-dev": { - "files": [ "src/Symfony/Component/VarDumper/Resources/functions/dump.php" ] + "files": [ + "src/Symfony/Component/Debug/Exception/FlattenException.php", + "src/Symfony/Component/VarDumper/Resources/functions/dump.php" + ] }, "repositories": [ { diff --git a/src/Symfony/Component/ErrorHandler/DebugClassLoader.php b/src/Symfony/Component/ErrorHandler/DebugClassLoader.php index 9bf8ce13874c7..f0ecd3c58f93c 100644 --- a/src/Symfony/Component/ErrorHandler/DebugClassLoader.php +++ b/src/Symfony/Component/ErrorHandler/DebugClassLoader.php @@ -423,7 +423,8 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array } if ($canAddReturnType = '' !== ($this->patchTypes['class-prefix'] ?? '') && 0 === strpos($class, $this->patchTypes['class-prefix'])) { - $canAddReturnType = false !== strpos($refl->getFileName(), \DIRECTORY_SEPARATOR.'Tests'.\DIRECTORY_SEPARATOR) + $canAddReturnType = ($this->patchTypes['force'] ?? false) + || false !== strpos($refl->getFileName(), \DIRECTORY_SEPARATOR.'Tests'.\DIRECTORY_SEPARATOR) || $refl->isFinal() || $method->isFinal() || $method->isPrivate() @@ -777,7 +778,7 @@ private function patchMethod(\ReflectionMethod $method, string $returnType, stri } } - if ('object' === $normalizedType && ($this->patchTypes['keep-compat-with-php71'] ?? false)) { + if ('object' === $normalizedType && ($this->patchTypes['php71-compat'] ?? false)) { $returnType = implode('|', $returnType); if ($method->getDocComment()) { @@ -845,7 +846,7 @@ private static function getUseStatements(string $file): array private function fixReturnStatements(\ReflectionMethod $method, ?string $returnType, int $i = 0) { - if (($this->patchTypes['keep-compat-with-php71'] ?? false) && 'object' === ltrim($returnType, '?')) { + if (($this->patchTypes['php71-compat'] ?? false) && 'object' === ltrim($returnType, '?')) { return; }