@vituum/vite-plugin-latte 2.0.0-next.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.
- package/README.md +1 -1
- package/index.js +4 -2
- package/package.json +11 -9
- package/types/index.d.ts +1 -1
- package/vendor/autoload.php +1 -4
- package/vendor/composer/InstalledVersions.php +36 -2
- package/vendor/composer/autoload_classmap.php +14 -15
- package/vendor/composer/autoload_psr4.php +2 -0
- package/vendor/composer/autoload_static.php +38 -15
- package/vendor/composer/installed.json +32 -22
- package/vendor/composer/installed.php +12 -12
- package/vendor/composer/platform_check.php +4 -5
- package/vendor/latte/latte/bin/latte-lint +10 -3
- package/vendor/latte/latte/composer.json +16 -6
- package/vendor/latte/latte/src/Bridges/Tracy/BlueScreenPanel.php +13 -38
- package/vendor/latte/latte/src/Bridges/Tracy/LattePanel.php +9 -7
- package/vendor/latte/latte/src/Bridges/Tracy/TracyExtension.php +2 -4
- package/vendor/latte/latte/src/Bridges/Tracy/dist/panel.phtml +94 -0
- package/vendor/latte/latte/src/Bridges/Tracy/dist/tab.phtml +10 -0
- package/vendor/latte/latte/src/Latte/Compiler/Block.php +4 -6
- package/vendor/latte/latte/src/Latte/Compiler/Escaper.php +67 -86
- package/vendor/latte/latte/src/Latte/Compiler/Node.php +6 -3
- package/vendor/latte/latte/src/Latte/Compiler/NodeHelpers.php +16 -6
- package/vendor/latte/latte/src/Latte/Compiler/NodeTraverser.php +25 -12
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/AreaNode.php +7 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/AuxiliaryNode.php +5 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/FragmentNode.php +8 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Html/AttributeNode.php +7 -15
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Html/BogusTagNode.php +4 -6
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Html/CommentNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Html/ElementNode.php +37 -67
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Html/ExpressionAttributeNode.php +60 -0
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Html/TagNode.php +70 -0
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/NopNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/ArgumentNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/ArrayItemNode.php +4 -15
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/ClosureUseNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/ComplexTypeNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ArrayAccessNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ArrayNode.php +6 -22
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/AssignNode.php +18 -5
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/AssignOpNode.php +18 -7
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/AuxiliaryNode.php +5 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/BinaryOpNode.php +38 -9
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/CastNode.php +14 -6
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ClassConstantFetchNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/CloneNode.php +12 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ClosureNode.php +10 -6
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ConstantFetchNode.php +7 -6
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/EmptyNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/FilterCallNode.php +10 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/FunctionCallNode.php +14 -5
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/InNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/InstanceofNode.php +14 -5
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/IssetNode.php +6 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/MatchNode.php +6 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/MethodCallNode.php +18 -5
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/NewNode.php +14 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/PostOpNode.php +14 -6
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/PreOpNode.php +14 -6
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/PropertyFetchNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/StaticMethodCallNode.php +14 -15
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/StaticPropertyFetchNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/TemporaryNode.php +7 -6
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/TernaryNode.php +16 -11
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/UnaryOpNode.php +19 -9
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/VariableNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/ExpressionNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/FilterNode.php +33 -8
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/IdentifierNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/InterpolatedStringPartNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/IntersectionTypeNode.php +6 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/ListItemNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/ListNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/MatchArmNode.php +6 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/ModifierNode.php +29 -41
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/NameNode.php +9 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/NullableTypeNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/OperatorNode.php +27 -0
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/ParameterNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/BooleanNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/FloatNode.php +9 -6
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/IntegerNode.php +8 -6
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/InterpolatedStringNode.php +9 -5
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/NullNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/StringNode.php +6 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/ScalarNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/SuperiorTypeNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/UnionTypeNode.php +6 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/VarLikeIdentifierNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/{Expression/NotNode.php → VariadicPlaceholderNode.php} +9 -9
- package/vendor/latte/latte/src/Latte/{Essential → Compiler}/Nodes/PrintNode.php +9 -15
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/StatementNode.php +7 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/TemplateNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/TextNode.php +6 -4
- package/vendor/latte/latte/src/Latte/Compiler/PhpHelpers.php +32 -18
- package/vendor/latte/latte/src/Latte/Compiler/Position.php +7 -7
- package/vendor/latte/latte/src/Latte/Compiler/PrintContext.php +72 -104
- package/vendor/latte/latte/src/Latte/Compiler/Tag.php +17 -16
- package/vendor/latte/latte/src/Latte/Compiler/TagLexer.php +11 -8
- package/vendor/latte/latte/src/Latte/Compiler/TagParser.php +28 -23
- package/vendor/latte/latte/src/Latte/Compiler/TagParserData.php +360 -336
- package/vendor/latte/latte/src/Latte/Compiler/TemplateGenerator.php +49 -38
- package/vendor/latte/latte/src/Latte/Compiler/TemplateLexer.php +37 -12
- package/vendor/latte/latte/src/Latte/Compiler/TemplateParser.php +35 -21
- package/vendor/latte/latte/src/Latte/Compiler/TemplateParserHtml.php +121 -71
- package/vendor/latte/latte/src/Latte/Compiler/Token.php +79 -70
- package/vendor/latte/latte/src/Latte/Compiler/TokenStream.php +21 -14
- package/vendor/latte/latte/src/Latte/ContentType.php +4 -3
- package/vendor/latte/latte/src/Latte/Engine.php +147 -188
- package/vendor/latte/latte/src/Latte/Essential/AuxiliaryIterator.php +5 -7
- package/vendor/latte/latte/src/Latte/Essential/Blueprint.php +5 -5
- package/vendor/latte/latte/src/Latte/Essential/CachingIterator.php +5 -4
- package/vendor/latte/latte/src/Latte/Essential/CoreExtension.php +155 -127
- package/vendor/latte/latte/src/Latte/Essential/Filters.php +99 -44
- package/vendor/latte/latte/src/Latte/Essential/Nodes/BlockNode.php +14 -13
- package/vendor/latte/latte/src/Latte/Essential/Nodes/CaptureNode.php +5 -6
- package/vendor/latte/latte/src/Latte/Essential/Nodes/ContentTypeNode.php +3 -4
- package/vendor/latte/latte/src/Latte/Essential/Nodes/CustomFunctionCallNode.php +46 -0
- package/vendor/latte/latte/src/Latte/Essential/Nodes/DebugbreakNode.php +2 -3
- package/vendor/latte/latte/src/Latte/Essential/Nodes/DefineNode.php +10 -7
- package/vendor/latte/latte/src/Latte/Essential/Nodes/DoNode.php +3 -4
- package/vendor/latte/latte/src/Latte/Essential/Nodes/DumpNode.php +2 -3
- package/vendor/latte/latte/src/Latte/Essential/Nodes/EmbedNode.php +8 -9
- package/vendor/latte/latte/src/Latte/Essential/Nodes/ExtendsNode.php +3 -5
- package/vendor/latte/latte/src/Latte/Essential/Nodes/FirstLastSepNode.php +4 -7
- package/vendor/latte/latte/src/Latte/Essential/Nodes/ForNode.php +6 -5
- package/vendor/latte/latte/src/Latte/Essential/Nodes/ForeachNode.php +7 -7
- package/vendor/latte/latte/src/Latte/Essential/Nodes/IfChangedNode.php +4 -5
- package/vendor/latte/latte/src/Latte/Essential/Nodes/IfContentNode.php +7 -6
- package/vendor/latte/latte/src/Latte/Essential/Nodes/IfNode.php +11 -11
- package/vendor/latte/latte/src/Latte/Essential/Nodes/ImportNode.php +5 -6
- package/vendor/latte/latte/src/Latte/Essential/Nodes/IncludeBlockNode.php +26 -27
- package/vendor/latte/latte/src/Latte/Essential/Nodes/IncludeFileNode.php +7 -10
- package/vendor/latte/latte/src/Latte/Essential/Nodes/IterateWhileNode.php +6 -6
- package/vendor/latte/latte/src/Latte/Essential/Nodes/JumpNode.php +4 -8
- package/vendor/latte/latte/src/Latte/Essential/Nodes/NAttrNode.php +35 -47
- package/vendor/latte/latte/src/Latte/Essential/Nodes/NClassNode.php +4 -5
- package/vendor/latte/latte/src/Latte/Essential/Nodes/NElseNode.php +69 -34
- package/vendor/latte/latte/src/Latte/Essential/Nodes/NTagNode.php +9 -33
- package/vendor/latte/latte/src/Latte/Essential/Nodes/ParametersNode.php +7 -4
- package/vendor/latte/latte/src/Latte/Essential/Nodes/RawPhpNode.php +3 -4
- package/vendor/latte/latte/src/Latte/Essential/Nodes/RollbackNode.php +2 -3
- package/vendor/latte/latte/src/Latte/Essential/Nodes/SpacelessNode.php +4 -5
- package/vendor/latte/latte/src/Latte/Essential/Nodes/SwitchNode.php +9 -7
- package/vendor/latte/latte/src/Latte/Essential/Nodes/TemplatePrintNode.php +4 -4
- package/vendor/latte/latte/src/Latte/Essential/Nodes/TemplateTypeNode.php +3 -4
- package/vendor/latte/latte/src/Latte/Essential/Nodes/TraceNode.php +2 -3
- package/vendor/latte/latte/src/Latte/Essential/Nodes/TranslateNode.php +5 -5
- package/vendor/latte/latte/src/Latte/Essential/Nodes/TryNode.php +4 -5
- package/vendor/latte/latte/src/Latte/Essential/Nodes/VarNode.php +10 -6
- package/vendor/latte/latte/src/Latte/Essential/Nodes/VarPrintNode.php +2 -3
- package/vendor/latte/latte/src/Latte/Essential/Nodes/VarTypeNode.php +3 -4
- package/vendor/latte/latte/src/Latte/Essential/Nodes/WhileNode.php +5 -5
- package/vendor/latte/latte/src/Latte/Essential/Passes.php +82 -21
- package/vendor/latte/latte/src/Latte/Essential/RawPhpExtension.php +2 -4
- package/vendor/latte/latte/src/Latte/Essential/RollbackException.php +1 -3
- package/vendor/latte/latte/src/Latte/Essential/Tracer.php +24 -28
- package/vendor/latte/latte/src/Latte/Essential/TranslatorExtension.php +14 -14
- package/vendor/latte/latte/src/Latte/Extension.php +12 -6
- package/vendor/latte/latte/src/Latte/Feature.php +24 -0
- package/vendor/latte/latte/src/Latte/Helpers.php +65 -15
- package/vendor/latte/latte/src/Latte/Loader.php +1 -9
- package/vendor/latte/latte/src/Latte/Loaders/FileLoader.php +11 -17
- package/vendor/latte/latte/src/Latte/Loaders/StringLoader.php +7 -21
- package/vendor/latte/latte/src/Latte/Policy.php +4 -3
- package/vendor/latte/latte/src/Latte/Runtime/Block.php +2 -4
- package/vendor/latte/latte/src/Latte/Runtime/Cache.php +143 -0
- package/vendor/latte/latte/src/Latte/Runtime/FilterExecutor.php +5 -6
- package/vendor/latte/latte/src/Latte/Runtime/FilterInfo.php +11 -11
- package/vendor/latte/latte/src/Latte/Runtime/FunctionExecutor.php +5 -6
- package/vendor/latte/latte/src/Latte/Runtime/Helpers.php +91 -0
- package/vendor/latte/latte/src/Latte/Runtime/Html.php +3 -5
- package/vendor/latte/latte/src/Latte/Runtime/HtmlHelpers.php +374 -0
- package/vendor/latte/latte/src/Latte/Runtime/HtmlStringable.php +1 -3
- package/vendor/latte/latte/src/Latte/Runtime/Template.php +162 -182
- package/vendor/latte/latte/src/Latte/Runtime/XmlHelpers.php +108 -0
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/FunctionCallNode.php +12 -4
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/MethodCallNode.php +15 -5
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/PropertyFetchNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/SandboxNode.php +5 -6
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/StaticMethodCallNode.php +14 -4
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/StaticPropertyFetchNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Sandbox/RuntimeChecker.php +8 -6
- package/vendor/latte/latte/src/Latte/Sandbox/SandboxExtension.php +16 -12
- package/vendor/latte/latte/src/Latte/Sandbox/SecurityPolicy.php +18 -16
- package/vendor/latte/latte/src/Latte/attributes.php +7 -3
- package/vendor/latte/latte/src/Latte/exceptions.php +52 -6
- package/vendor/latte/latte/src/Tools/Linter.php +74 -28
- package/vendor/latte/latte/src/Tools/LinterExtension.php +176 -0
- package/vendor/nette/utils/composer.json +15 -5
- package/vendor/nette/utils/readme.md +1 -1
- package/vendor/nette/utils/src/HtmlStringable.php +4 -1
- package/vendor/nette/utils/src/Iterators/CachingIterator.php +10 -25
- package/vendor/nette/utils/src/Iterators/Mapper.php +2 -3
- package/vendor/nette/utils/src/SmartObject.php +3 -0
- package/vendor/nette/utils/src/StaticClass.php +1 -11
- package/vendor/nette/utils/src/Translator.php +1 -1
- package/vendor/nette/utils/src/Utils/ArrayHash.php +6 -10
- package/vendor/nette/utils/src/Utils/ArrayList.php +8 -12
- package/vendor/nette/utils/src/Utils/Arrays.php +38 -18
- package/vendor/nette/utils/src/Utils/Callback.php +13 -8
- package/vendor/nette/utils/src/Utils/DateTime.php +95 -26
- package/vendor/nette/utils/src/Utils/FileInfo.php +6 -7
- package/vendor/nette/utils/src/Utils/FileSystem.php +10 -5
- package/vendor/nette/utils/src/Utils/Finder.php +31 -12
- package/vendor/nette/utils/src/Utils/Floats.php +1 -0
- package/vendor/nette/utils/src/Utils/Helpers.php +22 -2
- package/vendor/nette/utils/src/Utils/Html.php +130 -127
- package/vendor/nette/utils/src/Utils/Image.php +80 -60
- package/vendor/nette/utils/src/Utils/ImageColor.php +5 -0
- package/vendor/nette/utils/src/Utils/ImageType.php +2 -0
- package/vendor/nette/utils/src/Utils/Iterables.php +41 -7
- package/vendor/nette/utils/src/Utils/Json.php +2 -0
- package/vendor/nette/utils/src/Utils/ObjectHelpers.php +2 -0
- package/vendor/nette/utils/src/Utils/Paginator.php +10 -43
- package/vendor/nette/utils/src/Utils/Random.php +2 -0
- package/vendor/nette/utils/src/Utils/Reflection.php +22 -15
- package/vendor/nette/utils/src/Utils/ReflectionMethod.php +6 -1
- package/vendor/nette/utils/src/Utils/Strings.php +62 -57
- package/vendor/nette/utils/src/Utils/Type.php +91 -42
- package/vendor/nette/utils/src/Utils/Validators.php +9 -7
- package/vendor/latte/latte/src/Bridges/Tracy/templates/LattePanel.panel.phtml +0 -101
- package/vendor/latte/latte/src/Bridges/Tracy/templates/LattePanel.tab.phtml +0 -15
- package/vendor/latte/latte/src/Latte/Compiler/ExpressionBuilder.php +0 -129
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ErrorSuppressNode.php +0 -36
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/FunctionCallableNode.php +0 -39
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/MethodCallableNode.php +0 -42
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/StaticMethodCallableNode.php +0 -57
- package/vendor/latte/latte/src/Latte/PositionAwareException.php +0 -47
- package/vendor/latte/latte/src/Latte/Runtime/Filters.php +0 -283
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/FunctionCallableNode.php +0 -29
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/MethodCallableNode.php +0 -30
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/StaticMethodCallableNode.php +0 -30
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare(strict_types=1);
|
|
9
|
-
|
|
10
8
|
namespace Latte\Compiler\Nodes\Php;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Node;
|
|
13
11
|
use Latte\Compiler\Position;
|
|
14
12
|
use Latte\Compiler\PrintContext;
|
|
13
|
+
use Latte\Helpers;
|
|
15
14
|
|
|
16
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Chain of filters with auto-escape flag.
|
|
18
|
+
*/
|
|
17
19
|
class ModifierNode extends Node
|
|
18
20
|
{
|
|
21
|
+
/** @deprecated */
|
|
22
|
+
public bool $check = true;
|
|
23
|
+
|
|
24
|
+
|
|
19
25
|
public function __construct(
|
|
20
26
|
/** @var FilterNode[] */
|
|
21
27
|
public array $filters,
|
|
22
28
|
public bool $escape = false,
|
|
23
|
-
public bool $check = true,
|
|
24
29
|
public ?Position $position = null,
|
|
25
30
|
) {
|
|
26
31
|
(function (FilterNode ...$args) {})(...$filters);
|
|
@@ -39,6 +44,18 @@ class ModifierNode extends Node
|
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
|
|
47
|
+
public function removeFilter(string $name): ?FilterNode
|
|
48
|
+
{
|
|
49
|
+
foreach ($this->filters as $i => $filter) {
|
|
50
|
+
if ($filter->name->name === $name) {
|
|
51
|
+
return array_splice($this->filters, $i, 1)[0];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
42
59
|
public function print(PrintContext $context): string
|
|
43
60
|
{
|
|
44
61
|
throw new \LogicException('Cannot directly print ModifierNode');
|
|
@@ -47,54 +64,24 @@ class ModifierNode extends Node
|
|
|
47
64
|
|
|
48
65
|
public function printSimple(PrintContext $context, string $expr): string
|
|
49
66
|
{
|
|
50
|
-
$
|
|
51
|
-
$check = $this->check;
|
|
52
|
-
foreach ($this->filters as $filter) {
|
|
53
|
-
$name = $filter->name->name;
|
|
54
|
-
if ($name === 'nocheck' || $name === 'noCheck') {
|
|
55
|
-
$check = false;
|
|
56
|
-
} elseif ($name === 'noescape') {
|
|
57
|
-
$escape = false;
|
|
58
|
-
} else {
|
|
59
|
-
if ($name === 'datastream' || $name === 'dataStream') {
|
|
60
|
-
$check = false;
|
|
61
|
-
}
|
|
62
|
-
$expr = $filter->printSimple($context, $expr);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
67
|
+
$expr = FilterNode::printSimple($context, $this->filters, $expr);
|
|
65
68
|
|
|
66
69
|
$escaper = $context->getEscaper();
|
|
67
|
-
|
|
68
|
-
$expr = $escaper->check($expr);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
$expr = $escape
|
|
70
|
+
return $this->escape
|
|
72
71
|
? $escaper->escape($expr)
|
|
73
|
-
: $escaper->escapeMandatory($expr);
|
|
74
|
-
|
|
75
|
-
return $expr;
|
|
72
|
+
: $escaper->escapeMandatory($expr, $this->position);
|
|
76
73
|
}
|
|
77
74
|
|
|
78
75
|
|
|
79
76
|
public function printContentAware(PrintContext $context, string $expr): string
|
|
80
77
|
{
|
|
81
78
|
foreach ($this->filters as $filter) {
|
|
82
|
-
$
|
|
83
|
-
if ($name === 'noescape') {
|
|
84
|
-
$noescape = true;
|
|
85
|
-
} else {
|
|
86
|
-
$expr = $filter->printContentAware($context, $expr);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if ($this->escape && empty($noescape)) {
|
|
91
|
-
$expr = 'LR\Filters::convertTo($ʟ_fi, '
|
|
92
|
-
. var_export($context->getEscaper()->export(), true) . ', '
|
|
93
|
-
. $expr
|
|
94
|
-
. ')';
|
|
79
|
+
$expr = $filter->printContentAware($context, $expr);
|
|
95
80
|
}
|
|
96
81
|
|
|
97
|
-
return $
|
|
82
|
+
return $this->escape
|
|
83
|
+
? $context->getEscaper()->escapeContent($expr)
|
|
84
|
+
: $expr;
|
|
98
85
|
}
|
|
99
86
|
|
|
100
87
|
|
|
@@ -103,5 +90,6 @@ class ModifierNode extends Node
|
|
|
103
90
|
foreach ($this->filters as &$filter) {
|
|
104
91
|
yield $filter;
|
|
105
92
|
}
|
|
93
|
+
Helpers::removeNulls($this->filters);
|
|
106
94
|
}
|
|
107
95
|
}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare(strict_types=1);
|
|
9
|
-
|
|
10
8
|
namespace Latte\Compiler\Nodes\Php;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Node;
|
|
13
11
|
use Latte\Compiler\Position;
|
|
14
12
|
use Latte\Compiler\PrintContext;
|
|
13
|
+
use function array_flip, str_starts_with, strtolower, substr;
|
|
15
14
|
|
|
16
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Qualified name for functions, classes, or constants (\Foo\Bar).
|
|
18
|
+
*/
|
|
17
19
|
class NameNode extends Node
|
|
18
20
|
{
|
|
19
21
|
public const
|
|
@@ -34,6 +36,9 @@ class NameNode extends Node
|
|
|
34
36
|
$this->kind = self::KindFullyQualified;
|
|
35
37
|
$this->name = substr($name, 1);
|
|
36
38
|
} else {
|
|
39
|
+
if ($kind === -1 && !str_starts_with($name, '__')) {
|
|
40
|
+
trigger_error("Using unqualified constant '$name' is deprecated. Use '\\$name' with a leading backslash $position", E_USER_DEPRECATED);
|
|
41
|
+
}
|
|
37
42
|
$this->kind = self::KindNormal;
|
|
38
43
|
}
|
|
39
44
|
}
|
|
@@ -44,7 +49,7 @@ class NameNode extends Node
|
|
|
44
49
|
static $keywords;
|
|
45
50
|
$keywords ??= array_flip([ // https://www.php.net/manual/en/reserved.keywords.php
|
|
46
51
|
'__halt_compiler', '__class__', '__dir__', '__file__', '__function__', '__line__', '__method__', '__namespace__', '__trait__',
|
|
47
|
-
'abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch', 'class', '
|
|
52
|
+
'abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch', 'class', 'const', 'continue', 'declare',
|
|
48
53
|
'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch',
|
|
49
54
|
'endwhile', 'eval', 'exit', 'extends', 'final', 'finally', 'fn', 'for', 'foreach', 'function', 'global', 'goto', 'if',
|
|
50
55
|
'implements', 'include', 'include_once', 'instanceof', 'insteadof', 'interface', 'isset', 'list', 'match', 'namespace',
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare(strict_types=1);
|
|
9
|
-
|
|
10
8
|
namespace Latte\Compiler\Nodes\Php;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Position;
|
|
13
11
|
use Latte\Compiler\PrintContext;
|
|
14
12
|
|
|
15
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Nullable type (?Type).
|
|
16
|
+
*/
|
|
16
17
|
class NullableTypeNode extends ComplexTypeNode
|
|
17
18
|
{
|
|
18
19
|
public function __construct(
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This file is part of the Latte (https://latte.nette.org)
|
|
5
|
+
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
namespace Latte\Compiler\Nodes\Php;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Interface for expression nodes that represent operators with precedence.
|
|
13
|
+
*/
|
|
14
|
+
interface OperatorNode
|
|
15
|
+
{
|
|
16
|
+
/** Operator associativity or position */
|
|
17
|
+
public const
|
|
18
|
+
AssocLeft = -1,
|
|
19
|
+
AssocNone = 0,
|
|
20
|
+
AssocRight = 1;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Returns [precedence, associativity] for this operator.
|
|
24
|
+
* @return array{int, self::AssocLeft|self::AssocNone|self::AssocRight}
|
|
25
|
+
*/
|
|
26
|
+
public function getOperatorPrecedence(): array;
|
|
27
|
+
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare(strict_types=1);
|
|
9
|
-
|
|
10
8
|
namespace Latte\Compiler\Nodes\Php;
|
|
11
9
|
|
|
12
10
|
use Latte\CompileException;
|
|
@@ -15,6 +13,9 @@ use Latte\Compiler\Position;
|
|
|
15
13
|
use Latte\Compiler\PrintContext;
|
|
16
14
|
|
|
17
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Function parameter with type, default value, and variadic support.
|
|
18
|
+
*/
|
|
18
19
|
class ParameterNode extends Node
|
|
19
20
|
{
|
|
20
21
|
public function __construct(
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare(strict_types=1);
|
|
9
|
-
|
|
10
8
|
namespace Latte\Compiler\Nodes\Php\Scalar;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\Php\ScalarNode;
|
|
@@ -14,6 +12,9 @@ use Latte\Compiler\Position;
|
|
|
14
12
|
use Latte\Compiler\PrintContext;
|
|
15
13
|
|
|
16
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Boolean literal (true/false).
|
|
17
|
+
*/
|
|
17
18
|
class BooleanNode extends ScalarNode
|
|
18
19
|
{
|
|
19
20
|
public function __construct(
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare(strict_types=1);
|
|
9
|
-
|
|
10
8
|
namespace Latte\Compiler\Nodes\Php\Scalar;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\Php\ScalarNode;
|
|
13
11
|
use Latte\Compiler\PhpHelpers;
|
|
14
12
|
use Latte\Compiler\Position;
|
|
15
13
|
use Latte\Compiler\PrintContext;
|
|
14
|
+
use function is_finite, preg_match, sprintf, str_replace, strpbrk;
|
|
15
|
+
use const INF;
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Floating-point literal including infinity and NaN.
|
|
20
|
+
*/
|
|
18
21
|
class FloatNode extends ScalarNode
|
|
19
22
|
{
|
|
20
23
|
public function __construct(
|
|
@@ -24,7 +27,7 @@ class FloatNode extends ScalarNode
|
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
|
|
27
|
-
public static function parse(string $str, Position $position): static
|
|
30
|
+
public static function parse(string $str, ?Position $position): static
|
|
28
31
|
{
|
|
29
32
|
return strpbrk($str, '.eE') === false
|
|
30
33
|
? new static((float) PhpHelpers::decodeNumber($str), $position)
|
|
@@ -35,9 +38,9 @@ class FloatNode extends ScalarNode
|
|
|
35
38
|
public function print(PrintContext $context): string
|
|
36
39
|
{
|
|
37
40
|
if (!is_finite($this->value)) {
|
|
38
|
-
if ($this->value ===
|
|
41
|
+
if ($this->value === INF) {
|
|
39
42
|
return '\INF';
|
|
40
|
-
} elseif ($this->value ===
|
|
43
|
+
} elseif ($this->value === -INF) {
|
|
41
44
|
return '-\INF';
|
|
42
45
|
} else {
|
|
43
46
|
return '\NAN';
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare(strict_types=1);
|
|
9
|
-
|
|
10
8
|
namespace Latte\Compiler\Nodes\Php\Scalar;
|
|
11
9
|
|
|
12
10
|
use Latte\CompileException;
|
|
@@ -14,8 +12,12 @@ use Latte\Compiler\Nodes\Php\ScalarNode;
|
|
|
14
12
|
use Latte\Compiler\PhpHelpers;
|
|
15
13
|
use Latte\Compiler\Position;
|
|
16
14
|
use Latte\Compiler\PrintContext;
|
|
15
|
+
use const PHP_INT_MAX;
|
|
17
16
|
|
|
18
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Integer literal in decimal, hex, octal, or binary notation.
|
|
20
|
+
*/
|
|
19
21
|
class IntegerNode extends ScalarNode
|
|
20
22
|
{
|
|
21
23
|
public const KindBinary = 2;
|
|
@@ -32,7 +34,7 @@ class IntegerNode extends ScalarNode
|
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
|
|
35
|
-
public static function parse(string $str, Position $position): static
|
|
37
|
+
public static function parse(string $str, ?Position $position): static
|
|
36
38
|
{
|
|
37
39
|
$num = PhpHelpers::decodeNumber($str, $base);
|
|
38
40
|
if ($num === null) {
|
|
@@ -44,9 +46,9 @@ class IntegerNode extends ScalarNode
|
|
|
44
46
|
|
|
45
47
|
public function print(PrintContext $context): string
|
|
46
48
|
{
|
|
47
|
-
if ($this->value ===
|
|
49
|
+
if ($this->value === -PHP_INT_MAX - 1) {
|
|
48
50
|
// PHP_INT_MIN cannot be represented as a literal, because the sign is not part of the literal
|
|
49
|
-
return '(-' .
|
|
51
|
+
return '(-' . PHP_INT_MAX . '-1)';
|
|
50
52
|
|
|
51
53
|
} elseif ($this->kind === self::KindDecimal) {
|
|
52
54
|
return (string) $this->value;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare(strict_types=1);
|
|
9
|
-
|
|
10
8
|
namespace Latte\Compiler\Nodes\Php\Scalar;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\Php\ExpressionNode;
|
|
@@ -15,8 +13,13 @@ use Latte\Compiler\Nodes\Php\ScalarNode;
|
|
|
15
13
|
use Latte\Compiler\PhpHelpers;
|
|
16
14
|
use Latte\Compiler\Position;
|
|
17
15
|
use Latte\Compiler\PrintContext;
|
|
16
|
+
use Latte\Helpers;
|
|
17
|
+
use function substr;
|
|
18
18
|
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Double-quoted string with embedded expressions ("Hello $name").
|
|
22
|
+
*/
|
|
20
23
|
class InterpolatedStringNode extends ScalarNode
|
|
21
24
|
{
|
|
22
25
|
public function __construct(
|
|
@@ -27,8 +30,8 @@ class InterpolatedStringNode extends ScalarNode
|
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
|
|
30
|
-
/** @param array<ExpressionNode|InterpolatedStringPartNode>
|
|
31
|
-
public static function parse(array $parts, Position $position): static
|
|
33
|
+
/** @param array<ExpressionNode|InterpolatedStringPartNode> $parts */
|
|
34
|
+
public static function parse(array $parts, ?Position $position): static
|
|
32
35
|
{
|
|
33
36
|
foreach ($parts as $part) {
|
|
34
37
|
if ($part instanceof InterpolatedStringPartNode) {
|
|
@@ -70,5 +73,6 @@ class InterpolatedStringNode extends ScalarNode
|
|
|
70
73
|
foreach ($this->parts as &$item) {
|
|
71
74
|
yield $item;
|
|
72
75
|
}
|
|
76
|
+
Helpers::removeNulls($this->parts);
|
|
73
77
|
}
|
|
74
78
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare(strict_types=1);
|
|
9
|
-
|
|
10
8
|
namespace Latte\Compiler\Nodes\Php\Scalar;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\Php\ScalarNode;
|
|
@@ -14,6 +12,9 @@ use Latte\Compiler\Position;
|
|
|
14
12
|
use Latte\Compiler\PrintContext;
|
|
15
13
|
|
|
16
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Null literal.
|
|
17
|
+
*/
|
|
17
18
|
class NullNode extends ScalarNode
|
|
18
19
|
{
|
|
19
20
|
public function __construct(
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare(strict_types=1);
|
|
9
|
-
|
|
10
8
|
namespace Latte\Compiler\Nodes\Php\Scalar;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\Php\ScalarNode;
|
|
13
11
|
use Latte\Compiler\PhpHelpers;
|
|
14
12
|
use Latte\Compiler\Position;
|
|
15
13
|
use Latte\Compiler\PrintContext;
|
|
14
|
+
use function strtr, substr;
|
|
16
15
|
|
|
17
16
|
|
|
17
|
+
/**
|
|
18
|
+
* String literal, single or double quoted.
|
|
19
|
+
*/
|
|
18
20
|
class StringNode extends ScalarNode
|
|
19
21
|
{
|
|
20
22
|
public function __construct(
|
|
@@ -24,7 +26,7 @@ class StringNode extends ScalarNode
|
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
|
|
27
|
-
public static function parse(string $str, Position $position): static
|
|
29
|
+
public static function parse(string $str, ?Position $position): static
|
|
28
30
|
{
|
|
29
31
|
$str = $str[0] === "'"
|
|
30
32
|
? strtr(substr($str, 1, -1), ['\\\\' => '\\', "\\'" => "'"])
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare(strict_types=1);
|
|
9
|
-
|
|
10
8
|
namespace Latte\Compiler\Nodes\Php;
|
|
11
9
|
|
|
12
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Base for literal value nodes (strings, numbers, booleans, null).
|
|
13
|
+
*/
|
|
13
14
|
abstract class ScalarNode extends ExpressionNode
|
|
14
15
|
{
|
|
15
16
|
public function &getIterator(): \Generator
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare(strict_types=1);
|
|
9
|
-
|
|
10
8
|
namespace Latte\Compiler\Nodes\Php;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Position;
|
|
13
11
|
use Latte\Compiler\PrintContext;
|
|
14
12
|
|
|
15
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Type not expressible in native PHP syntax (e.g., int[], array<K,V>).
|
|
16
|
+
*/
|
|
16
17
|
class SuperiorTypeNode extends ComplexTypeNode
|
|
17
18
|
{
|
|
18
19
|
public function __construct(
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare(strict_types=1);
|
|
9
|
-
|
|
10
8
|
namespace Latte\Compiler\Nodes\Php;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Position;
|
|
13
11
|
use Latte\Compiler\PrintContext;
|
|
12
|
+
use Latte\Helpers;
|
|
14
13
|
|
|
15
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Union type (Type1|Type2).
|
|
17
|
+
*/
|
|
16
18
|
class UnionTypeNode extends ComplexTypeNode
|
|
17
19
|
{
|
|
18
20
|
public function __construct(
|
|
@@ -35,5 +37,6 @@ class UnionTypeNode extends ComplexTypeNode
|
|
|
35
37
|
foreach ($this->types as &$item) {
|
|
36
38
|
yield $item;
|
|
37
39
|
}
|
|
40
|
+
Helpers::removeNulls($this->types);
|
|
38
41
|
}
|
|
39
42
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
declare(strict_types=1);
|
|
9
|
-
|
|
10
8
|
namespace Latte\Compiler\Nodes\Php;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\PrintContext;
|
|
13
11
|
|
|
14
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Identifier for static property name in Foo::$bar syntax.
|
|
15
|
+
*/
|
|
15
16
|
class VarLikeIdentifierNode extends IdentifierNode
|
|
16
17
|
{
|
|
17
18
|
public function print(PrintContext $context): string
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
namespace Latte\Compiler\Nodes\Php;
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
use Latte\Compiler\Nodes\Php\ExpressionNode;
|
|
10
|
+
use Latte\Compiler\Node;
|
|
13
11
|
use Latte\Compiler\Position;
|
|
14
12
|
use Latte\Compiler\PrintContext;
|
|
15
13
|
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Placeholder ... for partial function application or first-class callable creation.
|
|
17
|
+
*/
|
|
18
|
+
class VariadicPlaceholderNode extends Node
|
|
18
19
|
{
|
|
19
20
|
public function __construct(
|
|
20
|
-
public ExpressionNode $expr,
|
|
21
21
|
public ?Position $position = null,
|
|
22
22
|
) {
|
|
23
23
|
}
|
|
@@ -25,12 +25,12 @@ class NotNode extends ExpressionNode
|
|
|
25
25
|
|
|
26
26
|
public function print(PrintContext $context): string
|
|
27
27
|
{
|
|
28
|
-
return
|
|
28
|
+
return '...';
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
public function &getIterator(): \Generator
|
|
33
33
|
{
|
|
34
|
-
yield
|
|
34
|
+
false && yield;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
<?php
|
|
1
|
+
<?php declare(strict_types=1);
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is part of the Latte (https://latte.nette.org)
|
|
5
5
|
* Copyright (c) 2008 David Grudl (https://davidgrudl.com)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
namespace Latte\Compiler\Nodes;
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
use Latte\CompileException;
|
|
10
|
+
use Latte;
|
|
13
11
|
use Latte\Compiler\Nodes\Php\ExpressionNode;
|
|
14
12
|
use Latte\Compiler\Nodes\Php\ModifierNode;
|
|
15
|
-
use Latte\Compiler\Nodes\StatementNode;
|
|
16
13
|
use Latte\Compiler\PrintContext;
|
|
17
14
|
use Latte\Compiler\Tag;
|
|
18
15
|
use Latte\Compiler\TemplateParser;
|
|
19
16
|
|
|
20
17
|
|
|
21
18
|
/**
|
|
22
|
-
* {=
|
|
19
|
+
* {= $expr|filter}
|
|
20
|
+
* Outputs escaped expression.
|
|
23
21
|
*/
|
|
24
22
|
class PrintNode extends StatementNode
|
|
25
23
|
{
|
|
26
24
|
public ExpressionNode $expression;
|
|
27
25
|
public ModifierNode $modifier;
|
|
28
|
-
private ?string $followsQuote = null;
|
|
29
26
|
|
|
30
27
|
|
|
31
28
|
public static function create(Tag $tag, TemplateParser $parser): static
|
|
@@ -33,21 +30,15 @@ class PrintNode extends StatementNode
|
|
|
33
30
|
$tag->outputMode = $tag::OutputKeepIndentation;
|
|
34
31
|
$tag->expectArguments();
|
|
35
32
|
$node = new static;
|
|
36
|
-
$node->followsQuote = preg_match('#["\']#A', $parser->getStream()->peek()->text)
|
|
37
|
-
? $tag->getNotation(true)
|
|
38
|
-
: null;
|
|
39
33
|
$node->expression = $tag->parser->parseExpression();
|
|
40
34
|
$node->modifier = $tag->parser->parseModifier();
|
|
41
|
-
$node->modifier->escape =
|
|
35
|
+
$node->modifier->escape = !$node->modifier->removeFilter('noescape');
|
|
42
36
|
return $node;
|
|
43
37
|
}
|
|
44
38
|
|
|
45
39
|
|
|
46
40
|
public function print(PrintContext $context): string
|
|
47
41
|
{
|
|
48
|
-
if ($this->followsQuote && $context->getEscaper()->export() === 'html/raw/js') {
|
|
49
|
-
throw new CompileException("Do not place {$this->followsQuote} inside quotes in JavaScript.", $this->position);
|
|
50
|
-
}
|
|
51
42
|
return $context->format(
|
|
52
43
|
"echo %modify(%node) %line;\n",
|
|
53
44
|
$this->modifier,
|
|
@@ -63,3 +54,6 @@ class PrintNode extends StatementNode
|
|
|
63
54
|
yield $this->modifier;
|
|
64
55
|
}
|
|
65
56
|
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class_alias(PrintNode::class, Latte\Essential\Nodes\PrintNode::class);
|