Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Introduce PSR2 compliance across src and tests

  • Loading branch information...
commit 8cf87733b0dfd7c4b39e6039c21abb764a53b373 1 parent eaa0fb9
@hnrysmth authored
Showing with 693 additions and 210 deletions.
  1. +5 −1 Makefile
  2. +2 −1  composer.json
  3. +109 −30 composer.lock
  4. +1 −1  src/TwigJs/Assetic/TwigJsFilter.php
  5. +1 −1  src/TwigJs/CompileRequest.php
  6. +1 −1  src/TwigJs/CompileRequestHandler.php
  7. +3 −1 src/TwigJs/Compiler/AutoEscapeCompiler.php
  8. +3 −1 src/TwigJs/Compiler/BlockCompiler.php
  9. +6 −2 src/TwigJs/Compiler/BlockReferenceCompiler.php
  10. +4 −3 src/TwigJs/Compiler/BodyCompiler.php
  11. +3 −1 src/TwigJs/Compiler/DoCompiler.php
  12. +6 −4 src/TwigJs/Compiler/Expression/ArrayCompiler.php
  13. +3 −1 src/TwigJs/Compiler/Expression/AssignNameCompiler.php
  14. +4 −2 src/TwigJs/Compiler/Expression/Binary/AddCompiler.php
  15. +6 −2 src/TwigJs/Compiler/Expression/Binary/AndCompiler.php
  16. +6 −2 src/TwigJs/Compiler/Expression/Binary/BitwiseAndCompiler.php
  17. +6 −2 src/TwigJs/Compiler/Expression/Binary/BitwiseOrCompiler.php
  18. +6 −2 src/TwigJs/Compiler/Expression/Binary/BitwiseXorCompiler.php
  19. +6 −2 src/TwigJs/Compiler/Expression/Binary/ConcatCompiler.php
  20. +6 −2 src/TwigJs/Compiler/Expression/Binary/DivCompiler.php
  21. +6 −2 src/TwigJs/Compiler/Expression/Binary/EqualCompiler.php
  22. +6 −2 src/TwigJs/Compiler/Expression/Binary/FloorDivCompiler.php
  23. +6 −2 src/TwigJs/Compiler/Expression/Binary/GreaterCompiler.php
  24. +6 −2 src/TwigJs/Compiler/Expression/Binary/GreaterEqualCompiler.php
  25. +6 −2 src/TwigJs/Compiler/Expression/Binary/InCompiler.php
  26. +6 −2 src/TwigJs/Compiler/Expression/Binary/LessCompiler.php
  27. +6 −2 src/TwigJs/Compiler/Expression/Binary/LessEqualCompiler.php
  28. +6 −2 src/TwigJs/Compiler/Expression/Binary/ModCompiler.php
  29. +6 −2 src/TwigJs/Compiler/Expression/Binary/MulCompiler.php
  30. +6 −2 src/TwigJs/Compiler/Expression/Binary/NotEqualCompiler.php
  31. +6 −2 src/TwigJs/Compiler/Expression/Binary/NotInCompiler.php
  32. +6 −2 src/TwigJs/Compiler/Expression/Binary/OrCompiler.php
  33. +6 −1 src/TwigJs/Compiler/Expression/Binary/PowerCompiler.php
  34. +6 −1 src/TwigJs/Compiler/Expression/Binary/RangeCompiler.php
  35. +6 −2 src/TwigJs/Compiler/Expression/Binary/SubCompiler.php
  36. +6 −1 src/TwigJs/Compiler/Expression/BinaryCompiler.php
  37. +6 −1 src/TwigJs/Compiler/Expression/BlockReferenceCompiler.php
  38. +6 −1 src/TwigJs/Compiler/Expression/ConditionalCompiler.php
  39. +6 −1 src/TwigJs/Compiler/Expression/ConstantCompiler.php
  40. +6 −1 src/TwigJs/Compiler/Expression/DefaultFilterCompiler.php
  41. +6 −1 src/TwigJs/Compiler/Expression/ExtensionReferenceCompiler.php
  42. +6 −1 src/TwigJs/Compiler/Expression/Filter/DefaultCompiler.php
  43. +7 −2 src/TwigJs/Compiler/Expression/FilterCompiler.php
  44. +13 −2 src/TwigJs/Compiler/Expression/FunctionCompiler.php
  45. +8 −3 src/TwigJs/Compiler/Expression/GetAttrCompiler.php
  46. +10 −4 src/TwigJs/Compiler/Expression/MacroCallCompiler.php
  47. +6 −1 src/TwigJs/Compiler/Expression/MethodCallCompiler.php
  48. +12 −2 src/TwigJs/Compiler/Expression/NameCompiler.php
  49. +6 −1 src/TwigJs/Compiler/Expression/ParentCompiler.php
  50. +6 −1 src/TwigJs/Compiler/Expression/TempNameCompiler.php
  51. +14 −2 src/TwigJs/Compiler/Expression/Test/ConstantCompiler.php
  52. +14 −2 src/TwigJs/Compiler/Expression/Test/DefinedCompiler.php
  53. +14 −2 src/TwigJs/Compiler/Expression/Test/DivisiblebyCompiler.php
  54. +14 −2 src/TwigJs/Compiler/Expression/Test/EvenCompiler.php
  55. +14 −2 src/TwigJs/Compiler/Expression/Test/NullCompiler.php
  56. +14 −2 src/TwigJs/Compiler/Expression/Test/OddCompiler.php
  57. +14 −2 src/TwigJs/Compiler/Expression/Test/SameasCompiler.php
  58. +7 −2 src/TwigJs/Compiler/Expression/TestCompiler.php
  59. +6 −2 src/TwigJs/Compiler/Expression/Unary/NegCompiler.php
  60. +6 −2 src/TwigJs/Compiler/Expression/Unary/NotCompiler.php
  61. +6 −2 src/TwigJs/Compiler/Expression/Unary/PosCompiler.php
  62. +6 −1 src/TwigJs/Compiler/Expression/UnaryCompiler.php
  63. +1 −2  src/TwigJs/Compiler/ExpressionCompiler.php
  64. +6 −1 src/TwigJs/Compiler/ExtensionReferenceCompiler.php
  65. +7 −2 src/TwigJs/Compiler/FlushCompiler.php
  66. +6 −1 src/TwigJs/Compiler/ForCompiler.php
  67. +6 −1 src/TwigJs/Compiler/ForLoopCompiler.php
  68. +9 −2 src/TwigJs/Compiler/ImportCompiler.php
  69. +6 −1 src/TwigJs/Compiler/IncludeCompiler.php
  70. +6 −1 src/TwigJs/Compiler/MacroCompiler.php
  71. +17 −5 src/TwigJs/Compiler/ModuleCompiler.php
  72. +6 −2 src/TwigJs/Compiler/ModuleCompiler/SandboxedGoogleCompiler.php
  73. +1 −1  src/TwigJs/Compiler/NodeCompiler.php
  74. +6 −1 src/TwigJs/Compiler/PrintCompiler.php
  75. +6 −1 src/TwigJs/Compiler/SandboxCompiler.php
  76. +6 −2 src/TwigJs/Compiler/SandboxedPrintCompiler.php
  77. +6 −1 src/TwigJs/Compiler/SetCompiler.php
  78. +6 −1 src/TwigJs/Compiler/SetTempCompiler.php
  79. +6 −1 src/TwigJs/Compiler/SpacelessCompiler.php
  80. +1 −1  src/TwigJs/Compiler/Test/DefinedCompiler.php
  81. +1 −1  src/TwigJs/Compiler/Test/DivisibleByCompiler.php
  82. +1 −1  src/TwigJs/Compiler/Test/EmptyCompiler.php
  83. +1 −1  src/TwigJs/Compiler/Test/EvenCompiler.php
  84. +1 −1  src/TwigJs/Compiler/Test/NoneCompiler.php
  85. +1 −3 src/TwigJs/Compiler/Test/NullCompiler.php
  86. +1 −1  src/TwigJs/Compiler/Test/OddCompiler.php
  87. +1 −1  src/TwigJs/Compiler/Test/SameAsCompiler.php
  88. +6 −1 src/TwigJs/Compiler/TextCompiler.php
  89. +1 −1  src/TwigJs/DefaultFunctionNamingStrategy.php
  90. +3 −3 src/TwigJs/FilterCompilerInterface.php
  91. +3 −3 src/TwigJs/FunctionNamingStrategyInterface.php
  92. +2 −3 src/TwigJs/JsCompiler.php
  93. +3 −3 src/TwigJs/TestCompilerInterface.php
  94. +1 −1  src/TwigJs/Twig/TwigJsExtension.php
  95. +1 −1  src/TwigJs/Twig/TwigJsNode.php
  96. +5 −3 src/TwigJs/Twig/TwigJsNodeVisitor.php
  97. +22 −6 src/TwigJs/Twig/TwigJsTokenParser.php
  98. +3 −3 src/TwigJs/TypeCompilerInterface.php
  99. +1 −1  tests/TwigJs/Tests/Fixture/generated/custom_name.js
  100. +1 −1  tests/TwigJs/Tests/Fixture/templates/custom_name.twig
  101. +1 −1  tests/TwigJs/Tests/Fixture/templates/custom_name_extended.twig
  102. +1 −1  tests/TwigJs/Tests/Fixture/templates/sameas.twig
  103. +1 −1  tests/TwigJs/Tests/Fixture/templates/simple_standalone.twig
  104. +5 −2 tests/TwigJs/Tests/TemplateGenerationTest.php
  105. +1 −1  tests/TwigJs/Tests/Twig/IntegrationTest.php
  106. +1 −1  tests/TwigJs/Tests/Twig/TwigJsTokenParserTest.php
  107. +0 −1  tests/bootstrap.php
View
6 Makefile
@@ -22,5 +22,9 @@ test: vendor
vendor:
composer install
-.PHONY: build clean test
+phpcs: vendor
+ ./vendor/bin/phpcs --standard=PSR2 --error-severity=1 src
+ ./vendor/bin/phpcs --standard=PSR2 --error-severity=1 tests
+
+.PHONY: build clean test phpcs
View
3  composer.json
@@ -16,7 +16,8 @@
},
"require-dev": {
- "phpunit/phpunit": "3.7.*@dev"
+ "phpunit/phpunit": "3.7.*@dev",
+ "squizlabs/php_codesniffer": "1.*"
},
"minimum-stability": "dev",
View
139 composer.lock
@@ -3,7 +3,7 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
- "hash": "f90445bbc85b4152777f376c32ea20c6",
+ "hash": "e5c73f47e23bb2a6cb5fd5912067c1fc",
"packages": [
{
"name": "twig/twig",
@@ -11,12 +11,12 @@
"source": {
"type": "git",
"url": "https://github.com/fabpot/Twig.git",
- "reference": "27f3e0fc1efd1dbaf6d10598d148d7ec3070b51d"
+ "reference": "b0ee99d6d69b30a512064c8b4fac536f862a0d23"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/fabpot/Twig/zipball/27f3e0fc1efd1dbaf6d10598d148d7ec3070b51d",
- "reference": "27f3e0fc1efd1dbaf6d10598d148d7ec3070b51d",
+ "url": "https://api.github.com/repos/fabpot/Twig/zipball/b0ee99d6d69b30a512064c8b4fac536f862a0d23",
+ "reference": "b0ee99d6d69b30a512064c8b4fac536f862a0d23",
"shasum": ""
},
"require": {
@@ -40,11 +40,19 @@
"authors": [
{
"name": "Fabien Potencier",
- "email": "fabien@symfony.com"
+ "email": "fabien@symfony.com",
+ "homepage": "http://fabien.potencier.org",
+ "role": "Lead Developer"
},
{
"name": "Armin Ronacher",
- "email": "armin.ronacher@active-4.com"
+ "email": "armin.ronacher@active-4.com",
+ "role": "Project Founder"
+ },
+ {
+ "name": "Twig Team",
+ "homepage": "https://github.com/fabpot/Twig/graphs/contributors",
+ "role": "Contributors"
}
],
"description": "Twig, the flexible, fast, and secure template language for PHP",
@@ -52,7 +60,7 @@
"keywords": [
"templating"
],
- "time": "2013-12-27 14:37:02"
+ "time": "2014-02-13 10:36:05"
}
],
"packages-dev": [
@@ -62,18 +70,18 @@
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "10c5b2c8b72a801eaad0031cd6a6a3686909c5a9"
+ "reference": "34d4ff4aa8ee0de5fcc99b5d8f14107e5deb6092"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/10c5b2c8b72a801eaad0031cd6a6a3686909c5a9",
- "reference": "10c5b2c8b72a801eaad0031cd6a6a3686909c5a9",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/34d4ff4aa8ee0de5fcc99b5d8f14107e5deb6092",
+ "reference": "34d4ff4aa8ee0de5fcc99b5d8f14107e5deb6092",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": ">=1.3.0@stable",
- "phpunit/php-text-template": ">=1.1.1@stable",
+ "phpunit/php-text-template": ">=1.2.0@stable",
"phpunit/php-token-stream": ">=1.1.3@stable"
},
"require-dev": {
@@ -115,7 +123,7 @@
"testing",
"xunit"
],
- "time": "2013-11-01 09:17:11"
+ "time": "2014-02-12 16:38:11"
},
{
"name": "phpunit/php-file-iterator",
@@ -168,12 +176,12 @@
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
- "reference": "1eeef106193d2f8c539728e566bb4793071a9e18"
+ "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/1eeef106193d2f8c539728e566bb4793071a9e18",
- "reference": "1eeef106193d2f8c539728e566bb4793071a9e18",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
+ "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
"shasum": ""
},
"require": {
@@ -204,7 +212,7 @@
"keywords": [
"template"
],
- "time": "2013-01-07 10:56:17"
+ "time": "2014-01-30 17:20:04"
},
{
"name": "phpunit/php-timer",
@@ -306,12 +314,12 @@
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "92e8faf88773fa173b0ab2425ba4ade434c58c5d"
+ "reference": "d24e9877331039582497052cc3c4d9f465b88210"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/92e8faf88773fa173b0ab2425ba4ade434c58c5d",
- "reference": "92e8faf88773fa173b0ab2425ba4ade434c58c5d",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d24e9877331039582497052cc3c4d9f465b88210",
+ "reference": "d24e9877331039582497052cc3c4d9f465b88210",
"shasum": ""
},
"require": {
@@ -372,7 +380,7 @@
"testing",
"xunit"
],
- "time": "2013-12-29 07:28:17"
+ "time": "2014-02-03 07:46:27"
},
{
"name": "phpunit/phpunit-mock-objects",
@@ -380,12 +388,12 @@
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
- "reference": "3e40f3b3f18c044a24688fe406440d7fd537744a"
+ "reference": "ed9c8ef8cecd7fa0e7dcee78970e5a972bcfd751"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3e40f3b3f18c044a24688fe406440d7fd537744a",
- "reference": "3e40f3b3f18c044a24688fe406440d7fd537744a",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ed9c8ef8cecd7fa0e7dcee78970e5a972bcfd751",
+ "reference": "ed9c8ef8cecd7fa0e7dcee78970e5a972bcfd751",
"shasum": ""
},
"require": {
@@ -393,7 +401,6 @@
"phpunit/php-text-template": ">=1.1.1@stable"
},
"require-dev": {
- "pear-pear/pear": "1.9.4",
"phpunit/phpunit": "3.7.*@dev"
},
"suggest": {
@@ -430,7 +437,77 @@
"mock",
"xunit"
],
- "time": "2013-07-23 04:42:59"
+ "time": "2014-01-30 16:40:39"
+ },
+ {
+ "name": "squizlabs/php_codesniffer",
+ "version": "1.5.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
+ "reference": "a76a39b317ce8106abe6264daa505e24e1731860"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/a76a39b317ce8106abe6264daa505e24e1731860",
+ "reference": "a76a39b317ce8106abe6264daa505e24e1731860",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "php": ">=5.1.2"
+ },
+ "suggest": {
+ "phpunit/php-timer": "dev-master"
+ },
+ "bin": [
+ "scripts/phpcs"
+ ],
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "CodeSniffer.php",
+ "CodeSniffer/CLI.php",
+ "CodeSniffer/Exception.php",
+ "CodeSniffer/File.php",
+ "CodeSniffer/Report.php",
+ "CodeSniffer/Reporting.php",
+ "CodeSniffer/Sniff.php",
+ "CodeSniffer/Tokens.php",
+ "CodeSniffer/Reports/",
+ "CodeSniffer/CommentParser/",
+ "CodeSniffer/Tokenizers/",
+ "CodeSniffer/DocGenerators/",
+ "CodeSniffer/Standards/AbstractPatternSniff.php",
+ "CodeSniffer/Standards/AbstractScopeSniff.php",
+ "CodeSniffer/Standards/AbstractVariableSniff.php",
+ "CodeSniffer/Standards/IncorrectPatternException.php",
+ "CodeSniffer/Standards/Generic/Sniffs/",
+ "CodeSniffer/Standards/MySource/Sniffs/",
+ "CodeSniffer/Standards/PEAR/Sniffs/",
+ "CodeSniffer/Standards/PSR1/Sniffs/",
+ "CodeSniffer/Standards/PSR2/Sniffs/",
+ "CodeSniffer/Standards/Squiz/Sniffs/",
+ "CodeSniffer/Standards/Zend/Sniffs/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Greg Sherwood",
+ "role": "lead"
+ }
+ ],
+ "description": "PHP_CodeSniffer tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
+ "homepage": "http://www.squizlabs.com/php-codesniffer",
+ "keywords": [
+ "phpcs",
+ "standards"
+ ],
+ "time": "2014-02-04 23:49:58"
},
{
"name": "symfony/yaml",
@@ -439,12 +516,12 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
- "reference": "c2e065720708d6db30dfba1278b8f53c45dd9fe0"
+ "reference": "9921872611710df49cf035c259e5a461ea2d0f8c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Yaml/zipball/c2e065720708d6db30dfba1278b8f53c45dd9fe0",
- "reference": "c2e065720708d6db30dfba1278b8f53c45dd9fe0",
+ "url": "https://api.github.com/repos/symfony/Yaml/zipball/9921872611710df49cf035c259e5a461ea2d0f8c",
+ "reference": "9921872611710df49cf035c259e5a461ea2d0f8c",
"shasum": ""
},
"require": {
@@ -468,7 +545,9 @@
"authors": [
{
"name": "Fabien Potencier",
- "email": "fabien@symfony.com"
+ "email": "fabien@symfony.com",
+ "homepage": "http://fabien.potencier.org",
+ "role": "Lead Developer"
},
{
"name": "Symfony Community",
@@ -477,7 +556,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
- "time": "2013-12-28 08:12:58"
+ "time": "2014-01-07 13:29:57"
}
],
"aliases": [
View
2  src/TwigJs/Assetic/TwigJsFilter.php
@@ -54,4 +54,4 @@ public function hash()
{
return 'twigjsfilter';
}
-}
+}
View
2  src/TwigJs/CompileRequest.php
@@ -49,4 +49,4 @@ public function getDefines()
{
return $this->defines;
}
-}
+}
View
2  src/TwigJs/CompileRequestHandler.php
@@ -50,4 +50,4 @@ public function process(CompileRequest $request)
throw $ex;
}
}
-}
+}
View
4 src/TwigJs/Compiler/AutoEscapeCompiler.php
@@ -31,7 +31,9 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_AutoEscape) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \AutoEscape, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf('$node must be an instanceof of \AutoEscape, but got "%s".', get_class($node))
+ );
}
$compiler->subcompile($node->getNode('body'));
View
4 src/TwigJs/Compiler/BlockCompiler.php
@@ -31,7 +31,9 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Block) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Block, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf('$node must be an instanceof of \Block, but got "%s".', get_class($node))
+ );
}
$compiler
View
8 src/TwigJs/Compiler/BlockReferenceCompiler.php
@@ -31,12 +31,16 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_BlockReference) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_BlockReference, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf('$node must be an instanceof of \Twig_Node_BlockReference, but got "%s".', get_class($node))
+ );
}
$compiler
->addDebugInfo($node)
- ->write(sprintf("sb.append(this.renderBlock(%s, context, blocks));\n", json_encode($node->getAttribute('name'))))
+ ->write(
+ sprintf("sb.append(this.renderBlock(%s, context, blocks));\n", json_encode($node->getAttribute('name')))
+ )
;
}
}
View
7 src/TwigJs/Compiler/BodyCompiler.php
@@ -19,7 +19,6 @@
namespace TwigJs\Compiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class BodyCompiler extends NodeCompiler
{
@@ -31,9 +30,11 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Body) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Body, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf('$node must be an instanceof of \Twig_Node_Body, but got "%s".', get_class($node))
+ );
}
return parent::compile($compiler, $node);
}
-}
+}
View
4 src/TwigJs/Compiler/DoCompiler.php
@@ -15,7 +15,9 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Do) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Do, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf('$node must be an instanceof of \Twig_Node_Do, but got "%s".', get_class($node))
+ );
}
$compiler
View
10 src/TwigJs/Compiler/Expression/ArrayCompiler.php
@@ -31,7 +31,9 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Array) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Expression_Array, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf('$node must be an instanceof of \Expression_Array, but got "%s".', get_class($node))
+ );
}
@@ -39,7 +41,7 @@ public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
if ($isList = $this->isList($pairs)) {
$compiler->raw('[');
- } else if ($hasDynamicKeys = $this->hasDynamicKeys($pairs)) {
+ } elseif ($hasDynamicKeys = $this->hasDynamicKeys($pairs)) {
$compiler->raw('twig.createObj(');
} else {
$compiler->raw('{');
@@ -54,7 +56,7 @@ public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
if ($isList) {
$compiler->subcompile($pair['value']);
- } else if ($hasDynamicKeys) {
+ } elseif ($hasDynamicKeys) {
$compiler
->subcompile($pair['key'])
->raw(', ')
@@ -71,7 +73,7 @@ public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
if ($isList) {
$compiler->raw(']');
- } else if ($hasDynamicKeys) {
+ } elseif ($hasDynamicKeys) {
$compiler->raw(')');
} else {
$compiler->raw('}');
View
4 src/TwigJs/Compiler/Expression/AssignNameCompiler.php
@@ -31,7 +31,9 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_AssignName) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Expression_AssignName, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf('$node must be an instanceof of \Expression_AssignName, but got "%s".', get_class($node))
+ );
}
$compiler
View
6 src/TwigJs/Compiler/Expression/Binary/AddCompiler.php
@@ -30,8 +30,10 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
- if ( ! $node instanceof \Twig_Node_Expression_Binary) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary, but got "%s".', get_class($node)));
+ if (!$node instanceof \Twig_Node_Expression_Binary) {
+ throw new \RuntimeException(
+ sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary, but got "%s".', get_class($node))
+ );
}
$compiler
View
8 src/TwigJs/Compiler/Expression/Binary/AndCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class AndCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_And) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_And, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_And, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('&&');
View
8 src/TwigJs/Compiler/Expression/Binary/BitwiseAndCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class BitwiseAndCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_BitwiseAnd) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_BitwiseAnd, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_BitwiseAnd, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('&');
View
8 src/TwigJs/Compiler/Expression/Binary/BitwiseOrCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class BitwiseOrCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_BitwiseOr) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_BitwiseOr, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_BitwiseOr, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('|');
View
8 src/TwigJs/Compiler/Expression/Binary/BitwiseXorCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class BitwiseXorCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_BitwiseXor) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_BitwiseXor, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_BitwiseXor, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('^');
View
8 src/TwigJs/Compiler/Expression/Binary/ConcatCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class ConcatCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_Concat) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_Concat, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_Concat, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('+');
View
8 src/TwigJs/Compiler/Expression/Binary/DivCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class DivCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_Div) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_Div, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_Div, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('/');
View
8 src/TwigJs/Compiler/Expression/Binary/EqualCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class EqualCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_Equal) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_Equal, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_Equal, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('==');
View
8 src/TwigJs/Compiler/Expression/Binary/FloorDivCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class FloorDivCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_FloorDiv) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_FloorDiv, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_FloorDiv, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler->raw('Math.floor(');
View
8 src/TwigJs/Compiler/Expression/Binary/GreaterCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class GreaterCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_Greater) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_Greater, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_Greater, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('>');
View
8 src/TwigJs/Compiler/Expression/Binary/GreaterEqualCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class GreaterEqualCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_GreaterEqual) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_GreaterEqual, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_GreaterEqual, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('>=');
View
8 src/TwigJs/Compiler/Expression/Binary/InCompiler.php
@@ -18,7 +18,6 @@
namespace TwigJs\Compiler\Expression\Binary;
-use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
use TwigJs\TypeCompilerInterface;
@@ -32,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_In) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_In, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_In, but got "%s".',
+ get_class($node)
+ )
+ );
}
// order left,right is reversed in JsCompiler compared to Twig_Compiler
View
8 src/TwigJs/Compiler/Expression/Binary/LessCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class LessCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_Less) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_Less, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_Less, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('<');
View
8 src/TwigJs/Compiler/Expression/Binary/LessEqualCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class LessEqualCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_LessEqual) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_LessEqual, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_LessEqual, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('<=');
View
8 src/TwigJs/Compiler/Expression/Binary/ModCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class ModCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_Mod) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_Mod, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_Mod, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('%');
View
8 src/TwigJs/Compiler/Expression/Binary/MulCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class MulCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_Mul) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_Mul, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_Mul, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('*');
View
8 src/TwigJs/Compiler/Expression/Binary/NotEqualCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class NotEqualCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_NotEqual) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_NotEqual, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_NotEqual, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('!=');
View
8 src/TwigJs/Compiler/Expression/Binary/NotInCompiler.php
@@ -18,7 +18,6 @@
namespace TwigJs\Compiler\Expression\Binary;
-use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
use TwigJs\TypeCompilerInterface;
@@ -32,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_NotIn) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_NotIn, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_NotIn, but got "%s".',
+ get_class($node)
+ )
+ );
}
// order of arguments is reversed, see the InCompiler
View
8 src/TwigJs/Compiler/Expression/Binary/OrCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class OrCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_Or) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_Or, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_Or, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('||');
View
7 src/TwigJs/Compiler/Expression/Binary/PowerCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_Power) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_Power, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_Power, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler
View
7 src/TwigJs/Compiler/Expression/Binary/RangeCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_Range) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_Range, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_Range, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler
View
8 src/TwigJs/Compiler/Expression/Binary/SubCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\BinaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class SubCompiler extends BinaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary_Sub) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary_Sub, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary_Sub, but got "%s".',
+ get_class($node)
+ )
+ );
}
return $compiler->raw('-');
View
7 src/TwigJs/Compiler/Expression/BinaryCompiler.php
@@ -26,7 +26,12 @@
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Binary) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Binary, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Binary, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler
View
7 src/TwigJs/Compiler/Expression/BlockReferenceCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_BlockReference) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_BlockReference, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_BlockReference, but got "%s".',
+ get_class($node)
+ )
+ );
}
if ($node->getAttribute('as_string')) {
View
7 src/TwigJs/Compiler/Expression/ConditionalCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Conditional) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Expression_Conditional, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Expression_Conditional, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler
View
7 src/TwigJs/Compiler/Expression/ConstantCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Constant) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Expression_Constant, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Expression_Constant, but got "%s".',
+ get_class($node)
+ )
+ );
}
if ($compiler->isTemplateName) {
View
7 src/TwigJs/Compiler/Expression/DefaultFilterCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_DefaultFilter) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_DefaultFilter, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_DefaultFilter, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler->subcompile($node->getNode('node'));
View
7 src/TwigJs/Compiler/Expression/ExtensionReferenceCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_ExtensionReference) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_ExtensionReference, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_ExtensionReference, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler
View
7 src/TwigJs/Compiler/Expression/Filter/DefaultCompiler.php
@@ -15,7 +15,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Filter_Default) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Filter_Default, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Filter_Default, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler->subcompile($node->getNode('node'));
View
9 src/TwigJs/Compiler/Expression/FilterCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Filter) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Filter, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Filter, but got "%s".',
+ get_class($node)
+ )
+ );
}
$name = $node->getNode('filter')->getAttribute('value');
@@ -42,7 +47,7 @@ public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
if (($filterCompiler = $compiler->getFilterCompiler($name))
&& false !== $filterCompiler->compile($compiler, $node)) {
return;
- } else if ($functionName = $compiler->getFilterFunction($name)) {
+ } elseif ($functionName = $compiler->getFilterFunction($name)) {
$compiler->raw($functionName.'(');
} else {
$compiler
View
15 src/TwigJs/Compiler/Expression/FunctionCompiler.php
@@ -31,12 +31,23 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Function) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Expression_Function, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Expression_Function, but got "%s".',
+ get_class($node)
+ )
+ );
}
$function = $compiler->getEnvironment()->getFunction($node->getAttribute('name'));
if (false === $function) {
- throw new \Twig_Error_Syntax(sprintf('The function "%s" does not exist', $node->getAttribute('name')), $node->getLine());
+ throw new \Twig_Error_Syntax(
+ sprintf(
+ 'The function "%s" does not exist',
+ $node->getAttribute('name')
+ ),
+ $node->getLine()
+ );
}
if ($jsFunction = $compiler->getJsFunction($node->getAttribute('name'))) {
View
11 src/TwigJs/Compiler/Expression/GetAttrCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_GetAttr) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Expression_GetAttr, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Expression_GetAttr, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler->raw('twig.attr(');
@@ -72,13 +77,13 @@ public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
}
$compiler->raw(']');
- } else if (!$defaultAccess || !$defaultTest) {
+ } elseif (!$defaultAccess || !$defaultTest) {
$compiler->raw(', undefined');
}
if (!$defaultAccess) {
$compiler->raw(', ')->repr($node->getAttribute('type'));
- } else if (!$defaultTest) {
+ } elseif (!$defaultTest) {
$compiler->raw(', undefined');
}
View
14 src/TwigJs/Compiler/Expression/MacroCallCompiler.php
@@ -14,12 +14,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
- if ( ! $node instanceof \Twig_Node_Expression_MacroCall) {
+ if (! $node instanceof \Twig_Node_Expression_MacroCall) {
throw new \LogicException(sprintf('This compiler does not support the type "%s".', get_class($node)));
}
$argsNode = $node->getNode('arguments');
- if ( ! $argsNode instanceof \Twig_Node_Expression_Array) {
+ if (! $argsNode instanceof \Twig_Node_Expression_Array) {
throw new \LogicException('Did not find args node.');
}
@@ -32,7 +32,13 @@ public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
$namedCount++;
$namedNames[$name] = 1;
} elseif ($namedCount > 0) {
- throw new \Twig_Error_Syntax(sprintf('Positional arguments cannot be used after named arguments for macro "%s".', $node->getAttribute('name')), $node->getLine());
+ throw new \Twig_Error_Syntax(
+ sprintf(
+ 'Positional arguments cannot be used after named arguments for macro "%s".',
+ $node->getAttribute('name')
+ ),
+ $node->getLine()
+ );
} else {
$positionalCount++;
}
@@ -57,4 +63,4 @@ public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
->raw(')')
;
}
-}
+}
View
7 src/TwigJs/Compiler/Expression/MethodCallCompiler.php
@@ -15,7 +15,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_MethodCall) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_MethodCall, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_MethodCall, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler
View
14 src/TwigJs/Compiler/Expression/NameCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Name) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Expression_Name, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Expression_Name, but got "%s".',
+ get_class($node)
+ )
+ );
}
$name = $node->getAttribute('name');
@@ -50,7 +55,12 @@ public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
);
if (!isset($specialVars[$name])) {
- throw new \RuntimeException(sprintf('The special var "%s" is not supported by the NameCompiler.', $name));
+ throw new \RuntimeException(
+ sprintf(
+ 'The special var "%s" is not supported by the NameCompiler.',
+ $name
+ )
+ );
}
$compiler->raw($specialVars[$name]);
View
7 src/TwigJs/Compiler/Expression/ParentCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Parent) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Parent, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Parent, but got "%s".',
+ get_class($node)
+ )
+ );
}
if ($output = $node->getAttribute('output')) {
View
7 src/TwigJs/Compiler/Expression/TempNameCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_TempName) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_TempName, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_TempName, but got "%s".',
+ get_class($node)
+ )
+ );
}
View
16 src/TwigJs/Compiler/Expression/Test/ConstantCompiler.php
@@ -15,9 +15,21 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Test_Constant) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Test_Constant, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Test_Constant, but got "%s".',
+ get_class($node)
+ )
+ );
}
- $compiler->subcompile(new \Twig_Node_Expression_Test($node->getNode('node'), $node->getAttribute('name'), $node->getNode('arguments'), $node->getLine()));
+ $compiler->subcompile(
+ new \Twig_Node_Expression_Test(
+ $node->getNode('node'),
+ $node->getAttribute('name'),
+ $node->getNode('arguments'),
+ $node->getLine()
+ )
+ );
}
}
View
16 src/TwigJs/Compiler/Expression/Test/DefinedCompiler.php
@@ -15,9 +15,21 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Test_Defined) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Test_Defined, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Test_Defined, but got "%s".',
+ get_class($node)
+ )
+ );
}
- $compiler->subcompile(new \Twig_Node_Expression_Test($node->getNode('node'), $node->getAttribute('name'), $node->getNode('arguments'), $node->getLine()));
+ $compiler->subcompile(
+ new \Twig_Node_Expression_Test(
+ $node->getNode('node'),
+ $node->getAttribute('name'),
+ $node->getNode('arguments'),
+ $node->getLine()
+ )
+ );
}
}
View
16 src/TwigJs/Compiler/Expression/Test/DivisiblebyCompiler.php
@@ -15,9 +15,21 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Test_Divisibleby) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Test_Divisibleby, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Test_Divisibleby, but got "%s".',
+ get_class($node)
+ )
+ );
}
- $compiler->subcompile(new \Twig_Node_Expression_Test($node->getNode('node'), $node->getAttribute('name'), $node->getNode('arguments'), $node->getLine()));
+ $compiler->subcompile(
+ new \Twig_Node_Expression_Test(
+ $node->getNode('node'),
+ $node->getAttribute('name'),
+ $node->getNode('arguments'),
+ $node->getLine()
+ )
+ );
}
}
View
16 src/TwigJs/Compiler/Expression/Test/EvenCompiler.php
@@ -15,9 +15,21 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Test_Even) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Test_Even, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Test_Even, but got "%s".',
+ get_class($node)
+ )
+ );
}
- $compiler->subcompile(new \Twig_Node_Expression_Test($node->getNode('node'), $node->getAttribute('name'), $node->getNode('arguments'), $node->getLine()));
+ $compiler->subcompile(
+ new \Twig_Node_Expression_Test(
+ $node->getNode('node'),
+ $node->getAttribute('name'),
+ $node->getNode('arguments'),
+ $node->getLine()
+ )
+ );
}
}
View
16 src/TwigJs/Compiler/Expression/Test/NullCompiler.php
@@ -15,9 +15,21 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Test_Null) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Test_Null, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Test_Null, but got "%s".',
+ get_class($node)
+ )
+ );
}
- $compiler->subcompile(new \Twig_Node_Expression_Test($node->getNode('node'), $node->getAttribute('name'), $node->getNode('arguments'), $node->getLine()));
+ $compiler->subcompile(
+ new \Twig_Node_Expression_Test(
+ $node->getNode('node'),
+ $node->getAttribute('name'),
+ $node->getNode('arguments'),
+ $node->getLine()
+ )
+ );
}
}
View
16 src/TwigJs/Compiler/Expression/Test/OddCompiler.php
@@ -15,9 +15,21 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Test_Odd) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Test_Odd, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Test_Odd, but got "%s".',
+ get_class($node)
+ )
+ );
}
- $compiler->subcompile(new \Twig_Node_Expression_Test($node->getNode('node'), $node->getAttribute('name'), $node->getNode('arguments'), $node->getLine()));
+ $compiler->subcompile(
+ new \Twig_Node_Expression_Test(
+ $node->getNode('node'),
+ $node->getAttribute('name'),
+ $node->getNode('arguments'),
+ $node->getLine()
+ )
+ );
}
}
View
16 src/TwigJs/Compiler/Expression/Test/SameasCompiler.php
@@ -15,9 +15,21 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Test_Sameas) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Test_Sameas, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Test_Sameas, but got "%s".',
+ get_class($node)
+ )
+ );
}
- $compiler->subcompile(new \Twig_Node_Expression_Test($node->getNode('node'), $node->getAttribute('name'), $node->getNode('arguments'), $node->getLine()));
+ $compiler->subcompile(
+ new \Twig_Node_Expression_Test(
+ $node->getNode('node'),
+ $node->getAttribute('name'),
+ $node->getNode('arguments'),
+ $node->getLine()
+ )
+ );
}
}
View
9 src/TwigJs/Compiler/Expression/TestCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Test) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Expression_Test, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Expression_Test, but got "%s".',
+ get_class($node)
+ )
+ );
}
$name = $node->getAttribute('name');
@@ -66,4 +71,4 @@ public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
$compiler->raw(')');
}
-}
+}
View
8 src/TwigJs/Compiler/Expression/Unary/NegCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\UnaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class NegCompiler extends UnaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Unary_Neg) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Expression_Unary_Neg, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Expression_Unary_Neg, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler->raw('-');
View
8 src/TwigJs/Compiler/Expression/Unary/NotCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\UnaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class NotCompiler extends UnaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Unary_Not) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Unary_Not, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Unary_Not, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler->raw('!');
View
8 src/TwigJs/Compiler/Expression/Unary/PosCompiler.php
@@ -20,7 +20,6 @@
use TwigJs\Compiler\Expression\UnaryCompiler;
use TwigJs\JsCompiler;
-use TwigJs\TypeCompilerInterface;
class PosCompiler extends UnaryCompiler
{
@@ -32,7 +31,12 @@ public function getType()
protected function operator(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Unary_Pos) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Expression_Unary_Pos, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Expression_Unary_Pos, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler->raw('+');
View
7 src/TwigJs/Compiler/Expression/UnaryCompiler.php
@@ -26,7 +26,12 @@
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Expression_Unary) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Expression_Unary, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Expression_Unary, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler->raw('(');
View
3  src/TwigJs/Compiler/ExpressionCompiler.php
@@ -18,9 +18,8 @@
namespace TwigJs\Compiler;
-use TwigJs\JsCompiler;
use TwigJs\TypeCompilerInterface;
abstract class ExpressionCompiler implements TypeCompilerInterface
{
-}
+}
View
7 src/TwigJs/Compiler/ExtensionReferenceCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_ExtensionReference) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_ExtensionReference, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_ExtensionReference, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler
View
9 src/TwigJs/Compiler/FlushCompiler.php
@@ -15,9 +15,14 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Flush) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Flush, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Flush, but got "%s".',
+ get_class($node)
+ )
+ );
}
-
+
throw new \LogicException('Flushing is not supported in Javascript templates.');
}
}
View
7 src/TwigJs/Compiler/ForCompiler.php
@@ -33,7 +33,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_For) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \For, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \For, but got "%s".',
+ get_class($node)
+ )
+ );
}
$count = $this->count++;
View
7 src/TwigJs/Compiler/ForLoopCompiler.php
@@ -15,7 +15,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_ForLoop) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_ForLoop, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_ForLoop, but got "%s".',
+ get_class($node)
+ )
+ );
}
if ($node->getAttribute('else')) {
View
11 src/TwigJs/Compiler/ImportCompiler.php
@@ -31,7 +31,12 @@ public function getType()
public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
{
if (!$node instanceof \Twig_Node_Import) {
- throw new \RuntimeException(sprintf('$node must be an instanceof of \Twig_Node_Import, but got "%s".', get_class($node)));
+ throw new \RuntimeException(
+ sprintf(
+ '$node must be an instanceof of \Twig_Node_Import, but got "%s".',
+ get_class($node)
+ )
+ );
}
$compiler
@@ -41,7 +46,9 @@ public function compile(JsCompiler $compiler, \Twig_NodeInterface $node)
->raw(' = ')