@vituum/vite-plugin-latte 2.0.0-next.5 → 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 +2 -1
- package/package.json +10 -9
- package/vendor/composer/autoload_classmap.php +3 -2
- package/vendor/composer/autoload_static.php +3 -2
- package/vendor/composer/installed.json +21 -17
- package/vendor/composer/installed.php +8 -8
- package/vendor/latte/latte/composer.json +9 -2
- package/vendor/latte/latte/src/Bridges/Tracy/BlueScreenPanel.php +7 -7
- package/vendor/latte/latte/src/Bridges/Tracy/LattePanel.php +5 -4
- package/vendor/latte/latte/src/Bridges/Tracy/TracyExtension.php +2 -4
- package/vendor/latte/latte/src/Bridges/Tracy/dist/panel.phtml +2 -4
- package/vendor/latte/latte/src/Bridges/Tracy/dist/tab.phtml +2 -4
- package/vendor/latte/latte/src/Latte/Compiler/Block.php +1 -3
- package/vendor/latte/latte/src/Latte/Compiler/Escaper.php +4 -8
- package/vendor/latte/latte/src/Latte/Compiler/Node.php +6 -3
- package/vendor/latte/latte/src/Latte/Compiler/NodeHelpers.php +15 -6
- package/vendor/latte/latte/src/Latte/Compiler/NodeTraverser.php +14 -9
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/AreaNode.php +7 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/AuxiliaryNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/FragmentNode.php +5 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Html/AttributeNode.php +6 -5
- 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 +5 -7
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Html/ExpressionAttributeNode.php +6 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Html/TagNode.php +1 -3
- 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 -3
- 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 +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/AssignNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/AssignOpNode.php +5 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/AuxiliaryNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/BinaryOpNode.php +5 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/CastNode.php +4 -3
- 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 +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ClosureNode.php +7 -6
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ConstantFetchNode.php +5 -4
- 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 +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/FunctionCallNode.php +4 -3
- 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 +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/IssetNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/MatchNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/MethodCallNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/NewNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/PostOpNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/PreOpNode.php +4 -3
- 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 +4 -3
- 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 +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/UnaryOpNode.php +4 -3
- 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 +4 -3
- 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 +4 -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 +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/ModifierNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/NameNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/NullableTypeNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/OperatorNode.php +1 -3
- 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 +5 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/IntegerNode.php +5 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/InterpolatedStringNode.php +6 -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 +5 -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 +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/VarLikeIdentifierNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/VariadicPlaceholderNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/PrintNode.php +3 -4
- 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 +5 -4
- package/vendor/latte/latte/src/Latte/Compiler/PhpHelpers.php +23 -15
- package/vendor/latte/latte/src/Latte/Compiler/Position.php +5 -7
- package/vendor/latte/latte/src/Latte/Compiler/PrintContext.php +30 -9
- package/vendor/latte/latte/src/Latte/Compiler/Tag.php +6 -6
- package/vendor/latte/latte/src/Latte/Compiler/TagLexer.php +4 -6
- package/vendor/latte/latte/src/Latte/Compiler/TagParser.php +14 -11
- package/vendor/latte/latte/src/Latte/Compiler/TagParserData.php +2 -4
- package/vendor/latte/latte/src/Latte/Compiler/TemplateGenerator.php +13 -11
- package/vendor/latte/latte/src/Latte/Compiler/TemplateLexer.php +21 -7
- package/vendor/latte/latte/src/Latte/Compiler/TemplateParser.php +32 -19
- package/vendor/latte/latte/src/Latte/Compiler/TemplateParserHtml.php +28 -21
- package/vendor/latte/latte/src/Latte/Compiler/Token.php +10 -9
- package/vendor/latte/latte/src/Latte/Compiler/TokenStream.php +20 -14
- package/vendor/latte/latte/src/Latte/ContentType.php +4 -3
- package/vendor/latte/latte/src/Latte/Engine.php +64 -35
- package/vendor/latte/latte/src/Latte/Essential/AuxiliaryIterator.php +3 -7
- package/vendor/latte/latte/src/Latte/Essential/Blueprint.php +4 -5
- package/vendor/latte/latte/src/Latte/Essential/CachingIterator.php +2 -3
- package/vendor/latte/latte/src/Latte/Essential/CoreExtension.php +1 -3
- package/vendor/latte/latte/src/Latte/Essential/Filters.php +65 -32
- package/vendor/latte/latte/src/Latte/Essential/Nodes/BlockNode.php +8 -6
- 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 +2 -4
- package/vendor/latte/latte/src/Latte/Essential/Nodes/DebugbreakNode.php +2 -3
- package/vendor/latte/latte/src/Latte/Essential/Nodes/DefineNode.php +6 -6
- 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 +3 -5
- 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 +3 -5
- package/vendor/latte/latte/src/Latte/Essential/Nodes/ForeachNode.php +7 -8
- 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 +6 -9
- package/vendor/latte/latte/src/Latte/Essential/Nodes/ImportNode.php +3 -4
- package/vendor/latte/latte/src/Latte/Essential/Nodes/IncludeBlockNode.php +8 -7
- package/vendor/latte/latte/src/Latte/Essential/Nodes/IncludeFileNode.php +2 -4
- 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 +3 -5
- package/vendor/latte/latte/src/Latte/Essential/Nodes/NClassNode.php +3 -4
- package/vendor/latte/latte/src/Latte/Essential/Nodes/NElseNode.php +8 -5
- package/vendor/latte/latte/src/Latte/Essential/Nodes/NTagNode.php +4 -4
- package/vendor/latte/latte/src/Latte/Essential/Nodes/ParametersNode.php +4 -4
- package/vendor/latte/latte/src/Latte/Essential/Nodes/RawPhpNode.php +2 -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 +3 -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 +3 -4
- package/vendor/latte/latte/src/Latte/Essential/Nodes/TryNode.php +4 -5
- package/vendor/latte/latte/src/Latte/Essential/Nodes/VarNode.php +8 -7
- 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 +26 -15
- package/vendor/latte/latte/src/Latte/Essential/RawPhpExtension.php +1 -3
- package/vendor/latte/latte/src/Latte/Essential/RollbackException.php +1 -3
- package/vendor/latte/latte/src/Latte/Essential/Tracer.php +20 -13
- package/vendor/latte/latte/src/Latte/Essential/TranslatorExtension.php +9 -10
- package/vendor/latte/latte/src/Latte/Extension.php +10 -6
- package/vendor/latte/latte/src/Latte/Feature.php +24 -0
- package/vendor/latte/latte/src/Latte/Helpers.php +18 -10
- package/vendor/latte/latte/src/Latte/Loader.php +1 -3
- package/vendor/latte/latte/src/Latte/Loaders/FileLoader.php +8 -5
- package/vendor/latte/latte/src/Latte/Loaders/StringLoader.php +5 -13
- 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/{Cache.php → Runtime/Cache.php} +12 -11
- package/vendor/latte/latte/src/Latte/Runtime/FilterExecutor.php +3 -5
- package/vendor/latte/latte/src/Latte/Runtime/FilterInfo.php +10 -11
- package/vendor/latte/latte/src/Latte/Runtime/FunctionExecutor.php +4 -6
- package/vendor/latte/latte/src/Latte/Runtime/Helpers.php +5 -7
- package/vendor/latte/latte/src/Latte/Runtime/Html.php +3 -5
- package/vendor/latte/latte/src/Latte/Runtime/HtmlHelpers.php +18 -18
- package/vendor/latte/latte/src/Latte/Runtime/HtmlStringable.php +1 -3
- package/vendor/latte/latte/src/Latte/Runtime/Template.php +23 -42
- package/vendor/latte/latte/src/Latte/Runtime/XmlHelpers.php +5 -7
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/FunctionCallNode.php +14 -8
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/MethodCallNode.php +17 -11
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/PropertyFetchNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/SandboxNode.php +3 -4
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/StaticMethodCallNode.php +16 -10
- package/vendor/latte/latte/src/Latte/Sandbox/Nodes/StaticPropertyFetchNode.php +4 -3
- package/vendor/latte/latte/src/Latte/Sandbox/RuntimeChecker.php +6 -5
- package/vendor/latte/latte/src/Latte/Sandbox/SandboxExtension.php +5 -4
- package/vendor/latte/latte/src/Latte/Sandbox/SecurityPolicy.php +17 -16
- package/vendor/latte/latte/src/Latte/attributes.php +7 -3
- package/vendor/latte/latte/src/Latte/exceptions.php +38 -3
- package/vendor/latte/latte/src/Tools/Linter.php +20 -14
- package/vendor/latte/latte/src/Tools/LinterExtension.php +26 -7
- package/vendor/nette/utils/composer.json +8 -1
- package/vendor/nette/utils/src/HtmlStringable.php +4 -1
- package/vendor/nette/utils/src/Iterators/CachingIterator.php +9 -24
- 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 -1
- package/vendor/nette/utils/src/Translator.php +1 -1
- package/vendor/nette/utils/src/Utils/ArrayHash.php +1 -5
- package/vendor/nette/utils/src/Utils/ArrayList.php +3 -6
- package/vendor/nette/utils/src/Utils/Arrays.php +33 -10
- package/vendor/nette/utils/src/Utils/Callback.php +12 -7
- package/vendor/nette/utils/src/Utils/DateTime.php +1 -1
- package/vendor/nette/utils/src/Utils/FileInfo.php +5 -7
- package/vendor/nette/utils/src/Utils/FileSystem.php +5 -2
- package/vendor/nette/utils/src/Utils/Finder.php +27 -8
- package/vendor/nette/utils/src/Utils/Helpers.php +7 -1
- package/vendor/nette/utils/src/Utils/Html.php +123 -118
- package/vendor/nette/utils/src/Utils/Image.php +72 -54
- package/vendor/nette/utils/src/Utils/ImageColor.php +4 -0
- package/vendor/nette/utils/src/Utils/Iterables.php +16 -8
- package/vendor/nette/utils/src/Utils/Paginator.php +10 -43
- package/vendor/nette/utils/src/Utils/Reflection.php +17 -7
- package/vendor/nette/utils/src/Utils/ReflectionMethod.php +4 -1
- package/vendor/nette/utils/src/Utils/Strings.php +48 -15
- package/vendor/nette/utils/src/Utils/Type.php +41 -27
- package/vendor/nette/utils/src/Utils/Validators.php +8 -7
- package/vendor/latte/latte/src/Bridges/Tracy/panel.latte +0 -94
- package/vendor/latte/latte/src/Bridges/Tracy/tab.latte +0 -8
- package/vendor/latte/latte/src/Latte/PositionAwareException.php +0 -47
|
@@ -1,17 +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;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Node;
|
|
13
11
|
|
|
14
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Base for nodes representing template content that produces output.
|
|
15
|
+
*
|
|
16
|
+
* Includes text, HTML elements, and Latte tags. Extend StatementNode
|
|
17
|
+
* for custom Latte tags, or AreaNode directly for passive content.
|
|
18
|
+
*/
|
|
15
19
|
abstract class AreaNode extends Node
|
|
16
20
|
{
|
|
17
21
|
}
|
|
@@ -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;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Node;
|
|
13
11
|
use Latte\Compiler\PrintContext;
|
|
14
12
|
|
|
15
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Code generator hidden from compiler passes. Pass child nodes for traversal.
|
|
16
|
+
*/
|
|
16
17
|
class AuxiliaryNode extends AreaNode
|
|
17
18
|
{
|
|
18
19
|
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;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\PrintContext;
|
|
@@ -14,13 +12,16 @@ use Latte\Helpers;
|
|
|
14
12
|
use function array_merge, count;
|
|
15
13
|
|
|
16
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Container for sequence of child nodes.
|
|
17
|
+
*/
|
|
17
18
|
final class FragmentNode extends AreaNode
|
|
18
19
|
{
|
|
19
20
|
/** @var AreaNode[] */
|
|
20
21
|
public array $children = [];
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
/** @param AreaNode[]
|
|
24
|
+
/** @param AreaNode[] $children */
|
|
24
25
|
public function __construct(array $children = [])
|
|
25
26
|
{
|
|
26
27
|
foreach ($children as $child) {
|
|
@@ -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\Html;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\NodeHelpers;
|
|
@@ -16,6 +14,9 @@ use Latte\Compiler\Position;
|
|
|
16
14
|
use Latte\Compiler\PrintContext;
|
|
17
15
|
|
|
18
16
|
|
|
17
|
+
/**
|
|
18
|
+
* HTML attribute with name, optional value, and quote style.
|
|
19
|
+
*/
|
|
19
20
|
class AttributeNode extends AreaNode
|
|
20
21
|
{
|
|
21
22
|
public function __construct(
|
|
@@ -36,13 +37,13 @@ class AttributeNode extends AreaNode
|
|
|
36
37
|
|
|
37
38
|
$res .= "echo '=';";
|
|
38
39
|
$quote = $this->quote ?? ($this->value instanceof TextNode ? null : '"');
|
|
39
|
-
$res .= $quote ? 'echo ' . var_export($quote, true) . ';' : '';
|
|
40
|
+
$res .= $quote ? 'echo ' . var_export($quote, return: true) . ';' : '';
|
|
40
41
|
|
|
41
42
|
$escaper = $context->beginEscape();
|
|
42
43
|
$escaper->enterHtmlAttribute(NodeHelpers::toText($this->name));
|
|
43
44
|
$res .= $this->value->print($context);
|
|
44
45
|
$context->restoreEscape();
|
|
45
|
-
$res .= $quote ? 'echo ' . var_export($quote, true) . ';' : '';
|
|
46
|
+
$res .= $quote ? 'echo ' . var_export($quote, return: true) . ';' : '';
|
|
46
47
|
return $res;
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -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\Html;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\AreaNode;
|
|
@@ -15,7 +13,7 @@ use Latte\Compiler\PrintContext;
|
|
|
15
13
|
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
|
-
*
|
|
16
|
+
* DOCTYPE or bogus HTML tags.
|
|
19
17
|
*/
|
|
20
18
|
class BogusTagNode extends AreaNode
|
|
21
19
|
{
|
|
@@ -30,11 +28,11 @@ class BogusTagNode extends AreaNode
|
|
|
30
28
|
|
|
31
29
|
public function print(PrintContext $context): string
|
|
32
30
|
{
|
|
33
|
-
$res = 'echo ' . var_export($this->openDelimiter, true) . ';';
|
|
31
|
+
$res = 'echo ' . var_export($this->openDelimiter, return: true) . ';';
|
|
34
32
|
$context->beginEscape()->enterHtmlBogusTag();
|
|
35
33
|
$res .= $this->content->print($context);
|
|
36
34
|
$context->restoreEscape();
|
|
37
|
-
$res .= 'echo ' . var_export($this->endDelimiter, true) . ';';
|
|
35
|
+
$res .= 'echo ' . var_export($this->endDelimiter, return: true) . ';';
|
|
38
36
|
return $res;
|
|
39
37
|
}
|
|
40
38
|
|
|
@@ -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\Html;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\AreaNode;
|
|
@@ -14,6 +12,9 @@ use Latte\Compiler\Position;
|
|
|
14
12
|
use Latte\Compiler\PrintContext;
|
|
15
13
|
|
|
16
14
|
|
|
15
|
+
/**
|
|
16
|
+
* HTML comment (<!-- ... -->).
|
|
17
|
+
*/
|
|
17
18
|
class CommentNode extends AreaNode
|
|
18
19
|
{
|
|
19
20
|
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\Html;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Node;
|
|
@@ -21,7 +19,7 @@ use Latte\ContentType;
|
|
|
21
19
|
|
|
22
20
|
|
|
23
21
|
/**
|
|
24
|
-
* HTML element
|
|
22
|
+
* HTML/XML element with attributes, content, and n:attribute support.
|
|
25
23
|
*/
|
|
26
24
|
class ElementNode extends AreaNode
|
|
27
25
|
{
|
|
@@ -91,16 +89,16 @@ class ElementNode extends AreaNode
|
|
|
91
89
|
? $this->dynamicTag->print($context)
|
|
92
90
|
: (new TagNode($this))->print($context, captureEnd: false);
|
|
93
91
|
|
|
94
|
-
if ($this->content) {
|
|
92
|
+
if ($innerContent = $this->content) {
|
|
95
93
|
if ($this->dynamicTag) {
|
|
96
94
|
$endTag = '$ʟ_tags[' . ($context->generateId()) . ']';
|
|
97
95
|
$res = "\$ʟ_tag = ''; $res $endTag = \$ʟ_tag;";
|
|
98
96
|
} else {
|
|
99
|
-
$endTag = var_export('</' . $this->name . '>', true);
|
|
97
|
+
$endTag = var_export('</' . $this->name . '>', return: true);
|
|
100
98
|
}
|
|
101
99
|
|
|
102
100
|
$context->beginEscape()->enterHtmlText($this);
|
|
103
|
-
$content = $
|
|
101
|
+
$content = $innerContent->print($context);
|
|
104
102
|
$context->restoreEscape();
|
|
105
103
|
$res .= $this->breakable
|
|
106
104
|
? 'try { ' . $content . ' } finally { echo ' . $endTag . '; } '
|
|
@@ -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\Html;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\AreaNode;
|
|
@@ -15,9 +13,13 @@ use Latte\Compiler\Nodes\Php\ModifierNode;
|
|
|
15
13
|
use Latte\Compiler\Position;
|
|
16
14
|
use Latte\Compiler\PrintContext;
|
|
17
15
|
use Latte\ContentType;
|
|
16
|
+
use Latte\Feature;
|
|
18
17
|
use Latte\Runtime as LR;
|
|
19
18
|
|
|
20
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Dynamic HTML attribute generated from expression.
|
|
22
|
+
*/
|
|
21
23
|
class ExpressionAttributeNode extends AreaNode
|
|
22
24
|
{
|
|
23
25
|
public function __construct(
|
|
@@ -44,7 +46,7 @@ class ExpressionAttributeNode extends AreaNode
|
|
|
44
46
|
$this->indentation . $this->name,
|
|
45
47
|
$this->modifier,
|
|
46
48
|
$this->value,
|
|
47
|
-
(!$this->modifier->removeFilter('accept') && $context->
|
|
49
|
+
(!$this->modifier->removeFilter('accept') && $context->hasFeature(Feature::MigrationWarnings)) ?: null,
|
|
48
50
|
$this->value->position,
|
|
49
51
|
);
|
|
50
52
|
}
|
|
@@ -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\Html;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes;
|
|
@@ -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;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\PrintContext;
|
|
13
11
|
|
|
14
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Placeholder for removed or filtered-out content.
|
|
15
|
+
*/
|
|
15
16
|
class NopNode extends AreaNode
|
|
16
17
|
{
|
|
17
18
|
public function print(PrintContext $context): string
|
|
@@ -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\Compiler\Node;
|
|
@@ -14,6 +12,9 @@ use Latte\Compiler\Position;
|
|
|
14
12
|
use Latte\Compiler\PrintContext;
|
|
15
13
|
|
|
16
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Function/method argument with optional name, reference, and unpacking.
|
|
17
|
+
*/
|
|
17
18
|
class ArgumentNode extends Node
|
|
18
19
|
{
|
|
19
20
|
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;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Node;
|
|
@@ -14,6 +12,9 @@ use Latte\Compiler\Position;
|
|
|
14
12
|
use Latte\Compiler\PrintContext;
|
|
15
13
|
|
|
16
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Array item with optional key, reference, and spread operator.
|
|
17
|
+
*/
|
|
17
18
|
class ArrayItemNode extends Node
|
|
18
19
|
{
|
|
19
20
|
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;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Node;
|
|
@@ -15,6 +13,9 @@ use Latte\Compiler\Position;
|
|
|
15
13
|
use Latte\Compiler\PrintContext;
|
|
16
14
|
|
|
17
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Closure use variable ($var or &$var).
|
|
18
|
+
*/
|
|
18
19
|
class ClosureUseNode extends Node
|
|
19
20
|
{
|
|
20
21
|
public function __construct(
|
|
@@ -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\Node;
|
|
13
11
|
|
|
14
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Base for complex type declarations (nullable, union, intersection).
|
|
15
|
+
*/
|
|
15
16
|
abstract class ComplexTypeNode extends Node
|
|
16
17
|
{
|
|
17
18
|
}
|
|
@@ -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\Expression;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\Php\ExpressionNode;
|
|
@@ -14,6 +12,9 @@ use Latte\Compiler\Position;
|
|
|
14
12
|
use Latte\Compiler\PrintContext;
|
|
15
13
|
|
|
16
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Array or string element access ($arr[$key]).
|
|
17
|
+
*/
|
|
17
18
|
class ArrayAccessNode extends ExpressionNode
|
|
18
19
|
{
|
|
19
20
|
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\Expression;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\Php\ArgumentNode;
|
|
@@ -17,6 +15,9 @@ use Latte\Compiler\PrintContext;
|
|
|
17
15
|
use Latte\Helpers;
|
|
18
16
|
|
|
19
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Array literal.
|
|
20
|
+
*/
|
|
20
21
|
class ArrayNode extends ExpressionNode
|
|
21
22
|
{
|
|
22
23
|
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\Expression;
|
|
11
9
|
|
|
12
10
|
use Latte\CompileException;
|
|
@@ -17,6 +15,9 @@ use Latte\Compiler\Position;
|
|
|
17
15
|
use Latte\Compiler\PrintContext;
|
|
18
16
|
|
|
19
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Assignment ($var = expr or $var = &$ref).
|
|
20
|
+
*/
|
|
20
21
|
class AssignNode extends ExpressionNode implements OperatorNode
|
|
21
22
|
{
|
|
22
23
|
public const Precedence = [90, self::AssocRight];
|
|
@@ -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\Expression;
|
|
11
9
|
|
|
12
10
|
use Latte\CompileException;
|
|
@@ -17,6 +15,9 @@ use Latte\Compiler\PrintContext;
|
|
|
17
15
|
use function in_array;
|
|
18
16
|
|
|
19
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Compound assignment ($var += expr, $var .= expr, etc.).
|
|
20
|
+
*/
|
|
20
21
|
class AssignOpNode extends ExpressionNode implements OperatorNode
|
|
21
22
|
{
|
|
22
23
|
private const Ops = ['+', '-', '*', '/', '.', '%', '&', '|', '^', '<<', '>>', '**', '??'];
|
|
@@ -28,7 +29,7 @@ class AssignOpNode extends ExpressionNode implements OperatorNode
|
|
|
28
29
|
public ExpressionNode $expr,
|
|
29
30
|
public ?Position $position = null,
|
|
30
31
|
) {
|
|
31
|
-
if (!in_array($this->operator, self::Ops, true)) {
|
|
32
|
+
if (!in_array($this->operator, self::Ops, strict: true)) {
|
|
32
33
|
throw new \InvalidArgumentException("Unexpected operator '$this->operator'");
|
|
33
34
|
}
|
|
34
35
|
$this->validate();
|
|
@@ -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\Expression;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Node;
|
|
@@ -14,6 +12,9 @@ use Latte\Compiler\Nodes\Php\ExpressionNode;
|
|
|
14
12
|
use Latte\Compiler\PrintContext;
|
|
15
13
|
|
|
16
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Code generator hidden from compiler passes. Pass child nodes for traversal.
|
|
17
|
+
*/
|
|
17
18
|
class AuxiliaryNode extends ExpressionNode
|
|
18
19
|
{
|
|
19
20
|
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\Expression;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\Php\ExpressionNode;
|
|
@@ -16,6 +14,9 @@ use Latte\Compiler\PrintContext;
|
|
|
16
14
|
use function count, in_array, strtolower;
|
|
17
15
|
|
|
18
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Binary operation: arithmetic, logical, bitwise, comparison, null-coalescing, or pipe.
|
|
19
|
+
*/
|
|
19
20
|
class BinaryOpNode extends ExpressionNode implements OperatorNode
|
|
20
21
|
{
|
|
21
22
|
private const Ops = ['||', '&&', 'or', 'and', 'xor', '|', '&', '^', '.', '+', '-', '*', '/', '%', '<<', '>>', '**',
|
|
@@ -28,7 +29,7 @@ class BinaryOpNode extends ExpressionNode implements OperatorNode
|
|
|
28
29
|
public ExpressionNode $right,
|
|
29
30
|
public ?Position $position = null,
|
|
30
31
|
) {
|
|
31
|
-
if (!in_array(strtolower($this->operator), self::Ops, true)) {
|
|
32
|
+
if (!in_array(strtolower($this->operator), self::Ops, strict: true)) {
|
|
32
33
|
throw new \InvalidArgumentException("Unexpected operator '$this->operator'");
|
|
33
34
|
}
|
|
34
35
|
}
|
|
@@ -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\Expression;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\Php\ExpressionNode;
|
|
@@ -15,6 +13,9 @@ use Latte\Compiler\Position;
|
|
|
15
13
|
use Latte\Compiler\PrintContext;
|
|
16
14
|
|
|
17
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Type cast (int), (string), (array), etc.
|
|
18
|
+
*/
|
|
18
19
|
class CastNode extends ExpressionNode implements OperatorNode
|
|
19
20
|
{
|
|
20
21
|
private const Types = ['int' => 1, 'float' => 1, 'string' => 1, 'array' => 1, 'object' => 1, 'bool' => 1];
|
package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ClassConstantFetchNode.php
CHANGED
|
@@ -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\Expression;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\Php\ExpressionNode;
|
|
@@ -16,6 +14,9 @@ use Latte\Compiler\Position;
|
|
|
16
14
|
use Latte\Compiler\PrintContext;
|
|
17
15
|
|
|
18
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Class constant access (Foo::CONST or Foo::class).
|
|
19
|
+
*/
|
|
19
20
|
class ClassConstantFetchNode extends ExpressionNode
|
|
20
21
|
{
|
|
21
22
|
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\Expression;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\Php\ExpressionNode;
|
|
@@ -15,6 +13,9 @@ use Latte\Compiler\Position;
|
|
|
15
13
|
use Latte\Compiler\PrintContext;
|
|
16
14
|
|
|
17
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Object cloning (clone $obj).
|
|
18
|
+
*/
|
|
18
19
|
class CloneNode extends ExpressionNode implements OperatorNode
|
|
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\Expression;
|
|
11
9
|
|
|
12
10
|
use Latte\Compiler\Nodes\Php;
|
|
@@ -17,6 +15,9 @@ use Latte\Compiler\PrintContext;
|
|
|
17
15
|
use Latte\Helpers;
|
|
18
16
|
|
|
19
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Closure or arrow function (fn($x) => $x or function($x) use ($y) {}).
|
|
20
|
+
*/
|
|
20
21
|
class ClosureNode extends ExpressionNode
|
|
21
22
|
{
|
|
22
23
|
public function __construct(
|
|
@@ -36,12 +37,12 @@ class ClosureNode extends ExpressionNode
|
|
|
36
37
|
|
|
37
38
|
public function print(PrintContext $context): string
|
|
38
39
|
{
|
|
39
|
-
$
|
|
40
|
+
$usesByRef = false;
|
|
40
41
|
foreach ($this->uses as $use) {
|
|
41
|
-
$
|
|
42
|
+
$usesByRef = $usesByRef || $use->byRef;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
return $
|
|
45
|
+
return $this->expr && !$usesByRef
|
|
45
46
|
? 'fn' . ($this->byRef ? '&' : '')
|
|
46
47
|
. '(' . $context->implode($this->params) . ')'
|
|
47
48
|
. ($this->returnType !== null ? ': ' . $this->returnType->print($context) : '')
|