From add887d60cf5e55bfbcff4df78eee16152de7633 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 15 Feb 2019 04:42:00 +0100 Subject: [PATCH] fixed CS --- .php_cs.dist | 5 ++-- lib/Twig/Autoloader.php | 2 +- test/Twig/Tests/Cache/FilesystemTest.php | 8 +++--- test/Twig/Tests/EnvironmentTest.php | 8 +++--- test/Twig/Tests/ErrorTest.php | 8 +++--- test/Twig/Tests/ExpressionParserTest.php | 26 +++++++++---------- test/Twig/Tests/Extension/CoreTest.php | 4 +-- test/Twig/Tests/Extension/SandboxTest.php | 2 +- test/Twig/Tests/FileCachingTest.php | 2 +- test/Twig/Tests/IntegrationTest.php | 2 +- test/Twig/Tests/LegacyIntegrationTest.php | 2 +- test/Twig/Tests/LexerTest.php | 6 ++--- test/Twig/Tests/Loader/ArrayTest.php | 8 +++--- test/Twig/Tests/Loader/ChainTest.php | 8 +++--- test/Twig/Tests/Loader/FilesystemTest.php | 22 ++++++++-------- test/Twig/Tests/Node/Expression/CallTest.php | 16 ++++++------ .../Twig/Tests/Node/Expression/FilterTest.php | 4 +-- test/Twig/Tests/ParserTest.php | 8 +++--- test/Twig/Tests/TemplateTest.php | 4 +-- test/Twig/Tests/TokenStreamTest.php | 4 +-- 20 files changed, 75 insertions(+), 74 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index 2a5df9ee6..ff8a55dbb 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -5,11 +5,12 @@ return PhpCsFixer\Config::create() '@Symfony' => true, '@Symfony:risky' => true, 'array_syntax' => ['syntax' => 'short'], - 'php_unit_fqcn_annotation' => false, + 'php_unit_fqcn_annotation' => true, 'no_unreachable_default_argument_value' => false, 'braces' => ['allow_single_line_closure' => true], 'heredoc_to_nowdoc' => false, - 'dir_constant' => false, + 'ordered_imports' => true, + 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], ]) ->setRiskyAllowed(true) ->setFinder(PhpCsFixer\Finder::create()->in(__DIR__)) diff --git a/lib/Twig/Autoloader.php b/lib/Twig/Autoloader.php index 6a2bf4a60..633d7a582 100644 --- a/lib/Twig/Autoloader.php +++ b/lib/Twig/Autoloader.php @@ -43,7 +43,7 @@ class Twig_Autoloader return; } - if (is_file($file = dirname(__FILE__).'/../'.str_replace(['_', "\0"], ['/', ''], $class).'.php')) { + if (is_file($file = __DIR__.'/../'.str_replace(['_', "\0"], ['/', ''], $class).'.php')) { require $file; } } diff --git a/test/Twig/Tests/Cache/FilesystemTest.php b/test/Twig/Tests/Cache/FilesystemTest.php index 05a7ac427..818e3ece0 100644 --- a/test/Twig/Tests/Cache/FilesystemTest.php +++ b/test/Twig/Tests/Cache/FilesystemTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -require_once dirname(dirname(__FILE__)).'/FilesystemHelper.php'; +require_once dirname(__DIR__).'/FilesystemHelper.php'; class Twig_Tests_Cache_FilesystemTest extends \PHPUnit\Framework\TestCase { @@ -76,7 +76,7 @@ class Twig_Tests_Cache_FilesystemTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException RuntimeException + * @expectedException \RuntimeException * @expectedExceptionMessage Unable to create the cache directory */ public function testWriteFailMkdir() @@ -98,7 +98,7 @@ class Twig_Tests_Cache_FilesystemTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException RuntimeException + * @expectedException \RuntimeException * @expectedExceptionMessage Unable to write in the cache directory */ public function testWriteFailDirWritable() @@ -122,7 +122,7 @@ class Twig_Tests_Cache_FilesystemTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException RuntimeException + * @expectedException \RuntimeException * @expectedExceptionMessage Failed to write cache file */ public function testWriteFailWriteFile() diff --git a/test/Twig/Tests/EnvironmentTest.php b/test/Twig/Tests/EnvironmentTest.php index 830d26900..676e47ffb 100644 --- a/test/Twig/Tests/EnvironmentTest.php +++ b/test/Twig/Tests/EnvironmentTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -require_once dirname(__FILE__).'/FilesystemHelper.php'; +require_once __DIR__.'/FilesystemHelper.php'; class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase { @@ -37,7 +37,7 @@ class Twig_Tests_EnvironmentTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException LogicException + * @expectedException \LogicException * @expectedExceptionMessage You must set a loader first. * @group legacy */ @@ -481,7 +481,7 @@ EOF } /** - * @expectedException Twig_Error_Runtime + * @expectedException \Twig_Error_Runtime * @expectedExceptionMessage Circular reference detected for Twig template "base.html.twig", path: base.html.twig -> base.html.twig in "base.html.twig" at line 1 */ public function testFailLoadTemplateOnCircularReference() @@ -494,7 +494,7 @@ EOF } /** - * @expectedException Twig_Error_Runtime + * @expectedException \Twig_Error_Runtime * @expectedExceptionMessage Circular reference detected for Twig template "base1.html.twig", path: base1.html.twig -> base2.html.twig -> base1.html.twig in "base1.html.twig" at line 1 */ public function testFailLoadTemplateOnComplexCircularReference() diff --git a/test/Twig/Tests/ErrorTest.php b/test/Twig/Tests/ErrorTest.php index d54412dfe..6fdcbfcc1 100644 --- a/test/Twig/Tests/ErrorTest.php +++ b/test/Twig/Tests/ErrorTest.php @@ -85,7 +85,7 @@ EOHTML public function testTwigExceptionGuessWithMissingVarAndFilesystemLoader() { - $loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/Fixtures/errors'); + $loader = new Twig_Loader_Filesystem(__DIR__.'/Fixtures/errors'); $twig = new Twig_Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]); $template = $twig->loadTemplate('index.html'); @@ -98,13 +98,13 @@ EOHTML $this->assertEquals(3, $e->getTemplateLine()); $this->assertEquals('index.html', $e->getSourceContext()->getName()); $this->assertEquals(3, $e->getLine()); - $this->assertEquals(strtr(dirname(__FILE__).'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile()); + $this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile()); } } public function testTwigExceptionGuessWithExceptionAndFilesystemLoader() { - $loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/Fixtures/errors'); + $loader = new Twig_Loader_Filesystem(__DIR__.'/Fixtures/errors'); $twig = new Twig_Environment($loader, ['strict_variables' => true, 'debug' => true, 'cache' => false]); $template = $twig->loadTemplate('index.html'); @@ -117,7 +117,7 @@ EOHTML $this->assertEquals(3, $e->getTemplateLine()); $this->assertEquals('index.html', $e->getSourceContext()->getName()); $this->assertEquals(3, $e->getLine()); - $this->assertEquals(strtr(dirname(__FILE__).'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile()); + $this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile()); } } diff --git a/test/Twig/Tests/ExpressionParserTest.php b/test/Twig/Tests/ExpressionParserTest.php index e5497b63d..64a47f24a 100644 --- a/test/Twig/Tests/ExpressionParserTest.php +++ b/test/Twig/Tests/ExpressionParserTest.php @@ -12,7 +12,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase { /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @dataProvider getFailingTestsForAssignment */ public function testCanOnlyAssignToNames($template) @@ -54,7 +54,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @dataProvider getFailingTestsForArray */ public function testArraySyntaxError($template) @@ -150,7 +150,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax */ public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings() { @@ -221,7 +221,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax */ public function testAttributeCallDoesNotSupportNamedArguments() { @@ -232,7 +232,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax */ public function testMacroCallDoesNotSupportNamedArguments() { @@ -243,7 +243,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage An argument must be a name. Unexpected token "string" of value "a" ("name" expected) in "index" at line 1. */ public function testMacroDefinitionDoesNotSupportNonNameVariableName() @@ -255,7 +255,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage A default value for an argument must be a constant (a boolean, a string, a number, or an array) in "index" at line 1 * @dataProvider getMacroDefinitionDoesNotSupportNonConstantDefaultValues */ @@ -304,7 +304,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unknown "cycl" function. Did you mean "cycle" in "index" at line 1? */ public function testUnknownFunction() @@ -316,7 +316,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unknown "foobar" function in "index" at line 1. */ public function testUnknownFunctionWithoutSuggestions() @@ -328,7 +328,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unknown "lowe" filter. Did you mean "lower" in "index" at line 1? */ public function testUnknownFilter() @@ -340,7 +340,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unknown "foobar" filter in "index" at line 1. */ public function testUnknownFilterWithoutSuggestions() @@ -352,7 +352,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unknown "nul" test. Did you mean "null" in "index" at line 1 */ public function testUnknownTest() @@ -364,7 +364,7 @@ class Twig_Tests_ExpressionParserTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unknown "foobar" test in "index" at line 1. */ public function testUnknownTestWithoutSuggestions() diff --git a/test/Twig/Tests/Extension/CoreTest.php b/test/Twig/Tests/Extension/CoreTest.php index 08bf3b173..1253eb996 100644 --- a/test/Twig/Tests/Extension/CoreTest.php +++ b/test/Twig/Tests/Extension/CoreTest.php @@ -77,7 +77,7 @@ class Twig_Tests_Extension_CoreTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Runtime + * @expectedException \Twig_Error_Runtime */ public function testRandomFunctionOfEmptyArrayThrowsException() { @@ -136,7 +136,7 @@ class Twig_Tests_Extension_CoreTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Runtime + * @expectedException \Twig_Error_Runtime */ public function testUnknownCustomEscaper() { diff --git a/test/Twig/Tests/Extension/SandboxTest.php b/test/Twig/Tests/Extension/SandboxTest.php index c3b7a6d06..562f7cc16 100644 --- a/test/Twig/Tests/Extension/SandboxTest.php +++ b/test/Twig/Tests/Extension/SandboxTest.php @@ -41,7 +41,7 @@ class Twig_Tests_Extension_SandboxTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Sandbox_SecurityError + * @expectedException \Twig_Sandbox_SecurityError * @expectedExceptionMessage Filter "json_encode" is not allowed in "1_child" at line 3. */ public function testSandboxWithInheritance() diff --git a/test/Twig/Tests/FileCachingTest.php b/test/Twig/Tests/FileCachingTest.php index d6d341e05..df5344573 100644 --- a/test/Twig/Tests/FileCachingTest.php +++ b/test/Twig/Tests/FileCachingTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -require_once dirname(__FILE__).'/FilesystemHelper.php'; +require_once __DIR__.'/FilesystemHelper.php'; class Twig_Tests_FileCachingTest extends \PHPUnit\Framework\TestCase { diff --git a/test/Twig/Tests/IntegrationTest.php b/test/Twig/Tests/IntegrationTest.php index 27c6c7387..8ab8d6cd9 100644 --- a/test/Twig/Tests/IntegrationTest.php +++ b/test/Twig/Tests/IntegrationTest.php @@ -32,7 +32,7 @@ class Twig_Tests_IntegrationTest extends Twig_Test_IntegrationTestCase public function getFixturesDir() { - return dirname(__FILE__).'/Fixtures/'; + return __DIR__.'/Fixtures/'; } } diff --git a/test/Twig/Tests/LegacyIntegrationTest.php b/test/Twig/Tests/LegacyIntegrationTest.php index 004d686a8..fce3eac8c 100644 --- a/test/Twig/Tests/LegacyIntegrationTest.php +++ b/test/Twig/Tests/LegacyIntegrationTest.php @@ -20,7 +20,7 @@ class Twig_Tests_LegacyIntegrationTest extends Twig_Test_IntegrationTestCase public function getFixturesDir() { - return dirname(__FILE__).'/LegacyFixtures/'; + return __DIR__.'/LegacyFixtures/'; } public function getTests($name, $legacyTests = false) diff --git a/test/Twig/Tests/LexerTest.php b/test/Twig/Tests/LexerTest.php index 8cfaaf7fb..c7521a7cd 100644 --- a/test/Twig/Tests/LexerTest.php +++ b/test/Twig/Tests/LexerTest.php @@ -238,7 +238,7 @@ class Twig_Tests_LexerTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unclosed """ */ public function testStringWithUnterminatedInterpolation() @@ -308,7 +308,7 @@ class Twig_Tests_LexerTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unclosed "variable" in "index" at line 3 */ public function testUnterminatedVariable() @@ -327,7 +327,7 @@ bar } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unclosed "block" in "index" at line 3 */ public function testUnterminatedBlock() diff --git a/test/Twig/Tests/Loader/ArrayTest.php b/test/Twig/Tests/Loader/ArrayTest.php index a764e0425..74be2c80a 100644 --- a/test/Twig/Tests/Loader/ArrayTest.php +++ b/test/Twig/Tests/Loader/ArrayTest.php @@ -23,7 +23,7 @@ class Twig_Tests_Loader_ArrayTest extends \PHPUnit\Framework\TestCase /** * @group legacy - * @expectedException Twig_Error_Loader + * @expectedException \Twig_Error_Loader */ public function testGetSourceWhenTemplateDoesNotExist() { @@ -33,7 +33,7 @@ class Twig_Tests_Loader_ArrayTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Loader + * @expectedException \Twig_Error_Loader */ public function testGetSourceContextWhenTemplateDoesNotExist() { @@ -72,7 +72,7 @@ class Twig_Tests_Loader_ArrayTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Loader + * @expectedException \Twig_Error_Loader */ public function testGetCacheKeyWhenTemplateDoesNotExist() { @@ -96,7 +96,7 @@ class Twig_Tests_Loader_ArrayTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Loader + * @expectedException \Twig_Error_Loader */ public function testIsFreshWhenTemplateDoesNotExist() { diff --git a/test/Twig/Tests/Loader/ChainTest.php b/test/Twig/Tests/Loader/ChainTest.php index 3b826c3cf..a42ad932a 100644 --- a/test/Twig/Tests/Loader/ChainTest.php +++ b/test/Twig/Tests/Loader/ChainTest.php @@ -27,7 +27,7 @@ class Twig_Tests_Loader_ChainTest extends \PHPUnit\Framework\TestCase public function testGetSourceContext() { - $path = dirname(__FILE__).'/../Fixtures'; + $path = __DIR__.'/../Fixtures'; $loader = new Twig_Loader_Chain([ new Twig_Loader_Array(['foo' => 'bar']), new Twig_Loader_Array(['errors/index.html' => 'baz']), @@ -47,7 +47,7 @@ class Twig_Tests_Loader_ChainTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Loader + * @expectedException \Twig_Error_Loader */ public function testGetSourceContextWhenTemplateDoesNotExist() { @@ -58,7 +58,7 @@ class Twig_Tests_Loader_ChainTest extends \PHPUnit\Framework\TestCase /** * @group legacy - * @expectedException Twig_Error_Loader + * @expectedException \Twig_Error_Loader */ public function testGetSourceWhenTemplateDoesNotExist() { @@ -79,7 +79,7 @@ class Twig_Tests_Loader_ChainTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Loader + * @expectedException \Twig_Error_Loader */ public function testGetCacheKeyWhenTemplateDoesNotExist() { diff --git a/test/Twig/Tests/Loader/FilesystemTest.php b/test/Twig/Tests/Loader/FilesystemTest.php index 78758e0b7..dc46e897e 100644 --- a/test/Twig/Tests/Loader/FilesystemTest.php +++ b/test/Twig/Tests/Loader/FilesystemTest.php @@ -13,7 +13,7 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase { public function testGetSourceContext() { - $path = dirname(__FILE__).'/../Fixtures'; + $path = __DIR__.'/../Fixtures'; $loader = new Twig_Loader_Filesystem([$path]); $this->assertEquals('errors/index.html', $loader->getSourceContext('errors/index.html')->getName()); $this->assertEquals(realpath($path.'/errors/index.html'), realpath($loader->getSourceContext('errors/index.html')->getPath())); @@ -24,7 +24,7 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase */ public function testSecurity($template) { - $loader = new Twig_Loader_Filesystem([dirname(__FILE__).'/../Fixtures']); + $loader = new Twig_Loader_Filesystem([__DIR__.'/../Fixtures']); try { $loader->getCacheKey($template); @@ -97,12 +97,12 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase { return [ [ - dirname(__FILE__).'/Fixtures', + __DIR__.'/Fixtures', 'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html', null, ], [ - dirname(__FILE__).'/Fixtures/../Fixtures', + __DIR__.'/Fixtures/../Fixtures', 'test/Twig/Tests/Loader/Fixtures/named_quater/named_absolute.html', null, ], @@ -141,7 +141,7 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase public function testFindTemplateExceptionNamespace() { - $basePath = dirname(__FILE__).'/Fixtures'; + $basePath = __DIR__.'/Fixtures'; $loader = new Twig_Loader_Filesystem([$basePath.'/normal']); $loader->addPath($basePath.'/named', 'named'); @@ -156,7 +156,7 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase public function testFindTemplateWithCache() { - $basePath = dirname(__FILE__).'/Fixtures'; + $basePath = __DIR__.'/Fixtures'; $loader = new Twig_Loader_Filesystem([$basePath.'/normal']); $loader->addPath($basePath.'/named', 'named'); @@ -172,9 +172,9 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase public function testLoadTemplateAndRenderBlockWithCache() { $loader = new Twig_Loader_Filesystem([]); - $loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme2'); - $loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme1'); - $loader->addPath(dirname(__FILE__).'/Fixtures/themes/theme1', 'default_theme'); + $loader->addPath(__DIR__.'/Fixtures/themes/theme2'); + $loader->addPath(__DIR__.'/Fixtures/themes/theme1'); + $loader->addPath(__DIR__.'/Fixtures/themes/theme1', 'default_theme'); $twig = new Twig_Environment($loader); @@ -203,7 +203,7 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase public function testArrayInheritance($templateName) { $loader = new Twig_Loader_Filesystem([]); - $loader->addPath(dirname(__FILE__).'/Fixtures/inheritance'); + $loader->addPath(__DIR__.'/Fixtures/inheritance'); $twig = new Twig_Environment($loader); @@ -220,7 +220,7 @@ class Twig_Tests_Loader_FilesystemTest extends \PHPUnit\Framework\TestCase // phar-sample.phar was created with the following script: // $f = new Phar('phar-test.phar'); // $f->addFromString('hello.twig', 'hello from phar'); - $loader->addPath('phar://'.dirname(__FILE__).'/Fixtures/phar/phar-sample.phar'); + $loader->addPath('phar://'.__DIR__.'/Fixtures/phar/phar-sample.phar'); $this->assertSame('hello from phar', $loader->getSourceContext('hello.twig')->getCode()); } diff --git a/test/Twig/Tests/Node/Expression/CallTest.php b/test/Twig/Tests/Node/Expression/CallTest.php index d8cf850ed..ede330987 100644 --- a/test/Twig/Tests/Node/Expression/CallTest.php +++ b/test/Twig/Tests/Node/Expression/CallTest.php @@ -18,7 +18,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Positional arguments cannot be used after named arguments for function "date". */ public function testGetArgumentsWhenPositionalArgumentsAfterNamedArguments() @@ -28,7 +28,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Argument "format" is defined twice for function "date". */ public function testGetArgumentsWhenArgumentIsDefinedTwice() @@ -38,7 +38,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unknown argument "unknown" for function "date(format, timestamp)". */ public function testGetArgumentsWithWrongNamedArgumentName() @@ -48,7 +48,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unknown arguments "unknown1", "unknown2" for function "date(format, timestamp)". */ public function testGetArgumentsWithWrongNamedArgumentNames() @@ -58,7 +58,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Argument "case_sensitivity" could not be assigned for function "substr_compare(main_str, str, offset, length, case_sensitivity)" because it is mapped to an internal PHP function which cannot determine default value for optional argument "length". */ public function testResolveArgumentsWithMissingValueForOptionalArgument() @@ -81,7 +81,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException LogicException + * @expectedException \LogicException * @expectedExceptionMessage The last parameter of "Twig_Tests_Node_Expression_CallTest::customFunctionWithArbitraryArguments" for function "foo" must be an array with default value, eg. "array $arg = []". */ public function testResolveArgumentsWithMissingParameterForArbitraryArguments() @@ -103,7 +103,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException LogicException + * @expectedException \LogicException * @expectedExceptionMessageRegExp #^The last parameter of "custom_Twig_Tests_Node_Expression_CallTest_function" for function "foo" must be an array with default value, eg\. "array \$arg \= \[\]"\.$# */ public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnFunction() @@ -113,7 +113,7 @@ class Twig_Tests_Node_Expression_CallTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException LogicException + * @expectedException \LogicException * @expectedExceptionMessageRegExp #^The last parameter of "CallableTestClass\:\:__invoke" for function "foo" must be an array with default value, eg\. "array \$arg \= \[\]"\.$# */ public function testResolveArgumentsWithMissingParameterForArbitraryArgumentsOnObject() diff --git a/test/Twig/Tests/Node/Expression/FilterTest.php b/test/Twig/Tests/Node/Expression/FilterTest.php index a626db2b9..1db144583 100644 --- a/test/Twig/Tests/Node/Expression/FilterTest.php +++ b/test/Twig/Tests/Node/Expression/FilterTest.php @@ -102,7 +102,7 @@ class Twig_Tests_Node_Expression_FilterTest extends Twig_Test_NodeTestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unknown argument "foobar" for filter "date(format, timezone)" at line 1. */ public function testCompileWithWrongNamedArgumentName() @@ -117,7 +117,7 @@ class Twig_Tests_Node_Expression_FilterTest extends Twig_Test_NodeTestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Value for argument "from" is required for filter "replace" at line 1. */ public function testCompileWithMissingNamedArgument() diff --git a/test/Twig/Tests/ParserTest.php b/test/Twig/Tests/ParserTest.php index 5134f22b9..5a8611ffc 100644 --- a/test/Twig/Tests/ParserTest.php +++ b/test/Twig/Tests/ParserTest.php @@ -11,7 +11,7 @@ class Twig_Tests_ParserTest extends \PHPUnit\Framework\TestCase { /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax */ public function testSetMacroThrowsExceptionOnReservedMethods() { @@ -20,7 +20,7 @@ class Twig_Tests_ParserTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unknown "foo" tag. Did you mean "for" at line 1? */ public function testUnknownTag() @@ -36,7 +36,7 @@ class Twig_Tests_ParserTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unknown "foobar" tag at line 1. */ public function testUnknownTagWithoutSuggestions() @@ -81,7 +81,7 @@ class Twig_Tests_ParserTest extends \PHPUnit\Framework\TestCase /** * @dataProvider getFilterBodyNodesDataThrowsException - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax */ public function testFilterBodyNodesThrowsException($input) { diff --git a/test/Twig/Tests/TemplateTest.php b/test/Twig/Tests/TemplateTest.php index 0a5bf52a8..3b1049485 100644 --- a/test/Twig/Tests/TemplateTest.php +++ b/test/Twig/Tests/TemplateTest.php @@ -11,7 +11,7 @@ class Twig_Tests_TemplateTest extends \PHPUnit\Framework\TestCase { /** - * @expectedException LogicException + * @expectedException \LogicException */ public function testDisplayBlocksAcceptTemplateOnlyAsBlocks() { @@ -434,7 +434,7 @@ class Twig_Tests_TemplateTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Runtime + * @expectedException \Twig_Error_Runtime */ public function testGetIsMethods() { diff --git a/test/Twig/Tests/TokenStreamTest.php b/test/Twig/Tests/TokenStreamTest.php index 59a80fceb..1867b4298 100644 --- a/test/Twig/Tests/TokenStreamTest.php +++ b/test/Twig/Tests/TokenStreamTest.php @@ -52,7 +52,7 @@ class Twig_Tests_TokenStreamTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unexpected end of template */ public function testEndOfTemplateNext() @@ -66,7 +66,7 @@ class Twig_Tests_TokenStreamTest extends \PHPUnit\Framework\TestCase } /** - * @expectedException Twig_Error_Syntax + * @expectedException \Twig_Error_Syntax * @expectedExceptionMessage Unexpected end of template */ public function testEndOfTemplateLook()