From 5dc364469b83b9b5b14dd42cbf80e4e8515567e0 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 21 May 2020 10:13:35 +0200 Subject: [PATCH] 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')); }