gulp-phug 1.3.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/README.md +26 -0
  2. package/index.js +38 -10
  3. package/package.json +4 -4
  4. package/support/bootstrap.php +6 -0
  5. package/support/composer.json +1 -1
  6. package/support/composer.lock +94 -179
  7. package/support/vendor/autoload.php +15 -0
  8. package/support/vendor/bin/phug +119 -0
  9. package/support/vendor/bin/var-dump-server +119 -0
  10. package/support/vendor/composer/ClassLoader.php +166 -32
  11. package/support/vendor/composer/InstalledVersions.php +387 -329
  12. package/support/vendor/composer/autoload_classmap.php +1 -5
  13. package/support/vendor/composer/autoload_files.php +2 -3
  14. package/support/vendor/composer/autoload_namespaces.php +1 -1
  15. package/support/vendor/composer/autoload_psr4.php +3 -4
  16. package/support/vendor/composer/autoload_real.php +12 -37
  17. package/support/vendor/composer/autoload_static.php +6 -17
  18. package/support/vendor/composer/installed.json +99 -186
  19. package/support/vendor/composer/installed.php +129 -151
  20. package/support/vendor/composer/platform_check.php +15 -4
  21. package/support/vendor/phug/phug/.github/workflows/coverage.yml +61 -0
  22. package/support/vendor/phug/phug/.github/workflows/multi-tester.yml +48 -0
  23. package/support/vendor/phug/phug/.github/workflows/split.yml +41 -0
  24. package/support/vendor/phug/phug/.github/workflows/style.yml +48 -0
  25. package/support/vendor/phug/phug/.github/workflows/tests.yml +48 -0
  26. package/support/vendor/phug/phug/.multi-tester.yml +47 -17
  27. package/support/vendor/phug/phug/composer.json +27 -18
  28. package/support/vendor/phug/phug/phpcs.xml +4 -0
  29. package/support/vendor/phug/phug/phpunit.xml +2 -0
  30. package/support/vendor/phug/phug/phug +1 -1
  31. package/support/vendor/phug/phug/release.php +8 -0
  32. package/support/vendor/phug/phug/src/Phug/Ast/Ast/Node.php +9 -3
  33. package/support/vendor/phug/phug/src/Phug/Ast/composer.json +2 -3
  34. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/AbstractNodeCompiler.php +4 -4
  35. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/Element/BlockElement.php +4 -4
  36. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/AssignmentListNodeCompiler.php +1 -1
  37. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/AssignmentNodeCompiler.php +10 -2
  38. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/AttributeListNodeCompiler.php +1 -1
  39. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/AttributeNodeCompiler.php +2 -1
  40. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/BlockNodeCompiler.php +3 -3
  41. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/CaseNodeCompiler.php +1 -1
  42. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/CodeNodeCompiler.php +2 -2
  43. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/CommentNodeCompiler.php +1 -1
  44. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/ConditionalNodeCompiler.php +1 -1
  45. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/DoNodeCompiler.php +1 -1
  46. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/DoctypeNodeCompiler.php +1 -1
  47. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/DocumentNodeCompiler.php +1 -1
  48. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/EachNodeCompiler.php +1 -1
  49. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/ElementNodeCompiler.php +7 -1
  50. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/ExpressionNodeCompiler.php +1 -1
  51. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/FilterNodeCompiler.php +1 -1
  52. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/ForNodeCompiler.php +1 -1
  53. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/ImportNodeCompiler.php +5 -5
  54. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/KeywordNodeCompiler.php +1 -1
  55. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/MixinCallNodeCompiler.php +1 -1
  56. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/MixinNodeCompiler.php +1 -1
  57. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/TextNodeCompiler.php +1 -1
  58. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/VariableNodeCompiler.php +1 -1
  59. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/WhenNodeCompiler.php +1 -1
  60. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/WhileNodeCompiler.php +1 -1
  61. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/YieldNodeCompiler.php +1 -1
  62. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompilerInterface.php +5 -5
  63. package/support/vendor/phug/phug/src/Phug/Compiler/Compiler.php +2 -2
  64. package/support/vendor/phug/phug/src/Phug/Compiler/CompilerInterface.php +2 -2
  65. package/support/vendor/phug/phug/src/Phug/Compiler/composer.json +10 -7
  66. package/support/vendor/phug/phug/src/Phug/DependencyInjection/DependencyInjection.php +1 -1
  67. package/support/vendor/phug/phug/src/Phug/DependencyInjection/composer.json +3 -4
  68. package/support/vendor/phug/phug/src/Phug/Event/Event/ListenerQueue.php +3 -0
  69. package/support/vendor/phug/phug/src/Phug/Event/EventManagerTrait.php +1 -1
  70. package/support/vendor/phug/phug/src/Phug/Event/composer.json +2 -3
  71. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/AbstractElement.php +1 -1
  72. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/AbstractFormat.php +17 -14
  73. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/AssignmentContainerInterface.php +2 -1
  74. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/AbstractAssignmentContainerElement.php +11 -1
  75. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/AbstractMarkupElement.php +1 -1
  76. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/AbstractValueElement.php +3 -3
  77. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/AnonymousBlockElement.php +1 -1
  78. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/AssignmentElement.php +13 -8
  79. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/AttributeElement.php +7 -4
  80. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/CodeElement.php +5 -5
  81. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/KeywordElement.php +3 -3
  82. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/MarkupElement.php +13 -11
  83. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/MixinCallElement.php +2 -1
  84. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/MixinElement.php +2 -1
  85. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/VariableElement.php +5 -5
  86. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Event/FormatEvent.php +1 -1
  87. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Format/HtmlFormat.php +1 -1
  88. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Format/XhtmlFormat.php +1 -1
  89. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Format/XmlFormat.php +214 -21
  90. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/FormatInterface.php +1 -1
  91. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Partial/AssignmentHelpersTrait.php +7 -4
  92. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Partial/HandleVariable.php +4 -4
  93. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Partial/MagicAccessorTrait.php +1 -7
  94. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Partial/PatternTrait.php +1 -1
  95. package/support/vendor/phug/phug/src/Phug/Formatter/Formatter.php +1 -1
  96. package/support/vendor/phug/phug/src/Phug/Formatter/composer.json +5 -6
  97. package/support/vendor/phug/phug/src/Phug/Invoker/Invoker.php +1 -1
  98. package/support/vendor/phug/phug/src/Phug/Invoker/composer.json +9 -6
  99. package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/AbstractToken.php +1 -1
  100. package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Partial/IndentStyleTrait.php +5 -5
  101. package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/AssignmentScanner.php +8 -2
  102. package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/AttributeScanner.php +24 -12
  103. package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/ConditionalScanner.php +1 -1
  104. package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/FilterScanner.php +6 -10
  105. package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/IndentationScanner.php +2 -2
  106. package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/KeywordScanner.php +1 -1
  107. package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/MultilineScanner.php +6 -12
  108. package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/Partial/TrailingOutdentHandlerTrait.php +26 -0
  109. package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/TextScanner.php +3 -3
  110. package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/State.php +9 -9
  111. package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/TokenInterface.php +1 -1
  112. package/support/vendor/phug/phug/src/Phug/Lexer/composer.json +4 -5
  113. package/support/vendor/phug/phug/src/Phug/Parser/Parser/Event/NodeEvent.php +3 -2
  114. package/support/vendor/phug/phug/src/Phug/Parser/Parser/Node/AssignmentNode.php +5 -1
  115. package/support/vendor/phug/phug/src/Phug/Parser/Parser/Node/AttributeNode.php +4 -1
  116. package/support/vendor/phug/phug/src/Phug/Parser/Parser/Node/ElementNode.php +5 -1
  117. package/support/vendor/phug/phug/src/Phug/Parser/Parser/Node/FilterNode.php +2 -1
  118. package/support/vendor/phug/phug/src/Phug/Parser/Parser/Node/MixinCallNode.php +5 -1
  119. package/support/vendor/phug/phug/src/Phug/Parser/Parser/Node/MixinNode.php +5 -1
  120. package/support/vendor/phug/phug/src/Phug/Parser/Parser/Node.php +5 -5
  121. package/support/vendor/phug/phug/src/Phug/Parser/Parser/State.php +4 -4
  122. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/AbstractTokenHandler.php +87 -0
  123. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/AssignmentTokenHandler.php +6 -21
  124. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/AttributeEndTokenHandler.php +5 -10
  125. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/AttributeStartTokenHandler.php +7 -23
  126. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/AttributeTokenHandler.php +21 -19
  127. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/AutoCloseTokenHandler.php +5 -17
  128. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/BlockTokenHandler.php +4 -10
  129. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/CaseTokenHandler.php +4 -10
  130. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/ClassTokenHandler.php +7 -34
  131. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/CodeTokenHandler.php +4 -10
  132. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/CommentTokenHandler.php +4 -10
  133. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/ConditionalTokenHandler.php +4 -10
  134. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/DoTokenHandler.php +4 -10
  135. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/DoctypeTokenHandler.php +4 -10
  136. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/EachTokenHandler.php +4 -10
  137. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/ExpansionTokenHandler.php +5 -11
  138. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/ExpressionTokenHandler.php +4 -10
  139. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/FilterTokenHandler.php +4 -10
  140. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/ForTokenHandler.php +4 -10
  141. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/IdTokenHandler.php +7 -33
  142. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/ImportTokenHandler.php +14 -20
  143. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/IndentTokenHandler.php +4 -10
  144. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/InterpolationEndTokenHandler.php +4 -10
  145. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/InterpolationStartTokenHandler.php +29 -30
  146. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/KeywordTokenHandler.php +4 -10
  147. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/MixinCallTokenHandler.php +4 -10
  148. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/MixinTokenHandler.php +4 -10
  149. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/NewLineTokenHandler.php +4 -10
  150. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/OutdentTokenHandler.php +4 -10
  151. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/Partial/StaticAttributeTrait.php +36 -0
  152. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/TagInterpolationEndTokenHandler.php +4 -10
  153. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/TagInterpolationStartTokenHandler.php +7 -10
  154. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/TagTokenHandler.php +6 -21
  155. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/TextTokenHandler.php +4 -10
  156. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/VariableTokenHandler.php +4 -10
  157. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/WhenTokenHandler.php +4 -10
  158. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/WhileTokenHandler.php +4 -10
  159. package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/YieldTokenHandler.php +4 -10
  160. package/support/vendor/phug/phug/src/Phug/Parser/Parser.php +1 -1
  161. package/support/vendor/phug/phug/src/Phug/Parser/ParserException.php +1 -1
  162. package/support/vendor/phug/phug/src/Phug/Parser/composer.json +5 -6
  163. package/support/vendor/phug/phug/src/Phug/Phug/Phug/Cli.php +5 -5
  164. package/support/vendor/phug/phug/src/Phug/Phug/Phug/Partial/ExtensionsTrait.php +1 -1
  165. package/support/vendor/phug/phug/src/Phug/Phug/Phug/Partial/FacadeOptionsTrait.php +1 -1
  166. package/support/vendor/phug/phug/src/Phug/Phug/Phug/Partial/PluginEnablerTrait.php +1 -1
  167. package/support/vendor/phug/phug/src/Phug/Phug/Phug/Phug.php +14 -5
  168. package/support/vendor/phug/phug/src/Phug/Phug/composer.json +9 -6
  169. package/support/vendor/phug/phug/src/Phug/Reader/Reader.php +13 -13
  170. package/support/vendor/phug/phug/src/Phug/Reader/composer.json +6 -2
  171. package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Adapter/FileAdapter.php +21 -4
  172. package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Adapter/Stream/Template.php +5 -0
  173. package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Adapter/StreamAdapter.php +1 -1
  174. package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/CacheInterface.php +1 -1
  175. package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Partial/AdapterTrait.php +1 -1
  176. package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Partial/Debug/DebuggerTrait.php +56 -10
  177. package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Partial/RendererOptionsTrait.php +1 -1
  178. package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Profiler/Dump.php +1 -1
  179. package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Profiler/LinkDump.php +2 -2
  180. package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Profiler/ProfilerModule.php +1 -1
  181. package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Task/TasksGroup.php +1 -1
  182. package/support/vendor/phug/phug/src/Phug/Renderer/composer.json +10 -6
  183. package/support/vendor/phug/phug/src/Phug/Util/CompatibilityUtil/TestCaseTyped.php +67 -0
  184. package/support/vendor/phug/phug/src/Phug/Util/CompatibilityUtil/TestCaseUntyped.php +67 -0
  185. package/support/vendor/phug/phug/src/Phug/Util/Util/AttributesInterface.php +16 -0
  186. package/support/vendor/phug/phug/src/Phug/Util/Util/AttributesOrderInterface.php +17 -0
  187. package/support/vendor/phug/phug/src/Phug/Util/Util/AttributesStorage.php +44 -0
  188. package/support/vendor/phug/phug/src/Phug/Util/Util/Collection.php +2 -0
  189. package/support/vendor/phug/phug/src/Phug/Util/Util/OrderableInterface.php +22 -0
  190. package/support/vendor/phug/phug/src/Phug/Util/Util/OrderedValue.php +25 -0
  191. package/support/vendor/phug/phug/src/Phug/Util/Util/Partial/AttributeTrait.php +2 -1
  192. package/support/vendor/phug/phug/src/Phug/Util/Util/Partial/AttributesOrderTrait.php +19 -0
  193. package/support/vendor/phug/phug/src/Phug/Util/Util/Partial/ModuleContainerTrait.php +3 -3
  194. package/support/vendor/phug/phug/src/Phug/Util/Util/Partial/OptionTrait.php +1 -1
  195. package/support/vendor/phug/phug/src/Phug/Util/Util/Partial/OrderTrait.php +27 -0
  196. package/support/vendor/phug/phug/src/Phug/Util/Util/Partial/StaticMemberTrait.php +1 -1
  197. package/support/vendor/phug/phug/src/Phug/Util/Util/Partial/ValueTrait.php +5 -3
  198. package/support/vendor/phug/phug/src/Phug/Util/Util/SandBox.php +2 -1
  199. package/support/vendor/phug/phug/src/Phug/Util/Util/TestCase.php +47 -4
  200. package/support/vendor/phug/phug/src/Phug/Util/composer.json +7 -8
  201. package/support/vendor/symfony/deprecation-contracts/CHANGELOG.md +5 -0
  202. package/support/vendor/symfony/{polyfill-php72 → deprecation-contracts}/LICENSE +1 -1
  203. package/support/vendor/symfony/deprecation-contracts/README.md +26 -0
  204. package/support/vendor/symfony/{polyfill-php72 → deprecation-contracts}/composer.json +9 -9
  205. package/support/vendor/symfony/deprecation-contracts/function.php +27 -0
  206. package/support/vendor/symfony/polyfill-mbstring/LICENSE +1 -1
  207. package/support/vendor/symfony/polyfill-mbstring/Mbstring.php +256 -57
  208. package/support/vendor/symfony/polyfill-mbstring/README.md +1 -1
  209. package/support/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php +119 -0
  210. package/support/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +1 -1
  211. package/support/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php +102 -27
  212. package/support/vendor/symfony/polyfill-mbstring/bootstrap.php +33 -8
  213. package/support/vendor/symfony/polyfill-mbstring/bootstrap80.php +167 -0
  214. package/support/vendor/symfony/polyfill-mbstring/composer.json +5 -4
  215. package/support/vendor/symfony/var-dumper/CHANGELOG.md +63 -0
  216. package/support/vendor/symfony/var-dumper/Caster/AddressInfoCaster.php +82 -0
  217. package/support/vendor/symfony/var-dumper/Caster/AmqpCaster.php +12 -10
  218. package/support/vendor/symfony/var-dumper/Caster/ArgsStub.php +6 -7
  219. package/support/vendor/symfony/var-dumper/Caster/Caster.php +59 -31
  220. package/support/vendor/symfony/var-dumper/Caster/ClassStub.php +7 -9
  221. package/support/vendor/symfony/var-dumper/Caster/ConstStub.php +20 -4
  222. package/support/vendor/symfony/var-dumper/Caster/CurlCaster.php +31 -0
  223. package/support/vendor/symfony/var-dumper/Caster/CutArrayStub.php +1 -1
  224. package/support/vendor/symfony/var-dumper/Caster/CutStub.php +2 -2
  225. package/support/vendor/symfony/var-dumper/Caster/DOMCaster.php +61 -156
  226. package/support/vendor/symfony/var-dumper/Caster/DateCaster.php +27 -26
  227. package/support/vendor/symfony/var-dumper/Caster/DoctrineCaster.php +6 -4
  228. package/support/vendor/symfony/var-dumper/Caster/DsCaster.php +1 -1
  229. package/support/vendor/symfony/var-dumper/Caster/DsPairStub.php +1 -1
  230. package/support/vendor/symfony/var-dumper/Caster/EnumStub.php +4 -5
  231. package/support/vendor/symfony/var-dumper/Caster/ExceptionCaster.php +64 -49
  232. package/support/vendor/symfony/var-dumper/Caster/FFICaster.php +171 -0
  233. package/support/vendor/symfony/var-dumper/Caster/FiberCaster.php +43 -0
  234. package/support/vendor/symfony/var-dumper/Caster/FrameStub.php +6 -8
  235. package/support/vendor/symfony/var-dumper/Caster/GdCaster.php +30 -0
  236. package/support/vendor/symfony/var-dumper/Caster/GmpCaster.php +4 -2
  237. package/support/vendor/symfony/var-dumper/Caster/ImagineCaster.php +2 -0
  238. package/support/vendor/symfony/var-dumper/Caster/ImgStub.php +1 -1
  239. package/support/vendor/symfony/var-dumper/Caster/IntlCaster.php +10 -8
  240. package/support/vendor/symfony/var-dumper/Caster/LinkStub.php +14 -17
  241. package/support/vendor/symfony/var-dumper/Caster/MemcachedCaster.php +10 -8
  242. package/support/vendor/symfony/var-dumper/Caster/MysqliCaster.php +33 -0
  243. package/support/vendor/symfony/var-dumper/Caster/OpenSSLCaster.php +69 -0
  244. package/support/vendor/symfony/var-dumper/Caster/PdoCaster.php +8 -6
  245. package/support/vendor/symfony/var-dumper/Caster/PgSqlCaster.php +21 -19
  246. package/support/vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php +4 -2
  247. package/support/vendor/symfony/var-dumper/Caster/RdKafkaCaster.php +188 -0
  248. package/support/vendor/symfony/var-dumper/Caster/RedisCaster.php +31 -31
  249. package/support/vendor/symfony/var-dumper/Caster/ReflectionCaster.php +100 -44
  250. package/support/vendor/symfony/var-dumper/Caster/ResourceCaster.php +33 -46
  251. package/support/vendor/symfony/var-dumper/Caster/ScalarStub.php +27 -0
  252. package/support/vendor/symfony/var-dumper/Caster/SocketCaster.php +64 -0
  253. package/support/vendor/symfony/var-dumper/Caster/SplCaster.php +57 -44
  254. package/support/vendor/symfony/var-dumper/Caster/SqliteCaster.php +32 -0
  255. package/support/vendor/symfony/var-dumper/Caster/StubCaster.php +15 -5
  256. package/support/vendor/symfony/var-dumper/Caster/SymfonyCaster.php +66 -10
  257. package/support/vendor/symfony/var-dumper/Caster/TraceStub.php +7 -11
  258. package/support/vendor/symfony/var-dumper/Caster/UninitializedStub.php +25 -0
  259. package/support/vendor/symfony/var-dumper/Caster/UuidCaster.php +2 -0
  260. package/support/vendor/symfony/var-dumper/Caster/VirtualStub.php +21 -0
  261. package/support/vendor/symfony/var-dumper/Caster/XmlReaderCaster.php +25 -10
  262. package/support/vendor/symfony/var-dumper/Caster/XmlResourceCaster.php +7 -5
  263. package/support/vendor/symfony/var-dumper/Cloner/AbstractCloner.php +103 -72
  264. package/support/vendor/symfony/var-dumper/Cloner/ClonerInterface.php +1 -5
  265. package/support/vendor/symfony/var-dumper/Cloner/Cursor.php +21 -21
  266. package/support/vendor/symfony/var-dumper/Cloner/Data.php +51 -77
  267. package/support/vendor/symfony/var-dumper/Cloner/DumperInterface.php +11 -14
  268. package/support/vendor/symfony/var-dumper/Cloner/Stub.php +40 -31
  269. package/support/vendor/symfony/var-dumper/Cloner/VarCloner.php +21 -104
  270. package/support/vendor/symfony/var-dumper/Command/Descriptor/CliDescriptor.php +9 -19
  271. package/support/vendor/symfony/var-dumper/Command/Descriptor/HtmlDescriptor.php +10 -11
  272. package/support/vendor/symfony/var-dumper/Command/ServerDumpCommand.php +27 -15
  273. package/support/vendor/symfony/var-dumper/Dumper/AbstractDumper.php +68 -48
  274. package/support/vendor/symfony/var-dumper/Dumper/CliDumper.php +126 -113
  275. package/support/vendor/symfony/var-dumper/Dumper/ContextProvider/CliContextProvider.php +1 -1
  276. package/support/vendor/symfony/var-dumper/Dumper/ContextProvider/ContextProviderInterface.php +0 -3
  277. package/support/vendor/symfony/var-dumper/Dumper/ContextProvider/RequestContextProvider.php +5 -6
  278. package/support/vendor/symfony/var-dumper/Dumper/ContextProvider/SourceContextProvider.php +10 -15
  279. package/support/vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php +8 -11
  280. package/support/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php +3 -0
  281. package/support/vendor/symfony/var-dumper/Dumper/HtmlDumper.php +122 -146
  282. package/support/vendor/symfony/var-dumper/Dumper/ServerDumper.php +10 -10
  283. package/support/vendor/symfony/var-dumper/Exception/ThrowingCasterException.php +1 -1
  284. package/support/vendor/symfony/var-dumper/LICENSE +1 -1
  285. package/support/vendor/symfony/var-dumper/README.md +6 -6
  286. package/support/vendor/symfony/var-dumper/Resources/bin/var-dump-server +4 -0
  287. package/support/vendor/symfony/var-dumper/Resources/functions/dump.php +35 -10
  288. package/support/vendor/symfony/var-dumper/Server/Connection.php +16 -14
  289. package/support/vendor/symfony/var-dumper/Server/DumpServer.php +16 -14
  290. package/support/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php +9 -9
  291. package/support/vendor/symfony/var-dumper/VarDumper.php +69 -17
  292. package/support/vendor/symfony/var-dumper/composer.json +10 -16
  293. package/support/vendor/symfony/polyfill-php72/Php72.php +0 -217
  294. package/support/vendor/symfony/polyfill-php72/README.md +0 -28
  295. package/support/vendor/symfony/polyfill-php72/bootstrap.php +0 -57
  296. package/support/vendor/symfony/polyfill-php80/LICENSE +0 -19
  297. package/support/vendor/symfony/polyfill-php80/Php80.php +0 -105
  298. package/support/vendor/symfony/polyfill-php80/README.md +0 -24
  299. package/support/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php +0 -22
  300. package/support/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php +0 -11
  301. package/support/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php +0 -5
  302. package/support/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php +0 -5
  303. package/support/vendor/symfony/polyfill-php80/bootstrap.php +0 -42
  304. package/support/vendor/symfony/polyfill-php80/composer.json +0 -40
@@ -3,21 +3,15 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\ForToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\Node\ForNode;
8
7
  use Phug\Parser\State;
9
- use Phug\Parser\TokenHandlerInterface;
10
8
 
11
- class ForTokenHandler implements TokenHandlerInterface
9
+ class ForTokenHandler extends AbstractTokenHandler
12
10
  {
13
- public function handleToken(TokenInterface $token, State $state)
14
- {
15
- if (!($token instanceof ForToken)) {
16
- throw new \RuntimeException(
17
- 'You can only pass for tokens to this token handler'
18
- );
19
- }
11
+ const TOKEN_TYPE = ForToken::class;
20
12
 
13
+ public function handleForToken(ForToken $token, State $state)
14
+ {
21
15
  /** @var ForNode $node */
22
16
  $node = $state->createNode(ForNode::class, $token);
23
17
  $node->setSubject($token->getSubject());
@@ -3,43 +3,17 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\IdToken;
6
- use Phug\Lexer\TokenInterface;
7
- use Phug\Parser\Node\AttributeNode;
8
- use Phug\Parser\Node\ElementNode;
9
- use Phug\Parser\Node\MixinCallNode;
10
6
  use Phug\Parser\State;
11
- use Phug\Parser\TokenHandlerInterface;
7
+ use Phug\Parser\TokenHandler\Partial\StaticAttributeTrait;
12
8
 
13
- class IdTokenHandler implements TokenHandlerInterface
9
+ class IdTokenHandler extends AbstractTokenHandler
14
10
  {
15
- public function handleToken(TokenInterface $token, State $state)
16
- {
17
- if (!($token instanceof IdToken)) {
18
- throw new \RuntimeException(
19
- 'You can only pass id tokens to this token handler'
20
- );
21
- }
22
-
23
- if (!$state->getCurrentNode()) {
24
- $state->setCurrentNode($state->createNode(ElementNode::class, $token));
25
- }
11
+ use StaticAttributeTrait;
26
12
 
27
- if (!$state->currentNodeIs([ElementNode::class, MixinCallNode::class])) {
28
- $state->throwException(
29
- 'IDs can only be used on elements and mixin calls',
30
- 0,
31
- $token
32
- );
33
- }
13
+ const TOKEN_TYPE = IdToken::class;
34
14
 
35
- /** @var AttributeNode $attr */
36
- $attr = $state->createNode(AttributeNode::class, $token);
37
- $attr->setName('id');
38
- $attr->setValue(var_export($token->getName(), true));
39
- $attr->unescape()->uncheck();
40
-
41
- /** @var ElementNode|MixinCallNode $current */
42
- $current = $state->getCurrentNode();
43
- $current->getAttributes()->attach($attr);
15
+ public function handleIdToken(IdToken $token, State $state)
16
+ {
17
+ $this->attachStaticAttribute('id', $token, $state);
44
18
  }
45
19
  }
@@ -3,35 +3,18 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\ImportToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\Node\CommentNode;
8
7
  use Phug\Parser\Node\ImportNode;
9
8
  use Phug\Parser\Node\MixinNode;
10
9
  use Phug\Parser\NodeInterface;
11
10
  use Phug\Parser\State;
12
- use Phug\Parser\TokenHandlerInterface;
13
11
 
14
- class ImportTokenHandler implements TokenHandlerInterface
12
+ class ImportTokenHandler extends AbstractTokenHandler
15
13
  {
16
- protected function isEmptyDocument(NodeInterface $document)
17
- {
18
- foreach ($document->getChildren() as $child) {
19
- if (!($child instanceof MixinNode || ($child instanceof CommentNode && !$child->isVisible()))) {
20
- return false;
21
- }
22
- }
23
-
24
- return true;
25
- }
14
+ const TOKEN_TYPE = ImportToken::class;
26
15
 
27
- public function handleToken(TokenInterface $token, State $state)
16
+ public function handleImportToken(ImportToken $token, State $state)
28
17
  {
29
- if (!($token instanceof ImportToken)) {
30
- throw new \RuntimeException(
31
- 'You can only pass import tokens to this token handler'
32
- );
33
- }
34
-
35
18
  if ($token->getName() === 'extend' && !$this->isEmptyDocument($state->getDocumentNode())) {
36
19
  $state->throwException(
37
20
  'extends should be the very first statement in a document',
@@ -46,4 +29,15 @@ class ImportTokenHandler implements TokenHandlerInterface
46
29
  $node->setPath($token->getPath());
47
30
  $state->setCurrentNode($node);
48
31
  }
32
+
33
+ protected function isEmptyDocument(NodeInterface $document)
34
+ {
35
+ foreach ($document->getChildren() as $child) {
36
+ if (!($child instanceof MixinNode || ($child instanceof CommentNode && !$child->isVisible()))) {
37
+ return false;
38
+ }
39
+ }
40
+
41
+ return true;
42
+ }
49
43
  }
@@ -3,20 +3,14 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\IndentToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\State;
8
- use Phug\Parser\TokenHandlerInterface;
9
7
 
10
- class IndentTokenHandler implements TokenHandlerInterface
8
+ class IndentTokenHandler extends AbstractTokenHandler
11
9
  {
12
- public function handleToken(TokenInterface $token, State $state)
13
- {
14
- if (!($token instanceof IndentToken)) {
15
- throw new \RuntimeException(
16
- 'You can only pass indent tokens to this token handler'
17
- );
18
- }
10
+ const TOKEN_TYPE = IndentToken::class;
19
11
 
12
+ public function handleIndentToken(IndentToken $token, State $state)
13
+ {
20
14
  $state->enter();
21
15
  }
22
16
  }
@@ -3,20 +3,14 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\InterpolationEndToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\State;
8
- use Phug\Parser\TokenHandlerInterface;
9
7
 
10
- class InterpolationEndTokenHandler implements TokenHandlerInterface
8
+ class InterpolationEndTokenHandler extends AbstractTokenHandler
11
9
  {
12
- public function handleToken(TokenInterface $token, State $state)
13
- {
14
- if (!($token instanceof InterpolationEndToken)) {
15
- throw new \RuntimeException(
16
- 'You can only pass interpolation end tokens to this token handler'
17
- );
18
- }
10
+ const TOKEN_TYPE = InterpolationEndToken::class;
19
11
 
12
+ public function handleInterpolationEndToken(InterpolationEndToken $token, State $state)
13
+ {
20
14
  $node = $state->getCurrentNode();
21
15
  $nodes = $state->getInterpolationStack()->offsetGet($token);
22
16
  $state->setCurrentNode($nodes->currentNode);
@@ -5,47 +5,22 @@ namespace Phug\Parser\TokenHandler;
5
5
  use Phug\Lexer\Token\ExpressionToken;
6
6
  use Phug\Lexer\Token\InterpolationEndToken;
7
7
  use Phug\Lexer\Token\InterpolationStartToken;
8
- use Phug\Lexer\TokenInterface;
9
8
  use Phug\Parser\Node\CodeNode;
10
9
  use Phug\Parser\Node\ElementNode;
11
10
  use Phug\Parser\Node\ExpressionNode;
12
11
  use Phug\Parser\Node\TextNode;
13
12
  use Phug\Parser\State;
14
- use Phug\Parser\TokenHandlerInterface;
15
13
 
16
- class InterpolationStartTokenHandler implements TokenHandlerInterface
14
+ class InterpolationStartTokenHandler extends AbstractTokenHandler
17
15
  {
18
- public function handleToken(TokenInterface $token, State $state)
19
- {
20
- if (!($token instanceof InterpolationStartToken)) {
21
- throw new \RuntimeException(
22
- 'You can only pass interpolation start tokens to this token handler'
23
- );
24
- }
16
+ const TOKEN_TYPE = InterpolationStartToken::class;
25
17
 
18
+ public function handleInterpolationStartToken(InterpolationStartToken $token, State $state)
19
+ {
26
20
  $node = $state->getCurrentNode();
27
21
 
28
22
  if (!$node && !($state->getPreviousToken() instanceof InterpolationEndToken)) {
29
- /** @var ElementNode $element */
30
- $element = $state->createNode(ElementNode::class, $token);
31
- $state->setCurrentNode($element);
32
-
33
- foreach ($state->lookUpNext([ExpressionToken::class]) as $expression) {
34
- /** @var ExpressionNode $expressionNode */
35
- $expressionNode = $state->createNode(ExpressionNode::class, $expression);
36
- $expressionNode->check();
37
- $expressionNode->unescape();
38
- $expressionNode->setValue($expression->getValue());
39
- $element->setName($expressionNode);
40
- }
41
-
42
- if (!$state->expect([InterpolationEndToken::class])) {
43
- $state->throwException(
44
- 'Interpolation not properly closed',
45
- 0,
46
- $token
47
- );
48
- }
23
+ $this->handleExpressionTokens($token, $state);
49
24
 
50
25
  return;
51
26
  }
@@ -65,4 +40,28 @@ class InterpolationStartTokenHandler implements TokenHandlerInterface
65
40
 
66
41
  $state->store();
67
42
  }
43
+
44
+ private function handleExpressionTokens(InterpolationStartToken $token, State $state)
45
+ {
46
+ /** @var ElementNode $element */
47
+ $element = $state->createNode(ElementNode::class, $token);
48
+ $state->setCurrentNode($element);
49
+
50
+ foreach ($state->lookUpNext([ExpressionToken::class]) as $expression) {
51
+ /** @var ExpressionNode $expressionNode */
52
+ $expressionNode = $state->createNode(ExpressionNode::class, $expression);
53
+ $expressionNode->check();
54
+ $expressionNode->unescape();
55
+ $expressionNode->setValue($expression->getValue());
56
+ $element->setName($expressionNode);
57
+ }
58
+
59
+ if (!$state->expect([InterpolationEndToken::class])) {
60
+ $state->throwException(
61
+ 'Interpolation not properly closed',
62
+ 0,
63
+ $token
64
+ );
65
+ }
66
+ }
68
67
  }
@@ -3,21 +3,15 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\KeywordToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\Node\KeywordNode;
8
7
  use Phug\Parser\State;
9
- use Phug\Parser\TokenHandlerInterface;
10
8
 
11
- class KeywordTokenHandler implements TokenHandlerInterface
9
+ class KeywordTokenHandler extends AbstractTokenHandler
12
10
  {
13
- public function handleToken(TokenInterface $token, State $state)
14
- {
15
- if (!($token instanceof KeywordToken)) {
16
- throw new \RuntimeException(
17
- 'You can only pass keyword tokens to this token handler'
18
- );
19
- }
11
+ const TOKEN_TYPE = KeywordToken::class;
20
12
 
13
+ public function handleKeywordToken(KeywordToken $token, State $state)
14
+ {
21
15
  /** @var KeywordNode $node */
22
16
  $node = $state->createNode(KeywordNode::class, $token);
23
17
  $node->setName($token->getName());
@@ -3,22 +3,16 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\MixinCallToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\Node\ExpressionNode;
8
7
  use Phug\Parser\Node\MixinCallNode;
9
8
  use Phug\Parser\State;
10
- use Phug\Parser\TokenHandlerInterface;
11
9
 
12
- class MixinCallTokenHandler implements TokenHandlerInterface
10
+ class MixinCallTokenHandler extends AbstractTokenHandler
13
11
  {
14
- public function handleToken(TokenInterface $token, State $state)
15
- {
16
- if (!($token instanceof MixinCallToken)) {
17
- throw new \RuntimeException(
18
- 'You can only pass mixin call tokens to this token handler'
19
- );
20
- }
12
+ const TOKEN_TYPE = MixinCallToken::class;
21
13
 
14
+ public function handleMixinCallToken(MixinCallToken $token, State $state)
15
+ {
22
16
  /** @var MixinCallNode $node */
23
17
  $node = $state->createNode(MixinCallNode::class, $token);
24
18
  $name = $token->getName();
@@ -3,21 +3,15 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\MixinToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\Node\MixinNode;
8
7
  use Phug\Parser\State;
9
- use Phug\Parser\TokenHandlerInterface;
10
8
 
11
- class MixinTokenHandler implements TokenHandlerInterface
9
+ class MixinTokenHandler extends AbstractTokenHandler
12
10
  {
13
- public function handleToken(TokenInterface $token, State $state)
14
- {
15
- if (!($token instanceof MixinToken)) {
16
- throw new \RuntimeException(
17
- 'You can only pass mixin tokens to this token handler'
18
- );
19
- }
11
+ const TOKEN_TYPE = MixinToken::class;
20
12
 
13
+ public function handleMixinToken(MixinToken $token, State $state)
14
+ {
21
15
  /** @var MixinNode $node */
22
16
  $node = $state->createNode(MixinNode::class, $token);
23
17
  $node->setName($token->getName());
@@ -3,20 +3,14 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\NewLineToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\State;
8
- use Phug\Parser\TokenHandlerInterface;
9
7
 
10
- class NewLineTokenHandler implements TokenHandlerInterface
8
+ class NewLineTokenHandler extends AbstractTokenHandler
11
9
  {
12
- public function handleToken(TokenInterface $token, State $state)
13
- {
14
- if (!($token instanceof NewLineToken)) {
15
- throw new \RuntimeException(
16
- 'You can only pass newline tokens to this token handler'
17
- );
18
- }
10
+ const TOKEN_TYPE = NewLineToken::class;
19
11
 
12
+ public function handleNewLineToken(NewLineToken $token, State $state)
13
+ {
20
14
  $state->store();
21
15
  }
22
16
  }
@@ -3,20 +3,14 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\OutdentToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\State;
8
- use Phug\Parser\TokenHandlerInterface;
9
7
 
10
- class OutdentTokenHandler implements TokenHandlerInterface
8
+ class OutdentTokenHandler extends AbstractTokenHandler
11
9
  {
12
- public function handleToken(TokenInterface $token, State $state)
13
- {
14
- if (!($token instanceof OutdentToken)) {
15
- throw new \RuntimeException(
16
- 'You can only pass outdent tokens to this token handler'
17
- );
18
- }
10
+ const TOKEN_TYPE = OutdentToken::class;
19
11
 
12
+ public function handleOutdentToken(OutdentToken $token, State $state)
13
+ {
20
14
  $state->leave();
21
15
  }
22
16
  }
@@ -0,0 +1,36 @@
1
+ <?php
2
+
3
+ namespace Phug\Parser\TokenHandler\Partial;
4
+
5
+ use Phug\Lexer\Token\ClassToken;
6
+ use Phug\Lexer\Token\IdToken;
7
+ use Phug\Lexer\TokenInterface;
8
+ use Phug\Parser\Node\AttributeNode;
9
+ use Phug\Parser\Node\ElementNode;
10
+ use Phug\Parser\Node\MixinCallNode;
11
+ use Phug\Parser\State;
12
+
13
+ trait StaticAttributeTrait
14
+ {
15
+ /**
16
+ * @param string $name
17
+ * @param IdToken|ClassToken $token
18
+ * @param State $state
19
+ *
20
+ * @return void
21
+ */
22
+ private function attachStaticAttribute($name, TokenInterface $token, State $state)
23
+ {
24
+ $this->onlyOnElement($token, $state);
25
+
26
+ /** @var AttributeNode $attr */
27
+ $attr = $state->createNode(AttributeNode::class, $token);
28
+ $attr->setName($name);
29
+ $attr->setValue(var_export($token->getName(), true));
30
+ $attr->unescape()->uncheck();
31
+
32
+ /** @var ElementNode|MixinCallNode $current */
33
+ $current = $state->getCurrentNode();
34
+ $current->getAttributes()->attach($attr);
35
+ }
36
+ }
@@ -3,20 +3,14 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\TagInterpolationEndToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\State;
8
- use Phug\Parser\TokenHandlerInterface;
9
7
 
10
- class TagInterpolationEndTokenHandler implements TokenHandlerInterface
8
+ class TagInterpolationEndTokenHandler extends AbstractTokenHandler
11
9
  {
12
- public function handleToken(TokenInterface $token, State $state)
13
- {
14
- if (!($token instanceof TagInterpolationEndToken)) {
15
- throw new \RuntimeException(
16
- 'You can only pass tag interpolation end tokens to this token handler'
17
- );
18
- }
10
+ const TOKEN_TYPE = TagInterpolationEndToken::class;
19
11
 
12
+ public function handleTagInterpolationEndToken(TagInterpolationEndToken $token, State $state)
13
+ {
20
14
  $state->popInterpolationNode();
21
15
  $node = $state->getCurrentNode();
22
16
  $nodes = $state->getInterpolationStack()->offsetGet($token);
@@ -3,24 +3,19 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\TagInterpolationStartToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\Node\CodeNode;
8
7
  use Phug\Parser\Node\ExpressionNode;
9
8
  use Phug\Parser\Node\TextNode;
10
9
  use Phug\Parser\State;
11
- use Phug\Parser\TokenHandlerInterface;
12
10
 
13
- class TagInterpolationStartTokenHandler implements TokenHandlerInterface
11
+ class TagInterpolationStartTokenHandler extends AbstractTokenHandler
14
12
  {
15
- public function handleToken(TokenInterface $token, State $state)
16
- {
17
- if (!($token instanceof TagInterpolationStartToken)) {
18
- throw new \RuntimeException(
19
- 'You can only pass tag interpolation start tokens to this token handler'
20
- );
21
- }
13
+ const TOKEN_TYPE = TagInterpolationStartToken::class;
22
14
 
15
+ public function handleTagInterpolationStartToken(TagInterpolationStartToken $token, State $state)
16
+ {
23
17
  $node = $state->getCurrentNode();
18
+
24
19
  if ($state->currentNodeIs([
25
20
  TextNode::class,
26
21
  CodeNode::class,
@@ -28,9 +23,11 @@ class TagInterpolationStartTokenHandler implements TokenHandlerInterface
28
23
  ])) {
29
24
  $node = $node->getParent();
30
25
  }
26
+
31
27
  if ($node) {
32
28
  $state->pushInterpolationNode($node);
33
29
  }
30
+
34
31
  $state->getInterpolationStack()->attach($token->getEnd(), (object) [
35
32
  'currentNode' => $node,
36
33
  'parentNode' => $state->getParentNode(),
@@ -3,32 +3,17 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\TagToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\Node\ElementNode;
8
7
  use Phug\Parser\State;
9
- use Phug\Parser\TokenHandlerInterface;
10
8
 
11
- class TagTokenHandler implements TokenHandlerInterface
9
+ class TagTokenHandler extends AbstractTokenHandler
12
10
  {
13
- public function handleToken(TokenInterface $token, State $state)
14
- {
15
- if (!($token instanceof TagToken)) {
16
- throw new \RuntimeException(
17
- 'You can only pass tag tokens to this token handler'
18
- );
19
- }
11
+ const TOKEN_TYPE = TagToken::class;
20
12
 
21
- if (!$state->getCurrentNode()) {
22
- $state->setCurrentNode($state->createNode(ElementNode::class, $token));
23
- }
24
-
25
- if (!$state->currentNodeIs([ElementNode::class])) {
26
- $state->throwException(
27
- 'Tags can only be used on elements',
28
- 0,
29
- $token
30
- );
31
- }
13
+ public function handleTagToken(TagToken $token, State $state)
14
+ {
15
+ $this->createElementNodeIfMissing($token, $state);
16
+ $this->assertCurrentNodeIs($token, $state, [ElementNode::class]);
32
17
 
33
18
  /** @var ElementNode $current */
34
19
  $current = $state->getCurrentNode();
@@ -3,21 +3,15 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\TextToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\Node\TextNode;
8
7
  use Phug\Parser\State;
9
- use Phug\Parser\TokenHandlerInterface;
10
8
 
11
- class TextTokenHandler implements TokenHandlerInterface
9
+ class TextTokenHandler extends AbstractTokenHandler
12
10
  {
13
- public function handleToken(TokenInterface $token, State $state)
14
- {
15
- if (!($token instanceof TextToken)) {
16
- throw new \RuntimeException(
17
- 'You can only pass text tokens to this token handler'
18
- );
19
- }
11
+ const TOKEN_TYPE = TextToken::class;
20
12
 
13
+ public function handleTextToken(TextToken $token, State $state)
14
+ {
21
15
  /** @var TextNode $node */
22
16
  $node = $state->createNode(TextNode::class, $token);
23
17
  $node->setValue($token->getValue());
@@ -3,21 +3,15 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\VariableToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\Node\VariableNode;
8
7
  use Phug\Parser\State;
9
- use Phug\Parser\TokenHandlerInterface;
10
8
 
11
- class VariableTokenHandler implements TokenHandlerInterface
9
+ class VariableTokenHandler extends AbstractTokenHandler
12
10
  {
13
- public function handleToken(TokenInterface $token, State $state)
14
- {
15
- if (!($token instanceof VariableToken)) {
16
- throw new \RuntimeException(
17
- 'You can only pass variable tokens to this token handler'
18
- );
19
- }
11
+ const TOKEN_TYPE = VariableToken::class;
20
12
 
13
+ public function handleVariableToken(VariableToken $token, State $state)
14
+ {
21
15
  /** @var VariableNode $node */
22
16
  $node = $state->createNode(VariableNode::class, $token);
23
17
  $node->setName($token->getName());
@@ -3,21 +3,15 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\WhenToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\Node\WhenNode;
8
7
  use Phug\Parser\State;
9
- use Phug\Parser\TokenHandlerInterface;
10
8
 
11
- class WhenTokenHandler implements TokenHandlerInterface
9
+ class WhenTokenHandler extends AbstractTokenHandler
12
10
  {
13
- public function handleToken(TokenInterface $token, State $state)
14
- {
15
- if (!($token instanceof WhenToken)) {
16
- throw new \RuntimeException(
17
- 'You can only pass when tokens to this token handler'
18
- );
19
- }
11
+ const TOKEN_TYPE = WhenToken::class;
20
12
 
13
+ public function handleWhenToken(WhenToken $token, State $state)
14
+ {
21
15
  /** @var WhenNode $node */
22
16
  $node = $state->createNode(WhenNode::class, $token);
23
17
  $node->setSubject($token->getSubject());
@@ -3,21 +3,15 @@
3
3
  namespace Phug\Parser\TokenHandler;
4
4
 
5
5
  use Phug\Lexer\Token\WhileToken;
6
- use Phug\Lexer\TokenInterface;
7
6
  use Phug\Parser\Node\WhileNode;
8
7
  use Phug\Parser\State;
9
- use Phug\Parser\TokenHandlerInterface;
10
8
 
11
- class WhileTokenHandler implements TokenHandlerInterface
9
+ class WhileTokenHandler extends AbstractTokenHandler
12
10
  {
13
- public function handleToken(TokenInterface $token, State $state)
14
- {
15
- if (!($token instanceof WhileToken)) {
16
- throw new \RuntimeException(
17
- 'You can only pass while tokens to this token handler'
18
- );
19
- }
11
+ const TOKEN_TYPE = WhileToken::class;
20
12
 
13
+ public function handleWhileToken(WhileToken $token, State $state)
14
+ {
21
15
  /** @var WhileNode $node */
22
16
  $node = $state->createNode(WhileNode::class, $token);
23
17
  $node->setSubject($token->getSubject());