gulp-phug 1.3.3 → 1.3.5
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/index.js +23 -8
- package/package.json +4 -4
- package/support/composer.json +1 -1
- package/support/composer.lock +93 -178
- package/support/vendor/autoload.php +15 -0
- package/support/vendor/bin/phug +119 -0
- package/support/vendor/bin/var-dump-server +119 -0
- package/support/vendor/composer/ClassLoader.php +166 -32
- package/support/vendor/composer/InstalledVersions.php +387 -329
- package/support/vendor/composer/autoload_classmap.php +1 -5
- package/support/vendor/composer/autoload_files.php +2 -3
- package/support/vendor/composer/autoload_namespaces.php +1 -1
- package/support/vendor/composer/autoload_psr4.php +3 -4
- package/support/vendor/composer/autoload_real.php +12 -37
- package/support/vendor/composer/autoload_static.php +6 -17
- package/support/vendor/composer/installed.json +97 -184
- package/support/vendor/composer/installed.php +129 -151
- package/support/vendor/composer/platform_check.php +16 -4
- package/support/vendor/phug/phug/.github/workflows/coverage.yml +71 -0
- package/support/vendor/phug/phug/.github/workflows/multi-tester.yml +46 -0
- package/support/vendor/phug/phug/.github/workflows/split.yml +41 -0
- package/support/vendor/phug/phug/.github/workflows/style.yml +48 -0
- package/support/vendor/phug/phug/.github/workflows/tests.yml +49 -0
- package/support/vendor/phug/phug/.multi-tester.yml +42 -10
- package/support/vendor/phug/phug/composer.json +25 -16
- package/support/vendor/phug/phug/phpcs.xml +4 -0
- package/support/vendor/phug/phug/phpunit.xml +2 -0
- package/support/vendor/phug/phug/phug +1 -1
- package/support/vendor/phug/phug/release.php +8 -0
- package/support/vendor/phug/phug/src/Phug/Ast/Ast/Node.php +7 -1
- package/support/vendor/phug/phug/src/Phug/Ast/composer.json +1 -2
- package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/Element/BlockElement.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/AssignmentNodeCompiler.php +9 -1
- package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/AttributeNodeCompiler.php +1 -0
- package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/ElementNodeCompiler.php +6 -0
- package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompiler/ImportNodeCompiler.php +4 -4
- package/support/vendor/phug/phug/src/Phug/Compiler/Compiler/NodeCompilerInterface.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Compiler/composer.json +5 -2
- package/support/vendor/phug/phug/src/Phug/DependencyInjection/DependencyInjection.php +1 -1
- package/support/vendor/phug/phug/src/Phug/DependencyInjection/composer.json +1 -2
- package/support/vendor/phug/phug/src/Phug/Event/Event/ListenerQueue.php +3 -0
- package/support/vendor/phug/phug/src/Phug/Event/EventManagerTrait.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Event/composer.json +1 -2
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/AbstractFormat.php +15 -12
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/AssignmentContainerInterface.php +2 -1
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/AbstractAssignmentContainerElement.php +11 -1
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/AbstractMarkupElement.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/AssignmentElement.php +9 -4
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/AttributeElement.php +4 -1
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/CodeElement.php +2 -2
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/MarkupElement.php +10 -8
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/MixinCallElement.php +2 -1
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Element/MixinElement.php +2 -1
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Format/XmlFormat.php +213 -20
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Partial/AssignmentHelpersTrait.php +7 -4
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Partial/HandleVariable.php +4 -4
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter/Partial/MagicAccessorTrait.php +1 -7
- package/support/vendor/phug/phug/src/Phug/Formatter/Formatter.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Formatter/composer.json +1 -2
- package/support/vendor/phug/phug/src/Phug/Invoker/Invoker.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Invoker/composer.json +5 -2
- package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Partial/IndentStyleTrait.php +5 -5
- package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/AssignmentScanner.php +8 -2
- package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/AttributeScanner.php +23 -11
- package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/ConditionalScanner.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/FilterScanner.php +6 -10
- package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/IndentationScanner.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/KeywordScanner.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/MultilineScanner.php +6 -12
- package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/Partial/TrailingOutdentHandlerTrait.php +26 -0
- package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/Scanner/TextScanner.php +3 -3
- package/support/vendor/phug/phug/src/Phug/Lexer/Lexer/State.php +9 -9
- package/support/vendor/phug/phug/src/Phug/Lexer/composer.json +1 -2
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/Event/NodeEvent.php +3 -2
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/Node/AssignmentNode.php +5 -1
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/Node/AttributeNode.php +4 -1
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/Node/ElementNode.php +5 -1
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/Node/FilterNode.php +2 -1
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/Node/MixinCallNode.php +5 -1
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/Node/MixinNode.php +5 -1
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/AbstractTokenHandler.php +87 -0
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/AssignmentTokenHandler.php +6 -21
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/AttributeEndTokenHandler.php +5 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/AttributeStartTokenHandler.php +7 -23
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/AttributeTokenHandler.php +21 -19
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/AutoCloseTokenHandler.php +5 -17
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/BlockTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/CaseTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/ClassTokenHandler.php +7 -34
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/CodeTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/CommentTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/ConditionalTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/DoTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/DoctypeTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/EachTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/ExpansionTokenHandler.php +5 -11
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/ExpressionTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/FilterTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/ForTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/IdTokenHandler.php +7 -33
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/ImportTokenHandler.php +14 -20
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/IndentTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/InterpolationEndTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/InterpolationStartTokenHandler.php +29 -30
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/KeywordTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/MixinCallTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/MixinTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/NewLineTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/OutdentTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/Partial/StaticAttributeTrait.php +36 -0
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/TagInterpolationEndTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/TagInterpolationStartTokenHandler.php +7 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/TagTokenHandler.php +6 -21
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/TextTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/VariableTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/WhenTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/WhileTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser/TokenHandler/YieldTokenHandler.php +4 -10
- package/support/vendor/phug/phug/src/Phug/Parser/Parser.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Parser/composer.json +1 -2
- package/support/vendor/phug/phug/src/Phug/Phug/Phug/Cli.php +5 -5
- package/support/vendor/phug/phug/src/Phug/Phug/Phug/Partial/ExtensionsTrait.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Phug/Phug/Partial/FacadeOptionsTrait.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Phug/Phug/Phug.php +14 -5
- package/support/vendor/phug/phug/src/Phug/Phug/composer.json +5 -2
- package/support/vendor/phug/phug/src/Phug/Reader/Reader.php +9 -9
- package/support/vendor/phug/phug/src/Phug/Reader/composer.json +4 -0
- package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Adapter/FileAdapter.php +21 -4
- package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Adapter/Stream/Template.php +5 -0
- package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Adapter/StreamAdapter.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/CacheInterface.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Partial/AdapterTrait.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Partial/Debug/DebuggerTrait.php +56 -10
- package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Partial/RendererOptionsTrait.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Profiler/Dump.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Profiler/LinkDump.php +2 -2
- package/support/vendor/phug/phug/src/Phug/Renderer/Renderer/Profiler/ProfilerModule.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Renderer/composer.json +7 -3
- package/support/vendor/phug/phug/src/Phug/Util/CompatibilityUtil/TestCaseTyped.php +67 -0
- package/support/vendor/phug/phug/src/Phug/Util/CompatibilityUtil/TestCaseUntyped.php +67 -0
- package/support/vendor/phug/phug/src/Phug/Util/Util/AttributesInterface.php +16 -0
- package/support/vendor/phug/phug/src/Phug/Util/Util/AttributesOrderInterface.php +17 -0
- package/support/vendor/phug/phug/src/Phug/Util/Util/AttributesStorage.php +44 -0
- package/support/vendor/phug/phug/src/Phug/Util/Util/Collection.php +2 -0
- package/support/vendor/phug/phug/src/Phug/Util/Util/OrderableInterface.php +22 -0
- package/support/vendor/phug/phug/src/Phug/Util/Util/OrderedValue.php +25 -0
- package/support/vendor/phug/phug/src/Phug/Util/Util/Partial/AttributeTrait.php +2 -1
- package/support/vendor/phug/phug/src/Phug/Util/Util/Partial/AttributesOrderTrait.php +19 -0
- package/support/vendor/phug/phug/src/Phug/Util/Util/Partial/ModuleContainerTrait.php +3 -3
- package/support/vendor/phug/phug/src/Phug/Util/Util/Partial/OptionTrait.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Util/Util/Partial/OrderTrait.php +27 -0
- package/support/vendor/phug/phug/src/Phug/Util/Util/Partial/StaticMemberTrait.php +1 -1
- package/support/vendor/phug/phug/src/Phug/Util/Util/Partial/ValueTrait.php +5 -3
- package/support/vendor/phug/phug/src/Phug/Util/Util/SandBox.php +1 -0
- package/support/vendor/phug/phug/src/Phug/Util/Util/TestCase.php +47 -4
- package/support/vendor/phug/phug/src/Phug/Util/composer.json +5 -6
- package/support/vendor/symfony/deprecation-contracts/CHANGELOG.md +5 -0
- package/support/vendor/symfony/{polyfill-php72 → deprecation-contracts}/LICENSE +1 -1
- package/support/vendor/symfony/deprecation-contracts/README.md +26 -0
- package/support/vendor/symfony/{polyfill-php72 → deprecation-contracts}/composer.json +9 -9
- package/support/vendor/symfony/deprecation-contracts/function.php +27 -0
- package/support/vendor/symfony/polyfill-mbstring/LICENSE +1 -1
- package/support/vendor/symfony/polyfill-mbstring/Mbstring.php +256 -57
- package/support/vendor/symfony/polyfill-mbstring/README.md +1 -1
- package/support/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php +119 -0
- package/support/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +1 -1
- package/support/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php +102 -27
- package/support/vendor/symfony/polyfill-mbstring/bootstrap.php +33 -8
- package/support/vendor/symfony/polyfill-mbstring/bootstrap80.php +167 -0
- package/support/vendor/symfony/polyfill-mbstring/composer.json +5 -4
- package/support/vendor/symfony/var-dumper/CHANGELOG.md +63 -0
- package/support/vendor/symfony/var-dumper/Caster/AddressInfoCaster.php +82 -0
- package/support/vendor/symfony/var-dumper/Caster/AmqpCaster.php +12 -10
- package/support/vendor/symfony/var-dumper/Caster/ArgsStub.php +6 -7
- package/support/vendor/symfony/var-dumper/Caster/Caster.php +59 -31
- package/support/vendor/symfony/var-dumper/Caster/ClassStub.php +7 -9
- package/support/vendor/symfony/var-dumper/Caster/ConstStub.php +20 -4
- package/support/vendor/symfony/var-dumper/Caster/CurlCaster.php +31 -0
- package/support/vendor/symfony/var-dumper/Caster/CutArrayStub.php +1 -1
- package/support/vendor/symfony/var-dumper/Caster/CutStub.php +2 -2
- package/support/vendor/symfony/var-dumper/Caster/DOMCaster.php +61 -156
- package/support/vendor/symfony/var-dumper/Caster/DateCaster.php +27 -26
- package/support/vendor/symfony/var-dumper/Caster/DoctrineCaster.php +6 -4
- package/support/vendor/symfony/var-dumper/Caster/DsCaster.php +1 -1
- package/support/vendor/symfony/var-dumper/Caster/DsPairStub.php +1 -1
- package/support/vendor/symfony/var-dumper/Caster/EnumStub.php +4 -5
- package/support/vendor/symfony/var-dumper/Caster/ExceptionCaster.php +64 -49
- package/support/vendor/symfony/var-dumper/Caster/FFICaster.php +171 -0
- package/support/vendor/symfony/var-dumper/Caster/FiberCaster.php +43 -0
- package/support/vendor/symfony/var-dumper/Caster/FrameStub.php +6 -8
- package/support/vendor/symfony/var-dumper/Caster/GdCaster.php +30 -0
- package/support/vendor/symfony/var-dumper/Caster/GmpCaster.php +4 -2
- package/support/vendor/symfony/var-dumper/Caster/ImagineCaster.php +2 -0
- package/support/vendor/symfony/var-dumper/Caster/ImgStub.php +1 -1
- package/support/vendor/symfony/var-dumper/Caster/IntlCaster.php +10 -8
- package/support/vendor/symfony/var-dumper/Caster/LinkStub.php +14 -17
- package/support/vendor/symfony/var-dumper/Caster/MemcachedCaster.php +10 -8
- package/support/vendor/symfony/var-dumper/Caster/MysqliCaster.php +33 -0
- package/support/vendor/symfony/var-dumper/Caster/OpenSSLCaster.php +69 -0
- package/support/vendor/symfony/var-dumper/Caster/PdoCaster.php +8 -6
- package/support/vendor/symfony/var-dumper/Caster/PgSqlCaster.php +21 -19
- package/support/vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php +4 -2
- package/support/vendor/symfony/var-dumper/Caster/RdKafkaCaster.php +188 -0
- package/support/vendor/symfony/var-dumper/Caster/RedisCaster.php +31 -31
- package/support/vendor/symfony/var-dumper/Caster/ReflectionCaster.php +100 -44
- package/support/vendor/symfony/var-dumper/Caster/ResourceCaster.php +33 -46
- package/support/vendor/symfony/var-dumper/Caster/ScalarStub.php +27 -0
- package/support/vendor/symfony/var-dumper/Caster/SocketCaster.php +64 -0
- package/support/vendor/symfony/var-dumper/Caster/SplCaster.php +57 -44
- package/support/vendor/symfony/var-dumper/Caster/SqliteCaster.php +32 -0
- package/support/vendor/symfony/var-dumper/Caster/StubCaster.php +15 -5
- package/support/vendor/symfony/var-dumper/Caster/SymfonyCaster.php +66 -10
- package/support/vendor/symfony/var-dumper/Caster/TraceStub.php +7 -11
- package/support/vendor/symfony/var-dumper/Caster/UninitializedStub.php +25 -0
- package/support/vendor/symfony/var-dumper/Caster/UuidCaster.php +2 -0
- package/support/vendor/symfony/var-dumper/Caster/VirtualStub.php +21 -0
- package/support/vendor/symfony/var-dumper/Caster/XmlReaderCaster.php +25 -10
- package/support/vendor/symfony/var-dumper/Caster/XmlResourceCaster.php +7 -5
- package/support/vendor/symfony/var-dumper/Cloner/AbstractCloner.php +103 -72
- package/support/vendor/symfony/var-dumper/Cloner/ClonerInterface.php +1 -5
- package/support/vendor/symfony/var-dumper/Cloner/Cursor.php +21 -21
- package/support/vendor/symfony/var-dumper/Cloner/Data.php +51 -77
- package/support/vendor/symfony/var-dumper/Cloner/DumperInterface.php +11 -14
- package/support/vendor/symfony/var-dumper/Cloner/Stub.php +40 -31
- package/support/vendor/symfony/var-dumper/Cloner/VarCloner.php +21 -104
- package/support/vendor/symfony/var-dumper/Command/Descriptor/CliDescriptor.php +9 -19
- package/support/vendor/symfony/var-dumper/Command/Descriptor/HtmlDescriptor.php +10 -11
- package/support/vendor/symfony/var-dumper/Command/ServerDumpCommand.php +27 -15
- package/support/vendor/symfony/var-dumper/Dumper/AbstractDumper.php +68 -48
- package/support/vendor/symfony/var-dumper/Dumper/CliDumper.php +126 -113
- package/support/vendor/symfony/var-dumper/Dumper/ContextProvider/CliContextProvider.php +1 -1
- package/support/vendor/symfony/var-dumper/Dumper/ContextProvider/ContextProviderInterface.php +0 -3
- package/support/vendor/symfony/var-dumper/Dumper/ContextProvider/RequestContextProvider.php +5 -6
- package/support/vendor/symfony/var-dumper/Dumper/ContextProvider/SourceContextProvider.php +10 -15
- package/support/vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php +8 -11
- package/support/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php +3 -0
- package/support/vendor/symfony/var-dumper/Dumper/HtmlDumper.php +122 -146
- package/support/vendor/symfony/var-dumper/Dumper/ServerDumper.php +10 -10
- package/support/vendor/symfony/var-dumper/Exception/ThrowingCasterException.php +1 -1
- package/support/vendor/symfony/var-dumper/LICENSE +1 -1
- package/support/vendor/symfony/var-dumper/README.md +6 -6
- package/support/vendor/symfony/var-dumper/Resources/bin/var-dump-server +4 -0
- package/support/vendor/symfony/var-dumper/Resources/functions/dump.php +35 -10
- package/support/vendor/symfony/var-dumper/Server/Connection.php +16 -14
- package/support/vendor/symfony/var-dumper/Server/DumpServer.php +16 -14
- package/support/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php +9 -9
- package/support/vendor/symfony/var-dumper/VarDumper.php +69 -17
- package/support/vendor/symfony/var-dumper/composer.json +10 -16
- package/support/vendor/symfony/polyfill-php72/Php72.php +0 -217
- package/support/vendor/symfony/polyfill-php72/README.md +0 -28
- package/support/vendor/symfony/polyfill-php72/bootstrap.php +0 -57
- package/support/vendor/symfony/polyfill-php80/LICENSE +0 -19
- package/support/vendor/symfony/polyfill-php80/Php80.php +0 -105
- package/support/vendor/symfony/polyfill-php80/README.md +0 -24
- package/support/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php +0 -22
- package/support/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php +0 -11
- package/support/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php +0 -5
- package/support/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php +0 -5
- package/support/vendor/symfony/polyfill-php80/bootstrap.php +0 -42
- package/support/vendor/symfony/polyfill-php80/composer.json +0 -40
|
@@ -17,15 +17,15 @@ use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider;
|
|
|
17
17
|
/**
|
|
18
18
|
* @author Nicolas Grekas <p@tchwork.com>
|
|
19
19
|
*/
|
|
20
|
-
class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
20
|
+
class Data implements \ArrayAccess, \Countable, \IteratorAggregate, \Stringable
|
|
21
21
|
{
|
|
22
|
-
private $data;
|
|
23
|
-
private $position = 0;
|
|
24
|
-
private $key = 0;
|
|
25
|
-
private $maxDepth = 20;
|
|
26
|
-
private $maxItemsPerDepth = -1;
|
|
27
|
-
private $useRefHandles = -1;
|
|
28
|
-
private $context = [];
|
|
22
|
+
private array $data;
|
|
23
|
+
private int $position = 0;
|
|
24
|
+
private int|string $key = 0;
|
|
25
|
+
private int $maxDepth = 20;
|
|
26
|
+
private int $maxItemsPerDepth = -1;
|
|
27
|
+
private int $useRefHandles = -1;
|
|
28
|
+
private array $context = [];
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* @param array $data An array as returned by ClonerInterface::cloneVar()
|
|
@@ -35,10 +35,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
|
35
35
|
$this->data = $data;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
* @return string|null The type of the value
|
|
40
|
-
*/
|
|
41
|
-
public function getType()
|
|
38
|
+
public function getType(): ?string
|
|
42
39
|
{
|
|
43
40
|
$item = $this->data[$this->position][$this->key];
|
|
44
41
|
|
|
@@ -65,11 +62,13 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
|
65
62
|
}
|
|
66
63
|
|
|
67
64
|
/**
|
|
65
|
+
* Returns a native representation of the original value.
|
|
66
|
+
*
|
|
68
67
|
* @param array|bool $recursive Whether values should be resolved recursively or not
|
|
69
68
|
*
|
|
70
|
-
* @return string|int|float|bool|array|Data[]|null
|
|
69
|
+
* @return string|int|float|bool|array|Data[]|null
|
|
71
70
|
*/
|
|
72
|
-
public function getValue($recursive = false)
|
|
71
|
+
public function getValue(array|bool $recursive = false): string|int|float|bool|array|null
|
|
73
72
|
{
|
|
74
73
|
$item = $this->data[$this->position][$this->key];
|
|
75
74
|
|
|
@@ -108,27 +107,21 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
|
108
107
|
return $children;
|
|
109
108
|
}
|
|
110
109
|
|
|
111
|
-
|
|
112
|
-
* @return int
|
|
113
|
-
*/
|
|
114
|
-
public function count()
|
|
110
|
+
public function count(): int
|
|
115
111
|
{
|
|
116
112
|
return \count($this->getValue());
|
|
117
113
|
}
|
|
118
114
|
|
|
119
|
-
|
|
120
|
-
* @return \Traversable
|
|
121
|
-
*/
|
|
122
|
-
public function getIterator()
|
|
115
|
+
public function getIterator(): \Traversable
|
|
123
116
|
{
|
|
124
117
|
if (!\is_array($value = $this->getValue())) {
|
|
125
|
-
throw new \LogicException(sprintf('"%s" object holds non-iterable type "%s".', self::class,
|
|
118
|
+
throw new \LogicException(\sprintf('"%s" object holds non-iterable type "%s".', self::class, get_debug_type($value)));
|
|
126
119
|
}
|
|
127
120
|
|
|
128
121
|
yield from $value;
|
|
129
122
|
}
|
|
130
123
|
|
|
131
|
-
public function __get($key)
|
|
124
|
+
public function __get(string $key): mixed
|
|
132
125
|
{
|
|
133
126
|
if (null !== $data = $this->seek($key)) {
|
|
134
127
|
$item = $this->getStub($data->data[$data->position][$data->key]);
|
|
@@ -139,41 +132,32 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
|
139
132
|
return null;
|
|
140
133
|
}
|
|
141
134
|
|
|
142
|
-
|
|
143
|
-
* @return bool
|
|
144
|
-
*/
|
|
145
|
-
public function __isset($key)
|
|
135
|
+
public function __isset(string $key): bool
|
|
146
136
|
{
|
|
147
137
|
return null !== $this->seek($key);
|
|
148
138
|
}
|
|
149
139
|
|
|
150
|
-
|
|
151
|
-
* @return bool
|
|
152
|
-
*/
|
|
153
|
-
public function offsetExists($key)
|
|
140
|
+
public function offsetExists(mixed $key): bool
|
|
154
141
|
{
|
|
155
142
|
return $this->__isset($key);
|
|
156
143
|
}
|
|
157
144
|
|
|
158
|
-
public function offsetGet($key)
|
|
145
|
+
public function offsetGet(mixed $key): mixed
|
|
159
146
|
{
|
|
160
147
|
return $this->__get($key);
|
|
161
148
|
}
|
|
162
149
|
|
|
163
|
-
public function offsetSet($key, $value)
|
|
150
|
+
public function offsetSet(mixed $key, mixed $value): void
|
|
164
151
|
{
|
|
165
152
|
throw new \BadMethodCallException(self::class.' objects are immutable.');
|
|
166
153
|
}
|
|
167
154
|
|
|
168
|
-
public function offsetUnset($key)
|
|
155
|
+
public function offsetUnset(mixed $key): void
|
|
169
156
|
{
|
|
170
157
|
throw new \BadMethodCallException(self::class.' objects are immutable.');
|
|
171
158
|
}
|
|
172
159
|
|
|
173
|
-
|
|
174
|
-
* @return string
|
|
175
|
-
*/
|
|
176
|
-
public function __toString()
|
|
160
|
+
public function __toString(): string
|
|
177
161
|
{
|
|
178
162
|
$value = $this->getValue();
|
|
179
163
|
|
|
@@ -181,35 +165,27 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
|
181
165
|
return (string) $value;
|
|
182
166
|
}
|
|
183
167
|
|
|
184
|
-
return sprintf('%s (count=%d)', $this->getType(), \count($value));
|
|
168
|
+
return \sprintf('%s (count=%d)', $this->getType(), \count($value));
|
|
185
169
|
}
|
|
186
170
|
|
|
187
171
|
/**
|
|
188
172
|
* Returns a depth limited clone of $this.
|
|
189
|
-
*
|
|
190
|
-
* @param int $maxDepth The max dumped depth level
|
|
191
|
-
*
|
|
192
|
-
* @return static
|
|
193
173
|
*/
|
|
194
|
-
public function withMaxDepth($maxDepth)
|
|
174
|
+
public function withMaxDepth(int $maxDepth): static
|
|
195
175
|
{
|
|
196
176
|
$data = clone $this;
|
|
197
|
-
$data->maxDepth =
|
|
177
|
+
$data->maxDepth = $maxDepth;
|
|
198
178
|
|
|
199
179
|
return $data;
|
|
200
180
|
}
|
|
201
181
|
|
|
202
182
|
/**
|
|
203
183
|
* Limits the number of elements per depth level.
|
|
204
|
-
*
|
|
205
|
-
* @param int $maxItemsPerDepth The max number of items dumped per depth level
|
|
206
|
-
*
|
|
207
|
-
* @return static
|
|
208
184
|
*/
|
|
209
|
-
public function withMaxItemsPerDepth($maxItemsPerDepth)
|
|
185
|
+
public function withMaxItemsPerDepth(int $maxItemsPerDepth): static
|
|
210
186
|
{
|
|
211
187
|
$data = clone $this;
|
|
212
|
-
$data->maxItemsPerDepth =
|
|
188
|
+
$data->maxItemsPerDepth = $maxItemsPerDepth;
|
|
213
189
|
|
|
214
190
|
return $data;
|
|
215
191
|
}
|
|
@@ -218,10 +194,8 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
|
218
194
|
* Enables/disables objects' identifiers tracking.
|
|
219
195
|
*
|
|
220
196
|
* @param bool $useRefHandles False to hide global ref. handles
|
|
221
|
-
*
|
|
222
|
-
* @return static
|
|
223
197
|
*/
|
|
224
|
-
public function withRefHandles($useRefHandles)
|
|
198
|
+
public function withRefHandles(bool $useRefHandles): static
|
|
225
199
|
{
|
|
226
200
|
$data = clone $this;
|
|
227
201
|
$data->useRefHandles = $useRefHandles ? -1 : 0;
|
|
@@ -229,10 +203,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
|
229
203
|
return $data;
|
|
230
204
|
}
|
|
231
205
|
|
|
232
|
-
|
|
233
|
-
* @return static
|
|
234
|
-
*/
|
|
235
|
-
public function withContext(array $context)
|
|
206
|
+
public function withContext(array $context): static
|
|
236
207
|
{
|
|
237
208
|
$data = clone $this;
|
|
238
209
|
$data->context = $context;
|
|
@@ -240,14 +211,15 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
|
240
211
|
return $data;
|
|
241
212
|
}
|
|
242
213
|
|
|
214
|
+
public function getContext(): array
|
|
215
|
+
{
|
|
216
|
+
return $this->context;
|
|
217
|
+
}
|
|
218
|
+
|
|
243
219
|
/**
|
|
244
220
|
* Seeks to a specific key in nested data structures.
|
|
245
|
-
*
|
|
246
|
-
* @param string|int $key The key to seek to
|
|
247
|
-
*
|
|
248
|
-
* @return static|null Null if the key is not set
|
|
249
221
|
*/
|
|
250
|
-
public function seek($key)
|
|
222
|
+
public function seek(string|int $key): ?static
|
|
251
223
|
{
|
|
252
224
|
$item = $this->data[$this->position][$this->key];
|
|
253
225
|
|
|
@@ -291,20 +263,18 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
|
291
263
|
/**
|
|
292
264
|
* Dumps data with a DumperInterface dumper.
|
|
293
265
|
*/
|
|
294
|
-
public function dump(DumperInterface $dumper)
|
|
266
|
+
public function dump(DumperInterface $dumper): void
|
|
295
267
|
{
|
|
296
268
|
$refs = [0];
|
|
297
269
|
$cursor = new Cursor();
|
|
270
|
+
$cursor->hashType = -1;
|
|
271
|
+
$cursor->attr = $this->context[SourceContextProvider::class] ?? [];
|
|
272
|
+
$label = $this->context['label'] ?? '';
|
|
298
273
|
|
|
299
|
-
if ($cursor->attr
|
|
300
|
-
$cursor
|
|
301
|
-
$cursor->hashType = -1;
|
|
302
|
-
$dumper->dumpScalar($cursor, 'default', '^');
|
|
303
|
-
$cursor->attr = ['if_links' => true];
|
|
304
|
-
$dumper->dumpScalar($cursor, 'default', ' ');
|
|
305
|
-
$cursor->hashType = 0;
|
|
274
|
+
if ($cursor->attr || '' !== $label) {
|
|
275
|
+
$dumper->dumpScalar($cursor, 'label', $label);
|
|
306
276
|
}
|
|
307
|
-
|
|
277
|
+
$cursor->hashType = 0;
|
|
308
278
|
$this->dumpItem($dumper, $cursor, $refs, $this->data[$this->position][$this->key]);
|
|
309
279
|
}
|
|
310
280
|
|
|
@@ -313,7 +283,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
|
313
283
|
*
|
|
314
284
|
* @param mixed $item A Stub object or the original value being dumped
|
|
315
285
|
*/
|
|
316
|
-
private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, $item)
|
|
286
|
+
private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, mixed $item): void
|
|
317
287
|
{
|
|
318
288
|
$cursor->refIndex = 0;
|
|
319
289
|
$cursor->softRefTo = $cursor->softRefHandle = $cursor->softRefCount = 0;
|
|
@@ -335,7 +305,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
|
335
305
|
}
|
|
336
306
|
$cursor->hardRefTo = $refs[$r];
|
|
337
307
|
$cursor->hardRefHandle = $this->useRefHandles & $item->handle;
|
|
338
|
-
$cursor->hardRefCount = $item->refCount;
|
|
308
|
+
$cursor->hardRefCount = 0 < $item->handle ? $item->refCount : 0;
|
|
339
309
|
}
|
|
340
310
|
$cursor->attr = $item->attr;
|
|
341
311
|
$type = $item->class ?: \gettype($item->value);
|
|
@@ -395,8 +365,12 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
|
395
365
|
$dumper->leaveHash($cursor, $item->type, $item->class, $withChildren, $cut);
|
|
396
366
|
break;
|
|
397
367
|
|
|
368
|
+
case Stub::TYPE_SCALAR:
|
|
369
|
+
$dumper->dumpScalar($cursor, 'default', $item->attr['value']);
|
|
370
|
+
break;
|
|
371
|
+
|
|
398
372
|
default:
|
|
399
|
-
throw new \RuntimeException(sprintf('Unexpected Stub type: "%s".', $item->type));
|
|
373
|
+
throw new \RuntimeException(\sprintf('Unexpected Stub type: "%s".', $item->type));
|
|
400
374
|
}
|
|
401
375
|
} elseif ('array' === $type) {
|
|
402
376
|
$dumper->enterHash($cursor, Cursor::HASH_INDEXED, 0, false);
|
|
@@ -435,7 +409,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
|
|
435
409
|
return $hashCut;
|
|
436
410
|
}
|
|
437
411
|
|
|
438
|
-
private function getStub($item)
|
|
412
|
+
private function getStub(mixed $item): mixed
|
|
439
413
|
{
|
|
440
414
|
if (!$item || !\is_array($item)) {
|
|
441
415
|
return $item;
|
|
@@ -20,11 +20,8 @@ interface DumperInterface
|
|
|
20
20
|
{
|
|
21
21
|
/**
|
|
22
22
|
* Dumps a scalar value.
|
|
23
|
-
*
|
|
24
|
-
* @param string $type The PHP type of the value being dumped
|
|
25
|
-
* @param string|int|float|bool $value The scalar value being dumped
|
|
26
23
|
*/
|
|
27
|
-
public function dumpScalar(Cursor $cursor, $type, $value);
|
|
24
|
+
public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value): void;
|
|
28
25
|
|
|
29
26
|
/**
|
|
30
27
|
* Dumps a string.
|
|
@@ -33,24 +30,24 @@ interface DumperInterface
|
|
|
33
30
|
* @param bool $bin Whether $str is UTF-8 or binary encoded
|
|
34
31
|
* @param int $cut The number of characters $str has been cut by
|
|
35
32
|
*/
|
|
36
|
-
public function dumpString(Cursor $cursor, $str, $bin, $cut);
|
|
33
|
+
public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut): void;
|
|
37
34
|
|
|
38
35
|
/**
|
|
39
36
|
* Dumps while entering an hash.
|
|
40
37
|
*
|
|
41
|
-
* @param int
|
|
42
|
-
* @param string|int $class The object class, resource type or array count
|
|
43
|
-
* @param bool
|
|
38
|
+
* @param int $type A Cursor::HASH_* const for the type of hash
|
|
39
|
+
* @param string|int|null $class The object class, resource type or array count
|
|
40
|
+
* @param bool $hasChild When the dump of the hash has child item
|
|
44
41
|
*/
|
|
45
|
-
public function enterHash(Cursor $cursor, $type, $class, $hasChild);
|
|
42
|
+
public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild): void;
|
|
46
43
|
|
|
47
44
|
/**
|
|
48
45
|
* Dumps while leaving an hash.
|
|
49
46
|
*
|
|
50
|
-
* @param int
|
|
51
|
-
* @param string|int $class The object class, resource type or array count
|
|
52
|
-
* @param bool
|
|
53
|
-
* @param int
|
|
47
|
+
* @param int $type A Cursor::HASH_* const for the type of hash
|
|
48
|
+
* @param string|int|null $class The object class, resource type or array count
|
|
49
|
+
* @param bool $hasChild When the dump of the hash has child item
|
|
50
|
+
* @param int $cut The number of items the hash has been cut by
|
|
54
51
|
*/
|
|
55
|
-
public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut);
|
|
52
|
+
public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut): void;
|
|
56
53
|
}
|
|
@@ -18,50 +18,59 @@ namespace Symfony\Component\VarDumper\Cloner;
|
|
|
18
18
|
*/
|
|
19
19
|
class Stub
|
|
20
20
|
{
|
|
21
|
-
const TYPE_REF = 1;
|
|
22
|
-
const TYPE_STRING = 2;
|
|
23
|
-
const TYPE_ARRAY = 3;
|
|
24
|
-
const TYPE_OBJECT = 4;
|
|
25
|
-
const TYPE_RESOURCE = 5;
|
|
21
|
+
public const TYPE_REF = 1;
|
|
22
|
+
public const TYPE_STRING = 2;
|
|
23
|
+
public const TYPE_ARRAY = 3;
|
|
24
|
+
public const TYPE_OBJECT = 4;
|
|
25
|
+
public const TYPE_RESOURCE = 5;
|
|
26
|
+
public const TYPE_SCALAR = 6;
|
|
26
27
|
|
|
27
|
-
const STRING_BINARY = 1;
|
|
28
|
-
const STRING_UTF8 = 2;
|
|
28
|
+
public const STRING_BINARY = 1;
|
|
29
|
+
public const STRING_UTF8 = 2;
|
|
29
30
|
|
|
30
|
-
const ARRAY_ASSOC = 1;
|
|
31
|
-
const ARRAY_INDEXED = 2;
|
|
31
|
+
public const ARRAY_ASSOC = 1;
|
|
32
|
+
public const ARRAY_INDEXED = 2;
|
|
32
33
|
|
|
33
|
-
public $type = self::TYPE_REF;
|
|
34
|
-
public $class = '';
|
|
35
|
-
public $value;
|
|
36
|
-
public $cut = 0;
|
|
37
|
-
public $handle = 0;
|
|
38
|
-
public $refCount = 0;
|
|
39
|
-
public $position = 0;
|
|
40
|
-
public $attr = [];
|
|
41
|
-
|
|
42
|
-
private static $defaultProperties = [];
|
|
34
|
+
public int $type = self::TYPE_REF;
|
|
35
|
+
public string|int|null $class = '';
|
|
36
|
+
public mixed $value = null;
|
|
37
|
+
public int $cut = 0;
|
|
38
|
+
public int $handle = 0;
|
|
39
|
+
public int $refCount = 0;
|
|
40
|
+
public int $position = 0;
|
|
41
|
+
public array $attr = [];
|
|
43
42
|
|
|
44
43
|
/**
|
|
45
44
|
* @internal
|
|
46
45
|
*/
|
|
47
|
-
|
|
48
|
-
{
|
|
49
|
-
$properties = [];
|
|
46
|
+
protected static array $propertyDefaults = [];
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
public function __serialize(): array
|
|
49
|
+
{
|
|
50
|
+
static $noDefault = new \stdClass();
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
if (self::class === static::class) {
|
|
53
|
+
$data = [];
|
|
54
|
+
foreach ($this as $k => $v) {
|
|
55
|
+
$default = self::$propertyDefaults[$this::class][$k] ??= ($p = new \ReflectionProperty($this, $k))->hasDefaultValue() ? $p->getDefaultValue() : ($p->hasType() ? $noDefault : null);
|
|
56
|
+
if ($noDefault === $default || $default !== $v) {
|
|
57
|
+
$data[$k] = $v;
|
|
58
|
+
}
|
|
56
59
|
}
|
|
60
|
+
|
|
61
|
+
return $data;
|
|
57
62
|
}
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
return \Closure::bind(function () use ($noDefault) {
|
|
65
|
+
$data = [];
|
|
66
|
+
foreach ($this as $k => $v) {
|
|
67
|
+
$default = self::$propertyDefaults[$this::class][$k] ??= ($p = new \ReflectionProperty($this, $k))->hasDefaultValue() ? $p->getDefaultValue() : ($p->hasType() ? $noDefault : null);
|
|
68
|
+
if ($noDefault === $default || $default !== $v) {
|
|
69
|
+
$data[$k] = $v;
|
|
70
|
+
}
|
|
62
71
|
}
|
|
63
|
-
}
|
|
64
72
|
|
|
65
|
-
|
|
73
|
+
return $data;
|
|
74
|
+
}, $this, $this::class)();
|
|
66
75
|
}
|
|
67
76
|
}
|
|
@@ -16,41 +16,30 @@ namespace Symfony\Component\VarDumper\Cloner;
|
|
|
16
16
|
*/
|
|
17
17
|
class VarCloner extends AbstractCloner
|
|
18
18
|
{
|
|
19
|
-
private static $
|
|
20
|
-
private static $arrayCache = [];
|
|
19
|
+
private static array $arrayCache = [];
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
* {@inheritdoc}
|
|
24
|
-
*/
|
|
25
|
-
protected function doClone($var)
|
|
21
|
+
protected function doClone(mixed $var): array
|
|
26
22
|
{
|
|
27
23
|
$len = 1; // Length of $queue
|
|
28
24
|
$pos = 0; // Number of cloned items past the minimum depth
|
|
29
25
|
$refsCounter = 0; // Hard references counter
|
|
30
|
-
$queue = [[$var]];
|
|
31
|
-
$
|
|
32
|
-
$
|
|
33
|
-
$
|
|
34
|
-
$
|
|
35
|
-
$resRefs = []; // Map of original resource handles to their stub object counterpart
|
|
36
|
-
$values = []; // Map of stub objects' ids to original values
|
|
26
|
+
$queue = [[$var]]; // This breadth-first queue is the return value
|
|
27
|
+
$hardRefs = []; // Map of original zval ids to stub objects
|
|
28
|
+
$objRefs = []; // Map of original object handles to their stub object counterpart
|
|
29
|
+
$objects = []; // Keep a ref to objects to ensure their handle cannot be reused while cloning
|
|
30
|
+
$resRefs = []; // Map of original resource handles to their stub object counterpart
|
|
37
31
|
$maxItems = $this->maxItems;
|
|
38
32
|
$maxString = $this->maxString;
|
|
39
33
|
$minDepth = $this->minDepth;
|
|
40
34
|
$currentDepth = 0; // Current tree depth
|
|
41
35
|
$currentDepthFinalIndex = 0; // Final $queue index for current tree depth
|
|
42
36
|
$minimumDepthReached = 0 === $minDepth; // Becomes true when minimum tree depth has been reached
|
|
43
|
-
$cookie = (object) []; // Unique object used to detect hard references
|
|
44
37
|
$a = null; // Array cast for nested structures
|
|
45
38
|
$stub = null; // Stub capturing the main properties of an original item value
|
|
46
39
|
// or null if the original value is used directly
|
|
47
40
|
|
|
48
|
-
if (!$gid = self::$gid) {
|
|
49
|
-
$gid = self::$gid = md5(random_bytes(6)); // Unique string used to detect the special $GLOBALS variable
|
|
50
|
-
}
|
|
51
41
|
$arrayStub = new Stub();
|
|
52
42
|
$arrayStub->type = Stub::TYPE_ARRAY;
|
|
53
|
-
$fromObjCast = false;
|
|
54
43
|
|
|
55
44
|
for ($i = 0; $i < $len; ++$i) {
|
|
56
45
|
// Detect when we move on to the next tree depth
|
|
@@ -62,51 +51,29 @@ class VarCloner extends AbstractCloner
|
|
|
62
51
|
}
|
|
63
52
|
}
|
|
64
53
|
|
|
65
|
-
$
|
|
66
|
-
if (\PHP_VERSION_ID < 70200 && empty($indexedArrays[$i])) {
|
|
67
|
-
// see https://wiki.php.net/rfc/convert_numeric_keys_in_object_array_casts
|
|
68
|
-
foreach ($vals as $k => $v) {
|
|
69
|
-
if (\is_int($k)) {
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
foreach ([$k => true] as $gk => $gv) {
|
|
73
|
-
}
|
|
74
|
-
if ($gk !== $k) {
|
|
75
|
-
$fromObjCast = true;
|
|
76
|
-
$refs = $vals = array_values($queue[$i]);
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
54
|
+
$vals = $queue[$i];
|
|
81
55
|
foreach ($vals as $k => $v) {
|
|
82
56
|
// $v is the original value or a stub object in case of hard references
|
|
83
57
|
|
|
84
|
-
|
|
85
|
-
$zvalIsRef = null !== \ReflectionReference::fromArrayElement($vals, $k);
|
|
86
|
-
} else {
|
|
87
|
-
$refs[$k] = $cookie;
|
|
88
|
-
$zvalIsRef = $vals[$k] === $cookie;
|
|
89
|
-
}
|
|
58
|
+
$zvalRef = ($r = \ReflectionReference::fromArrayElement($vals, $k)) ? $r->getId() : null;
|
|
90
59
|
|
|
91
|
-
if ($
|
|
60
|
+
if ($zvalRef) {
|
|
92
61
|
$vals[$k] = &$stub; // Break hard references to make $queue completely
|
|
93
62
|
unset($stub); // independent from the original structure
|
|
94
|
-
if (
|
|
95
|
-
$
|
|
63
|
+
if (null !== $vals[$k] = $hardRefs[$zvalRef] ?? null) {
|
|
64
|
+
$v = $vals[$k];
|
|
96
65
|
if ($v->value instanceof Stub && (Stub::TYPE_OBJECT === $v->value->type || Stub::TYPE_RESOURCE === $v->value->type)) {
|
|
97
66
|
++$v->value->refCount;
|
|
98
67
|
}
|
|
99
68
|
++$v->refCount;
|
|
100
69
|
continue;
|
|
101
70
|
}
|
|
102
|
-
$
|
|
103
|
-
$
|
|
104
|
-
$h = spl_object_id($refs[$k]);
|
|
105
|
-
$hardRefs[$h] = &$refs[$k];
|
|
106
|
-
$values[$h] = $v;
|
|
71
|
+
$vals[$k] = new Stub();
|
|
72
|
+
$vals[$k]->value = $v;
|
|
107
73
|
$vals[$k]->handle = ++$refsCounter;
|
|
74
|
+
$hardRefs[$zvalRef] = $vals[$k];
|
|
108
75
|
}
|
|
109
|
-
// Create $stub when the original value $v
|
|
76
|
+
// Create $stub when the original value $v cannot be used directly
|
|
110
77
|
// If $v is a nested structure, put that structure in array $a
|
|
111
78
|
switch (true) {
|
|
112
79
|
case null === $v:
|
|
@@ -145,44 +112,16 @@ class VarCloner extends AbstractCloner
|
|
|
145
112
|
continue 2;
|
|
146
113
|
}
|
|
147
114
|
$stub = $arrayStub;
|
|
148
|
-
$stub->class = Stub::ARRAY_INDEXED;
|
|
149
115
|
|
|
150
|
-
$
|
|
151
|
-
foreach ($v as $gk => $gv) {
|
|
152
|
-
if ($gk !== ++$j) {
|
|
153
|
-
$stub->class = Stub::ARRAY_ASSOC;
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
116
|
+
$stub->class = array_is_list($v) ? Stub::ARRAY_INDEXED : Stub::ARRAY_ASSOC;
|
|
157
117
|
$a = $v;
|
|
158
|
-
|
|
159
|
-
if (Stub::ARRAY_ASSOC === $stub->class) {
|
|
160
|
-
// Copies of $GLOBALS have very strange behavior,
|
|
161
|
-
// let's detect them with some black magic
|
|
162
|
-
$a[$gid] = true;
|
|
163
|
-
|
|
164
|
-
// Happens with copies of $GLOBALS
|
|
165
|
-
if (isset($v[$gid])) {
|
|
166
|
-
unset($v[$gid]);
|
|
167
|
-
$a = [];
|
|
168
|
-
foreach ($v as $gk => &$gv) {
|
|
169
|
-
$a[$gk] = &$gv;
|
|
170
|
-
}
|
|
171
|
-
unset($gv);
|
|
172
|
-
} else {
|
|
173
|
-
$a = $v;
|
|
174
|
-
}
|
|
175
|
-
} elseif (\PHP_VERSION_ID < 70200) {
|
|
176
|
-
$indexedArrays[$len] = true;
|
|
177
|
-
}
|
|
178
118
|
break;
|
|
179
119
|
|
|
180
120
|
case \is_object($v):
|
|
181
|
-
case $v instanceof \__PHP_Incomplete_Class:
|
|
182
121
|
if (empty($objRefs[$h = spl_object_id($v)])) {
|
|
183
122
|
$stub = new Stub();
|
|
184
123
|
$stub->type = Stub::TYPE_OBJECT;
|
|
185
|
-
$stub->class =
|
|
124
|
+
$stub->class = $v::class;
|
|
186
125
|
$stub->value = $v;
|
|
187
126
|
$stub->handle = $h;
|
|
188
127
|
$a = $this->castObject($stub, 0 < $i);
|
|
@@ -264,38 +203,16 @@ class VarCloner extends AbstractCloner
|
|
|
264
203
|
}
|
|
265
204
|
}
|
|
266
205
|
|
|
267
|
-
if (
|
|
268
|
-
$refs[$k]->value = $stub;
|
|
269
|
-
} else {
|
|
206
|
+
if (!$zvalRef) {
|
|
270
207
|
$vals[$k] = $stub;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
if ($fromObjCast) {
|
|
275
|
-
$fromObjCast = false;
|
|
276
|
-
$refs = $vals;
|
|
277
|
-
$vals = [];
|
|
278
|
-
$j = -1;
|
|
279
|
-
foreach ($queue[$i] as $k => $v) {
|
|
280
|
-
foreach ([$k => true] as $gk => $gv) {
|
|
281
|
-
}
|
|
282
|
-
if ($gk !== $k) {
|
|
283
|
-
$vals = (object) $vals;
|
|
284
|
-
$vals->{$k} = $refs[++$j];
|
|
285
|
-
$vals = (array) $vals;
|
|
286
|
-
} else {
|
|
287
|
-
$vals[$k] = $refs[++$j];
|
|
288
|
-
}
|
|
208
|
+
} else {
|
|
209
|
+
$hardRefs[$zvalRef]->value = $stub;
|
|
289
210
|
}
|
|
290
211
|
}
|
|
291
212
|
|
|
292
213
|
$queue[$i] = $vals;
|
|
293
214
|
}
|
|
294
215
|
|
|
295
|
-
foreach ($values as $h => $v) {
|
|
296
|
-
$hardRefs[$h] = $v;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
216
|
return $queue;
|
|
300
217
|
}
|
|
301
218
|
}
|