@flarum/cli 2.0.0-beta.8 → 3.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/LICENSE +1 -1
- package/README.md +178 -48
- package/bin/run +2 -1
- package/bin/splitsh-lite-darwin +0 -0
- package/bin/splitsh-lite-linux +0 -0
- package/boilerplate/skeleton/extension/.gitattributes +16 -14
- package/boilerplate/skeleton/extension/.github/workflows/backend.yml +2 -6
- package/boilerplate/skeleton/extension/.github/workflows/frontend.yml +5 -6
- package/boilerplate/skeleton/extension/.github/workflows/phpstan.yml +12 -0
- package/boilerplate/skeleton/extension/LICENSE.md +1 -1
- package/boilerplate/skeleton/extension/README.md +1 -1
- package/boilerplate/skeleton/extension/composer.json +13 -7
- package/boilerplate/skeleton/extension/extend.php +2 -2
- package/boilerplate/skeleton/extension/gitignore +1 -0
- package/boilerplate/skeleton/extension/js/admin.ts +2 -0
- package/boilerplate/skeleton/extension/js/forum.ts +2 -0
- package/boilerplate/skeleton/extension/js/jest.config.cjs +1 -0
- package/boilerplate/skeleton/extension/js/package.json +11 -4
- package/boilerplate/skeleton/extension/js/src/admin/extend.js +8 -0
- package/boilerplate/skeleton/extension/js/src/admin/extend.ts +8 -0
- package/boilerplate/skeleton/extension/js/src/admin/index.js +2 -0
- package/boilerplate/skeleton/extension/js/src/admin/index.ts +7 -0
- package/boilerplate/skeleton/extension/js/src/common/extend.js +5 -0
- package/boilerplate/skeleton/extension/js/src/common/extend.ts +5 -0
- package/boilerplate/skeleton/extension/js/src/common/index.ts +5 -0
- package/boilerplate/skeleton/extension/js/src/forum/extend.js +8 -0
- package/boilerplate/skeleton/extension/js/src/forum/extend.ts +8 -0
- package/boilerplate/skeleton/extension/js/src/forum/index.js +2 -0
- package/boilerplate/skeleton/extension/js/src/forum/index.ts +7 -0
- package/boilerplate/skeleton/extension/js/tests/unit/.gitkeep +0 -0
- package/boilerplate/skeleton/extension/js/tsconfig.json +10 -2
- package/boilerplate/skeleton/extension/js/tsconfig.test.json +10 -0
- package/boilerplate/skeleton/extension/locale/en.yml +1 -1
- package/boilerplate/skeleton/extension/phpstan.neon +12 -0
- package/boilerplate/skeleton/extension/tests/phpunit.integration.xml +6 -7
- package/boilerplate/skeleton/extension/tests/phpunit.unit.xml +5 -10
- package/boilerplate/stubs/backend/advanced-api-resource.php +85 -0
- package/boilerplate/stubs/backend/api-resource.php +73 -0
- package/boilerplate/stubs/backend/command.php +2 -2
- package/boilerplate/stubs/backend/controller.php +19 -0
- package/boilerplate/stubs/backend/event-listener.php +1 -1
- package/boilerplate/stubs/backend/filter.php +25 -0
- package/boilerplate/stubs/backend/handler/command.php +6 -20
- package/boilerplate/stubs/backend/handler/handler.php +6 -14
- package/boilerplate/stubs/backend/integration-test.php +10 -7
- package/boilerplate/stubs/backend/job.php +6 -11
- package/boilerplate/stubs/backend/mail-driver.php +36 -0
- package/boilerplate/stubs/backend/middleware.php +19 -0
- package/boilerplate/stubs/backend/model.php +1 -1
- package/boilerplate/stubs/backend/notification-blueprint.php +42 -0
- package/boilerplate/stubs/backend/notification-driver.php +32 -0
- package/boilerplate/stubs/backend/policy.php +1 -1
- package/boilerplate/stubs/backend/post-type.php +35 -0
- package/boilerplate/stubs/backend/repository.php +2 -10
- package/boilerplate/stubs/backend/search/driver.php +13 -0
- package/boilerplate/stubs/backend/search/searcher.php +41 -0
- package/boilerplate/stubs/backend/service-provider.php +1 -1
- package/boilerplate/stubs/backend/validator.php +1 -1
- package/boilerplate/stubs/frontend/component.js +1 -1
- package/boilerplate/stubs/frontend/forum-page.js +68 -0
- package/boilerplate/stubs/frontend/gambit/boolean.js +12 -0
- package/boilerplate/stubs/frontend/gambit/key-value.js +16 -0
- package/boilerplate/stubs/frontend/modal.js +1 -1
- package/boilerplate/stubs/frontend/model.js +1 -1
- package/boilerplate/stubs/frontend/notification.js +22 -0
- package/boilerplate/stubs/frontend/post-type.js +13 -0
- package/boilerplate/stubs/migration.php +1 -1
- package/boilerplate/stubs/views/email/html/information.blade.php +8 -0
- package/boilerplate/stubs/views/email/html/notification.blade.php +8 -0
- package/boilerplate/stubs/views/email/plain/information.blade.php +7 -0
- package/boilerplate/stubs/views/email/plain/notification.blade.php +6 -0
- package/lib/base-command.d.ts +22 -6
- package/lib/base-command.js +114 -56
- package/lib/boilersmith/io.d.ts +33 -11
- package/lib/boilersmith/io.js +32 -17
- package/lib/boilersmith/paths.d.ts +3 -3
- package/lib/boilersmith/paths.js +7 -7
- package/lib/boilersmith/scaffolding/audit-step-factory.js +12 -12
- package/lib/boilersmith/scaffolding/infra-step-factory.js +2 -2
- package/lib/boilersmith/scaffolding/init-step-factory.js +5 -5
- package/lib/boilersmith/scaffolding/module.d.ts +30 -10
- package/lib/boilersmith/scaffolding/module.js +61 -19
- package/lib/boilersmith/scaffolding/scaffolder.d.ts +4 -1
- package/lib/boilersmith/scaffolding/scaffolder.js +33 -33
- package/lib/boilersmith/scaffolding/template-param.d.ts +2 -2
- package/lib/boilersmith/scaffolding/template-param.js +2 -2
- package/lib/boilersmith/step-manager.d.ts +15 -11
- package/lib/boilersmith/step-manager.js +45 -29
- package/lib/boilersmith/steps/stub-base.js +4 -4
- package/lib/boilersmith/utils/clone-and-fill.js +1 -1
- package/lib/boilersmith/utils/commit-async.d.ts +2 -0
- package/lib/boilersmith/utils/commit-async.js +15 -0
- package/lib/boilersmith/utils/json-leaf-paths.d.ts +2 -2
- package/lib/boilersmith/utils/read-tpl.js +2 -2
- package/lib/commands/audit/infra.d.ts +2 -5
- package/lib/commands/audit/infra.js +31 -9
- package/lib/commands/infra.d.ts +2 -10
- package/lib/commands/infra.js +20 -14
- package/lib/commands/init.d.ts +2 -5
- package/lib/commands/init.js +7 -5
- package/lib/commands/make/backend/{api-serializer.d.ts → api-resource.d.ts} +2 -5
- package/lib/commands/make/backend/api-resource.js +26 -0
- package/lib/commands/make/backend/command.d.ts +1 -4
- package/lib/commands/make/backend/command.js +3 -4
- package/lib/commands/make/backend/{api-controller.d.ts → controller.d.ts} +2 -5
- package/lib/commands/make/backend/controller.js +31 -0
- package/lib/commands/make/backend/event-listener.d.ts +1 -4
- package/lib/commands/make/backend/event-listener.js +2 -3
- package/lib/commands/make/backend/{api-serializer-attributes.d.ts → filter.d.ts} +3 -6
- package/lib/commands/make/backend/filter.js +26 -0
- package/lib/commands/make/backend/handler.d.ts +2 -5
- package/lib/commands/make/backend/handler.js +8 -11
- package/lib/commands/make/backend/integration-test.d.ts +1 -4
- package/lib/commands/make/backend/integration-test.js +4 -6
- package/lib/commands/make/backend/job.d.ts +1 -4
- package/lib/commands/make/backend/job.js +2 -2
- package/lib/commands/make/backend/mail-driver.d.ts +12 -0
- package/lib/commands/make/backend/mail-driver.js +29 -0
- package/lib/commands/make/backend/middleware.d.ts +11 -0
- package/lib/commands/make/backend/middleware.js +26 -0
- package/lib/commands/make/backend/migration.d.ts +1 -4
- package/lib/commands/make/backend/migration.js +10 -4
- package/lib/commands/make/backend/model.d.ts +6 -7
- package/lib/commands/make/backend/model.js +69 -449
- package/lib/commands/make/backend/notification-blueprint.d.ts +12 -0
- package/lib/commands/make/backend/notification-blueprint.js +29 -0
- package/lib/commands/make/backend/notification-driver.d.ts +12 -0
- package/lib/commands/make/backend/notification-driver.js +29 -0
- package/lib/commands/make/backend/policy.d.ts +1 -4
- package/lib/commands/make/backend/policy.js +2 -3
- package/lib/commands/make/backend/post-type.d.ts +12 -0
- package/lib/commands/make/backend/post-type.js +29 -0
- package/lib/commands/make/backend/repository.d.ts +1 -4
- package/lib/commands/make/backend/repository.js +1 -1
- package/lib/commands/make/backend/route.d.ts +1 -4
- package/lib/commands/make/backend/route.js +2 -3
- package/lib/commands/make/backend/search-driver.d.ts +11 -0
- package/lib/commands/make/backend/search-driver.js +51 -0
- package/lib/commands/make/backend/service-provider.d.ts +1 -4
- package/lib/commands/make/backend/service-provider.js +3 -4
- package/lib/commands/make/backend/validator.d.ts +1 -4
- package/lib/commands/make/backend/validator.js +2 -2
- package/lib/commands/make/frontend/component.d.ts +4 -5
- package/lib/commands/make/frontend/component.js +7 -2
- package/lib/commands/make/frontend/forum-page.d.ts +11 -0
- package/lib/commands/make/frontend/forum-page.js +92 -0
- package/lib/commands/make/frontend/gambit.d.ts +11 -0
- package/lib/commands/make/frontend/gambit.js +30 -0
- package/lib/commands/make/frontend/modal.d.ts +1 -4
- package/lib/commands/make/frontend/modal.js +3 -2
- package/lib/commands/make/frontend/model.d.ts +6 -7
- package/lib/commands/make/frontend/model.js +27 -28
- package/lib/commands/make/frontend/notification.d.ts +12 -0
- package/lib/commands/make/frontend/notification.js +62 -0
- package/lib/commands/make/frontend/post-type.d.ts +12 -0
- package/lib/commands/make/frontend/post-type.js +59 -0
- package/lib/commands/make/locale.d.ts +11 -0
- package/lib/commands/make/locale.js +27 -0
- package/lib/commands/make/model.d.ts +12 -0
- package/lib/commands/make/model.js +29 -0
- package/lib/commands/make/notification.d.ts +11 -0
- package/lib/commands/make/notification.js +33 -0
- package/lib/commands/make/post-type.d.ts +11 -0
- package/lib/commands/make/post-type.js +31 -0
- package/lib/commands/monorepo/create.d.ts +12 -0
- package/lib/commands/monorepo/create.js +20 -0
- package/lib/commands/monorepo/split.d.ts +12 -0
- package/lib/commands/monorepo/split.js +19 -0
- package/lib/commands/update/js-imports.d.ts +1 -4
- package/lib/commands/update/js-imports.js +2 -3
- package/lib/commands/upgrade/2.0.d.ts +17 -0
- package/lib/commands/upgrade/2.0.js +113 -0
- package/lib/help.js +2 -2
- package/lib/providers/php-provider.d.ts +7 -1
- package/lib/providers/php-provider.js +18 -5
- package/lib/steps/extenders/{api-serializer.d.ts → api-resource.d.ts} +1 -1
- package/lib/steps/extenders/api-resource.js +38 -0
- package/lib/steps/extenders/base.d.ts +1 -1
- package/lib/steps/extenders/base.js +13 -1
- package/lib/steps/extenders/console-command.js +1 -1
- package/lib/steps/extenders/event.js +1 -1
- package/lib/steps/extenders/mail-driver.d.ts +5 -0
- package/lib/steps/extenders/mail-driver.js +58 -0
- package/lib/steps/extenders/middleware.d.ts +5 -0
- package/lib/steps/extenders/middleware.js +57 -0
- package/lib/steps/extenders/notification-driver.d.ts +5 -0
- package/lib/steps/extenders/notification-driver.js +58 -0
- package/lib/steps/extenders/notification-type.d.ts +5 -0
- package/lib/steps/extenders/notification-type.js +55 -0
- package/lib/steps/extenders/policy.js +1 -1
- package/lib/steps/extenders/post-type.d.ts +5 -0
- package/lib/steps/extenders/post-type.js +42 -0
- package/lib/steps/extenders/route.js +11 -2
- package/lib/steps/extenders/search-driver.d.ts +5 -0
- package/lib/steps/extenders/search-driver.js +38 -0
- package/lib/steps/extenders/search-filter.d.ts +5 -0
- package/lib/steps/extenders/search-filter.js +67 -0
- package/lib/steps/extenders/service-provider.js +1 -1
- package/lib/steps/gen-ext-scaffolder.d.ts +4 -4
- package/lib/steps/gen-ext-scaffolder.js +264 -58
- package/lib/steps/js/base.d.ts +14 -5
- package/lib/steps/js/base.js +101 -27
- package/lib/steps/js/model.d.ts +4 -7
- package/lib/steps/js/model.js +45 -19
- package/lib/steps/js/notification.d.ts +7 -0
- package/lib/steps/js/notification.js +58 -0
- package/lib/steps/js/post-type.d.ts +8 -0
- package/lib/steps/js/post-type.js +60 -0
- package/lib/steps/js/routes.d.ts +7 -0
- package/lib/steps/js/routes.js +63 -0
- package/lib/steps/js/search-driver-locale.d.ts +8 -0
- package/lib/steps/js/search-driver-locale.js +36 -0
- package/lib/steps/js/search-gambit.d.ts +7 -0
- package/lib/steps/js/search-gambit.js +51 -0
- package/lib/steps/locale/base.d.ts +32 -0
- package/lib/steps/locale/base.js +97 -0
- package/lib/steps/misc/composer.js +2 -2
- package/lib/steps/misc/git.d.ts +1 -1
- package/lib/steps/misc/git.js +3 -3
- package/lib/steps/misc/npm.d.ts +11 -0
- package/lib/steps/misc/npm.js +19 -0
- package/lib/steps/misc/yarn.js +2 -2
- package/lib/steps/monorepo/create.d.ts +19 -0
- package/lib/steps/monorepo/create.js +187 -0
- package/lib/steps/monorepo/split.d.ts +14 -0
- package/lib/steps/monorepo/split.js +99 -0
- package/lib/steps/stubs/backend/advanced-api-resource.d.ts +13 -0
- package/lib/steps/stubs/backend/advanced-api-resource.js +81 -0
- package/lib/steps/stubs/backend/{api-serializer.d.ts → api-resource.d.ts} +2 -2
- package/lib/steps/stubs/backend/{api-serializer.js → api-resource.js} +12 -9
- package/lib/steps/stubs/backend/command.d.ts +2 -21
- package/lib/steps/stubs/backend/command.js +15 -1
- package/lib/steps/stubs/backend/{api-controller.d.ts → controller.d.ts} +4 -14
- package/lib/steps/stubs/backend/controller.js +40 -0
- package/lib/steps/stubs/backend/event-listener.d.ts +1 -1
- package/lib/steps/stubs/backend/event-listener.js +3 -1
- package/lib/steps/stubs/backend/filter.d.ts +8 -0
- package/lib/steps/stubs/backend/filter.js +44 -0
- package/lib/steps/stubs/backend/handler-command.d.ts +2 -27
- package/lib/steps/stubs/backend/handler-command.js +3 -1
- package/lib/steps/stubs/backend/handler.d.ts +1 -1
- package/lib/steps/stubs/backend/handler.js +5 -1
- package/lib/steps/stubs/backend/integration-test.d.ts +1 -1
- package/lib/steps/stubs/backend/integration-test.js +1 -4
- package/lib/steps/stubs/backend/job.d.ts +1 -1
- package/lib/steps/stubs/backend/job.js +1 -0
- package/lib/steps/stubs/backend/mail-driver.d.ts +7 -0
- package/lib/steps/stubs/backend/mail-driver.js +30 -0
- package/lib/steps/stubs/backend/middleware.d.ts +22 -0
- package/lib/steps/stubs/backend/middleware.js +31 -0
- package/lib/steps/stubs/backend/migration.js +6 -3
- package/lib/steps/stubs/backend/model.d.ts +2 -24
- package/lib/steps/stubs/backend/model.js +3 -5
- package/lib/steps/stubs/backend/notification-blueprint.d.ts +7 -0
- package/lib/steps/stubs/backend/notification-blueprint.js +44 -0
- package/lib/steps/stubs/backend/notification-driver.d.ts +7 -0
- package/lib/steps/stubs/backend/notification-driver.js +30 -0
- package/lib/steps/stubs/backend/policy.d.ts +1 -1
- package/lib/steps/stubs/backend/policy.js +3 -1
- package/lib/steps/stubs/backend/post-type.d.ts +7 -0
- package/lib/steps/stubs/backend/post-type.js +44 -0
- package/lib/steps/stubs/backend/repository.d.ts +1 -1
- package/lib/steps/stubs/backend/repository.js +3 -1
- package/lib/steps/stubs/backend/search-driver-searcher.d.ts +24 -0
- package/lib/steps/stubs/backend/search-driver-searcher.js +32 -0
- package/lib/steps/stubs/backend/search-driver.d.ts +8 -0
- package/lib/steps/stubs/backend/search-driver.js +49 -0
- package/lib/steps/stubs/backend/service-provider.d.ts +1 -1
- package/lib/steps/stubs/backend/service-provider.js +1 -0
- package/lib/steps/stubs/backend/validator.d.ts +1 -1
- package/lib/steps/stubs/backend/validator.js +1 -0
- package/lib/steps/stubs/flarum-base.js +1 -1
- package/lib/steps/stubs/frontend/component.d.ts +0 -5
- package/lib/steps/stubs/frontend/component.js +1 -0
- package/lib/steps/stubs/frontend/forum-page.d.ts +25 -0
- package/lib/steps/stubs/frontend/forum-page.js +37 -0
- package/lib/steps/stubs/frontend/gambit.d.ts +7 -0
- package/lib/steps/stubs/frontend/gambit.js +50 -0
- package/lib/steps/stubs/frontend/modal.d.ts +0 -5
- package/lib/steps/stubs/frontend/modal.js +1 -0
- package/lib/steps/stubs/frontend/model.d.ts +8 -1
- package/lib/steps/stubs/frontend/model.js +6 -0
- package/lib/steps/stubs/frontend/notification.d.ts +11 -0
- package/lib/steps/stubs/frontend/notification.js +48 -0
- package/lib/steps/stubs/frontend/post-type.d.ts +11 -0
- package/lib/steps/stubs/frontend/post-type.js +48 -0
- package/lib/steps/stubs/js-base.js +12 -5
- package/lib/steps/stubs/php-base.js +13 -9
- package/lib/steps/update/js-imports.js +9 -3
- package/lib/steps/upgrade/twopointoh/backend/email-views.d.ts +18 -0
- package/lib/steps/upgrade/twopointoh/backend/email-views.js +81 -0
- package/lib/steps/upgrade/twopointoh/backend/filesystem.d.ts +8 -0
- package/lib/steps/upgrade/twopointoh/backend/filesystem.js +40 -0
- package/lib/steps/upgrade/twopointoh/backend/intervention-image.d.ts +8 -0
- package/lib/steps/upgrade/twopointoh/backend/intervention-image.js +44 -0
- package/lib/steps/upgrade/twopointoh/backend/json-api.d.ts +12 -0
- package/lib/steps/upgrade/twopointoh/backend/json-api.js +111 -0
- package/lib/steps/upgrade/twopointoh/backend/mailer.d.ts +8 -0
- package/lib/steps/upgrade/twopointoh/backend/mailer.js +37 -0
- package/lib/steps/upgrade/twopointoh/backend/misc.d.ts +8 -0
- package/lib/steps/upgrade/twopointoh/backend/misc.js +42 -0
- package/lib/steps/upgrade/twopointoh/backend/phpunit.d.ts +8 -0
- package/lib/steps/upgrade/twopointoh/backend/phpunit.js +52 -0
- package/lib/steps/upgrade/twopointoh/backend/search.d.ts +28 -0
- package/lib/steps/upgrade/twopointoh/backend/search.js +200 -0
- package/lib/steps/upgrade/twopointoh/base.d.ts +58 -0
- package/lib/steps/upgrade/twopointoh/base.js +284 -0
- package/lib/steps/upgrade/twopointoh/dependencies.d.ts +10 -0
- package/lib/steps/upgrade/twopointoh/dependencies.js +108 -0
- package/lib/steps/upgrade/twopointoh/frontend/code-splitting/usage-of-lazy-modules.d.ts +26 -0
- package/lib/steps/upgrade/twopointoh/frontend/code-splitting/usage-of-lazy-modules.js +418 -0
- package/lib/steps/upgrade/twopointoh/frontend/export-registry/compat.d.ts +12 -0
- package/lib/steps/upgrade/twopointoh/frontend/export-registry/compat.js +75 -0
- package/lib/steps/upgrade/twopointoh/frontend/export-registry/import-ext.d.ts +13 -0
- package/lib/steps/upgrade/twopointoh/frontend/export-registry/import-ext.js +126 -0
- package/lib/steps/upgrade/twopointoh/frontend/format.d.ts +8 -0
- package/lib/steps/upgrade/twopointoh/frontend/format.js +32 -0
- package/lib/steps/upgrade/twopointoh/frontend/misc.d.ts +17 -0
- package/lib/steps/upgrade/twopointoh/frontend/misc.js +433 -0
- package/lib/steps/upgrade/twopointoh/infra.d.ts +10 -0
- package/lib/steps/upgrade/twopointoh/infra.js +51 -0
- package/lib/steps/upgrade/twopointoh/less.d.ts +12 -0
- package/lib/steps/upgrade/twopointoh/less.js +217 -0
- package/lib/utils/add-extenders.d.ts +2 -0
- package/lib/utils/add-extenders.js +115 -0
- package/lib/utils/ast.d.ts +22 -0
- package/lib/utils/ast.js +235 -0
- package/lib/utils/composer.d.ts +2 -1
- package/lib/utils/migration.js +3 -1
- package/lib/utils/model-name.d.ts +1 -0
- package/lib/utils/model-name.js +7 -3
- package/lib/utils/monorepo.d.ts +24 -0
- package/lib/utils/monorepo.js +24 -0
- package/lib/utils/validation.d.ts +6 -1
- package/lib/utils/validation.js +15 -0
- package/oclif.manifest.json +1 -1
- package/package.json +27 -14
- package/php-subsystem/composer.json +11 -9
- package/php-subsystem/composer.lock +66 -71
- package/php-subsystem/index.php +41 -6
- package/php-subsystem/src/CustomPrettyPrinter.php +1 -1
- package/php-subsystem/src/ExtenderUtil.php +7 -13
- package/php-subsystem/src/NodeUtil.php +72 -0
- package/php-subsystem/src/NodeVisitors/AddExtender.php +28 -12
- package/php-subsystem/src/NodeVisitors/AddUses.php +24 -0
- package/php-subsystem/src/NodeVisitors/ChangeSignatures.php +200 -0
- package/php-subsystem/src/NodeVisitors/ReplaceUses.php +175 -0
- package/php-subsystem/src/Upgrade/Replacement.php +51 -0
- package/php-subsystem/src/Upgrade/ReplacementResult.php +17 -0
- package/php-subsystem/src/Upgrade/TwoPointOh/EmailViews.php +94 -0
- package/php-subsystem/src/Upgrade/TwoPointOh/Filesystem.php +88 -0
- package/php-subsystem/src/Upgrade/TwoPointOh/InterventionImage.php +86 -0
- package/php-subsystem/src/Upgrade/TwoPointOh/JsonApi.php +186 -0
- package/php-subsystem/src/Upgrade/TwoPointOh/Misc.php +564 -0
- package/php-subsystem/src/Upgrade/TwoPointOh/PhpUnit.php +241 -0
- package/php-subsystem/src/Upgrade/TwoPointOh/Search.php +589 -0
- package/php-subsystem/vendor/autoload.php +18 -0
- package/php-subsystem/vendor/bin/php-parse +119 -0
- package/php-subsystem/vendor/composer/ClassLoader.php +166 -32
- package/php-subsystem/vendor/composer/InstalledVersions.php +350 -209
- package/php-subsystem/vendor/composer/autoload_classmap.php +1 -1
- package/php-subsystem/vendor/composer/autoload_namespaces.php +1 -1
- package/php-subsystem/vendor/composer/autoload_psr4.php +1 -1
- package/php-subsystem/vendor/composer/autoload_real.php +3 -22
- package/php-subsystem/vendor/composer/installed.json +56 -61
- package/php-subsystem/vendor/composer/installed.php +29 -30
- package/php-subsystem/vendor/composer/platform_check.php +2 -2
- package/php-subsystem/vendor/nikic/php-parser/README.md +21 -13
- package/php-subsystem/vendor/nikic/php-parser/bin/php-parse +12 -11
- package/php-subsystem/vendor/nikic/php-parser/composer.json +41 -39
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php +58 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php +54 -25
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php +11 -4
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php +87 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php +116 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php +22 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php +26 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php +31 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php +5 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php +69 -26
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php +47 -18
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php +6 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php +25 -28
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php +31 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php +8 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Builder.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php +85 -70
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php +119 -71
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Comment/Doc.php +1 -2
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Comment.php +35 -67
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluationException.php +3 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php +17 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Error.php +24 -33
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php +6 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ErrorHandler.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Internal/DiffElem.php +11 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Internal/Differ.php +36 -22
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Internal/PrintableNewAnonClassNode.php +24 -14
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenPolyfill.php +237 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Internal/TokenStream.php +63 -69
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/JsonDecoder.php +15 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php +74 -92
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/AttributeEmulator.php +11 -18
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/EnumTokenEmulator.php +10 -15
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ExplicitOctalEmulator.php +45 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php +19 -25
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/MatchTokenEmulator.php +6 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NullsafeTokenEmulator.php +22 -29
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyFunctionTokenEmulator.php +31 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php +31 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/ReverseEmulator.php +6 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/TokenEmulator.php +10 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer.php +70 -491
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Modifiers.php +69 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NameContext.php +23 -24
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php +13 -14
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/ArrayItem.php +43 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Attribute.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/AttributeGroup.php +5 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/ClosureUse.php +36 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/ComplexType.php +13 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Const_.php +12 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/DeclareItem.php +37 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php +10 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php +1 -39
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php +11 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrowFunction.php +35 -30
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Coalesce.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php +8 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php +35 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php +5 -6
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php +5 -6
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php +12 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php +34 -27
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php +1 -32
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php +5 -6
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php +10 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php +15 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php +13 -14
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php +11 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php +12 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Match_.php +8 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php +18 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php +17 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafeMethodCall.php +18 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/NullsafePropertyFetch.php +10 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php +6 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php +10 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php +9 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php +19 -14
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php +11 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php +12 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Throw_.php +6 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php +6 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php +10 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Expr.php +1 -2
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php +6 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Identifier.php +13 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/InterpolatedStringPart.php +32 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/IntersectionType.php +27 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/MatchArm.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Name.php +80 -53
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/NullableType.php +10 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Param.php +47 -23
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/PropertyItem.php +37 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php +1 -68
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php +1 -29
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php +1 -28
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Float_.php +78 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Int_.php +82 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/InterpolatedString.php +34 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php +1 -71
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php +44 -24
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Scalar.php +1 -2
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/StaticVar.php +39 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Block.php +29 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php +10 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php +11 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php +33 -27
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php +15 -15
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php +66 -71
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php +48 -61
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php +1 -32
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php +12 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/EnumCase.php +11 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Enum_.php +17 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Expression.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php +19 -15
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php +20 -17
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php +31 -27
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php +16 -14
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php +18 -15
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php +13 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php +11 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php +35 -36
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php +1 -32
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php +1 -35
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php +8 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php +8 -9
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php +12 -13
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php +3 -4
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php +10 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php +11 -12
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php +7 -8
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php +1 -50
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php +16 -16
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php +9 -10
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt.php +1 -2
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/UnionType.php +8 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/UseItem.php +55 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/VarLikeIdentifier.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/VariadicPlaceholder.php +27 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node.php +24 -29
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php +20 -20
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php +169 -82
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeFinder.php +28 -19
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php +71 -84
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php +4 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CloningVisitor.php +1 -2
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/CommentAnnotatingVisitor.php +82 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php +4 -5
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FirstFindingVisitor.php +6 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php +40 -24
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NodeConnectingVisitor.php +2 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/ParentConnectingVisitor.php +8 -11
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php +59 -7
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php +1 -2
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php +2011 -2058
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Parser/Php8.php +2717 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Parser.php +9 -3
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php +466 -248
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ParserFactory.php +31 -33
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/PhpVersion.php +164 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php +419 -338
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter.php +51 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php +587 -431
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Token.php +18 -0
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/compatibility_tokens.php +63 -0
- package/boilerplate/stubs/backend/api-controller/create.php +0 -53
- package/boilerplate/stubs/backend/api-controller/delete.php +0 -52
- package/boilerplate/stubs/backend/api-controller/list.php +0 -61
- package/boilerplate/stubs/backend/api-controller/normal.php +0 -29
- package/boilerplate/stubs/backend/api-controller/show.php +0 -48
- package/boilerplate/stubs/backend/api-controller/update.php +0 -54
- package/boilerplate/stubs/backend/api-serializer.php +0 -36
- package/lib/commands/make/backend/api-controller.js +0 -27
- package/lib/commands/make/backend/api-serializer-attributes.js +0 -15
- package/lib/commands/make/backend/api-serializer.js +0 -15
- package/lib/steps/extenders/api-serializer.js +0 -77
- package/lib/steps/stubs/backend/api-controller.js +0 -62
- package/lib/steps/stubs/frontend/migration.js +0 -1
- package/php-subsystem/vendor/nikic/php-parser/.editorconfig +0 -9
- package/php-subsystem/vendor/nikic/php-parser/grammar/README.md +0 -30
- package/php-subsystem/vendor/nikic/php-parser/grammar/parser.template +0 -106
- package/php-subsystem/vendor/nikic/php-parser/grammar/php5.y +0 -1026
- package/php-subsystem/vendor/nikic/php-parser/grammar/php7.y +0 -1152
- package/php-subsystem/vendor/nikic/php-parser/grammar/phpyLang.php +0 -192
- package/php-subsystem/vendor/nikic/php-parser/grammar/rebuildParsers.php +0 -81
- package/php-subsystem/vendor/nikic/php-parser/grammar/tokens.template +0 -17
- package/php-subsystem/vendor/nikic/php-parser/grammar/tokens.y +0 -115
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/CoaleseEqualTokenEmulator.php +0 -47
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FlexibleDocStringEmulator.php +0 -76
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/FnTokenEmulator.php +0 -23
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/NumericLiteralSeparatorEmulator.php +0 -105
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php +0 -30
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php +0 -55
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php +0 -2630
- package/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/Parser/Tokens.php +0 -145
- /package/{lib/steps/stubs/frontend/migration.d.ts → boilerplate/skeleton/extension/js/tests/integration/.gitkeep} +0 -0
- /package/boilerplate/skeleton/extension/js/{webpack.config.js → webpack.config.cjs} +0 -0
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
namespace PhpParser\Internal;
|
|
4
4
|
|
|
5
|
+
use PhpParser\Token;
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* Provides operations on token streams, for use by pretty printer.
|
|
7
9
|
*
|
|
8
10
|
* @internal
|
|
9
11
|
*/
|
|
10
|
-
class TokenStream
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
private $tokens;
|
|
12
|
+
class TokenStream {
|
|
13
|
+
/** @var Token[] Tokens (in PhpToken::tokenize() format) */
|
|
14
|
+
private array $tokens;
|
|
14
15
|
/** @var int[] Map from position to indentation */
|
|
15
|
-
private $indentMap;
|
|
16
|
+
private array $indentMap;
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Create token stream instance.
|
|
19
20
|
*
|
|
20
|
-
* @param
|
|
21
|
+
* @param Token[] $tokens Tokens in PhpToken::tokenize() format
|
|
21
22
|
*/
|
|
22
23
|
public function __construct(array $tokens) {
|
|
23
24
|
$this->tokens = $tokens;
|
|
@@ -28,11 +29,9 @@ class TokenStream
|
|
|
28
29
|
* Whether the given position is immediately surrounded by parenthesis.
|
|
29
30
|
*
|
|
30
31
|
* @param int $startPos Start position
|
|
31
|
-
* @param int $endPos
|
|
32
|
-
*
|
|
33
|
-
* @return bool
|
|
32
|
+
* @param int $endPos End position
|
|
34
33
|
*/
|
|
35
|
-
public function haveParens(int $startPos, int $endPos)
|
|
34
|
+
public function haveParens(int $startPos, int $endPos): bool {
|
|
36
35
|
return $this->haveTokenImmediatelyBefore($startPos, '(')
|
|
37
36
|
&& $this->haveTokenImmediatelyAfter($endPos, ')');
|
|
38
37
|
}
|
|
@@ -41,11 +40,9 @@ class TokenStream
|
|
|
41
40
|
* Whether the given position is immediately surrounded by braces.
|
|
42
41
|
*
|
|
43
42
|
* @param int $startPos Start position
|
|
44
|
-
* @param int $endPos
|
|
45
|
-
*
|
|
46
|
-
* @return bool
|
|
43
|
+
* @param int $endPos End position
|
|
47
44
|
*/
|
|
48
|
-
public function haveBraces(int $startPos, int $endPos)
|
|
45
|
+
public function haveBraces(int $startPos, int $endPos): bool {
|
|
49
46
|
return ($this->haveTokenImmediatelyBefore($startPos, '{')
|
|
50
47
|
|| $this->haveTokenImmediatelyBefore($startPos, T_CURLY_OPEN))
|
|
51
48
|
&& $this->haveTokenImmediatelyAfter($endPos, '}');
|
|
@@ -56,21 +53,20 @@ class TokenStream
|
|
|
56
53
|
*
|
|
57
54
|
* During this check whitespace and comments are skipped.
|
|
58
55
|
*
|
|
59
|
-
* @param int
|
|
56
|
+
* @param int $pos Position before which the token should occur
|
|
60
57
|
* @param int|string $expectedTokenType Token to check for
|
|
61
58
|
*
|
|
62
59
|
* @return bool Whether the expected token was found
|
|
63
60
|
*/
|
|
64
|
-
public function haveTokenImmediatelyBefore(int $pos, $expectedTokenType)
|
|
61
|
+
public function haveTokenImmediatelyBefore(int $pos, $expectedTokenType): bool {
|
|
65
62
|
$tokens = $this->tokens;
|
|
66
63
|
$pos--;
|
|
67
64
|
for (; $pos >= 0; $pos--) {
|
|
68
|
-
$
|
|
69
|
-
if ($
|
|
65
|
+
$token = $tokens[$pos];
|
|
66
|
+
if ($token->is($expectedTokenType)) {
|
|
70
67
|
return true;
|
|
71
68
|
}
|
|
72
|
-
if (
|
|
73
|
-
&& $tokenType !== \T_COMMENT && $tokenType !== \T_DOC_COMMENT) {
|
|
69
|
+
if (!$token->isIgnorable()) {
|
|
74
70
|
break;
|
|
75
71
|
}
|
|
76
72
|
}
|
|
@@ -82,28 +78,28 @@ class TokenStream
|
|
|
82
78
|
*
|
|
83
79
|
* During this check whitespace and comments are skipped.
|
|
84
80
|
*
|
|
85
|
-
* @param int
|
|
81
|
+
* @param int $pos Position after which the token should occur
|
|
86
82
|
* @param int|string $expectedTokenType Token to check for
|
|
87
83
|
*
|
|
88
84
|
* @return bool Whether the expected token was found
|
|
89
85
|
*/
|
|
90
|
-
public function haveTokenImmediatelyAfter(int $pos, $expectedTokenType)
|
|
86
|
+
public function haveTokenImmediatelyAfter(int $pos, $expectedTokenType): bool {
|
|
91
87
|
$tokens = $this->tokens;
|
|
92
88
|
$pos++;
|
|
93
|
-
for (
|
|
94
|
-
$
|
|
95
|
-
if ($
|
|
89
|
+
for ($c = \count($tokens); $pos < $c; $pos++) {
|
|
90
|
+
$token = $tokens[$pos];
|
|
91
|
+
if ($token->is($expectedTokenType)) {
|
|
96
92
|
return true;
|
|
97
93
|
}
|
|
98
|
-
if (
|
|
99
|
-
&& $tokenType !== \T_COMMENT && $tokenType !== \T_DOC_COMMENT) {
|
|
94
|
+
if (!$token->isIgnorable()) {
|
|
100
95
|
break;
|
|
101
96
|
}
|
|
102
97
|
}
|
|
103
98
|
return false;
|
|
104
99
|
}
|
|
105
100
|
|
|
106
|
-
|
|
101
|
+
/** @param int|string|(int|string)[] $skipTokenType */
|
|
102
|
+
public function skipLeft(int $pos, $skipTokenType): int {
|
|
107
103
|
$tokens = $this->tokens;
|
|
108
104
|
|
|
109
105
|
$pos = $this->skipLeftWhitespace($pos);
|
|
@@ -111,7 +107,7 @@ class TokenStream
|
|
|
111
107
|
return $pos;
|
|
112
108
|
}
|
|
113
109
|
|
|
114
|
-
if (
|
|
110
|
+
if (!$tokens[$pos]->is($skipTokenType)) {
|
|
115
111
|
// Shouldn't happen. The skip token MUST be there
|
|
116
112
|
throw new \Exception('Encountered unexpected token');
|
|
117
113
|
}
|
|
@@ -120,7 +116,8 @@ class TokenStream
|
|
|
120
116
|
return $this->skipLeftWhitespace($pos);
|
|
121
117
|
}
|
|
122
118
|
|
|
123
|
-
|
|
119
|
+
/** @param int|string|(int|string)[] $skipTokenType */
|
|
120
|
+
public function skipRight(int $pos, $skipTokenType): int {
|
|
124
121
|
$tokens = $this->tokens;
|
|
125
122
|
|
|
126
123
|
$pos = $this->skipRightWhitespace($pos);
|
|
@@ -128,7 +125,7 @@ class TokenStream
|
|
|
128
125
|
return $pos;
|
|
129
126
|
}
|
|
130
127
|
|
|
131
|
-
if (
|
|
128
|
+
if (!$tokens[$pos]->is($skipTokenType)) {
|
|
132
129
|
// Shouldn't happen. The skip token MUST be there
|
|
133
130
|
throw new \Exception('Encountered unexpected token');
|
|
134
131
|
}
|
|
@@ -143,11 +140,10 @@ class TokenStream
|
|
|
143
140
|
* @param int $pos Token position
|
|
144
141
|
* @return int Non-whitespace token position
|
|
145
142
|
*/
|
|
146
|
-
public function skipLeftWhitespace(int $pos) {
|
|
143
|
+
public function skipLeftWhitespace(int $pos): int {
|
|
147
144
|
$tokens = $this->tokens;
|
|
148
145
|
for (; $pos >= 0; $pos--) {
|
|
149
|
-
|
|
150
|
-
if ($type !== \T_WHITESPACE && $type !== \T_COMMENT && $type !== \T_DOC_COMMENT) {
|
|
146
|
+
if (!$tokens[$pos]->isIgnorable()) {
|
|
151
147
|
break;
|
|
152
148
|
}
|
|
153
149
|
}
|
|
@@ -160,22 +156,21 @@ class TokenStream
|
|
|
160
156
|
* @param int $pos Token position
|
|
161
157
|
* @return int Non-whitespace token position
|
|
162
158
|
*/
|
|
163
|
-
public function skipRightWhitespace(int $pos) {
|
|
159
|
+
public function skipRightWhitespace(int $pos): int {
|
|
164
160
|
$tokens = $this->tokens;
|
|
165
161
|
for ($count = \count($tokens); $pos < $count; $pos++) {
|
|
166
|
-
|
|
167
|
-
if ($type !== \T_WHITESPACE && $type !== \T_COMMENT && $type !== \T_DOC_COMMENT) {
|
|
162
|
+
if (!$tokens[$pos]->isIgnorable()) {
|
|
168
163
|
break;
|
|
169
164
|
}
|
|
170
165
|
}
|
|
171
166
|
return $pos;
|
|
172
167
|
}
|
|
173
168
|
|
|
174
|
-
|
|
169
|
+
/** @param int|string|(int|string)[] $findTokenType */
|
|
170
|
+
public function findRight(int $pos, $findTokenType): int {
|
|
175
171
|
$tokens = $this->tokens;
|
|
176
172
|
for ($count = \count($tokens); $pos < $count; $pos++) {
|
|
177
|
-
|
|
178
|
-
if ($type === $findTokenType) {
|
|
173
|
+
if ($tokens[$pos]->is($findTokenType)) {
|
|
179
174
|
return $pos;
|
|
180
175
|
}
|
|
181
176
|
}
|
|
@@ -190,20 +185,19 @@ class TokenStream
|
|
|
190
185
|
* @param int|string $tokenType Token type to look for
|
|
191
186
|
* @return bool Whether the token occurs in the given range
|
|
192
187
|
*/
|
|
193
|
-
public function haveTokenInRange(int $startPos, int $endPos, $tokenType) {
|
|
188
|
+
public function haveTokenInRange(int $startPos, int $endPos, $tokenType): bool {
|
|
194
189
|
$tokens = $this->tokens;
|
|
195
190
|
for ($pos = $startPos; $pos < $endPos; $pos++) {
|
|
196
|
-
if ($tokens[$pos]
|
|
191
|
+
if ($tokens[$pos]->is($tokenType)) {
|
|
197
192
|
return true;
|
|
198
193
|
}
|
|
199
194
|
}
|
|
200
195
|
return false;
|
|
201
196
|
}
|
|
202
197
|
|
|
203
|
-
public function
|
|
204
|
-
return $this->haveTokenInRange($startPos, $endPos,
|
|
205
|
-
|| $this->haveTokenInRange($startPos, $endPos,
|
|
206
|
-
|| $this->haveTokenInRange($startPos, $endPos, '}');
|
|
198
|
+
public function haveTagInRange(int $startPos, int $endPos): bool {
|
|
199
|
+
return $this->haveTokenInRange($startPos, $endPos, \T_OPEN_TAG)
|
|
200
|
+
|| $this->haveTokenInRange($startPos, $endPos, \T_CLOSE_TAG);
|
|
207
201
|
}
|
|
208
202
|
|
|
209
203
|
/**
|
|
@@ -213,41 +207,37 @@ class TokenStream
|
|
|
213
207
|
*
|
|
214
208
|
* @return int Indentation depth (in spaces)
|
|
215
209
|
*/
|
|
216
|
-
public function getIndentationBefore(int $pos)
|
|
210
|
+
public function getIndentationBefore(int $pos): int {
|
|
217
211
|
return $this->indentMap[$pos];
|
|
218
212
|
}
|
|
219
213
|
|
|
220
214
|
/**
|
|
221
215
|
* Get the code corresponding to a token offset range, optionally adjusted for indentation.
|
|
222
216
|
*
|
|
223
|
-
* @param int $from
|
|
224
|
-
* @param int $to
|
|
217
|
+
* @param int $from Token start position (inclusive)
|
|
218
|
+
* @param int $to Token end position (exclusive)
|
|
225
219
|
* @param int $indent By how much the code should be indented (can be negative as well)
|
|
226
220
|
*
|
|
227
221
|
* @return string Code corresponding to token range, adjusted for indentation
|
|
228
222
|
*/
|
|
229
|
-
public function getTokenCode(int $from, int $to, int $indent)
|
|
223
|
+
public function getTokenCode(int $from, int $to, int $indent): string {
|
|
230
224
|
$tokens = $this->tokens;
|
|
231
225
|
$result = '';
|
|
232
226
|
for ($pos = $from; $pos < $to; $pos++) {
|
|
233
227
|
$token = $tokens[$pos];
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
228
|
+
$id = $token->id;
|
|
229
|
+
$text = $token->text;
|
|
230
|
+
if ($id === \T_CONSTANT_ENCAPSED_STRING || $id === \T_ENCAPSED_AND_WHITESPACE) {
|
|
231
|
+
$result .= $text;
|
|
232
|
+
} else {
|
|
233
|
+
// TODO Handle non-space indentation
|
|
234
|
+
if ($indent < 0) {
|
|
235
|
+
$result .= str_replace("\n" . str_repeat(" ", -$indent), "\n", $text);
|
|
236
|
+
} elseif ($indent > 0) {
|
|
237
|
+
$result .= str_replace("\n", "\n" . str_repeat(" ", $indent), $text);
|
|
239
238
|
} else {
|
|
240
|
-
|
|
241
|
-
if ($indent < 0) {
|
|
242
|
-
$result .= str_replace("\n" . str_repeat(" ", -$indent), "\n", $content);
|
|
243
|
-
} elseif ($indent > 0) {
|
|
244
|
-
$result .= str_replace("\n", "\n" . str_repeat(" ", $indent), $content);
|
|
245
|
-
} else {
|
|
246
|
-
$result .= $content;
|
|
247
|
-
}
|
|
239
|
+
$result .= $text;
|
|
248
240
|
}
|
|
249
|
-
} else {
|
|
250
|
-
$result .= $token;
|
|
251
241
|
}
|
|
252
242
|
}
|
|
253
243
|
return $result;
|
|
@@ -258,17 +248,21 @@ class TokenStream
|
|
|
258
248
|
*
|
|
259
249
|
* @return int[] Token position to indentation map
|
|
260
250
|
*/
|
|
261
|
-
private function calcIndentMap() {
|
|
251
|
+
private function calcIndentMap(): array {
|
|
262
252
|
$indentMap = [];
|
|
263
253
|
$indent = 0;
|
|
264
|
-
foreach ($this->tokens as $token) {
|
|
254
|
+
foreach ($this->tokens as $i => $token) {
|
|
265
255
|
$indentMap[] = $indent;
|
|
266
256
|
|
|
267
|
-
if ($token
|
|
268
|
-
$content = $token
|
|
257
|
+
if ($token->id === \T_WHITESPACE) {
|
|
258
|
+
$content = $token->text;
|
|
269
259
|
$newlinePos = \strrpos($content, "\n");
|
|
270
260
|
if (false !== $newlinePos) {
|
|
271
261
|
$indent = \strlen($content) - $newlinePos - 1;
|
|
262
|
+
} elseif ($i === 1 && $this->tokens[0]->id === \T_OPEN_TAG &&
|
|
263
|
+
$this->tokens[0]->text[\strlen($this->tokens[0]->text) - 1] === "\n") {
|
|
264
|
+
// Special case: Newline at the end of opening tag followed by whitespace.
|
|
265
|
+
$indent = \strlen($content);
|
|
272
266
|
}
|
|
273
267
|
}
|
|
274
268
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
namespace PhpParser;
|
|
4
4
|
|
|
5
|
-
class JsonDecoder
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
private $reflectionClassCache;
|
|
5
|
+
class JsonDecoder {
|
|
6
|
+
/** @var \ReflectionClass<Node>[] Node type to reflection class map */
|
|
7
|
+
private array $reflectionClassCache;
|
|
9
8
|
|
|
9
|
+
/** @return mixed */
|
|
10
10
|
public function decode(string $json) {
|
|
11
11
|
$value = json_decode($json, true);
|
|
12
12
|
if (json_last_error()) {
|
|
@@ -16,6 +16,10 @@ class JsonDecoder
|
|
|
16
16
|
return $this->decodeRecursive($value);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @param mixed $value
|
|
21
|
+
* @return mixed
|
|
22
|
+
*/
|
|
19
23
|
private function decodeRecursive($value) {
|
|
20
24
|
if (\is_array($value)) {
|
|
21
25
|
if (isset($value['nodeType'])) {
|
|
@@ -29,7 +33,7 @@ class JsonDecoder
|
|
|
29
33
|
return $value;
|
|
30
34
|
}
|
|
31
35
|
|
|
32
|
-
private function decodeArray(array $array)
|
|
36
|
+
private function decodeArray(array $array): array {
|
|
33
37
|
$decodedArray = [];
|
|
34
38
|
foreach ($array as $key => $value) {
|
|
35
39
|
$decodedArray[$key] = $this->decodeRecursive($value);
|
|
@@ -37,14 +41,13 @@ class JsonDecoder
|
|
|
37
41
|
return $decodedArray;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
|
-
private function decodeNode(array $value)
|
|
44
|
+
private function decodeNode(array $value): Node {
|
|
41
45
|
$nodeType = $value['nodeType'];
|
|
42
46
|
if (!\is_string($nodeType)) {
|
|
43
47
|
throw new \RuntimeException('Node type must be a string');
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
$reflectionClass = $this->reflectionClassFromNodeType($nodeType);
|
|
47
|
-
/** @var Node $node */
|
|
48
51
|
$node = $reflectionClass->newInstanceWithoutConstructor();
|
|
49
52
|
|
|
50
53
|
if (isset($value['attributes'])) {
|
|
@@ -66,7 +69,7 @@ class JsonDecoder
|
|
|
66
69
|
return $node;
|
|
67
70
|
}
|
|
68
71
|
|
|
69
|
-
private function decodeComment(array $value)
|
|
72
|
+
private function decodeComment(array $value): Comment {
|
|
70
73
|
$className = $value['nodeType'] === 'Comment' ? Comment::class : Comment\Doc::class;
|
|
71
74
|
if (!isset($value['text'])) {
|
|
72
75
|
throw new \RuntimeException('Comment must have text');
|
|
@@ -79,7 +82,8 @@ class JsonDecoder
|
|
|
79
82
|
);
|
|
80
83
|
}
|
|
81
84
|
|
|
82
|
-
|
|
85
|
+
/** @return \ReflectionClass<Node> */
|
|
86
|
+
private function reflectionClassFromNodeType(string $nodeType): \ReflectionClass {
|
|
83
87
|
if (!isset($this->reflectionClassCache[$nodeType])) {
|
|
84
88
|
$className = $this->classNameFromNodeType($nodeType);
|
|
85
89
|
$this->reflectionClassCache[$nodeType] = new \ReflectionClass($className);
|
|
@@ -87,7 +91,8 @@ class JsonDecoder
|
|
|
87
91
|
return $this->reflectionClassCache[$nodeType];
|
|
88
92
|
}
|
|
89
93
|
|
|
90
|
-
|
|
94
|
+
/** @return class-string<Node> */
|
|
95
|
+
private function classNameFromNodeType(string $nodeType): string {
|
|
91
96
|
$className = 'PhpParser\\Node\\' . strtr($nodeType, '_', '\\');
|
|
92
97
|
if (class_exists($className)) {
|
|
93
98
|
return $className;
|
|
@@ -8,51 +8,45 @@ use PhpParser\Lexer;
|
|
|
8
8
|
use PhpParser\Lexer\TokenEmulator\AttributeEmulator;
|
|
9
9
|
use PhpParser\Lexer\TokenEmulator\EnumTokenEmulator;
|
|
10
10
|
use PhpParser\Lexer\TokenEmulator\CoaleseEqualTokenEmulator;
|
|
11
|
+
use PhpParser\Lexer\TokenEmulator\ExplicitOctalEmulator;
|
|
11
12
|
use PhpParser\Lexer\TokenEmulator\FlexibleDocStringEmulator;
|
|
12
13
|
use PhpParser\Lexer\TokenEmulator\FnTokenEmulator;
|
|
13
14
|
use PhpParser\Lexer\TokenEmulator\MatchTokenEmulator;
|
|
14
15
|
use PhpParser\Lexer\TokenEmulator\NullsafeTokenEmulator;
|
|
15
16
|
use PhpParser\Lexer\TokenEmulator\NumericLiteralSeparatorEmulator;
|
|
17
|
+
use PhpParser\Lexer\TokenEmulator\ReadonlyFunctionTokenEmulator;
|
|
18
|
+
use PhpParser\Lexer\TokenEmulator\ReadonlyTokenEmulator;
|
|
16
19
|
use PhpParser\Lexer\TokenEmulator\ReverseEmulator;
|
|
17
20
|
use PhpParser\Lexer\TokenEmulator\TokenEmulator;
|
|
21
|
+
use PhpParser\PhpVersion;
|
|
22
|
+
use PhpParser\Token;
|
|
18
23
|
|
|
19
|
-
class Emulative extends Lexer
|
|
20
|
-
{
|
|
21
|
-
|
|
22
|
-
const PHP_7_4 = '7.4dev';
|
|
23
|
-
const PHP_8_0 = '8.0dev';
|
|
24
|
-
const PHP_8_1 = '8.1dev';
|
|
24
|
+
class Emulative extends Lexer {
|
|
25
|
+
/** @var array{int, string, string}[] Patches used to reverse changes introduced in the code */
|
|
26
|
+
private array $patches = [];
|
|
25
27
|
|
|
26
|
-
/** @var
|
|
27
|
-
private $
|
|
28
|
+
/** @var list<TokenEmulator> */
|
|
29
|
+
private array $emulators = [];
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
private $emulators = [];
|
|
31
|
+
private PhpVersion $targetPhpVersion;
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
private $targetPhpVersion;
|
|
33
|
+
private PhpVersion $hostPhpVersion;
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* @param
|
|
37
|
-
* accepts a 'phpVersion' string that specifies the
|
|
38
|
-
* version to emulated. Defaults to newest supported.
|
|
36
|
+
* @param PhpVersion|null $phpVersion PHP version to emulate. Defaults to newest supported.
|
|
39
37
|
*/
|
|
40
|
-
public function __construct(
|
|
41
|
-
|
|
42
|
-
$this->
|
|
43
|
-
unset($options['phpVersion']);
|
|
44
|
-
|
|
45
|
-
parent::__construct($options);
|
|
38
|
+
public function __construct(?PhpVersion $phpVersion = null) {
|
|
39
|
+
$this->targetPhpVersion = $phpVersion ?? PhpVersion::getNewestSupported();
|
|
40
|
+
$this->hostPhpVersion = PhpVersion::getHostVersion();
|
|
46
41
|
|
|
47
42
|
$emulators = [
|
|
48
|
-
new FlexibleDocStringEmulator(),
|
|
49
|
-
new FnTokenEmulator(),
|
|
50
43
|
new MatchTokenEmulator(),
|
|
51
|
-
new CoaleseEqualTokenEmulator(),
|
|
52
|
-
new NumericLiteralSeparatorEmulator(),
|
|
53
44
|
new NullsafeTokenEmulator(),
|
|
54
45
|
new AttributeEmulator(),
|
|
55
46
|
new EnumTokenEmulator(),
|
|
47
|
+
new ReadonlyTokenEmulator(),
|
|
48
|
+
new ExplicitOctalEmulator(),
|
|
49
|
+
new ReadonlyFunctionTokenEmulator(),
|
|
56
50
|
];
|
|
57
51
|
|
|
58
52
|
// Collect emulators that are relevant for the PHP version we're running
|
|
@@ -61,21 +55,24 @@ class Emulative extends Lexer
|
|
|
61
55
|
$emulatorPhpVersion = $emulator->getPhpVersion();
|
|
62
56
|
if ($this->isForwardEmulationNeeded($emulatorPhpVersion)) {
|
|
63
57
|
$this->emulators[] = $emulator;
|
|
64
|
-
}
|
|
58
|
+
} elseif ($this->isReverseEmulationNeeded($emulatorPhpVersion)) {
|
|
65
59
|
$this->emulators[] = new ReverseEmulator($emulator);
|
|
66
60
|
}
|
|
67
61
|
}
|
|
68
62
|
}
|
|
69
63
|
|
|
70
|
-
public function
|
|
71
|
-
$emulators = array_filter($this->emulators, function($emulator) use($code) {
|
|
64
|
+
public function tokenize(string $code, ?ErrorHandler $errorHandler = null): array {
|
|
65
|
+
$emulators = array_filter($this->emulators, function ($emulator) use ($code) {
|
|
72
66
|
return $emulator->isEmulationNeeded($code);
|
|
73
67
|
});
|
|
74
68
|
|
|
75
69
|
if (empty($emulators)) {
|
|
76
70
|
// Nothing to emulate, yay
|
|
77
|
-
parent::
|
|
78
|
-
|
|
71
|
+
return parent::tokenize($code, $errorHandler);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if ($errorHandler === null) {
|
|
75
|
+
$errorHandler = new ErrorHandler\Throwing();
|
|
79
76
|
}
|
|
80
77
|
|
|
81
78
|
$this->patches = [];
|
|
@@ -84,9 +81,9 @@ class Emulative extends Lexer
|
|
|
84
81
|
}
|
|
85
82
|
|
|
86
83
|
$collector = new ErrorHandler\Collecting();
|
|
87
|
-
parent::
|
|
84
|
+
$tokens = parent::tokenize($code, $collector);
|
|
88
85
|
$this->sortPatches();
|
|
89
|
-
$this->fixupTokens();
|
|
86
|
+
$tokens = $this->fixupTokens($tokens);
|
|
90
87
|
|
|
91
88
|
$errors = $collector->getErrors();
|
|
92
89
|
if (!empty($errors)) {
|
|
@@ -97,90 +94,80 @@ class Emulative extends Lexer
|
|
|
97
94
|
}
|
|
98
95
|
|
|
99
96
|
foreach ($emulators as $emulator) {
|
|
100
|
-
$
|
|
97
|
+
$tokens = $emulator->emulate($code, $tokens);
|
|
101
98
|
}
|
|
99
|
+
|
|
100
|
+
return $tokens;
|
|
102
101
|
}
|
|
103
102
|
|
|
104
|
-
private function isForwardEmulationNeeded(
|
|
105
|
-
return
|
|
106
|
-
&&
|
|
103
|
+
private function isForwardEmulationNeeded(PhpVersion $emulatorPhpVersion): bool {
|
|
104
|
+
return $this->hostPhpVersion->older($emulatorPhpVersion)
|
|
105
|
+
&& $this->targetPhpVersion->newerOrEqual($emulatorPhpVersion);
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
private function isReverseEmulationNeeded(
|
|
110
|
-
return
|
|
111
|
-
&&
|
|
108
|
+
private function isReverseEmulationNeeded(PhpVersion $emulatorPhpVersion): bool {
|
|
109
|
+
return $this->hostPhpVersion->newerOrEqual($emulatorPhpVersion)
|
|
110
|
+
&& $this->targetPhpVersion->older($emulatorPhpVersion);
|
|
112
111
|
}
|
|
113
112
|
|
|
114
|
-
private function sortPatches()
|
|
115
|
-
{
|
|
113
|
+
private function sortPatches(): void {
|
|
116
114
|
// Patches may be contributed by different emulators.
|
|
117
115
|
// Make sure they are sorted by increasing patch position.
|
|
118
|
-
usort($this->patches, function($p1, $p2) {
|
|
116
|
+
usort($this->patches, function ($p1, $p2) {
|
|
119
117
|
return $p1[0] <=> $p2[0];
|
|
120
118
|
});
|
|
121
119
|
}
|
|
122
120
|
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
/**
|
|
122
|
+
* @param list<Token> $tokens
|
|
123
|
+
* @return list<Token>
|
|
124
|
+
*/
|
|
125
|
+
private function fixupTokens(array $tokens): array {
|
|
125
126
|
if (\count($this->patches) === 0) {
|
|
126
|
-
return;
|
|
127
|
+
return $tokens;
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
// Load first patch
|
|
130
131
|
$patchIdx = 0;
|
|
131
|
-
|
|
132
132
|
list($patchPos, $patchType, $patchText) = $this->patches[$patchIdx];
|
|
133
133
|
|
|
134
134
|
// We use a manual loop over the tokens, because we modify the array on the fly
|
|
135
|
-
$
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
// Fetch the next patch
|
|
145
|
-
$patchIdx++;
|
|
146
|
-
if ($patchIdx >= \count($this->patches)) {
|
|
147
|
-
// No more patches, we're done
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
list($patchPos, $patchType, $patchText) = $this->patches[$patchIdx];
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
$pos += \strlen($token);
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
$len = \strlen($token[1]);
|
|
158
|
-
$posDelta = 0;
|
|
135
|
+
$posDelta = 0;
|
|
136
|
+
$lineDelta = 0;
|
|
137
|
+
for ($i = 0, $c = \count($tokens); $i < $c; $i++) {
|
|
138
|
+
$token = $tokens[$i];
|
|
139
|
+
$pos = $token->pos;
|
|
140
|
+
$token->pos += $posDelta;
|
|
141
|
+
$token->line += $lineDelta;
|
|
142
|
+
$localPosDelta = 0;
|
|
143
|
+
$len = \strlen($token->text);
|
|
159
144
|
while ($patchPos >= $pos && $patchPos < $pos + $len) {
|
|
160
145
|
$patchTextLen = \strlen($patchText);
|
|
161
146
|
if ($patchType === 'remove') {
|
|
162
147
|
if ($patchPos === $pos && $patchTextLen === $len) {
|
|
163
148
|
// Remove token entirely
|
|
164
|
-
array_splice($
|
|
149
|
+
array_splice($tokens, $i, 1, []);
|
|
165
150
|
$i--;
|
|
166
151
|
$c--;
|
|
167
152
|
} else {
|
|
168
153
|
// Remove from token string
|
|
169
|
-
$
|
|
170
|
-
$token
|
|
154
|
+
$token->text = substr_replace(
|
|
155
|
+
$token->text, '', $patchPos - $pos + $localPosDelta, $patchTextLen
|
|
171
156
|
);
|
|
172
|
-
$
|
|
157
|
+
$localPosDelta -= $patchTextLen;
|
|
173
158
|
}
|
|
159
|
+
$lineDelta -= \substr_count($patchText, "\n");
|
|
174
160
|
} elseif ($patchType === 'add') {
|
|
175
161
|
// Insert into the token string
|
|
176
|
-
$
|
|
177
|
-
$token
|
|
162
|
+
$token->text = substr_replace(
|
|
163
|
+
$token->text, $patchText, $patchPos - $pos + $localPosDelta, 0
|
|
178
164
|
);
|
|
179
|
-
$
|
|
180
|
-
|
|
165
|
+
$localPosDelta += $patchTextLen;
|
|
166
|
+
$lineDelta += \substr_count($patchText, "\n");
|
|
167
|
+
} elseif ($patchType === 'replace') {
|
|
181
168
|
// Replace inside the token string
|
|
182
|
-
$
|
|
183
|
-
$token
|
|
169
|
+
$token->text = substr_replace(
|
|
170
|
+
$token->text, $patchText, $patchPos - $pos + $localPosDelta, $patchTextLen
|
|
184
171
|
);
|
|
185
172
|
} else {
|
|
186
173
|
assert(false);
|
|
@@ -189,22 +176,17 @@ class Emulative extends Lexer
|
|
|
189
176
|
// Fetch the next patch
|
|
190
177
|
$patchIdx++;
|
|
191
178
|
if ($patchIdx >= \count($this->patches)) {
|
|
192
|
-
// No more patches, we
|
|
193
|
-
|
|
179
|
+
// No more patches. However, we still need to adjust position.
|
|
180
|
+
$patchPos = \PHP_INT_MAX;
|
|
181
|
+
break;
|
|
194
182
|
}
|
|
195
183
|
|
|
196
184
|
list($patchPos, $patchType, $patchText) = $this->patches[$patchIdx];
|
|
197
|
-
|
|
198
|
-
// Multiple patches may apply to the same token. Reload the current one to check
|
|
199
|
-
// If the new patch applies
|
|
200
|
-
$token = $this->tokens[$i];
|
|
201
185
|
}
|
|
202
186
|
|
|
203
|
-
$
|
|
187
|
+
$posDelta += $localPosDelta;
|
|
204
188
|
}
|
|
205
|
-
|
|
206
|
-
// A patch did not apply
|
|
207
|
-
assert(false);
|
|
189
|
+
return $tokens;
|
|
208
190
|
}
|
|
209
191
|
|
|
210
192
|
/**
|
|
@@ -212,7 +194,7 @@ class Emulative extends Lexer
|
|
|
212
194
|
*
|
|
213
195
|
* @param Error[] $errors
|
|
214
196
|
*/
|
|
215
|
-
private function fixupErrors(array $errors) {
|
|
197
|
+
private function fixupErrors(array $errors): void {
|
|
216
198
|
foreach ($errors as $error) {
|
|
217
199
|
$attrs = $error->getAttributes();
|
|
218
200
|
|
|
@@ -228,7 +210,7 @@ class Emulative extends Lexer
|
|
|
228
210
|
if ($patchType === 'add') {
|
|
229
211
|
$posDelta += strlen($patchText);
|
|
230
212
|
$lineDelta += substr_count($patchText, "\n");
|
|
231
|
-
}
|
|
213
|
+
} elseif ($patchType === 'remove') {
|
|
232
214
|
$posDelta -= strlen($patchText);
|
|
233
215
|
$lineDelta -= substr_count($patchText, "\n");
|
|
234
216
|
}
|