mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-05 06:56:51 +00:00
fixed CS
This commit is contained in:
@@ -25,7 +25,7 @@ class ErrorTest extends \PHPUnit\Framework\TestCase
|
||||
$error = new Error('foo');
|
||||
$error->setSourceContext(new Source('', new \SplFileInfo(__FILE__)));
|
||||
|
||||
$this->assertContains('test'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Tests'.DIRECTORY_SEPARATOR.'ErrorTest.php', $error->getMessage());
|
||||
$this->assertContains('test'.\DIRECTORY_SEPARATOR.'Twig'.\DIRECTORY_SEPARATOR.'Tests'.\DIRECTORY_SEPARATOR.'ErrorTest.php', $error->getMessage());
|
||||
}
|
||||
|
||||
public function testErrorWithArrayFilename()
|
||||
@@ -107,7 +107,7 @@ EOHTML
|
||||
$this->assertEquals(3, $e->getTemplateLine());
|
||||
$this->assertEquals('index.html', $e->getSourceContext()->getName());
|
||||
$this->assertEquals(3, $e->getLine());
|
||||
$this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile());
|
||||
$this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', \DIRECTORY_SEPARATOR), $e->getFile());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ EOHTML
|
||||
$this->assertEquals(3, $e->getTemplateLine());
|
||||
$this->assertEquals('index.html', $e->getSourceContext()->getName());
|
||||
$this->assertEquals(3, $e->getLine());
|
||||
$this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', DIRECTORY_SEPARATOR), $e->getFile());
|
||||
$this->assertEquals(strtr(__DIR__.'/Fixtures/errors/index.html', '/', \DIRECTORY_SEPARATOR), $e->getFile());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class FilesystemHelper
|
||||
{
|
||||
public static function removeDir($dir)
|
||||
{
|
||||
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir, PHP_VERSION_ID < 50300 ? 0 : \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST);
|
||||
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir, \PHP_VERSION_ID < 50300 ? 0 : \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST);
|
||||
foreach ($iterator as $filename => $fileInfo) {
|
||||
if ($iterator->isDot()) {
|
||||
continue;
|
||||
|
||||
@@ -23,7 +23,7 @@ class NativeExtensionTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testGetProperties()
|
||||
{
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
if (\PHP_VERSION_ID >= 70000) {
|
||||
$this->markTestSkipped('Extension is not available on PHP 7+');
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class FilterTest extends NodeTestCase
|
||||
$tests[] = [$node, 'twig_reverse_filter($this->env, "abc", true)'];
|
||||
|
||||
// filter as an anonymous function
|
||||
if (PHP_VERSION_ID >= 50300) {
|
||||
if (\PHP_VERSION_ID >= 50300) {
|
||||
$node = $this->createFilter(new ConstantExpression('foo', 1), 'anonymous');
|
||||
$tests[] = [$node, 'call_user_func_array($this->env->getFilter(\'anonymous\')->getCallable(), ["foo"])'];
|
||||
}
|
||||
@@ -150,7 +150,7 @@ class FilterTest extends NodeTestCase
|
||||
|
||||
protected function getEnvironment()
|
||||
{
|
||||
if (PHP_VERSION_ID >= 50300) {
|
||||
if (\PHP_VERSION_ID >= 50300) {
|
||||
return include 'PHP53/FilterInclude.php';
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ class FunctionTest extends NodeTestCase
|
||||
$tests[] = [$node, 'Twig\Tests\Node\Expression\twig_tests_function_barbar("1", "2", [0 => "3", "foo" => "bar"])', $environment];
|
||||
|
||||
// function as an anonymous function
|
||||
if (PHP_VERSION_ID >= 50300) {
|
||||
if (\PHP_VERSION_ID >= 50300) {
|
||||
$node = $this->createFunction('anonymous', [new ConstantExpression('foo', 1)]);
|
||||
$tests[] = [$node, 'call_user_func_array($this->env->getFunction(\'anonymous\')->getCallable(), ["foo"])'];
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class FunctionTest extends NodeTestCase
|
||||
|
||||
protected function getEnvironment()
|
||||
{
|
||||
if (PHP_VERSION_ID >= 50300) {
|
||||
if (\PHP_VERSION_ID >= 50300) {
|
||||
return include 'PHP53/FunctionInclude.php';
|
||||
}
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@ class NameTest extends NodeTestCase
|
||||
$env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => true]);
|
||||
$env1 = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock(), ['strict_variables' => false]);
|
||||
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
if (\PHP_VERSION_ID >= 70000) {
|
||||
$output = '($context["foo"] ?? $this->getContext($context, "foo"))';
|
||||
} elseif (PHP_VERSION_ID >= 50400) {
|
||||
} elseif (\PHP_VERSION_ID >= 50400) {
|
||||
$output = '(isset($context["foo"]) ? $context["foo"] : $this->getContext($context, "foo"))';
|
||||
} else {
|
||||
$output = '$this->getContext($context, "foo")';
|
||||
|
||||
@@ -25,9 +25,9 @@ class NullCoalesceTest extends NodeTestCase
|
||||
$left = new NameExpression('foo', 1);
|
||||
$right = new ConstantExpression(2, 1);
|
||||
$node = new NullCoalesceExpression($left, $right, 1);
|
||||
if (PHP_VERSION_ID >= 70000) {
|
||||
if (\PHP_VERSION_ID >= 70000) {
|
||||
$tests[] = [$node, "((// line 1\n\$context[\"foo\"]) ?? (2))"];
|
||||
} elseif (PHP_VERSION_ID >= 50400) {
|
||||
} elseif (\PHP_VERSION_ID >= 50400) {
|
||||
$tests[] = [$node, "(((// line 1\n(isset(\$context[\"foo\"]) || array_key_exists(\"foo\", \$context)) && !(null === (isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)))) ? ((isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)) : (2))"];
|
||||
} else {
|
||||
$tests[] = [$node, "(((// line 1\n(isset(\$context[\"foo\"]) || array_key_exists(\"foo\", \$context)) && !(null === \$this->getContext(\$context, \"foo\")))) ? (\$this->getContext(\$context, \"foo\")) : (2))"];
|
||||
|
||||
@@ -45,7 +45,7 @@ class TestTest extends NodeTestCase
|
||||
$tests[] = [$node, '(null === "foo")'];
|
||||
|
||||
// test as an anonymous function
|
||||
if (PHP_VERSION_ID >= 50300) {
|
||||
if (\PHP_VERSION_ID >= 50300) {
|
||||
$node = $this->createTest(new ConstantExpression('foo', 1), 'anonymous', [new ConstantExpression('foo', 1)]);
|
||||
$tests[] = [$node, 'call_user_func_array($this->env->getTest(\'anonymous\')->getCallable(), ["foo", "foo"])'];
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class TestTest extends NodeTestCase
|
||||
|
||||
protected function getEnvironment()
|
||||
{
|
||||
if (PHP_VERSION_ID >= 50300) {
|
||||
if (\PHP_VERSION_ID >= 50300) {
|
||||
return include 'PHP53/TestInclude.php';
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class MacroTest extends NodeTestCase
|
||||
], [], 1);
|
||||
$node = new MacroNode('foo', $body, $arguments, 1);
|
||||
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
if (\PHP_VERSION_ID >= 50600) {
|
||||
$declaration = ', ...$__varargs__';
|
||||
$varargs = '$__varargs__';
|
||||
} else {
|
||||
|
||||
@@ -43,7 +43,7 @@ class OptimizerTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
public function testRenderVariableBlockOptimizer()
|
||||
{
|
||||
if (PHP_VERSION_ID >= 50400) {
|
||||
if (\PHP_VERSION_ID >= 50400) {
|
||||
$this->markTestSkipped('not needed on PHP >= 5.4');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user