From 8d81259b9ca781fe5229166c079c2c8bc1666385 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 21 May 2020 08:32:17 +0200 Subject: [PATCH 1/3] Fix Travis config --- .travis.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 25c8b1f2f..0db7a5671 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,20 +20,20 @@ before_install: install: - travis_retry composer install - ./vendor/bin/simple-phpunit install - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || cd extra/cssinliner-extra && travis_retry composer install) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || cd extra/html-extra && travis_retry composer install) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || cd extra/inky-extra && travis_retry composer install) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || cd extra/intl-extra && travis_retry composer install) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || cd extra/markdown-extra && travis_retry composer install) - - ([[ $TRAVIS_PHP_VERSION = 7.1 ]] || [[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/string-extra && travis_retry composer install)) + - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/cssinliner-extra && travis_retry composer install && ./vendor/bin/simple-phpunit install)) + - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/html-extra && travis_retry composer install && ./vendor/bin/simple-phpunit install)) + - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/inky-extra && travis_retry composer install && ./vendor/bin/simple-phpunit install)) + - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/intl-extra && travis_retry composer install && ./vendor/bin/simple-phpunit install)) + - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/markdown-extra && travis_retry composer install && ./vendor/bin/simple-phpunit install)) + - ([[ $TRAVIS_PHP_VERSION = 7.1 ]] || [[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/string-extra && travis_retry composer install && ./vendor/bin/simple-phpunit install)) script: - ./vendor/bin/simple-phpunit - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || cd extra/cssinliner-extra && ./vendor/bin/simple-phpunit) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || cd extra/html-extra && ./vendor/bin/simple-phpunit) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || cd extra/inky-extra && ./vendor/bin/simple-phpunit) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || cd extra/intl-extra && ./vendor/bin/simple-phpunit) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || cd extra/markdown-extra && ./vendor/bin/simple-phpunit) + - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/cssinliner-extra && ./vendor/bin/simple-phpunit)) + - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/html-extra && ./vendor/bin/simple-phpunit)) + - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/inky-extra && ./vendor/bin/simple-phpunit)) + - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/intl-extra && ./vendor/bin/simple-phpunit)) + - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/markdown-extra && ./vendor/bin/simple-phpunit)) - ([[ $TRAVIS_PHP_VERSION = 7.1 ]] || [[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/string-extra && ./vendor/bin/simple-phpunit)) matrix: From 5dc364469b83b9b5b14dd42cbf80e4e8515567e0 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 21 May 2020 10:13:35 +0200 Subject: [PATCH 2/3] Minor fixes --- .travis.yml | 7 ++++--- drupal_test.sh | 4 +++- src/Node/Expression/GetAttrExpression.php | 2 +- src/Node/Expression/Test/DefinedTest.php | 2 +- src/Node/Expression/TestExpression.php | 2 +- src/Node/ModuleNode.php | 2 +- tests/Cache/FilesystemTest.php | 4 ++-- tests/Extension/SandboxTest.php | 2 +- tests/FileCachingTest.php | 4 ++-- tests/TokenStreamTest.php | 2 +- tests/escapingTest.php | 2 +- 11 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7fead3d75..33be91460 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ cache: env: global: - - SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 - SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1 before_install: @@ -18,9 +17,11 @@ before_install: install: - travis_retry composer install - - ./vendor/bin/simple-phpunit install + - export PHPUNIT=$(readlink -f ./vendor/bin/simple-phpunit) + - $PHPUNIT install -script: ./vendor/bin/simple-phpunit +script: + - $PHPUNIT jobs: fast_finish: true diff --git a/drupal_test.sh b/drupal_test.sh index d71aad8da..e15bd6673 100755 --- a/drupal_test.sh +++ b/drupal_test.sh @@ -6,8 +6,10 @@ set -e REPO=`pwd` cd /tmp rm -rf drupal-twig-test -composer create-project --no-interaction drupal-composer/drupal-project:8.x-dev drupal-twig-test +composer create-project --no-install --no-interaction drupal-composer/drupal-project:8.x-dev drupal-twig-test cd drupal-twig-test +composer require --no-update webflo/drupal-core-require-dev "egulias/email-validator:^2.0" +composer update (cd vendor/twig && rm -rf twig && ln -sf $REPO twig) echo '$config["system.logging"]["error_level"] = "verbose";' >> web/sites/default/settings.php php ./web/core/scripts/drupal install --no-interaction demo_umami > output diff --git a/src/Node/Expression/GetAttrExpression.php b/src/Node/Expression/GetAttrExpression.php index b790bf7af..06511c773 100644 --- a/src/Node/Expression/GetAttrExpression.php +++ b/src/Node/Expression/GetAttrExpression.php @@ -17,7 +17,7 @@ use Twig\Template; class GetAttrExpression extends AbstractExpression { - public function __construct(AbstractExpression $node, AbstractExpression $attribute, AbstractExpression $arguments = null, $type, $lineno) + public function __construct(AbstractExpression $node, AbstractExpression $attribute, ?AbstractExpression $arguments, string $type, int $lineno) { $nodes = ['node' => $node, 'attribute' => $attribute]; if (null !== $arguments) { diff --git a/src/Node/Expression/Test/DefinedTest.php b/src/Node/Expression/Test/DefinedTest.php index 2222e11cf..e2b3a0b8a 100644 --- a/src/Node/Expression/Test/DefinedTest.php +++ b/src/Node/Expression/Test/DefinedTest.php @@ -33,7 +33,7 @@ use Twig\Node\Expression\TestExpression; */ class DefinedTest extends TestExpression { - public function __construct(\Twig_NodeInterface $node, $name, \Twig_NodeInterface $arguments = null, $lineno) + public function __construct(\Twig_NodeInterface $node, $name, ?\Twig_NodeInterface $arguments, $lineno) { if ($node instanceof NameExpression) { $node->setAttribute('is_defined_test', true); diff --git a/src/Node/Expression/TestExpression.php b/src/Node/Expression/TestExpression.php index 8fc31d3aa..fa3c18fbf 100644 --- a/src/Node/Expression/TestExpression.php +++ b/src/Node/Expression/TestExpression.php @@ -16,7 +16,7 @@ use Twig\TwigTest; class TestExpression extends CallExpression { - public function __construct(\Twig_NodeInterface $node, $name, \Twig_NodeInterface $arguments = null, $lineno) + public function __construct(\Twig_NodeInterface $node, $name, ?\Twig_NodeInterface $arguments, $lineno) { $nodes = ['node' => $node]; if (null !== $arguments) { diff --git a/src/Node/ModuleNode.php b/src/Node/ModuleNode.php index aab2aa33f..89d602b97 100644 --- a/src/Node/ModuleNode.php +++ b/src/Node/ModuleNode.php @@ -28,7 +28,7 @@ use Twig\Source; */ class ModuleNode extends Node { - public function __construct(\Twig_NodeInterface $body, AbstractExpression $parent = null, \Twig_NodeInterface $blocks, \Twig_NodeInterface $macros, \Twig_NodeInterface $traits, $embeddedTemplates, $name, $source = '') + public function __construct(\Twig_NodeInterface $body, ?AbstractExpression $parent, \Twig_NodeInterface $blocks, \Twig_NodeInterface $macros, \Twig_NodeInterface $traits, $embeddedTemplates, $name, $source = '') { if (!$name instanceof Source) { @trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a \Twig\Source instance instead.', __METHOD__), E_USER_DEPRECATED); diff --git a/tests/Cache/FilesystemTest.php b/tests/Cache/FilesystemTest.php index c810caed9..6b842cb7d 100644 --- a/tests/Cache/FilesystemTest.php +++ b/tests/Cache/FilesystemTest.php @@ -20,7 +20,7 @@ class FilesystemTest extends \PHPUnit\Framework\TestCase private $directory; private $cache; - protected function setUp() + protected function setUp(): void { $nonce = hash('sha256', uniqid(mt_rand(), true)); $this->classname = '__Twig_Tests_Cache_FilesystemTest_Template_'.$nonce; @@ -28,7 +28,7 @@ class FilesystemTest extends \PHPUnit\Framework\TestCase $this->cache = new FilesystemCache($this->directory); } - protected function tearDown() + protected function tearDown(): void { if (file_exists($this->directory)) { FilesystemHelper::removeDir($this->directory); diff --git a/tests/Extension/SandboxTest.php b/tests/Extension/SandboxTest.php index fe0f32ff5..7b7107988 100644 --- a/tests/Extension/SandboxTest.php +++ b/tests/Extension/SandboxTest.php @@ -22,7 +22,7 @@ class SandboxTest extends \PHPUnit\Framework\TestCase protected static $params; protected static $templates; - protected function setUp() + protected function setUp(): void { self::$params = [ 'name' => 'Fabien', diff --git a/tests/FileCachingTest.php b/tests/FileCachingTest.php index e1fa3a4b5..acc8b9bf9 100644 --- a/tests/FileCachingTest.php +++ b/tests/FileCachingTest.php @@ -19,7 +19,7 @@ class FileCachingTest extends \PHPUnit\Framework\TestCase private $env; private $tmpDir; - protected function setUp() + protected function setUp(): void { $this->tmpDir = sys_get_temp_dir().'/TwigTests'; if (!file_exists($this->tmpDir)) { @@ -33,7 +33,7 @@ class FileCachingTest extends \PHPUnit\Framework\TestCase $this->env = new Environment(new ArrayLoader(['index' => 'index', 'index2' => 'index2']), ['cache' => $this->tmpDir]); } - protected function tearDown() + protected function tearDown(): void { FilesystemHelper::removeDir($this->tmpDir); } diff --git a/tests/TokenStreamTest.php b/tests/TokenStreamTest.php index c98e0f072..66cc01f00 100644 --- a/tests/TokenStreamTest.php +++ b/tests/TokenStreamTest.php @@ -18,7 +18,7 @@ class TokenStreamTest extends \PHPUnit\Framework\TestCase { protected static $tokens; - protected function setUp() + protected function setUp(): void { self::$tokens = [ new Token(Token::TEXT_TYPE, 1, 1), diff --git a/tests/escapingTest.php b/tests/escapingTest.php index 84759ebb4..7b1db1b44 100644 --- a/tests/escapingTest.php +++ b/tests/escapingTest.php @@ -151,7 +151,7 @@ class Twig_Test_EscapingTest extends \PHPUnit\Framework\TestCase protected $env; - protected function setUp() + protected function setUp(): void { $this->env = new \Twig\Environment($this->createMock('\Twig\Loader\LoaderInterface')); } From 4e0008cd82990cfec653d62674934499d838a84a Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 21 May 2020 11:20:45 +0200 Subject: [PATCH 3/3] Try running all tests on nightly --- .travis.yml | 28 +++++++++++++------------- drupal_test.sh | 1 - extra/cssinliner-extra/composer.json | 1 - extra/html-extra/composer.json | 1 - extra/inky-extra/composer.json | 1 - extra/intl-extra/composer.json | 1 - extra/intl-extra/src/IntlExtension.php | 2 +- extra/markdown-extra/composer.json | 1 - extra/string-extra/composer.json | 1 - extra/twig-extra-bundle/composer.json | 1 - 10 files changed, 15 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 75fcd7d10..4d8da6f5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,6 @@ cache: env: global: - - SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 - SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1 before_install: @@ -21,23 +20,24 @@ install: - travis_retry composer install - export PHPUNIT=$(readlink -f ./vendor/bin/simple-phpunit) - $PHPUNIT install - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/cssinliner-extra && travis_retry composer install)) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/html-extra && travis_retry composer install)) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/inky-extra && travis_retry composer install)) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/intl-extra && travis_retry composer install)) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/markdown-extra && travis_retry composer install)) - - ([[ $TRAVIS_PHP_VERSION = 7.1 ]] || [[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/string-extra && travis_retry composer install)) + - (cd extra/cssinliner-extra && travis_retry composer install) + - (cd extra/html-extra && travis_retry composer install) + - (cd extra/inky-extra && travis_retry composer install) + - (cd extra/intl-extra && travis_retry composer install) + - ([[ $TRAVIS_PHP_VERSION = nightly ]] && (cd extra/markdown-extra && composer config platform.php 7.4.99) || true) + - (cd extra/markdown-extra && travis_retry composer install) + - ([[ $TRAVIS_PHP_VERSION = 7.1 ]] || (cd extra/string-extra && travis_retry composer install)) script: - $PHPUNIT - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/cssinliner-extra && $PHPUNIT)) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/html-extra && $PHPUNIT)) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/inky-extra && $PHPUNIT)) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/intl-extra && $PHPUNIT)) - - ([[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/markdown-extra && $PHPUNIT)) - - ([[ $TRAVIS_PHP_VERSION = 7.1 ]] || [[ $TRAVIS_PHP_VERSION = "nightly" ]] || (cd extra/string-extra && $PHPUNIT)) + - (cd extra/cssinliner-extra && $PHPUNIT) + - (cd extra/html-extra && $PHPUNIT) + - (cd extra/inky-extra && $PHPUNIT) + - (cd extra/intl-extra && $PHPUNIT) + - (cd extra/markdown-extra && $PHPUNIT) + - ([[ $TRAVIS_PHP_VERSION = 7.1 ]] || (cd extra/string-extra && $PHPUNIT)) -matrix: +jobs: fast_finish: true include: - php: 7.1 diff --git a/drupal_test.sh b/drupal_test.sh index 0cb690baa..e15bd6673 100755 --- a/drupal_test.sh +++ b/drupal_test.sh @@ -12,7 +12,6 @@ composer require --no-update webflo/drupal-core-require-dev "egulias/email-valid composer update (cd vendor/twig && rm -rf twig && ln -sf $REPO twig) echo '$config["system.logging"]["error_level"] = "verbose";' >> web/sites/default/settings.php -composer require drupal/core:8.7.x-dev webflo/drupal-core-require-dev:8.7.x-dev "egulias/email-validator:^2.0" php ./web/core/scripts/drupal install --no-interaction demo_umami > output perl -p -i -e 's/^([A-Za-z]+)\: (.+)$/export DRUPAL_\1=\2/' output source output diff --git a/extra/cssinliner-extra/composer.json b/extra/cssinliner-extra/composer.json index 1afeaf9cd..c1696a3f2 100644 --- a/extra/cssinliner-extra/composer.json +++ b/extra/cssinliner-extra/composer.json @@ -6,7 +6,6 @@ "homepage": "https://twig.symfony.com", "license": "MIT", "minimum-stability": "dev", - "prefer-stable": true, "authors": [ { "name": "Fabien Potencier", diff --git a/extra/html-extra/composer.json b/extra/html-extra/composer.json index e4a69cf82..c7abce173 100644 --- a/extra/html-extra/composer.json +++ b/extra/html-extra/composer.json @@ -6,7 +6,6 @@ "homepage": "https://twig.symfony.com", "license": "MIT", "minimum-stability": "dev", - "prefer-stable": true, "authors": [ { "name": "Fabien Potencier", diff --git a/extra/inky-extra/composer.json b/extra/inky-extra/composer.json index 817cac369..137670e3a 100644 --- a/extra/inky-extra/composer.json +++ b/extra/inky-extra/composer.json @@ -6,7 +6,6 @@ "homepage": "https://twig.symfony.com", "license": "MIT", "minimum-stability": "dev", - "prefer-stable": true, "authors": [ { "name": "Fabien Potencier", diff --git a/extra/intl-extra/composer.json b/extra/intl-extra/composer.json index 456ae8345..55ecfc648 100644 --- a/extra/intl-extra/composer.json +++ b/extra/intl-extra/composer.json @@ -6,7 +6,6 @@ "homepage": "https://twig.symfony.com", "license": "MIT", "minimum-stability": "dev", - "prefer-stable": true, "authors": [ { "name": "Fabien Potencier", diff --git a/extra/intl-extra/src/IntlExtension.php b/extra/intl-extra/src/IntlExtension.php index 3bb23bac7..34f33c80e 100644 --- a/extra/intl-extra/src/IntlExtension.php +++ b/extra/intl-extra/src/IntlExtension.php @@ -307,7 +307,7 @@ final class IntlExtension extends AbstractExtension return $this->formatDateTime($env, $date, 'none', $timeFormat, $pattern, $timezone, $calendar, $locale); } - private function createDateFormatter(?string $locale, ?string $dateFormat, ?string $timeFormat, string $pattern = '', \DateTimeZone $timezone, string $calendar): \IntlDateFormatter + private function createDateFormatter(?string $locale, ?string $dateFormat, ?string $timeFormat, string $pattern, \DateTimeZone $timezone, string $calendar): \IntlDateFormatter { if (null !== $dateFormat && !isset(self::DATE_FORMATS[$dateFormat])) { throw new RuntimeError(sprintf('The date format "%s" does not exist, known formats are: "%s".', $dateFormat, implode('", "', array_keys(self::DATE_FORMATS)))); diff --git a/extra/markdown-extra/composer.json b/extra/markdown-extra/composer.json index 385e470b7..bf7a7c77a 100644 --- a/extra/markdown-extra/composer.json +++ b/extra/markdown-extra/composer.json @@ -6,7 +6,6 @@ "homepage": "https://twig.symfony.com", "license": "MIT", "minimum-stability": "dev", - "prefer-stable": true, "authors": [ { "name": "Fabien Potencier", diff --git a/extra/string-extra/composer.json b/extra/string-extra/composer.json index 5bc9fcc99..ad9027e2b 100644 --- a/extra/string-extra/composer.json +++ b/extra/string-extra/composer.json @@ -6,7 +6,6 @@ "homepage": "https://twig.symfony.com", "license": "MIT", "minimum-stability": "dev", - "prefer-stable": true, "authors": [ { "name": "Fabien Potencier", diff --git a/extra/twig-extra-bundle/composer.json b/extra/twig-extra-bundle/composer.json index 67d8efb3d..ff32ff460 100644 --- a/extra/twig-extra-bundle/composer.json +++ b/extra/twig-extra-bundle/composer.json @@ -6,7 +6,6 @@ "homepage": "https://twig.symfony.com", "license": "MIT", "minimum-stability": "dev", - "prefer-stable": true, "authors": [ { "name": "Fabien Potencier",