diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 000000000..e22022cc3 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,10 @@ +comment: off + +coverage: + status: + patch: + default: + target: 80% + project: + default: + target: auto diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..efe88a949 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +standalone.js diff --git a/.eslintrc.yml b/.eslintrc.yml index aff7c62cc..e5a44beea 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,28 +1,29 @@ --- extends: -- eslint:recommended -- plugin:prettier/recommended -- plugin:jest/recommended + - eslint:recommended + - plugin:prettier/recommended + - plugin:jest/recommended + - plugin:prettier-doc/recommended +parserOptions: + ecmaVersion: 2023 + sourceType: "module" plugins: -- import + - import root: true env: - es6: true + es2024: true node: true jest: true rules: + eqeqeq: error curly: error - import/no-extraneous-dependencies: - - error - - devDependencies: ["tests*/**", "scripts/**"] no-else-return: error no-inner-declarations: error - no-unneeded-ternary: error no-useless-return: error no-var: error one-var: - - error - - never + - error + - never object-shorthand: error prefer-arrow-callback: error prefer-const: error @@ -32,12 +33,23 @@ rules: strict: error symbol-description: error yoda: - - error - - never - - exceptRange: true + - error + - never + - exceptRange: true + + import/extensions: + - error + - ignorePackages + import/no-extraneous-dependencies: + - error + - devDependencies: ["tests*/**", "scripts/**", "build/**"] overrides: -- files: "tests/**/*.js" - rules: - strict: off - globals: - run_spec: true + - files: "**/*.cjs" + parserOptions: + sourceType: "script" + - files: "tests/**/*.mjs" + globals: + run_spec: true + - files: "build/*.mjs" + parserOptions: + sourceType: module diff --git a/.gitattributes b/.gitattributes index 3b668f709..ced03355d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,15 @@ +* text=auto eol=lf tests/newline/CRLF.php text eol=crlf +tests/newline/html-CRLF.php text eol=crlf +tests/newline/mixed-CRLF.php text eol=crlf +tests/newline/comment-block-CRLF.php text eol=crlf +tests/require-pragma/file-with-alt-pragma-CRLF.php text eol=crlf +tests/require-pragma/file-with-pragma-CRLF.php text eol=crlf +tests/require-pragma/file-without-pragma-and-no-docblock-CRLF.php text eol=crlf +tests/require-pragma/file-without-pragma-CRLF.php text eol=crlf +tests/insert-pragma/pragma-alreadyinserted-CRLF.php eol=crlf +tests/insert-pragma/pragma-nodocblock-CRLF.php eol=crlf +tests/insert-pragma/pragma-sparsedocblock-CRLF.php eol=crlf +tests/insert-pragma/pragma-weirddocblock-alt-CRLF.php eol=crlf +tests/insert-pragma/pragma-weirddocblock-CRLF.php eol=crlf +tests/insert-pragma/pragma-withdocblock-CRLF.php eol=crlf diff --git a/.github/ISSUE_TEMPLATE/formatting.md b/.github/ISSUE_TEMPLATE/formatting.md new file mode 100644 index 000000000..bbe3bd253 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/formatting.md @@ -0,0 +1,50 @@ +--- +name: ✨ Formatting +about: Issues for ugly or incorrect code +--- + + + +**Prettier 1.16.4** + +**PHP Plugin 0.10.2** + +```sh +# Options (if any): +--single-quote +``` + +**Input:** + +```php +// code snippet +``` + +**Output:** + +```php +// code snippet +``` + +**Expected behavior:** diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..1bf21e662 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + - package-ecosystem: npm + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 000000000..7a644cbad --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,54 @@ +name: Node CI + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + cache: "yarn" + - run: yarn install --frozen-lockfile + - run: yarn lint + + test: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + node-version: [18.x, 20.x, 22.x, 24.x] + + env: + ENABLE_COVERAGE: true + AST_COMPARE: true + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "yarn" + - run: yarn install --frozen-lockfile + - run: yarn c8 yarn test:node + - uses: codecov/codecov-action@v5 + with: + fail_ci_if_error: true + disable_search: true + files: coverage/lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + - run: yarn test:standalone diff --git a/.gitignore b/.gitignore index 852b93c1f..6dbd0bc1f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ coverage __pycache__/ *.pyc *.swp +/standalone.js diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..7ded15658 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +tests/**/* +!tests/**/jsfmt.spec.js diff --git a/.prettierrc.yml b/.prettierrc.yml new file mode 100644 index 000000000..f7083e1a8 --- /dev/null +++ b/.prettierrc.yml @@ -0,0 +1 @@ +trailingComma: "es5" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1ec0b85c9..000000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -language: node_js -node_js: - - 6 - - 8 - - 9 -cache: - yarn: true - directories: - - node_modules -install: - - yarn install -script: - - AST_COMPARE=1 yarn test -- --runInBand diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c0251f331..9122ac01b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,15 +5,49 @@ To get up and running, install the dependencies and run the tests: ```bash yarn yarn test + +# format a single file +yarn prettier path/to/file.php` + +# run a single test +yarn test tests/{folder of your choice} ``` Here's what you need to know about the tests: -* The tests use [Jest](https://facebook.github.io/jest/) snapshots. -* You can make changes and run `jest -u` (or `yarn test -u`) to update the snapshots. Then run `git diff` to take a look at what changed. Always update the snapshots when opening a PR. -* You can run `AST_COMPARE=1 yarn test` for a more robust test run. That formats each file, re-parses it, and compares the new AST with the original one and makes sure they are semantically equivalent. -* If you would like to debug prettier locally, you can either debug it in node or the browser. The easiest way to debug it in the browser is to run the interactive `docs` REPL locally. The easiest way to debug it in node, is to create a local test file and run it in an editor like VS Code. +- The tests use [Jest](https://facebook.github.io/jest/) snapshots. +- You can make changes and run `jest -u` (or `yarn test -u`) to update the snapshots. Then run `git diff` to take a look at what changed. Always update the snapshots when opening a PR. +- You can run `AST_COMPARE=1 yarn test` for a more robust test run. That formats each file, re-parses it, and compares the new AST with the original one and makes sure they are semantically equivalent. Run `yarn lint --fix` to automatically format files. -If you can, take look at [commands.md](commands.md) and check out [Wadler's paper](http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf) to understand how Prettier works. +If you can, take look at [commands.md](https://github.com/prettier/prettier/blob/master/commands.md) and check out [Wadler's paper](http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf) to understand how Prettier works. + +## Debugging + +### VScode + +Add the following configuration to `.vscode/launch.json`: + +```json +{ + "type": "node", + "request": "launch", + "name": "Prettify test.php", + "skipFiles": ["/**"], + "program": "${workspaceRoot}/node_modules/.bin/prettier", + "args": ["--plugin=.", "--parser=php", "test.php"], + "cwd": "${workspaceRoot}", + "outputCapture": "std" +} +``` + +Afterwards, paste some PHP code into `test.php`, add a breakpoint, and start the debugger. + +### Browser + +``` +node --inspect-brk node_modules/.bin/jest --runInBand tests/{folder of your choice}/` +``` + +Details about debugging in the Browser can be found in the [Jest troubleshooting docs](https://jestjs.io/docs/en/troubleshooting). diff --git a/README.md b/README.md index b77c0c2f8..aacfb96c0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,3 @@ -

- :construction: Work in Progress! :construction: -

-
Prettier @@ -12,84 +8,117 @@

Prettier PHP Plugin

- - Gitter - - - Travis + + CI Status npm version + + Coverage Status + - + code style: prettier - - Follow+Prettier+on+Twitter + + Follow Prettier on X

-## WORK IN PROGRESS - -Please note that this plugin is currently in alpha stage and still under active development. We encourage everyone to try it and give feedback, but we don't recommend it for production use yet. - ## Intro Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary. This plugin adds support for the PHP language to Prettier. +> [!NOTE] +> +> This plugin uses PSR / PER as guidance when making formatting decisions, but does not aim to be fully PSR / PER compliant. The idea is to stay reasonably close to how Prettier for JS works. + +### Can this be used in production? + +We're considering the plugin to be stable when pure PHP files are formatted. Formatting of files that contain mixed PHP and HTML is still considered unstable - please see [open issues with the tag "inline"](https://github.com/prettier/plugin-php/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Ainline) for details. + +If you want to use the plugin in production, we recommend limiting its scope to pure PHP files. + ### Input ```php +"code","with"=>"inconsistent","formatting"=>"is", "hard" => "to", "maintain"=>true)); +}, array("complex"=>"code","with"=> + function() {return "inconsistent";} +,"formatting"=>"is", "hard" => "to", "maintain"=>true)); ``` ### Output ```php + "code", - "with" => "inconsistent", + "with" => function () { + return "inconsistent"; + }, "formatting" => "is", "hard" => "to", - "maintain" => true - ) + "maintain" => true, + ] ); ``` -## Install +## Playground -Currently, the plugin can only be installed locally, due to an [issue in Prettier's plugin system](https://github.com/prettier/prettier/issues/4000). +You can give the plugin a try in our [playground](https://loilo.github.io/prettier-php-playground/)! + +## Install yarn: ```bash -yarn add --dev prettier/prettier prettier/plugin-php +yarn add --dev prettier @prettier/plugin-php +# or globally (pending https://github.com/prettier/prettier/issues/15141) +yarn global add prettier @prettier/plugin-php ``` npm: ```bash -npm install --save-dev prettier/prettier prettier/plugin-php +npm install --save-dev prettier @prettier/plugin-php +# or globally (pending https://github.com/prettier/prettier/issues/15141) +npm install --global prettier @prettier/plugin-php +``` + +### Activate the plugin + +Create or modify your [prettier configuration file](https://prettier.io/docs/en/configuration) to activate the plugin: + +```json +{ + "plugins": ["@prettier/plugin-php"] +} ``` ## Use -You can add Prettier as a script in your `package.json`, +### With Node.js + +If you installed prettier as a local dependency, you can add prettier as a script in your `package.json`, ```json -"scripts": { - "prettier": "prettier" +{ + "scripts": { + "prettier": "prettier" + } } ``` @@ -98,32 +127,219 @@ and then run it via ```bash yarn run prettier path/to/file.php --write # or -npm run prettier path/to/file.php --write +npm run prettier -- path/to/file.php --write +``` + +If you installed globally, run + +```bash +prettier path/to/file.php --write ``` +### In the Browser + +This package exposes a `standalone.js` that can be used alongside Prettier's own `standalone.js` to make the PHP plugin work in browsers without a compile step. + +First, grab both standalone scripts from an npm CDN like [unpkg](https://unpkg.com/): + +```html + + +``` + +Then use Prettier with PHP, just like this: + +```js +await prettier.format(YOUR_CODE, { + plugins: prettierPlugins, + parser: "php", +}); +``` + +See this code in action [in this basic demo](https://jsbin.com/butoruw/edit?html,output). + +### With Bundlers + +Bundlers like webpack, Rollup or browserify automatically recognize how to handle the PHP plugin. Remember that even when using a bundler, you still have to use the standalone builds: + +```js +import prettier from "prettier/standalone"; +import * as prettierPluginPhp from "@prettier/plugin-php/standalone"; + +await prettier.format(YOUR_CODE, { + plugins: [prettierPluginPhp], + parser: "php", +}); +``` + +## Configuration + +Prettier for PHP supports the following options. We recommend that all users set the `phpVersion` option. + +| Name | Default | Description | +| ------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `phpVersion` | `"auto"` \* | Allows specifying the PHP version you're using. (See Notes Below) | +| `printWidth` | `80` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#print-width)) | +| `tabWidth` | `4` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#tab-width)), The default is `4` based on the `PSR-2` coding standard. | +| `useTabs` | `false` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#tabs)) | +| `singleQuote` | `false` | If set to `"true"`, strings that use double quotes but do not rely on the features they add, will be reformatted. Example: `"foo" -> 'foo'`, `"foo $bar" -> "foo $bar"`. | +| `trailingCommaPHP` | `true` | If set to `true`, trailing commas will be added wherever possible.
If set to `false`, no trailing commas are printed. | +| `braceStyle` | `"per-cs"` | If set to `"per-cs"`, prettier will move open brace for code blocks (classes, functions and methods) onto new line.
If set to `"1tbs"`, prettier will move open brace for code blocks (classes, functions and methods) onto same line. | +| `requirePragma` | `false` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#require-pragma)) | +| `insertPragma` | `false` | Same as in Prettier ([see prettier docs](https://prettier.io/docs/en/options.html#insert-pragma)) | + +### \* `phpVersion` Configuration Notes : + +The default setting `auto`, attempts to auto-detect your supported php versions from a `composer.json` with in the +current directory or any parent directory, the plugin will use a minimum supported php version from +`{"require":{"php":"..."}}` to set the phpVersion. If not found or not able to be parsed, it will default to latest +supported PHP version. + +You set the `phpVersion` to `composer` and this will only use the `composer.json` file to determine the php +version, prettier will crash if the PHP cannot be determined. + +You can also set the `phpVersion` to a specific version, such as `7.4`, `8.0`, `8.1`, `8.2`, `8.3` or `8.4`. + +**Please Note:** If the phpVersion is not set correctly for your environment, this plugin will produce code that could +be incompatible with your PHP runtime. For example, if you are using PHP 7.4, but the plugin is set to PHP 8.3, it will +produce code that uses features not available in PHP 7.4. + +## Ignoring code + +A comment `// prettier-ignore` will exclude the next node in the abstract syntax tree from formatting. + +For example: + +```php +matrix( + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 +); + +// prettier-ignore +matrix( + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 +); +``` + +will be transformed to + +```php +matrix(1, 0, 0, 0, 1, 0, 0, 0, 1); + +// prettier-ignore +matrix( + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 +) +``` + +## Editor integration + +### Visual Studio Code + +The official [prettier plugin for vscode](https://github.com/prettier/prettier-vscode) supports plugins since Version 1.10.0. To enable it, install the extension and make sure the plugin is installed _locally_ (in your project folder). + +Visual Studio Code may not recognise the document selectors provided by this plugin, and so you can add php to your document selectors by adding the following line to `.vscode/settings.json`: + +```json + "prettier.documentSelectors": [ + "**/*.{js,jsx,ts,tsx,vue,html,css,scss,less,json,md,mdx,graphql,yaml,yml,php}" + ] +``` + +You may also need to declare php as the parser in your prettier config file: + +```json +{ + "parser": "php", + "plugins": ["@prettier/plugin-php"] +} +``` + +See (this issue)[https://github.com/prettier/plugin-php/issues/1730] for more discussion around potential VS Code solutions. + +### PhpStorm / IntelliJ / Jetbrains IDE + +- Install prettier and plugin locally `yarn add -D prettier @prettier/plugin-php` +- Open Settings (File, Settings) +- Go to Plugins Section, Select Marketplace, Search for Prettier, Install Plugin, Restart IDE +- Open Settings, Search for Prettier, select Prettier in left settings navigation +- Check prettier package has auto-detected, should be something like `myproject/node_modules/prettier` +- Update Run for Files to include .php, eg: `{**/*,*}.{js,ts,jsx,tsx,php,json,scss,vue,md}` +- Tick the On Save button, if you want your files formatting updated on file save +- Clock OK to save settings + +_Note: Just pressing save does not reformat your current file unless the file has been modified in some way, +alternatively you can use the Prettier shortcut Ctrl+Alt+Shift+P_ + +### Sublime Text + +Sublime Text support is available through Package Control and the [JsPrettier](https://packagecontrol.io/packages/JsPrettier) plugin. + +### Vim + +The official [prettier plugin for vim](https://github.com/prettier/vim-prettier) has built-in support for plugin-php since 1.0. + +### Nova + +The [Prettier⁺ Extension](https://extensions.panic.com/extensions/stonerl/stonerl.prettier/) has built-in support for plugin-php. + +#### ALE + +The linting plugin ALE has built-in support for prettier and its plugins. Just add prettier to your [list of fixers](https://github.com/w0rp/ale#2ii-fixing). For example: + +```vim +let g:ale_fixers={ + \'javascript': ['prettier'], + \'json': ['prettier'], + \'php': ['prettier'], +\} +``` + +#### Custom + +Alternatively, adding the following to `.vimrc` will define a custom command `:PrettierPhp` that runs the plugin while preserving the cursor position and run it on save. + +```vim +" Prettier for PHP +function PrettierPhpCursor() + let save_pos = getpos(".") + %! prettier --stdin --parser=php + call setpos('.', save_pos) +endfunction +" define custom command +command PrettierPhp call PrettierPhpCursor() +" format on save +autocmd BufwritePre *.php PrettierPhp +``` + +## Integration for other tools + +### PHP-CS-Fixer + +See `docs/recipes/php-cs-fixer` for integration help, code can also be found in https://gist.github.com/Billz95/9d5fad3af728b88540fa831b73261733 + ## Contributing If you're interested in contributing to the development of Prettier for PHP, you can follow the [CONTRIBUTING guide from Prettier](https://github.com/prettier/prettier/blob/master/CONTRIBUTING.md), as it all applies to this repository too. To test it out on a PHP file: -* Clone this repository. -* Run `yarn`. -* Create a file called `test.php`. -* Run `yarn prettier test.php` to check the output. +- Clone this repository. +- Run `yarn`. +- Create a file called `test.php`. +- Run `yarn prettier test.php` to check the output. ## Maintainers - \\n" . + " \\n" . + " \\n" . + " \\n"; +} + +list($a, list($b, $c)) = array(1, array(2, 3)); + +list($a[0], $a[1], $a[2]) = $info; + +foreach ($data as ["id" => $id, "name" => $name]) { + echo "id: $id, name: $name\\n"; +} + +list(0 => $first, 1 => $second, 2 => $three, 3 => $fourth) = $arr; +list( + 0 => $first, 1 => $second, 2 => $three, 3 => $fourth +) = $arr; + +list($first, $second, $three, $fourth) = $arr; +list(,$first, $second, $three, $fourth,) = $arr; +list(,,$first, $second, $three, $fourth,,) = $arr; +list(,,$first,, $second,, $three,, $fourth,,) = $arr; +list(,,,$first, $second, $three, $fourth,,,) = $arr; +list(,,,$first,,, $second,,, $three,,, $fourth,,,) = $arr; + +list(0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong) = $arr; +list(,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong,, 1 => $secondVeryVeryVeryVeryLong,, 2 => $threeVeryVeryVeryVeryLong,, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong,,, 1 => $secondVeryVeryVeryVeryLong,,, 2 => $threeVeryVeryVeryVeryLong,,, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; + +list( + 0 => $firstVeryVeryVeryVeryLong, + + 1 => $secondVeryVeryVeryVeryLong, + + + 2 => $threeVeryVeryVeryVeryLong, + + + + 3 => $fourthVeryVeryVeryVeryLong +) = $arr; + +list("id" => $id1, "name" => $name1) = $data[0]; +["id" => $id1, "name" => $name1] = $data[0]; + +foreach ($data as list("id" => $id, "name" => $name)) { + // logic here with $id and $name +} + +foreach ($data as ["id" => $id, "name" => $name]) { + // logic here with $id and $name +} + +function swap( &$a, &$b ): void +{ [ $a, $b ] = [ $b, $a ]; } + +$array = [1, 2]; +list($a, &$b) = $array; +[$a, &$b] = $array; +list(&$a, $b,, list(&$c, $d)) = $array; +[&$a, $b,, [&$c, $d]] = $array; + +foreach ($array as list(&$a, $b)) { +} +foreach ($array as [&$a, $b]) { +} + +list(0 => $var) = $arr; +list(0 => $var,) = $arr; +list(, 0 => $var) = $arr; +list(0 => $var + ) = $arr; +list( + 0 => $var) = $arr; +list( + ,0 => $var) = $arr; +list( + ,0 => $var,) = $arr; +list( + ,0 => $var,,) = $arr; +list( + 0 => $var, 1 => $other_var) = $arr; +list( + ,0 => $var, 1 => $other_var) = $arr; +list( + ,0 => $var, 1 => $other_var,) = $arr; +list( + ,0 => $var, 1 => $other_var,,) = $arr; +list(0 + => $var) = $arr; +list( + 0 + => + $var +) = $arr; + +=====================================output===================================== +fetch(PDO::FETCH_NUM)) { +} + +[$a, [$b, $c]] = [1, [2, 3]]; + +$info = ["coffee", "brown", "caffeine"]; +[$a[0], $a[1], $a[2]] = $info; + +["id" => $id1, "name" => $name1] = $data[0]; +[ + "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, + "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, +] = $data[0]; +[ + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, +] = $data[0]; + +foreach ($data as ["id" => $id, "name" => $name]) { + // logic here with $id and $name +} + +foreach ( + $data + as [ + "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, + "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, + ] +) { + // logic here with $id and $name +} + +foreach ( + $data + as [ + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, + ] +) { + // logic here with $id and $name +} + +[, $b] = ["a", "b"]; +[, , $c] = ["a", "b", "c"]; + +while ([$id, $name, $salary] = $result->fetch(PDO::FETCH_NUM)) { + echo " \\n" . + " \\n" . + " \\n" . + " \\n"; +} + +[$a, [$b, $c]] = [1, [2, 3]]; + +[$a[0], $a[1], $a[2]] = $info; + +foreach ($data as ["id" => $id, "name" => $name]) { + echo "id: $id, name: $name\\n"; +} + +[0 => $first, 1 => $second, 2 => $three, 3 => $fourth] = $arr; +[ + 0 => $first, + 1 => $second, + 2 => $three, + 3 => $fourth, +] = $arr; + +[$first, $second, $three, $fourth] = $arr; +[, $first, $second, $three, $fourth] = $arr; +[, , $first, $second, $three, $fourth, ,] = $arr; +[, , $first, , $second, , $three, , $fourth, ,] = $arr; +[, , , $first, $second, $three, $fourth, , ,] = $arr; +[, , , $first, , , $second, , , $three, , , $fourth, , ,] = $arr; + +[ + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, +] = $arr; +[ + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, +] = $arr; +[ + , + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, + , +] = $arr; +[ + , + , + 0 => $firstVeryVeryVeryVeryLong, + , + 1 => $secondVeryVeryVeryVeryLong, + , + 2 => $threeVeryVeryVeryVeryLong, + , + 3 => $fourthVeryVeryVeryVeryLong, + , +] = $arr; +[ + , + , + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, + , + , +] = $arr; +[ + , + , + , + 0 => $firstVeryVeryVeryVeryLong, + , + , + 1 => $secondVeryVeryVeryVeryLong, + , + , + 2 => $threeVeryVeryVeryVeryLong, + , + , + 3 => $fourthVeryVeryVeryVeryLong, + , + , +] = $arr; + +[ + 0 => $firstVeryVeryVeryVeryLong, + + 1 => $secondVeryVeryVeryVeryLong, + + 2 => $threeVeryVeryVeryVeryLong, + + 3 => $fourthVeryVeryVeryVeryLong, +] = $arr; + +["id" => $id1, "name" => $name1] = $data[0]; +["id" => $id1, "name" => $name1] = $data[0]; + +foreach ($data as ["id" => $id, "name" => $name]) { + // logic here with $id and $name +} + +foreach ($data as ["id" => $id, "name" => $name]) { + // logic here with $id and $name +} + +function swap(&$a, &$b): void +{ + [$a, $b] = [$b, $a]; +} + +$array = [1, 2]; +[$a, &$b] = $array; +[$a, &$b] = $array; +[&$a, $b, , [&$c, $d]] = $array; +[&$a, $b, , [&$c, $d]] = $array; + +foreach ($array as [&$a, $b]) { +} +foreach ($array as [&$a, $b]) { +} + +[0 => $var] = $arr; +[0 => $var] = $arr; +[, 0 => $var] = $arr; +[0 => $var] = $arr; +[ + 0 => $var, +] = $arr; +[ + , + 0 => $var, +] = $arr; +[ + , + 0 => $var, +] = $arr; +[ + , + 0 => $var, + , +] = $arr; +[ + 0 => $var, + 1 => $other_var, +] = $arr; +[ + , + 0 => $var, + 1 => $other_var, +] = $arr; +[ + , + 0 => $var, + 1 => $other_var, +] = $arr; +[ + , + 0 => $var, + 1 => $other_var, + , +] = $arr; +[0 => $var] = $arr; +[ + 0 => $var, +] = $arr; + +================================================================================ +`; + +exports[`list.php 2`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "7.1" +printWidth: 80 + | printWidth +=====================================input====================================== +fetch(PDO::FETCH_NUM)) {} + +list($a, list($b, $c)) = array(1, array(2, 3)); + +$info = array('coffee', 'brown', 'caffeine'); +list($a[0], $a[1], $a[2]) = $info; + +list("id" => $id1, "name" => $name1) = $data[0]; +list("veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue) = $data[0]; +list("veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue) = $data[0]; + +foreach ($data as list("id" => $id, "name" => $name)) { + // logic here with $id and $name +} + +foreach ($data as list("veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue)) { + // logic here with $id and $name +} + +foreach ($data as list("veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue)) { + // logic here with $id and $name +} + +list(, $b) = ['a', 'b']; +list(, , $c) = ['a', 'b', 'c']; + +while (list($id, $name, $salary) = $result->fetch(PDO::FETCH_NUM)) { + echo " \\n" . + " \\n" . + " \\n" . + " \\n"; +} + +list($a, list($b, $c)) = array(1, array(2, 3)); + +list($a[0], $a[1], $a[2]) = $info; + +foreach ($data as ["id" => $id, "name" => $name]) { + echo "id: $id, name: $name\\n"; +} + +list(0 => $first, 1 => $second, 2 => $three, 3 => $fourth) = $arr; +list( + 0 => $first, 1 => $second, 2 => $three, 3 => $fourth +) = $arr; + +list($first, $second, $three, $fourth) = $arr; +list(,$first, $second, $three, $fourth,) = $arr; +list(,,$first, $second, $three, $fourth,,) = $arr; +list(,,$first,, $second,, $three,, $fourth,,) = $arr; +list(,,,$first, $second, $three, $fourth,,,) = $arr; +list(,,,$first,,, $second,,, $three,,, $fourth,,,) = $arr; + +list(0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong) = $arr; +list(,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong,, 1 => $secondVeryVeryVeryVeryLong,, 2 => $threeVeryVeryVeryVeryLong,, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong,,, 1 => $secondVeryVeryVeryVeryLong,,, 2 => $threeVeryVeryVeryVeryLong,,, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; + +list( + 0 => $firstVeryVeryVeryVeryLong, + + 1 => $secondVeryVeryVeryVeryLong, + + + 2 => $threeVeryVeryVeryVeryLong, + + + + 3 => $fourthVeryVeryVeryVeryLong +) = $arr; + +list("id" => $id1, "name" => $name1) = $data[0]; +["id" => $id1, "name" => $name1] = $data[0]; + +foreach ($data as list("id" => $id, "name" => $name)) { + // logic here with $id and $name +} + +foreach ($data as ["id" => $id, "name" => $name]) { + // logic here with $id and $name +} + +function swap( &$a, &$b ): void +{ [ $a, $b ] = [ $b, $a ]; } + +$array = [1, 2]; +list($a, &$b) = $array; +[$a, &$b] = $array; +list(&$a, $b,, list(&$c, $d)) = $array; +[&$a, $b,, [&$c, $d]] = $array; + +foreach ($array as list(&$a, $b)) { +} +foreach ($array as [&$a, $b]) { +} + +list(0 => $var) = $arr; +list(0 => $var,) = $arr; +list(, 0 => $var) = $arr; +list(0 => $var + ) = $arr; +list( + 0 => $var) = $arr; +list( + ,0 => $var) = $arr; +list( + ,0 => $var,) = $arr; +list( + ,0 => $var,,) = $arr; +list( + 0 => $var, 1 => $other_var) = $arr; +list( + ,0 => $var, 1 => $other_var) = $arr; +list( + ,0 => $var, 1 => $other_var,) = $arr; +list( + ,0 => $var, 1 => $other_var,,) = $arr; +list(0 + => $var) = $arr; +list( + 0 + => + $var +) = $arr; + +=====================================output===================================== +fetch(PDO::FETCH_NUM)) { +} + +[$a, [$b, $c]] = [1, [2, 3]]; + +$info = ["coffee", "brown", "caffeine"]; +[$a[0], $a[1], $a[2]] = $info; + +["id" => $id1, "name" => $name1] = $data[0]; +[ + "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, + "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, +] = $data[0]; +[ + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, +] = $data[0]; + +foreach ($data as ["id" => $id, "name" => $name]) { + // logic here with $id and $name +} + +foreach ( + $data + as [ + "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, + "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, + ] +) { + // logic here with $id and $name +} + +foreach ( + $data + as [ + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, + ] +) { + // logic here with $id and $name +} + +[, $b] = ["a", "b"]; +[, , $c] = ["a", "b", "c"]; + +while ([$id, $name, $salary] = $result->fetch(PDO::FETCH_NUM)) { + echo " \\n" . + " \\n" . + " \\n" . + " \\n"; +} + +[$a, [$b, $c]] = [1, [2, 3]]; + +[$a[0], $a[1], $a[2]] = $info; + +foreach ($data as ["id" => $id, "name" => $name]) { + echo "id: $id, name: $name\\n"; +} + +[0 => $first, 1 => $second, 2 => $three, 3 => $fourth] = $arr; +[ + 0 => $first, + 1 => $second, + 2 => $three, + 3 => $fourth, +] = $arr; + +[$first, $second, $three, $fourth] = $arr; +[, $first, $second, $three, $fourth] = $arr; +[, , $first, $second, $three, $fourth, ,] = $arr; +[, , $first, , $second, , $three, , $fourth, ,] = $arr; +[, , , $first, $second, $three, $fourth, , ,] = $arr; +[, , , $first, , , $second, , , $three, , , $fourth, , ,] = $arr; + +[ + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, +] = $arr; +[ + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, +] = $arr; +[ + , + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, + , +] = $arr; +[ + , + , + 0 => $firstVeryVeryVeryVeryLong, + , + 1 => $secondVeryVeryVeryVeryLong, + , + 2 => $threeVeryVeryVeryVeryLong, + , + 3 => $fourthVeryVeryVeryVeryLong, + , +] = $arr; +[ + , + , + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, + , + , +] = $arr; +[ + , + , + , + 0 => $firstVeryVeryVeryVeryLong, + , + , + 1 => $secondVeryVeryVeryVeryLong, + , + , + 2 => $threeVeryVeryVeryVeryLong, + , + , + 3 => $fourthVeryVeryVeryVeryLong, + , + , +] = $arr; + +[ + 0 => $firstVeryVeryVeryVeryLong, + + 1 => $secondVeryVeryVeryVeryLong, + + 2 => $threeVeryVeryVeryVeryLong, + + 3 => $fourthVeryVeryVeryVeryLong, +] = $arr; + +["id" => $id1, "name" => $name1] = $data[0]; +["id" => $id1, "name" => $name1] = $data[0]; + +foreach ($data as ["id" => $id, "name" => $name]) { + // logic here with $id and $name +} + +foreach ($data as ["id" => $id, "name" => $name]) { + // logic here with $id and $name +} + +function swap(&$a, &$b): void +{ + [$a, $b] = [$b, $a]; +} + +$array = [1, 2]; +[$a, &$b] = $array; +[$a, &$b] = $array; +[&$a, $b, , [&$c, $d]] = $array; +[&$a, $b, , [&$c, $d]] = $array; + +foreach ($array as [&$a, $b]) { +} +foreach ($array as [&$a, $b]) { +} + +[0 => $var] = $arr; +[0 => $var] = $arr; +[, 0 => $var] = $arr; +[0 => $var] = $arr; +[ + 0 => $var, +] = $arr; +[ + , + 0 => $var, +] = $arr; +[ + , + 0 => $var, +] = $arr; +[ + , + 0 => $var, + , +] = $arr; +[ + 0 => $var, + 1 => $other_var, +] = $arr; +[ + , + 0 => $var, + 1 => $other_var, +] = $arr; +[ + , + 0 => $var, + 1 => $other_var, +] = $arr; +[ + , + 0 => $var, + 1 => $other_var, + , +] = $arr; +[0 => $var] = $arr; +[ + 0 => $var, +] = $arr; + +================================================================================ +`; diff --git a/tests/list/jsfmt.spec.js b/tests/list/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/list/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/list/jsfmt.spec.mjs b/tests/list/jsfmt.spec.mjs new file mode 100644 index 000000000..c0ec8a1fc --- /dev/null +++ b/tests/list/jsfmt.spec.mjs @@ -0,0 +1,2 @@ +run_spec(import.meta, ["php"]); +run_spec(import.meta, ["php"], { phpVersion: "7.1" }); diff --git a/tests/list/list.php b/tests/list/list.php index ecd9aa9a7..e6aa850aa 100644 --- a/tests/list/list.php +++ b/tests/list/list.php @@ -10,10 +10,9 @@ list($drink, , $power) = $info; echo "$drink has $power.\n"; -// TODO: unncoment after resolve https://github.com/glayzzle/php-parser/issues/137 // Or let's skip to only the third one -// list( , , $power) = $info; -// echo "I need $power!\n"; +list( , , $power) = $info; +echo "I need $power!\n"; // list() doesn't work with strings list($bar) = "abcde"; @@ -44,3 +43,104 @@ list(, $b) = ['a', 'b']; list(, , $c) = ['a', 'b', 'c']; + +while (list($id, $name, $salary) = $result->fetch(PDO::FETCH_NUM)) { + echo " \n" . + " \n" . + " \n" . + " \n"; +} + +list($a, list($b, $c)) = array(1, array(2, 3)); + +list($a[0], $a[1], $a[2]) = $info; + +foreach ($data as ["id" => $id, "name" => $name]) { + echo "id: $id, name: $name\n"; +} + +list(0 => $first, 1 => $second, 2 => $three, 3 => $fourth) = $arr; +list( + 0 => $first, 1 => $second, 2 => $three, 3 => $fourth +) = $arr; + +list($first, $second, $three, $fourth) = $arr; +list(,$first, $second, $three, $fourth,) = $arr; +list(,,$first, $second, $three, $fourth,,) = $arr; +list(,,$first,, $second,, $three,, $fourth,,) = $arr; +list(,,,$first, $second, $three, $fourth,,,) = $arr; +list(,,,$first,,, $second,,, $three,,, $fourth,,,) = $arr; + +list(0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong) = $arr; +list(,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong,, 1 => $secondVeryVeryVeryVeryLong,, 2 => $threeVeryVeryVeryVeryLong,, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong,,, 1 => $secondVeryVeryVeryVeryLong,,, 2 => $threeVeryVeryVeryVeryLong,,, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; + +list( + 0 => $firstVeryVeryVeryVeryLong, + + 1 => $secondVeryVeryVeryVeryLong, + + + 2 => $threeVeryVeryVeryVeryLong, + + + + 3 => $fourthVeryVeryVeryVeryLong +) = $arr; + +list("id" => $id1, "name" => $name1) = $data[0]; +["id" => $id1, "name" => $name1] = $data[0]; + +foreach ($data as list("id" => $id, "name" => $name)) { + // logic here with $id and $name +} + +foreach ($data as ["id" => $id, "name" => $name]) { + // logic here with $id and $name +} + +function swap( &$a, &$b ): void +{ [ $a, $b ] = [ $b, $a ]; } + +$array = [1, 2]; +list($a, &$b) = $array; +[$a, &$b] = $array; +list(&$a, $b,, list(&$c, $d)) = $array; +[&$a, $b,, [&$c, $d]] = $array; + +foreach ($array as list(&$a, $b)) { +} +foreach ($array as [&$a, $b]) { +} + +list(0 => $var) = $arr; +list(0 => $var,) = $arr; +list(, 0 => $var) = $arr; +list(0 => $var + ) = $arr; +list( + 0 => $var) = $arr; +list( + ,0 => $var) = $arr; +list( + ,0 => $var,) = $arr; +list( + ,0 => $var,,) = $arr; +list( + 0 => $var, 1 => $other_var) = $arr; +list( + ,0 => $var, 1 => $other_var) = $arr; +list( + ,0 => $var, 1 => $other_var,) = $arr; +list( + ,0 => $var, 1 => $other_var,,) = $arr; +list(0 + => $var) = $arr; +list( + 0 + => + $var +) = $arr; diff --git a/tests/magic/__snapshots__/jsfmt.spec.js.snap b/tests/magic/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index b2cbf462c..000000000 --- a/tests/magic/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,38 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`magic.php 1`] = ` - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - + +=====================================output===================================== + + +================================================================================ +`; diff --git a/tests/magic/jsfmt.spec.js b/tests/magic/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/magic/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/magic/jsfmt.spec.mjs b/tests/magic/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/magic/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/magic/magic.php b/tests/magic/magic.php index 1c55b0af6..c62d855a8 100644 --- a/tests/magic/magic.php +++ b/tests/magic/magic.php @@ -9,3 +9,18 @@ __NAMESPACE__; $magic = __LINE__; + +class Foo extends Base +{ + public static function label() + { + // Here we run `Base::label` + return __(parent::{__FUNCTION__}()); + } + + public static function oLabel() + { + // Here we run `Base::__FUNCTION__` + return __(parent::__FUNCTION__()); + } +} diff --git a/tests/markdown/__snapshots__/jsfmt.spec.mjs.snap b/tests/markdown/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..7c306ec51 --- /dev/null +++ b/tests/markdown/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,177 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`markdown.md 1`] = ` +====================================options===================================== +parsers: ["markdown"] +printWidth: 80 +proseWrap: "always" +tabWidth: 4 + | printWidth +=====================================input====================================== +# PHP in Markdown + +\`\`\`php +$foo='bar'; + +\`\`\` + +\`\`\`php +$foo = 'bar'; +\`\`\` + +\`\`\`php +\`\`\` + +\`\`\`php +function test(){$a=1;} +\`\`\` + +\`\`\`php + +\`\`\` + +\`\`\`php + + + + + +test + +test + +\`\`\` + +=====================================output===================================== +# PHP in Markdown + +\`\`\`php +$foo = "bar"; +\`\`\` + +\`\`\`php +$foo = "bar"; +\`\`\` + +\`\`\`php + +\`\`\` + +\`\`\`php +function test() +{ + $a = 1; +} +\`\`\` + +\`\`\`php + +\`\`\` + +\`\`\`php + + + + + +test + +test +\`\`\` + +================================================================================ +`; diff --git a/tests/markdown/jsfmt.spec.mjs b/tests/markdown/jsfmt.spec.mjs new file mode 100644 index 000000000..486660ae6 --- /dev/null +++ b/tests/markdown/jsfmt.spec.mjs @@ -0,0 +1,5 @@ +run_spec(import.meta, ["markdown"], { + plugins: global.STANDALONE ? ["prettier/parser-markdown"] : [], + proseWrap: "always", + tabWidth: 4, +}); diff --git a/tests/markdown/markdown.md b/tests/markdown/markdown.md new file mode 100644 index 000000000..da474ef52 --- /dev/null +++ b/tests/markdown/markdown.md @@ -0,0 +1,82 @@ +# PHP in Markdown + +```php +$foo='bar'; + +``` + +```php +$foo = 'bar'; +``` + +```php +``` + +```php +function test(){$a=1;} +``` + +```php + +``` + +```php + + + + + +test + +test + +``` diff --git a/tests/match/__snapshots__/jsfmt.spec.mjs.snap b/tests/match/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..2279ebfaf --- /dev/null +++ b/tests/match/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,323 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`match.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.0" +printWidth: 80 +trailingCommaPHP: false + | printWidth +=====================================input====================================== + implode(',',[1,2,3]), + false => $a || 'Empty', + null => null, + default => throw new \\InvalidArgumentException('Unknown Value'), +}; + +$boolStr = match($v) {true => 'true', false => 'false'}; + +$boolish = match($v) { + true, 1 => true, + false,0,'',null => false, + default => null +}; + +$a = match(true) { + test() => 'Good', + test2() => 'Two', + default => 'fail' +}; + +$nest = match(match($a) {true => 1, false => 2}) { + 1 => match($b) { + 'ok' => true, + 'fail' => false, + default => false + }, + 2 => 'null' +}; + +$extraLongMatch = match($a) { + 'foo', 'foo2', 'foo3', 'foo4', + 'foo5', 'foo6', 'foo7', 'foo8', + 'foo9', 'foo10', 'foo11', 'foo12', + => ['bar'], + 'bar', 'bar2', 'bar3', 'bar4', + 'bar5', 'bar6', 'bar7', 'bar8', + 'bar9', 'bar10', 'bar11', 'bar12', + => 'some really long value in the return part of the match statement', + 'cd' => [], + default => [], +}; + +// Whitespace in match expressions is handled like in function/method arguments: +// - none above the first arm or below the last arm +// - empty lines are preserved between arms +// - multiple empty lines are collapsed into one +match ($a) { + + 'a' => 1, + + + 'b' => 2 + +}; + +match($really_really_really_really_really_really_really_really_long_variable_name) { +default => null +}; + +=====================================output===================================== + implode(",", [1, 2, 3]), + false => $a || "Empty", + null => null, + default => throw new \\InvalidArgumentException("Unknown Value") +}; + +$boolStr = match ($v) { + true => "true", + false => "false" +}; + +$boolish = match ($v) { + true, 1 => true, + false, 0, "", null => false, + default => null +}; + +$a = match (true) { + test() => "Good", + test2() => "Two", + default => "fail" +}; + +$nest = match ( + match ($a) { + true => 1, + false => 2 + } +) { + 1 => match ($b) { + "ok" => true, + "fail" => false, + default => false + }, + 2 => "null" +}; + +$extraLongMatch = match ($a) { + "foo", + "foo2", + "foo3", + "foo4", + "foo5", + "foo6", + "foo7", + "foo8", + "foo9", + "foo10", + "foo11", + "foo12" + => ["bar"], + "bar", + "bar2", + "bar3", + "bar4", + "bar5", + "bar6", + "bar7", + "bar8", + "bar9", + "bar10", + "bar11", + "bar12" + => "some really long value in the return part of the match statement", + "cd" => [], + default => [] +}; + +// Whitespace in match expressions is handled like in function/method arguments: +// - none above the first arm or below the last arm +// - empty lines are preserved between arms +// - multiple empty lines are collapsed into one +match ($a) { + "a" => 1, + + "b" => 2 +}; + +match ( + $really_really_really_really_really_really_really_really_long_variable_name +) { + default => null +}; + +================================================================================ +`; + +exports[`match.php 2`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.0" +printWidth: 80 +trailingCommaPHP: true + | printWidth +=====================================input====================================== + implode(',',[1,2,3]), + false => $a || 'Empty', + null => null, + default => throw new \\InvalidArgumentException('Unknown Value'), +}; + +$boolStr = match($v) {true => 'true', false => 'false'}; + +$boolish = match($v) { + true, 1 => true, + false,0,'',null => false, + default => null +}; + +$a = match(true) { + test() => 'Good', + test2() => 'Two', + default => 'fail' +}; + +$nest = match(match($a) {true => 1, false => 2}) { + 1 => match($b) { + 'ok' => true, + 'fail' => false, + default => false + }, + 2 => 'null' +}; + +$extraLongMatch = match($a) { + 'foo', 'foo2', 'foo3', 'foo4', + 'foo5', 'foo6', 'foo7', 'foo8', + 'foo9', 'foo10', 'foo11', 'foo12', + => ['bar'], + 'bar', 'bar2', 'bar3', 'bar4', + 'bar5', 'bar6', 'bar7', 'bar8', + 'bar9', 'bar10', 'bar11', 'bar12', + => 'some really long value in the return part of the match statement', + 'cd' => [], + default => [], +}; + +// Whitespace in match expressions is handled like in function/method arguments: +// - none above the first arm or below the last arm +// - empty lines are preserved between arms +// - multiple empty lines are collapsed into one +match ($a) { + + 'a' => 1, + + + 'b' => 2 + +}; + +match($really_really_really_really_really_really_really_really_long_variable_name) { +default => null +}; + +=====================================output===================================== + implode(",", [1, 2, 3]), + false => $a || "Empty", + null => null, + default => throw new \\InvalidArgumentException("Unknown Value"), +}; + +$boolStr = match ($v) { + true => "true", + false => "false", +}; + +$boolish = match ($v) { + true, 1 => true, + false, 0, "", null => false, + default => null, +}; + +$a = match (true) { + test() => "Good", + test2() => "Two", + default => "fail", +}; + +$nest = match ( + match ($a) { + true => 1, + false => 2, + } +) { + 1 => match ($b) { + "ok" => true, + "fail" => false, + default => false, + }, + 2 => "null", +}; + +$extraLongMatch = match ($a) { + "foo", + "foo2", + "foo3", + "foo4", + "foo5", + "foo6", + "foo7", + "foo8", + "foo9", + "foo10", + "foo11", + "foo12" + => ["bar"], + "bar", + "bar2", + "bar3", + "bar4", + "bar5", + "bar6", + "bar7", + "bar8", + "bar9", + "bar10", + "bar11", + "bar12" + => "some really long value in the return part of the match statement", + "cd" => [], + default => [], +}; + +// Whitespace in match expressions is handled like in function/method arguments: +// - none above the first arm or below the last arm +// - empty lines are preserved between arms +// - multiple empty lines are collapsed into one +match ($a) { + "a" => 1, + + "b" => 2, +}; + +match ( + $really_really_really_really_really_really_really_really_long_variable_name +) { + default => null, +}; + +================================================================================ +`; diff --git a/tests/match/jsfmt.spec.mjs b/tests/match/jsfmt.spec.mjs new file mode 100644 index 000000000..97399d8f1 --- /dev/null +++ b/tests/match/jsfmt.spec.mjs @@ -0,0 +1,8 @@ +run_spec(import.meta, ["php"], { + trailingCommaPHP: false, + phpVersion: "8.0", +}); +run_spec(import.meta, ["php"], { + trailingCommaPHP: true, + phpVersion: "8.0", +}); diff --git a/tests/match/match.php b/tests/match/match.php new file mode 100644 index 000000000..907a13086 --- /dev/null +++ b/tests/match/match.php @@ -0,0 +1,61 @@ + implode(',',[1,2,3]), + false => $a || 'Empty', + null => null, + default => throw new \InvalidArgumentException('Unknown Value'), +}; + +$boolStr = match($v) {true => 'true', false => 'false'}; + +$boolish = match($v) { + true, 1 => true, + false,0,'',null => false, + default => null +}; + +$a = match(true) { + test() => 'Good', + test2() => 'Two', + default => 'fail' +}; + +$nest = match(match($a) {true => 1, false => 2}) { + 1 => match($b) { + 'ok' => true, + 'fail' => false, + default => false + }, + 2 => 'null' +}; + +$extraLongMatch = match($a) { + 'foo', 'foo2', 'foo3', 'foo4', + 'foo5', 'foo6', 'foo7', 'foo8', + 'foo9', 'foo10', 'foo11', 'foo12', + => ['bar'], + 'bar', 'bar2', 'bar3', 'bar4', + 'bar5', 'bar6', 'bar7', 'bar8', + 'bar9', 'bar10', 'bar11', 'bar12', + => 'some really long value in the return part of the match statement', + 'cd' => [], + default => [], +}; + +// Whitespace in match expressions is handled like in function/method arguments: +// - none above the first arm or below the last arm +// - empty lines are preserved between arms +// - multiple empty lines are collapsed into one +match ($a) { + + 'a' => 1, + + + 'b' => 2 + +}; + +match($really_really_really_really_really_really_really_really_long_variable_name) { +default => null +}; diff --git a/tests/member_chain/__snapshots__/jsfmt.spec.js.snap b/tests/member_chain/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 06eefcdd5..000000000 --- a/tests/member_chain/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,528 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`break-last-call.php 1`] = ` -then( - function ($response) { - return next(actionWith([ - 'response' => $response, - 'type' => $successType - ])); - }, - function ($error) { - return next(actionWith([ - 'type' => $failureType, - 'error' => $error->message || 'Something bad happened' - ])); - } - ); -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -then( - function ($response) { - return next( - actionWith(['response' => $response, 'type' => $successType]) - ); - }, - function ($error) { - return next( - actionWith([ - 'type' => $failureType, - 'error' => $error->message || 'Something bad happened' - ]) - ); - } - ); -} - -`; - -exports[`break-last-member.php 1`] = ` -someVeryLongCallExpression()->some_very_long_member_expression; -$weNeedToReachTheEightyCharacterLimitXXXXXXXXXXXXXXXXX->someNode -->childrenInAnArray[0]; -$superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered; -$superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered[0]; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -someVeryLongCallExpression()->some_very_long_member_expression; -$weNeedToReachTheEightyCharacterLimitXXXXXXXXXXXXXXXXX->someNode->childrenInAnArray[0]; -$superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered; -$superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered[0]; - -`; - -exports[`break-multiple.php 1`] = ` -foo()->bar()->baz(); - -foo()->bar()->baz(); - -foo()->bar->baz(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -foo() - ->bar() - ->baz(); - -foo() - ->bar() - ->baz(); - -foo()->bar->baz(); - -`; - -exports[`conditional.php 1`] = ` -d(); - -($a ? $b : $c)->d()->e(); - -($a ? $b : $c)->d()->e()->f(); - -($valid - ? $helper->responseBody($this->currentUser) - : $helper->responseBody($this->defaultUser)) -->map(); - -($valid - ? $helper->responseBody($this->currentUser) - : $helper->responseBody($this->defaultUser)) -->map()->filter(); - -($valid - ? $helper->responseBody($this->currentUser) - : $helper->responseBody(defaultUser)) -->map(); - -$object[$valid - ? $helper->responseBody($this->currentUser) - : $helper->responseBody($defaultUser) -]->map(); - -(new TestClassWithReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName()) -->map()->filter(); - -($testThingWithReallyLongName && $someOtherObject->withfunctionThatReturnsSomething()) -->map()->filter(); - -($testThingWithReallyLongName && $someOtherObject->withlongPropThatReturnsSomething) -->map()->filter(); - -($testThingWithReallyLongName && new SomeObjectWithReallyReallyReallyReallyLongName()) -->map()->filter(); - -($testThingWithReallyLongName && $test = new SomeObjectWithReallyReallyReallyLongName()) -->map()->filter(); - -($testThingWithReallyLongName = new SomeObjectWithReallyReallyReallyReallyReallyReallyReallyReallyLongName()) -->map()->filter(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -d(); - -($a ? $b : $c)->d()->e(); - -($a ? $b : $c) - ->d() - ->e() - ->f(); - -($valid - ? $helper->responseBody($this->currentUser) - : $helper->responseBody($this->defaultUser))->map(); - -($valid - ? $helper->responseBody($this->currentUser) - : $helper->responseBody($this->defaultUser)) - ->map() - ->filter(); - -($valid - ? $helper->responseBody($this->currentUser) - : $helper->responseBody(defaultUser))->map(); - -$object[ - $valid - ? $helper->responseBody($this->currentUser) - : $helper->responseBody($defaultUser) -]->map(); - -(new TestClassWithReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName()) - ->map() - ->filter(); - -( - $testThingWithReallyLongName && - $someOtherObject->withfunctionThatReturnsSomething() -) - ->map() - ->filter(); - -( - $testThingWithReallyLongName && - $someOtherObject->withlongPropThatReturnsSomething -) - ->map() - ->filter(); - -( - $testThingWithReallyLongName && - new SomeObjectWithReallyReallyReallyReallyLongName() -) - ->map() - ->filter(); - -( - $testThingWithReallyLongName && - $test = new SomeObjectWithReallyReallyReallyLongName() -) - ->map() - ->filter(); - -($testThingWithReallyLongName = new SomeObjectWithReallyReallyReallyReallyReallyReallyReallyReallyLongName()) - ->map() - ->filter(); - -`; - -exports[`logical.php 1`] = ` - 'bar', 'bar' => 'foo', 'foobar' => 'barfoor'] -) || [])->map(function ($edge) { return $edge->node; }); - -($veryLongVeryLongVeryLong || $e)->map(function ($tickets) { - $TicketRecord->createFromSomeLongString(); -}); - -($veryLongVeryLongVeryLong || $e)->map(function ($tickets) { - $TicketRecord->createFromSomeLongString(); -})->filter(function ($obj) { return !!$obj; }); - -($veryLongVeryLongVeryLong || $anotherVeryLongVeryLongVeryLong || $veryVeryVeryLongError)->map(function ($tickets) { - $TicketRecord ->createFromSomeLongString(); -}); - -($veryLongVeryLongVeryLong || $anotherVeryLongVeryLongVeryLong || $veryVeryVeryLongError)->map(function ($tickets) { - $TicketRecord->createFromSomeLongString(); -})->filter(function ($obj) { return !!$obj; }); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 'bar', 'bar' => 'foo', 'foobar' => 'barfoor']) || [] -)->map(function ($edge) { - return $edge->node; -}); - -($veryLongVeryLongVeryLong || $e)->map(function ($tickets) { - $TicketRecord->createFromSomeLongString(); -}); - -($veryLongVeryLongVeryLong || $e) - ->map(function ($tickets) { - $TicketRecord->createFromSomeLongString(); - }) - ->filter(function ($obj) { - return !!$obj; - }); - -( - $veryLongVeryLongVeryLong || - $anotherVeryLongVeryLongVeryLong || - $veryVeryVeryLongError -)->map(function ($tickets) { - $TicketRecord->createFromSomeLongString(); -}); - -( - $veryLongVeryLongVeryLong || - $anotherVeryLongVeryLongVeryLong || - $veryVeryVeryLongError -) - ->map(function ($tickets) { - $TicketRecord->createFromSomeLongString(); - }) - ->filter(function ($obj) { - return !!$obj; - }); - -`; - -exports[`member_chain.php 1`] = ` -two(); -one() - ->two() - ->three(); -one() - ->two->three() - ->four->five(); - -Route::prefix('api') - ->middleware('api') - ->namespace($this->namespace) - ->group(base_path('routes/api.php')); - -return tap($this->forceFill([ - 'approver_id' => $user instanceof User ? $user->id : $user, - 'approved_at' => $this->freshTimestamp(), -]))->save(); - -return collect(parent::jsonSerialize())->mapWithKeys(function ($value, $key) { - return [camel_case($key) => $value]; -})->toArray(); - -method()->then(function ($x) { return $x; }) - ["abc"](function ($x) { return $x; }) - [$abc](function ($x) { return $x; }); - -($a->a()->b()); -($a)->a()->b(); -$a->a()->b; -$a->b->a(); -$a->b()->c()->d(); -$a->b->c->d; - -$this->loooooooooooong->lookup = (int) $this->getRequest()->getParam( - 'some-param' -); - -$this->loooooooooooong->lookup = (int) $variable->getRequest()->getParam( - 'some-param' -); - -$aVariable = $theThing - ->aLongFunction(1, 2, 3) - ->anotherReallyLongFunciton('a', 'b', 'c'); - -$anotherVariables = $theOtherThing - ->aLongFunction(1, 2, 3, 4, 5, 6, 7) - ->anotherReallyLongFunciton('a', 'b', 'c'); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -two(); -one() - ->two() - ->three(); -one() - ->two->three() - ->four->five(); - -Route - ::prefix('api') - ->middleware('api') - ->namespace($this->namespace) - ->group(base_path('routes/api.php')); - -return tap( - $this->forceFill([ - 'approver_id' => $user instanceof User ? $user->id : $user, - 'approved_at' => $this->freshTimestamp() - ]) -)->save(); - -return collect(parent::jsonSerialize()) - ->mapWithKeys(function ($value, $key) { - return [camel_case($key) => $value]; - }) - ->toArray(); - -method()->then(function ($x) { - return $x; -})["abc"](function ($x) { - return $x; -})[$abc](function ($x) { - return $x; -}); - -($a->a()->b()); -($a)->a()->b(); -$a->a()->b; -$a->b->a(); -$a - ->b() - ->c() - ->d(); -$a->b->c->d; - -$this->loooooooooooong->lookup = (int) $this->getRequest()->getParam( - 'some-param' -); - -$this->loooooooooooong->lookup = (int) $variable - ->getRequest() - ->getParam('some-param'); - -$aVariable = $theThing - ->aLongFunction(1, 2, 3) - ->anotherReallyLongFunciton('a', 'b', 'c'); - -$anotherVariables = $theOtherThing - ->aLongFunction(1, 2, 3, 4, 5, 6, 7) - ->anotherReallyLongFunciton('a', 'b', 'c'); - -`; - -exports[`multiple-members.php 1`] = ` -find('SomewhatLongNodeName')->prop('longPropFunctionName')->then(function() { - doSomething(); -}); - -$wrapper->find('SomewhatLongNodeName')->prop('longPropFunctionName')->then(function() { - doSomething(); -}); - -$wrapper->find('SomewhatLongNodeName')->prop('longPropFunctionName', 'second argument that pushes this group past 80 characters')->then(function() { - doSomething(); -}); - -$wrapper->find('SomewhatLongNodeName')->prop('longPropFunctionName')->then(function() { - doSomething(); -}); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -find('SomewhatLongNodeName') - ->prop('longPropFunctionName') - ->then(function () { - doSomething(); - }); - -$wrapper - ->find('SomewhatLongNodeName') - ->prop('longPropFunctionName') - ->then(function () { - doSomething(); - }); - -$wrapper - ->find('SomewhatLongNodeName') - ->prop( - 'longPropFunctionName', - 'second argument that pushes this group past 80 characters' - ) - ->then(function () { - doSomething(); - }); - -$wrapper - ->find('SomewhatLongNodeName') - ->prop('longPropFunctionName') - ->then(function () { - doSomething(); - }); - -`; - -exports[`offsetlookup.php 1`] = ` -split('jest version =') - ->pop() - ->split(EOL)[0] - ->trim(); - -$component = find('.org-lclp-edit-copy-url-banner__link')[0] - ->getAttribute('href') - ->indexOf($this->landingPageLink); - -nock('test') - ->matchHeader('Accept', 'application/json')['string']('/foo') - ->reply(200, [ - 'foo' => 'bar' - ]); - -$data->forEach(function ($key) { - $data['key']('foo') - ->then(function () { $console->log('bar'); }) - ->catch(function () { $console->log('baz'); }); -}); - -$data->forEach(function ($key) { - $data('foo')[$key]('bar') - ->then(function () { $console->log('bar'); }) - ->catch(function () { $console->log('baz'); }); -}); - -$window->Data['key']("foo") - ->then(function () { return $a; }) - ->catch(function () { return $b; }); - -$window->Data['key']['foo']("foo") - ->then(function () { return $a; }) - ->catch(function () { return $b; }); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -split('jest version =') - ->pop() - ->split(EOL)[0] - ->trim(); - -$component = find('.org-lclp-edit-copy-url-banner__link')[0] - ->getAttribute('href') - ->indexOf($this->landingPageLink); - -nock('test') - ->matchHeader('Accept', 'application/json') - ['string']('/foo') - ->reply(200, ['foo' => 'bar']); - -$data->forEach(function ($key) { - $data - ['key']('foo') - ->then(function () { - $console->log('bar'); - }) - ->catch(function () { - $console->log('baz'); - }); -}); - -$data->forEach(function ($key) { - $data('foo') - [$key]('bar') - ->then(function () { - $console->log('bar'); - }) - ->catch(function () { - $console->log('baz'); - }); -}); - -$window->Data['key']("foo") - ->then(function () { - return $a; - }) - ->catch(function () { - return $b; - }); - -$window->Data['key'] - ['foo']("foo") - ->then(function () { - return $a; - }) - ->catch(function () { - return $b; - }); - -`; diff --git a/tests/member_chain/__snapshots__/jsfmt.spec.mjs.snap b/tests/member_chain/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..4d8631650 --- /dev/null +++ b/tests/member_chain/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,1094 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`break-last-call.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +then( + function ($response) { + return next(actionWith([ + 'response' => $response, + 'type' => $successType + ])); + }, + function ($error) { + return next(actionWith([ + 'type' => $failureType, + 'error' => $error->message || 'Something bad happened' + ])); + } + ); +} + +=====================================output===================================== +then( + function ($response) { + return next( + actionWith([ + "response" => $response, + "type" => $successType, + ]), + ); + }, + function ($error) { + return next( + actionWith([ + "type" => $failureType, + "error" => $error->message || "Something bad happened", + ]), + ); + }, + ); +} + +================================================================================ +`; + +exports[`break-last-member.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +someVeryLongCallExpression()->some_very_long_member_expression; +$weNeedToReachTheEightyCharacterLimitXXXXXXXXXXXXXXXXX->someNode +->childrenInAnArray[0]; +$superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered; +$superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered[0]; +$superSupersuperSupersuperSupersuperSupersuperSuperLong->{$exampleOfOrderOfGetterAndSetterReordered}; +$superSupersuperSupersuperSupersuperSupersuperSuperLong::$exampleOfOrderOfGetterAndSetterReordered; +$superSupersuperSupersuperSupersuperSupersuperSuperLong::$exampleOfOrderOfGetterAndSetterReordered[0]; +$superSupersuperSupersuperSupersuperSupersuperSuperLong = (new SuperSuperSuperSuperSuperSuperLongClassName())->some_very_long_member_expression; +new $superSupersuperSupersuperSupersuperSupersuperSuperLong->superSupersuperSupersuperSupersuperSupersuperSuperLong->superSupersuperSupersuperSupersuperSupersuperSuperLong(); +(new $superSupersuperSupersuperSupersuperSupersuperSuperLong->superSupersuperSupersuperSupersuperSupersuperSuperLong->superSupersuperSupersuperSupersuperSupersuperSuperLong)->superSupersuperSupersuperSupersuperSupersuperSuperLong; +$test = $superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered; +$test = $test = $superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered; + +=====================================output===================================== +someVeryLongCallExpression() + ->some_very_long_member_expression; +$weNeedToReachTheEightyCharacterLimitXXXXXXXXXXXXXXXXX->someNode + ->childrenInAnArray[0]; +$superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered; +$superSupersuperSupersuperSupersuperSupersuperSuperLong + ->exampleOfOrderOfGetterAndSetterReordered[0]; +$superSupersuperSupersuperSupersuperSupersuperSuperLong->{$exampleOfOrderOfGetterAndSetterReordered}; +$superSupersuperSupersuperSupersuperSupersuperSuperLong::$exampleOfOrderOfGetterAndSetterReordered; +$superSupersuperSupersuperSupersuperSupersuperSuperLong + ::$exampleOfOrderOfGetterAndSetterReordered[0]; +$superSupersuperSupersuperSupersuperSupersuperSuperLong = new SuperSuperSuperSuperSuperSuperLongClassName() + ->some_very_long_member_expression; +new $superSupersuperSupersuperSupersuperSupersuperSuperLong->superSupersuperSupersuperSupersuperSupersuperSuperLong->superSupersuperSupersuperSupersuperSupersuperSuperLong(); +new $superSupersuperSupersuperSupersuperSupersuperSuperLong->superSupersuperSupersuperSupersuperSupersuperSuperLong->superSupersuperSupersuperSupersuperSupersuperSuperLong() + ->superSupersuperSupersuperSupersuperSupersuperSuperLong; +$test = + $superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered; +$test = $test = + $superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered; + +================================================================================ +`; + +exports[`break-multiple.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo()->bar()->baz(); + +$object->foo()->bar()->baz()->foo()->bar()->baz(); + +$object->foo()->bar()->baz()->foo()->bar()->baz()->foo()->bar()->baz(); + +$object->foo()->bar()->baz()->foo()->bar()->baz()->foo()->bar()->baz()->foo()->bar()->baz()->foo()->bar()->baz()->foo()->bar()->baz(); + +foo()->bar()->baz(); + +foo()->bar->baz(); + +=====================================output===================================== +foo()->bar()->baz(); + +$object->foo()->bar()->baz()->foo()->bar()->baz(); + +$object->foo()->bar()->baz()->foo()->bar()->baz()->foo()->bar()->baz(); + +$object + ->foo() + ->bar() + ->baz() + ->foo() + ->bar() + ->baz() + ->foo() + ->bar() + ->baz() + ->foo() + ->bar() + ->baz() + ->foo() + ->bar() + ->baz() + ->foo() + ->bar() + ->baz(); + +foo()->bar()->baz(); + +foo()->bar->baz(); + +================================================================================ +`; + +exports[`conditional.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +d(); + +($a ? $b : $c)->d()->e(); + +($a ? $b : $c)->d()->e()->f(); + +($valid + ? $helper->responseBody($this->currentUser) + : $helper->responseBody($this->defaultUser)) +->map(); + +($valid + ? $helper->responseBody($this->currentUser) + : $helper->responseBody($this->defaultUser)) +->map()->filter(); + +($valid + ? $helper->responseBody($this->currentUser) + : $helper->responseBody(defaultUser)) +->map(); + +$object[$valid + ? $helper->responseBody($this->currentUser) + : $helper->responseBody($defaultUser) +]->map(); + +(new TestClassWithReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName()) +->map()->filter(); + +($testThingWithReallyLongName && $someOtherObject->withfunctionThatReturnsSomething()) +->map()->filter(); + +($testThingWithReallyLongName && $someOtherObject->withlongPropThatReturnsSomething) +->map()->filter(); + +($testThingWithReallyLongName && new SomeObjectWithReallyReallyReallyReallyLongName()) +->map()->filter(); + +($testThingWithReallyLongName && $test = new SomeObjectWithReallyReallyReallyLongName()) +->map()->filter(); + +($testThingWithReallyLongName = new SomeObjectWithReallyReallyReallyReallyReallyReallyReallyReallyLongName()) +->map()->filter(); + +=====================================output===================================== +d(); + +($a ? $b : $c)->d()->e(); + +($a ? $b : $c)->d()->e()->f(); + +($valid + ? $helper->responseBody($this->currentUser) + : $helper->responseBody($this->defaultUser) +)->map(); + +($valid + ? $helper->responseBody($this->currentUser) + : $helper->responseBody($this->defaultUser) +) + ->map() + ->filter(); + +($valid + ? $helper->responseBody($this->currentUser) + : $helper->responseBody(defaultUser) +)->map(); + +$object[ + $valid + ? $helper->responseBody($this->currentUser) + : $helper->responseBody($defaultUser) +]->map(); + +new TestClassWithReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ->map() + ->filter(); + +( + $testThingWithReallyLongName && + $someOtherObject->withfunctionThatReturnsSomething() +) + ->map() + ->filter(); + +( + $testThingWithReallyLongName && + $someOtherObject->withlongPropThatReturnsSomething +) + ->map() + ->filter(); + +( + $testThingWithReallyLongName && + new SomeObjectWithReallyReallyReallyReallyLongName() +) + ->map() + ->filter(); + +( + $testThingWithReallyLongName && + ($test = new SomeObjectWithReallyReallyReallyLongName()) +) + ->map() + ->filter(); + +($testThingWithReallyLongName = new SomeObjectWithReallyReallyReallyReallyReallyReallyReallyReallyLongName()) + ->map() + ->filter(); + +================================================================================ +`; + +exports[`logical.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 'bar', 'bar' => 'foo', 'foobar' => 'barfoor'] +) || [])->map(function ($edge) { return $edge->node; }); + +($veryLongVeryLongVeryLong || $e)->map(function ($tickets) { + $TicketRecord->createFromSomeLongString(); +}); + +($veryLongVeryLongVeryLong || $e)->map(function ($tickets) { + $TicketRecord->createFromSomeLongString(); +})->filter(function ($obj) { return !!$obj; }); + +($veryLongVeryLongVeryLong || $anotherVeryLongVeryLongVeryLong || $veryVeryVeryLongError)->map(function ($tickets) { + $TicketRecord ->createFromSomeLongString(); +}); + +($veryLongVeryLongVeryLong || $anotherVeryLongVeryLongVeryLong || $veryVeryVeryLongError)->map(function ($tickets) { + $TicketRecord->createFromSomeLongString(); +})->filter(function ($obj) { return !!$obj; }); + +=====================================output===================================== + "bar", "bar" => "foo", "foobar" => "barfoor"]) || [] +)->map(function ($edge) { + return $edge->node; +}); + +($veryLongVeryLongVeryLong || $e)->map(function ($tickets) { + $TicketRecord->createFromSomeLongString(); +}); + +($veryLongVeryLongVeryLong || $e) + ->map(function ($tickets) { + $TicketRecord->createFromSomeLongString(); + }) + ->filter(function ($obj) { + return !!$obj; + }); + +( + $veryLongVeryLongVeryLong || + $anotherVeryLongVeryLongVeryLong || + $veryVeryVeryLongError +)->map(function ($tickets) { + $TicketRecord->createFromSomeLongString(); +}); + +( + $veryLongVeryLongVeryLong || + $anotherVeryLongVeryLongVeryLong || + $veryVeryVeryLongError +) + ->map(function ($tickets) { + $TicketRecord->createFromSomeLongString(); + }) + ->filter(function ($obj) { + return !!$obj; + }); + +================================================================================ +`; + +exports[`member_chain.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +two(); +one() + ->two() + ->three(); +one() + ->two->three() + ->four->five(); + +Route::prefix('api') + ->middleware('api') + ->namespace($this->namespace) + ->group(base_path('routes/api.php')); + +return tap($this->forceFill([ + 'approver_id' => $user instanceof User ? $user->id : $user, + 'approved_at' => $this->freshTimestamp(), +]))->save(); + +return collect(parent::jsonSerialize())->mapWithKeys(function ($value, $key) { + return [camel_case($key) => $value]; +})->toArray(); + +method()->then(function ($x) { return $x; }) + ["abc"](function ($x) { return $x; }) + [$abc](function ($x) { return $x; }); + +($a->a()->b()); +($a)->a()->b(); +$a->a()->b; +$a->b->a(); +$a->b()->c()->d(); +$a->b->c->d; + +// should inline +$t->shouldReceive( 'signUp' )->with( anInstanceOf( 'Foo\\\\Bar\\\\Baz' ), $this->app['foo.bar.baz']->getEmail())->once(); +$te->shouldReceive( 'signUp' )->with( anInstanceOf( 'Foo\\\\Bar\\\\Baz' ), $this->app['foo.bar.baz']->getEmail())->once(); +$tes->shouldReceive( 'signUp' )->with( anInstanceOf( 'Foo\\\\Bar\\\\Baz' ), $this->app['foo.bar.baz']->getEmail())->once(); +// should break +$test->shouldReceive( 'signUp' )->with( anInstanceOf( 'Foo\\\\Bar\\\\Baz' ), $this->app['foo.bar.baz']->getEmail())->once(); +$a = $t->shouldReceive( 'signUp' )->with( anInstanceOf( 'Foo\\\\Bar\\\\Baz' ), $this->app['foo.bar.baz']->getEmail())->once(); + +$this->loooooooooooong->lookup = (int) $this->getRequest()->getParam( + 'some-param' +); + +$this->loooooooooooong->lookup = (int) $variable->getRequest()->getParam( + 'some-param' +); + +$aVariable = $theThing + ->aLongFunction(1, 2, 3) + ->anotherReallyLongFunciton('a', 'b', 'c'); + +$anotherVariables = $theOtherThing + ->aLongFunction(1, 2, 3, 4, 5, 6, 7) + ->anotherReallyLongFunciton('a', 'b', 'c'); + +$aVariable = $theThing->veryVeryVeryVeryVeryVeryVeryVeryLongCall()->veryVeryVeryVeryVeryVeryVeryVery; +$aVariable = $theThing->veryVeryVeryVeryVeryVeryVeryVeryLongCall()->veryVeryVeryVeryVeryVeryVeryVery(); + +bar()(); +bar('veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong')(); +bar()('veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong'); +bar('veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong')()()()()(); + +$foo->bar()(); +$foo->bar('veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong')(); +$foo->bar()('veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong'); +$foo->bar('veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong')()()()()(); + +$brian->hotel->orders()->ordered()->with('smith')->get(); +$brian::$hotel->orders()->ordered()->with('smith')->get(); +$brian['hotel']->orders()->ordered()->with('smith')->get(); +Foo::$hotel->orders()->ordered()->with('smith')->get(); +(new Foo())->hotel->orders()->ordered()->with('smith')->get(); +(clone $a)->hotel->orders()->ordered()->with('smith')->get(); + +$var = $brian->hotel->orders()->ordered()->with('smith')->get(); +$var = $brian::$hotel->orders()->ordered()->with('smith')->get(); +$var = $brian['hotel']->orders()->ordered()->with('smith')->get(); +$var = Foo::$hotel->orders()->ordered()->with('smith')->get(); +$var = (new Foo())->hotel->orders()->ordered()->with('smith')->get(); +$var = (clone $a)->hotel->orders()->ordered()->with('smith')->get(); + +$var = Foo::keys($items)->filter(function ($x) { return $x > 2; })->map(function ($x) { return $x * 2; }); + +(new static(func_get_args()))->push($this)->each(function ($item) { + VarDumper::dump($item); +}); +(new static(func_get_args()))->offset(10)->push($this)->each(function ($item) { + VarDumper::dump($item); +}); + +=====================================output===================================== +two(); +one()->two()->three(); +one()->two->three()->four->five(); + +Route::prefix("api") + ->middleware("api") + ->namespace($this->namespace) + ->group(base_path("routes/api.php")); + +return tap( + $this->forceFill([ + "approver_id" => $user instanceof User ? $user->id : $user, + "approved_at" => $this->freshTimestamp(), + ]), +)->save(); + +return collect(parent::jsonSerialize()) + ->mapWithKeys(function ($value, $key) { + return [camel_case($key) => $value]; + }) + ->toArray(); + +method() + ->then(function ($x) { + return $x; + }) + ["abc"](function ($x) { + return $x; + }) + [$abc](function ($x) { + return $x; + }); + +$a->a()->b(); +$a->a()->b(); +$a->a()->b; +$a->b->a(); +$a->b()->c()->d(); +$a->b->c->d; + +// should inline +$t->shouldReceive("signUp") + ->with(anInstanceOf("Foo\\\\Bar\\\\Baz"), $this->app["foo.bar.baz"]->getEmail()) + ->once(); +$te->shouldReceive("signUp") + ->with(anInstanceOf("Foo\\\\Bar\\\\Baz"), $this->app["foo.bar.baz"]->getEmail()) + ->once(); +$tes->shouldReceive("signUp") + ->with(anInstanceOf("Foo\\\\Bar\\\\Baz"), $this->app["foo.bar.baz"]->getEmail()) + ->once(); +// should break +$test + ->shouldReceive("signUp") + ->with(anInstanceOf("Foo\\\\Bar\\\\Baz"), $this->app["foo.bar.baz"]->getEmail()) + ->once(); +$a = $t + ->shouldReceive("signUp") + ->with(anInstanceOf("Foo\\\\Bar\\\\Baz"), $this->app["foo.bar.baz"]->getEmail()) + ->once(); + +$this->loooooooooooong->lookup = (int) $this->getRequest()->getParam( + "some-param", +); + +$this->loooooooooooong->lookup = (int) $variable + ->getRequest() + ->getParam("some-param"); + +$aVariable = $theThing + ->aLongFunction(1, 2, 3) + ->anotherReallyLongFunciton("a", "b", "c"); + +$anotherVariables = $theOtherThing + ->aLongFunction(1, 2, 3, 4, 5, 6, 7) + ->anotherReallyLongFunciton("a", "b", "c"); + +$aVariable = $theThing->veryVeryVeryVeryVeryVeryVeryVeryLongCall() + ->veryVeryVeryVeryVeryVeryVeryVery; +$aVariable = $theThing + ->veryVeryVeryVeryVeryVeryVeryVeryLongCall() + ->veryVeryVeryVeryVeryVeryVeryVery(); + +bar()(); +bar( + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong", +)(); +bar()( + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong", +); +bar( + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong", +)()()()()(); + +$foo->bar()(); +$foo->bar( + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong", +)(); +$foo->bar()( + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong", +); +$foo->bar( + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong", +)()()()()(); + +$brian->hotel->orders()->ordered()->with("smith")->get(); +$brian::$hotel->orders()->ordered()->with("smith")->get(); +$brian["hotel"]->orders()->ordered()->with("smith")->get(); +Foo::$hotel->orders()->ordered()->with("smith")->get(); +new Foo()->hotel->orders()->ordered()->with("smith")->get(); +(clone $a)->hotel->orders()->ordered()->with("smith")->get(); + +$var = $brian->hotel->orders()->ordered()->with("smith")->get(); +$var = $brian::$hotel->orders()->ordered()->with("smith")->get(); +$var = $brian["hotel"]->orders()->ordered()->with("smith")->get(); +$var = Foo::$hotel->orders()->ordered()->with("smith")->get(); +$var = new Foo()->hotel->orders()->ordered()->with("smith")->get(); +$var = (clone $a)->hotel->orders()->ordered()->with("smith")->get(); + +$var = Foo::keys($items) + ->filter(function ($x) { + return $x > 2; + }) + ->map(function ($x) { + return $x * 2; + }); + +new static(func_get_args())->push($this)->each(function ($item) { + VarDumper::dump($item); +}); +new static(func_get_args()) + ->offset(10) + ->push($this) + ->each(function ($item) { + VarDumper::dump($item); + }); + +================================================================================ +`; + +exports[`multiple-members.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +find('SomewhatLongNodeName')->prop('longPropFunctionName')->then(function() { + doSomething(); +}); + +$wrapper->find('SomewhatLongNodeName')->prop('longPropFunctionName')->then(function() { + doSomething(); +}); + +$wrapper->find('SomewhatLongNodeName')->prop('longPropFunctionName', 'second argument that pushes this group past 80 characters')->then(function() { + doSomething(); +}); + +$wrapper->find('SomewhatLongNodeName')->prop('longPropFunctionName')->then(function() { + doSomething(); +}); + +=====================================output===================================== +find("SomewhatLongNodeName") + ->prop("longPropFunctionName") + ->then(function () { + doSomething(); + }); + +$wrapper + ->find("SomewhatLongNodeName") + ->prop("longPropFunctionName") + ->then(function () { + doSomething(); + }); + +$wrapper + ->find("SomewhatLongNodeName") + ->prop( + "longPropFunctionName", + "second argument that pushes this group past 80 characters", + ) + ->then(function () { + doSomething(); + }); + +$wrapper + ->find("SomewhatLongNodeName") + ->prop("longPropFunctionName") + ->then(function () { + doSomething(); + }); + +================================================================================ +`; + +exports[`offsetlookup.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +split('jest version =') + ->pop() + ->split(EOL)[0] + ->trim(); + +$component = find('.org-lclp-edit-copy-url-banner__link')[0] + ->getAttribute('href') + ->indexOf($this->landingPageLink); + +nock('test') + ->matchHeader('Accept', 'application/json')['string']('/foo') + ->reply(200, [ + 'foo' => 'bar' + ]); + +$data->forEach(function ($key) { + $data['key']('foo') + ->then(function () { $console->log('bar'); }) + ->catch(function () { $console->log('baz'); }); +}); + +$data->forEach(function ($key) { + $data('foo')[$key]('bar') + ->then(function () { $console->log('bar'); }) + ->catch(function () { $console->log('baz'); }); +}); + +$window->Data['key']("foo") + ->then(function () { return $a; }) + ->catch(function () { return $b; }); + +$window->Data['key']['foo']("foo") + ->then(function () { return $a; }) + ->catch(function () { return $b; }); + +$window->foo_{'bar' . 'baz'} + ['key']("foo") + ->then(function () { + return $a; + }) + ->catch(function () { + return $b; + }); + +$window->{call()} + ['key']("foo") + ->then(function () { + return $a; + }) + ->catch(function () { + return $b; + }); + + +$window->call($foo->bar->baz)->first()->second(); +$window->call($foo->bar->baz->foo())->first()->second(); + +(new Foo())->call($foo->bar->baz)->first()->second(); +(new Foo())->call($foo->bar->baz->foo())->first()->second(); + +Foo::call($foo->bar->baz)->first()->second(); +Foo::call($foo->bar->baz->foo())->first()->second(); + +=====================================output===================================== +split("jest version =") + ->pop() + ->split(EOL)[0] + ->trim(); + +$component = find(".org-lclp-edit-copy-url-banner__link")[0] + ->getAttribute("href") + ->indexOf($this->landingPageLink); + +nock("test") + ->matchHeader("Accept", "application/json") + ["string"]("/foo") + ->reply(200, [ + "foo" => "bar", + ]); + +$data->forEach(function ($key) { + $data + ["key"]("foo") + ->then(function () { + $console->log("bar"); + }) + ->catch(function () { + $console->log("baz"); + }); +}); + +$data->forEach(function ($key) { + $data("foo") + [$key]("bar") + ->then(function () { + $console->log("bar"); + }) + ->catch(function () { + $console->log("baz"); + }); +}); + +$window->Data["key"]("foo") + ->then(function () { + return $a; + }) + ->catch(function () { + return $b; + }); + +$window->Data["key"] + ["foo"]("foo") + ->then(function () { + return $a; + }) + ->catch(function () { + return $b; + }); + +$window->foo_["bar" . "baz"] + ["key"]("foo") + ->then(function () { + return $a; + }) + ->catch(function () { + return $b; + }); + +$window->{call()} + ["key"]("foo") + ->then(function () { + return $a; + }) + ->catch(function () { + return $b; + }); + +$window->call($foo->bar->baz)->first()->second(); +$window + ->call($foo->bar->baz->foo()) + ->first() + ->second(); + +new Foo()->call($foo->bar->baz)->first()->second(); +new Foo() + ->call($foo->bar->baz->foo()) + ->first() + ->second(); + +Foo::call($foo->bar->baz)->first()->second(); +Foo::call($foo->bar->baz->foo()) + ->first() + ->second(); + +================================================================================ +`; + +exports[`staticlookup.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +insert([ + 'ref' => $ref, + 'handle' => $handle +]); + +DB::table('identity')->insert([ + 'ref' => $ref, + 'handle' => $handle, + 'foo' => $bar, + 'bar' => $foo +]); + +DB::table('identity')->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName([ + 'ref' => $ref, + 'handle' => $handle, + 'foo' => $bar, + 'bar' => $foo +]); + +$page = TableRegistry + ::get('Pages') + ->findByPath($path) + ->find('published') + ->find('frontend') + ->find('somethingElse') + ->first(); + +Logger + ::use_logger('albus') + ->info('Albus: failed to find active version for albus object', [ + 'uuid' => $uuid, + 'requested_date' => $date + ]); + +DBwithlongname::table('identity')->insertReallyReallyReallyLongName()->someOtherReallyReallyLong(); + +$DBwithlongname->table('identity')::insertReallyReallyReallyLongName()->someOtherReallyReallyLong(); + +$page = TableRegistry + ::get('Pages') + ::findByPath($path) + ::find('published') + ::find('frontend') + ::find('somethingElse') + ::first(); + +$page = TableRegistry + ::insertReallyReallyReallyLongName('Pages') + ::insertReallyReallyReallyLongName($path) + ::insertReallyReallyReallyLongName('published') + ::insertReallyReallyReallyLongName('frontend') + ::insertReallyReallyReallyLongName('somethingElse') + ::insertReallyReallyReallyLongName(); + +$page = TableRegistry::insertReallyReallyReallyLongName[0]; +$page = TableRegistry::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$page = TableRegistry + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$page = TableRegistry + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; + +$page = TableRegistry::insertReallyReallyReallyLongName('Pages')[0]; +$page = TableRegistry::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName('Pages')[0]; + +$component = find('.org-lclp-edit-copy-url-banner__link')[0] + ::getAttribute('href') + ::indexOf($this->landingPageLink); + +$component = Foo::test(['foo' => 'bar', 'bar' => 'foo', 'foobar' => 'barfoo', 'barfoo' => 'foobar']); +$component = Foo::$insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; + +static + ::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + 'paginator' => $this + ]) + ) + ->render(); +sTaTic + ::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + 'paginator' => $this + ]) + ) + ->render(); +self + ::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + 'paginator' => $this + ]) + ) + ->render(); +parent + ::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + 'paginator' => $this + ]) + ) + ->render(); + +Foo + ::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + 'paginator' => $this + ]) + ) + ->render(); + +=====================================output===================================== +insert([ + "ref" => $ref, + "handle" => $handle, +]); + +DB::table("identity")->insert([ + "ref" => $ref, + "handle" => $handle, + "foo" => $bar, + "bar" => $foo, +]); + +DB::table( + "identity", +)->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName([ + "ref" => $ref, + "handle" => $handle, + "foo" => $bar, + "bar" => $foo, +]); + +$page = TableRegistry::get("Pages") + ->findByPath($path) + ->find("published") + ->find("frontend") + ->find("somethingElse") + ->first(); + +Logger::use_logger("albus")->info( + "Albus: failed to find active version for albus object", + [ + "uuid" => $uuid, + "requested_date" => $date, + ], +); + +DBwithlongname::table("identity") + ->insertReallyReallyReallyLongName() + ->someOtherReallyReallyLong(); + +$DBwithlongname + ->table("identity") + ::insertReallyReallyReallyLongName() + ->someOtherReallyReallyLong(); + +$page = TableRegistry::get("Pages") + ::findByPath($path) + ::find("published") + ::find("frontend") + ::find("somethingElse") + ::first(); + +$page = TableRegistry::insertReallyReallyReallyLongName("Pages") + ::insertReallyReallyReallyLongName($path) + ::insertReallyReallyReallyLongName("published") + ::insertReallyReallyReallyLongName("frontend") + ::insertReallyReallyReallyLongName("somethingElse") + ::insertReallyReallyReallyLongName(); + +$page = TableRegistry::insertReallyReallyReallyLongName[0]; +$page = + TableRegistry + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$page = TableRegistry::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$page = TableRegistry::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; + +$page = TableRegistry::insertReallyReallyReallyLongName("Pages")[0]; +$page = TableRegistry::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName( + "Pages", +)[0]; + +$component = find(".org-lclp-edit-copy-url-banner__link")[0] + ::getAttribute("href") + ::indexOf($this->landingPageLink); + +$component = Foo::test([ + "foo" => "bar", + "bar" => "foo", + "foobar" => "barfoo", + "barfoo" => "foobar", +]); +$component = + Foo + ::$insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; + +static::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + "paginator" => $this, + ]), + ) + ->render(); +static::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + "paginator" => $this, + ]), + ) + ->render(); +self::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + "paginator" => $this, + ]), + ) + ->render(); +parent::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + "paginator" => $this, + ]), + ) + ->render(); + +Foo::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + "paginator" => $this, + ]), + ) + ->render(); + +================================================================================ +`; diff --git a/tests/member_chain/break-last-member.php b/tests/member_chain/break-last-member.php index a17d61e62..8aba48712 100644 --- a/tests/member_chain/break-last-member.php +++ b/tests/member_chain/break-last-member.php @@ -5,3 +5,11 @@ ->childrenInAnArray[0]; $superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered; $superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered[0]; +$superSupersuperSupersuperSupersuperSupersuperSuperLong->{$exampleOfOrderOfGetterAndSetterReordered}; +$superSupersuperSupersuperSupersuperSupersuperSuperLong::$exampleOfOrderOfGetterAndSetterReordered; +$superSupersuperSupersuperSupersuperSupersuperSuperLong::$exampleOfOrderOfGetterAndSetterReordered[0]; +$superSupersuperSupersuperSupersuperSupersuperSuperLong = (new SuperSuperSuperSuperSuperSuperLongClassName())->some_very_long_member_expression; +new $superSupersuperSupersuperSupersuperSupersuperSuperLong->superSupersuperSupersuperSupersuperSupersuperSuperLong->superSupersuperSupersuperSupersuperSupersuperSuperLong(); +(new $superSupersuperSupersuperSupersuperSupersuperSuperLong->superSupersuperSupersuperSupersuperSupersuperSuperLong->superSupersuperSupersuperSupersuperSupersuperSuperLong)->superSupersuperSupersuperSupersuperSupersuperSuperLong; +$test = $superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered; +$test = $test = $superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered; diff --git a/tests/member_chain/break-multiple.php b/tests/member_chain/break-multiple.php index 642568abb..8bc7fbb7b 100644 --- a/tests/member_chain/break-multiple.php +++ b/tests/member_chain/break-multiple.php @@ -2,6 +2,12 @@ $object->foo()->bar()->baz(); +$object->foo()->bar()->baz()->foo()->bar()->baz(); + +$object->foo()->bar()->baz()->foo()->bar()->baz()->foo()->bar()->baz(); + +$object->foo()->bar()->baz()->foo()->bar()->baz()->foo()->bar()->baz()->foo()->bar()->baz()->foo()->bar()->baz()->foo()->bar()->baz(); + foo()->bar()->baz(); foo()->bar->baz(); diff --git a/tests/member_chain/jsfmt.spec.js b/tests/member_chain/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/member_chain/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/member_chain/jsfmt.spec.mjs b/tests/member_chain/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/member_chain/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/member_chain/member_chain.php b/tests/member_chain/member_chain.php index a0e257897..e770a0a84 100644 --- a/tests/member_chain/member_chain.php +++ b/tests/member_chain/member_chain.php @@ -33,6 +33,14 @@ $a->b()->c()->d(); $a->b->c->d; +// should inline +$t->shouldReceive( 'signUp' )->with( anInstanceOf( 'Foo\\Bar\\Baz' ), $this->app['foo.bar.baz']->getEmail())->once(); +$te->shouldReceive( 'signUp' )->with( anInstanceOf( 'Foo\\Bar\\Baz' ), $this->app['foo.bar.baz']->getEmail())->once(); +$tes->shouldReceive( 'signUp' )->with( anInstanceOf( 'Foo\\Bar\\Baz' ), $this->app['foo.bar.baz']->getEmail())->once(); +// should break +$test->shouldReceive( 'signUp' )->with( anInstanceOf( 'Foo\\Bar\\Baz' ), $this->app['foo.bar.baz']->getEmail())->once(); +$a = $t->shouldReceive( 'signUp' )->with( anInstanceOf( 'Foo\\Bar\\Baz' ), $this->app['foo.bar.baz']->getEmail())->once(); + $this->loooooooooooong->lookup = (int) $this->getRequest()->getParam( 'some-param' ); @@ -48,3 +56,39 @@ $anotherVariables = $theOtherThing ->aLongFunction(1, 2, 3, 4, 5, 6, 7) ->anotherReallyLongFunciton('a', 'b', 'c'); + +$aVariable = $theThing->veryVeryVeryVeryVeryVeryVeryVeryLongCall()->veryVeryVeryVeryVeryVeryVeryVery; +$aVariable = $theThing->veryVeryVeryVeryVeryVeryVeryVeryLongCall()->veryVeryVeryVeryVeryVeryVeryVery(); + +bar()(); +bar('veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong')(); +bar()('veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong'); +bar('veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong')()()()()(); + +$foo->bar()(); +$foo->bar('veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong')(); +$foo->bar()('veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong'); +$foo->bar('veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong')()()()()(); + +$brian->hotel->orders()->ordered()->with('smith')->get(); +$brian::$hotel->orders()->ordered()->with('smith')->get(); +$brian['hotel']->orders()->ordered()->with('smith')->get(); +Foo::$hotel->orders()->ordered()->with('smith')->get(); +(new Foo())->hotel->orders()->ordered()->with('smith')->get(); +(clone $a)->hotel->orders()->ordered()->with('smith')->get(); + +$var = $brian->hotel->orders()->ordered()->with('smith')->get(); +$var = $brian::$hotel->orders()->ordered()->with('smith')->get(); +$var = $brian['hotel']->orders()->ordered()->with('smith')->get(); +$var = Foo::$hotel->orders()->ordered()->with('smith')->get(); +$var = (new Foo())->hotel->orders()->ordered()->with('smith')->get(); +$var = (clone $a)->hotel->orders()->ordered()->with('smith')->get(); + +$var = Foo::keys($items)->filter(function ($x) { return $x > 2; })->map(function ($x) { return $x * 2; }); + +(new static(func_get_args()))->push($this)->each(function ($item) { + VarDumper::dump($item); +}); +(new static(func_get_args()))->offset(10)->push($this)->each(function ($item) { + VarDumper::dump($item); +}); diff --git a/tests/member_chain/offsetlookup.php b/tests/member_chain/offsetlookup.php index b7c8c746f..5b37bc39e 100644 --- a/tests/member_chain/offsetlookup.php +++ b/tests/member_chain/offsetlookup.php @@ -35,3 +35,31 @@ $window->Data['key']['foo']("foo") ->then(function () { return $a; }) ->catch(function () { return $b; }); + +$window->foo_{'bar' . 'baz'} + ['key']("foo") + ->then(function () { + return $a; + }) + ->catch(function () { + return $b; + }); + +$window->{call()} + ['key']("foo") + ->then(function () { + return $a; + }) + ->catch(function () { + return $b; + }); + + +$window->call($foo->bar->baz)->first()->second(); +$window->call($foo->bar->baz->foo())->first()->second(); + +(new Foo())->call($foo->bar->baz)->first()->second(); +(new Foo())->call($foo->bar->baz->foo())->first()->second(); + +Foo::call($foo->bar->baz)->first()->second(); +Foo::call($foo->bar->baz->foo())->first()->second(); diff --git a/tests/member_chain/staticlookup.php b/tests/member_chain/staticlookup.php new file mode 100644 index 000000000..d7a1e7e7a --- /dev/null +++ b/tests/member_chain/staticlookup.php @@ -0,0 +1,123 @@ +insert([ + 'ref' => $ref, + 'handle' => $handle +]); + +DB::table('identity')->insert([ + 'ref' => $ref, + 'handle' => $handle, + 'foo' => $bar, + 'bar' => $foo +]); + +DB::table('identity')->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName([ + 'ref' => $ref, + 'handle' => $handle, + 'foo' => $bar, + 'bar' => $foo +]); + +$page = TableRegistry + ::get('Pages') + ->findByPath($path) + ->find('published') + ->find('frontend') + ->find('somethingElse') + ->first(); + +Logger + ::use_logger('albus') + ->info('Albus: failed to find active version for albus object', [ + 'uuid' => $uuid, + 'requested_date' => $date + ]); + +DBwithlongname::table('identity')->insertReallyReallyReallyLongName()->someOtherReallyReallyLong(); + +$DBwithlongname->table('identity')::insertReallyReallyReallyLongName()->someOtherReallyReallyLong(); + +$page = TableRegistry + ::get('Pages') + ::findByPath($path) + ::find('published') + ::find('frontend') + ::find('somethingElse') + ::first(); + +$page = TableRegistry + ::insertReallyReallyReallyLongName('Pages') + ::insertReallyReallyReallyLongName($path) + ::insertReallyReallyReallyLongName('published') + ::insertReallyReallyReallyLongName('frontend') + ::insertReallyReallyReallyLongName('somethingElse') + ::insertReallyReallyReallyLongName(); + +$page = TableRegistry::insertReallyReallyReallyLongName[0]; +$page = TableRegistry::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$page = TableRegistry + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$page = TableRegistry + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName() + ::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; + +$page = TableRegistry::insertReallyReallyReallyLongName('Pages')[0]; +$page = TableRegistry::insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName('Pages')[0]; + +$component = find('.org-lclp-edit-copy-url-banner__link')[0] + ::getAttribute('href') + ::indexOf($this->landingPageLink); + +$component = Foo::test(['foo' => 'bar', 'bar' => 'foo', 'foobar' => 'barfoo', 'barfoo' => 'foobar']); +$component = Foo::$insertReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; + +static + ::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + 'paginator' => $this + ]) + ) + ->render(); +sTaTic + ::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + 'paginator' => $this + ]) + ) + ->render(); +self + ::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + 'paginator' => $this + ]) + ) + ->render(); +parent + ::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + 'paginator' => $this + ]) + ) + ->render(); + +Foo + ::viewFactory() + ->make( + $view ?: static::$defaultSimpleView, + array_merge($data, [ + 'paginator' => $this + ]) + ) + ->render(); diff --git a/tests/method/__snapshots__/jsfmt.spec.mjs.snap b/tests/method/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..2e31fde39 --- /dev/null +++ b/tests/method/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,92 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`method.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +link = $link; + } + + public function publishMethod() + { + return 'public'; + } + + private function protectedMethod() + { + return 'protected'; + } + + private function privateMethod() + { + return 'private'; + } + + public function emptyMethod() {} + + public function emptyMethodWithComment() + { + // Comment + } + + function aMemberFunc() { + print 'Inside \`aMemberFunc()\`'; + } + + function bMemberFunc(){} +} + +=====================================output===================================== +link = $link; + } + + public function publishMethod() + { + return "public"; + } + + private function protectedMethod() + { + return "protected"; + } + + private function privateMethod() + { + return "private"; + } + + public function emptyMethod() {} + + public function emptyMethodWithComment() + { + // Comment + } + + function aMemberFunc() + { + print "Inside \`aMemberFunc()\`"; + } + + function bMemberFunc() {} +} + +================================================================================ +`; diff --git a/tests/method/jsfmt.spec.mjs b/tests/method/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/method/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/method/method.php b/tests/method/method.php new file mode 100644 index 000000000..04a20f08c --- /dev/null +++ b/tests/method/method.php @@ -0,0 +1,39 @@ +link = $link; + } + + public function publishMethod() + { + return 'public'; + } + + private function protectedMethod() + { + return 'protected'; + } + + private function privateMethod() + { + return 'private'; + } + + public function emptyMethod() {} + + public function emptyMethodWithComment() + { + // Comment + } + + function aMemberFunc() { + print 'Inside `aMemberFunc()`'; + } + + function bMemberFunc(){} +} diff --git a/tests/namedarguments/.jsfmt.spec.js.swo b/tests/namedarguments/.jsfmt.spec.js.swo new file mode 100644 index 000000000..517570411 Binary files /dev/null and b/tests/namedarguments/.jsfmt.spec.js.swo differ diff --git a/tests/namedarguments/__snapshots__/jsfmt.spec.mjs.snap b/tests/namedarguments/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..584418c04 --- /dev/null +++ b/tests/namedarguments/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,69 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`namedarguments.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.0" +printWidth: 80 + | printWidth +=====================================input====================================== + bar (arg1: $arg1, arg2: $arg2,$arg3, $arg4 , $arg5 ) ; +Foo :: bar( arg1:$arg1,arg2:$arg2 ,$arg3, $arg4 , $arg5 ) ; + +$db->Execute($sql, config: [ + $foo, + $bar, + $foobar, + $somewhatLongParameter, + $somewhatLongParameterX, + $somewhatLongParameterXYZ +]); + +$app->get('/hello/{name}', callback: function ($name) use ($app) { + return 'Hello ' . $app->escape($name); +}); + +$this->something->method($argument, val: $this->more->stuff( + $this->even->more->things->complicatedMethod() +)); + +=====================================output===================================== +bar(arg1: $arg1, arg2: $arg2, $arg3, $arg4, $arg5); +Foo::bar(arg1: $arg1, arg2: $arg2, $arg3, $arg4, $arg5); + +$db->Execute( + $sql, + config: [ + $foo, + $bar, + $foobar, + $somewhatLongParameter, + $somewhatLongParameterX, + $somewhatLongParameterXYZ, + ], +); + +$app->get( + "/hello/{name}", + callback: function ($name) use ($app) { + return "Hello " . $app->escape($name); + }, +); + +$this->something->method( + $argument, + val: $this->more->stuff($this->even->more->things->complicatedMethod()), +); + +================================================================================ +`; diff --git a/tests/namedarguments/jsfmt.spec.mjs b/tests/namedarguments/jsfmt.spec.mjs new file mode 100644 index 000000000..d22c24d29 --- /dev/null +++ b/tests/namedarguments/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"], { phpVersion: "8.0" }); diff --git a/tests/namedarguments/namedarguments.php b/tests/namedarguments/namedarguments.php new file mode 100644 index 000000000..743e6824d --- /dev/null +++ b/tests/namedarguments/namedarguments.php @@ -0,0 +1,24 @@ + bar (arg1: $arg1, arg2: $arg2,$arg3, $arg4 , $arg5 ) ; +Foo :: bar( arg1:$arg1,arg2:$arg2 ,$arg3, $arg4 , $arg5 ) ; + +$db->Execute($sql, config: [ + $foo, + $bar, + $foobar, + $somewhatLongParameter, + $somewhatLongParameterX, + $somewhatLongParameterXYZ +]); + +$app->get('/hello/{name}', callback: function ($name) use ($app) { + return 'Hello ' . $app->escape($name); +}); + +$this->something->method($argument, val: $this->more->stuff( + $this->even->more->things->complicatedMethod() +)); diff --git a/tests/namespace/__snapshots__/jsfmt.spec.js.snap b/tests/namespace/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 7fbb5108e..000000000 --- a/tests/namespace/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,57 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`namespace.php 1`] = ` -veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); -$class = (new Foo(['VeryVeryVeryVeryVeryVeryVeryVeryVeryLongKey' => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue']))->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); -$class = (new PendingDispatch(new $this->class(...func_get_args())))->chain($this->chain); -$dumper = in_array(PHP_SAPI, ['cli', 'phpdbg']) ? new CliDumper : new HtmlDumper; -$class = new static('Error encoding model ['.get_class($model).'] with ID ['.$model->getKey().'] to JSON: '.$message); -$response = new \\Illuminate\\Http\\JsonResponse(new JsonResponseTestJsonSerializeObject); -$result = (new Pipeline(new \\Illuminate\\Container\\Container)) - ->send('foo') - ->through([new PipelineTestPipeOne]) - ->then(function ($piped) { - return $piped; - }); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); -$class = (new Foo([ - 'VeryVeryVeryVeryVeryVeryVeryVeryVeryLongKey' => - 'VeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue' -]))->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); -$class = (new PendingDispatch(new $this->class(...func_get_args())))->chain( - $this->chain -); -$dumper = in_array(PHP_SAPI, ['cli', 'phpdbg']) - ? new CliDumper() - : new HtmlDumper(); -$class = new static( - 'Error encoding model [' . - get_class($model) . - '] with ID [' . - $model->getKey() . - '] to JSON: ' . - $message -); -$response = new \\Illuminate\\Http\\JsonResponse( - new JsonResponseTestJsonSerializeObject() -); -$result = (new Pipeline(new \\Illuminate\\Container\\Container())) - ->send('foo') - ->through([new PipelineTestPipeOne()]) - ->then(function ($piped) { - return $piped; - }); - -`; diff --git a/tests/new/__snapshots__/jsfmt.spec.mjs.snap b/tests/new/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..177c147da --- /dev/null +++ b/tests/new/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,874 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`new.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); +$class = (new Foo(['VeryVeryVeryVeryVeryVeryVeryVeryVeryLongKey' => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue']))->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); +$class = (new PendingDispatch(new $this->class(...func_get_args())))->chain($this->chain); +$dumper = in_array(PHP_SAPI, ['cli', 'phpdbg']) ? new CliDumper : new HtmlDumper; +$class = new static('Error encoding model ['.get_class($model).'] with ID ['.$model->getKey().'] to JSON: '.$message); +$response = new \\Illuminate\\Http\\JsonResponse(new JsonResponseTestJsonSerializeObject); +$result = (new Pipeline(new \\Illuminate\\Container\\Container)) + ->send('foo') + ->through([new PipelineTestPipeOne]) + ->then(function ($piped) { + return $piped; + }); + +$var = new Foo( +<<<'EOD' +Example of string +spanning multiple lines +using nowdoc syntax. +EOD + , + $arg +); + +$var = new Foo( + $arg, + <<<'EOD' +Example of string +spanning multiple lines +using nowdoc syntax. +EOD +); + +$var = new Foo( + $arg, + <<<'EOD' +Example of string +spanning multiple lines +using nowdoc syntax. +EOD + , + $arg +); + +$var = new Foo( + <<num = $num; + } + + use SomeTrait; +}; + +$a = new (b('c')['d']); +$client = new (config('longstringvariable','longerstringvariable')(['name'=>$myLongClassname['name']])); + +=====================================output===================================== +veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); +$class = (new Foo([ + "VeryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => + "VeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue", +]))->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); +$class = (new PendingDispatch(new $this->class(...func_get_args())))->chain( + $this->chain, +); +$dumper = in_array(PHP_SAPI, ["cli", "phpdbg"]) + ? new CliDumper() + : new HtmlDumper(); +$class = new static( + "Error encoding model [" . + get_class($model) . + "] with ID [" . + $model->getKey() . + "] to JSON: " . + $message, +); +$response = new \\Illuminate\\Http\\JsonResponse( + new JsonResponseTestJsonSerializeObject(), +); +$result = (new Pipeline(new \\Illuminate\\Container\\Container())) + ->send("foo") + ->through([new PipelineTestPipeOne()]) + ->then(function ($piped) { + return $piped; + }); + +$var = new Foo( + <<<'EOD' + Example of string + spanning multiple lines + using nowdoc syntax. + EOD + , + $arg, +); + +$var = new Foo( + $arg, + <<<'EOD' + Example of string + spanning multiple lines + using nowdoc syntax. + EOD + , +); + +$var = new Foo( + $arg, + <<<'EOD' + Example of string + spanning multiple lines + using nowdoc syntax. + EOD + , + $arg, +); + +$var = new Foo( + <<num = $num; + } + + use SomeTrait; +}; + +$a = new (b("c")["d"])(); +$client = new (config("longstringvariable", "longerstringvariable")([ + "name" => $myLongClassname["name"], +]))(); + +================================================================================ +`; + +exports[`new.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); +$class = (new Foo(['VeryVeryVeryVeryVeryVeryVeryVeryVeryLongKey' => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue']))->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); +$class = (new PendingDispatch(new $this->class(...func_get_args())))->chain($this->chain); +$dumper = in_array(PHP_SAPI, ['cli', 'phpdbg']) ? new CliDumper : new HtmlDumper; +$class = new static('Error encoding model ['.get_class($model).'] with ID ['.$model->getKey().'] to JSON: '.$message); +$response = new \\Illuminate\\Http\\JsonResponse(new JsonResponseTestJsonSerializeObject); +$result = (new Pipeline(new \\Illuminate\\Container\\Container)) + ->send('foo') + ->through([new PipelineTestPipeOne]) + ->then(function ($piped) { + return $piped; + }); + +$var = new Foo( +<<<'EOD' +Example of string +spanning multiple lines +using nowdoc syntax. +EOD + , + $arg +); + +$var = new Foo( + $arg, + <<<'EOD' +Example of string +spanning multiple lines +using nowdoc syntax. +EOD +); + +$var = new Foo( + $arg, + <<<'EOD' +Example of string +spanning multiple lines +using nowdoc syntax. +EOD + , + $arg +); + +$var = new Foo( + <<num = $num; + } + + use SomeTrait; +}; + +$a = new (b('c')['d']); +$client = new (config('longstringvariable','longerstringvariable')(['name'=>$myLongClassname['name']])); + +=====================================output===================================== +veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); +$class = new Foo([ + "VeryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => + "VeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue", +])->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); +$class = new PendingDispatch(new $this->class(...func_get_args()))->chain( + $this->chain, +); +$dumper = in_array(PHP_SAPI, ["cli", "phpdbg"]) + ? new CliDumper() + : new HtmlDumper(); +$class = new static( + "Error encoding model [" . + get_class($model) . + "] with ID [" . + $model->getKey() . + "] to JSON: " . + $message, +); +$response = new \\Illuminate\\Http\\JsonResponse( + new JsonResponseTestJsonSerializeObject(), +); +$result = new Pipeline(new \\Illuminate\\Container\\Container()) + ->send("foo") + ->through([new PipelineTestPipeOne()]) + ->then(function ($piped) { + return $piped; + }); + +$var = new Foo( + <<<'EOD' + Example of string + spanning multiple lines + using nowdoc syntax. + EOD + , + $arg, +); + +$var = new Foo( + $arg, + <<<'EOD' + Example of string + spanning multiple lines + using nowdoc syntax. + EOD + , +); + +$var = new Foo( + $arg, + <<<'EOD' + Example of string + spanning multiple lines + using nowdoc syntax. + EOD + , + $arg, +); + +$var = new Foo( + <<num = $num; + } + + use SomeTrait; +}; + +$a = new (b("c")["d"])(); +$client = new (config("longstringvariable", "longerstringvariable")([ + "name" => $myLongClassname["name"], +]))(); + +================================================================================ +`; diff --git a/tests/new/jsfmt.spec.js b/tests/new/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/new/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/new/jsfmt.spec.mjs b/tests/new/jsfmt.spec.mjs new file mode 100644 index 000000000..0692003b1 --- /dev/null +++ b/tests/new/jsfmt.spec.mjs @@ -0,0 +1,2 @@ +run_spec(import.meta, ["php"], {phpVersion: "8.3"}); +run_spec(import.meta, ["php"]); diff --git a/tests/new/new.php b/tests/new/new.php index 35101bf37..a4a16e1f1 100644 --- a/tests/new/new.php +++ b/tests/new/new.php @@ -30,3 +30,163 @@ public static function create() ->then(function ($piped) { return $piped; }); + +$var = new Foo( +<<<'EOD' +Example of string +spanning multiple lines +using nowdoc syntax. +EOD + , + $arg +); + +$var = new Foo( + $arg, + <<<'EOD' +Example of string +spanning multiple lines +using nowdoc syntax. +EOD +); + +$var = new Foo( + $arg, + <<<'EOD' +Example of string +spanning multiple lines +using nowdoc syntax. +EOD + , + $arg +); + +$var = new Foo( + <<num = $num; + } + + use SomeTrait; +}; + +$a = new (b('c')['d']); +$client = new (config('longstringvariable','longerstringvariable')(['name'=>$myLongClassname['name']])); diff --git a/tests/newline/__snapshots__/jsfmt.spec.js.snap b/tests/newline/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index b3de72c0c..000000000 --- a/tests/newline/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,54 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`CRLF.php 1`] = ` - +$test = 1; + +class Foo +{ + /** + * Comment indented with tabs in file with utf-8[dos] + */ + private $foo; +} + +=====================================output===================================== + +$test = 1; + +class Foo +{ + /** + * Comment indented with tabs in file with utf-8[dos] + */ + private $foo; +} + +================================================================================ +`; + +exports[`CRLF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +$test = 1; + +class Foo +{ + /** + * Comment indented with tabs in file with utf-8[dos] + */ + private $foo; +} + +=====================================output===================================== + +$test = 1; + +class Foo +{ + /** + * Comment indented with tabs in file with utf-8[dos] + */ + private $foo; +} + +================================================================================ +`; + +exports[`CRLF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +$test = 1; + +class Foo +{ + /** + * Comment indented with tabs in file with utf-8[dos] + */ + private $foo; +} + +=====================================output===================================== + +$test = 1; + +class Foo +{ + /** + * Comment indented with tabs in file with utf-8[dos] + */ + private $foo; +} + +================================================================================ +`; + +exports[`LF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +$test = 1; + +=====================================output===================================== + +$test = 1; + +================================================================================ +`; + +exports[`LF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +$test = 1; + +=====================================output===================================== + +$test = 1; + +================================================================================ +`; + +exports[`LF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +$test = 1; + +=====================================output===================================== + +$test = 1; + +================================================================================ +`; + +exports[`comment-block-CRLF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +/** + * See http://example.com + * + * Some example code + * \`\`\`php + * $hello = 'world'; // This is a comment in a comment + * \`\`\` + */ + +$a = 1; + +=====================================output===================================== + + +/** + * See http://example.com + * + * Some example code + * \`\`\`php + * $hello = 'world'; // This is a comment in a comment + * \`\`\` + */ + +$a = 1; + +================================================================================ +`; + +exports[`comment-block-CRLF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +/** + * See http://example.com + * + * Some example code + * \`\`\`php + * $hello = 'world'; // This is a comment in a comment + * \`\`\` + */ + +$a = 1; + +=====================================output===================================== + + +/** + * See http://example.com + * + * Some example code + * \`\`\`php + * $hello = 'world'; // This is a comment in a comment + * \`\`\` + */ + +$a = 1; + +================================================================================ +`; + +exports[`comment-block-CRLF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +/** + * See http://example.com + * + * Some example code + * \`\`\`php + * $hello = 'world'; // This is a comment in a comment + * \`\`\` + */ + +$a = 1; + +=====================================output===================================== + + +/** + * See http://example.com + * + * Some example code + * \`\`\`php + * $hello = 'world'; // This is a comment in a comment + * \`\`\` + */ + +$a = 1; + +================================================================================ +`; + +exports[`comment-block-LF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +/** + * See http://example.com + * + * Some example code + * \`\`\`php + * $hello = 'world'; // This is a comment in a comment + * \`\`\` + */ + +$a = 1; + +=====================================output===================================== + + +/** + * See http://example.com + * + * Some example code + * \`\`\`php + * $hello = 'world'; // This is a comment in a comment + * \`\`\` + */ + +$a = 1; + +================================================================================ +`; + +exports[`comment-block-LF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +/** + * See http://example.com + * + * Some example code + * \`\`\`php + * $hello = 'world'; // This is a comment in a comment + * \`\`\` + */ + +$a = 1; + +=====================================output===================================== + + +/** + * See http://example.com + * + * Some example code + * \`\`\`php + * $hello = 'world'; // This is a comment in a comment + * \`\`\` + */ + +$a = 1; + +================================================================================ +`; + +exports[`comment-block-LF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +/** + * See http://example.com + * + * Some example code + * \`\`\`php + * $hello = 'world'; // This is a comment in a comment + * \`\`\` + */ + +$a = 1; + +=====================================output===================================== + + +/** + * See http://example.com + * + * Some example code + * \`\`\`php + * $hello = 'world'; // This is a comment in a comment + * \`\`\` + */ + +$a = 1; + +================================================================================ +`; + +exports[`file-terminated-with-multiple-LF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +$test = 1; + + + +=====================================output===================================== + +$test = 1; + +================================================================================ +`; + +exports[`file-terminated-with-multiple-LF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +$test = 1; + + + +=====================================output===================================== + +$test = 1; + +================================================================================ +`; + +exports[`file-terminated-with-multiple-LF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +$test = 1; + + + +=====================================output===================================== + +$test = 1; + +================================================================================ +`; + +exports[`file-terminated-without-line-ending.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +$test = 1; +=====================================output===================================== + +$test = 1; + +================================================================================ +`; + +exports[`file-terminated-without-line-ending.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +$test = 1; +=====================================output===================================== + +$test = 1; + +================================================================================ +`; + +exports[`file-terminated-without-line-ending.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +$test = 1; +=====================================output===================================== + +$test = 1; + +================================================================================ +`; + +exports[`html-CRLF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + + + . + + + + + + + + +=====================================output===================================== + + + + + + . + + + + + + + + +================================================================================ +`; + +exports[`html-CRLF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + + + . + + + + + + + + +=====================================output===================================== + + + + + + . + + + + + + + + +================================================================================ +`; + +exports[`html-CRLF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + + + . + + + + + + + + +=====================================output===================================== + + + + + + . + + + + + + + + +================================================================================ +`; + +exports[`html-LF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + + + . + + + + + + + + +=====================================output===================================== + + + + + + . + + + + + + + + +================================================================================ +`; + +exports[`html-LF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + + + . + + + + + + + + +=====================================output===================================== + + + + + + . + + + + + + + + +================================================================================ +`; + +exports[`html-LF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + + + . + + + + + + + + +=====================================output===================================== + + + + + + . + + + + + + + + +================================================================================ +`; + +exports[`mixed-CRLF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +Text + + +Test + +=====================================output===================================== +Text + + +Test + +================================================================================ +`; + +exports[`mixed-CRLF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +Text + + +Test + +=====================================output===================================== +Text + + +Test + +================================================================================ +`; + +exports[`mixed-CRLF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +Text + + +Test + +=====================================output===================================== +Text + + +Test + +================================================================================ +`; + +exports[`mixed-LF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +Text + + +Test + +=====================================output===================================== +Text + + +Test + +================================================================================ +`; + +exports[`mixed-LF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +Text + + +Test + +=====================================output===================================== +Text + + +Test + +================================================================================ +`; + +exports[`mixed-LF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +Text + + +Test + +=====================================output===================================== +Text + + +Test + +================================================================================ +`; diff --git a/tests/newline/comment-block-CRLF.php b/tests/newline/comment-block-CRLF.php new file mode 100644 index 000000000..5c91630e4 --- /dev/null +++ b/tests/newline/comment-block-CRLF.php @@ -0,0 +1,12 @@ + + + + + + . + + + + + + + diff --git a/tests/newline/html-LF.php b/tests/newline/html-LF.php new file mode 100644 index 000000000..547ee1902 --- /dev/null +++ b/tests/newline/html-LF.php @@ -0,0 +1,13 @@ + + + + + + . + + + + + + + diff --git a/tests/newline/jsfmt.spec.js b/tests/newline/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/newline/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/newline/jsfmt.spec.mjs b/tests/newline/jsfmt.spec.mjs new file mode 100644 index 000000000..4096c5dc5 --- /dev/null +++ b/tests/newline/jsfmt.spec.mjs @@ -0,0 +1,3 @@ +run_spec(import.meta, ["php"], { endOfLine: "cr" }); +run_spec(import.meta, ["php"], { endOfLine: "crlf" }); +run_spec(import.meta, ["php"], { endOfLine: "lf" }); diff --git a/tests/newline/mixed-CRLF.php b/tests/newline/mixed-CRLF.php new file mode 100644 index 000000000..80d4222a8 --- /dev/null +++ b/tests/newline/mixed-CRLF.php @@ -0,0 +1,4 @@ +Text + + +Test diff --git a/tests/newline/mixed-LF.php b/tests/newline/mixed-LF.php new file mode 100644 index 000000000..80d4222a8 --- /dev/null +++ b/tests/newline/mixed-LF.php @@ -0,0 +1,4 @@ +Text + + +Test diff --git a/tests/nowdoc/__snapshots__/jsfmt.spec.js.snap b/tests/nowdoc/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index ff31e83d1..000000000 --- a/tests/nowdoc/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,78 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`nowdoc.php 1`] = ` -foo. -Now, I am printing some {$foo->bar[1]}. -This should not print a capital 'A': \\x41 -EOT; - -$str = <<<'EOL' -"test" foo 'test' -EOL; - -$str = array(<<<'EOF' -foo -EOF -, "bar" -); - -$str = sprintf(<<<'EOF' -foo -EOF -); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -foo. -Now, I am printing some {$foo->bar[1]}. -This should not print a capital 'A': \\x41 -EOT; - -$str = <<<'EOL' -"test" foo 'test' -EOL; - -$str = array(<<<'EOF' -foo -EOF -, "bar"); - -$str = sprintf( - <<<'EOF' -foo -EOF -); - -`; - -exports[`single.php 1`] = ` -foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT; + +$str = <<<'EOL' +"test" foo 'test' +EOL; + +$str = array(<<<'EOF' +foo +EOF +, "bar" +); + +$str = array( + "bar", + <<<'EOF' +foo +EOF +); + +$str = sprintf(<<<'EOF' +foo +EOF +); + +$str = sprintf(<<<'EOF' +foo +EOF +, true); + +$str = sprintf(<< <<<'EOD' +string +string +string +EOD +]; + +$a = [ + 'key' => <<<'EOD' +string +string +string +EOD + , +]; + +$a = [ + 'other-key' => $a, + 'key' => <<<'EOD' +string +string +string +EOD +]; + +$a = [ + 'key' => <<<'EOD' +string +string +string +EOD + , + 'other-key' => $a +]; + +switch ($i) { + case <<<'TXT' +string +TXT + : + print <<<'TXT' +string +TXT; + break; + + case <<<'TXT' +other +TXT + : + break; + default: + print <<<'TXT' +string +TXT; +} + +$var->call( + <<<'TXT' +string +TXT +); + +$var->call( + $var, + <<<'TXT' +string +TXT +); + +$var->call( + <<<'TXT' +string +TXT + , + $var +); + +$var->call( + $var, + <<<'TXT' +string +TXT + , + $var +); + +$var = <<<'TXT' +string +TXT + ? <<<'TXT' +string +TXT + : <<<'TXT' +string +TXT; + +if ( +<<<'EOD' +string +string +string +EOD +) { + echo 'test'; +} + +do { +} while ( + <<<'EOD' +string +string +string +EOD +); + +while ( +<<<'EOD' +string +string +string +EOD +) {}; + +switch ( +<<<'EOD' +string +string +string +EOD +) {} + +function generator() +{ + yield <<<'EOD' +string +string +string +EOD; + yield $id => <<<'EOD' +string +string +string +EOD; +} + +$var = $var ?: <<<'EOD' +string +string +string +EOD; + +$var = $var ?: $var ?: $var ?: $var ?: $var ?: <<<'EOD' +string +string +string +EOD; + +call( + call( + <<<'EOD' +string +string +string +EOD + ) +); + +call( + $var->call( + <<<'EOD' +string +string +string +EOD + ) +); + +call( + Foo::call( + <<<'EOD' +string +string +string +EOD + ) +); + +for ( + $i = <<<'EOD' +string +string +string +EOD; + $i < 10; + $i++ +) {} + +for ( +print <<<'EOD' +string +string +string +EOD; + $i < 10; + $i++ +) {} + +for ( + $i = 0, +print <<<'EOD' +string +string +string +EOD; + $i < 10; + $i++ +) {} + +for ( +print <<<'EOD' +string +string +string +EOD +, + $i = 0; + $i < 10; + $i++ +) {} + +for ( + $i = 0; +print <<<'EOD' +string +string +string +EOD; + $i++ +) {} + +for ( + $i = 0; + $i < 10, +print <<<'EOD' +string +string +string +EOD; + $i++ +) {} + +for ( + $i = 0; +print <<<'EOD' +string +string +string +EOD +, + $i < 10; + $i++ +) {} + +for ( + $i = 0; + $i < 10; +print <<<'EOD' +string +string +string +EOD +) {} + +for ( + $i = 0; + $i < 10; +print <<<'EOD' +string +string +string +EOD +, + $i++ +) {} + +for ( + $i = 0; + $i < 10; + $i++, +print <<<'EOD' +string +string +string +EOD +) {} + +for ( +print <<<'EOD' +string +string +string +EOD; +print <<<'EOD' +string +string +string +EOD; +print <<<'EOD' +string +string +string +EOD +) {} + +call( + <<<'TXT' +string +TXT +); + +call( + $var, + <<<'TXT' +string +TXT +); + +call( + <<<'TXT' +string +TXT + , + $var +); + +call( + $var, + <<<'TXT' +string +TXT + , + $var +); + +call( + $var . + <<<'TXT' +string +TXT + , + $var +); + +call( + <<<'TXT' +string +TXT + . + $var + , + $var +); + +call( + <<<'TXT' +string +TXT + . + $var . + $var . + $var . + $var, + $var +); + +call( + $var . + $var . + <<<'TXT' +string +TXT + . + $var . + $var, + $var +); + +call( + $var . + $var . + $var . + $var . + <<<'TXT' +string +TXT + , + $var +); + +call( + $var ? <<<'EOD' +string +string +string +EOD + : <<<'EOD' +string +string +string +EOD +); + +call( + $var, + $var ? <<<'EOD' +string +string +string +EOD + : <<<'EOD' +string +string +string +EOD +); + +call( + $var ? <<<'EOD' +string +string +string +EOD + : <<<'EOD' +string +string +string +EOD + , + $var +); + +call( + $var, + $var ? <<<'EOD' +string +string +string +EOD + : <<<'EOD' +string +string +string +EOD + , $var +); + +$array = [ + <<<'EOD' +string +string +string +EOD + => <<<'EOD' +string +string +string +EOD +]; + +$php73FlexibleNowdoc = <<<'EOD' + $a + b + c + EOD; + +$php73FlexibleNowdoc2 = <<<'EOD' + $a + b + c + EOD; + +[ + $var ? "foo" : <<<'EOD' +string +EOD + , "bar" +]; + +[ + $var ? "foo" : $var2 ? "bar" : <<<'EOD' +string +EOD + , "bar" +]; + +[ + $var ?? <<<'EOD' +string +EOD + , "bar" +]; + +[ + $a ?? $b ?? <<<'EOD' +string +EOD + , "bar" +]; +=====================================output===================================== +foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT; + +$str = <<<'EOL' +"test" foo 'test' +EOL; + +$str = [ + <<<'EOF' +foo +EOF + , + "bar", +]; + +$str = [ + "bar", + <<<'EOF' +foo +EOF +, +]; + +$str = sprintf( + <<<'EOF' +foo +EOF +); + +$str = sprintf( + <<<'EOF' +foo +EOF + , + true +); + +$str = sprintf( + << <<<'EOD' +string +string +string +EOD +, +]; + +$a = [ + "key" => <<<'EOD' +string +string +string +EOD +, +]; + +$a = [ + "other-key" => $a, + "key" => <<<'EOD' +string +string +string +EOD +, +]; + +$a = [ + "key" => <<<'EOD' +string +string +string +EOD + , + "other-key" => $a, +]; + +switch ($i) { + case <<<'TXT' +string +TXT + : + print <<<'TXT' +string +TXT; + break; + + case <<<'TXT' +other +TXT + : + break; + default: + print <<<'TXT' +string +TXT; +} + +$var->call( + <<<'TXT' +string +TXT +); + +$var->call( + $var, + <<<'TXT' +string +TXT +); + +$var->call( + <<<'TXT' +string +TXT + , + $var +); + +$var->call( + $var, + <<<'TXT' +string +TXT + , + $var +); + +$var = <<<'TXT' +string +TXT + ? <<<'TXT' +string +TXT + : <<<'TXT' +string +TXT; + +if ( + <<<'EOD' +string +string +string +EOD +) { + echo "test"; +} + +do { +} while ( + <<<'EOD' +string +string +string +EOD +); + +while ( + <<<'EOD' +string +string +string +EOD +) { +} + +switch ( + <<<'EOD' +string +string +string +EOD +) { +} + +function generator() +{ + yield <<<'EOD' +string +string +string +EOD; + yield $id => <<<'EOD' +string +string +string +EOD; +} + +$var = + $var ?: + <<<'EOD' +string +string +string +EOD; + +$var = + $var ?: + $var ?: + $var ?: + $var ?: + $var ?: + <<<'EOD' +string +string +string +EOD; + +call( + call( + <<<'EOD' +string +string +string +EOD + ) +); + +call( + $var->call( + <<<'EOD' +string +string +string +EOD + ) +); + +call( + Foo::call( + <<<'EOD' +string +string +string +EOD + ) +); + +for ( + $i = <<<'EOD' +string +string +string +EOD; + $i < 10; + $i++ +) { +} + +for ( + print <<<'EOD' +string +string +string +EOD; + $i < 10; + $i++ +) { +} + +for ( + $i = 0, + print <<<'EOD' +string +string +string +EOD; + $i < 10; + $i++ +) { +} + +for ( + print <<<'EOD' +string +string +string +EOD + , + $i = 0; + $i < 10; + $i++ +) { +} + +for ( + $i = 0; + print <<<'EOD' +string +string +string +EOD; + $i++ +) { +} + +for ( + $i = 0; + $i < 10, + print <<<'EOD' +string +string +string +EOD; + $i++ +) { +} + +for ( + $i = 0; + print <<<'EOD' +string +string +string +EOD + , + $i < 10; + $i++ +) { +} + +for ( + $i = 0; + $i < 10; + print <<<'EOD' +string +string +string +EOD +) { +} + +for ( + $i = 0; + $i < 10; + print <<<'EOD' +string +string +string +EOD + , + $i++ +) { +} + +for ( + $i = 0; + $i < 10; + $i++, + print <<<'EOD' +string +string +string +EOD +) { +} + +for ( + print <<<'EOD' +string +string +string +EOD; + print <<<'EOD' +string +string +string +EOD; + print <<<'EOD' +string +string +string +EOD +) { +} + +call( + <<<'TXT' +string +TXT +); + +call( + $var, + <<<'TXT' +string +TXT +); + +call( + <<<'TXT' +string +TXT + , + $var +); + +call( + $var, + <<<'TXT' +string +TXT + , + $var +); + +call( + $var . + <<<'TXT' +string +TXT + , + $var +); + +call( + <<<'TXT' +string +TXT + . $var, + $var +); + +call( + <<<'TXT' +string +TXT + . + $var . + $var . + $var . + $var, + $var +); + +call( + $var . + $var . + <<<'TXT' +string +TXT + . + $var . + $var, + $var +); + +call( + $var . + $var . + $var . + $var . + <<<'TXT' +string +TXT + , + $var +); + +call( + $var + ? <<<'EOD' +string +string +string +EOD + : <<<'EOD' +string +string +string +EOD +); + +call( + $var, + $var + ? <<<'EOD' +string +string +string +EOD + : <<<'EOD' +string +string +string +EOD +); + +call( + $var + ? <<<'EOD' +string +string +string +EOD + + : <<<'EOD' +string +string +string +EOD + , + $var +); + +call( + $var, + $var + ? <<<'EOD' +string +string +string +EOD + + : <<<'EOD' +string +string +string +EOD + , + $var +); + +$array = [ + <<<'EOD' +string +string +string +EOD + => <<<'EOD' +string +string +string +EOD +, +]; + +$php73FlexibleNowdoc = <<<'EOD' + $a + b +c +EOD; + +$php73FlexibleNowdoc2 = <<<'EOD' + $a + b + c +EOD; + +[ + $var + ? "foo" + : <<<'EOD' +string +EOD + , + "bar", +]; + +[ + ($var + ? "foo" + : $var2) + ? "bar" + : <<<'EOD' +string +EOD + , + "bar", +]; + +[ + $var ?? + <<<'EOD' +string +EOD + , + "bar", +]; + +[ + $a ?? + ($b ?? + <<<'EOD' +string +EOD + ), + "bar", +]; + +================================================================================ +`; + +exports[`nowdoc.php 2`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "7.3" +printWidth: 80 + | printWidth +=====================================input====================================== +foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT; + +$str = <<<'EOL' +"test" foo 'test' +EOL; + +$str = array(<<<'EOF' +foo +EOF +, "bar" +); + +$str = array( + "bar", + <<<'EOF' +foo +EOF +); + +$str = sprintf(<<<'EOF' +foo +EOF +); + +$str = sprintf(<<<'EOF' +foo +EOF +, true); + +$str = sprintf(<< <<<'EOD' +string +string +string +EOD +]; + +$a = [ + 'key' => <<<'EOD' +string +string +string +EOD + , +]; + +$a = [ + 'other-key' => $a, + 'key' => <<<'EOD' +string +string +string +EOD +]; + +$a = [ + 'key' => <<<'EOD' +string +string +string +EOD + , + 'other-key' => $a +]; + +switch ($i) { + case <<<'TXT' +string +TXT + : + print <<<'TXT' +string +TXT; + break; + + case <<<'TXT' +other +TXT + : + break; + default: + print <<<'TXT' +string +TXT; +} + +$var->call( + <<<'TXT' +string +TXT +); + +$var->call( + $var, + <<<'TXT' +string +TXT +); + +$var->call( + <<<'TXT' +string +TXT + , + $var +); + +$var->call( + $var, + <<<'TXT' +string +TXT + , + $var +); + +$var = <<<'TXT' +string +TXT + ? <<<'TXT' +string +TXT + : <<<'TXT' +string +TXT; + +if ( +<<<'EOD' +string +string +string +EOD +) { + echo 'test'; +} + +do { +} while ( + <<<'EOD' +string +string +string +EOD +); + +while ( +<<<'EOD' +string +string +string +EOD +) {}; + +switch ( +<<<'EOD' +string +string +string +EOD +) {} + +function generator() +{ + yield <<<'EOD' +string +string +string +EOD; + yield $id => <<<'EOD' +string +string +string +EOD; +} + +$var = $var ?: <<<'EOD' +string +string +string +EOD; + +$var = $var ?: $var ?: $var ?: $var ?: $var ?: <<<'EOD' +string +string +string +EOD; + +call( + call( + <<<'EOD' +string +string +string +EOD + ) +); + +call( + $var->call( + <<<'EOD' +string +string +string +EOD + ) +); + +call( + Foo::call( + <<<'EOD' +string +string +string +EOD + ) +); + +for ( + $i = <<<'EOD' +string +string +string +EOD; + $i < 10; + $i++ +) {} + +for ( +print <<<'EOD' +string +string +string +EOD; + $i < 10; + $i++ +) {} + +for ( + $i = 0, +print <<<'EOD' +string +string +string +EOD; + $i < 10; + $i++ +) {} + +for ( +print <<<'EOD' +string +string +string +EOD +, + $i = 0; + $i < 10; + $i++ +) {} + +for ( + $i = 0; +print <<<'EOD' +string +string +string +EOD; + $i++ +) {} + +for ( + $i = 0; + $i < 10, +print <<<'EOD' +string +string +string +EOD; + $i++ +) {} + +for ( + $i = 0; +print <<<'EOD' +string +string +string +EOD +, + $i < 10; + $i++ +) {} + +for ( + $i = 0; + $i < 10; +print <<<'EOD' +string +string +string +EOD +) {} + +for ( + $i = 0; + $i < 10; +print <<<'EOD' +string +string +string +EOD +, + $i++ +) {} + +for ( + $i = 0; + $i < 10; + $i++, +print <<<'EOD' +string +string +string +EOD +) {} + +for ( +print <<<'EOD' +string +string +string +EOD; +print <<<'EOD' +string +string +string +EOD; +print <<<'EOD' +string +string +string +EOD +) {} + +call( + <<<'TXT' +string +TXT +); + +call( + $var, + <<<'TXT' +string +TXT +); + +call( + <<<'TXT' +string +TXT + , + $var +); + +call( + $var, + <<<'TXT' +string +TXT + , + $var +); + +call( + $var . + <<<'TXT' +string +TXT + , + $var +); + +call( + <<<'TXT' +string +TXT + . + $var + , + $var +); + +call( + <<<'TXT' +string +TXT + . + $var . + $var . + $var . + $var, + $var +); + +call( + $var . + $var . + <<<'TXT' +string +TXT + . + $var . + $var, + $var +); + +call( + $var . + $var . + $var . + $var . + <<<'TXT' +string +TXT + , + $var +); + +call( + $var ? <<<'EOD' +string +string +string +EOD + : <<<'EOD' +string +string +string +EOD +); + +call( + $var, + $var ? <<<'EOD' +string +string +string +EOD + : <<<'EOD' +string +string +string +EOD +); + +call( + $var ? <<<'EOD' +string +string +string +EOD + : <<<'EOD' +string +string +string +EOD + , + $var +); + +call( + $var, + $var ? <<<'EOD' +string +string +string +EOD + : <<<'EOD' +string +string +string +EOD + , $var +); + +$array = [ + <<<'EOD' +string +string +string +EOD + => <<<'EOD' +string +string +string +EOD +]; + +$php73FlexibleNowdoc = <<<'EOD' + $a + b + c + EOD; + +$php73FlexibleNowdoc2 = <<<'EOD' + $a + b + c + EOD; + +[ + $var ? "foo" : <<<'EOD' +string +EOD + , "bar" +]; + +[ + $var ? "foo" : $var2 ? "bar" : <<<'EOD' +string +EOD + , "bar" +]; + +[ + $var ?? <<<'EOD' +string +EOD + , "bar" +]; + +[ + $a ?? $b ?? <<<'EOD' +string +EOD + , "bar" +]; +=====================================output===================================== +foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT; + +$str = <<<'EOL' +"test" foo 'test' +EOL; + +$str = [ + <<<'EOF' + foo + EOF + , + "bar", +]; + +$str = [ + "bar", + <<<'EOF' + foo + EOF +, +]; + +$str = sprintf( + <<<'EOF' + foo + EOF + , +); + +$str = sprintf( + <<<'EOF' + foo + EOF + , + true, +); + +$str = sprintf( + << <<<'EOD' + string + string + string + EOD +, +]; + +$a = [ + "key" => <<<'EOD' + string + string + string + EOD +, +]; + +$a = [ + "other-key" => $a, + "key" => <<<'EOD' + string + string + string + EOD +, +]; + +$a = [ + "key" => <<<'EOD' + string + string + string + EOD + , + "other-key" => $a, +]; + +switch ($i) { + case <<<'TXT' + string + TXT + : + print <<<'TXT' + string + TXT; + break; + + case <<<'TXT' + other + TXT + : + break; + default: + print <<<'TXT' + string + TXT; +} + +$var->call( + <<<'TXT' + string + TXT + , +); + +$var->call( + $var, + <<<'TXT' + string + TXT + , +); + +$var->call( + <<<'TXT' + string + TXT + , + $var, +); + +$var->call( + $var, + <<<'TXT' + string + TXT + , + $var, +); + +$var = <<<'TXT' +string +TXT + ? <<<'TXT' + string + TXT + : <<<'TXT' + string + TXT; + +if ( + <<<'EOD' + string + string + string + EOD +) { + echo "test"; +} + +do { +} while ( + <<<'EOD' + string + string + string + EOD +); + +while ( + <<<'EOD' + string + string + string + EOD +) { +} + +switch ( + <<<'EOD' + string + string + string + EOD +) { +} + +function generator() +{ + yield <<<'EOD' + string + string + string + EOD; + yield $id => <<<'EOD' + string + string + string + EOD; +} + +$var = + $var ?: + <<<'EOD' + string + string + string + EOD; + +$var = + $var ?: + $var ?: + $var ?: + $var ?: + $var ?: + <<<'EOD' + string + string + string + EOD; + +call( + call( + <<<'EOD' + string + string + string + EOD + , + ), +); + +call( + $var->call( + <<<'EOD' + string + string + string + EOD + , + ), +); + +call( + Foo::call( + <<<'EOD' + string + string + string + EOD + , + ), +); + +for ( + $i = <<<'EOD' + string + string + string + EOD; + $i < 10; + $i++ +) { +} + +for ( + print <<<'EOD' + string + string + string + EOD; + $i < 10; + $i++ +) { +} + +for ( + $i = 0, + print <<<'EOD' + string + string + string + EOD; + $i < 10; + $i++ +) { +} + +for ( + print <<<'EOD' + string + string + string + EOD + , + $i = 0; + $i < 10; + $i++ +) { +} + +for ( + $i = 0; + print <<<'EOD' + string + string + string + EOD; + $i++ +) { +} + +for ( + $i = 0; + $i < 10, + print <<<'EOD' + string + string + string + EOD; + $i++ +) { +} + +for ( + $i = 0; + print <<<'EOD' + string + string + string + EOD + , + $i < 10; + $i++ +) { +} + +for ( + $i = 0; + $i < 10; + print <<<'EOD' + string + string + string + EOD +) { +} + +for ( + $i = 0; + $i < 10; + print <<<'EOD' + string + string + string + EOD + , + $i++ +) { +} + +for ( + $i = 0; + $i < 10; + $i++, + print <<<'EOD' + string + string + string + EOD +) { +} + +for ( + print <<<'EOD' + string + string + string + EOD; + print <<<'EOD' + string + string + string + EOD; + print <<<'EOD' + string + string + string + EOD +) { +} + +call( + <<<'TXT' + string + TXT + , +); + +call( + $var, + <<<'TXT' + string + TXT + , +); + +call( + <<<'TXT' + string + TXT + , + $var, +); + +call( + $var, + <<<'TXT' + string + TXT + , + $var, +); + +call( + $var . + <<<'TXT' + string + TXT + , + $var, +); + +call( + <<<'TXT' + string + TXT + . $var, + $var, +); + +call( + <<<'TXT' + string + TXT + . + $var . + $var . + $var . + $var, + $var, +); + +call( + $var . + $var . + <<<'TXT' + string + TXT + . + $var . + $var, + $var, +); + +call( + $var . + $var . + $var . + $var . + <<<'TXT' + string + TXT + , + $var, +); + +call( + $var + ? <<<'EOD' + string + string + string + EOD + : <<<'EOD' + string + string + string + EOD, +); + +call( + $var, + $var + ? <<<'EOD' + string + string + string + EOD + : <<<'EOD' + string + string + string + EOD, +); + +call( + $var + ? <<<'EOD' + string + string + string + EOD + + : <<<'EOD' + string + string + string + EOD + , + $var, +); + +call( + $var, + $var + ? <<<'EOD' + string + string + string + EOD + + : <<<'EOD' + string + string + string + EOD + , + $var, +); + +$array = [ + <<<'EOD' + string + string + string + EOD + => <<<'EOD' + string + string + string + EOD +, +]; + +$php73FlexibleNowdoc = <<<'EOD' + $a + b +c +EOD; + +$php73FlexibleNowdoc2 = <<<'EOD' + $a + b + c +EOD; + +[ + $var + ? "foo" + : <<<'EOD' + string + EOD + , + "bar", +]; + +[ + ($var + ? "foo" + : $var2) + ? "bar" + : <<<'EOD' + string + EOD + , + "bar", +]; + +[ + $var ?? + <<<'EOD' + string + EOD + , + "bar", +]; + +[ + $a ?? + ($b ?? + <<<'EOD' + string + EOD + ), + "bar", +]; + +================================================================================ +`; + +exports[`single.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "7.0" +printWidth: 80 + | printWidth +=====================================input====================================== + <<<'EOD' +string +string +string +EOD +]; + +$a = [ + 'key' => <<<'EOD' +string +string +string +EOD + , +]; + +$a = [ + 'other-key' => $a, + 'key' => <<<'EOD' +string +string +string +EOD +]; + +$a = [ + 'key' => <<<'EOD' +string +string +string +EOD + , + 'other-key' => $a +]; + +switch ($i) { + case <<<'TXT' +string +TXT + : + print <<<'TXT' +string +TXT; + break; + + case <<<'TXT' +other +TXT + : + break; + default: + print <<<'TXT' +string +TXT; +} + +$var->call( + <<<'TXT' +string +TXT +); + +$var->call( + $var, + <<<'TXT' +string +TXT +); + +$var->call( + <<<'TXT' +string +TXT + , + $var +); + +$var->call( + $var, + <<<'TXT' +string +TXT + , + $var +); + +$var = <<<'TXT' +string +TXT + ? <<<'TXT' +string +TXT + : <<<'TXT' +string +TXT; + +if ( +<<<'EOD' +string +string +string +EOD +) { + echo 'test'; +} + +do { +} while ( + <<<'EOD' +string +string +string +EOD +); + +while ( +<<<'EOD' +string +string +string +EOD +) {}; + +switch ( +<<<'EOD' +string +string +string +EOD +) {} + +function generator() +{ + yield <<<'EOD' +string +string +string +EOD; + yield $id => <<<'EOD' +string +string +string +EOD; +} + +$var = $var ?: <<<'EOD' +string +string +string +EOD; + +$var = $var ?: $var ?: $var ?: $var ?: $var ?: <<<'EOD' +string +string +string +EOD; + +call( + call( + <<<'EOD' +string +string +string +EOD + ) +); + +call( + $var->call( + <<<'EOD' +string +string +string +EOD + ) +); + +call( + Foo::call( + <<<'EOD' +string +string +string +EOD + ) +); + +for ( + $i = <<<'EOD' +string +string +string +EOD; + $i < 10; + $i++ +) {} + +for ( +print <<<'EOD' +string +string +string +EOD; + $i < 10; + $i++ +) {} + +for ( + $i = 0, +print <<<'EOD' +string +string +string +EOD; + $i < 10; + $i++ +) {} + +for ( +print <<<'EOD' +string +string +string +EOD +, + $i = 0; + $i < 10; + $i++ +) {} + +for ( + $i = 0; +print <<<'EOD' +string +string +string +EOD; + $i++ +) {} + +for ( + $i = 0; + $i < 10, +print <<<'EOD' +string +string +string +EOD; + $i++ +) {} + +for ( + $i = 0; +print <<<'EOD' +string +string +string +EOD +, + $i < 10; + $i++ +) {} + +for ( + $i = 0; + $i < 10; +print <<<'EOD' +string +string +string +EOD +) {} + +for ( + $i = 0; + $i < 10; +print <<<'EOD' +string +string +string +EOD +, + $i++ +) {} + +for ( + $i = 0; + $i < 10; + $i++, +print <<<'EOD' +string +string +string +EOD +) {} + +for ( +print <<<'EOD' +string +string +string +EOD; +print <<<'EOD' +string +string +string +EOD; +print <<<'EOD' +string +string +string +EOD +) {} + +call( + <<<'TXT' +string +TXT +); + +call( + $var, + <<<'TXT' +string +TXT +); + +call( + <<<'TXT' +string +TXT + , + $var +); + +call( + $var, + <<<'TXT' +string +TXT + , + $var +); + +call( + $var . + <<<'TXT' +string +TXT + , + $var +); + +call( + <<<'TXT' +string +TXT + . + $var + , + $var +); + +call( + <<<'TXT' +string +TXT + . + $var . + $var . + $var . + $var, + $var +); + +call( + $var . + $var . + <<<'TXT' +string +TXT + . + $var . + $var, + $var +); + +call( + $var . + $var . + $var . + $var . + <<<'TXT' +string +TXT + , + $var +); + +call( + $var ? <<<'EOD' +string +string +string +EOD + : <<<'EOD' +string +string +string +EOD +); + +call( + $var, + $var ? <<<'EOD' +string +string +string +EOD + : <<<'EOD' +string +string +string +EOD +); + +call( + $var ? <<<'EOD' +string +string +string +EOD + : <<<'EOD' +string +string +string +EOD + , + $var +); + +call( + $var, + $var ? <<<'EOD' +string +string +string +EOD + : <<<'EOD' +string +string +string +EOD + , $var +); + +$array = [ + <<<'EOD' +string +string +string +EOD + => <<<'EOD' +string +string +string +EOD +]; + +$php73FlexibleNowdoc = <<<'EOD' + $a + b + c + EOD; + +$php73FlexibleNowdoc2 = <<<'EOD' + $a + b + c + EOD; + +[ + $var ? "foo" : <<<'EOD' +string +EOD + , "bar" +]; + +[ + $var ? "foo" : $var2 ? "bar" : <<<'EOD' +string +EOD + , "bar" +]; + +[ + $var ?? <<<'EOD' +string +EOD + , "bar" +]; + +[ + $a ?? $b ?? <<<'EOD' +string +EOD + , "bar" +]; \ No newline at end of file diff --git a/tests/nullsafepropertylookup/__snapshots__/jsfmt.spec.mjs.snap b/tests/nullsafepropertylookup/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..2d90ad71b --- /dev/null +++ b/tests/nullsafepropertylookup/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`offsets.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.0" +printWidth: 80 + | printWidth +=====================================input====================================== +foo; +// variable +$obj?->$var; +// variable variable +$obj?->$$var; +// literal with identifier +$obj?->{foo}; +// literal with variable +$obj?->{$var}; +// literal with call +$obj?->{call()}; +// encapsed (offset type) +$obj?->foo_{'test' . 'bar'}; +// variable with literal with call +$obj?->\${call()}; + +// long methods names chaining +// all nullsafe +$obj?->aaaaaaaaaaaaaaaaaaaaaaaa()?->ccccccccccccccccccccccccccccc()?->ccccccccccccccccccccc(); +// first nullsafe +$obj?->aaaaaaaaaaaaaaaaaaaaaaaa()->ccccccccccccccccccccccccccccc()->ccccccccccccccccccccc(); +// middle nullsafe +$obj->aaaaaaaaaaaaaaaaaaaaaaaa()?->ccccccccccccccccccccccccccccc()->ccccccccccccccccccccc(); +// last nullsafe +$obj->aaaaaaaaaaaaaaaaaaaaaaaa()->ccccccccccccccccccccccccccccc()?->ccccccccccccccccccccc(); + +=====================================output===================================== +foo; +// variable +$obj?->$var; +// variable variable +$obj?->$$var; +// literal with identifier +$obj?->{foo}; +// literal with variable +$obj?->{$var}; +// literal with call +$obj?->{call()}; +// encapsed (offset type) +$obj?->foo_["test" . "bar"]; +// variable with literal with call +$obj?->\${call()}; + +// long methods names chaining +// all nullsafe +$obj?->aaaaaaaaaaaaaaaaaaaaaaaa() + ?->ccccccccccccccccccccccccccccc() + ?->ccccccccccccccccccccc(); +// first nullsafe +$obj?->aaaaaaaaaaaaaaaaaaaaaaaa() + ->ccccccccccccccccccccccccccccc() + ->ccccccccccccccccccccc(); +// middle nullsafe +$obj->aaaaaaaaaaaaaaaaaaaaaaaa() + ?->ccccccccccccccccccccccccccccc() + ->ccccccccccccccccccccc(); +// last nullsafe +$obj->aaaaaaaaaaaaaaaaaaaaaaaa() + ->ccccccccccccccccccccccccccccc() + ?->ccccccccccccccccccccc(); + +================================================================================ +`; + +exports[`reserved-keyword.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.0" +printWidth: 80 + | printWidth +=====================================input====================================== +metaData?->abstract; + +// keyword: class +echo $record->learner->currentEnrollment?->class->grade->code; + + +=====================================output===================================== +metaData?->abstract; + +// keyword: class +echo $record->learner->currentEnrollment?->class->grade->code; + +================================================================================ +`; diff --git a/tests/nullsafepropertylookup/jsfmt.spec.mjs b/tests/nullsafepropertylookup/jsfmt.spec.mjs new file mode 100644 index 000000000..d22c24d29 --- /dev/null +++ b/tests/nullsafepropertylookup/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"], { phpVersion: "8.0" }); diff --git a/tests/nullsafepropertylookup/offsets.php b/tests/nullsafepropertylookup/offsets.php new file mode 100644 index 000000000..c56f9d646 --- /dev/null +++ b/tests/nullsafepropertylookup/offsets.php @@ -0,0 +1,28 @@ +foo; +// variable +$obj?->$var; +// variable variable +$obj?->$$var; +// literal with identifier +$obj?->{foo}; +// literal with variable +$obj?->{$var}; +// literal with call +$obj?->{call()}; +// encapsed (offset type) +$obj?->foo_{'test' . 'bar'}; +// variable with literal with call +$obj?->${call()}; + +// long methods names chaining +// all nullsafe +$obj?->aaaaaaaaaaaaaaaaaaaaaaaa()?->ccccccccccccccccccccccccccccc()?->ccccccccccccccccccccc(); +// first nullsafe +$obj?->aaaaaaaaaaaaaaaaaaaaaaaa()->ccccccccccccccccccccccccccccc()->ccccccccccccccccccccc(); +// middle nullsafe +$obj->aaaaaaaaaaaaaaaaaaaaaaaa()?->ccccccccccccccccccccccccccccc()->ccccccccccccccccccccc(); +// last nullsafe +$obj->aaaaaaaaaaaaaaaaaaaaaaaa()->ccccccccccccccccccccccccccccc()?->ccccccccccccccccccccc(); diff --git a/tests/nullsafepropertylookup/reserved-keyword.php b/tests/nullsafepropertylookup/reserved-keyword.php new file mode 100644 index 000000000..a12045b73 --- /dev/null +++ b/tests/nullsafepropertylookup/reserved-keyword.php @@ -0,0 +1,8 @@ +metaData?->abstract; + +// keyword: class +echo $record->learner->currentEnrollment?->class->grade->code; + diff --git a/tests/number/__snapshots__/jsfmt.spec.js.snap b/tests/number/__snapshots__/jsfmt.spec.mjs.snap similarity index 50% rename from tests/number/__snapshots__/jsfmt.spec.js.snap rename to tests/number/__snapshots__/jsfmt.spec.mjs.snap index 17548b60b..f044abc68 100644 --- a/tests/number/__snapshots__/jsfmt.spec.js.snap +++ b/tests/number/__snapshots__/jsfmt.spec.mjs.snap @@ -1,6 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`number.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== registered['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString']; -$variable = get_taxonomy_function(get_queried_object_function()->taxonomy)->object_type[0]; -$someArray[] = $this->something->long->that->not->makes->it->break->onto->two->break->lines(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -registered[ - 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' -]; -$variable = get_taxonomy_function( - get_queried_object_function()->taxonomy -)->object_type[0]; -$someArray[] = $this->something->long->that->not->makes->it->break->onto->two->break->lines(); - -`; - -exports[`single.php 1`] = ` -registered['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString']; +$variable = get_taxonomy_function(get_queried_object_function()->taxonomy)->object_type[0]; +$someArray[] = $this->something->long->that->not->makes->it->break->onto->two->break->lines(); +$variable = "abcdef"[-2]; + +$variable[1]; +$variable[11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111]; +$variable['string']; +$variable['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString']; +$variable['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString']['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString']; + +$var = $a{$b}; +$var = $a{$b}{$c}; +$var = $a[$b]{$c}; +$var = $a{$b}[$c]; + +=====================================output===================================== +registered[ + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + ]; +$variable = get_taxonomy_function(get_queried_object_function()->taxonomy) + ->object_type[0]; +$someArray[] = $this->something->long->that->not->makes->it->break->onto->two->break->lines(); +$variable = "abcdef"[-2]; + +$variable[1]; +$variable[11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111]; +$variable["string"]; +$variable[ + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" +]; +$variable[ + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" +][ + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" +]; + +$var = $a[$b]; +$var = $a[$b][$c]; +$var = $a[$b][$c]; +$var = $a[$b][$c]; + +================================================================================ +`; + +exports[`single.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +registered['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString']; $variable = get_taxonomy_function(get_queried_object_function()->taxonomy)->object_type[0]; $someArray[] = $this->something->long->that->not->makes->it->break->onto->two->break->lines(); +$variable = "abcdef"[-2]; + +$variable[1]; +$variable[11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111]; +$variable['string']; +$variable['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString']; +$variable['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString']['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString']; + +$var = $a{$b}; +$var = $a{$b}{$c}; +$var = $a[$b]{$c}; +$var = $a{$b}[$c]; diff --git a/tests/offsetlookup/single-multiple.php b/tests/offsetlookup/single-multiple.php new file mode 100644 index 000000000..33cb9a0ba --- /dev/null +++ b/tests/offsetlookup/single-multiple.php @@ -0,0 +1,3 @@ +> $b; -$a >>= $b; - -$a == $b; -$a === $b; -$a != $b; -$a <> $b; -$a !== $b; -$a < $b; -$a > $b; -$a <= $b; -$a >= $b; -$a <=> $b; - -$a and $b; -$a or $b; -$a xor $b; -!$a; -$a && $b; -$a || $b; - -$a . $b; -$a .= $b; - -$a instanceof stdClass; - -$output = \`ls -al\`; -$a = (bool) "test"; - -$b = &$a; - -$a ?? $b; - -$this->reallyLong->testPropertyName = 'a' . $someOtherTest . 'n' . $oneLastOneToMakeLineLong; - -'tesssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssst' . 'test'; - -$someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable; -$someReallyReallyReallyLongBooleanVariable . $someReallyReallyReallyLongBooleanVariable; -$someReallyReallyReallyLongBooleanVariable .= $someReallyReallyReallyLongBooleanVariable; -++$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName; ---$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName; -$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName++; -$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName--; -$someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable - $someReallyReallyReallyLongBooleanVariable; - -$value = isset($_POST['menu-item-dropdown']) && -isset($_POST['menu-item-dropdown'][$menuItemDbId]) - ? 'enabled' - : 'disabled'; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -> $b; -$a >>= $b; - -$a == $b; -$a === $b; -$a != $b; -$a != $b; -$a !== $b; -$a < $b; -$a > $b; -$a <= $b; -$a >= $b; -$a <=> $b; - -$a and $b; -$a or $b; -$a xor $b; -!$a; -$a && $b; -$a || $b; - -$a . $b; -$a .= $b; - -$a instanceof stdClass; - -$output = \`ls -al\`; -$a = (bool) "test"; - -$b = &$a; - -$a ?? $b; - -$this->reallyLong->testPropertyName = - 'a' . $someOtherTest . 'n' . $oneLastOneToMakeLineLong; - -'tesssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssst' . - 'test'; - -$someReallyReallyReallyLongBooleanVariable + - $someReallyReallyReallyLongBooleanVariable; -$someReallyReallyReallyLongBooleanVariable . - $someReallyReallyReallyLongBooleanVariable; -$someReallyReallyReallyLongBooleanVariable .= $someReallyReallyReallyLongBooleanVariable; -++$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName; ---$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName; -$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName++; -$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName--; -$someReallyReallyReallyLongBooleanVariable + - $someReallyReallyReallyLongBooleanVariable - - $someReallyReallyReallyLongBooleanVariable; - -$value = - isset($_POST['menu-item-dropdown']) && - isset($_POST['menu-item-dropdown'][$menuItemDbId]) - ? 'enabled' - : 'disabled'; - -`; diff --git a/tests/operations/jsfmt.spec.js b/tests/operations/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/operations/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/operations/operations.php b/tests/operations/operations.php deleted file mode 100644 index b35f22321..000000000 --- a/tests/operations/operations.php +++ /dev/null @@ -1,78 +0,0 @@ -> $b; -$a >>= $b; - -$a == $b; -$a === $b; -$a != $b; -$a <> $b; -$a !== $b; -$a < $b; -$a > $b; -$a <= $b; -$a >= $b; -$a <=> $b; - -$a and $b; -$a or $b; -$a xor $b; -!$a; -$a && $b; -$a || $b; - -$a . $b; -$a .= $b; - -$a instanceof stdClass; - -$output = `ls -al`; -$a = (bool) "test"; - -$b = &$a; - -$a ?? $b; - -$this->reallyLong->testPropertyName = 'a' . $someOtherTest . 'n' . $oneLastOneToMakeLineLong; - -'tesssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssst' . 'test'; - -$someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable; -$someReallyReallyReallyLongBooleanVariable . $someReallyReallyReallyLongBooleanVariable; -$someReallyReallyReallyLongBooleanVariable .= $someReallyReallyReallyLongBooleanVariable; -++$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName; ---$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName; -$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName++; -$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName--; -$someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable - $someReallyReallyReallyLongBooleanVariable; - -$value = isset($_POST['menu-item-dropdown']) && -isset($_POST['menu-item-dropdown'][$menuItemDbId]) - ? 'enabled' - : 'disabled'; diff --git a/tests/parameter/__snapshots__/jsfmt.spec.mjs.snap b/tests/parameter/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..04cb4cb00 --- /dev/null +++ b/tests/parameter/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,363 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`parameter.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +$unit; + } + return $time; +} + +function testReturn(?string $name): ?string +{ + return $name; +} + +function intArg(int $c = 111111111111111111111111111111111111111111111111111111111111111111111111) { + var_dump($c); +} + +function bar($arg = array("veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString")) +{ + return $arg; +} + +function bar1( + $arg = array( + "key1" => "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", + + "key2" => "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", + + "key3" => "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + ) +) { + return $arg; +} + +function bar2($arg = "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString") +{ + return $arg; +} + +function bar3($arg = "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" ? "1" : "2") +{ + return $arg; +} + +function bar4(string $arg = "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" ? "1" : "2") +{ + return $arg; +} + +function bar5($arg = "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString" === "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString" ? "1" : "2") +{ + return $arg; +} + +function foo($arg = 'string +string +string') {} + +function foo($arg = 'string +string +string', $arg = 'string +string +string') {} + +function foo($a, $b = 'string +string +string', $c) {} + +=====================================output===================================== +$unit; + } + return $time; +} + +function testReturn(?string $name): ?string +{ + return $name; +} + +function intArg( + int $c = 111111111111111111111111111111111111111111111111111111111111111111111111, +) { + var_dump($c); +} + +function bar( + $arg = [ + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", + ], +) { + return $arg; +} + +function bar1( + $arg = [ + "key1" => "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", + + "key2" => "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", + + "key3" => "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", + ], +) { + return $arg; +} + +function bar2( + $arg = + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", +) { + return $arg; +} + +function bar3( + $arg = "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + ? "1" + : "2", +) { + return $arg; +} + +function bar4( + string $arg = "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + ? "1" + : "2", +) { + return $arg; +} + +function bar5( + $arg = + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString" === + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + ? "1" + : "2", +) { + return $arg; +} + +function foo( + $arg = 'string +string +string', +) {} + +function foo( + $arg = 'string +string +string', + $arg = 'string +string +string', +) {} + +function foo( + $a, + $b = 'string +string +string', + $c, +) {} + +================================================================================ +`; + +exports[`spec.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +$unit; + } + return $time; +} + +function testReturn(?string $name): ?string +{ + return $name; +} + +function intArg(int $c = 111111111111111111111111111111111111111111111111111111111111111111111111) { + var_dump($c); +} + +function bar($arg = array("veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString")) +{ + return $arg; +} + +function bar1( + $arg = array( + "key1" => "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", + + "key2" => "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString", + + "key3" => "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + ) +) { + return $arg; +} + +function bar2($arg = "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString") +{ + return $arg; +} + +function bar3($arg = "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" ? "1" : "2") +{ + return $arg; +} + +function bar4(string $arg = "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" ? "1" : "2") +{ + return $arg; +} + +function bar5($arg = "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString" === "veryVeryVeryVeryVeryVeryVeryVeryVeryLongString" ? "1" : "2") +{ + return $arg; +} + +function foo($arg = 'string +string +string') {} + +function foo($arg = 'string +string +string', $arg = 'string +string +string') {} + +function foo($a, $b = 'string +string +string', $c) {} diff --git a/tests/parameter/spec.php b/tests/parameter/spec.php new file mode 100644 index 000000000..cf292f148 --- /dev/null +++ b/tests/parameter/spec.php @@ -0,0 +1,41 @@ + 'bar') -)) -?> - 'bar') -)))) -?> - 'bar'] -)) -?> -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 'bar') -)); -( - new Translator( - $container, - new MessageFormatter(), - 'en', - $someOtherVar, - array('foo' => 'bar') - ) -); -(new Translator($container, new MessageFormatter(), 'en', $someOtherVar, [ - 'foo' => 'bar' -])); - -`; diff --git a/tests/parens/__snapshots__/jsfmt.spec.mjs.snap b/tests/parens/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..ccb74dd00 --- /dev/null +++ b/tests/parens/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,7192 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`array.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== + ($var), ('other-key') => ($other_var)]; +$arr = ([('key') => ($var), ('other-key') => ($other_var)]); + +[$var, $other_var] = $arr; +[($var), ($other_var)] = $arr; +[('key') => ($var), ('other-key') => ($other_var)] = $arr; + +$var = array(1, 2, 3)[1]; +$var = (array(1, 2, 3))[1]; +$var = [1, 2, 3][1]; +$var = ([1, 2, 3])[1]; +$var = array(new stdClass())[0]; +$var = (array((new stdClass())))[0]; +$var = [new stdClass()][0]; +$var = ([(new stdClass())])[0]; + +=====================================output===================================== + $var, "other-key" => $other_var]; +$arr = ["key" => $var, "other-key" => $other_var]; + +[$var, $other_var] = $arr; +[$var, $other_var] = $arr; +["key" => $var, "other-key" => $other_var] = $arr; + +$var = [1, 2, 3][1]; +$var = [1, 2, 3][1]; +$var = [1, 2, 3][1]; +$var = [1, 2, 3][1]; +$var = [new stdClass()][0]; +$var = [new stdClass()][0]; +$var = [new stdClass()][0]; +$var = [new stdClass()][0]; + +================================================================================ +`; + +exports[`array.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + ($var), ('other-key') => ($other_var)]; +$arr = ([('key') => ($var), ('other-key') => ($other_var)]); + +[$var, $other_var] = $arr; +[($var), ($other_var)] = $arr; +[('key') => ($var), ('other-key') => ($other_var)] = $arr; + +$var = array(1, 2, 3)[1]; +$var = (array(1, 2, 3))[1]; +$var = [1, 2, 3][1]; +$var = ([1, 2, 3])[1]; +$var = array(new stdClass())[0]; +$var = (array((new stdClass())))[0]; +$var = [new stdClass()][0]; +$var = ([(new stdClass())])[0]; + +=====================================output===================================== + $var, "other-key" => $other_var]; +$arr = ["key" => $var, "other-key" => $other_var]; + +[$var, $other_var] = $arr; +[$var, $other_var] = $arr; +["key" => $var, "other-key" => $other_var] = $arr; + +$var = [1, 2, 3][1]; +$var = [1, 2, 3][1]; +$var = [1, 2, 3][1]; +$var = [1, 2, 3][1]; +$var = [new stdClass()][0]; +$var = [new stdClass()][0]; +$var = [new stdClass()][0]; +$var = [new stdClass()][0]; + +================================================================================ +`; + +exports[`assign.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== + 'value']); + +($var = $var ? $var : function() { return 0; }); + +for ($i = 1; $i <= 10; $i++) { + echo $i; +} + +for (($i = 1); ($i <= 10); ($i++)) { + echo $i; +} +for (($i = 1), ($j = 0); ($i <= 10); ($j += $i), print ($i), ($i++)); + +if ($a = 1) {} + +while ($var = 1) {} +while ($var = current($array) !== FALSE) {} +while (($var = current($array)) !== FALSE) {} + +$var = $var || $var = new MyClass(); +$var = $var || ($var = new MyClass()); + +if (true) $var = $var; +if (true) ($var = $var); +if (true) { ($var = $var); } else if (false) ($var = $var); +if (true) { ($var = $var); } else if (false) { ($var = $var); } else ($var = $var); + +if (true) { + $var = $var; + ($var = $var); +} + +while ($i <= 10) $i = 1; +while ($i <= 10) ($i = 1); + +do { + echo $i; +} while ($i = 0); + +for ($i = 1; $i <= 10; $i++) $i = 1; +for ($i = 1; $i <= 10; $i++) ($i = 1); + +foreach ($arr as &$value) $value = $value * 2; +foreach ($arr as &$value) ($value = $value * 2); + +switch ($i = 1) { + case 0: + echo "i equals 0"; + break; + case 1: + echo "i equals 1"; + break; + case 2: + echo "i equals 2"; + break; +} + +switch (($i = 1)) { + case 0: + echo "i equals 0"; + break; + case 1: + echo "i equals 1"; + break; + case 2: + echo "i equals 2"; + break; +} + +=====================================output===================================== + "value"]; + +$var = $var + ? $var + : function () { + return 0; + }; + +for ($i = 1; $i <= 10; $i++) { + echo $i; +} + +for ($i = 1; $i <= 10; $i++) { + echo $i; +} +for ($i = 1, $j = 0; $i <= 10; $j += $i, print $i, $i++); + +if ($a = 1) { +} + +while ($var = 1) { +} +while ($var = current($array) !== false) { +} +while (($var = current($array)) !== false) { +} + +$var = $var || ($var = new MyClass()); +$var = $var || ($var = new MyClass()); + +if (true) { + $var = $var; +} +if (true) { + $var = $var; +} +if (true) { + $var = $var; +} elseif (false) { + $var = $var; +} +if (true) { + $var = $var; +} elseif (false) { + $var = $var; +} else { + $var = $var; +} + +if (true) { + $var = $var; + $var = $var; +} + +while ($i <= 10) { + $i = 1; +} +while ($i <= 10) { + $i = 1; +} + +do { + echo $i; +} while ($i = 0); + +for ($i = 1; $i <= 10; $i++) { + $i = 1; +} +for ($i = 1; $i <= 10; $i++) { + $i = 1; +} + +foreach ($arr as &$value) { + $value = $value * 2; +} +foreach ($arr as &$value) { + $value = $value * 2; +} + +switch ($i = 1) { + case 0: + echo "i equals 0"; + break; + case 1: + echo "i equals 1"; + break; + case 2: + echo "i equals 2"; + break; +} + +switch ($i = 1) { + case 0: + echo "i equals 0"; + break; + case 1: + echo "i equals 1"; + break; + case 2: + echo "i equals 2"; + break; +} + +================================================================================ +`; + +exports[`assign.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 'value']); + +($var = $var ? $var : function() { return 0; }); + +for ($i = 1; $i <= 10; $i++) { + echo $i; +} + +for (($i = 1); ($i <= 10); ($i++)) { + echo $i; +} +for (($i = 1), ($j = 0); ($i <= 10); ($j += $i), print ($i), ($i++)); + +if ($a = 1) {} + +while ($var = 1) {} +while ($var = current($array) !== FALSE) {} +while (($var = current($array)) !== FALSE) {} + +$var = $var || $var = new MyClass(); +$var = $var || ($var = new MyClass()); + +if (true) $var = $var; +if (true) ($var = $var); +if (true) { ($var = $var); } else if (false) ($var = $var); +if (true) { ($var = $var); } else if (false) { ($var = $var); } else ($var = $var); + +if (true) { + $var = $var; + ($var = $var); +} + +while ($i <= 10) $i = 1; +while ($i <= 10) ($i = 1); + +do { + echo $i; +} while ($i = 0); + +for ($i = 1; $i <= 10; $i++) $i = 1; +for ($i = 1; $i <= 10; $i++) ($i = 1); + +foreach ($arr as &$value) $value = $value * 2; +foreach ($arr as &$value) ($value = $value * 2); + +switch ($i = 1) { + case 0: + echo "i equals 0"; + break; + case 1: + echo "i equals 1"; + break; + case 2: + echo "i equals 2"; + break; +} + +switch (($i = 1)) { + case 0: + echo "i equals 0"; + break; + case 1: + echo "i equals 1"; + break; + case 2: + echo "i equals 2"; + break; +} + +=====================================output===================================== + "value"]; + +$var = $var + ? $var + : function () { + return 0; + }; + +for ($i = 1; $i <= 10; $i++) { + echo $i; +} + +for ($i = 1; $i <= 10; $i++) { + echo $i; +} +for ($i = 1, $j = 0; $i <= 10; $j += $i, print $i, $i++); + +if ($a = 1) { +} + +while ($var = 1) { +} +while ($var = current($array) !== false) { +} +while (($var = current($array)) !== false) { +} + +$var = $var || ($var = new MyClass()); +$var = $var || ($var = new MyClass()); + +if (true) { + $var = $var; +} +if (true) { + $var = $var; +} +if (true) { + $var = $var; +} elseif (false) { + $var = $var; +} +if (true) { + $var = $var; +} elseif (false) { + $var = $var; +} else { + $var = $var; +} + +if (true) { + $var = $var; + $var = $var; +} + +while ($i <= 10) { + $i = 1; +} +while ($i <= 10) { + $i = 1; +} + +do { + echo $i; +} while ($i = 0); + +for ($i = 1; $i <= 10; $i++) { + $i = 1; +} +for ($i = 1; $i <= 10; $i++) { + $i = 1; +} + +foreach ($arr as &$value) { + $value = $value * 2; +} +foreach ($arr as &$value) { + $value = $value * 2; +} + +switch ($i = 1) { + case 0: + echo "i equals 0"; + break; + case 1: + echo "i equals 1"; + break; + case 2: + echo "i equals 2"; + break; +} + +switch ($i = 1) { + case 0: + echo "i equals 0"; + break; + case 1: + echo "i equals 1"; + break; + case 2: + echo "i equals 2"; + break; +} + +================================================================================ +`; + +exports[`assignref.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== + 0) {} +if (($foo = &test1()) && test2($foo) > 0) {} + +call(($a =& $b)); + +=====================================output===================================== + 0) { +} +if ($foo = &test1() && test2($foo) > 0) { +} + +call($a = &$b); + +================================================================================ +`; + +exports[`assignref.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 0) {} +if (($foo = &test1()) && test2($foo) > 0) {} + +call(($a =& $b)); + +=====================================output===================================== + 0) { +} +if ($foo = &test1() && test2($foo) > 0) { +} + +call($a = &$b); + +================================================================================ +`; + +exports[`bin.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +> 20 >> 30; +$var = (10 >> 20) >> 30; +$var = 10 >> (20 >> 30); + +$var = 10 ^ 20 ^ 30; +$var = (10 ^ 20) ^ 30; +$var = 10 ^ (20 ^ 30); + +$var = 10 | 20 | 30; +$var = (10 | 20) | 30; +$var = 10 | (20 | 30); + +$var = false || true; +$var = (false || true); +$var = false or true; +$var = (false or true); +$var = true && false; +$var = (true && false); +$var = true and false; +$var = (true and false); + +$var = $var || $var(); +$var = ($var || $var)(); +$var = $var && $var(); +$var = ($var && $var)(); +$var = call($var || $var); +$var = call(($var || $var)); +$var = call($var && $var); +$var = call(($var && $var)); + +$var = +($var || $var); +$var = -($var || $var); +$var = ~($var || $var); + +$var = ($var || $var)->foo; +$var = ($var || $var)->foo(); +$var = ($var || $var)[1]; + +$var = $var || $var && $var; +$var = ($var || $var) && $var; +$var = $var || ($var && $var); + +$var = $var & ($var || 'test'); +$var = ($var || 'test') & $var; +$var = $var & ($var . 'test'); +$var = ($var . 'test') & $var; +$var = ($var & $var) || 'test'; +$var = $var || ('test' & $var); + +$var = ($var || $var) % 100; +$var = ($var + $var) % 100; +$var = 100 % ($var || $var); +$var = 100 % ($var + $var); +$var = $var || ($var % 100); +$var = $var + ($var % 100); +$var = (100 % $var) || $var; +$var = (100 % $var) + $var; + +$var = ($var + $var) >> 1; +$var = (($var - 1) >> $var) & $var; +$var = $var > $var ? 0 : ($var - $var) >> $var; +$var = (($var - $var) >> $var) + 1; + +if ($var < 1 << ($var + $var)) {} + +$var = $var < $var ? 0 : ((($var - 1) >> $var) << $var); +$var = 1 - (2 * ($var[3] >> 7)); +$var = ((($var[3] << 1) & 0xff) | ($var[2] >> 7)) - 127; +$var = (($var[2] & 0x7f) << 16) | ($var[1] << 8) | $var[0]; + +$var = 2 / 3 * 10 / 2 + 2; + +$var = (($var / $var) * $var - $var / 2) * call($var); +$var = (($var / $var) * $var - $var / 2) * call($var); + +$var = $var % 10 - 5; +$var = $var * $var % 10; +$var = $var % 10 > 5; +$var = $var % 10 == 0; + +$var = $var + $var / $var; +$var = $var / $var + $var; + +$var = $var * $var % $var; +$var = $var / $var % $var; +$var = $var % $var * $var; +$var = $var % $var / $var; + +$var = $var % $var % $var; + +$var = $var << $var >> $var; +$var = $var >> $var << $var; +$var = $var >> $var >> $var; +$var = $var + $var >> $var; +$var = ($var + $var) >> $var; +$var = $var + ($var >> $var); + +$var = $var | $var & $var; +$var = $var & $var | $var; +$var = $var ^ $var ^ $var; +$var = $var & $var & $var; +$var = $var | $var | $var; +$var = $var & $var >> $var; +$var = $var << $var | $var; + +$var = $var ? 'foo' : 'bar' . 'test'; +$var = ($var ? 'foo' : 'bar') . 'test'; +$var = $var ? 'foo' : ('bar' . 'test'); + +call(($var + $var)); + +$var = call(($var + $var)); + +$var = $var + $var ** 2; +$var = ($var + $var) ** 2; +$var = $var + ($var ** 2); +$var = (+$var) ** 2; +$var = +$var ** 2; + +$var = $foo instanceof Foo; +$var = $foo instanceof Foo || $foo instanceof Foo; +$var = ($foo instanceof Foo) || ($foo instanceof Foo); +$var = (($foo) instanceof Foo); + +$var = !$var; +$var = !($var); +$var = (!($var)); +$var = !!$var; +$var = !!($var); +$var = !(!($var)); +$var = (!(!($var))); +$var = !!!$var; +$var = !!!($var); +$var = !!(!($var)); +$var = !(!(!($var))); +$var = (!(!(!($var)))); + +$var = !$var || !$var; +$var = (!($var) || !($var)); +$var = !(!($var) || !($var)); + +$var = $var + $var * $var; +$var = ($var + $var) * $var; + +$var = @foo() || @foo(); +$var = @(foo() || foo()); + +($var += ($var += ($var += $var))); +($var -= ($var -= ($var -= $var))); +($var *= ($var *= ($var *= $var))); +($var **= ($var **= ($var **= $var))); +($var /= ($var /= ($var /= $var))); +($var .= ($var .= ($var .= $var))); +($var %= ($var %= ($var %= $var))); +($var &= ($var &= ($var &= $var))); +($var |= ($var |= ($var |= $var))); +($var ^= ($var ^= ($var ^= $var))); +($var <<= ($var <<= ($var <<= $var))); +($var >>= ($var >>= ($var >>= $var))); + +$var = $var | $var | $var; +$var = $var | ($var | $var); +$var = ($var | $var) | $var; +$var = $var & $var & $var; +$var = $var & ($var & $var); +$var = ($var & $var) & $var; + +$var = $var ^ $var | $var; +$var = ($var ^ $var) | $var; +$var = $var | $var ^ $var; +$var = $var | ($var ^ $var); +$var = ($var | $var) ^ $var; + +$var = $var & $var | $var; +$var = ($var & $var) | $var; +$var = $var | $var & $var; +$var = $var | ($var & $var); +$var = ($var | $var) & $var; + +$var = $var == $var || false; +$var = ($var == $var) || false; +$var = $var == ($var || false); + +$var = false || $var == $var; +$var = false || ($var == $var); +$var = ($var || false) == $var; + +$var = 'string' . true ? '1' : '2'; +$var = 'string' . (true ? '1' : '2'); + +$var = 'string' . (100 + 100); +$var = (100 + 100) . 'string'; +$var = 'string' . ($var || 100); +$var = ($var || 100) . 'string'; +$var = 'string' . ($var * 100); +$var = ($var * 100) . 'string'; +$var = 'string' . !$var; +$var = !$var . 'string'; +$var = 'string' . ($var | 100); +$var = ($var | 100) . 'string'; + +$var = $var . $var % $var; +$var = ($var . $var) % $var; +$var = $var % $var . $var; +$var = $var % ($var . $var); + +$var = '100' - '100' - '100'; +$var = ('100' - '100') - '100'; +$var = '100' - ('100' - '100'); + +if (false || true) {}; +if ((false || true)) {}; +if (false or true) {}; +if ((false or true)) {}; +if (true && false) {}; +if ((true && false)) {}; +if (true and false) {}; +if ((true and false)) {}; + +if (!$foo or $bar == -1) {} +if ((!$foo or $bar == -1)) {} +if ((!$foo or $bar) == -1) {} +if (!$foo or ($bar == -1)) {} + +do {} while ($foo and $bar); +while ($foo or $bar < 10) {} +for ($foo or $bar;;) {} +switch ($foo or $bar) {} + +$a ** $b ** $c; +($a ** $b) ** $c; +$a->b ** $c; +(-$a) ** $b; +$a ** -$b; +-($a**$b); +($a * $b) ** $c; +$a ** ($b * $c); +($a % $b) ** $c; + +$var = $var + $var ?? ''; +$var = $var + ($var ?? ''); +$var = ($var + $var) ?? ''; +$var = $var ?? null + 1; +$var = ($var ?? null) + 1; +$var = $var && ($var ?? true); +$var = ($var ?? true) && $var; +$var = $var && ($var ?? null) === true; +$var = ($var ?? null) === true && $var; + +$findAll = $cachesNames === []; +$findAll = ($cachesNames === []); + +$isNamespaced = strpos($fixture, '\\\\') !== false; +$isNamespaced = (strpos($fixture, '\\\\') !== false); + +$var = $a['apply_time'] > $b['apply_time'] ? -1 : +1; +$var = ($a['apply_time'] > $b['apply_time']) ? -1 : +1; + +$var = $page > 0 || $page == 0 && $this->forcePageParam; +$var = $page > 0 || ($page == 0 && $this->forcePageParam); + +@foo() || @foo(); +(@foo()) || (@foo()); +$var = @foo() || @foo(); +$var = (@foo() || @foo()); + +@$i / 0; +@($i) / 0; + +$var = "a" . (@$b ? 'bar' : "baz"); + +$a = (false && foo()); +$b = (true || foo()); +$c = (false and foo()); +$d = (true or foo()); + +$f = false or true; +$h = true and false; + +$my_file = call('non_existent_file') or die("Failed opening file: error was '$php_errormsg'"); +($my_file = call('non_existent_file')) or die("Failed opening file: error was '$php_errormsg'"); + +$my_file = call('non_existent_file') and die("Failed opening file: error was '$php_errormsg'"); +($my_file = call('non_existent_file')) and die("Failed opening file: error was '$php_errormsg'"); + +$var = $obj->foo ?? "default"; +$var = $foo ? $bar ?? $foo : $baz; +$var = $foo ?? ($bar ?? $baz); +$var = ($foo ?? $baz) || $baz; +$var = $foo ?? $baz || $baz; +$var = ($foo && $baz) ?? $baz; +$var = $foo && ($baz ?? $baz); + +$result = 2 ** $number - 1; +$result = (2 ** $number) - 1; +$result = 2 ** ($number - 1); + +=====================================output===================================== +> 20) >> 30; +$var = (10 >> 20) >> 30; +$var = 10 >> (20 >> 30); + +$var = 10 ^ 20 ^ 30; +$var = 10 ^ 20 ^ 30; +$var = 10 ^ (20 ^ 30); + +$var = 10 | 20 | 30; +$var = 10 | 20 | 30; +$var = 10 | (20 | 30); + +$var = false || true; +$var = false || true; +($var = false) or true; +$var = (false or true); +$var = true && false; +$var = true && false; +($var = true) and false; +$var = (true and false); + +$var = $var || $var(); +$var = ($var || $var)(); +$var = $var && $var(); +$var = ($var && $var)(); +$var = call($var || $var); +$var = call($var || $var); +$var = call($var && $var); +$var = call($var && $var); + +$var = +($var || $var); +$var = -($var || $var); +$var = ~($var || $var); + +$var = ($var || $var)->foo; +$var = ($var || $var)->foo(); +$var = ($var || $var)[1]; + +$var = $var || ($var && $var); +$var = ($var || $var) && $var; +$var = $var || ($var && $var); + +$var = $var & ($var || "test"); +$var = ($var || "test") & $var; +$var = $var & ($var . "test"); +$var = ($var . "test") & $var; +$var = $var & $var || "test"; +$var = $var || "test" & $var; + +$var = ($var || $var) % 100; +$var = ($var + $var) % 100; +$var = 100 % ($var || $var); +$var = 100 % ($var + $var); +$var = $var || $var % 100; +$var = $var + ($var % 100); +$var = 100 % $var || $var; +$var = (100 % $var) + $var; + +$var = $var + $var >> 1; +$var = ($var - 1 >> $var) & $var; +$var = $var > $var ? 0 : $var - $var >> $var; +$var = ($var - $var >> $var) + 1; + +if ($var < 1 << $var + $var) { +} + +$var = $var < $var ? 0 : ($var - 1 >> $var) << $var; +$var = 1 - 2 * ($var[3] >> 7); +$var = ((($var[3] << 1) & 0xff) | ($var[2] >> 7)) - 127; +$var = (($var[2] & 0x7f) << 16) | ($var[1] << 8) | $var[0]; + +$var = ((2 / 3) * 10) / 2 + 2; + +$var = (($var / $var) * $var - $var / 2) * call($var); +$var = (($var / $var) * $var - $var / 2) * call($var); + +$var = ($var % 10) - 5; +$var = ($var * $var) % 10; +$var = $var % 10 > 5; +$var = $var % 10 == 0; + +$var = $var + $var / $var; +$var = $var / $var + $var; + +$var = ($var * $var) % $var; +$var = ($var / $var) % $var; +$var = ($var % $var) * $var; +$var = ($var % $var) / $var; + +$var = ($var % $var) % $var; + +$var = ($var << $var) >> $var; +$var = ($var >> $var) << $var; +$var = ($var >> $var) >> $var; +$var = $var + $var >> $var; +$var = $var + $var >> $var; +$var = $var + ($var >> $var); + +$var = $var | ($var & $var); +$var = ($var & $var) | $var; +$var = $var ^ $var ^ $var; +$var = $var & $var & $var; +$var = $var | $var | $var; +$var = $var & ($var >> $var); +$var = ($var << $var) | $var; + +$var = $var ? "foo" : "bar" . "test"; +$var = ($var ? "foo" : "bar") . "test"; +$var = $var ? "foo" : "bar" . "test"; + +call($var + $var); + +$var = call($var + $var); + +$var = $var + $var ** 2; +$var = ($var + $var) ** 2; +$var = $var + $var ** 2; +$var = (+$var) ** 2; +$var = (+$var) ** 2; + +$var = $foo instanceof Foo; +$var = $foo instanceof Foo || $foo instanceof Foo; +$var = $foo instanceof Foo || $foo instanceof Foo; +$var = $foo instanceof Foo; + +$var = !$var; +$var = !$var; +$var = !$var; +$var = !!$var; +$var = !!$var; +$var = !!$var; +$var = !!$var; +$var = !!!$var; +$var = !!!$var; +$var = !!!$var; +$var = !!!$var; +$var = !!!$var; + +$var = !$var || !$var; +$var = !$var || !$var; +$var = !(!$var || !$var); + +$var = $var + $var * $var; +$var = ($var + $var) * $var; + +$var = @foo() || @foo(); +$var = @(foo() || foo()); + +$var += $var += $var += $var; +$var -= $var -= $var -= $var; +$var *= $var *= $var *= $var; +$var **= $var **= $var **= $var; +$var /= $var /= $var /= $var; +$var .= $var .= $var .= $var; +$var %= $var %= $var %= $var; +$var &= $var &= $var &= $var; +$var |= $var |= $var |= $var; +$var ^= $var ^= $var ^= $var; +$var <<= $var <<= $var <<= $var; +$var >>= $var >>= $var >>= $var; + +$var = $var | $var | $var; +$var = $var | ($var | $var); +$var = $var | $var | $var; +$var = $var & $var & $var; +$var = $var & ($var & $var); +$var = $var & $var & $var; + +$var = ($var ^ $var) | $var; +$var = ($var ^ $var) | $var; +$var = $var | ($var ^ $var); +$var = $var | ($var ^ $var); +$var = ($var | $var) ^ $var; + +$var = ($var & $var) | $var; +$var = ($var & $var) | $var; +$var = $var | ($var & $var); +$var = $var | ($var & $var); +$var = ($var | $var) & $var; + +$var = $var == $var || false; +$var = $var == $var || false; +$var = $var == ($var || false); + +$var = false || $var == $var; +$var = false || $var == $var; +$var = ($var || false) == $var; + +$var = "string" . true ? "1" : "2"; +$var = "string" . (true ? "1" : "2"); + +$var = "string" . (100 + 100); +$var = 100 + 100 . "string"; +$var = "string" . ($var || 100); +$var = ($var || 100) . "string"; +$var = "string" . $var * 100; +$var = $var * 100 . "string"; +$var = "string" . !$var; +$var = !$var . "string"; +$var = "string" . ($var | 100); +$var = ($var | 100) . "string"; + +$var = $var . $var % $var; +$var = ($var . $var) % $var; +$var = $var % $var . $var; +$var = $var % ($var . $var); + +$var = "100" - "100" - "100"; +$var = "100" - "100" - "100"; +$var = "100" - ("100" - "100"); + +if (false || true) { +} +if (false || true) { +} +if (false or true) { +} +if (false or true) { +} +if (true && false) { +} +if (true && false) { +} +if (true and false) { +} +if (true and false) { +} + +if (!$foo or $bar == -1) { +} +if (!$foo or $bar == -1) { +} +if ((!$foo or $bar) == -1) { +} +if (!$foo or $bar == -1) { +} + +do { +} while ($foo and $bar); +while ($foo or $bar < 10) { +} +for ($foo or $bar; ; ) { +} +switch ($foo or $bar) { +} + +$a ** ($b ** $c); +($a ** $b) ** $c; +$a->b ** $c; +(-$a) ** $b; +$a ** -$b; +-($a ** $b); +($a * $b) ** $c; +$a ** ($b * $c); +($a % $b) ** $c; + +$var = $var + $var ?? ""; +$var = $var + ($var ?? ""); +$var = $var + $var ?? ""; +$var = $var ?? null + 1; +$var = ($var ?? null) + 1; +$var = $var && ($var ?? true); +$var = ($var ?? true) && $var; +$var = $var && ($var ?? null) === true; +$var = ($var ?? null) === true && $var; + +$findAll = $cachesNames === []; +$findAll = $cachesNames === []; + +$isNamespaced = strpos($fixture, "\\\\") !== false; +$isNamespaced = strpos($fixture, "\\\\") !== false; + +$var = $a["apply_time"] > $b["apply_time"] ? -1 : +1; +$var = $a["apply_time"] > $b["apply_time"] ? -1 : +1; + +$var = $page > 0 || ($page == 0 && $this->forcePageParam); +$var = $page > 0 || ($page == 0 && $this->forcePageParam); + +@foo() || @foo(); +@foo() || @foo(); +$var = @foo() || @foo(); +$var = @foo() || @foo(); + +@$i / 0; +@$i / 0; + +$var = "a" . (@$b ? "bar" : "baz"); + +$a = false && foo(); +$b = true || foo(); +$c = (false and foo()); +$d = (true or foo()); + +($f = false) or true; +($h = true) and false; + +($my_file = call("non_existent_file")) or + die("Failed opening file: error was '$php_errormsg'"); +($my_file = call("non_existent_file")) or + die("Failed opening file: error was '$php_errormsg'"); + +($my_file = call("non_existent_file")) and + die("Failed opening file: error was '$php_errormsg'"); +($my_file = call("non_existent_file")) and + die("Failed opening file: error was '$php_errormsg'"); + +$var = $obj->foo ?? "default"; +$var = $foo ? $bar ?? $foo : $baz; +$var = $foo ?? ($bar ?? $baz); +$var = ($foo ?? $baz) || $baz; +$var = $foo ?? $baz || $baz; +$var = $foo && $baz ?? $baz; +$var = $foo && ($baz ?? $baz); + +$result = 2 ** $number - 1; +$result = 2 ** $number - 1; +$result = 2 ** ($number - 1); + +================================================================================ +`; + +exports[`bin.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +> 20 >> 30; +$var = (10 >> 20) >> 30; +$var = 10 >> (20 >> 30); + +$var = 10 ^ 20 ^ 30; +$var = (10 ^ 20) ^ 30; +$var = 10 ^ (20 ^ 30); + +$var = 10 | 20 | 30; +$var = (10 | 20) | 30; +$var = 10 | (20 | 30); + +$var = false || true; +$var = (false || true); +$var = false or true; +$var = (false or true); +$var = true && false; +$var = (true && false); +$var = true and false; +$var = (true and false); + +$var = $var || $var(); +$var = ($var || $var)(); +$var = $var && $var(); +$var = ($var && $var)(); +$var = call($var || $var); +$var = call(($var || $var)); +$var = call($var && $var); +$var = call(($var && $var)); + +$var = +($var || $var); +$var = -($var || $var); +$var = ~($var || $var); + +$var = ($var || $var)->foo; +$var = ($var || $var)->foo(); +$var = ($var || $var)[1]; + +$var = $var || $var && $var; +$var = ($var || $var) && $var; +$var = $var || ($var && $var); + +$var = $var & ($var || 'test'); +$var = ($var || 'test') & $var; +$var = $var & ($var . 'test'); +$var = ($var . 'test') & $var; +$var = ($var & $var) || 'test'; +$var = $var || ('test' & $var); + +$var = ($var || $var) % 100; +$var = ($var + $var) % 100; +$var = 100 % ($var || $var); +$var = 100 % ($var + $var); +$var = $var || ($var % 100); +$var = $var + ($var % 100); +$var = (100 % $var) || $var; +$var = (100 % $var) + $var; + +$var = ($var + $var) >> 1; +$var = (($var - 1) >> $var) & $var; +$var = $var > $var ? 0 : ($var - $var) >> $var; +$var = (($var - $var) >> $var) + 1; + +if ($var < 1 << ($var + $var)) {} + +$var = $var < $var ? 0 : ((($var - 1) >> $var) << $var); +$var = 1 - (2 * ($var[3] >> 7)); +$var = ((($var[3] << 1) & 0xff) | ($var[2] >> 7)) - 127; +$var = (($var[2] & 0x7f) << 16) | ($var[1] << 8) | $var[0]; + +$var = 2 / 3 * 10 / 2 + 2; + +$var = (($var / $var) * $var - $var / 2) * call($var); +$var = (($var / $var) * $var - $var / 2) * call($var); + +$var = $var % 10 - 5; +$var = $var * $var % 10; +$var = $var % 10 > 5; +$var = $var % 10 == 0; + +$var = $var + $var / $var; +$var = $var / $var + $var; + +$var = $var * $var % $var; +$var = $var / $var % $var; +$var = $var % $var * $var; +$var = $var % $var / $var; + +$var = $var % $var % $var; + +$var = $var << $var >> $var; +$var = $var >> $var << $var; +$var = $var >> $var >> $var; +$var = $var + $var >> $var; +$var = ($var + $var) >> $var; +$var = $var + ($var >> $var); + +$var = $var | $var & $var; +$var = $var & $var | $var; +$var = $var ^ $var ^ $var; +$var = $var & $var & $var; +$var = $var | $var | $var; +$var = $var & $var >> $var; +$var = $var << $var | $var; + +$var = $var ? 'foo' : 'bar' . 'test'; +$var = ($var ? 'foo' : 'bar') . 'test'; +$var = $var ? 'foo' : ('bar' . 'test'); + +call(($var + $var)); + +$var = call(($var + $var)); + +$var = $var + $var ** 2; +$var = ($var + $var) ** 2; +$var = $var + ($var ** 2); +$var = (+$var) ** 2; +$var = +$var ** 2; + +$var = $foo instanceof Foo; +$var = $foo instanceof Foo || $foo instanceof Foo; +$var = ($foo instanceof Foo) || ($foo instanceof Foo); +$var = (($foo) instanceof Foo); + +$var = !$var; +$var = !($var); +$var = (!($var)); +$var = !!$var; +$var = !!($var); +$var = !(!($var)); +$var = (!(!($var))); +$var = !!!$var; +$var = !!!($var); +$var = !!(!($var)); +$var = !(!(!($var))); +$var = (!(!(!($var)))); + +$var = !$var || !$var; +$var = (!($var) || !($var)); +$var = !(!($var) || !($var)); + +$var = $var + $var * $var; +$var = ($var + $var) * $var; + +$var = @foo() || @foo(); +$var = @(foo() || foo()); + +($var += ($var += ($var += $var))); +($var -= ($var -= ($var -= $var))); +($var *= ($var *= ($var *= $var))); +($var **= ($var **= ($var **= $var))); +($var /= ($var /= ($var /= $var))); +($var .= ($var .= ($var .= $var))); +($var %= ($var %= ($var %= $var))); +($var &= ($var &= ($var &= $var))); +($var |= ($var |= ($var |= $var))); +($var ^= ($var ^= ($var ^= $var))); +($var <<= ($var <<= ($var <<= $var))); +($var >>= ($var >>= ($var >>= $var))); + +$var = $var | $var | $var; +$var = $var | ($var | $var); +$var = ($var | $var) | $var; +$var = $var & $var & $var; +$var = $var & ($var & $var); +$var = ($var & $var) & $var; + +$var = $var ^ $var | $var; +$var = ($var ^ $var) | $var; +$var = $var | $var ^ $var; +$var = $var | ($var ^ $var); +$var = ($var | $var) ^ $var; + +$var = $var & $var | $var; +$var = ($var & $var) | $var; +$var = $var | $var & $var; +$var = $var | ($var & $var); +$var = ($var | $var) & $var; + +$var = $var == $var || false; +$var = ($var == $var) || false; +$var = $var == ($var || false); + +$var = false || $var == $var; +$var = false || ($var == $var); +$var = ($var || false) == $var; + +$var = 'string' . true ? '1' : '2'; +$var = 'string' . (true ? '1' : '2'); + +$var = 'string' . (100 + 100); +$var = (100 + 100) . 'string'; +$var = 'string' . ($var || 100); +$var = ($var || 100) . 'string'; +$var = 'string' . ($var * 100); +$var = ($var * 100) . 'string'; +$var = 'string' . !$var; +$var = !$var . 'string'; +$var = 'string' . ($var | 100); +$var = ($var | 100) . 'string'; + +$var = $var . $var % $var; +$var = ($var . $var) % $var; +$var = $var % $var . $var; +$var = $var % ($var . $var); + +$var = '100' - '100' - '100'; +$var = ('100' - '100') - '100'; +$var = '100' - ('100' - '100'); + +if (false || true) {}; +if ((false || true)) {}; +if (false or true) {}; +if ((false or true)) {}; +if (true && false) {}; +if ((true && false)) {}; +if (true and false) {}; +if ((true and false)) {}; + +if (!$foo or $bar == -1) {} +if ((!$foo or $bar == -1)) {} +if ((!$foo or $bar) == -1) {} +if (!$foo or ($bar == -1)) {} + +do {} while ($foo and $bar); +while ($foo or $bar < 10) {} +for ($foo or $bar;;) {} +switch ($foo or $bar) {} + +$a ** $b ** $c; +($a ** $b) ** $c; +$a->b ** $c; +(-$a) ** $b; +$a ** -$b; +-($a**$b); +($a * $b) ** $c; +$a ** ($b * $c); +($a % $b) ** $c; + +$var = $var + $var ?? ''; +$var = $var + ($var ?? ''); +$var = ($var + $var) ?? ''; +$var = $var ?? null + 1; +$var = ($var ?? null) + 1; +$var = $var && ($var ?? true); +$var = ($var ?? true) && $var; +$var = $var && ($var ?? null) === true; +$var = ($var ?? null) === true && $var; + +$findAll = $cachesNames === []; +$findAll = ($cachesNames === []); + +$isNamespaced = strpos($fixture, '\\\\') !== false; +$isNamespaced = (strpos($fixture, '\\\\') !== false); + +$var = $a['apply_time'] > $b['apply_time'] ? -1 : +1; +$var = ($a['apply_time'] > $b['apply_time']) ? -1 : +1; + +$var = $page > 0 || $page == 0 && $this->forcePageParam; +$var = $page > 0 || ($page == 0 && $this->forcePageParam); + +@foo() || @foo(); +(@foo()) || (@foo()); +$var = @foo() || @foo(); +$var = (@foo() || @foo()); + +@$i / 0; +@($i) / 0; + +$var = "a" . (@$b ? 'bar' : "baz"); + +$a = (false && foo()); +$b = (true || foo()); +$c = (false and foo()); +$d = (true or foo()); + +$f = false or true; +$h = true and false; + +$my_file = call('non_existent_file') or die("Failed opening file: error was '$php_errormsg'"); +($my_file = call('non_existent_file')) or die("Failed opening file: error was '$php_errormsg'"); + +$my_file = call('non_existent_file') and die("Failed opening file: error was '$php_errormsg'"); +($my_file = call('non_existent_file')) and die("Failed opening file: error was '$php_errormsg'"); + +$var = $obj->foo ?? "default"; +$var = $foo ? $bar ?? $foo : $baz; +$var = $foo ?? ($bar ?? $baz); +$var = ($foo ?? $baz) || $baz; +$var = $foo ?? $baz || $baz; +$var = ($foo && $baz) ?? $baz; +$var = $foo && ($baz ?? $baz); + +$result = 2 ** $number - 1; +$result = (2 ** $number) - 1; +$result = 2 ** ($number - 1); + +=====================================output===================================== +> 20) >> 30; +$var = (10 >> 20) >> 30; +$var = 10 >> (20 >> 30); + +$var = 10 ^ 20 ^ 30; +$var = 10 ^ 20 ^ 30; +$var = 10 ^ (20 ^ 30); + +$var = 10 | 20 | 30; +$var = 10 | 20 | 30; +$var = 10 | (20 | 30); + +$var = false || true; +$var = false || true; +($var = false) or true; +$var = (false or true); +$var = true && false; +$var = true && false; +($var = true) and false; +$var = (true and false); + +$var = $var || $var(); +$var = ($var || $var)(); +$var = $var && $var(); +$var = ($var && $var)(); +$var = call($var || $var); +$var = call($var || $var); +$var = call($var && $var); +$var = call($var && $var); + +$var = +($var || $var); +$var = -($var || $var); +$var = ~($var || $var); + +$var = ($var || $var)->foo; +$var = ($var || $var)->foo(); +$var = ($var || $var)[1]; + +$var = $var || ($var && $var); +$var = ($var || $var) && $var; +$var = $var || ($var && $var); + +$var = $var & ($var || "test"); +$var = ($var || "test") & $var; +$var = $var & ($var . "test"); +$var = ($var . "test") & $var; +$var = $var & $var || "test"; +$var = $var || "test" & $var; + +$var = ($var || $var) % 100; +$var = ($var + $var) % 100; +$var = 100 % ($var || $var); +$var = 100 % ($var + $var); +$var = $var || $var % 100; +$var = $var + ($var % 100); +$var = 100 % $var || $var; +$var = (100 % $var) + $var; + +$var = $var + $var >> 1; +$var = ($var - 1 >> $var) & $var; +$var = $var > $var ? 0 : $var - $var >> $var; +$var = ($var - $var >> $var) + 1; + +if ($var < 1 << $var + $var) { +} + +$var = $var < $var ? 0 : ($var - 1 >> $var) << $var; +$var = 1 - 2 * ($var[3] >> 7); +$var = ((($var[3] << 1) & 0xff) | ($var[2] >> 7)) - 127; +$var = (($var[2] & 0x7f) << 16) | ($var[1] << 8) | $var[0]; + +$var = ((2 / 3) * 10) / 2 + 2; + +$var = (($var / $var) * $var - $var / 2) * call($var); +$var = (($var / $var) * $var - $var / 2) * call($var); + +$var = ($var % 10) - 5; +$var = ($var * $var) % 10; +$var = $var % 10 > 5; +$var = $var % 10 == 0; + +$var = $var + $var / $var; +$var = $var / $var + $var; + +$var = ($var * $var) % $var; +$var = ($var / $var) % $var; +$var = ($var % $var) * $var; +$var = ($var % $var) / $var; + +$var = ($var % $var) % $var; + +$var = ($var << $var) >> $var; +$var = ($var >> $var) << $var; +$var = ($var >> $var) >> $var; +$var = $var + $var >> $var; +$var = $var + $var >> $var; +$var = $var + ($var >> $var); + +$var = $var | ($var & $var); +$var = ($var & $var) | $var; +$var = $var ^ $var ^ $var; +$var = $var & $var & $var; +$var = $var | $var | $var; +$var = $var & ($var >> $var); +$var = ($var << $var) | $var; + +$var = $var ? "foo" : "bar" . "test"; +$var = ($var ? "foo" : "bar") . "test"; +$var = $var ? "foo" : "bar" . "test"; + +call($var + $var); + +$var = call($var + $var); + +$var = $var + $var ** 2; +$var = ($var + $var) ** 2; +$var = $var + $var ** 2; +$var = (+$var) ** 2; +$var = (+$var) ** 2; + +$var = $foo instanceof Foo; +$var = $foo instanceof Foo || $foo instanceof Foo; +$var = $foo instanceof Foo || $foo instanceof Foo; +$var = $foo instanceof Foo; + +$var = !$var; +$var = !$var; +$var = !$var; +$var = !!$var; +$var = !!$var; +$var = !!$var; +$var = !!$var; +$var = !!!$var; +$var = !!!$var; +$var = !!!$var; +$var = !!!$var; +$var = !!!$var; + +$var = !$var || !$var; +$var = !$var || !$var; +$var = !(!$var || !$var); + +$var = $var + $var * $var; +$var = ($var + $var) * $var; + +$var = @foo() || @foo(); +$var = @(foo() || foo()); + +$var += $var += $var += $var; +$var -= $var -= $var -= $var; +$var *= $var *= $var *= $var; +$var **= $var **= $var **= $var; +$var /= $var /= $var /= $var; +$var .= $var .= $var .= $var; +$var %= $var %= $var %= $var; +$var &= $var &= $var &= $var; +$var |= $var |= $var |= $var; +$var ^= $var ^= $var ^= $var; +$var <<= $var <<= $var <<= $var; +$var >>= $var >>= $var >>= $var; + +$var = $var | $var | $var; +$var = $var | ($var | $var); +$var = $var | $var | $var; +$var = $var & $var & $var; +$var = $var & ($var & $var); +$var = $var & $var & $var; + +$var = ($var ^ $var) | $var; +$var = ($var ^ $var) | $var; +$var = $var | ($var ^ $var); +$var = $var | ($var ^ $var); +$var = ($var | $var) ^ $var; + +$var = ($var & $var) | $var; +$var = ($var & $var) | $var; +$var = $var | ($var & $var); +$var = $var | ($var & $var); +$var = ($var | $var) & $var; + +$var = $var == $var || false; +$var = $var == $var || false; +$var = $var == ($var || false); + +$var = false || $var == $var; +$var = false || $var == $var; +$var = ($var || false) == $var; + +$var = "string" . true ? "1" : "2"; +$var = "string" . (true ? "1" : "2"); + +$var = "string" . (100 + 100); +$var = 100 + 100 . "string"; +$var = "string" . ($var || 100); +$var = ($var || 100) . "string"; +$var = "string" . $var * 100; +$var = $var * 100 . "string"; +$var = "string" . !$var; +$var = !$var . "string"; +$var = "string" . ($var | 100); +$var = ($var | 100) . "string"; + +$var = $var . $var % $var; +$var = ($var . $var) % $var; +$var = $var % $var . $var; +$var = $var % ($var . $var); + +$var = "100" - "100" - "100"; +$var = "100" - "100" - "100"; +$var = "100" - ("100" - "100"); + +if (false || true) { +} +if (false || true) { +} +if (false or true) { +} +if (false or true) { +} +if (true && false) { +} +if (true && false) { +} +if (true and false) { +} +if (true and false) { +} + +if (!$foo or $bar == -1) { +} +if (!$foo or $bar == -1) { +} +if ((!$foo or $bar) == -1) { +} +if (!$foo or $bar == -1) { +} + +do { +} while ($foo and $bar); +while ($foo or $bar < 10) { +} +for ($foo or $bar; ; ) { +} +switch ($foo or $bar) { +} + +$a ** ($b ** $c); +($a ** $b) ** $c; +$a->b ** $c; +(-$a) ** $b; +$a ** -$b; +-($a ** $b); +($a * $b) ** $c; +$a ** ($b * $c); +($a % $b) ** $c; + +$var = $var + $var ?? ""; +$var = $var + ($var ?? ""); +$var = $var + $var ?? ""; +$var = $var ?? null + 1; +$var = ($var ?? null) + 1; +$var = $var && ($var ?? true); +$var = ($var ?? true) && $var; +$var = $var && ($var ?? null) === true; +$var = ($var ?? null) === true && $var; + +$findAll = $cachesNames === []; +$findAll = $cachesNames === []; + +$isNamespaced = strpos($fixture, "\\\\") !== false; +$isNamespaced = strpos($fixture, "\\\\") !== false; + +$var = $a["apply_time"] > $b["apply_time"] ? -1 : +1; +$var = $a["apply_time"] > $b["apply_time"] ? -1 : +1; + +$var = $page > 0 || ($page == 0 && $this->forcePageParam); +$var = $page > 0 || ($page == 0 && $this->forcePageParam); + +@foo() || @foo(); +@foo() || @foo(); +$var = @foo() || @foo(); +$var = @foo() || @foo(); + +@$i / 0; +@$i / 0; + +$var = "a" . (@$b ? "bar" : "baz"); + +$a = false && foo(); +$b = true || foo(); +$c = (false and foo()); +$d = (true or foo()); + +($f = false) or true; +($h = true) and false; + +($my_file = call("non_existent_file")) or + die("Failed opening file: error was '$php_errormsg'"); +($my_file = call("non_existent_file")) or + die("Failed opening file: error was '$php_errormsg'"); + +($my_file = call("non_existent_file")) and + die("Failed opening file: error was '$php_errormsg'"); +($my_file = call("non_existent_file")) and + die("Failed opening file: error was '$php_errormsg'"); + +$var = $obj->foo ?? "default"; +$var = $foo ? $bar ?? $foo : $baz; +$var = $foo ?? ($bar ?? $baz); +$var = ($foo ?? $baz) || $baz; +$var = $foo ?? $baz || $baz; +$var = $foo && $baz ?? $baz; +$var = $foo && ($baz ?? $baz); + +$result = 2 ** $number - 1; +$result = 2 ** $number - 1; +$result = 2 ** ($number - 1); + +================================================================================ +`; + +exports[`block.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +c()); +} + +=====================================output===================================== +c(); +} + +================================================================================ +`; + +exports[`block.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +c()); +} + +=====================================output===================================== +c(); +} + +================================================================================ +`; + +exports[`break.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +call(); +$var = ($foo)->call(); +$var = ($foo->call()); +$var = $foo->call()->call(); +$var = ($foo)->call()->call(); +$var = (($foo)->call())->call(); +$var = ((($foo)->call())->call()); + +$var = call((call())); +$var = call(...(call())); +$var = (call((call()))); +$var = (call((call()), (call()))); + +$var = $func(); +$var = ($func)(); +$var = ($func()); +$var = (($func)()); + +$var = $this->$name(); +$var = ($this)->$name(); +$var = ($this->$name()); +$var = (($this)->$name()); + +$var = Foo::call(); +$var = (Foo::call()); + +$var = (array("Foo", "bar"))(); +$var = (array(new Foo, "baz"))(); +$var = ((string) 1234)(); +$var = "Foo::bar"(); +$var = ("Foo::bar")(); + +call(($a), (($b)), ((($c)))); +call($a = $b); +call(($a = $b)); +call($a = new Foo()); +call(($a = new Foo())); +call($a = (new Foo())); +call(($a = (new Foo()))); +$foo->call(($a = (new Foo()))); +Foo::call(($a = (new Foo()))); + +=====================================output===================================== +call(); +$var = $foo->call(); +$var = $foo->call(); +$var = $foo->call()->call(); +$var = $foo->call()->call(); +$var = $foo->call()->call(); +$var = $foo->call()->call(); + +$var = call(call()); +$var = call(...call()); +$var = call(call()); +$var = call(call(), call()); + +$var = $func(); +$var = $func(); +$var = $func(); +$var = $func(); + +$var = $this->$name(); +$var = $this->$name(); +$var = $this->$name(); +$var = $this->$name(); + +$var = Foo::call(); +$var = Foo::call(); + +$var = (["Foo", "bar"])(); +$var = ([new Foo(), "baz"])(); +$var = ((string) 1234)(); +$var = ("Foo::bar")(); +$var = ("Foo::bar")(); + +call($a, $b, $c); +call($a = $b); +call($a = $b); +call($a = new Foo()); +call($a = new Foo()); +call($a = new Foo()); +call($a = new Foo()); +$foo->call($a = new Foo()); +Foo::call($a = new Foo()); + +================================================================================ +`; + +exports[`call.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +call(); +$var = ($foo)->call(); +$var = ($foo->call()); +$var = $foo->call()->call(); +$var = ($foo)->call()->call(); +$var = (($foo)->call())->call(); +$var = ((($foo)->call())->call()); + +$var = call((call())); +$var = call(...(call())); +$var = (call((call()))); +$var = (call((call()), (call()))); + +$var = $func(); +$var = ($func)(); +$var = ($func()); +$var = (($func)()); + +$var = $this->$name(); +$var = ($this)->$name(); +$var = ($this->$name()); +$var = (($this)->$name()); + +$var = Foo::call(); +$var = (Foo::call()); + +$var = (array("Foo", "bar"))(); +$var = (array(new Foo, "baz"))(); +$var = ((string) 1234)(); +$var = "Foo::bar"(); +$var = ("Foo::bar")(); + +call(($a), (($b)), ((($c)))); +call($a = $b); +call(($a = $b)); +call($a = new Foo()); +call(($a = new Foo())); +call($a = (new Foo())); +call(($a = (new Foo()))); +$foo->call(($a = (new Foo()))); +Foo::call(($a = (new Foo()))); + +=====================================output===================================== +call(); +$var = $foo->call(); +$var = $foo->call(); +$var = $foo->call()->call(); +$var = $foo->call()->call(); +$var = $foo->call()->call(); +$var = $foo->call()->call(); + +$var = call(call()); +$var = call(...call()); +$var = call(call()); +$var = call(call(), call()); + +$var = $func(); +$var = $func(); +$var = $func(); +$var = $func(); + +$var = $this->$name(); +$var = $this->$name(); +$var = $this->$name(); +$var = $this->$name(); + +$var = Foo::call(); +$var = Foo::call(); + +$var = (["Foo", "bar"])(); +$var = ([new Foo(), "baz"])(); +$var = ((string) 1234)(); +$var = ("Foo::bar")(); +$var = ("Foo::bar")(); + +call($a, $b, $c); +call($a = $b); +call($a = $b); +call($a = new Foo()); +call($a = new Foo()); +call($a = new Foo()); +call($a = new Foo()); +$foo->call($a = new Foo()); +Foo::call($a = new Foo()); + +================================================================================ +`; + +exports[`cast.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== + 'foo'))); +$var = ((object) (['1' => 'foo'])); +$var = ((object) 'ciao')->scalar; +$var = ((object) array('test'))->{'0'}; +$var = (((object) array('test'))->{'0'}); +$var = (array) new B(); +$var = (array) (new B()); +$var = ((array) (new B())); +$var = ((array) (new B()))['foo']; +$var = ((string) 1234)[1]; +$var = ((string) 123)(); +$var = ((string) (123))(); +$var = "test"[0]; +$var = (array) "test"[0]; +$var = ((array) "test")[0]; +$var = [(int) 'key' => (int) '1']; +$var = [((int) 'key') => ((int) '1')]; +$var = ([((int) 'key') => ((int) '1')]); +$var = (int) $raw['data'] + $value; +$var = ((int) $raw['data']) + $value; +$var = (bool) $var ? 1 : 2; +$var = (bool) ($var ? 1 : 2); +$var = (bool) $var + 1 ? 1 : 2; +$var = ((bool) $var) + 1 ? 1 : 2; +$var = (bool) ($var + 1) ? 1 : 2; +$var = ((bool) $var) ? 1 : 2; +$var = ((bool) $var) ? (bool) 1 : (bool) 2; +$var = ((bool) $var) ? ((bool) 1) : ((bool) 2); +$var = ((bool) $var) ? (bool) 1 + 2 : (bool) 2 + 3; +$var = ((bool) $var) ? ((bool) 1 + 2) : ((bool) 2 + 3); +$var = ((bool) $var) ? (bool) $var ? 1 : 2 : (bool) $var ? 1 : 2; +$var = ((bool) $var) ? ((bool) $var) ? 1 : 2 : ((bool) $var) ? 1 : 2; +$var = ((bool) $var) ? (bool) ($var ? 1 : 2) : (bool) ($var ? 1 : 2); +$var = (bool) ($var ? (bool) ($var ? 1 : 2) : (bool) ($var ? 1 : 2)); +$var = (bool) $var->foo; +$var = (bool) ($var->foo); +$var = ((bool) $var->foo); +$var = ((object) $var)->foo; +$var = ((object) $var)[0]; +$var = (int) 'test' + (int) 'test'; +$var = ((int) 'test') + ((int) 'test'); +$var = ((int) 'test') * ((int) 'test'); +$var = ((int) 'test') | ((int) 'test'); +$var = ((int) 'test') % ((int) 'test'); +$var = @((int) 'test'); +$var = @((int) call()); +$var = (int) (int) 1; +$var = (int) ((int) 1); +$var = call((int) $var, (int) call(), (int) $minutes * 60); +$var = call(((int) $var), ((int) call()), (int) ($minutes * 60)); +$var = $var + (int) $minutes * 60; +$var = $var + (int) ($minutes * 60); + +return (int) $var; +return ((int) $var); + +if ((int) 1 === 1) {} +if (1 === (int) 1) {} +if (((int) 1) === 1) {} +if (1 === ((int) 1)) {} +if ((int) 1 === (int) 1) {} +if (((int) 1) === (int) 1) {} +if ((int) 1 === ((int) 1)) {} +if (((int) (1)) === ((int) 1)) {} + +$var = (bool) call(); +$var = $var || (bool) call(); +$var = (bool) call() || $var; + +$var = (int) $var === 1; +$var = ((int) $var) === 1; +$var = (int) ($var === 1); + +$this->apc->put($this->prefix.$key, $value, (int) ($minutes * 60)); + +$timeout = (int) ($server->timeout / 1000) + (($server->timeout % 1000 > 0) ? 1 : 0); + +=====================================output===================================== + "foo"]); +$var = ((object) ["1" => "foo"]); +$var = ((object) "ciao")->scalar; +$var = ((object) ["test"])->{'0'}; +$var = ((object) ["test"])->{'0'}; +$var = (array) new B(); +$var = (array) new B(); +$var = ((array) new B()); +$var = ((array) new B())["foo"]; +$var = ((string) 1234)[1]; +$var = ((string) 123)(); +$var = ((string) 123)(); +$var = "test"[0]; +$var = (array) "test"[0]; +$var = ((array) "test")[0]; +$var = [(int) "key" => (int) "1"]; +$var = [((int) "key") => ((int) "1")]; +$var = [((int) "key") => ((int) "1")]; +$var = (int) $raw["data"] + $value; +$var = ((int) $raw["data"]) + $value; +$var = (bool) $var ? 1 : 2; +$var = (bool) ($var ? 1 : 2); +$var = (bool) $var + 1 ? 1 : 2; +$var = ((bool) $var) + 1 ? 1 : 2; +$var = (bool) ($var + 1) ? 1 : 2; +$var = ((bool) $var) ? 1 : 2; +$var = ((bool) $var) ? (bool) 1 : (bool) 2; +$var = ((bool) $var) ? ((bool) 1) : ((bool) 2); +$var = ((bool) $var) ? (bool) 1 + 2 : (bool) 2 + 3; +$var = ((bool) $var) ? (bool) 1 + 2 : (bool) 2 + 3; +$var = (((bool) $var) ? ((bool) $var ? 1 : 2) : (bool) $var) ? 1 : 2; +$var = (((bool) $var) ? (((bool) $var) ? 1 : 2) : ((bool) $var)) ? 1 : 2; +$var = ((bool) $var) ? (bool) ($var ? 1 : 2) : (bool) ($var ? 1 : 2); +$var = (bool) ($var ? (bool) ($var ? 1 : 2) : (bool) ($var ? 1 : 2)); +$var = (bool) $var->foo; +$var = (bool) $var->foo; +$var = ((bool) $var->foo); +$var = ((object) $var)->foo; +$var = ((object) $var)[0]; +$var = (int) "test" + (int) "test"; +$var = ((int) "test") + ((int) "test"); +$var = ((int) "test") * ((int) "test"); +$var = ((int) "test") | ((int) "test"); +$var = ((int) "test") % ((int) "test"); +$var = @((int) "test"); +$var = @((int) call()); +$var = (int) (int) 1; +$var = (int) ((int) 1); +$var = call((int) $var, (int) call(), (int) $minutes * 60); +$var = call(((int) $var), ((int) call()), (int) ($minutes * 60)); +$var = $var + (int) $minutes * 60; +$var = $var + (int) ($minutes * 60); + +return (int) $var; +return (int) $var; + +if ((int) 1 === 1) { +} +if (1 === (int) 1) { +} +if (((int) 1) === 1) { +} +if (1 === ((int) 1)) { +} +if ((int) 1 === (int) 1) { +} +if (((int) 1) === (int) 1) { +} +if ((int) 1 === ((int) 1)) { +} +if (((int) 1) === ((int) 1)) { +} + +$var = (bool) call(); +$var = $var || (bool) call(); +$var = (bool) call() || $var; + +$var = (int) $var === 1; +$var = ((int) $var) === 1; +$var = (int) ($var === 1); + +$this->apc->put($this->prefix . $key, $value, (int) ($minutes * 60)); + +$timeout = + (int) ($server->timeout / 1000) + ($server->timeout % 1000 > 0 ? 1 : 0); + +================================================================================ +`; + +exports[`cast.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 'foo'))); +$var = ((object) (['1' => 'foo'])); +$var = ((object) 'ciao')->scalar; +$var = ((object) array('test'))->{'0'}; +$var = (((object) array('test'))->{'0'}); +$var = (array) new B(); +$var = (array) (new B()); +$var = ((array) (new B())); +$var = ((array) (new B()))['foo']; +$var = ((string) 1234)[1]; +$var = ((string) 123)(); +$var = ((string) (123))(); +$var = "test"[0]; +$var = (array) "test"[0]; +$var = ((array) "test")[0]; +$var = [(int) 'key' => (int) '1']; +$var = [((int) 'key') => ((int) '1')]; +$var = ([((int) 'key') => ((int) '1')]); +$var = (int) $raw['data'] + $value; +$var = ((int) $raw['data']) + $value; +$var = (bool) $var ? 1 : 2; +$var = (bool) ($var ? 1 : 2); +$var = (bool) $var + 1 ? 1 : 2; +$var = ((bool) $var) + 1 ? 1 : 2; +$var = (bool) ($var + 1) ? 1 : 2; +$var = ((bool) $var) ? 1 : 2; +$var = ((bool) $var) ? (bool) 1 : (bool) 2; +$var = ((bool) $var) ? ((bool) 1) : ((bool) 2); +$var = ((bool) $var) ? (bool) 1 + 2 : (bool) 2 + 3; +$var = ((bool) $var) ? ((bool) 1 + 2) : ((bool) 2 + 3); +$var = ((bool) $var) ? (bool) $var ? 1 : 2 : (bool) $var ? 1 : 2; +$var = ((bool) $var) ? ((bool) $var) ? 1 : 2 : ((bool) $var) ? 1 : 2; +$var = ((bool) $var) ? (bool) ($var ? 1 : 2) : (bool) ($var ? 1 : 2); +$var = (bool) ($var ? (bool) ($var ? 1 : 2) : (bool) ($var ? 1 : 2)); +$var = (bool) $var->foo; +$var = (bool) ($var->foo); +$var = ((bool) $var->foo); +$var = ((object) $var)->foo; +$var = ((object) $var)[0]; +$var = (int) 'test' + (int) 'test'; +$var = ((int) 'test') + ((int) 'test'); +$var = ((int) 'test') * ((int) 'test'); +$var = ((int) 'test') | ((int) 'test'); +$var = ((int) 'test') % ((int) 'test'); +$var = @((int) 'test'); +$var = @((int) call()); +$var = (int) (int) 1; +$var = (int) ((int) 1); +$var = call((int) $var, (int) call(), (int) $minutes * 60); +$var = call(((int) $var), ((int) call()), (int) ($minutes * 60)); +$var = $var + (int) $minutes * 60; +$var = $var + (int) ($minutes * 60); + +return (int) $var; +return ((int) $var); + +if ((int) 1 === 1) {} +if (1 === (int) 1) {} +if (((int) 1) === 1) {} +if (1 === ((int) 1)) {} +if ((int) 1 === (int) 1) {} +if (((int) 1) === (int) 1) {} +if ((int) 1 === ((int) 1)) {} +if (((int) (1)) === ((int) 1)) {} + +$var = (bool) call(); +$var = $var || (bool) call(); +$var = (bool) call() || $var; + +$var = (int) $var === 1; +$var = ((int) $var) === 1; +$var = (int) ($var === 1); + +$this->apc->put($this->prefix.$key, $value, (int) ($minutes * 60)); + +$timeout = (int) ($server->timeout / 1000) + (($server->timeout % 1000 > 0) ? 1 : 0); + +=====================================output===================================== + "foo"]); +$var = ((object) ["1" => "foo"]); +$var = ((object) "ciao")->scalar; +$var = ((object) ["test"])->{'0'}; +$var = ((object) ["test"])->{'0'}; +$var = (array) new B(); +$var = (array) new B(); +$var = ((array) new B()); +$var = ((array) new B())["foo"]; +$var = ((string) 1234)[1]; +$var = ((string) 123)(); +$var = ((string) 123)(); +$var = "test"[0]; +$var = (array) "test"[0]; +$var = ((array) "test")[0]; +$var = [(int) "key" => (int) "1"]; +$var = [((int) "key") => ((int) "1")]; +$var = [((int) "key") => ((int) "1")]; +$var = (int) $raw["data"] + $value; +$var = ((int) $raw["data"]) + $value; +$var = (bool) $var ? 1 : 2; +$var = (bool) ($var ? 1 : 2); +$var = (bool) $var + 1 ? 1 : 2; +$var = ((bool) $var) + 1 ? 1 : 2; +$var = (bool) ($var + 1) ? 1 : 2; +$var = ((bool) $var) ? 1 : 2; +$var = ((bool) $var) ? (bool) 1 : (bool) 2; +$var = ((bool) $var) ? ((bool) 1) : ((bool) 2); +$var = ((bool) $var) ? (bool) 1 + 2 : (bool) 2 + 3; +$var = ((bool) $var) ? (bool) 1 + 2 : (bool) 2 + 3; +$var = (((bool) $var) ? ((bool) $var ? 1 : 2) : (bool) $var) ? 1 : 2; +$var = (((bool) $var) ? (((bool) $var) ? 1 : 2) : ((bool) $var)) ? 1 : 2; +$var = ((bool) $var) ? (bool) ($var ? 1 : 2) : (bool) ($var ? 1 : 2); +$var = (bool) ($var ? (bool) ($var ? 1 : 2) : (bool) ($var ? 1 : 2)); +$var = (bool) $var->foo; +$var = (bool) $var->foo; +$var = ((bool) $var->foo); +$var = ((object) $var)->foo; +$var = ((object) $var)[0]; +$var = (int) "test" + (int) "test"; +$var = ((int) "test") + ((int) "test"); +$var = ((int) "test") * ((int) "test"); +$var = ((int) "test") | ((int) "test"); +$var = ((int) "test") % ((int) "test"); +$var = @((int) "test"); +$var = @((int) call()); +$var = (int) (int) 1; +$var = (int) ((int) 1); +$var = call((int) $var, (int) call(), (int) $minutes * 60); +$var = call(((int) $var), ((int) call()), (int) ($minutes * 60)); +$var = $var + (int) $minutes * 60; +$var = $var + (int) ($minutes * 60); + +return (int) $var; +return (int) $var; + +if ((int) 1 === 1) { +} +if (1 === (int) 1) { +} +if (((int) 1) === 1) { +} +if (1 === ((int) 1)) { +} +if ((int) 1 === (int) 1) { +} +if (((int) 1) === (int) 1) { +} +if ((int) 1 === ((int) 1)) { +} +if (((int) 1) === ((int) 1)) { +} + +$var = (bool) call(); +$var = $var || (bool) call(); +$var = (bool) call() || $var; + +$var = (int) $var === 1; +$var = ((int) $var) === 1; +$var = (int) ($var === 1); + +$this->apc->put($this->prefix . $key, $value, (int) ($minutes * 60)); + +$timeout = + (int) ($server->timeout / 1000) + ($server->timeout % 1000 > 0 ? 1 : 0); + +================================================================================ +`; + +exports[`clone.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +foo; +$var = (clone $a->foo); +$var = (clone $a)->foo(); + +$var = (clone foo())->bar()->foo(); +$var = ((clone foo())->bar())->foo(); +$var = (((clone foo())->bar())->foo()); +$var = (((clone foo())->bar())->foo())[0]; +$var = ((((clone foo())->bar())->foo())[0])[1]; +$var = (((clone foo())->bar())->foo())->baz(); +$var = (clone $foo())->bar; +$var = (clone $bar->y)->x; +$var = (clone $foo)[0]; +$var = (clone $foo)[0]['string']; + +$var = clone $a->b; +$var = clone $a->b(); +$var = (clone $a)->b(); +$var = ((clone $a)->b()); + +$var = (clone ($var)); +$var = (clone($var)); +$var = (clone($var->foo)); +$var = (clone($var->foo))->foo; + +=====================================output===================================== +foo; +$var = clone $a->foo; +$var = (clone $a)->foo(); + +$var = (clone foo())->bar()->foo(); +$var = (clone foo())->bar()->foo(); +$var = (clone foo())->bar()->foo(); +$var = (clone foo())->bar()->foo()[0]; +$var = (clone foo())->bar()->foo()[0][1]; +$var = (clone foo())->bar()->foo()->baz(); +$var = (clone $foo())->bar; +$var = (clone $bar->y)->x; +$var = (clone $foo)[0]; +$var = (clone $foo)[0]["string"]; + +$var = clone $a->b; +$var = clone $a->b(); +$var = (clone $a)->b(); +$var = (clone $a)->b(); + +$var = clone $var; +$var = clone $var; +$var = clone $var->foo; +$var = (clone $var->foo)->foo; + +================================================================================ +`; + +exports[`clone.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo; +$var = (clone $a->foo); +$var = (clone $a)->foo(); + +$var = (clone foo())->bar()->foo(); +$var = ((clone foo())->bar())->foo(); +$var = (((clone foo())->bar())->foo()); +$var = (((clone foo())->bar())->foo())[0]; +$var = ((((clone foo())->bar())->foo())[0])[1]; +$var = (((clone foo())->bar())->foo())->baz(); +$var = (clone $foo())->bar; +$var = (clone $bar->y)->x; +$var = (clone $foo)[0]; +$var = (clone $foo)[0]['string']; + +$var = clone $a->b; +$var = clone $a->b(); +$var = (clone $a)->b(); +$var = ((clone $a)->b()); + +$var = (clone ($var)); +$var = (clone($var)); +$var = (clone($var->foo)); +$var = (clone($var->foo))->foo; + +=====================================output===================================== +foo; +$var = clone $a->foo; +$var = (clone $a)->foo(); + +$var = (clone foo())->bar()->foo(); +$var = (clone foo())->bar()->foo(); +$var = (clone foo())->bar()->foo(); +$var = (clone foo())->bar()->foo()[0]; +$var = (clone foo())->bar()->foo()[0][1]; +$var = (clone foo())->bar()->foo()->baz(); +$var = (clone $foo())->bar; +$var = (clone $bar->y)->x; +$var = (clone $foo)[0]; +$var = (clone $foo)[0]["string"]; + +$var = clone $a->b; +$var = clone $a->b(); +$var = (clone $a)->b(); +$var = (clone $a)->b(); + +$var = clone $var; +$var = clone $var; +$var = clone $var->foo; +$var = (clone $var->foo)->foo; + +================================================================================ +`; + +exports[`closure.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== + $b)) { + echo "a is bigger than b"; +} elseif (($a == $b)) { + echo "a is equal to b"; +} else { + echo "a is smaller than b"; +} + +while (($i <= 10)) { + echo $i++; +} + +do { + echo $i; +} while (($i > 0)); + +switch (($i)) { + case (0): + echo "i equals 0"; + break; + case ((1)): + echo "i equals 1"; + break; + case ('test' . ( 1 > 2 ? 'foo' : 'bar')): + echo "i equals 2"; + break; +} + +switch (($i + 1)) { + case (0): + echo "i equals 0"; + break; + case (1 + 2): + echo "i equals 1"; + break; + case (1 + ( 1 > 2 ? 1 : 3)): + echo "i equals 2"; + break; +} + +while (++$i) { + switch ($i) { + case 5: + echo "At 5
\\n"; + break (2); /* Exit only the switch. */ + case 10: + echo "At 10; quitting
\\n"; + break ((4)); /* Exit the switch and the while. */ + default: + break; + } +} + +while ($i++ < 5) { + echo "Outer
\\n"; + while (1) { + echo "Middle
\\n"; + while (1) { + echo "Inner
\\n"; + continue (3); + } + echo "This never gets output.
\\n"; + continue ((2)); + } + echo "Neither does this.
\\n"; +} + +if ($var = 1) {} +if (($var = 1)) {} +if ($var = 1) {} else if ($var = 1) {} else {} +if (($var = 1)) {} else if (($var = 1)) {} else {} +do {} while ($var = 1); +do {} while (($var = 1)); +while ($var = 1) {} +while (($var = 1)) {} +for ($i = 1; $i <= 10; $i++) {} +for (($i = 1); ($i <= 10); ($i++)) {} +foreach (($arr = [1, 2, 3]) as $value) {} +foreach (($arr) as $value) {} +foreach (($arr) as $key => $value) {} +foreach (($arr = [1, 2, 3]) as $key => $value) {} +switch ($var = 1) {} +switch (($var = 1)) {} + +while (list($id, $name, $salary) = $result->fetch(PDO::FETCH_NUM)) {} +while ([$id, $name, $salary] = $result->fetch(PDO::FETCH_NUM)) {} + +if (($foo = $bar) && count($foo) > 0) {} +if( false !== ($file = readdir($dh)) && 0 !== strpos($file,'.')){} +while (($a = foo()) !== 5) {} +while( false !== ($file = readdir($dh))){} +do {} while( false !== ($file = readdir($dh))); + +=====================================output===================================== + $b) { + echo "a is bigger than b"; +} elseif ($a == $b) { + echo "a is equal to b"; +} else { + echo "a is smaller than b"; +} + +while ($i <= 10) { + echo $i++; +} + +do { + echo $i; +} while ($i > 0); + +switch ($i) { + case 0: + echo "i equals 0"; + break; + case 1: + echo "i equals 1"; + break; + case "test" . (1 > 2 ? "foo" : "bar"): + echo "i equals 2"; + break; +} + +switch ($i + 1) { + case 0: + echo "i equals 0"; + break; + case 1 + 2: + echo "i equals 1"; + break; + case 1 + (1 > 2 ? 1 : 3): + echo "i equals 2"; + break; +} + +while (++$i) { + switch ($i) { + case 5: + echo "At 5
\\n"; + break 2; /* Exit only the switch. */ + case 10: + echo "At 10; quitting
\\n"; + break 4; /* Exit the switch and the while. */ + default: + break; + } +} + +while ($i++ < 5) { + echo "Outer
\\n"; + while (1) { + echo "Middle
\\n"; + while (1) { + echo "Inner
\\n"; + continue 3; + } + echo "This never gets output.
\\n"; + continue 2; + } + echo "Neither does this.
\\n"; +} + +if ($var = 1) { +} +if ($var = 1) { +} +if ($var = 1) { +} elseif ($var = 1) { +} else { +} +if ($var = 1) { +} elseif ($var = 1) { +} else { +} +do { +} while ($var = 1); +do { +} while ($var = 1); +while ($var = 1) { +} +while ($var = 1) { +} +for ($i = 1; $i <= 10; $i++) { +} +for ($i = 1; $i <= 10; $i++) { +} +foreach ($arr = [1, 2, 3] as $value) { +} +foreach ($arr as $value) { +} +foreach ($arr as $key => $value) { +} +foreach ($arr = [1, 2, 3] as $key => $value) { +} +switch ($var = 1) { +} +switch ($var = 1) { +} + +while ([$id, $name, $salary] = $result->fetch(PDO::FETCH_NUM)) { +} +while ([$id, $name, $salary] = $result->fetch(PDO::FETCH_NUM)) { +} + +if (($foo = $bar) && count($foo) > 0) { +} +if (false !== ($file = readdir($dh)) && 0 !== strpos($file, ".")) { +} +while (($a = foo()) !== 5) { +} +while (false !== ($file = readdir($dh))) { +} +do { +} while (false !== ($file = readdir($dh))); + +================================================================================ +`; + +exports[`control-structures.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + $b)) { + echo "a is bigger than b"; +} elseif (($a == $b)) { + echo "a is equal to b"; +} else { + echo "a is smaller than b"; +} + +while (($i <= 10)) { + echo $i++; +} + +do { + echo $i; +} while (($i > 0)); + +switch (($i)) { + case (0): + echo "i equals 0"; + break; + case ((1)): + echo "i equals 1"; + break; + case ('test' . ( 1 > 2 ? 'foo' : 'bar')): + echo "i equals 2"; + break; +} + +switch (($i + 1)) { + case (0): + echo "i equals 0"; + break; + case (1 + 2): + echo "i equals 1"; + break; + case (1 + ( 1 > 2 ? 1 : 3)): + echo "i equals 2"; + break; +} + +while (++$i) { + switch ($i) { + case 5: + echo "At 5
\\n"; + break (2); /* Exit only the switch. */ + case 10: + echo "At 10; quitting
\\n"; + break ((4)); /* Exit the switch and the while. */ + default: + break; + } +} + +while ($i++ < 5) { + echo "Outer
\\n"; + while (1) { + echo "Middle
\\n"; + while (1) { + echo "Inner
\\n"; + continue (3); + } + echo "This never gets output.
\\n"; + continue ((2)); + } + echo "Neither does this.
\\n"; +} + +if ($var = 1) {} +if (($var = 1)) {} +if ($var = 1) {} else if ($var = 1) {} else {} +if (($var = 1)) {} else if (($var = 1)) {} else {} +do {} while ($var = 1); +do {} while (($var = 1)); +while ($var = 1) {} +while (($var = 1)) {} +for ($i = 1; $i <= 10; $i++) {} +for (($i = 1); ($i <= 10); ($i++)) {} +foreach (($arr = [1, 2, 3]) as $value) {} +foreach (($arr) as $value) {} +foreach (($arr) as $key => $value) {} +foreach (($arr = [1, 2, 3]) as $key => $value) {} +switch ($var = 1) {} +switch (($var = 1)) {} + +while (list($id, $name, $salary) = $result->fetch(PDO::FETCH_NUM)) {} +while ([$id, $name, $salary] = $result->fetch(PDO::FETCH_NUM)) {} + +if (($foo = $bar) && count($foo) > 0) {} +if( false !== ($file = readdir($dh)) && 0 !== strpos($file,'.')){} +while (($a = foo()) !== 5) {} +while( false !== ($file = readdir($dh))){} +do {} while( false !== ($file = readdir($dh))); + +=====================================output===================================== + $b) { + echo "a is bigger than b"; +} elseif ($a == $b) { + echo "a is equal to b"; +} else { + echo "a is smaller than b"; +} + +while ($i <= 10) { + echo $i++; +} + +do { + echo $i; +} while ($i > 0); + +switch ($i) { + case 0: + echo "i equals 0"; + break; + case 1: + echo "i equals 1"; + break; + case "test" . (1 > 2 ? "foo" : "bar"): + echo "i equals 2"; + break; +} + +switch ($i + 1) { + case 0: + echo "i equals 0"; + break; + case 1 + 2: + echo "i equals 1"; + break; + case 1 + (1 > 2 ? 1 : 3): + echo "i equals 2"; + break; +} + +while (++$i) { + switch ($i) { + case 5: + echo "At 5
\\n"; + break 2; /* Exit only the switch. */ + case 10: + echo "At 10; quitting
\\n"; + break 4; /* Exit the switch and the while. */ + default: + break; + } +} + +while ($i++ < 5) { + echo "Outer
\\n"; + while (1) { + echo "Middle
\\n"; + while (1) { + echo "Inner
\\n"; + continue 3; + } + echo "This never gets output.
\\n"; + continue 2; + } + echo "Neither does this.
\\n"; +} + +if ($var = 1) { +} +if ($var = 1) { +} +if ($var = 1) { +} elseif ($var = 1) { +} else { +} +if ($var = 1) { +} elseif ($var = 1) { +} else { +} +do { +} while ($var = 1); +do { +} while ($var = 1); +while ($var = 1) { +} +while ($var = 1) { +} +for ($i = 1; $i <= 10; $i++) { +} +for ($i = 1; $i <= 10; $i++) { +} +foreach ($arr = [1, 2, 3] as $value) { +} +foreach ($arr as $value) { +} +foreach ($arr as $key => $value) { +} +foreach ($arr = [1, 2, 3] as $key => $value) { +} +switch ($var = 1) { +} +switch ($var = 1) { +} + +while ([$id, $name, $salary] = $result->fetch(PDO::FETCH_NUM)) { +} +while ([$id, $name, $salary] = $result->fetch(PDO::FETCH_NUM)) { +} + +if (($foo = $bar) && count($foo) > 0) { +} +if (false !== ($file = readdir($dh)) && 0 !== strpos($file, ".")) { +} +while (($a = foo()) !== 5) { +} +while (false !== ($file = readdir($dh))) { +} +do { +} while (false !== ($file = readdir($dh))); + +================================================================================ +`; + +exports[`declare.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +c()); + +=====================================output===================================== +c(); + +================================================================================ +`; + +exports[`declare.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +c()); + +=====================================output===================================== +c(); + +================================================================================ +`; + +exports[`echo.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +bar; +($var->bar); + +$var->bar(); +($var->bar()); + +$var::bar(); +($var::bar()); + +$var = $var->bar; +$var = ($var->bar); +$var = $var->bar->foo; +$var = ($var->bar)->foo; +$var = ($var->bar->foo); +$var = (($var->bar)->foo); + +$var = $var::foo(); +$var = ($var::foo()); +$var = $var::foo()::bar(); +$var = ($var::foo())::bar(); +$var = ($var::foo()::bar()); +$var = (($var::foo())::bar()); + +$var = $var->bar(); +$var = ($var->bar()); +$var = $var->bar()->foo(); +$var = ($var->bar())->foo(); +$var = ($var->bar()->foo()); +$var = (($var->bar())->foo()); + +$var = ((object) ($var->bar())->foo()); +$var = (object) (($var->bar())->foo()); + +$var = $var[0]; +$var = $var[0][1]; +$var = ($var[0]); +$var = ($var[0][1]); +$var = $var[0]->foo; +$var = ($var[0])->foo; +$var = ($var[0][1])->foo; +$var = ($var[0])[1]->foo; +$var = (($var[0])[1])->foo; +$var = $var[0]::foo; +$var = ($var[0])::foo; +$var = ($var[0][1])::foo; +$var = ($var[0])[1]::foo; +$var = (($var[0])[1])::foo; +$var = $var[0]->foo(); +$var = ($var[0])->foo(); +$var = ($var[0][1])->foo(); +$var = ($var[0])[1]->foo(); +$var = (($var[0])[1])->foo(); +$var = $var[0]::foo(); +$var = ($var[0])::foo(); +$var = ($var[0][1])::foo(); +$var = ($var[0])[1]::foo(); +$var = (($var[0])[1])::foo(); + +$var = $var[0]->foo()->baz; +$var = ((($var[0])->foo())->baz); + +$var = (new Foo())->bar; +$var = (new Foo())::bar; +$var = (new Foo())->bar(); +$var = (new Foo())::bar(); +$var = (new Foo())[1]; + +$var = $var->bar()(); +$var = ($var->bar())(); +$var = ($var->bar()()); +$var = (($var->bar())()); + +$var = $var::bar()(); +$var = ($var::bar())(); +$var = ($var::bar()()); +$var = (($var::bar())()); + +$var = ($var)->bar; +$var = (($var)->bar); +$var = ($var)->bar(); +$var = (($var)->bar()); + +$var = (function () { + return $this->foo; +})->bindTo($var, A::class)(); +$var = (((function () { + return $this->foo; +})))->bindTo($var, A::class)(); + +=====================================output===================================== +bar; +$var->bar; + +$var->bar(); +$var->bar(); + +$var::bar(); +$var::bar(); + +$var = $var->bar; +$var = $var->bar; +$var = $var->bar->foo; +$var = $var->bar->foo; +$var = $var->bar->foo; +$var = $var->bar->foo; + +$var = $var::foo(); +$var = $var::foo(); +$var = $var::foo()::bar(); +$var = $var::foo()::bar(); +$var = $var::foo()::bar(); +$var = $var::foo()::bar(); + +$var = $var->bar(); +$var = $var->bar(); +$var = $var->bar()->foo(); +$var = $var->bar()->foo(); +$var = $var->bar()->foo(); +$var = $var->bar()->foo(); + +$var = ((object) $var->bar()->foo()); +$var = (object) $var->bar()->foo(); + +$var = $var[0]; +$var = $var[0][1]; +$var = $var[0]; +$var = $var[0][1]; +$var = $var[0]->foo; +$var = $var[0]->foo; +$var = $var[0][1]->foo; +$var = $var[0][1]->foo; +$var = $var[0][1]->foo; +$var = $var[0]::foo; +$var = $var[0]::foo; +$var = $var[0][1]::foo; +$var = $var[0][1]::foo; +$var = $var[0][1]::foo; +$var = $var[0]->foo(); +$var = $var[0]->foo(); +$var = $var[0][1]->foo(); +$var = $var[0][1]->foo(); +$var = $var[0][1]->foo(); +$var = $var[0]::foo(); +$var = $var[0]::foo(); +$var = $var[0][1]::foo(); +$var = $var[0][1]::foo(); +$var = $var[0][1]::foo(); + +$var = $var[0]->foo()->baz; +$var = $var[0]->foo()->baz; + +$var = (new Foo())->bar; +$var = (new Foo())::bar; +$var = (new Foo())->bar(); +$var = (new Foo())::bar(); +$var = (new Foo())[1]; + +$var = $var->bar()(); +$var = $var->bar()(); +$var = $var->bar()(); +$var = $var->bar()(); + +$var = $var::bar()(); +$var = $var::bar()(); +$var = $var::bar()(); +$var = $var::bar()(); + +$var = $var->bar; +$var = $var->bar; +$var = $var->bar(); +$var = $var->bar(); + +$var = (function () { + return $this->foo; +})->bindTo($var, A::class)(); +$var = (function () { + return $this->foo; +})->bindTo($var, A::class)(); + +================================================================================ +`; + +exports[`lookups.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +bar; +($var->bar); + +$var->bar(); +($var->bar()); + +$var::bar(); +($var::bar()); + +$var = $var->bar; +$var = ($var->bar); +$var = $var->bar->foo; +$var = ($var->bar)->foo; +$var = ($var->bar->foo); +$var = (($var->bar)->foo); + +$var = $var::foo(); +$var = ($var::foo()); +$var = $var::foo()::bar(); +$var = ($var::foo())::bar(); +$var = ($var::foo()::bar()); +$var = (($var::foo())::bar()); + +$var = $var->bar(); +$var = ($var->bar()); +$var = $var->bar()->foo(); +$var = ($var->bar())->foo(); +$var = ($var->bar()->foo()); +$var = (($var->bar())->foo()); + +$var = ((object) ($var->bar())->foo()); +$var = (object) (($var->bar())->foo()); + +$var = $var[0]; +$var = $var[0][1]; +$var = ($var[0]); +$var = ($var[0][1]); +$var = $var[0]->foo; +$var = ($var[0])->foo; +$var = ($var[0][1])->foo; +$var = ($var[0])[1]->foo; +$var = (($var[0])[1])->foo; +$var = $var[0]::foo; +$var = ($var[0])::foo; +$var = ($var[0][1])::foo; +$var = ($var[0])[1]::foo; +$var = (($var[0])[1])::foo; +$var = $var[0]->foo(); +$var = ($var[0])->foo(); +$var = ($var[0][1])->foo(); +$var = ($var[0])[1]->foo(); +$var = (($var[0])[1])->foo(); +$var = $var[0]::foo(); +$var = ($var[0])::foo(); +$var = ($var[0][1])::foo(); +$var = ($var[0])[1]::foo(); +$var = (($var[0])[1])::foo(); + +$var = $var[0]->foo()->baz; +$var = ((($var[0])->foo())->baz); + +$var = (new Foo())->bar; +$var = (new Foo())::bar; +$var = (new Foo())->bar(); +$var = (new Foo())::bar(); +$var = (new Foo())[1]; + +$var = $var->bar()(); +$var = ($var->bar())(); +$var = ($var->bar()()); +$var = (($var->bar())()); + +$var = $var::bar()(); +$var = ($var::bar())(); +$var = ($var::bar()()); +$var = (($var::bar())()); + +$var = ($var)->bar; +$var = (($var)->bar); +$var = ($var)->bar(); +$var = (($var)->bar()); + +$var = (function () { + return $this->foo; +})->bindTo($var, A::class)(); +$var = (((function () { + return $this->foo; +})))->bindTo($var, A::class)(); + +=====================================output===================================== +bar; +$var->bar; + +$var->bar(); +$var->bar(); + +$var::bar(); +$var::bar(); + +$var = $var->bar; +$var = $var->bar; +$var = $var->bar->foo; +$var = $var->bar->foo; +$var = $var->bar->foo; +$var = $var->bar->foo; + +$var = $var::foo(); +$var = $var::foo(); +$var = $var::foo()::bar(); +$var = $var::foo()::bar(); +$var = $var::foo()::bar(); +$var = $var::foo()::bar(); + +$var = $var->bar(); +$var = $var->bar(); +$var = $var->bar()->foo(); +$var = $var->bar()->foo(); +$var = $var->bar()->foo(); +$var = $var->bar()->foo(); + +$var = ((object) $var->bar()->foo()); +$var = (object) $var->bar()->foo(); + +$var = $var[0]; +$var = $var[0][1]; +$var = $var[0]; +$var = $var[0][1]; +$var = $var[0]->foo; +$var = $var[0]->foo; +$var = $var[0][1]->foo; +$var = $var[0][1]->foo; +$var = $var[0][1]->foo; +$var = $var[0]::foo; +$var = $var[0]::foo; +$var = $var[0][1]::foo; +$var = $var[0][1]::foo; +$var = $var[0][1]::foo; +$var = $var[0]->foo(); +$var = $var[0]->foo(); +$var = $var[0][1]->foo(); +$var = $var[0][1]->foo(); +$var = $var[0][1]->foo(); +$var = $var[0]::foo(); +$var = $var[0]::foo(); +$var = $var[0][1]::foo(); +$var = $var[0][1]::foo(); +$var = $var[0][1]::foo(); + +$var = $var[0]->foo()->baz; +$var = $var[0]->foo()->baz; + +$var = new Foo()->bar; +$var = new Foo()::bar; +$var = new Foo()->bar(); +$var = new Foo()::bar(); +$var = new Foo()[1]; + +$var = $var->bar()(); +$var = $var->bar()(); +$var = $var->bar()(); +$var = $var->bar()(); + +$var = $var::bar()(); +$var = $var::bar()(); +$var = $var::bar()(); +$var = $var::bar()(); + +$var = $var->bar; +$var = $var->bar; +$var = $var->bar(); +$var = $var->bar(); + +$var = (function () { + return $this->foo; +})->bindTo($var, A::class)(); +$var = (function () { + return $this->foo; +})->bindTo($var, A::class)(); + +================================================================================ +`; + +exports[`namespace.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +c()); + +=====================================output===================================== +c(); + +================================================================================ +`; + +exports[`namespace.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +c()); + +=====================================output===================================== +c(); + +================================================================================ +`; + +exports[`new.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== + 'bar') +)) +?> + 'bar') +)))) +?> + 'bar'] +)) +?> +c(); +new Foo->prop; +new Foo->method(); +new Foo->$var; +$var = (new class { + public function log($msg) + { + echo $msg; + } +}); +$var = (new foo())->bar(); +$var = (new foo())->bar()->foo(); +$var = ((new foo())->bar())->foo(); +$var = (((new foo())->bar())->foo()); +$var = (((new foo())->bar())->foo())[0]; +$var = ((((new foo())->bar())->foo())[0])[1]; +$var = (((new foo())->bar())->foo())->baz(); +$var = (new $foo())->bar; +$var = (new $bar->y)->x; +new SortOfLongClassName()->withALongMethodName()->andAnother()->toPushItPast80Chars(); +$asdf = +new SortOfLongClassName()->withALongMethodName() + ->andAnother()->toPushItPast80Chars(); + +$var = (new foo)[0]; +$var = (new foo)[0]['string']; + +$var = (new Foo)::foo; +$var = (new Foo)::$foo; + +$var = new $a->b; +$var = new $a->b(); +$var = (new $a)->b(); +$var = ((new $a)->b()); + +(new class {})->foo; +(new class {})->foo(); +(new class {})(); +(new class {})['foo']; + +$var = (new class {})->foo; + +=====================================output===================================== + "bar"], +); ?> + "bar", +]); ?> + "bar", +]); ?> +c(); +(new Foo())->prop; +(new Foo())->method(); +(new Foo())->$var; +$var = new class { + public function log($msg) + { + echo $msg; + } +}; +$var = (new foo())->bar(); +$var = (new foo())->bar()->foo(); +$var = (new foo())->bar()->foo(); +$var = (new foo())->bar()->foo(); +$var = (new foo())->bar()->foo()[0]; +$var = (new foo())->bar()->foo()[0][1]; +$var = (new foo())->bar()->foo()->baz(); +$var = (new $foo())->bar; +$var = (new $bar->y())->x; +(new SortOfLongClassName()) + ->withALongMethodName() + ->andAnother() + ->toPushItPast80Chars(); +$asdf = (new SortOfLongClassName()) + ->withALongMethodName() + ->andAnother() + ->toPushItPast80Chars(); +$var = (new foo())[0]; +$var = (new foo())[0]["string"]; +$var = (new Foo())::foo; +$var = (new Foo())::$foo; +$var = new $a->b(); +$var = new $a->b(); +$var = (new $a())->b(); +$var = (new $a())->b(); +(new class {})->foo; +(new class {})->foo(); +(new class {})(); +(new class {})["foo"]; +$var = (new class {})->foo; + + +================================================================================ +`; + +exports[`new.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 'bar') +)) +?> + 'bar') +)))) +?> + 'bar'] +)) +?> +c(); +new Foo->prop; +new Foo->method(); +new Foo->$var; +$var = (new class { + public function log($msg) + { + echo $msg; + } +}); +$var = (new foo())->bar(); +$var = (new foo())->bar()->foo(); +$var = ((new foo())->bar())->foo(); +$var = (((new foo())->bar())->foo()); +$var = (((new foo())->bar())->foo())[0]; +$var = ((((new foo())->bar())->foo())[0])[1]; +$var = (((new foo())->bar())->foo())->baz(); +$var = (new $foo())->bar; +$var = (new $bar->y)->x; +new SortOfLongClassName()->withALongMethodName()->andAnother()->toPushItPast80Chars(); +$asdf = +new SortOfLongClassName()->withALongMethodName() + ->andAnother()->toPushItPast80Chars(); + +$var = (new foo)[0]; +$var = (new foo)[0]['string']; + +$var = (new Foo)::foo; +$var = (new Foo)::$foo; + +$var = new $a->b; +$var = new $a->b(); +$var = (new $a)->b(); +$var = ((new $a)->b()); + +(new class {})->foo; +(new class {})->foo(); +(new class {})(); +(new class {})['foo']; + +$var = (new class {})->foo; + +=====================================output===================================== + "bar"], +); ?> + "bar", +]); ?> + "bar", +]); ?> +c(); +new Foo()->prop; +new Foo()->method(); +new Foo()->$var; +$var = new class { + public function log($msg) + { + echo $msg; + } +}; +$var = new foo()->bar(); +$var = new foo()->bar()->foo(); +$var = new foo()->bar()->foo(); +$var = new foo()->bar()->foo(); +$var = new foo()->bar()->foo()[0]; +$var = new foo()->bar()->foo()[0][1]; +$var = new foo()->bar()->foo()->baz(); +$var = new $foo()->bar; +$var = new $bar->y()->x; +new SortOfLongClassName() + ->withALongMethodName() + ->andAnother() + ->toPushItPast80Chars(); +$asdf = new SortOfLongClassName() + ->withALongMethodName() + ->andAnother() + ->toPushItPast80Chars(); +$var = new foo()[0]; +$var = new foo()[0]["string"]; +$var = new Foo()::foo; +$var = new Foo()::$foo; +$var = new $a->b(); +$var = new $a->b(); +$var = new $a()->b(); +$var = new $a()->b(); +new class {}->foo; +new class {}->foo(); +new class {}(); +new class {}["foo"]; +$var = new class {}->foo; + + +================================================================================ +`; + +exports[`parens.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +b++; +($a->b++); +++$a->b; +(++$a)->b; + +($a->b++)->call(); +($a->b++)[1]; +($var++)(); +$var = call($var->_uuidCounter++); + +(--$a->b)->call(); +(--$a->b)[1]; +(--$var)(); +$var = call(--$var->_uuidCounter); + +=====================================output===================================== +b++; +$a->b++; +++$a->b; +(++$a)->b; + +($a->b++)->call(); +($a->b++)[1]; +($var++)(); +$var = call($var->_uuidCounter++); + +(--$a->b)->call(); +(--$a->b)[1]; +(--$var)(); +$var = call(--$var->_uuidCounter); + +================================================================================ +`; + +exports[`pre-post.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +b++; +($a->b++); +++$a->b; +(++$a)->b; + +($a->b++)->call(); +($a->b++)[1]; +($var++)(); +$var = call($var->_uuidCounter++); + +(--$a->b)->call(); +(--$a->b)[1]; +(--$var)(); +$var = call(--$var->_uuidCounter); + +=====================================output===================================== +b++; +$a->b++; +++$a->b; +(++$a)->b; + +($a->b++)->call(); +($a->b++)[1]; +($var++)(); +$var = call($var->_uuidCounter++); + +(--$a->b)->call(); +(--$a->b)[1]; +(--$var)(); +$var = call(--$var->_uuidCounter); + +================================================================================ +`; + +exports[`print.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +" : print "$string_message\\n"; +$var = $var ? (print "$string_message
") : (print "$string_message\\n"); +$var = $var ? (print ("$string_message
")) : (print ("$string_message\\n")); + +print 1 . print(2) + 3; // 511 +print 1 . (print(2)) + 3; // 214 + +print ($var || $var) && $var; +print (($var || $var) && $var); + +=====================================output===================================== +" : print "$string_message\\n"; +$var = $var ? print "$string_message
" : print "$string_message\\n"; +$var = $var ? print "$string_message
" : print "$string_message\\n"; + +print 1 . (print 2 + 3); // 511 +print 1 . (print 2) + 3; // 214 + +print ($var || $var) && $var; +print ($var || $var) && $var; + +================================================================================ +`; + +exports[`print.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +" : print "$string_message\\n"; +$var = $var ? (print "$string_message
") : (print "$string_message\\n"); +$var = $var ? (print ("$string_message
")) : (print ("$string_message\\n")); + +print 1 . print(2) + 3; // 511 +print 1 . (print(2)) + 3; // 214 + +print ($var || $var) && $var; +print (($var || $var) && $var); + +=====================================output===================================== +" : print "$string_message\\n"; +$var = $var ? print "$string_message
" : print "$string_message\\n"; +$var = $var ? print "$string_message
" : print "$string_message\\n"; + +print 1 . (print 2 + 3); // 511 +print 1 . (print 2) + 3; // 214 + +print ($var || $var) && $var; +print ($var || $var) && $var; + +================================================================================ +`; + +exports[`program.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +c()); + +=====================================output===================================== +c(); + +================================================================================ +`; + +exports[`program.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +c()); + +=====================================output===================================== +c(); + +================================================================================ +`; + +exports[`retif.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +prop; +($var ? $var : $var)->prop(); +($var ? $var : $var)[1]; +($var ? $var : $var)->d(); +($var ? $var : $var)->d()->e(); +($var ? $var : $var)->d()->e()->f(); +($var + ? $var->responseBody($var->currentUser) + : $var->responseBody($var->defaultUser)) +->map(); +($var + ? $var.responseBody($var->currentUser) + : $var.responseBody($var->defaultUser)) +->map()->filter(); +($var + ? $var.responseBody($var->currentUser) + : $var.responseBody($var)) +->map(); +$var[$var + ? $var->responseBody($var->currentUser) + : $var->responseBody($var)] +->map(); + +$var = $var . $var ? "()" : ""; +$var = ($var . $var) ? "()" : ""; +$var = $var . ($var ? "()" : ""); +$var = +($var ? 1 : 2); +$var = +(+$var ? 1 : 2); +$var = +($var++ ? 1 : 2); +$var = ((true ? 'true' : false) ? (true ? 'true' : false) : (true ? 'true' : false)); +$var = $var ? $var1 ? 1 : 2 : $var2 ? 3 : 4; + +$var = $var ?: $var ?: $var ?: 'string'; +$var = ($var ?: $var) ?: $var ?: 'string'; +$var = (($var ?: $var) ?: $var) ?: 'string'; +$var = ((($var ?: $var) ?: $var) ?: 'string'); +$var = ($var ?: ($var ?: $var)) ?: 'string'; +$var = ($var ?: (($var ?: $var) ?: 'string')); +$var = ($var ?: ($var ?: ($var ?: 'string'))); + +$var = ($foo and $bar) ? true : false; +$var = ($foo or $bar) ? true : false; +$var = ($foo xor $bar) ? true : false; +$var = ($foo = "bar") ? true : false; + +$var = ($foo && $bar) ? true : false; +$var = ($foo || $bar) ? true : false; +$var = (!$foo) ? true : false; +$var = (new $foo) ? true : false; + +=====================================output===================================== +prop; +($var ? $var : $var)->prop(); +($var ? $var : $var)[1]; +($var ? $var : $var)->d(); +($var ? $var : $var)->d()->e(); +($var ? $var : $var)->d()->e()->f(); +($var + ? $var->responseBody($var->currentUser) + : $var->responseBody($var->defaultUser) +)->map(); +($var + ? $var . responseBody($var->currentUser) + : $var . responseBody($var->defaultUser) +) + ->map() + ->filter(); +($var + ? $var . responseBody($var->currentUser) + : $var . responseBody($var) +)->map(); +$var[ + $var ? $var->responseBody($var->currentUser) : $var->responseBody($var) +]->map(); + +$var = $var . $var ? "()" : ""; +$var = $var . $var ? "()" : ""; +$var = $var . ($var ? "()" : ""); +$var = +($var ? 1 : 2); +$var = +(+$var ? 1 : 2); +$var = +($var++ ? 1 : 2); +$var = (true + ? "true" + : false) + ? (true + ? "true" + : false) + : (true + ? "true" + : false); +$var = ($var ? ($var1 ? 1 : 2) : $var2) ? 3 : 4; + +$var = $var ?: $var ?: $var ?: "string"; +$var = $var ?: $var ?: $var ?: "string"; +$var = $var ?: $var ?: $var ?: "string"; +$var = $var ?: $var ?: $var ?: "string"; +$var = $var ?: ($var ?: $var) ?: "string"; +$var = $var ?: ($var ?: $var ?: "string"); +$var = $var ?: ($var ?: ($var ?: "string")); + +$var = ($foo and $bar) ? true : false; +$var = ($foo or $bar) ? true : false; +$var = ($foo xor $bar) ? true : false; +$var = ($foo = "bar") ? true : false; + +$var = $foo && $bar ? true : false; +$var = $foo || $bar ? true : false; +$var = !$foo ? true : false; +$var = new $foo() ? true : false; + +================================================================================ +`; + +exports[`retif.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +prop; +($var ? $var : $var)->prop(); +($var ? $var : $var)[1]; +($var ? $var : $var)->d(); +($var ? $var : $var)->d()->e(); +($var ? $var : $var)->d()->e()->f(); +($var + ? $var->responseBody($var->currentUser) + : $var->responseBody($var->defaultUser)) +->map(); +($var + ? $var.responseBody($var->currentUser) + : $var.responseBody($var->defaultUser)) +->map()->filter(); +($var + ? $var.responseBody($var->currentUser) + : $var.responseBody($var)) +->map(); +$var[$var + ? $var->responseBody($var->currentUser) + : $var->responseBody($var)] +->map(); + +$var = $var . $var ? "()" : ""; +$var = ($var . $var) ? "()" : ""; +$var = $var . ($var ? "()" : ""); +$var = +($var ? 1 : 2); +$var = +(+$var ? 1 : 2); +$var = +($var++ ? 1 : 2); +$var = ((true ? 'true' : false) ? (true ? 'true' : false) : (true ? 'true' : false)); +$var = $var ? $var1 ? 1 : 2 : $var2 ? 3 : 4; + +$var = $var ?: $var ?: $var ?: 'string'; +$var = ($var ?: $var) ?: $var ?: 'string'; +$var = (($var ?: $var) ?: $var) ?: 'string'; +$var = ((($var ?: $var) ?: $var) ?: 'string'); +$var = ($var ?: ($var ?: $var)) ?: 'string'; +$var = ($var ?: (($var ?: $var) ?: 'string')); +$var = ($var ?: ($var ?: ($var ?: 'string'))); + +$var = ($foo and $bar) ? true : false; +$var = ($foo or $bar) ? true : false; +$var = ($foo xor $bar) ? true : false; +$var = ($foo = "bar") ? true : false; + +$var = ($foo && $bar) ? true : false; +$var = ($foo || $bar) ? true : false; +$var = (!$foo) ? true : false; +$var = (new $foo) ? true : false; + +=====================================output===================================== +prop; +($var ? $var : $var)->prop(); +($var ? $var : $var)[1]; +($var ? $var : $var)->d(); +($var ? $var : $var)->d()->e(); +($var ? $var : $var)->d()->e()->f(); +($var + ? $var->responseBody($var->currentUser) + : $var->responseBody($var->defaultUser) +)->map(); +($var + ? $var . responseBody($var->currentUser) + : $var . responseBody($var->defaultUser) +) + ->map() + ->filter(); +($var + ? $var . responseBody($var->currentUser) + : $var . responseBody($var) +)->map(); +$var[ + $var ? $var->responseBody($var->currentUser) : $var->responseBody($var) +]->map(); + +$var = $var . $var ? "()" : ""; +$var = $var . $var ? "()" : ""; +$var = $var . ($var ? "()" : ""); +$var = +($var ? 1 : 2); +$var = +(+$var ? 1 : 2); +$var = +($var++ ? 1 : 2); +$var = (true + ? "true" + : false) + ? (true + ? "true" + : false) + : (true + ? "true" + : false); +$var = ($var ? ($var1 ? 1 : 2) : $var2) ? 3 : 4; + +$var = $var ?: $var ?: $var ?: "string"; +$var = $var ?: $var ?: $var ?: "string"; +$var = $var ?: $var ?: $var ?: "string"; +$var = $var ?: $var ?: $var ?: "string"; +$var = $var ?: ($var ?: $var) ?: "string"; +$var = $var ?: ($var ?: $var ?: "string"); +$var = $var ?: ($var ?: ($var ?: "string")); + +$var = ($foo and $bar) ? true : false; +$var = ($foo or $bar) ? true : false; +$var = ($foo xor $bar) ? true : false; +$var = ($foo = "bar") ? true : false; + +$var = $foo && $bar ? true : false; +$var = $foo || $bar ? true : false; +$var = !$foo ? true : false; +$var = new $foo() ? true : false; + +================================================================================ +`; + +exports[`return.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +customer->paymentService ?? null); + + +=====================================output===================================== +customer->paymentService ?? null; + +================================================================================ +`; + +exports[`return.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +customer->paymentService ?? null); + + +=====================================output===================================== +customer->paymentService ?? null; + +================================================================================ +`; + +exports[`silent.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) { + // should never happen + throw new RuntimeException('Unable to write output.'); +} + +try { + if (($fp = @fopen($filename, "r")) == false) { + throw new Exception; + } else { + do_file_stuff(); + } +} catch (Exception $e) { + handle_exception(); +} + +@list($width, $height) = getimagesize($file); +// Todo https://github.com/glayzzle/php-parser/issues/356 +// @(list($width, $height) = getimagesize($file)); + +@$var += 10; +// Todo https://github.com/glayzzle/php-parser/issues/356 +// @($var += 10); + +echo @(1 / 0); + +@$i / 0; +@($i / 0); + +=====================================output===================================== +stream, $message) || + ($newline && false === @fwrite($this->stream, PHP_EOL)) +) { + // should never happen + throw new RuntimeException("Unable to write output."); +} + +try { + if (($fp = @fopen($filename, "r")) == false) { + throw new Exception(); + } else { + do_file_stuff(); + } +} catch (Exception $e) { + handle_exception(); +} + +@[$width, $height] = getimagesize($file); +// Todo https://github.com/glayzzle/php-parser/issues/356 +// @(list($width, $height) = getimagesize($file)); + +@$var += 10; +// Todo https://github.com/glayzzle/php-parser/issues/356 +// @($var += 10); + +echo @(1 / 0); + +@$i / 0; +@($i / 0); + +================================================================================ +`; + +exports[`silent.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) { + // should never happen + throw new RuntimeException('Unable to write output.'); +} + +try { + if (($fp = @fopen($filename, "r")) == false) { + throw new Exception; + } else { + do_file_stuff(); + } +} catch (Exception $e) { + handle_exception(); +} + +@list($width, $height) = getimagesize($file); +// Todo https://github.com/glayzzle/php-parser/issues/356 +// @(list($width, $height) = getimagesize($file)); + +@$var += 10; +// Todo https://github.com/glayzzle/php-parser/issues/356 +// @($var += 10); + +echo @(1 / 0); + +@$i / 0; +@($i / 0); + +=====================================output===================================== +stream, $message) || + ($newline && false === @fwrite($this->stream, PHP_EOL)) +) { + // should never happen + throw new RuntimeException("Unable to write output."); +} + +try { + if (($fp = @fopen($filename, "r")) == false) { + throw new Exception(); + } else { + do_file_stuff(); + } +} catch (Exception $e) { + handle_exception(); +} + +@[$width, $height] = getimagesize($file); +// Todo https://github.com/glayzzle/php-parser/issues/356 +// @(list($width, $height) = getimagesize($file)); + +@$var += 10; +// Todo https://github.com/glayzzle/php-parser/issues/356 +// @($var += 10); + +echo @(1 / 0); + +@$i / 0; +@($i / 0); + +================================================================================ +`; + +exports[`throw.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== + throw new \\RuntimeException('In arrow function'); +$value = $a ? $a : throw new \\InvalidArgumentException('In ternary'); +=====================================output===================================== + throw new \\RuntimeException("In arrow function"); +$value = $a ? $a : throw new \\InvalidArgumentException("In ternary"); + +================================================================================ +`; + +exports[`throw.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + throw new \\RuntimeException('In arrow function'); +$value = $a ? $a : throw new \\InvalidArgumentException('In ternary'); +=====================================output===================================== + throw new \\RuntimeException("In arrow function"); +$value = $a ? $a : throw new \\InvalidArgumentException("In ternary"); + +================================================================================ +`; + +exports[`unary.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +bar); + +$var = +$var || +$var; +$var = (+$var) || (+$var); +$var = ((+$var) || (+$var)); + +$var = -(+($var)); + +$var = ~(+$var); + +$var = ~$var += 1; +$var = ~($var += 1); + +(+$a->b)->call(); +(+$a->b)[1]; +(+$var)(); +$var = call(+$var->_uuidCounter); + +if (!$token = $this->getToken()) {} +if (!($token = $this->getToken())) {} + +=====================================output===================================== +bar; + +$var = +$var || +$var; +$var = +$var || +$var; +$var = +$var || +$var; + +$var = -+$var; + +$var = ~+$var; + +$var = ~($var += 1); +$var = ~($var += 1); + +(+$a->b)->call(); +(+$a->b)[1]; +(+$var)(); +$var = call(+$var->_uuidCounter); + +if (!($token = $this->getToken())) { +} +if (!($token = $this->getToken())) { +} + +================================================================================ +`; + +exports[`unary.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +bar); + +$var = +$var || +$var; +$var = (+$var) || (+$var); +$var = ((+$var) || (+$var)); + +$var = -(+($var)); + +$var = ~(+$var); + +$var = ~$var += 1; +$var = ~($var += 1); + +(+$a->b)->call(); +(+$a->b)[1]; +(+$var)(); +$var = call(+$var->_uuidCounter); + +if (!$token = $this->getToken()) {} +if (!($token = $this->getToken())) {} + +=====================================output===================================== +bar; + +$var = +$var || +$var; +$var = +$var || +$var; +$var = +$var || +$var; + +$var = -+$var; + +$var = ~+$var; + +$var = ~($var += 1); +$var = ~($var += 1); + +(+$a->b)->call(); +(+$a->b)[1]; +(+$var)(); +$var = call(+$var->_uuidCounter); + +if (!($token = $this->getToken())) { +} +if (!($token = $this->getToken())) { +} + +================================================================================ +`; + +exports[`unnecessary.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.3" +printWidth: 80 + | printWidth +=====================================input====================================== +b; + !(yield $var); + yield (yield $var); + } + + $var = yield; + $var = yield $var; + $var += yield $var; + $var = (yield $var); + $var += (yield $var); + $var = yield $key => $var; + $var = (yield $key => $var); + $var = !yield $var; + $var = !(yield $var); + $var = yield (yield $var); + $var = yield 1 ? 1 : 1; + $var = (yield 1) ? 1 : 1; + $var = yield 1 ? yield 1 : yield 1; + $var = (yield 1) ? (yield 1) : (yield 1); + $var = yield $var->b; + $var = (yield $var)->b; + $var = yield $var->b(); + $var = (yield $var)->b(); + $var = yield $var[1]; + $var = (yield $var)[1]; + + call(yield $var); + + return yield from nine_ten(); + + foreach($SubTrav as $SubItem) yield $SubItem; +} + +=====================================output===================================== +b; + !(yield $var); + yield (yield $var); + } + + $var = yield; + $var = (yield $var); + $var += (yield $var); + $var = (yield $var); + $var += (yield $var); + $var = (yield $key => $var); + $var = (yield $key => $var); + $var = !(yield $var); + $var = !(yield $var); + $var = (yield (yield $var)); + $var = (yield 1 ? 1 : 1); + $var = (yield 1) ? 1 : 1; + $var = (yield 1 ? yield 1 : yield 1); + $var = (yield 1) ? yield 1 : yield 1; + $var = (yield $var->b); + $var = (yield $var)->b; + $var = (yield $var->b()); + $var = (yield $var)->b(); + $var = (yield $var[1]); + $var = (yield $var)[1]; + + call(yield $var); + + return yield from nine_ten(); + + foreach ($SubTrav as $SubItem) { + yield $SubItem; + } +} + +================================================================================ +`; + +exports[`yield.php 2`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +b; + !(yield $var); + yield (yield $var); + } + + $var = yield; + $var = yield $var; + $var += yield $var; + $var = (yield $var); + $var += (yield $var); + $var = yield $key => $var; + $var = (yield $key => $var); + $var = !yield $var; + $var = !(yield $var); + $var = yield (yield $var); + $var = yield 1 ? 1 : 1; + $var = (yield 1) ? 1 : 1; + $var = yield 1 ? yield 1 : yield 1; + $var = (yield 1) ? (yield 1) : (yield 1); + $var = yield $var->b; + $var = (yield $var)->b; + $var = yield $var->b(); + $var = (yield $var)->b(); + $var = yield $var[1]; + $var = (yield $var)[1]; + + call(yield $var); + + return yield from nine_ten(); + + foreach($SubTrav as $SubItem) yield $SubItem; +} + +=====================================output===================================== +b; + !(yield $var); + yield (yield $var); + } + + $var = yield; + $var = (yield $var); + $var += (yield $var); + $var = (yield $var); + $var += (yield $var); + $var = (yield $key => $var); + $var = (yield $key => $var); + $var = !(yield $var); + $var = !(yield $var); + $var = (yield (yield $var)); + $var = (yield 1 ? 1 : 1); + $var = (yield 1) ? 1 : 1; + $var = (yield 1 ? yield 1 : yield 1); + $var = (yield 1) ? yield 1 : yield 1; + $var = (yield $var->b); + $var = (yield $var)->b; + $var = (yield $var->b()); + $var = (yield $var)->b(); + $var = (yield $var[1]); + $var = (yield $var)[1]; + + call(yield $var); + + return yield from nine_ten(); + + foreach ($SubTrav as $SubItem) { + yield $SubItem; + } +} + +================================================================================ +`; diff --git a/tests/parens/array.php b/tests/parens/array.php new file mode 100644 index 000000000..32f549314 --- /dev/null +++ b/tests/parens/array.php @@ -0,0 +1,46 @@ + ($var), ('other-key') => ($other_var)]; +$arr = ([('key') => ($var), ('other-key') => ($other_var)]); + +[$var, $other_var] = $arr; +[($var), ($other_var)] = $arr; +[('key') => ($var), ('other-key') => ($other_var)] = $arr; + +$var = array(1, 2, 3)[1]; +$var = (array(1, 2, 3))[1]; +$var = [1, 2, 3][1]; +$var = ([1, 2, 3])[1]; +$var = array(new stdClass())[0]; +$var = (array((new stdClass())))[0]; +$var = [new stdClass()][0]; +$var = ([(new stdClass())])[0]; diff --git a/tests/parens/assign.php b/tests/parens/assign.php new file mode 100644 index 000000000..31d989aa2 --- /dev/null +++ b/tests/parens/assign.php @@ -0,0 +1,84 @@ + 'value']); + +($var = $var ? $var : function() { return 0; }); + +for ($i = 1; $i <= 10; $i++) { + echo $i; +} + +for (($i = 1); ($i <= 10); ($i++)) { + echo $i; +} +for (($i = 1), ($j = 0); ($i <= 10); ($j += $i), print ($i), ($i++)); + +if ($a = 1) {} + +while ($var = 1) {} +while ($var = current($array) !== FALSE) {} +while (($var = current($array)) !== FALSE) {} + +$var = $var || $var = new MyClass(); +$var = $var || ($var = new MyClass()); + +if (true) $var = $var; +if (true) ($var = $var); +if (true) { ($var = $var); } else if (false) ($var = $var); +if (true) { ($var = $var); } else if (false) { ($var = $var); } else ($var = $var); + +if (true) { + $var = $var; + ($var = $var); +} + +while ($i <= 10) $i = 1; +while ($i <= 10) ($i = 1); + +do { + echo $i; +} while ($i = 0); + +for ($i = 1; $i <= 10; $i++) $i = 1; +for ($i = 1; $i <= 10; $i++) ($i = 1); + +foreach ($arr as &$value) $value = $value * 2; +foreach ($arr as &$value) ($value = $value * 2); + +switch ($i = 1) { + case 0: + echo "i equals 0"; + break; + case 1: + echo "i equals 1"; + break; + case 2: + echo "i equals 2"; + break; +} + +switch (($i = 1)) { + case 0: + echo "i equals 0"; + break; + case 1: + echo "i equals 1"; + break; + case 2: + echo "i equals 2"; + break; +} diff --git a/tests/parens/assignref.php b/tests/parens/assignref.php new file mode 100644 index 000000000..cc44e3337 --- /dev/null +++ b/tests/parens/assignref.php @@ -0,0 +1,17 @@ + 0) {} +if (($foo = &test1()) && test2($foo) > 0) {} + +call(($a =& $b)); diff --git a/tests/parens/bin.php b/tests/parens/bin.php new file mode 100644 index 000000000..39cdd95cd --- /dev/null +++ b/tests/parens/bin.php @@ -0,0 +1,367 @@ +> 20 >> 30; +$var = (10 >> 20) >> 30; +$var = 10 >> (20 >> 30); + +$var = 10 ^ 20 ^ 30; +$var = (10 ^ 20) ^ 30; +$var = 10 ^ (20 ^ 30); + +$var = 10 | 20 | 30; +$var = (10 | 20) | 30; +$var = 10 | (20 | 30); + +$var = false || true; +$var = (false || true); +$var = false or true; +$var = (false or true); +$var = true && false; +$var = (true && false); +$var = true and false; +$var = (true and false); + +$var = $var || $var(); +$var = ($var || $var)(); +$var = $var && $var(); +$var = ($var && $var)(); +$var = call($var || $var); +$var = call(($var || $var)); +$var = call($var && $var); +$var = call(($var && $var)); + +$var = +($var || $var); +$var = -($var || $var); +$var = ~($var || $var); + +$var = ($var || $var)->foo; +$var = ($var || $var)->foo(); +$var = ($var || $var)[1]; + +$var = $var || $var && $var; +$var = ($var || $var) && $var; +$var = $var || ($var && $var); + +$var = $var & ($var || 'test'); +$var = ($var || 'test') & $var; +$var = $var & ($var . 'test'); +$var = ($var . 'test') & $var; +$var = ($var & $var) || 'test'; +$var = $var || ('test' & $var); + +$var = ($var || $var) % 100; +$var = ($var + $var) % 100; +$var = 100 % ($var || $var); +$var = 100 % ($var + $var); +$var = $var || ($var % 100); +$var = $var + ($var % 100); +$var = (100 % $var) || $var; +$var = (100 % $var) + $var; + +$var = ($var + $var) >> 1; +$var = (($var - 1) >> $var) & $var; +$var = $var > $var ? 0 : ($var - $var) >> $var; +$var = (($var - $var) >> $var) + 1; + +if ($var < 1 << ($var + $var)) {} + +$var = $var < $var ? 0 : ((($var - 1) >> $var) << $var); +$var = 1 - (2 * ($var[3] >> 7)); +$var = ((($var[3] << 1) & 0xff) | ($var[2] >> 7)) - 127; +$var = (($var[2] & 0x7f) << 16) | ($var[1] << 8) | $var[0]; + +$var = 2 / 3 * 10 / 2 + 2; + +$var = (($var / $var) * $var - $var / 2) * call($var); +$var = (($var / $var) * $var - $var / 2) * call($var); + +$var = $var % 10 - 5; +$var = $var * $var % 10; +$var = $var % 10 > 5; +$var = $var % 10 == 0; + +$var = $var + $var / $var; +$var = $var / $var + $var; + +$var = $var * $var % $var; +$var = $var / $var % $var; +$var = $var % $var * $var; +$var = $var % $var / $var; + +$var = $var % $var % $var; + +$var = $var << $var >> $var; +$var = $var >> $var << $var; +$var = $var >> $var >> $var; +$var = $var + $var >> $var; +$var = ($var + $var) >> $var; +$var = $var + ($var >> $var); + +$var = $var | $var & $var; +$var = $var & $var | $var; +$var = $var ^ $var ^ $var; +$var = $var & $var & $var; +$var = $var | $var | $var; +$var = $var & $var >> $var; +$var = $var << $var | $var; + +$var = $var ? 'foo' : 'bar' . 'test'; +$var = ($var ? 'foo' : 'bar') . 'test'; +$var = $var ? 'foo' : ('bar' . 'test'); + +call(($var + $var)); + +$var = call(($var + $var)); + +$var = $var + $var ** 2; +$var = ($var + $var) ** 2; +$var = $var + ($var ** 2); +$var = (+$var) ** 2; +$var = +$var ** 2; + +$var = $foo instanceof Foo; +$var = $foo instanceof Foo || $foo instanceof Foo; +$var = ($foo instanceof Foo) || ($foo instanceof Foo); +$var = (($foo) instanceof Foo); + +$var = !$var; +$var = !($var); +$var = (!($var)); +$var = !!$var; +$var = !!($var); +$var = !(!($var)); +$var = (!(!($var))); +$var = !!!$var; +$var = !!!($var); +$var = !!(!($var)); +$var = !(!(!($var))); +$var = (!(!(!($var)))); + +$var = !$var || !$var; +$var = (!($var) || !($var)); +$var = !(!($var) || !($var)); + +$var = $var + $var * $var; +$var = ($var + $var) * $var; + +$var = @foo() || @foo(); +$var = @(foo() || foo()); + +($var += ($var += ($var += $var))); +($var -= ($var -= ($var -= $var))); +($var *= ($var *= ($var *= $var))); +($var **= ($var **= ($var **= $var))); +($var /= ($var /= ($var /= $var))); +($var .= ($var .= ($var .= $var))); +($var %= ($var %= ($var %= $var))); +($var &= ($var &= ($var &= $var))); +($var |= ($var |= ($var |= $var))); +($var ^= ($var ^= ($var ^= $var))); +($var <<= ($var <<= ($var <<= $var))); +($var >>= ($var >>= ($var >>= $var))); + +$var = $var | $var | $var; +$var = $var | ($var | $var); +$var = ($var | $var) | $var; +$var = $var & $var & $var; +$var = $var & ($var & $var); +$var = ($var & $var) & $var; + +$var = $var ^ $var | $var; +$var = ($var ^ $var) | $var; +$var = $var | $var ^ $var; +$var = $var | ($var ^ $var); +$var = ($var | $var) ^ $var; + +$var = $var & $var | $var; +$var = ($var & $var) | $var; +$var = $var | $var & $var; +$var = $var | ($var & $var); +$var = ($var | $var) & $var; + +$var = $var == $var || false; +$var = ($var == $var) || false; +$var = $var == ($var || false); + +$var = false || $var == $var; +$var = false || ($var == $var); +$var = ($var || false) == $var; + +$var = 'string' . true ? '1' : '2'; +$var = 'string' . (true ? '1' : '2'); + +$var = 'string' . (100 + 100); +$var = (100 + 100) . 'string'; +$var = 'string' . ($var || 100); +$var = ($var || 100) . 'string'; +$var = 'string' . ($var * 100); +$var = ($var * 100) . 'string'; +$var = 'string' . !$var; +$var = !$var . 'string'; +$var = 'string' . ($var | 100); +$var = ($var | 100) . 'string'; + +$var = $var . $var % $var; +$var = ($var . $var) % $var; +$var = $var % $var . $var; +$var = $var % ($var . $var); + +$var = '100' - '100' - '100'; +$var = ('100' - '100') - '100'; +$var = '100' - ('100' - '100'); + +if (false || true) {}; +if ((false || true)) {}; +if (false or true) {}; +if ((false or true)) {}; +if (true && false) {}; +if ((true && false)) {}; +if (true and false) {}; +if ((true and false)) {}; + +if (!$foo or $bar == -1) {} +if ((!$foo or $bar == -1)) {} +if ((!$foo or $bar) == -1) {} +if (!$foo or ($bar == -1)) {} + +do {} while ($foo and $bar); +while ($foo or $bar < 10) {} +for ($foo or $bar;;) {} +switch ($foo or $bar) {} + +$a ** $b ** $c; +($a ** $b) ** $c; +$a->b ** $c; +(-$a) ** $b; +$a ** -$b; +-($a**$b); +($a * $b) ** $c; +$a ** ($b * $c); +($a % $b) ** $c; + +$var = $var + $var ?? ''; +$var = $var + ($var ?? ''); +$var = ($var + $var) ?? ''; +$var = $var ?? null + 1; +$var = ($var ?? null) + 1; +$var = $var && ($var ?? true); +$var = ($var ?? true) && $var; +$var = $var && ($var ?? null) === true; +$var = ($var ?? null) === true && $var; + +$findAll = $cachesNames === []; +$findAll = ($cachesNames === []); + +$isNamespaced = strpos($fixture, '\\') !== false; +$isNamespaced = (strpos($fixture, '\\') !== false); + +$var = $a['apply_time'] > $b['apply_time'] ? -1 : +1; +$var = ($a['apply_time'] > $b['apply_time']) ? -1 : +1; + +$var = $page > 0 || $page == 0 && $this->forcePageParam; +$var = $page > 0 || ($page == 0 && $this->forcePageParam); + +@foo() || @foo(); +(@foo()) || (@foo()); +$var = @foo() || @foo(); +$var = (@foo() || @foo()); + +@$i / 0; +@($i) / 0; + +$var = "a" . (@$b ? 'bar' : "baz"); + +$a = (false && foo()); +$b = (true || foo()); +$c = (false and foo()); +$d = (true or foo()); + +$f = false or true; +$h = true and false; + +$my_file = call('non_existent_file') or die("Failed opening file: error was '$php_errormsg'"); +($my_file = call('non_existent_file')) or die("Failed opening file: error was '$php_errormsg'"); + +$my_file = call('non_existent_file') and die("Failed opening file: error was '$php_errormsg'"); +($my_file = call('non_existent_file')) and die("Failed opening file: error was '$php_errormsg'"); + +$var = $obj->foo ?? "default"; +$var = $foo ? $bar ?? $foo : $baz; +$var = $foo ?? ($bar ?? $baz); +$var = ($foo ?? $baz) || $baz; +$var = $foo ?? $baz || $baz; +$var = ($foo && $baz) ?? $baz; +$var = $foo && ($baz ?? $baz); + +$result = 2 ** $number - 1; +$result = (2 ** $number) - 1; +$result = 2 ** ($number - 1); diff --git a/tests/parens/block.php b/tests/parens/block.php new file mode 100644 index 000000000..36a06b815 --- /dev/null +++ b/tests/parens/block.php @@ -0,0 +1,5 @@ +c()); +} diff --git a/tests/parens/break.php b/tests/parens/break.php new file mode 100644 index 000000000..fa6a898ac --- /dev/null +++ b/tests/parens/break.php @@ -0,0 +1,11 @@ +call(); +$var = ($foo)->call(); +$var = ($foo->call()); +$var = $foo->call()->call(); +$var = ($foo)->call()->call(); +$var = (($foo)->call())->call(); +$var = ((($foo)->call())->call()); + +$var = call((call())); +$var = call(...(call())); +$var = (call((call()))); +$var = (call((call()), (call()))); + +$var = $func(); +$var = ($func)(); +$var = ($func()); +$var = (($func)()); + +$var = $this->$name(); +$var = ($this)->$name(); +$var = ($this->$name()); +$var = (($this)->$name()); + +$var = Foo::call(); +$var = (Foo::call()); + +$var = (array("Foo", "bar"))(); +$var = (array(new Foo, "baz"))(); +$var = ((string) 1234)(); +$var = "Foo::bar"(); +$var = ("Foo::bar")(); + +call(($a), (($b)), ((($c)))); +call($a = $b); +call(($a = $b)); +call($a = new Foo()); +call(($a = new Foo())); +call($a = (new Foo())); +call(($a = (new Foo()))); +$foo->call(($a = (new Foo()))); +Foo::call(($a = (new Foo()))); diff --git a/tests/parens/cast.php b/tests/parens/cast.php new file mode 100644 index 000000000..33068ec2c --- /dev/null +++ b/tests/parens/cast.php @@ -0,0 +1,90 @@ + 'foo'))); +$var = ((object) (['1' => 'foo'])); +$var = ((object) 'ciao')->scalar; +$var = ((object) array('test'))->{'0'}; +$var = (((object) array('test'))->{'0'}); +$var = (array) new B(); +$var = (array) (new B()); +$var = ((array) (new B())); +$var = ((array) (new B()))['foo']; +$var = ((string) 1234)[1]; +$var = ((string) 123)(); +$var = ((string) (123))(); +$var = "test"[0]; +$var = (array) "test"[0]; +$var = ((array) "test")[0]; +$var = [(int) 'key' => (int) '1']; +$var = [((int) 'key') => ((int) '1')]; +$var = ([((int) 'key') => ((int) '1')]); +$var = (int) $raw['data'] + $value; +$var = ((int) $raw['data']) + $value; +$var = (bool) $var ? 1 : 2; +$var = (bool) ($var ? 1 : 2); +$var = (bool) $var + 1 ? 1 : 2; +$var = ((bool) $var) + 1 ? 1 : 2; +$var = (bool) ($var + 1) ? 1 : 2; +$var = ((bool) $var) ? 1 : 2; +$var = ((bool) $var) ? (bool) 1 : (bool) 2; +$var = ((bool) $var) ? ((bool) 1) : ((bool) 2); +$var = ((bool) $var) ? (bool) 1 + 2 : (bool) 2 + 3; +$var = ((bool) $var) ? ((bool) 1 + 2) : ((bool) 2 + 3); +$var = ((bool) $var) ? (bool) $var ? 1 : 2 : (bool) $var ? 1 : 2; +$var = ((bool) $var) ? ((bool) $var) ? 1 : 2 : ((bool) $var) ? 1 : 2; +$var = ((bool) $var) ? (bool) ($var ? 1 : 2) : (bool) ($var ? 1 : 2); +$var = (bool) ($var ? (bool) ($var ? 1 : 2) : (bool) ($var ? 1 : 2)); +$var = (bool) $var->foo; +$var = (bool) ($var->foo); +$var = ((bool) $var->foo); +$var = ((object) $var)->foo; +$var = ((object) $var)[0]; +$var = (int) 'test' + (int) 'test'; +$var = ((int) 'test') + ((int) 'test'); +$var = ((int) 'test') * ((int) 'test'); +$var = ((int) 'test') | ((int) 'test'); +$var = ((int) 'test') % ((int) 'test'); +$var = @((int) 'test'); +$var = @((int) call()); +$var = (int) (int) 1; +$var = (int) ((int) 1); +$var = call((int) $var, (int) call(), (int) $minutes * 60); +$var = call(((int) $var), ((int) call()), (int) ($minutes * 60)); +$var = $var + (int) $minutes * 60; +$var = $var + (int) ($minutes * 60); + +return (int) $var; +return ((int) $var); + +if ((int) 1 === 1) {} +if (1 === (int) 1) {} +if (((int) 1) === 1) {} +if (1 === ((int) 1)) {} +if ((int) 1 === (int) 1) {} +if (((int) 1) === (int) 1) {} +if ((int) 1 === ((int) 1)) {} +if (((int) (1)) === ((int) 1)) {} + +$var = (bool) call(); +$var = $var || (bool) call(); +$var = (bool) call() || $var; + +$var = (int) $var === 1; +$var = ((int) $var) === 1; +$var = (int) ($var === 1); + +$this->apc->put($this->prefix.$key, $value, (int) ($minutes * 60)); + +$timeout = (int) ($server->timeout / 1000) + (($server->timeout % 1000 > 0) ? 1 : 0); diff --git a/tests/parens/clone.php b/tests/parens/clone.php new file mode 100644 index 000000000..2210d44cf --- /dev/null +++ b/tests/parens/clone.php @@ -0,0 +1,33 @@ +foo; +$var = (clone $a->foo); +$var = (clone $a)->foo(); + +$var = (clone foo())->bar()->foo(); +$var = ((clone foo())->bar())->foo(); +$var = (((clone foo())->bar())->foo()); +$var = (((clone foo())->bar())->foo())[0]; +$var = ((((clone foo())->bar())->foo())[0])[1]; +$var = (((clone foo())->bar())->foo())->baz(); +$var = (clone $foo())->bar; +$var = (clone $bar->y)->x; +$var = (clone $foo)[0]; +$var = (clone $foo)[0]['string']; + +$var = clone $a->b; +$var = clone $a->b(); +$var = (clone $a)->b(); +$var = ((clone $a)->b()); + +$var = (clone ($var)); +$var = (clone($var)); +$var = (clone($var->foo)); +$var = (clone($var->foo))->foo; diff --git a/tests/parens/closure.php b/tests/parens/closure.php new file mode 100644 index 000000000..6df949bfb --- /dev/null +++ b/tests/parens/closure.php @@ -0,0 +1,20 @@ + $b)) { + echo "a is bigger than b"; +} elseif (($a == $b)) { + echo "a is equal to b"; +} else { + echo "a is smaller than b"; +} + +while (($i <= 10)) { + echo $i++; +} + +do { + echo $i; +} while (($i > 0)); + +switch (($i)) { + case (0): + echo "i equals 0"; + break; + case ((1)): + echo "i equals 1"; + break; + case ('test' . ( 1 > 2 ? 'foo' : 'bar')): + echo "i equals 2"; + break; +} + +switch (($i + 1)) { + case (0): + echo "i equals 0"; + break; + case (1 + 2): + echo "i equals 1"; + break; + case (1 + ( 1 > 2 ? 1 : 3)): + echo "i equals 2"; + break; +} + +while (++$i) { + switch ($i) { + case 5: + echo "At 5
\n"; + break (2); /* Exit only the switch. */ + case 10: + echo "At 10; quitting
\n"; + break ((4)); /* Exit the switch and the while. */ + default: + break; + } +} + +while ($i++ < 5) { + echo "Outer
\n"; + while (1) { + echo "Middle
\n"; + while (1) { + echo "Inner
\n"; + continue (3); + } + echo "This never gets output.
\n"; + continue ((2)); + } + echo "Neither does this.
\n"; +} + +if ($var = 1) {} +if (($var = 1)) {} +if ($var = 1) {} else if ($var = 1) {} else {} +if (($var = 1)) {} else if (($var = 1)) {} else {} +do {} while ($var = 1); +do {} while (($var = 1)); +while ($var = 1) {} +while (($var = 1)) {} +for ($i = 1; $i <= 10; $i++) {} +for (($i = 1); ($i <= 10); ($i++)) {} +foreach (($arr = [1, 2, 3]) as $value) {} +foreach (($arr) as $value) {} +foreach (($arr) as $key => $value) {} +foreach (($arr = [1, 2, 3]) as $key => $value) {} +switch ($var = 1) {} +switch (($var = 1)) {} + +while (list($id, $name, $salary) = $result->fetch(PDO::FETCH_NUM)) {} +while ([$id, $name, $salary] = $result->fetch(PDO::FETCH_NUM)) {} + +if (($foo = $bar) && count($foo) > 0) {} +if( false !== ($file = readdir($dh)) && 0 !== strpos($file,'.')){} +while (($a = foo()) !== 5) {} +while( false !== ($file = readdir($dh))){} +do {} while( false !== ($file = readdir($dh))); diff --git a/tests/parens/declare.php b/tests/parens/declare.php new file mode 100644 index 000000000..18675edd0 --- /dev/null +++ b/tests/parens/declare.php @@ -0,0 +1,5 @@ +c()); diff --git a/tests/parens/echo.php b/tests/parens/echo.php new file mode 100644 index 000000000..1de4fcc2a --- /dev/null +++ b/tests/parens/echo.php @@ -0,0 +1,38 @@ +bar; +($var->bar); + +$var->bar(); +($var->bar()); + +$var::bar(); +($var::bar()); + +$var = $var->bar; +$var = ($var->bar); +$var = $var->bar->foo; +$var = ($var->bar)->foo; +$var = ($var->bar->foo); +$var = (($var->bar)->foo); + +$var = $var::foo(); +$var = ($var::foo()); +$var = $var::foo()::bar(); +$var = ($var::foo())::bar(); +$var = ($var::foo()::bar()); +$var = (($var::foo())::bar()); + +$var = $var->bar(); +$var = ($var->bar()); +$var = $var->bar()->foo(); +$var = ($var->bar())->foo(); +$var = ($var->bar()->foo()); +$var = (($var->bar())->foo()); + +$var = ((object) ($var->bar())->foo()); +$var = (object) (($var->bar())->foo()); + +$var = $var[0]; +$var = $var[0][1]; +$var = ($var[0]); +$var = ($var[0][1]); +$var = $var[0]->foo; +$var = ($var[0])->foo; +$var = ($var[0][1])->foo; +$var = ($var[0])[1]->foo; +$var = (($var[0])[1])->foo; +$var = $var[0]::foo; +$var = ($var[0])::foo; +$var = ($var[0][1])::foo; +$var = ($var[0])[1]::foo; +$var = (($var[0])[1])::foo; +$var = $var[0]->foo(); +$var = ($var[0])->foo(); +$var = ($var[0][1])->foo(); +$var = ($var[0])[1]->foo(); +$var = (($var[0])[1])->foo(); +$var = $var[0]::foo(); +$var = ($var[0])::foo(); +$var = ($var[0][1])::foo(); +$var = ($var[0])[1]::foo(); +$var = (($var[0])[1])::foo(); + +$var = $var[0]->foo()->baz; +$var = ((($var[0])->foo())->baz); + +$var = (new Foo())->bar; +$var = (new Foo())::bar; +$var = (new Foo())->bar(); +$var = (new Foo())::bar(); +$var = (new Foo())[1]; + +$var = $var->bar()(); +$var = ($var->bar())(); +$var = ($var->bar()()); +$var = (($var->bar())()); + +$var = $var::bar()(); +$var = ($var::bar())(); +$var = ($var::bar()()); +$var = (($var::bar())()); + +$var = ($var)->bar; +$var = (($var)->bar); +$var = ($var)->bar(); +$var = (($var)->bar()); + +$var = (function () { + return $this->foo; +})->bindTo($var, A::class)(); +$var = (((function () { + return $this->foo; +})))->bindTo($var, A::class)(); diff --git a/tests/parens/namespace.php b/tests/parens/namespace.php new file mode 100644 index 000000000..712d045bc --- /dev/null +++ b/tests/parens/namespace.php @@ -0,0 +1,5 @@ +c()); diff --git a/tests/parens/new.php b/tests/parens/new.php index 37bb40ed8..290cfe91c 100644 --- a/tests/parens/new.php +++ b/tests/parens/new.php @@ -25,3 +25,48 @@ ['foo' => 'bar'] )) ?> +c(); +new Foo->prop; +new Foo->method(); +new Foo->$var; +$var = (new class { + public function log($msg) + { + echo $msg; + } +}); +$var = (new foo())->bar(); +$var = (new foo())->bar()->foo(); +$var = ((new foo())->bar())->foo(); +$var = (((new foo())->bar())->foo()); +$var = (((new foo())->bar())->foo())[0]; +$var = ((((new foo())->bar())->foo())[0])[1]; +$var = (((new foo())->bar())->foo())->baz(); +$var = (new $foo())->bar; +$var = (new $bar->y)->x; +new SortOfLongClassName()->withALongMethodName()->andAnother()->toPushItPast80Chars(); +$asdf = +new SortOfLongClassName()->withALongMethodName() + ->andAnother()->toPushItPast80Chars(); + +$var = (new foo)[0]; +$var = (new foo)[0]['string']; + +$var = (new Foo)::foo; +$var = (new Foo)::$foo; + +$var = new $a->b; +$var = new $a->b(); +$var = (new $a)->b(); +$var = ((new $a)->b()); + +(new class {})->foo; +(new class {})->foo(); +(new class {})(); +(new class {})['foo']; + +$var = (new class {})->foo; diff --git a/tests/parens/parens.php b/tests/parens/parens.php new file mode 100644 index 000000000..8d59c392a --- /dev/null +++ b/tests/parens/parens.php @@ -0,0 +1,3 @@ +b++; +($a->b++); +++$a->b; +(++$a)->b; + +($a->b++)->call(); +($a->b++)[1]; +($var++)(); +$var = call($var->_uuidCounter++); + +(--$a->b)->call(); +(--$a->b)[1]; +(--$var)(); +$var = call(--$var->_uuidCounter); diff --git a/tests/parens/print.php b/tests/parens/print.php new file mode 100644 index 000000000..1651f0a89 --- /dev/null +++ b/tests/parens/print.php @@ -0,0 +1,44 @@ +" : print "$string_message\n"; +$var = $var ? (print "$string_message
") : (print "$string_message\n"); +$var = $var ? (print ("$string_message
")) : (print ("$string_message\n")); + +print 1 . print(2) + 3; // 511 +print 1 . (print(2)) + 3; // 214 + +print ($var || $var) && $var; +print (($var || $var) && $var); diff --git a/tests/parens/program.php b/tests/parens/program.php new file mode 100644 index 000000000..d8de36475 --- /dev/null +++ b/tests/parens/program.php @@ -0,0 +1,3 @@ +c()); diff --git a/tests/parens/retif.php b/tests/parens/retif.php new file mode 100644 index 000000000..1ad1a5bf1 --- /dev/null +++ b/tests/parens/retif.php @@ -0,0 +1,62 @@ +prop; +($var ? $var : $var)->prop(); +($var ? $var : $var)[1]; +($var ? $var : $var)->d(); +($var ? $var : $var)->d()->e(); +($var ? $var : $var)->d()->e()->f(); +($var + ? $var->responseBody($var->currentUser) + : $var->responseBody($var->defaultUser)) +->map(); +($var + ? $var.responseBody($var->currentUser) + : $var.responseBody($var->defaultUser)) +->map()->filter(); +($var + ? $var.responseBody($var->currentUser) + : $var.responseBody($var)) +->map(); +$var[$var + ? $var->responseBody($var->currentUser) + : $var->responseBody($var)] +->map(); + +$var = $var . $var ? "()" : ""; +$var = ($var . $var) ? "()" : ""; +$var = $var . ($var ? "()" : ""); +$var = +($var ? 1 : 2); +$var = +(+$var ? 1 : 2); +$var = +($var++ ? 1 : 2); +$var = ((true ? 'true' : false) ? (true ? 'true' : false) : (true ? 'true' : false)); +$var = $var ? $var1 ? 1 : 2 : $var2 ? 3 : 4; + +$var = $var ?: $var ?: $var ?: 'string'; +$var = ($var ?: $var) ?: $var ?: 'string'; +$var = (($var ?: $var) ?: $var) ?: 'string'; +$var = ((($var ?: $var) ?: $var) ?: 'string'); +$var = ($var ?: ($var ?: $var)) ?: 'string'; +$var = ($var ?: (($var ?: $var) ?: 'string')); +$var = ($var ?: ($var ?: ($var ?: 'string'))); + +$var = ($foo and $bar) ? true : false; +$var = ($foo or $bar) ? true : false; +$var = ($foo xor $bar) ? true : false; +$var = ($foo = "bar") ? true : false; + +$var = ($foo && $bar) ? true : false; +$var = ($foo || $bar) ? true : false; +$var = (!$foo) ? true : false; +$var = (new $foo) ? true : false; diff --git a/tests/parens/return.php b/tests/parens/return.php new file mode 100644 index 000000000..309d9764e --- /dev/null +++ b/tests/parens/return.php @@ -0,0 +1,13 @@ +customer->paymentService ?? null); + diff --git a/tests/parens/silent.php b/tests/parens/silent.php new file mode 100644 index 000000000..aa3856167 --- /dev/null +++ b/tests/parens/silent.php @@ -0,0 +1,49 @@ +stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) { + // should never happen + throw new RuntimeException('Unable to write output.'); +} + +try { + if (($fp = @fopen($filename, "r")) == false) { + throw new Exception; + } else { + do_file_stuff(); + } +} catch (Exception $e) { + handle_exception(); +} + +@list($width, $height) = getimagesize($file); +// Todo https://github.com/glayzzle/php-parser/issues/356 +// @(list($width, $height) = getimagesize($file)); + +@$var += 10; +// Todo https://github.com/glayzzle/php-parser/issues/356 +// @($var += 10); + +echo @(1 / 0); + +@$i / 0; +@($i / 0); diff --git a/tests/parens/throw.php b/tests/parens/throw.php new file mode 100644 index 000000000..b6cdebd6f --- /dev/null +++ b/tests/parens/throw.php @@ -0,0 +1,21 @@ + throw new \RuntimeException('In arrow function'); +$value = $a ? $a : throw new \InvalidArgumentException('In ternary'); \ No newline at end of file diff --git a/tests/parens/unary.php b/tests/parens/unary.php new file mode 100644 index 000000000..e07cad75f --- /dev/null +++ b/tests/parens/unary.php @@ -0,0 +1,65 @@ +bar); + +$var = +$var || +$var; +$var = (+$var) || (+$var); +$var = ((+$var) || (+$var)); + +$var = -(+($var)); + +$var = ~(+$var); + +$var = ~$var += 1; +$var = ~($var += 1); + +(+$a->b)->call(); +(+$a->b)[1]; +(+$var)(); +$var = call(+$var->_uuidCounter); + +if (!$token = $this->getToken()) {} +if (!($token = $this->getToken())) {} diff --git a/tests/parens/unnecessary.php b/tests/parens/unnecessary.php new file mode 100644 index 000000000..0e8b2a9ae --- /dev/null +++ b/tests/parens/unnecessary.php @@ -0,0 +1,58 @@ +b; + !(yield $var); + yield (yield $var); + } + + $var = yield; + $var = yield $var; + $var += yield $var; + $var = (yield $var); + $var += (yield $var); + $var = yield $key => $var; + $var = (yield $key => $var); + $var = !yield $var; + $var = !(yield $var); + $var = yield (yield $var); + $var = yield 1 ? 1 : 1; + $var = (yield 1) ? 1 : 1; + $var = yield 1 ? yield 1 : yield 1; + $var = (yield 1) ? (yield 1) : (yield 1); + $var = yield $var->b; + $var = (yield $var)->b; + $var = yield $var->b(); + $var = (yield $var)->b(); + $var = yield $var[1]; + $var = (yield $var)[1]; + + call(yield $var); + + return yield from nine_ten(); + + foreach($SubTrav as $SubItem) yield $SubItem; +} diff --git a/tests/preserve_line/__snapshots__/jsfmt.spec.mjs.snap b/tests/preserve_line/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..5a67bb15a --- /dev/null +++ b/tests/preserve_line/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,1183 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`argument-list.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 'Hello World', + 'age' => 29 + ], + + doSomething( + + // Hello world + + + // Hello world again + [ 'name' => 'Hello World', 'age' => 34 ], + + + $oneThing + + $anotherThing + + // Comment + + ) + +); + +evenMoreArgTypes( + doSomething( + [ 'name' => 'Hello World', 'age' => 34 ], + + + true + + ), + + 14, + + 1 + 2 + - 90/80, + + !98 * + 60 - + 90 + + + +); + +$foo->apply(null, + +// Array here +[1, 2]); + + +$bar->on("readable", + +function () { + doStuff(); +}); + +foo(['A, B'], + +/* function here */ +function () { return true; }); + +$doSomething->apply(null, + +// Comment + +[ + 'Hello world 1', + 'Hello world 2', + 'Hello world 3', +]); + + +doAnotherThing("node", + +[ + $solution_type, + $time_frame +]); + +$stuff->doThing($someStuff, + + -1, [ + 'accept' => function($node) { doSomething($node); } +]); + +doThing( + + $someOtherStuff, + + // This is important + true, [ + 'decline' => function ($creditCard) { takeMoney($creditCard); } +] + +); + +func( + function () { + thing(); + }, + + [ 'yes' => true, 'no' => 5 ] +); + +doSomething( + + [ 'tomorrow' => $maybe, 'today' => $never[$always] ], + + 1337, + + /* Comment */ + + // This is important + [ $helloWorld, $someImportantStuff ] + + +); + +=====================================output===================================== + "Hello World", + "age" => 29, + ], + + doSomething( + // Hello world + + // Hello world again + ["name" => "Hello World", "age" => 34], + + $oneThing + $anotherThing, + + // Comment + ), +); + +evenMoreArgTypes( + doSomething( + ["name" => "Hello World", "age" => 34], + + true, + ), + + 14, + + 1 + 2 - 90 / 80, + + !98 * 60 - 90, +); + +$foo->apply( + null, + + // Array here + [1, 2], +); + +$bar->on( + "readable", + + function () { + doStuff(); + }, +); + +foo( + ["A, B"], + + /* function here */ + function () { + return true; + }, +); + +$doSomething->apply( + null, + + // Comment + + ["Hello world 1", "Hello world 2", "Hello world 3"], +); + +doAnotherThing( + "node", + + [$solution_type, $time_frame], +); + +$stuff->doThing( + $someStuff, + + -1, + [ + "accept" => function ($node) { + doSomething($node); + }, + ], +); + +doThing( + $someOtherStuff, + + // This is important + true, + [ + "decline" => function ($creditCard) { + takeMoney($creditCard); + }, + ], +); + +func( + function () { + thing(); + }, + + ["yes" => true, "no" => 5], +); + +doSomething( + ["tomorrow" => $maybe, "today" => $never[$always]], + + 1337, + + /* Comment */ + + // This is important + [$helloWorld, $someImportantStuff], +); + +================================================================================ +`; + +exports[`class.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +var; + } + public function displayVar1() { + echo $this->var_1; + } + + + public function displayVar2() { + echo $this->var_2; + } + + const CONSTANT = 'constant value'; + const CONSTANT_1 = 'constant value'; + + + const CONSTANT_2 = 'constant value'; + + // Comment + + + // Comment + public function __sleep() + { + return array('dsn', 'username', 'password'); + } + // Comment + + + // Comment + private $dsn; + // Comment + + +} + +=====================================output===================================== +var; + } + public function displayVar1() + { + echo $this->var_1; + } + + public function displayVar2() + { + echo $this->var_2; + } + + const CONSTANT = "constant value"; + const CONSTANT_1 = "constant value"; + + const CONSTANT_2 = "constant value"; + + // Comment + + // Comment + public function __sleep() + { + return ["dsn", "username", "password"]; + } + // Comment + + // Comment + private $dsn; + // Comment +} + +================================================================================ +`; + +exports[`comments.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +doSomething('Hello World')->doAnotherThing('Foo', [ 'foo' => $bar ]) + + // App configuration. + ->doOneMoreThing($config) + + ->run(function () { $console->log('Bar'); }); + +$bigDeal + + ->doSomething('Hello World') + + // Hello world + ->doAnotherThing('Foo', [ 'foo' => $bar ]) + + // App configuration. + ->doOneMoreThing($config) + + ->run(function () { $console->log('Bar'); }); + + +$foo->bar->baz + + ->doSomething('Hello World') + + // Hello world + ->foo->bar->doAnotherThing('Foo', [ 'foo' => $bar ]) + + ->doOneMoreThing($config) + ->bar->run(function () { $console->log('Bar'); }); + +( + $somethingGood ? $thisIsIt : $maybeNot +) + + // Hello world + ->doSomething('Hello World') + + ->doAnotherThing('Foo', [ 'foo' => $bar ]) // Run this + ->run(function () { $console->log('Bar'); }); // Do this + +$helloWorld + + ->text() + + ->then(function ($t) { return $t; }); + +($veryLongVeryLongVeryLong || + $anotherVeryLongVeryLongVeryLong || + $veryVeryVeryLongError +) + + ->map(function ($tickets) { $TicketRecord->createFromSomeLongString(); }) + + ->filter(function ($obj) { return !!$obj; }); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { return $x->selected; }); + +=====================================output===================================== +doSomething("Hello World") + ->doAnotherThing("Foo", ["foo" => $bar]) + + // App configuration. + ->doOneMoreThing($config) + + ->run(function () { + $console->log("Bar"); + }); + +$bigDeal + + ->doSomething("Hello World") + + // Hello world + ->doAnotherThing("Foo", ["foo" => $bar]) + + // App configuration. + ->doOneMoreThing($config) + + ->run(function () { + $console->log("Bar"); + }); + +$foo->bar->baz + + ->doSomething("Hello World") + + // Hello world + ->foo->bar->doAnotherThing("Foo", ["foo" => $bar]) + + ->doOneMoreThing($config) + ->bar->run(function () { + $console->log("Bar"); + }); + +($somethingGood ? $thisIsIt : $maybeNot) + + // Hello world + ->doSomething("Hello World") + + ->doAnotherThing("Foo", ["foo" => $bar]) // Run this + ->run(function () { + $console->log("Bar"); + }); // Do this + +$helloWorld + + ->text() + + ->then(function ($t) { + return $t; + }); + +( + $veryLongVeryLongVeryLong || + $anotherVeryLongVeryLongVeryLong || + $veryVeryVeryLongError +) + + ->map(function ($tickets) { + $TicketRecord->createFromSomeLongString(); + }) + + ->filter(function ($obj) { + return !!$obj; + }); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { + return $x->selected; + }); + +================================================================================ +`; + +exports[`open-php-tag.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`php-tags-2.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`php-tags-3.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`php-tags-4.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`php-tags-5.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`php-tags-6.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`php-tags-7.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`php-tags-12.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`php-tags-13.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`php-tags-14.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`php-tags-15.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`traituse.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 'Hello World', + 'age' => 29 + ], + + doSomething( + + // Hello world + + + // Hello world again + [ 'name' => 'Hello World', 'age' => 34 ], + + + $oneThing + + $anotherThing + + // Comment + + ) + +); + +evenMoreArgTypes( + doSomething( + [ 'name' => 'Hello World', 'age' => 34 ], + + + true + + ), + + 14, + + 1 + 2 + - 90/80, + + !98 * + 60 - + 90 + + + +); + +$foo->apply(null, + +// Array here +[1, 2]); + + +$bar->on("readable", + +function () { + doStuff(); +}); + +foo(['A, B'], + +/* function here */ +function () { return true; }); + +$doSomething->apply(null, + +// Comment + +[ + 'Hello world 1', + 'Hello world 2', + 'Hello world 3', +]); + + +doAnotherThing("node", + +[ + $solution_type, + $time_frame +]); + +$stuff->doThing($someStuff, + + -1, [ + 'accept' => function($node) { doSomething($node); } +]); + +doThing( + + $someOtherStuff, + + // This is important + true, [ + 'decline' => function ($creditCard) { takeMoney($creditCard); } +] + +); + +func( + function () { + thing(); + }, + + [ 'yes' => true, 'no' => 5 ] +); + +doSomething( + + [ 'tomorrow' => $maybe, 'today' => $never[$always] ], + + 1337, + + /* Comment */ + + // This is important + [ $helloWorld, $someImportantStuff ] + + +); diff --git a/tests/preserve_line/class.php b/tests/preserve_line/class.php new file mode 100644 index 000000000..238cfdec0 --- /dev/null +++ b/tests/preserve_line/class.php @@ -0,0 +1,49 @@ +var; + } + public function displayVar1() { + echo $this->var_1; + } + + + public function displayVar2() { + echo $this->var_2; + } + + const CONSTANT = 'constant value'; + const CONSTANT_1 = 'constant value'; + + + const CONSTANT_2 = 'constant value'; + + // Comment + + + // Comment + public function __sleep() + { + return array('dsn', 'username', 'password'); + } + // Comment + + + // Comment + private $dsn; + // Comment + + +} diff --git a/tests/preserve_line/comments.php b/tests/preserve_line/comments.php new file mode 100644 index 000000000..d881c8125 --- /dev/null +++ b/tests/preserve_line/comments.php @@ -0,0 +1,30 @@ +doSomething('Hello World')->doAnotherThing('Foo', [ 'foo' => $bar ]) + + // App configuration. + ->doOneMoreThing($config) + + ->run(function () { $console->log('Bar'); }); + +$bigDeal + + ->doSomething('Hello World') + + // Hello world + ->doAnotherThing('Foo', [ 'foo' => $bar ]) + + // App configuration. + ->doOneMoreThing($config) + + ->run(function () { $console->log('Bar'); }); + + +$foo->bar->baz + + ->doSomething('Hello World') + + // Hello world + ->foo->bar->doAnotherThing('Foo', [ 'foo' => $bar ]) + + ->doOneMoreThing($config) + ->bar->run(function () { $console->log('Bar'); }); + +( + $somethingGood ? $thisIsIt : $maybeNot +) + + // Hello world + ->doSomething('Hello World') + + ->doAnotherThing('Foo', [ 'foo' => $bar ]) // Run this + ->run(function () { $console->log('Bar'); }); // Do this + +$helloWorld + + ->text() + + ->then(function ($t) { return $t; }); + +($veryLongVeryLongVeryLong || + $anotherVeryLongVeryLongVeryLong || + $veryVeryVeryLongError +) + + ->map(function ($tickets) { $TicketRecord->createFromSomeLongString(); }) + + ->filter(function ($obj) { return !!$obj; }); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { return $x->selected; }); diff --git a/tests/preserve_line/open-php-tag-1.php b/tests/preserve_line/open-php-tag-1.php new file mode 100644 index 000000000..49bd5825a --- /dev/null +++ b/tests/preserve_line/open-php-tag-1.php @@ -0,0 +1,2 @@ + diff --git a/tests/preserve_line/php-tags-12.php b/tests/preserve_line/php-tags-12.php new file mode 100644 index 000000000..75c3addb2 --- /dev/null +++ b/tests/preserve_line/php-tags-12.php @@ -0,0 +1,7 @@ + diff --git a/tests/preserve_line/php-tags-13.php b/tests/preserve_line/php-tags-13.php new file mode 100644 index 000000000..165191bb4 --- /dev/null +++ b/tests/preserve_line/php-tags-13.php @@ -0,0 +1,9 @@ + diff --git a/tests/preserve_line/php-tags-14.php b/tests/preserve_line/php-tags-14.php new file mode 100644 index 000000000..bfb6b488e --- /dev/null +++ b/tests/preserve_line/php-tags-14.php @@ -0,0 +1,10 @@ + diff --git a/tests/preserve_line/php-tags-15.php b/tests/preserve_line/php-tags-15.php new file mode 100644 index 000000000..6f5d9f19c --- /dev/null +++ b/tests/preserve_line/php-tags-15.php @@ -0,0 +1,14 @@ + diff --git a/tests/preserve_line/php-tags-2.php b/tests/preserve_line/php-tags-2.php new file mode 100644 index 000000000..96a8e995f --- /dev/null +++ b/tests/preserve_line/php-tags-2.php @@ -0,0 +1,4 @@ + diff --git a/tests/preserve_line/php-tags-3.php b/tests/preserve_line/php-tags-3.php new file mode 100644 index 000000000..69be47c6f --- /dev/null +++ b/tests/preserve_line/php-tags-3.php @@ -0,0 +1,4 @@ + diff --git a/tests/preserve_line/php-tags-4.php b/tests/preserve_line/php-tags-4.php new file mode 100644 index 000000000..d01bcaf2e --- /dev/null +++ b/tests/preserve_line/php-tags-4.php @@ -0,0 +1,5 @@ + diff --git a/tests/preserve_line/php-tags-5.php b/tests/preserve_line/php-tags-5.php new file mode 100644 index 000000000..bbd072170 --- /dev/null +++ b/tests/preserve_line/php-tags-5.php @@ -0,0 +1,7 @@ + diff --git a/tests/preserve_line/php-tags-6.php b/tests/preserve_line/php-tags-6.php new file mode 100644 index 000000000..84654770a --- /dev/null +++ b/tests/preserve_line/php-tags-6.php @@ -0,0 +1 @@ + diff --git a/tests/preserve_line/php-tags-7.php b/tests/preserve_line/php-tags-7.php new file mode 100644 index 000000000..4016522fb --- /dev/null +++ b/tests/preserve_line/php-tags-7.php @@ -0,0 +1,2 @@ + diff --git a/tests/preserve_line/traituse.php b/tests/preserve_line/traituse.php new file mode 100644 index 000000000..88bb690e1 --- /dev/null +++ b/tests/preserve_line/traituse.php @@ -0,0 +1,63 @@ +veryVeryVeryVeryVeryVeryLongProperty; - -print str_replace('test', 'test', 'test'); -print(str_replace('test', 'test', 'test')); - -print(1); -print (1); -print (((1))); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -veryVeryVeryVeryVeryVeryLongProperty; - -print str_replace('test', 'test', 'test'); -print str_replace('test', 'test', 'test'); - -print 1; -print 1; -print 1; - -`; diff --git a/tests/print/__snapshots__/jsfmt.spec.mjs.snap b/tests/print/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..922788033 --- /dev/null +++ b/tests/print/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,336 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`print.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +veryVeryVeryVeryVeryVeryLongProperty; + +print str_replace('test', 'test', 'test'); +print(str_replace('test', 'test', 'test')); + +print(1); +print (1); +print (((1))); + +print esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) +); + +print << $var, 'foo' => $var, 'bar' => $var]; +print [ + 'key' => $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, + 'other-key' => $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, + 'ohter-other-key' => $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable +]; + +print $var->foo->bar->baz; +print $var->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + +print $var->call()->call()->call(); +print $var->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall()->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall()->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall(); + +print $var; +print $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable; + +print true; +print false; + +print 1024; +print 10240000000000000000000000000000000000000000000000000000000000000000000000000000000; + +print new Foo(); +print new Foo($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable); +print new class {}; +print new class { + public function __toString() { + return "String"; + } +}; + +print (function () { + return "string"; +})(); + +=====================================output===================================== +veryVeryVeryVeryVeryVeryLongProperty; + +print str_replace("test", "test", "test"); +print str_replace("test", "test", "test"); + +print 1; +print 1; +print 1; + +print esc_html( + sprintf( + __( + "Hi there. Your recent order on %s has been completed. " . + "Your order details are shown below for your reference:", + "woocommerce", + ), + get_option("blogname"), + ), +); + +print << $var, "foo" => $var, "bar" => $var]; +print [ + "key" => $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, + "other-key" => $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, + "ohter-other-key" => $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, +]; + +print $var->foo->bar->baz; +print $var->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty + ->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty + ->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + +print $var->call()->call()->call(); +print $var + ->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall() + ->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall() + ->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall(); + +print $var; +print $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable; + +print true; +print false; + +print 1024; +print 10240000000000000000000000000000000000000000000000000000000000000000000000000000000; + +print new Foo(); +print new Foo( + $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, + $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, + $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, +); +print new class {}; +print new class { + public function __toString() + { + return "String"; + } +}; + +print (function () { + return "string"; +})(); + +================================================================================ +`; diff --git a/tests/print/jsfmt.spec.js b/tests/print/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/print/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/print/jsfmt.spec.mjs b/tests/print/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/print/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/print/print.php b/tests/print/print.php index 679d25616..60fa352aa 100644 --- a/tests/print/print.php +++ b/tests/print/print.php @@ -51,3 +51,89 @@ print(1); print (1); print (((1))); + +print esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) +); + +print << $var, 'foo' => $var, 'bar' => $var]; +print [ + 'key' => $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, + 'other-key' => $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, + 'ohter-other-key' => $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable +]; + +print $var->foo->bar->baz; +print $var->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + +print $var->call()->call()->call(); +print $var->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall()->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall()->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall(); + +print $var; +print $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable; + +print true; +print false; + +print 1024; +print 10240000000000000000000000000000000000000000000000000000000000000000000000000000000; + +print new Foo(); +print new Foo($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable); +print new class {}; +print new class { + public function __toString() { + return "String"; + } +}; + +print (function () { + return "string"; +})(); diff --git a/tests/program/__snapshots__/jsfmt.spec.js.snap b/tests/program/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 4e20954c8..000000000 --- a/tests/program/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,8 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`single-open-php-tag.php 1`] = ` - + +=====================================output===================================== + + +================================================================================ +`; + +exports[`empty-open-and-close-php-tag-1.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`empty-open-and-close-php-tag-2.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`empty-open-and-close-php-tag-3.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`newline.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + diff --git a/tests/program/empty-open-and-close-php-tag-2.php b/tests/program/empty-open-and-close-php-tag-2.php new file mode 100644 index 000000000..6eff33c4e --- /dev/null +++ b/tests/program/empty-open-and-close-php-tag-2.php @@ -0,0 +1,4 @@ + diff --git a/tests/program/empty-open-and-close-php-tag-3.php b/tests/program/empty-open-and-close-php-tag-3.php new file mode 100644 index 000000000..7ccbe4974 --- /dev/null +++ b/tests/program/empty-open-and-close-php-tag-3.php @@ -0,0 +1 @@ + diff --git a/tests/program/empty-open-and-close-php-tag.php b/tests/program/empty-open-and-close-php-tag.php new file mode 100644 index 000000000..acb6c3546 --- /dev/null +++ b/tests/program/empty-open-and-close-php-tag.php @@ -0,0 +1,2 @@ + diff --git a/tests/program/jsfmt.spec.js b/tests/program/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/program/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/program/jsfmt.spec.mjs b/tests/program/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/program/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/program/newline.php b/tests/program/newline.php new file mode 100644 index 000000000..c656e6562 --- /dev/null +++ b/tests/program/newline.php @@ -0,0 +1,3 @@ + 'value', 'other_key' => 'other_value']; + public $var7_3 = ['very_very_very_long_key' => 'very_very_very_long_value', 'very_very_very_long_other_key' => 'very_very_very_long_other_value']; + public $var8 = <<<'EOD' +hello world +EOD; + public $var9 = 11111111111111111111111111111111111111111111111111111111111111111111; + public $var10 = 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString'; + public $var11 = true; + public $public = 'Public'; + protected $protected = 'Protected'; + private $private = 'Private'; + public $prop; + private static $static_property; + public static $my_static = 'foo'; + static $my_static_1 = 'foo'; + public static $my_public_static='bar'; + static $foo; // visibility is empty + var $bar; // visibility is null + public $string = 'string +string +string'; + public $string2 = 'string +string +string' . 'string +string +string'; +} + +=====================================output===================================== + "value", "other_key" => "other_value"]; + public $var7_3 = [ + "very_very_very_long_key" => "very_very_very_long_value", + "very_very_very_long_other_key" => "very_very_very_long_other_value", + ]; + public $var8 = <<<'EOD' + hello world + EOD; + public $var9 = 11111111111111111111111111111111111111111111111111111111111111111111; + public $var10 = "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; + public $var11 = true; + public $public = "Public"; + protected $protected = "Protected"; + private $private = "Private"; + public $prop; + private static $static_property; + public static $my_static = "foo"; + static $my_static_1 = "foo"; + public static $my_public_static = "bar"; + static $foo; // visibility is empty + var $bar; // visibility is null + public $string = 'string +string +string'; + public $string2 = + 'string +string +string' . + 'string +string +string'; +} + +================================================================================ +`; diff --git a/tests/property/jsfmt.spec.mjs b/tests/property/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/property/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/property/property.php b/tests/property/property.php new file mode 100644 index 000000000..ac8af4612 --- /dev/null +++ b/tests/property/property.php @@ -0,0 +1,42 @@ + 'value', 'other_key' => 'other_value']; + public $var7_3 = ['very_very_very_long_key' => 'very_very_very_long_value', 'very_very_very_long_other_key' => 'very_very_very_long_other_value']; + public $var8 = <<<'EOD' +hello world +EOD; + public $var9 = 11111111111111111111111111111111111111111111111111111111111111111111; + public $var10 = 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString'; + public $var11 = true; + public $public = 'Public'; + protected $protected = 'Protected'; + private $private = 'Private'; + public $prop; + private static $static_property; + public static $my_static = 'foo'; + static $my_static_1 = 'foo'; + public static $my_public_static='bar'; + static $foo; // visibility is empty + var $bar; // visibility is null + public $string = 'string +string +string'; + public $string2 = 'string +string +string' . 'string +string +string'; +} diff --git a/tests/propertylookup/__snapshots__/jsfmt.spec.js.snap b/tests/propertylookup/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 9b23d0c98..000000000 --- a/tests/propertylookup/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,53 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`propertylookup.php 1`] = ` -value; -$a = &$obj->getValue(); -$obj->value = 2; - -$b = $this->{foo}; -$b = $this->{foo['bar']}; -$b = $this->{'foo' . $bar}; -$b = $this->{self::STUFF}; -$object = $this->{'bar' . $foo}->buzz(); - -$this->loooooooooooongloooooooooooongloooooooooooonglookup = "teeeeeeeeeeeeeeeeeeeeest"; -$this->loooooooooooong->loooooooooooong->loooooooooooong->lookup = "teeeeeeeeeeest"; -$this->loooooooooooong->loooooooooooong->loooooooooooong->lookup = $other->looooooooooong->stuff; -$this->loooooooooooong->lookup = (int) $this->getRequest()->getParam( - 'instance-resource-id' -); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -value; -$a = &$obj->getValue(); -$obj->value = 2; - -$b = $this->{foo}; -$b = $this->{foo['bar']}; -$b = $this->{'foo' . $bar}; -$b = $this->{self::STUFF}; -$object = $this->{'bar' . $foo}->buzz(); - -$this->loooooooooooongloooooooooooongloooooooooooonglookup = - "teeeeeeeeeeeeeeeeeeeeest"; -$this->loooooooooooong->loooooooooooong->loooooooooooong->lookup = - "teeeeeeeeeeest"; -$this->loooooooooooong->loooooooooooong->loooooooooooong->lookup = - $other->looooooooooong->stuff; -$this->loooooooooooong->lookup = (int) $this->getRequest()->getParam( - 'instance-resource-id' -); - -`; - -exports[`single.php 1`] = ` -veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; - -`; diff --git a/tests/propertylookup/__snapshots__/jsfmt.spec.mjs.snap b/tests/propertylookup/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..bbd1aa97f --- /dev/null +++ b/tests/propertylookup/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,146 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`offsets.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +var; +// variable +$obj->$var; +// variable variable +$obj->$$var; +// literal with identifier +$obj->{foo}; +// literal with variable +$obj->{$var}; +// literal with call +$obj->{call()}; +// encapsed (offset type) +$obj->foo_{'test' . 'bar'}; +// variable with literal with call +$obj->\${call()}; + +=====================================output===================================== +var; +// variable +$obj->$var; +// variable variable +$obj->$$var; +// literal with identifier +$obj->{foo}; +// literal with variable +$obj->{$var}; +// literal with call +$obj->{call()}; +// encapsed (offset type) +$obj->foo_["test" . "bar"]; +// variable with literal with call +$obj->\${call()}; + +================================================================================ +`; + +exports[`propertylookup.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +value; +$a = &$obj->getValue(); +$a = &$obj->getValue()->getValue()->getValue()->getValue()->getValue()->getValue()->getValue()->getValue()->getValue(); +$var = &$var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; +$obj->value = 2; + +$b = $this->foo; +$b = $this->{foo}; +$b = $this->{foo['bar']}; +$b = $this->{'foo' . $bar}; +$b = $this->{self::STUFF}; +$object = $this->{'bar' . $foo}->buzz(); + +$this->loooooooooooongloooooooooooongloooooooooooonglookup = "teeeeeeeeeeeeeeeeeeeeest"; +$this->loooooooooooong->loooooooooooong->loooooooooooong->lookup = "teeeeeeeeeeest"; +$this->loooooooooooong->loooooooooooong->loooooooooooong->lookup = $other->looooooooooong->stuff; +$this->loooooooooooong->lookup = (int) $this->getRequest()->getParam( + 'instance-resource-id' +); + +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + +$var = $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; +$var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; + +=====================================output===================================== +value; +$a = &$obj->getValue(); +$a = &$obj + ->getValue() + ->getValue() + ->getValue() + ->getValue() + ->getValue() + ->getValue() + ->getValue() + ->getValue() + ->getValue(); +$var = + &$var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; +$obj->value = 2; + +$b = $this->foo; +$b = $this->{foo}; +$b = $this->{foo["bar"]}; +$b = $this->{"foo" . $bar}; +$b = $this->{self::STUFF}; +$object = $this->{"bar" . $foo}->buzz(); + +$this->loooooooooooongloooooooooooongloooooooooooonglookup = + "teeeeeeeeeeeeeeeeeeeeest"; +$this->loooooooooooong->loooooooooooong->loooooooooooong->lookup = + "teeeeeeeeeeest"; +$this->loooooooooooong->loooooooooooong->loooooooooooong->lookup = + $other->looooooooooong->stuff; +$this->loooooooooooong->lookup = (int) $this->getRequest()->getParam( + "instance-resource-id", +); + +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + +$var = + $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; +$var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = + $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; + +================================================================================ +`; + +exports[`single.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + +=====================================output===================================== +veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + +================================================================================ +`; diff --git a/tests/propertylookup/jsfmt.spec.js b/tests/propertylookup/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/propertylookup/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/propertylookup/jsfmt.spec.mjs b/tests/propertylookup/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/propertylookup/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/propertylookup/offsets.php b/tests/propertylookup/offsets.php new file mode 100644 index 000000000..9916b0840 --- /dev/null +++ b/tests/propertylookup/offsets.php @@ -0,0 +1,18 @@ +var; +// variable +$obj->$var; +// variable variable +$obj->$$var; +// literal with identifier +$obj->{foo}; +// literal with variable +$obj->{$var}; +// literal with call +$obj->{call()}; +// encapsed (offset type) +$obj->foo_{'test' . 'bar'}; +// variable with literal with call +$obj->${call()}; diff --git a/tests/propertylookup/propertylookup.php b/tests/propertylookup/propertylookup.php index ec6d08e81..2c33e0665 100644 --- a/tests/propertylookup/propertylookup.php +++ b/tests/propertylookup/propertylookup.php @@ -2,8 +2,11 @@ $a = $obj->value; $a = &$obj->getValue(); +$a = &$obj->getValue()->getValue()->getValue()->getValue()->getValue()->getValue()->getValue()->getValue()->getValue(); +$var = &$var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; $obj->value = 2; +$b = $this->foo; $b = $this->{foo}; $b = $this->{foo['bar']}; $b = $this->{'foo' . $bar}; @@ -16,3 +19,9 @@ $this->loooooooooooong->lookup = (int) $this->getRequest()->getParam( 'instance-resource-id' ); + +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + +$var = $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; +$var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; diff --git a/tests/propertystatement/__snapshots__/jsfmt.spec.mjs.snap b/tests/propertystatement/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..2d9815817 --- /dev/null +++ b/tests/propertystatement/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,87 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`propertystatement.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 'very_very_very_long_value', 'very_very_very_long_other_key' => 'very_very_very_long_other_value'], $b = ['very_very_very_long_key' => 'very_very_very_long_value', 'very_very_very_long_other_key' => 'very_very_very_long_other_value']; + static $a = 'foo'; + static $a = 'foo', $b = 'baz'; +} + +=====================================output===================================== + "very_very_very_long_value", + "very_very_very_long_other_key" => + "very_very_very_long_other_value", + ], + $b = [ + "very_very_very_long_key" => "very_very_very_long_value", + "very_very_very_long_other_key" => + "very_very_very_long_other_value", + ]; + static $a = "foo"; + static $a = "foo", + $b = "baz"; +} + +================================================================================ +`; diff --git a/tests/propertystatement/jsfmt.spec.mjs b/tests/propertystatement/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/propertystatement/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/propertystatement/propertystatement.php b/tests/propertystatement/propertystatement.php new file mode 100644 index 000000000..6954a6f75 --- /dev/null +++ b/tests/propertystatement/propertystatement.php @@ -0,0 +1,23 @@ + 'very_very_very_long_value', 'very_very_very_long_other_key' => 'very_very_very_long_other_value'], $b = ['very_very_very_long_key' => 'very_very_very_long_value', 'very_very_very_long_other_key' => 'very_very_very_long_other_value']; + static $a = 'foo'; + static $a = 'foo', $b = 'baz'; +} diff --git a/tests/require-pragma/__snapshots__/jsfmt.spec.mjs.snap b/tests/require-pragma/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..14730b47b --- /dev/null +++ b/tests/require-pragma/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,793 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`file-with-alt-pragma-CRLF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * This works too + * + * @prettier + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * This works too + * + * @prettier + */ + +echo "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "\\n"; + +================================================================================ +`; + +exports[`file-with-alt-pragma-CRLF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * This works too + * + * @prettier + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * This works too + * + * @prettier + */ + +echo "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "\\n"; + +================================================================================ +`; + +exports[`file-with-alt-pragma-CRLF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * This works too + * + * @prettier + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * This works too + * + * @prettier + */ + +echo "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "\\n"; + +================================================================================ +`; + +exports[`file-with-alt-pragma-LF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * This works too + * + * @prettier + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * This works too + * + * @prettier + */ + +echo "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "\\n"; + +================================================================================ +`; + +exports[`file-with-alt-pragma-LF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * This works too + * + * @prettier + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * This works too + * + * @prettier + */ + +echo "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "\\n"; + +================================================================================ +`; + +exports[`file-with-alt-pragma-LF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * This works too + * + * @prettier + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * This works too + * + * @prettier + */ + +echo "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "\\n"; + +================================================================================ +`; + +exports[`file-with-pragma-CRLF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * This turns on prettier formatting if --require-pragma is passed + * + * @format + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * This turns on prettier formatting if --require-pragma is passed + * + * @format + */ + +echo "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "\\n"; + +================================================================================ +`; + +exports[`file-with-pragma-CRLF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * This turns on prettier formatting if --require-pragma is passed + * + * @format + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * This turns on prettier formatting if --require-pragma is passed + * + * @format + */ + +echo "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "\\n"; + +================================================================================ +`; + +exports[`file-with-pragma-CRLF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * This turns on prettier formatting if --require-pragma is passed + * + * @format + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * This turns on prettier formatting if --require-pragma is passed + * + * @format + */ + +echo "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "\\n"; + +================================================================================ +`; + +exports[`file-with-pragma-LF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * This turns on prettier formatting if --require-pragma is passed + * + * @format + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * This turns on prettier formatting if --require-pragma is passed + * + * @format + */ + +echo "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "\\n"; + +================================================================================ +`; + +exports[`file-with-pragma-LF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * This turns on prettier formatting if --require-pragma is passed + * + * @format + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * This turns on prettier formatting if --require-pragma is passed + * + * @format + */ + +echo "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "\\n"; + +================================================================================ +`; + +exports[`file-with-pragma-LF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * This turns on prettier formatting if --require-pragma is passed + * + * @format + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * This turns on prettier formatting if --require-pragma is passed + * + * @format + */ + +echo "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "This " . + "string " . + "was " . + "made " . + "with concatenation." . + "\\n"; + +================================================================================ +`; + +exports[`file-without-pragma-CRLF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * No pragma, no prettier (assuming --require-pragma) + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * No pragma, no prettier (assuming --require-pragma) + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +================================================================================ +`; + +exports[`file-without-pragma-CRLF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * No pragma, no prettier (assuming --require-pragma) + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * No pragma, no prettier (assuming --require-pragma) + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +================================================================================ +`; + +exports[`file-without-pragma-CRLF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * No pragma, no prettier (assuming --require-pragma) + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * No pragma, no prettier (assuming --require-pragma) + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +================================================================================ +`; + +exports[`file-without-pragma-LF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * No pragma, no prettier (assuming --require-pragma) + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * No pragma, no prettier (assuming --require-pragma) + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +================================================================================ +`; + +exports[`file-without-pragma-LF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * No pragma, no prettier (assuming --require-pragma) + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * No pragma, no prettier (assuming --require-pragma) + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +================================================================================ +`; + +exports[`file-without-pragma-LF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + +/** + * No pragma, no prettier (assuming --require-pragma) + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +=====================================output===================================== + +/** + * No pragma, no prettier (assuming --require-pragma) + */ + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +================================================================================ +`; + +exports[`file-without-pragma-and-no-docblock-CRLF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +// @prettier +// @format + +=====================================output===================================== + + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +// @prettier +// @format + +================================================================================ +`; + +exports[`file-without-pragma-and-no-docblock-CRLF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +// @prettier +// @format + +=====================================output===================================== + + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +// @prettier +// @format + +================================================================================ +`; + +exports[`file-without-pragma-and-no-docblock-CRLF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +// @prettier +// @format + +=====================================output===================================== + + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +// @prettier +// @format + +================================================================================ +`; + +exports[`file-without-pragma-and-no-docblock-LF.php.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +// @prettier +// @format + +=====================================output===================================== + + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +// @prettier +// @format + +================================================================================ +`; + +exports[`file-without-pragma-and-no-docblock-LF.php.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +// @prettier +// @format + +=====================================output===================================== + + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +// @prettier +// @format + +================================================================================ +`; + +exports[`file-without-pragma-and-no-docblock-LF.php.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +parsers: ["php"] +printWidth: 80 +requirePragma: true + | printWidth +=====================================input====================================== + + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +// @prettier +// @format + +=====================================output===================================== + + +echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\\n"; + +// @prettier +// @format + +================================================================================ +`; diff --git a/tests/require-pragma/file-with-alt-pragma-CRLF.php b/tests/require-pragma/file-with-alt-pragma-CRLF.php new file mode 100644 index 000000000..8095d34ef --- /dev/null +++ b/tests/require-pragma/file-with-alt-pragma-CRLF.php @@ -0,0 +1,8 @@ += 1) ? $someOtherReallyReallyLongVariable : $thisOtherVariable; -return true ?: 2; -return ($testReallyReallyLong === $someOtherReallyReallyLongVariable && $otherTest != $someOtherTest) ? 1 : 0; - -$test ? doSomething() : doSomethingElse(); -return $test ? doSomething() : doSomethingElse(); -$test ?: doSomething(); -return $test ?: doSomething(); - -$category_color = get_field( Category_Meta::COLOR, 'category_' . $term_id ) ?: 'gold'; - -$var = $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; -$var = $someOtherReallyReallyLongVariable ? ($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable) : ($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable); -$test = $foo ?: bar($someOtherReallyReallyLongVariable, $someOtherReallyReallyLongVariable, $someOtherReallyReallyLongVariable); -$test = ($testReallyReallyReallyReallyReallyReallyLong >= 1) ?: $someOtherReallyReallyReallyReallyReallyReallyLongVariable; -$test = $foo ?: bar([ 'foo' => 'bar' , 'bar' => 'foo']); -$test = $foo ?: bar([ 'foo' => $someOtherReallyReallyLongVariable , 'bar' => $someOtherReallyReallyLongVariable]); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -= 1) - ? $someOtherReallyReallyLongVariable - : $thisOtherVariable; -return true ?: 2; -return ( - $testReallyReallyLong === $someOtherReallyReallyLongVariable && - $otherTest != $someOtherTest -) - ? 1 - : 0; - -$test ? doSomething() : doSomethingElse(); -return $test ? doSomething() : doSomethingElse(); -$test ?: doSomething(); -return $test ?: doSomething(); - -$category_color = get_field(Category_Meta::COLOR, 'category_' . $term_id) - ?: 'gold'; - -$var = $someOtherReallyReallyLongVariable - ? $someOtherReallyReallyLongVariable - ? $someOtherReallyReallyLongVariable - : $someOtherReallyReallyLongVariable - : $someOtherReallyReallyLongVariable - ? $someOtherReallyReallyLongVariable - : $someOtherReallyReallyLongVariable; -$var = $someOtherReallyReallyLongVariable - ? ( - $someOtherReallyReallyLongVariable - ? $someOtherReallyReallyLongVariable - : $someOtherReallyReallyLongVariable - ) - : ( - $someOtherReallyReallyLongVariable - ? $someOtherReallyReallyLongVariable - : $someOtherReallyReallyLongVariable - ); -$test = $foo - ?: bar( - $someOtherReallyReallyLongVariable, - $someOtherReallyReallyLongVariable, - $someOtherReallyReallyLongVariable - ); -$test = ($testReallyReallyReallyReallyReallyReallyLong >= 1) - ?: $someOtherReallyReallyReallyReallyReallyReallyLongVariable; -$test = $foo ?: bar(['foo' => 'bar', 'bar' => 'foo']); -$test = $foo - ?: bar([ - 'foo' => $someOtherReallyReallyLongVariable, - 'bar' => $someOtherReallyReallyLongVariable - ]); - -`; diff --git a/tests/retif/__snapshots__/jsfmt.spec.mjs.snap b/tests/retif/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..49603a8d0 --- /dev/null +++ b/tests/retif/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,670 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`retif.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== += 1) ? $someOtherReallyReallyLongVariable : $thisOtherVariable; +return true ?: 2; +return ($testReallyReallyLong === $someOtherReallyReallyLongVariable && $otherTest != $someOtherTest) ? 1 : 0; + +$test ? doSomething() : doSomethingElse(); +return $test ? doSomething() : doSomethingElse(); +$test ?: doSomething(); +return $test ?: doSomething(); + +$category_color = get_field( Category_Meta::COLOR, 'category_' . $term_id ) ?: 'gold'; + +$var = $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +$var = ($someOtherReallyReallyLongVariable ? ($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable) : $someOtherReallyReallyLongVariable) ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +$var = $someOtherReallyReallyLongVariable ? ($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable) : ($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable); +$test = $foo ?: bar($someOtherReallyReallyLongVariable, $someOtherReallyReallyLongVariable, $someOtherReallyReallyLongVariable); +$test = ($testReallyReallyReallyReallyReallyReallyLong >= 1) ?: $someOtherReallyReallyReallyReallyReallyReallyLongVariable; +$test = $foo ?: bar([ 'foo' => 'bar' , 'bar' => 'foo']); +$test = $foo ?: bar([ 'foo' => $someOtherReallyReallyLongVariable , 'bar' => $someOtherReallyReallyLongVariable]); +$var = ($this->databasePath ?: $this->basePath . DIRECTORY_SEPARATOR . 'database') . + ($path ? DIRECTORY_SEPARATOR . $path : $path); +$var = ($this->databasePath ? $this->basePath . DIRECTORY_SEPARATOR . 'other' : $this->basePath . DIRECTORY_SEPARATOR . 'database') . + ($path ? DIRECTORY_SEPARATOR . $path : $path); +return ($this->databasePath ?: $this->basePath . DIRECTORY_SEPARATOR . 'database') . + ($path ? DIRECTORY_SEPARATOR . $path : $path); + +$test = $foo + ? foo([ 'foo' => $someOtherReallyReallyLongVariable , 'bar' => $someOtherReallyReallyLongVariable]) + : bar([ 'foo' => $someOtherReallyReallyLongVariable , 'bar' => $someOtherReallyReallyLongVariable]); + +$var = 'string' . $someOtherReallyReallyLongVariable . $someOtherReallyReallyLongVariable ? 1 : 2; +$var = 1 ? 'string' . $someOtherReallyReallyLongVariable . $someOtherReallyReallyLongVariable : 2; +$var = 1 ? 2 : 'string' . $someOtherReallyReallyLongVariable . $someOtherReallyReallyLongVariable; + +($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable +)->call(); +$var = $test ?: (true ? 1 : 2); +$var = $test ?: ($someOtherReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongVariable ? 1 : 2); +$var = $test ?: (true ? $someOtherReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongVariable : 2); +$var = $test ?: (true ? 1 : $someOtherReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongVariable); +$var = $test + ? 'string' + : ($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable); +$var = $test + ? ($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable) + : 'string'; + +$arr = [ + 'step' => !empty($field['sliderStep']) && $field['sliderStep'] + ? (int) $field['sliderStep'] + : 1, + 'step' => true ? (int) $field['sliderStep'] : 1, + 'step' => true ? $someOtherReallyReallyLongVariable . $someOtherReallyReallyLongVariable : 1, + 'step' => $someOtherReallyReallyLongVariable ? (int) $field['sliderStep'] : 1, + 'step' => $someOtherReallyReallyLongVariable . 'string' ? (int) $field['sliderStep'] : 1, + 'step' => $someOtherReallyReallyLongVariable . $someOtherReallyReallyLongVariable ? (int) $field['sliderStep'] : 1, + 'step' => $someOtherReallyReallyReallyReallyLongVariable . $someOtherReallyReallyReallyReallyLongVariable ? (int) $field['sliderStep'] : 1, + 'step' => $someOtherReallyReallyReallyReallyLongVariable && $someOtherReallyReallyReallyReallyLongVariable ? (int) $field['sliderStep'] : 1, +]; + +$var = $var ?: $var ?: $var ?: 'string'; +$var = $var ?: $var ?: $var ?: $var ?: $var ?: $var ?: $var ?: $var ?: $var ?: $var ?: $var ?: $var ?: 'string'; + +($var ? 'string' : 'other-string')(); +($var ?: $var ?: $var ?: 'string')(); +($someOtherReallyReallyLongVariable ?: 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString')(); +($someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string')(); +($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable)(); + +($var ? $var : $var)->call(); +($var ?: $var ?: $var ?: 'string')->call(); +($someOtherReallyReallyLongVariable ?: 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString')->call(); +($someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string')->call(); +($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable)->call(); + +($var ?: $var ?: $var ?: 'string')->foo; +($var ? $var : $var)->foo; +($someOtherReallyReallyLongVariable ?: 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString')->foo; +($someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string')->foo; +($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable)->foo; + +call(function () { + return 1; +}, $var ? 1 : 2); + +call(function () { + return 1; +}, $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable); + +call(function () { + return 1; +}, $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ? :'test'); + +$var = [ + 'foo' => $var ?: $var ?: $var ?: 'string', + 'other-foo' => $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string' +]; + +return $var ? 'string' : 'other-string'; +return $var ?: $var ?: $var ?: 'string'; +return $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +return $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string'; + +$var = $this->databasePath ?: $this->basePath . DIRECTORY_SEPARATOR . 'database'; + +$var = $var ?: $otherVar ?: 'string' . 'string'; +$var = $var ?: $otherVar ?: 'string' . 'string' . 'string' . 'string' . 'string' . 'string'; +$var = $var ?: $otherVar ?: 'string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string'; + +echo $var ? 'string' : 'other-string'; +echo $var ?: $var ?: $var ?: 'string'; +echo $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +echo $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string'; + +print $var ? 'string' : 'other-string'; +print $var ?: $var ?: $var ?: 'string'; +print $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +print $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string'; + +include $var ? 'string' : 'other-string'; +include $var ?: $var ?: $var ?: 'string'; +include $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +include $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string'; + +$var = include $var ? 'string' : 'other-string'; +$var = include $var ?: $var ?: $var ?: 'string'; +$var = include $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +$var = include $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string'; + +call($var ? 'string' : 'other-string'); +call($var ?: $var ?: $var ?: 'string'); +call($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable); +call($someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string'); + +exit($var ? 'string' : 'other-string'); +exit($var ?: $var ?: $var ?: 'string'); +exit($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable); +exit($someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string'); + +$var = $abilities ?: []; +$var = $abilities ?: ['foo', 'bar', 'bar']; +$var = $abilities ?: ['foo', 'bar', 'bar', 'veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey']; +$var = $abilities ?: ['foo', 'bar', 'bar', 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongKey']; +$var = $abilities ?: ['view' => 'view']; +$var = $abilities ?: [ + 'view' => 'view' +]; +$var = $abilities ?: [ + 'view' => 'view', + 'create' => 'create', + 'update' => 'update', + 'delete' => 'delete' +]; +$var = $abilities ?: ['foo', 'bar', 'bar'] ?: ['foo', 'bar', 'bar']; +$var = $abilities ?: ['foo', 'bar', 'bar'] ?: ['foo', 'bar', 'bar', 'veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey']; +$var = $abilities ?: [ + 'view' => 'view', + 'create' => 'create', + 'update' => 'update', + 'delete' => 'delete' +] ?: [ + 'view' => 'view', + 'create' => 'create', + 'update' => 'update', + 'delete' => 'delete' +]; + +$callback = $var ?: function () { return true; }; +$callback = $var ?: function () { return true; } ?: function () { return true; }; + +$var = $delay instanceof DateTimeInterface + ? $delay->getTimestamp() + : Carbon::now() + ->addSeconds($delay) + ->getTimestamp(); + +return $delay instanceof DateTimeInterface + ? $delay->getTimestamp() + : Carbon::now() + ->addSeconds($delay) + ->getTimestamp(); + +$var = true ? 'string +string +string' : 'string +string +string'; + +$var = $var ?: 'string +string +string'; + +$var = [ + 'foo' => is_my() || !current_user_can("read") ? call_1() : call_2(), + 'bar' => is_my_very_long() || !current_user_can("read") ? call_1() : call_2(), + 'bar' => is_my_very_very_very_long() || !current_user_can("read") ? call_1() : call_2() +]; + +=====================================output===================================== += 1 + ? $someOtherReallyReallyLongVariable + : $thisOtherVariable; +return true ?: 2; +return $testReallyReallyLong === $someOtherReallyReallyLongVariable && + $otherTest != $someOtherTest + ? 1 + : 0; + +$test ? doSomething() : doSomethingElse(); +return $test ? doSomething() : doSomethingElse(); +$test ?: doSomething(); +return $test ?: doSomething(); + +$category_color = + get_field(Category_Meta::COLOR, "category_" . $term_id) ?: "gold"; + +$var = ($someOtherReallyReallyLongVariable + ? ($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable) + : $someOtherReallyReallyLongVariable) + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable; +$var = ($someOtherReallyReallyLongVariable + ? ($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable) + : $someOtherReallyReallyLongVariable) + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable; +$var = $someOtherReallyReallyLongVariable + ? ($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable) + : ($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable); +$test = + $foo ?: + bar( + $someOtherReallyReallyLongVariable, + $someOtherReallyReallyLongVariable, + $someOtherReallyReallyLongVariable, + ); +$test = + $testReallyReallyReallyReallyReallyReallyLong >= 1 ?: + $someOtherReallyReallyReallyReallyReallyReallyLongVariable; +$test = $foo ?: bar(["foo" => "bar", "bar" => "foo"]); +$test = + $foo ?: + bar([ + "foo" => $someOtherReallyReallyLongVariable, + "bar" => $someOtherReallyReallyLongVariable, + ]); +$var = + ($this->databasePath ?: + $this->basePath . DIRECTORY_SEPARATOR . "database") . + ($path ? DIRECTORY_SEPARATOR . $path : $path); +$var = + ($this->databasePath + ? $this->basePath . DIRECTORY_SEPARATOR . "other" + : $this->basePath . DIRECTORY_SEPARATOR . "database") . + ($path ? DIRECTORY_SEPARATOR . $path : $path); +return ($this->databasePath ?: + $this->basePath . DIRECTORY_SEPARATOR . "database") . + ($path ? DIRECTORY_SEPARATOR . $path : $path); + +$test = $foo + ? foo([ + "foo" => $someOtherReallyReallyLongVariable, + "bar" => $someOtherReallyReallyLongVariable, + ]) + : bar([ + "foo" => $someOtherReallyReallyLongVariable, + "bar" => $someOtherReallyReallyLongVariable, + ]); + +$var = + "string" . + $someOtherReallyReallyLongVariable . + $someOtherReallyReallyLongVariable + ? 1 + : 2; +$var = 1 + ? "string" . + $someOtherReallyReallyLongVariable . + $someOtherReallyReallyLongVariable + : 2; +$var = 1 + ? 2 + : "string" . + $someOtherReallyReallyLongVariable . + $someOtherReallyReallyLongVariable; + +($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable +)->call(); +$var = $test ?: (true ? 1 : 2); +$var = + $test ?: + ($someOtherReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongVariable + ? 1 + : 2); +$var = + $test ?: + (true + ? $someOtherReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongVariable + : 2); +$var = + $test ?: + (true + ? 1 + : $someOtherReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongVariable); +$var = $test + ? "string" + : ($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable); +$var = $test + ? ($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable) + : "string"; + +$arr = [ + "step" => + !empty($field["sliderStep"]) && $field["sliderStep"] + ? (int) $field["sliderStep"] + : 1, + "step" => true ? (int) $field["sliderStep"] : 1, + "step" => true + ? $someOtherReallyReallyLongVariable . + $someOtherReallyReallyLongVariable + : 1, + "step" => $someOtherReallyReallyLongVariable + ? (int) $field["sliderStep"] + : 1, + "step" => + $someOtherReallyReallyLongVariable . "string" + ? (int) $field["sliderStep"] + : 1, + "step" => + $someOtherReallyReallyLongVariable . $someOtherReallyReallyLongVariable + ? (int) $field["sliderStep"] + : 1, + "step" => + $someOtherReallyReallyReallyReallyLongVariable . + $someOtherReallyReallyReallyReallyLongVariable + ? (int) $field["sliderStep"] + : 1, + "step" => + $someOtherReallyReallyReallyReallyLongVariable && + $someOtherReallyReallyReallyReallyLongVariable + ? (int) $field["sliderStep"] + : 1, +]; + +$var = $var ?: $var ?: $var ?: "string"; +$var = + $var ?: + $var ?: + $var ?: + $var ?: + $var ?: + $var ?: + $var ?: + $var ?: + $var ?: + $var ?: + $var ?: + $var ?: + "string"; + +($var ? "string" : "other-string")(); +($var ?: $var ?: $var ?: "string")(); +( + $someOtherReallyReallyLongVariable ?: + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" +)(); +( + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + "string" +)(); +($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable)(); + +($var ? $var : $var)->call(); +($var ?: $var ?: $var ?: "string")->call(); +( + $someOtherReallyReallyLongVariable ?: + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" +)->call(); +( + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + "string" +)->call(); +($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable +)->call(); + +($var ?: $var ?: $var ?: "string")->foo; +($var ? $var : $var)->foo; +( + $someOtherReallyReallyLongVariable ?: + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" +)->foo; +( + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + "string" +)->foo; +($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable +)->foo; + +call( + function () { + return 1; + }, + $var ? 1 : 2, +); + +call( + function () { + return 1; + }, + $someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable, +); + +call( + function () { + return 1; + }, + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + "test", +); + +$var = [ + "foo" => $var ?: $var ?: $var ?: "string", + "other-foo" => + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + "string", +]; + +return $var ? "string" : "other-string"; +return $var ?: $var ?: $var ?: "string"; +return $someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable; +return $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + "string"; + +$var = + $this->databasePath ?: $this->basePath . DIRECTORY_SEPARATOR . "database"; + +$var = $var ?: $otherVar ?: "string" . "string"; +$var = + $var ?: + $otherVar ?: + "string" . "string" . "string" . "string" . "string" . "string"; +$var = + $var ?: + $otherVar ?: + "string" . + "string" . + "string" . + "string" . + "string" . + "string" . + "string" . + "string" . + "string" . + "string"; + +echo $var ? "string" : "other-string"; +echo $var ?: $var ?: $var ?: "string"; +echo $someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable; +echo $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + "string"; + +print $var ? "string" : "other-string"; +print $var ?: $var ?: $var ?: "string"; +print $someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable; +print $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + "string"; + +include $var ? "string" : "other-string"; +include $var ?: $var ?: $var ?: "string"; +include $someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable; +include $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + "string"; + +$var = include $var ? "string" : "other-string"; +$var = include $var ?: $var ?: $var ?: "string"; +$var = include $someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable; +$var = include $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + "string"; + +call($var ? "string" : "other-string"); +call($var ?: $var ?: $var ?: "string"); +call( + $someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable, +); +call( + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + "string", +); + +exit($var ? "string" : "other-string"); +exit($var ?: $var ?: $var ?: "string"); +exit( + $someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable +); +exit( + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + $someOtherReallyReallyLongVariable ?: + "string" +); + +$var = $abilities ?: []; +$var = $abilities ?: ["foo", "bar", "bar"]; +$var = $abilities ?: [ + "foo", + "bar", + "bar", + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey", +]; +$var = $abilities ?: [ + "foo", + "bar", + "bar", + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongKey", +]; +$var = $abilities ?: ["view" => "view"]; +$var = $abilities ?: [ + "view" => "view", +]; +$var = $abilities ?: [ + "view" => "view", + "create" => "create", + "update" => "update", + "delete" => "delete", +]; +$var = $abilities ?: ["foo", "bar", "bar"] ?: ["foo", "bar", "bar"]; +$var = $abilities ?: ["foo", "bar", "bar"] ?: [ + "foo", + "bar", + "bar", + "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey", +]; +$var = $abilities ?: [ + "view" => "view", + "create" => "create", + "update" => "update", + "delete" => "delete", +] ?: [ + "view" => "view", + "create" => "create", + "update" => "update", + "delete" => "delete", +]; + +$callback = + $var ?: + function () { + return true; + }; +$callback = + $var ?: + function () { + return true; + } ?: + function () { + return true; + }; + +$var = + $delay instanceof DateTimeInterface + ? $delay->getTimestamp() + : Carbon::now()->addSeconds($delay)->getTimestamp(); + +return $delay instanceof DateTimeInterface + ? $delay->getTimestamp() + : Carbon::now()->addSeconds($delay)->getTimestamp(); + +$var = true + ? 'string +string +string' + : 'string +string +string'; + +$var = + $var ?: + 'string +string +string'; + +$var = [ + "foo" => is_my() || !current_user_can("read") ? call_1() : call_2(), + "bar" => + is_my_very_long() || !current_user_can("read") ? call_1() : call_2(), + "bar" => + is_my_very_very_very_long() || !current_user_can("read") + ? call_1() + : call_2(), +]; + +================================================================================ +`; diff --git a/tests/retif/jsfmt.spec.js b/tests/retif/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/retif/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/retif/jsfmt.spec.mjs b/tests/retif/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/retif/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/retif/retif.php b/tests/retif/retif.php index 68b28ddb8..ca4ddbaaf 100644 --- a/tests/retif/retif.php +++ b/tests/retif/retif.php @@ -13,8 +13,193 @@ $category_color = get_field( Category_Meta::COLOR, 'category_' . $term_id ) ?: 'gold'; $var = $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +$var = ($someOtherReallyReallyLongVariable ? ($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable) : $someOtherReallyReallyLongVariable) ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; $var = $someOtherReallyReallyLongVariable ? ($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable) : ($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable); $test = $foo ?: bar($someOtherReallyReallyLongVariable, $someOtherReallyReallyLongVariable, $someOtherReallyReallyLongVariable); $test = ($testReallyReallyReallyReallyReallyReallyLong >= 1) ?: $someOtherReallyReallyReallyReallyReallyReallyLongVariable; $test = $foo ?: bar([ 'foo' => 'bar' , 'bar' => 'foo']); $test = $foo ?: bar([ 'foo' => $someOtherReallyReallyLongVariable , 'bar' => $someOtherReallyReallyLongVariable]); +$var = ($this->databasePath ?: $this->basePath . DIRECTORY_SEPARATOR . 'database') . + ($path ? DIRECTORY_SEPARATOR . $path : $path); +$var = ($this->databasePath ? $this->basePath . DIRECTORY_SEPARATOR . 'other' : $this->basePath . DIRECTORY_SEPARATOR . 'database') . + ($path ? DIRECTORY_SEPARATOR . $path : $path); +return ($this->databasePath ?: $this->basePath . DIRECTORY_SEPARATOR . 'database') . + ($path ? DIRECTORY_SEPARATOR . $path : $path); + +$test = $foo + ? foo([ 'foo' => $someOtherReallyReallyLongVariable , 'bar' => $someOtherReallyReallyLongVariable]) + : bar([ 'foo' => $someOtherReallyReallyLongVariable , 'bar' => $someOtherReallyReallyLongVariable]); + +$var = 'string' . $someOtherReallyReallyLongVariable . $someOtherReallyReallyLongVariable ? 1 : 2; +$var = 1 ? 'string' . $someOtherReallyReallyLongVariable . $someOtherReallyReallyLongVariable : 2; +$var = 1 ? 2 : 'string' . $someOtherReallyReallyLongVariable . $someOtherReallyReallyLongVariable; + +($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable +)->call(); +$var = $test ?: (true ? 1 : 2); +$var = $test ?: ($someOtherReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongVariable ? 1 : 2); +$var = $test ?: (true ? $someOtherReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongVariable : 2); +$var = $test ?: (true ? 1 : $someOtherReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongVariable); +$var = $test + ? 'string' + : ($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable); +$var = $test + ? ($someOtherReallyReallyLongVariable + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable) + : 'string'; + +$arr = [ + 'step' => !empty($field['sliderStep']) && $field['sliderStep'] + ? (int) $field['sliderStep'] + : 1, + 'step' => true ? (int) $field['sliderStep'] : 1, + 'step' => true ? $someOtherReallyReallyLongVariable . $someOtherReallyReallyLongVariable : 1, + 'step' => $someOtherReallyReallyLongVariable ? (int) $field['sliderStep'] : 1, + 'step' => $someOtherReallyReallyLongVariable . 'string' ? (int) $field['sliderStep'] : 1, + 'step' => $someOtherReallyReallyLongVariable . $someOtherReallyReallyLongVariable ? (int) $field['sliderStep'] : 1, + 'step' => $someOtherReallyReallyReallyReallyLongVariable . $someOtherReallyReallyReallyReallyLongVariable ? (int) $field['sliderStep'] : 1, + 'step' => $someOtherReallyReallyReallyReallyLongVariable && $someOtherReallyReallyReallyReallyLongVariable ? (int) $field['sliderStep'] : 1, +]; + +$var = $var ?: $var ?: $var ?: 'string'; +$var = $var ?: $var ?: $var ?: $var ?: $var ?: $var ?: $var ?: $var ?: $var ?: $var ?: $var ?: $var ?: 'string'; + +($var ? 'string' : 'other-string')(); +($var ?: $var ?: $var ?: 'string')(); +($someOtherReallyReallyLongVariable ?: 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString')(); +($someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string')(); +($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable)(); + +($var ? $var : $var)->call(); +($var ?: $var ?: $var ?: 'string')->call(); +($someOtherReallyReallyLongVariable ?: 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString')->call(); +($someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string')->call(); +($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable)->call(); + +($var ?: $var ?: $var ?: 'string')->foo; +($var ? $var : $var)->foo; +($someOtherReallyReallyLongVariable ?: 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString')->foo; +($someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string')->foo; +($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable)->foo; + +call(function () { + return 1; +}, $var ? 1 : 2); + +call(function () { + return 1; +}, $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable); + +call(function () { + return 1; +}, $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ? :'test'); + +$var = [ + 'foo' => $var ?: $var ?: $var ?: 'string', + 'other-foo' => $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string' +]; + +return $var ? 'string' : 'other-string'; +return $var ?: $var ?: $var ?: 'string'; +return $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +return $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string'; + +$var = $this->databasePath ?: $this->basePath . DIRECTORY_SEPARATOR . 'database'; + +$var = $var ?: $otherVar ?: 'string' . 'string'; +$var = $var ?: $otherVar ?: 'string' . 'string' . 'string' . 'string' . 'string' . 'string'; +$var = $var ?: $otherVar ?: 'string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string'; + +echo $var ? 'string' : 'other-string'; +echo $var ?: $var ?: $var ?: 'string'; +echo $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +echo $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string'; + +print $var ? 'string' : 'other-string'; +print $var ?: $var ?: $var ?: 'string'; +print $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +print $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string'; + +include $var ? 'string' : 'other-string'; +include $var ?: $var ?: $var ?: 'string'; +include $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +include $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string'; + +$var = include $var ? 'string' : 'other-string'; +$var = include $var ?: $var ?: $var ?: 'string'; +$var = include $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +$var = include $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string'; + +call($var ? 'string' : 'other-string'); +call($var ?: $var ?: $var ?: 'string'); +call($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable); +call($someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string'); + +exit($var ? 'string' : 'other-string'); +exit($var ?: $var ?: $var ?: 'string'); +exit($someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable); +exit($someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable ?: 'string'); + +$var = $abilities ?: []; +$var = $abilities ?: ['foo', 'bar', 'bar']; +$var = $abilities ?: ['foo', 'bar', 'bar', 'veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey']; +$var = $abilities ?: ['foo', 'bar', 'bar', 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongKey']; +$var = $abilities ?: ['view' => 'view']; +$var = $abilities ?: [ + 'view' => 'view' +]; +$var = $abilities ?: [ + 'view' => 'view', + 'create' => 'create', + 'update' => 'update', + 'delete' => 'delete' +]; +$var = $abilities ?: ['foo', 'bar', 'bar'] ?: ['foo', 'bar', 'bar']; +$var = $abilities ?: ['foo', 'bar', 'bar'] ?: ['foo', 'bar', 'bar', 'veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey']; +$var = $abilities ?: [ + 'view' => 'view', + 'create' => 'create', + 'update' => 'update', + 'delete' => 'delete' +] ?: [ + 'view' => 'view', + 'create' => 'create', + 'update' => 'update', + 'delete' => 'delete' +]; + +$callback = $var ?: function () { return true; }; +$callback = $var ?: function () { return true; } ?: function () { return true; }; + +$var = $delay instanceof DateTimeInterface + ? $delay->getTimestamp() + : Carbon::now() + ->addSeconds($delay) + ->getTimestamp(); + +return $delay instanceof DateTimeInterface + ? $delay->getTimestamp() + : Carbon::now() + ->addSeconds($delay) + ->getTimestamp(); + +$var = true ? 'string +string +string' : 'string +string +string'; + +$var = $var ?: 'string +string +string'; + +$var = [ + 'foo' => is_my() || !current_user_can("read") ? call_1() : call_2(), + 'bar' => is_my_very_long() || !current_user_can("read") ? call_1() : call_2(), + 'bar' => is_my_very_very_very_long() || !current_user_can("read") ? call_1() : call_2() +]; diff --git a/tests/return/__snapshots__/jsfmt.spec.js.snap b/tests/return/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index e4be627ef..000000000 --- a/tests/return/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,87 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`return.php 1`] = ` - 'VeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', $veryVeryVeryVeryVeryVeryLongKey => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', 3]; -return ($a + $b); -return ( $a / $b ); -return ( $a && $b ); -return new $VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClassName(); -return "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; -return "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; -return 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000; -return (1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000); -return $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable ? true : false; -return $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->veryVeryVeryVeryVeryVeryLongProperty; -return ((($true ? ('foo' . ('foo'. 'bar')) : "foobarfoo"))); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - 'VeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', - $veryVeryVeryVeryVeryVeryLongKey => - 'VeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', - 3 -]; -return ($a + $b); -return ($a / $b); -return ($a && $b); -return new $VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClassName(); -return ( - "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . - "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" -); -return ( - "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . - "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . - "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" -); -return ( - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 -); -return ( - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 + - 1000000000 -); -return $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable - ? true - : false; -return $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->veryVeryVeryVeryVeryVeryLongProperty; -return ($true ? ('foo' . ('foo' . 'bar')) : "foobarfoo"); - -`; diff --git a/tests/return/__snapshots__/jsfmt.spec.mjs.snap b/tests/return/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..45146d195 --- /dev/null +++ b/tests/return/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,561 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`return.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 'VeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', $veryVeryVeryVeryVeryVeryLongKey => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', 3]; +return ($a + $b); +return ( $a / $b ); +return ( $a && $b ); +return new $VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClassName(); +return "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; +return "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; +return 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000; +return (1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000 + 1000000000); +return $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable ? true : false; +return $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->veryVeryVeryVeryVeryVeryLongProperty; +return ((($true ? ('foo' . ('foo'. 'bar')) : "foobarfoo"))); +return 'string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string'; +return ('string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string'); + +return function () {}; +return (function () {})(); + +return call(); +return $a->b->c->d->e->f; +return $a->b()->c()->d()->e()->f(); +return call()->b()->c()->d()->e()->f(); +return $a::b()::c()::d()::e()::f(); +return Foo::a()::b()::c()::d()::e()::f(); + +return " +string +string +string +"; + +return $str = <<basePath . '/composer.json'), + true +)['extra']['laravel']['dont-discover'] ?? []; + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)['extra']['laravel']['dont-discover'] ? [] : []; + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)['extra']['laravel']['dont-discover'] . 'string'; + +return 'string' . json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)['extra']['laravel']['dont-discover']; + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)->foo->bar->foo->bar; + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)->foo()->bar()->foo()->bar(); + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)::foo()::bar()::foo()::bar(); + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)->foo->bar->foo->bar . 'string'; + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)->foo()->bar()->foo()->bar() . 'string'; + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)::foo()::bar()::foo()::bar() . 'string'; + +return isset($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongLine) ? true : false; + +return eval('$var = "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongLine"; $var .= $var;'); + +return include 'foo.php' . ' MORE OUTPUT'; +return include 'foo.php' . ' MORE OUTPUT' . ' MORE OUTPUT' . ' MORE OUTPUT' . ' MORE OUTPUT' . ' MORE OUTPUT' . ' MORE OUTPUT'; + +return new Foo($arg); +return new Foo($arg, 'string', 1024, $veryVeryVeryVeryVeryVeryLongLine, true, false); +return new Foo($arg, 'string', 1024, $veryVeryVeryVeryVeryVeryLongLine, true, false) . 'string'; +return 'string' . new Foo($arg, 'string', 1024, $veryVeryVeryVeryVeryVeryLongLine, true, false); + +return []; +return ['foo', 'bar']; +return ['key' => 'foo', 'other-key' => 'bar']; +return [ + 'key' => 'foo', + 'other-key' => 'bar' +]; +return ['foo', 'bar', 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongLine']; +return [ + 'bootstrap' => '^4.0.0', + 'jquery' => '^3.2', + 'popper.js' => '^1.12' +] || $packages; +return $packages || [ + 'bootstrap' => '^4.0.0', + 'jquery' => '^3.2', + 'popper.js' => '^1.12' +]; + +return $this->events->until( + new Events\\NotificationSending( + $notifiable, + $notification, + $channel + ) +) !== false; + +return false !== $this->events->until( + new Events\\NotificationSending( + $notifiable, + $notification, + $channel + ) +); + +return $this->getOptions()['endpoint'] ?? + 'https://api.sparkpost.com/api/v1/transmissions'; +return $this->getOptions()['endpoint'] ?? + 'https://api.sparkpost.com/api/v1/transmissions' ?? + 'https://api.sparkpost.com/api/v1/transmissions' ?? + 'https://api.sparkpost.com/api/v1/transmissions'; + +return $this->channels[$name] ?? + with($this->resolve($name), function ($logger) use ($name) { + return $this->channels[$name] = $this->tap( + $name, + new Logger($logger, $this->app['events']) + ); + }); + +return $original instanceof self + ? $original->{__FUNCTION__}() + : $original; +return $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable instanceof self + ? $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->{__FUNCTION__}() + : $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable; + +return count($this->query()) > 0 + ? $this->url() . + $question . + Arr::query(array_merge($this->query(), $query)) + : $this->fullUrl() . $question . Arr::query($query); +return count($this->query()) > 0 + ? $this->url() . + $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable . + Arr::query(array_merge($this->query(), $query)) + : $this->fullUrl() . + $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable . + Arr::query($query); + +return $this->hasEncodingOption(JSON_PARTIAL_OUTPUT_ON_ERROR) && + in_array($jsonError, [ + JSON_ERROR_RECURSION, + JSON_ERROR_INF_OR_NAN, + JSON_ERROR_UNSUPPORTED_TYPE + ]); + +return in_array($jsonError, [ + JSON_ERROR_RECURSION, + JSON_ERROR_INF_OR_NAN, + JSON_ERROR_UNSUPPORTED_TYPE +]) && $this->hasEncodingOption(JSON_PARTIAL_OUTPUT_ON_ERROR); + +return $this->guards[$name] ?? ($this->guards[$name] = $this->resolve($name)); +return $this->guards[$veryVeryVeryLongVariable] ?? ($this->guards[$name] = $this->resolve($name)); +return $this->guards[$name] ?? ($this->guards[$veryVeryVeryLongVariable] = $this->resolve($name)); +return $this->guards[$name] ?? ($this->guards[$name] = $this->resolve($veryVeryVeryLongVariable)); +return $this->guards[$veryVeryVeryLongVariable] ?? ($this->guards[$veryVeryVeryLongVariable] = $this->resolve($veryVeryVeryLongVariable)); + +return call_user_func($this->passwordValidator, $credentials) && $password === $confirm; +return $password === $confirm && call_user_func($this->passwordValidator, $credentials); + +return is_string($this->recaller) && Str::contains($this->recaller, '|'); +return is_string($this->recallerWithClass) && Str::contains($this->recaller, '|'); +return Str::contains($this->recaller, '|') && is_string($this->recallerWithClass); + +return in_array('odbc', $this->getAvailableDrivers()) && $config['odbc'] ?? null === true; +return in_array('odbc', $this->getAvailableDrivers()) && $config['odbc'] ?? + null === true; +return in_array('odbc', $this->getAvailableDrivers()) && ($config['odbc'] ?? null) === true; +return in_array('odbc', $this->getAvailableDrivers()) && + ($config['odbc'] ?? null) === true; +return ($map[$name] ?? $name).(! is_null($parameters) ? ':'.$parameters : ''); +return ($map[$name] ?? $name) . + (!is_null($parameters) ? ':' . $parameters : ''); + +=====================================output===================================== + + "VeryVeryVeryVeryVeryVeryVeryVeryVeryLongString", + $veryVeryVeryVeryVeryVeryLongKey => + "VeryVeryVeryVeryVeryVeryVeryVeryVeryLongString", + 3, +]; +return $a + $b; +return $a / $b; +return $a && $b; +return new $VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClassName(); +return "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; +return "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; +return 1000000000 + + 1000000000 + + 1000000000 + + 1000000000 + + 1000000000 + + 1000000000 + + 1000000000 + + 1000000000 + + 1000000000 + + 1000000000 + + 1000000000; +return 1000000000 + + 1000000000 + + 1000000000 + + 1000000000 + + 1000000000 + + 1000000000 + + 1000000000 + + 1000000000 + + 1000000000 + + 1000000000 + + 1000000000; +return $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable + ? true + : false; +return $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->veryVeryVeryVeryVeryVeryLongProperty; +return $true ? "foo" . ("foo" . "bar") : "foobarfoo"; +return "string" . + "string" . + "string" . + "string" . + "string" . + "string" . + "string" . + "string"; +return "string" . + "string" . + "string" . + "string" . + "string" . + "string" . + "string" . + "string"; + +return function () {}; +return (function () {})(); + +return call(); +return $a->b->c->d->e->f; +return $a->b()->c()->d()->e()->f(); +return call()->b()->c()->d()->e()->f(); +return $a::b()::c()::d()::e()::f(); +return Foo::a()::b()::c()::d()::e()::f(); + +return " +string +string +string +"; + +return $str = <<basePath . "/composer.json"), true)[ + "extra" +]["laravel"]["dont-discover"] ?? []; + +return json_decode(file_get_contents($this->basePath . "/composer.json"), true)[ + "extra" +]["laravel"]["dont-discover"] + ? [] + : []; + +return json_decode(file_get_contents($this->basePath . "/composer.json"), true)[ + "extra" +]["laravel"]["dont-discover"] . "string"; + +return "string" . + json_decode(file_get_contents($this->basePath . "/composer.json"), true)[ + "extra" + ]["laravel"]["dont-discover"]; + +return json_decode(file_get_contents($this->basePath . "/composer.json"), true) + ->foo->bar->foo->bar; + +return json_decode(file_get_contents($this->basePath . "/composer.json"), true) + ->foo() + ->bar() + ->foo() + ->bar(); + +return json_decode(file_get_contents($this->basePath . "/composer.json"), true) + ::foo() + ::bar() + ::foo() + ::bar(); + +return json_decode(file_get_contents($this->basePath . "/composer.json"), true) + ->foo->bar->foo->bar . "string"; + +return json_decode(file_get_contents($this->basePath . "/composer.json"), true) + ->foo() + ->bar() + ->foo() + ->bar() . "string"; + +return json_decode(file_get_contents($this->basePath . "/composer.json"), true) + ::foo() + ::bar() + ::foo() + ::bar() . "string"; + +return isset($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongLine) + ? true + : false; + +return eval( + '$var = "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongLine"; $var .= $var;' +); + +return include "foo.php" . " MORE OUTPUT"; +return include "foo.php" . + " MORE OUTPUT" . + " MORE OUTPUT" . + " MORE OUTPUT" . + " MORE OUTPUT" . + " MORE OUTPUT" . + " MORE OUTPUT"; + +return new Foo($arg); +return new Foo( + $arg, + "string", + 1024, + $veryVeryVeryVeryVeryVeryLongLine, + true, + false, +); +return new Foo( + $arg, + "string", + 1024, + $veryVeryVeryVeryVeryVeryLongLine, + true, + false, +) . "string"; +return "string" . + new Foo( + $arg, + "string", + 1024, + $veryVeryVeryVeryVeryVeryLongLine, + true, + false, + ); + +return []; +return ["foo", "bar"]; +return ["key" => "foo", "other-key" => "bar"]; +return [ + "key" => "foo", + "other-key" => "bar", +]; +return [ + "foo", + "bar", + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongLine", +]; +return [ + "bootstrap" => "^4.0.0", + "jquery" => "^3.2", + "popper.js" => "^1.12", +] || $packages; +return $packages || [ + "bootstrap" => "^4.0.0", + "jquery" => "^3.2", + "popper.js" => "^1.12", +]; + +return $this->events->until( + new Events\\NotificationSending($notifiable, $notification, $channel), +) !== false; + +return false !== + $this->events->until( + new Events\\NotificationSending($notifiable, $notification, $channel), + ); + +return $this->getOptions()["endpoint"] ?? + "https://api.sparkpost.com/api/v1/transmissions"; +return $this->getOptions()["endpoint"] ?? + ("https://api.sparkpost.com/api/v1/transmissions" ?? + ("https://api.sparkpost.com/api/v1/transmissions" ?? + "https://api.sparkpost.com/api/v1/transmissions")); + +return $this->channels[$name] ?? + with($this->resolve($name), function ($logger) use ($name) { + return $this->channels[$name] = $this->tap( + $name, + new Logger($logger, $this->app["events"]), + ); + }); + +return $original instanceof self ? $original->{__FUNCTION__}() : $original; +return $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable instanceof self + ? $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->{__FUNCTION__}() + : $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable; + +return count($this->query()) > 0 + ? $this->url() . $question . Arr::query(array_merge($this->query(), $query)) + : $this->fullUrl() . $question . Arr::query($query); +return count($this->query()) > 0 + ? $this->url() . + $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable . + Arr::query(array_merge($this->query(), $query)) + : $this->fullUrl() . + $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable . + Arr::query($query); + +return $this->hasEncodingOption(JSON_PARTIAL_OUTPUT_ON_ERROR) && + in_array($jsonError, [ + JSON_ERROR_RECURSION, + JSON_ERROR_INF_OR_NAN, + JSON_ERROR_UNSUPPORTED_TYPE, + ]); + +return in_array($jsonError, [ + JSON_ERROR_RECURSION, + JSON_ERROR_INF_OR_NAN, + JSON_ERROR_UNSUPPORTED_TYPE, +]) && $this->hasEncodingOption(JSON_PARTIAL_OUTPUT_ON_ERROR); + +return $this->guards[$name] ?? ($this->guards[$name] = $this->resolve($name)); +return $this->guards[$veryVeryVeryLongVariable] ?? + ($this->guards[$name] = $this->resolve($name)); +return $this->guards[$name] ?? + ($this->guards[$veryVeryVeryLongVariable] = $this->resolve($name)); +return $this->guards[$name] ?? + ($this->guards[$name] = $this->resolve($veryVeryVeryLongVariable)); +return $this->guards[$veryVeryVeryLongVariable] ?? + ($this->guards[$veryVeryVeryLongVariable] = $this->resolve( + $veryVeryVeryLongVariable, + )); + +return call_user_func($this->passwordValidator, $credentials) && + $password === $confirm; +return $password === $confirm && + call_user_func($this->passwordValidator, $credentials); + +return is_string($this->recaller) && Str::contains($this->recaller, "|"); +return is_string($this->recallerWithClass) && + Str::contains($this->recaller, "|"); +return Str::contains($this->recaller, "|") && + is_string($this->recallerWithClass); + +return in_array("odbc", $this->getAvailableDrivers()) && $config["odbc"] ?? + null === true; +return in_array("odbc", $this->getAvailableDrivers()) && $config["odbc"] ?? + null === true; +return in_array("odbc", $this->getAvailableDrivers()) && + ($config["odbc"] ?? null) === true; +return in_array("odbc", $this->getAvailableDrivers()) && + ($config["odbc"] ?? null) === true; +return ($map[$name] ?? $name) . + (!is_null($parameters) ? ":" . $parameters : ""); +return ($map[$name] ?? $name) . + (!is_null($parameters) ? ":" . $parameters : ""); + +================================================================================ +`; diff --git a/tests/return/jsfmt.spec.js b/tests/return/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/return/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/return/jsfmt.spec.mjs b/tests/return/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/return/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/return/return.php b/tests/return/return.php index 054dea52a..1eb400f74 100644 --- a/tests/return/return.php +++ b/tests/return/return.php @@ -6,6 +6,12 @@ function sum($a, $b) { return; return $name; +return + +$name; +return + +$VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClassName; return [1, 2, 3]; return [$veryVeryVeryVeryVeryVeryLongKey => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', $veryVeryVeryVeryVeryVeryLongKey => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', 3]; return ($a + $b); @@ -19,3 +25,210 @@ function sum($a, $b) { return $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable ? true : false; return $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->veryVeryVeryVeryVeryVeryLongProperty; return ((($true ? ('foo' . ('foo'. 'bar')) : "foobarfoo"))); +return 'string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string'; +return ('string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string' . 'string'); + +return function () {}; +return (function () {})(); + +return call(); +return $a->b->c->d->e->f; +return $a->b()->c()->d()->e()->f(); +return call()->b()->c()->d()->e()->f(); +return $a::b()::c()::d()::e()::f(); +return Foo::a()::b()::c()::d()::e()::f(); + +return " +string +string +string +"; + +return $str = <<basePath . '/composer.json'), + true +)['extra']['laravel']['dont-discover'] ?? []; + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)['extra']['laravel']['dont-discover'] ? [] : []; + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)['extra']['laravel']['dont-discover'] . 'string'; + +return 'string' . json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)['extra']['laravel']['dont-discover']; + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)->foo->bar->foo->bar; + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)->foo()->bar()->foo()->bar(); + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)::foo()::bar()::foo()::bar(); + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)->foo->bar->foo->bar . 'string'; + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)->foo()->bar()->foo()->bar() . 'string'; + +return json_decode( + file_get_contents($this->basePath . '/composer.json'), + true +)::foo()::bar()::foo()::bar() . 'string'; + +return isset($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongLine) ? true : false; + +return eval('$var = "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongLine"; $var .= $var;'); + +return include 'foo.php' . ' MORE OUTPUT'; +return include 'foo.php' . ' MORE OUTPUT' . ' MORE OUTPUT' . ' MORE OUTPUT' . ' MORE OUTPUT' . ' MORE OUTPUT' . ' MORE OUTPUT'; + +return new Foo($arg); +return new Foo($arg, 'string', 1024, $veryVeryVeryVeryVeryVeryLongLine, true, false); +return new Foo($arg, 'string', 1024, $veryVeryVeryVeryVeryVeryLongLine, true, false) . 'string'; +return 'string' . new Foo($arg, 'string', 1024, $veryVeryVeryVeryVeryVeryLongLine, true, false); + +return []; +return ['foo', 'bar']; +return ['key' => 'foo', 'other-key' => 'bar']; +return [ + 'key' => 'foo', + 'other-key' => 'bar' +]; +return ['foo', 'bar', 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongLine']; +return [ + 'bootstrap' => '^4.0.0', + 'jquery' => '^3.2', + 'popper.js' => '^1.12' +] || $packages; +return $packages || [ + 'bootstrap' => '^4.0.0', + 'jquery' => '^3.2', + 'popper.js' => '^1.12' +]; + +return $this->events->until( + new Events\NotificationSending( + $notifiable, + $notification, + $channel + ) +) !== false; + +return false !== $this->events->until( + new Events\NotificationSending( + $notifiable, + $notification, + $channel + ) +); + +return $this->getOptions()['endpoint'] ?? + 'https://api.sparkpost.com/api/v1/transmissions'; +return $this->getOptions()['endpoint'] ?? + 'https://api.sparkpost.com/api/v1/transmissions' ?? + 'https://api.sparkpost.com/api/v1/transmissions' ?? + 'https://api.sparkpost.com/api/v1/transmissions'; + +return $this->channels[$name] ?? + with($this->resolve($name), function ($logger) use ($name) { + return $this->channels[$name] = $this->tap( + $name, + new Logger($logger, $this->app['events']) + ); + }); + +return $original instanceof self + ? $original->{__FUNCTION__}() + : $original; +return $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable instanceof self + ? $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->{__FUNCTION__}() + : $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable; + +return count($this->query()) > 0 + ? $this->url() . + $question . + Arr::query(array_merge($this->query(), $query)) + : $this->fullUrl() . $question . Arr::query($query); +return count($this->query()) > 0 + ? $this->url() . + $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable . + Arr::query(array_merge($this->query(), $query)) + : $this->fullUrl() . + $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable . + Arr::query($query); + +return $this->hasEncodingOption(JSON_PARTIAL_OUTPUT_ON_ERROR) && + in_array($jsonError, [ + JSON_ERROR_RECURSION, + JSON_ERROR_INF_OR_NAN, + JSON_ERROR_UNSUPPORTED_TYPE + ]); + +return in_array($jsonError, [ + JSON_ERROR_RECURSION, + JSON_ERROR_INF_OR_NAN, + JSON_ERROR_UNSUPPORTED_TYPE +]) && $this->hasEncodingOption(JSON_PARTIAL_OUTPUT_ON_ERROR); + +return $this->guards[$name] ?? ($this->guards[$name] = $this->resolve($name)); +return $this->guards[$veryVeryVeryLongVariable] ?? ($this->guards[$name] = $this->resolve($name)); +return $this->guards[$name] ?? ($this->guards[$veryVeryVeryLongVariable] = $this->resolve($name)); +return $this->guards[$name] ?? ($this->guards[$name] = $this->resolve($veryVeryVeryLongVariable)); +return $this->guards[$veryVeryVeryLongVariable] ?? ($this->guards[$veryVeryVeryLongVariable] = $this->resolve($veryVeryVeryLongVariable)); + +return call_user_func($this->passwordValidator, $credentials) && $password === $confirm; +return $password === $confirm && call_user_func($this->passwordValidator, $credentials); + +return is_string($this->recaller) && Str::contains($this->recaller, '|'); +return is_string($this->recallerWithClass) && Str::contains($this->recaller, '|'); +return Str::contains($this->recaller, '|') && is_string($this->recallerWithClass); + +return in_array('odbc', $this->getAvailableDrivers()) && $config['odbc'] ?? null === true; +return in_array('odbc', $this->getAvailableDrivers()) && $config['odbc'] ?? + null === true; +return in_array('odbc', $this->getAvailableDrivers()) && ($config['odbc'] ?? null) === true; +return in_array('odbc', $this->getAvailableDrivers()) && + ($config['odbc'] ?? null) === true; +return ($map[$name] ?? $name).(! is_null($parameters) ? ':'.$parameters : ''); +return ($map[$name] ?? $name) . + (!is_null($parameters) ? ':' . $parameters : ''); diff --git a/tests/shebang/__snapshots__/jsfmt.spec.js.snap b/tests/shebang/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 069408763..000000000 --- a/tests/shebang/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,12 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`shebang.php 1`] = ` -#!/usr/bin/php - + +=====================================output===================================== +#!/usr/bin/php + + +================================================================================ +`; + +exports[`inline.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +#!/usr/bin/php + diff --git a/tests/shebang/inline.php b/tests/shebang/inline.php new file mode 100644 index 000000000..5c5de31d1 --- /dev/null +++ b/tests/shebang/inline.php @@ -0,0 +1,2 @@ +#!/usr/bin/php + 'veryVeryVeryVeryVery $variable = @foo()->veryVeryVeryVeryVeryLongMethod()->veryVeryVeryVeryVeryLongMethod()->veryVeryVeryVeryVeryLongMethod(); $variable = @foo('VeryVeryVeryVeryVeryVeryLongArgument', 'VeryVeryVeryVeryVeryVeryLongArgument', 'VeryVeryVeryVeryVeryVeryLongArgument'); @trigger_error($error, E_USER_DEPRECATED); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +$value = @ $cache[$key]; + +=====================================output===================================== 'veryVeryVeryVeryVeryVeryLongValue' + "veryVeryVeryVeryVeryVeryVeryLongKey" => + "veryVeryVeryVeryVeryVeryLongValue", ]); $variable = @foo() ->veryVeryVeryVeryVeryLongMethod() ->veryVeryVeryVeryVeryLongMethod() ->veryVeryVeryVeryVeryLongMethod(); $variable = @foo( - 'VeryVeryVeryVeryVeryVeryLongArgument', - 'VeryVeryVeryVeryVeryVeryLongArgument', - 'VeryVeryVeryVeryVeryVeryLongArgument' + "VeryVeryVeryVeryVeryVeryLongArgument", + "VeryVeryVeryVeryVeryVeryLongArgument", + "VeryVeryVeryVeryVeryVeryLongArgument", ); @trigger_error($error, E_USER_DEPRECATED); +$value = @$cache[$key]; +================================================================================ `; diff --git a/tests/silent/jsfmt.spec.js b/tests/silent/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/silent/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/silent/jsfmt.spec.mjs b/tests/silent/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/silent/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/silent/silent.php b/tests/silent/silent.php index 262b197f5..0273e482f 100644 --- a/tests/silent/silent.php +++ b/tests/silent/silent.php @@ -10,3 +10,4 @@ $variable = @foo()->veryVeryVeryVeryVeryLongMethod()->veryVeryVeryVeryVeryLongMethod()->veryVeryVeryVeryVeryLongMethod(); $variable = @foo('VeryVeryVeryVeryVeryVeryLongArgument', 'VeryVeryVeryVeryVeryVeryLongArgument', 'VeryVeryVeryVeryVeryVeryLongArgument'); @trigger_error($error, E_USER_DEPRECATED); +$value = @ $cache[$key]; diff --git a/tests/single-quote-api/jsfmt.spec.mjs b/tests/single-quote-api/jsfmt.spec.mjs new file mode 100644 index 000000000..bb9db6fb7 --- /dev/null +++ b/tests/single-quote-api/jsfmt.spec.mjs @@ -0,0 +1,21 @@ +import prettier from "prettier/standalone"; +import * as prettierPluginPhp from "../../src/index.mjs"; + +// https://github.com/prettier/plugin-php/issues/2302 +test(`singleQuote option on format api`, async () => { + const input = ``; + const result = await prettier.format(input, { + plugins: [prettierPluginPhp], + singleQuote: true, + parser: "php", + }); + + const expected = ` +`; + + expect(result).toEqual(expected); +}); diff --git a/tests/statement/__snapshots__/jsfmt.spec.js.snap b/tests/statement/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 19c8f0abf..000000000 --- a/tests/statement/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,25 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`statement.php 1`] = ` - 'value', 'other-key' => 'other-value']; +static $a = [ + 'key' => 'value', + 'other-key' => 'other-value' +]; +static $a = ['key' => 'value', 'other-key' => 'other-value'], $b = ['key' => 'value', 'other-key' => 'other-value']; +static $a = [ + 'key' => 'value', + 'other-key' => 'other-value' + ], + $b = [ + 'key' => 'value', + 'other-key' => 'other-value' + ]; +static $a = 'string' . 'string' . 'string' . 'string' . 'string' . 'string'. 'string' . 'string'; +static $a, $b = 'string' . 'string' . 'string' . 'string' . 'string' . 'string'. 'string' . 'string'; +static $a = 'string +string +string'; +static $a = 'string +string +string', $b = 'string +string +string'; + +=====================================output===================================== + "value", "other-key" => "other-value"]; +static $a = [ + "key" => "value", + "other-key" => "other-value", +]; +static $a = ["key" => "value", "other-key" => "other-value"], + $b = ["key" => "value", "other-key" => "other-value"]; +static $a = [ + "key" => "value", + "other-key" => "other-value", + ], + $b = [ + "key" => "value", + "other-key" => "other-value", + ]; +static $a = + "string" . + "string" . + "string" . + "string" . + "string" . + "string" . + "string" . + "string"; +static $a, + $b = + "string" . + "string" . + "string" . + "string" . + "string" . + "string" . + "string" . + "string"; +static $a = 'string +string +string'; +static $a = 'string +string +string', + $b = 'string +string +string'; + +================================================================================ +`; diff --git a/tests/static/jsfmt.spec.js b/tests/static/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/static/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/static/jsfmt.spec.mjs b/tests/static/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/static/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/static/static.php b/tests/static/static.php index 103bb15eb..b4b601253 100644 --- a/tests/static/static.php +++ b/tests/static/static.php @@ -1,4 +1,37 @@ 'value', 'other-key' => 'other-value']; +static $a = [ + 'key' => 'value', + 'other-key' => 'other-value' +]; +static $a = ['key' => 'value', 'other-key' => 'other-value'], $b = ['key' => 'value', 'other-key' => 'other-value']; +static $a = [ + 'key' => 'value', + 'other-key' => 'other-value' + ], + $b = [ + 'key' => 'value', + 'other-key' => 'other-value' + ]; +static $a = 'string' . 'string' . 'string' . 'string' . 'string' . 'string'. 'string' . 'string'; +static $a, $b = 'string' . 'string' . 'string' . 'string' . 'string' . 'string'. 'string' . 'string'; +static $a = 'string +string +string'; +static $a = 'string +string +string', $b = 'string +string +string'; diff --git a/tests/staticlookup/__snapshots__/jsfmt.spec.js.snap b/tests/staticlookup/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 2437fb4f5..000000000 --- a/tests/staticlookup/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,37 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`single.php 1`] = ` - 'bar', - 'bar' => 'foo', - 'foobar' => 'barfoo', - 'barfoo' => 'foobar' -]); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 'bar', - 'bar' => 'foo', - 'foobar' => 'barfoo', - 'barfoo' => 'foobar' -]); - -`; diff --git a/tests/staticlookup/__snapshots__/jsfmt.spec.mjs.snap b/tests/staticlookup/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..121cb5059 --- /dev/null +++ b/tests/staticlookup/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,370 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`single.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 'bar', + 'bar' => 'foo', + 'foobar' => 'barfoo', + 'barfoo' => 'foobar' +]); +MyClass::$aStaticProp; +MyClass::$aStaticProp = 1; +$classname::$aStaticProp; +MyClass::$$b; + +class Foo +{ + public static $my_static = 'foo'; + + public function staticValue() { + return self::$my_static; + } +} + +class Bar extends Foo +{ + public function fooStatic() { + return parent::$my_static; + } +} + +abstract class DataRecord { + private static $db; // MySQLi-Connection, same for all subclasses + private static $table = array(); // Array of tables for subclasses + + public static function init($classname, $table, $db = false) { + if (!($db === false)) self::$db = $db; + self::$table[$classname] = $table; + } + + public static function getDB() { return self::$db; } + public static function getTable($classname) { return self::$table[$classname]; } +} + +abstract class Singleton { + + protected static $_instance = NULL; + + /** + * Prevent direct object creation + */ + final private function __construct() { } + + /** + * Prevent object cloning + */ + final private function __clone() { } + + /** + * Returns new or existing Singleton instance + * @return Singleton + */ + final public static function getInstance(){ + if(null !== static::$_instance){ + return static::$_instance; + } + static::$_instance = new static(); + return static::$_instance; + } + +} + +MyClass::$table[$classname] = 1; + +$obj::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; +$obj::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; +$obj::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); +$obj::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + +class Foo { + public static function staticFoo() { + static::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + static::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + static::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + static::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + } + + public static function selfFoo() + { + self::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + self::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + self::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + self::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + } + + public static function parentFoo() + { + parent::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + parent::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + parent::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + parent::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + } +} + +$var = ($this->modelClass)::where('name', 'like', strtoupper("%\${key}%"))->get(); + +MyVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClass::class; + +$var = static::$arrayCache[$arrayStub->class][$arrayStub->position][$arrayStub->foo][$arrayStub->baz]; +$var = self::$arrayCache[$arrayStub->class][$arrayStub->position][$arrayStub->foo][$arrayStub->baz]; +$var = parent::$arrayCache[$arrayStub->class][$arrayStub->position][$arrayStub->foo][$arrayStub->baz]; + +$var = Order::{camel_case($name)}(); +$var = Order::{"string"}(); +$var = Order::{1}(); +$var = Order::{__FILE__}(); +$var = Order::{true}(); +$var = Order::{$var ? "foo" : "bar"}(); +$var = Order::{"foo" . "bar"}(); +$var = Order::{$var = "test"}(); +$var = Order::{(string) $var = 1111}(); +$var = Order::{(string)["test"]}(); +$var = Order::{$var}(); +$var = Order::{$$var}(); + +$var = ($var[0])::foo; +$var = ($var[0][1])::foo; +$var = ($var[0])[1]::foo; +$var = (($var[0])[1])::foo; +$var = (new Foo())::bar; +$var = (Foo::$bar)['baz'](); +$var = Foo::$bar['baz'](); +$var = Foo::{$bar['baz']}(); +$var = Foo::$bar['baz'](); + +get_class($this->resource)::$wrap; + +$var = (Foo::$bar)['baz'](); + +$var = get_class($var)::property; +$var = get_class($var)::$property; +$var = get_class($var)::$$property; +$var = get_class($var)::$$$property; +$var = get_class($var)::$$$$property; +$var = get_class($var)::$$$$$property; + +$var = $bar->{$property->foo}; +// TODO https://github.com/glayzzle/php-parser/issues/254 +// $var = $bar->\${$property}; +$var = $bar->foo_{$property}; + +=====================================output===================================== + "bar", + "bar" => "foo", + "foobar" => "barfoo", + "barfoo" => "foobar", +]); +MyClass::$aStaticProp; +MyClass::$aStaticProp = 1; +$classname::$aStaticProp; +MyClass::$$b; + +class Foo +{ + public static $my_static = "foo"; + + public function staticValue() + { + return self::$my_static; + } +} + +class Bar extends Foo +{ + public function fooStatic() + { + return parent::$my_static; + } +} + +abstract class DataRecord +{ + private static $db; // MySQLi-Connection, same for all subclasses + private static $table = []; // Array of tables for subclasses + + public static function init($classname, $table, $db = false) + { + if (!($db === false)) { + self::$db = $db; + } + self::$table[$classname] = $table; + } + + public static function getDB() + { + return self::$db; + } + public static function getTable($classname) + { + return self::$table[$classname]; + } +} + +abstract class Singleton +{ + protected static $_instance = null; + + /** + * Prevent direct object creation + */ + final private function __construct() {} + + /** + * Prevent object cloning + */ + final private function __clone() {} + + /** + * Returns new or existing Singleton instance + * @return Singleton + */ + final public static function getInstance() + { + if (null !== static::$_instance) { + return static::$_instance; + } + static::$_instance = new static(); + return static::$_instance; + } +} + +MyClass::$table[$classname] = 1; + +$obj::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; +$obj::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; +$obj::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); +$obj::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + +class Foo +{ + public static function staticFoo() + { + static::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + static::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + static::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + static::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + } + + public static function selfFoo() + { + self::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + self::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + self::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + self::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + } + + public static function parentFoo() + { + parent::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + parent::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + parent::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + parent::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + } +} + +$var = $this->modelClass::where("name", "like", strtoupper("%\${key}%"))->get(); + +MyVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClass::class; + +$var = + static::$arrayCache[$arrayStub->class][$arrayStub->position][ + $arrayStub->foo + ][$arrayStub->baz]; +$var = + self::$arrayCache[$arrayStub->class][$arrayStub->position][$arrayStub->foo][ + $arrayStub->baz + ]; +$var = + parent::$arrayCache[$arrayStub->class][$arrayStub->position][ + $arrayStub->foo + ][$arrayStub->baz]; + +$var = Order::{camel_case($name)}(); +$var = Order::{"string"}(); +$var = Order::{1}(); +$var = Order::{__FILE__}(); +$var = Order::{true}(); +$var = Order::{$var ? "foo" : "bar"}(); +$var = Order::{"foo" . "bar"}(); +$var = Order::{($var = "test")}(); +$var = Order::{(string) ($var = 1111)}(); +$var = Order::{(string) ["test"]}(); +$var = Order::{$var}(); +$var = Order::{$$var}(); + +$var = $var[0]::foo; +$var = $var[0][1]::foo; +$var = $var[0][1]::foo; +$var = $var[0][1]::foo; +$var = new Foo()::bar; +$var = Foo::$bar["baz"](); +$var = Foo::$bar["baz"](); +$var = Foo::{$bar["baz"]}(); +$var = Foo::$bar["baz"](); + +get_class($this->resource)::$wrap; + +$var = Foo::$bar["baz"](); + +$var = get_class($var)::property; +$var = get_class($var)::$property; +$var = get_class($var)::$$property; +$var = get_class($var)::$$$property; +$var = get_class($var)::$$$$property; +$var = get_class($var)::$$$$$property; + +$var = $bar->{$property->foo}; +// TODO https://github.com/glayzzle/php-parser/issues/254 +// $var = $bar->\${$property}; +$var = $bar->foo_[$property]; + +================================================================================ +`; diff --git a/tests/staticlookup/jsfmt.spec.js b/tests/staticlookup/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/staticlookup/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/staticlookup/jsfmt.spec.mjs b/tests/staticlookup/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/staticlookup/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/staticlookup/single-variable.php b/tests/staticlookup/single-variable.php new file mode 100644 index 000000000..1e2fa0ad3 --- /dev/null +++ b/tests/staticlookup/single-variable.php @@ -0,0 +1,2 @@ + 'barfoo', 'barfoo' => 'foobar' ]); +MyClass::$aStaticProp; +MyClass::$aStaticProp = 1; +$classname::$aStaticProp; +MyClass::$$b; + +class Foo +{ + public static $my_static = 'foo'; + + public function staticValue() { + return self::$my_static; + } +} + +class Bar extends Foo +{ + public function fooStatic() { + return parent::$my_static; + } +} + +abstract class DataRecord { + private static $db; // MySQLi-Connection, same for all subclasses + private static $table = array(); // Array of tables for subclasses + + public static function init($classname, $table, $db = false) { + if (!($db === false)) self::$db = $db; + self::$table[$classname] = $table; + } + + public static function getDB() { return self::$db; } + public static function getTable($classname) { return self::$table[$classname]; } +} + +abstract class Singleton { + + protected static $_instance = NULL; + + /** + * Prevent direct object creation + */ + final private function __construct() { } + + /** + * Prevent object cloning + */ + final private function __clone() { } + + /** + * Returns new or existing Singleton instance + * @return Singleton + */ + final public static function getInstance(){ + if(null !== static::$_instance){ + return static::$_instance; + } + static::$_instance = new static(); + return static::$_instance; + } + +} + +MyClass::$table[$classname] = 1; + +$obj::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; +$obj::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; +$obj::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); +$obj::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + +class Foo { + public static function staticFoo() { + static::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + static::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + static::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + static::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + } + + public static function selfFoo() + { + self::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + self::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + self::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + self::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + } + + public static function parentFoo() + { + parent::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + parent::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty; + parent::veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + parent::$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty(); + } +} + +$var = ($this->modelClass)::where('name', 'like', strtoupper("%${key}%"))->get(); + +MyVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClass::class; + +$var = static::$arrayCache[$arrayStub->class][$arrayStub->position][$arrayStub->foo][$arrayStub->baz]; +$var = self::$arrayCache[$arrayStub->class][$arrayStub->position][$arrayStub->foo][$arrayStub->baz]; +$var = parent::$arrayCache[$arrayStub->class][$arrayStub->position][$arrayStub->foo][$arrayStub->baz]; + +$var = Order::{camel_case($name)}(); +$var = Order::{"string"}(); +$var = Order::{1}(); +$var = Order::{__FILE__}(); +$var = Order::{true}(); +$var = Order::{$var ? "foo" : "bar"}(); +$var = Order::{"foo" . "bar"}(); +$var = Order::{$var = "test"}(); +$var = Order::{(string) $var = 1111}(); +$var = Order::{(string)["test"]}(); +$var = Order::{$var}(); +$var = Order::{$$var}(); + +$var = ($var[0])::foo; +$var = ($var[0][1])::foo; +$var = ($var[0])[1]::foo; +$var = (($var[0])[1])::foo; +$var = (new Foo())::bar; +$var = (Foo::$bar)['baz'](); +$var = Foo::$bar['baz'](); +$var = Foo::{$bar['baz']}(); +$var = Foo::$bar['baz'](); + +get_class($this->resource)::$wrap; + +$var = (Foo::$bar)['baz'](); + +$var = get_class($var)::property; +$var = get_class($var)::$property; +$var = get_class($var)::$$property; +$var = get_class($var)::$$$property; +$var = get_class($var)::$$$$property; +$var = get_class($var)::$$$$$property; + +$var = $bar->{$property->foo}; +// TODO https://github.com/glayzzle/php-parser/issues/254 +// $var = $bar->${$property}; +$var = $bar->foo_{$property}; diff --git a/tests/string-double-quote/__snapshots__/jsfmt.spec.mjs.snap b/tests/string-double-quote/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..e8f8159a1 --- /dev/null +++ b/tests/string-double-quote/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`quoting.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 +singleQuote: false + | printWidth +=====================================input====================================== +call()}."; -$string = "combined \${$encapsed}."; -// $string = "He drank some $juices[koolaid1] juice."; -$string = "$people->john drank some $juices[0] juice."; -$string = "This is { $great}"; -$string = "This is {$great}"; -// $string = "This square is {$square->width}00 centimeters broad."; -// $string = "This works: {$arr['key']}"; -// $string = "This works: {$arr[4][3]}"; -$string = "This works: " . $arr['foo'][3]; -// $string = "This works too: {$obj->values[3]->name}"; -$string = "This is the value of the var named $name: {\${$name}}"; -$string = "This is the value of the var named by the return value of getName(): {\${getName()}}"; -$string = "This is the value of the var named by the return value of getName(): {\${getName($arg1, $arg2, $arg3)}}"; -// $string = "This is the value of the var named by the return value of \\$object->getName(): {\${$object->getName()}}"; -$string = "I'd like an {\${beers::softdrink}}\\n"; -$string = "I'd like an {\${beers::$ale}}\\n"; -$test = "\\\\"; -$test = '\\\\'; -printf("Query run in $queryTimeTaken seconds.\\n"); -$test = "You can also have embedded\\n newlines in -strings this way as it is -okay to do"; -$test = '/(<]*)>/i'; -$string = "\\"encapsed $escaping\\""; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -call()}."; -$string = "combined \${$encapsed}."; -// $string = "He drank some $juices[koolaid1] juice."; -$string = "{$people->john} drank some {$juices[0]} juice."; -$string = "This is { $great}"; -$string = "This is {$great}"; -// $string = "This square is {$square->width}00 centimeters broad."; -// $string = "This works: {$arr['key']}"; -// $string = "This works: {$arr[4][3]}"; -$string = "This works: " . $arr['foo'][3]; -// $string = "This works too: {$obj->values[3]->name}"; -$string = "This is the value of the var named $name: \${$name}"; -$string = "This is the value of the var named by the return value of getName(): \${getName()}"; -$string = "This is the value of the var named by the return value of getName(): \${getName( - $arg1, - $arg2, - $arg3 -)}"; -// $string = "This is the value of the var named by the return value of \\$object->getName(): {\${$object->getName()}}"; -$string = "I'd like an \${beers::softdrink}\\n"; -$string = "I'd like an \${beers::$ale}\\n"; -$test = "\\\\"; -$test = '\\\\'; -printf("Query run in $queryTimeTaken seconds.\\n"); -$test = - "You can also have embedded\\n newlines in -strings this way as it is -okay to do"; -$test = '/(<]*)>/i'; -$string = "\\"encapsed $escaping\\""; - -`; diff --git a/tests/string/__snapshots__/jsfmt.spec.mjs.snap b/tests/string/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..a166868aa --- /dev/null +++ b/tests/string/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,371 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`multiline.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +call()}."; +$string = "combined \${$encapsed}."; +$string = "He drank some $juices[koolaid1] juice."; +$string = "$people->john drank some $juices[0] juice."; +$string = "This is { $great}"; +$string = "This is {$great}"; +$string = "This square is {$square->width}00 centimeters broad."; +$string = "This works: {$arr['key']}"; +$string = "This works: {$arr[4][3]}"; +$string = "This works: " . $arr['foo'][3]; +$string = "This works too: {$obj->values[3]->name}"; +$string = "This is the value of the var named $name: {\${$name}}"; +$string = "This is the value of the var named by the return value of getName(): {\${getName()}}"; +$string = "This is the value of the var named by the return value of getName(): {\${getName($arg1, $arg2, $arg3)}}"; +$string = "This is the value of the var named by the return value of \\$object->getName(): {\${$object->getName()}}"; +$string = "I'd like an {\${beers::softdrink}}\\n"; +$string = "I'd like an {\${beers::$ale}}\\n"; +$test = "\\\\"; +$test = '\\\\'; +printf("Query run in $queryTimeTaken seconds.\\n"); +$test = "You can also have embedded\\n newlines in +strings this way as it is +okay to do"; +$test = '/(<]*)>/i'; +$string = "\\"encapsed $escaping\\""; +$string = 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString'; +$string = "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString\\n"; +$string = "ShortString\\n"; +$string = 'ShortString\\n'; +$string = "\\u{aa}"; +$string = "\\u{0000aa}"; +$string = "\\u{9999}"; +$string = '\\"bar\\"'; +$string = "\\'bar\\'"; +$string = "\\'"; +$string = '\\''; +$string = '\\"'; +$string = "\\#"; +$string = '\\#'; +$string = "\\e"; +$string = '\\e'; +$string = "\\""; +$string = '\\"'; +$string = '\\''; +$string = "\\"\${foo}\\""; +$string = '\\'\${foo}\\''; +$string = '\\"\${foo}\\"'; +$string = "/\\!/"; +$string = '/\\!/'; +$string = "/\\@/"; +$string = '/\\@/'; +$string = '\\n'; +$string = '\\r'; +$string = "\\n"; +$string = "\\r"; +$string = "\\t"; +$string = "\\v"; +$string = "\\e"; +$string = "\\f"; +$string = "\\\\"; +$string = "\\$"; +$string = "\\""; +$string = "\\0"; +$string = "\\777"; +$string = "\\xFF"; +$string = "\\u{FFFF}"; +$string = "\\:"; +$string = '\\:'; + +=====================================output===================================== +call()}."; +$string = "combined \${$encapsed}."; +$string = "He drank some $juices[koolaid1] juice."; +$string = "$people->john drank some $juices[0] juice."; +$string = "This is { $great}"; +$string = "This is {$great}"; +$string = "This square is {$square->width}00 centimeters broad."; +$string = "This works: {$arr["key"]}"; +$string = "This works: {$arr[4][3]}"; +$string = "This works: " . $arr["foo"][3]; +$string = "This works too: {$obj->values[3]->name}"; +$string = "This is the value of the var named $name: {\${$name}}"; +$string = "This is the value of the var named by the return value of getName(): {\${getName()}}"; +$string = "This is the value of the var named by the return value of getName(): {\${getName( + $arg1, + $arg2, + $arg3, +)}}"; +$string = "This is the value of the var named by the return value of \\$object->getName(): {\${$object->getName()}}"; +$string = "I'd like an {\${beers::softdrink}}\\n"; +$string = "I'd like an {\${beers::$ale}}\\n"; +$test = "\\\\"; +$test = "\\\\"; +printf("Query run in $queryTimeTaken seconds.\\n"); +$test = "You can also have embedded\\n newlines in +strings this way as it is +okay to do"; +$test = "/(<]*)>/i"; +$string = "\\"encapsed $escaping\\""; +$string = + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; +$string = + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString\\n"; +$string = "ShortString\\n"; +$string = 'ShortString\\n'; +$string = "\\u{aa}"; +$string = "\\u{0000aa}"; +$string = "\\u{9999}"; +$string = '\\"bar\\"'; +$string = "\\'bar\\'"; +$string = "\\'"; +$string = '\\''; +$string = '\\"'; +$string = "\\#"; +$string = "\\#"; +$string = "\\e"; +$string = '\\e'; +$string = "\\""; +$string = '\\"'; +$string = '\\''; +$string = "\\"\${foo}\\""; +$string = '\\'\${foo}\\''; +$string = '\\"\${foo}\\"'; +$string = "/\\!/"; +$string = "/\\!/"; +$string = "/\\@/"; +$string = "/\\@/"; +$string = '\\n'; +$string = '\\r'; +$string = "\\n"; +$string = "\\r"; +$string = "\\t"; +$string = "\\v"; +$string = "\\e"; +$string = "\\f"; +$string = "\\\\"; +$string = "\\$"; +$string = "\\""; +$string = "\\0"; +$string = "\\777"; +$string = "\\xFF"; +$string = "\\u{FFFF}"; +$string = "\\:"; +$string = "\\:"; + +================================================================================ +`; diff --git a/tests/string/jsfmt.spec.js b/tests/string/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/string/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/string/jsfmt.spec.mjs b/tests/string/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/string/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/string/multiline.php b/tests/string/multiline.php new file mode 100644 index 000000000..367b6f717 --- /dev/null +++ b/tests/string/multiline.php @@ -0,0 +1,16 @@ +call()}."; $string = "combined ${$encapsed}."; -// $string = "He drank some $juices[koolaid1] juice."; +$string = "He drank some $juices[koolaid1] juice."; $string = "$people->john drank some $juices[0] juice."; $string = "This is { $great}"; $string = "This is {$great}"; -// $string = "This square is {$square->width}00 centimeters broad."; -// $string = "This works: {$arr['key']}"; -// $string = "This works: {$arr[4][3]}"; +$string = "This square is {$square->width}00 centimeters broad."; +$string = "This works: {$arr['key']}"; +$string = "This works: {$arr[4][3]}"; $string = "This works: " . $arr['foo'][3]; -// $string = "This works too: {$obj->values[3]->name}"; +$string = "This works too: {$obj->values[3]->name}"; $string = "This is the value of the var named $name: {${$name}}"; $string = "This is the value of the var named by the return value of getName(): {${getName()}}"; $string = "This is the value of the var named by the return value of getName(): {${getName($arg1, $arg2, $arg3)}}"; -// $string = "This is the value of the var named by the return value of \$object->getName(): {${$object->getName()}}"; +$string = "This is the value of the var named by the return value of \$object->getName(): {${$object->getName()}}"; $string = "I'd like an {${beers::softdrink}}\n"; $string = "I'd like an {${beers::$ale}}\n"; $test = "\\"; @@ -63,3 +66,46 @@ okay to do"; $test = '/(<]*)>/i'; $string = "\"encapsed $escaping\""; +$string = 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString'; +$string = "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString\n"; +$string = "ShortString\n"; +$string = 'ShortString\n'; +$string = "\u{aa}"; +$string = "\u{0000aa}"; +$string = "\u{9999}"; +$string = '\"bar\"'; +$string = "\'bar\'"; +$string = "\'"; +$string = '\''; +$string = '\"'; +$string = "\#"; +$string = '\#'; +$string = "\e"; +$string = '\e'; +$string = "\""; +$string = '\"'; +$string = '\''; +$string = "\"${foo}\""; +$string = '\'${foo}\''; +$string = '\"${foo}\"'; +$string = "/\!/"; +$string = '/\!/'; +$string = "/\@/"; +$string = '/\@/'; +$string = '\n'; +$string = '\r'; +$string = "\n"; +$string = "\r"; +$string = "\t"; +$string = "\v"; +$string = "\e"; +$string = "\f"; +$string = "\\"; +$string = "\$"; +$string = "\""; +$string = "\0"; +$string = "\777"; +$string = "\xFF"; +$string = "\u{FFFF}"; +$string = "\:"; +$string = '\:'; diff --git a/tests/switch/__snapshots__/jsfmt.spec.js.snap b/tests/switch/__snapshots__/jsfmt.spec.mjs.snap similarity index 73% rename from tests/switch/__snapshots__/jsfmt.spec.js.snap rename to tests/switch/__snapshots__/jsfmt.spec.mjs.snap index e9faa77e5..293cb2ff0 100644 --- a/tests/switch/__snapshots__/jsfmt.spec.js.snap +++ b/tests/switch/__snapshots__/jsfmt.spec.mjs.snap @@ -1,6 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`empty_lines.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== veryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod()->veryVeryVeryVeryVeryVeryVeryLongProperty: break; } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +=====================================output===================================== veryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod()->veryVeryVeryVeryVeryVeryVeryLongProperty: + case $exception->veryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod() + ->veryVeryVeryVeryVeryVeryVeryLongProperty: break; } +================================================================================ `; diff --git a/tests/switch/jsfmt.spec.js b/tests/switch/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/switch/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/switch/jsfmt.spec.mjs b/tests/switch/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/switch/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/syntax-error/__snapshots__/jsfmt.spec.mjs.snap b/tests/syntax-error/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..3898bee1c --- /dev/null +++ b/tests/syntax-error/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Syntax errors have the expected structure 1`] = ` +{ + "codeFrame": "> 1 | { + await expect(raiseSyntaxError).rejects.toThrow(SyntaxError); +}); + +test("Syntax errors have the expected structure", async () => { + try { + await raiseSyntaxError(); + } catch (err) { + // Convert error to plain object since additional properties are not snapshotted otherwise + const errObject = Object.assign({}, err, { + // Strip ANSI from code frame since not all test environments may support it + codeFrame: stripAnsi(err.codeFrame), + }); + + // eslint-disable-next-line jest/no-conditional-expect + expect(errObject).toMatchSnapshot(); + } +}); diff --git a/tests/sys/__snapshots__/jsfmt.spec.js.snap b/tests/sys/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 56b0178c1..000000000 --- a/tests/sys/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,42 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`sys.php 1`] = ` - true; + } +} + +function f3( + $standaloneFunctionArgumentOne, + $standaloneFunctionArgumentTwo, + $standaloneFunctionArgumentThree, + $standaloneFunctionArgumentFour, +) { +} + +f3( + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", +); + +$f4 = function () use ( + $closureUseBlockVariableOne, + $closureUseBlockVariableTwo, + $closureUseBlockVariableThree, + $closureUseBlockVariableFour, +) { +}; + +=====================================output===================================== + true; + } +} + +function f3( + $standaloneFunctionArgumentOne, + $standaloneFunctionArgumentTwo, + $standaloneFunctionArgumentThree, + $standaloneFunctionArgumentFour +) {} + +f3( + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz" +); + +$f4 = function () use ( + $closureUseBlockVariableOne, + $closureUseBlockVariableTwo, + $closureUseBlockVariableThree, + $closureUseBlockVariableFour +) {}; + +================================================================================ +`; + +exports[`function.php 2`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.0" +printWidth: 80 +trailingComma: "none" +trailingCommaPHP: true + | printWidth +=====================================input====================================== + true; + } +} + +function f3( + $standaloneFunctionArgumentOne, + $standaloneFunctionArgumentTwo, + $standaloneFunctionArgumentThree, + $standaloneFunctionArgumentFour, +) { +} + +f3( + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", +); + +$f4 = function () use ( + $closureUseBlockVariableOne, + $closureUseBlockVariableTwo, + $closureUseBlockVariableThree, + $closureUseBlockVariableFour, +) { +}; + +=====================================output===================================== + true; + } +} + +function f3( + $standaloneFunctionArgumentOne, + $standaloneFunctionArgumentTwo, + $standaloneFunctionArgumentThree, + $standaloneFunctionArgumentFour, +) {} + +f3( + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", +); + +$f4 = function () use ( + $closureUseBlockVariableOne, + $closureUseBlockVariableTwo, + $closureUseBlockVariableThree, + $closureUseBlockVariableFour, +) {}; + +================================================================================ +`; diff --git a/tests/trailing_comma_func/function.php b/tests/trailing_comma_func/function.php new file mode 100644 index 000000000..26d89809d --- /dev/null +++ b/tests/trailing_comma_func/function.php @@ -0,0 +1,39 @@ + true; + } +} + +function f3( + $standaloneFunctionArgumentOne, + $standaloneFunctionArgumentTwo, + $standaloneFunctionArgumentThree, + $standaloneFunctionArgumentFour, +) { +} + +f3( + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", + "abcdefghijklmnopqrstuvwxyz", +); + +$f4 = function () use ( + $closureUseBlockVariableOne, + $closureUseBlockVariableTwo, + $closureUseBlockVariableThree, + $closureUseBlockVariableFour, +) { +}; diff --git a/tests/trailing_comma_func/jsfmt.spec.mjs b/tests/trailing_comma_func/jsfmt.spec.mjs new file mode 100644 index 000000000..77f569314 --- /dev/null +++ b/tests/trailing_comma_func/jsfmt.spec.mjs @@ -0,0 +1,10 @@ +run_spec(import.meta, ["php"], { + trailingComma: "all", + trailingCommaPHP: false, + phpVersion: "8.0", +}); +run_spec(import.meta, ["php"], { + trailingComma: "none", + trailingCommaPHP: true, + phpVersion: "8.0", +}); diff --git a/tests/trailing_commas/__snapshots__/jsfmt.spec.js.snap b/tests/trailing_commas/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index b06013e5a..000000000 --- a/tests/trailing_commas/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,129 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`trailing_commas.php 1`] = ` - 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar']; -$foo = ['very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',]; -$foo = array('foo', 'bar'); -$foo = array('foo', 'bar',); -$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2'); -$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2',); -$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar'); -$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',); -$packages = array_merge( - idx($composer, 'require', []), - idx($composer, 'require-dev', []) -); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 'foo', - 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar' -]; -$foo = [ - 'very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', - 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar' -]; -$foo = array('foo', 'bar'); -$foo = array('foo', 'bar'); -$foo = array( - 'very-very-very-very-very-very-very-very-very-long-item-1', - 'very-very-very-very-very-very-very-very-very-long-item-2' -); -$foo = array( - 'very-very-very-very-very-very-very-very-very-long-item-1', - 'very-very-very-very-very-very-very-very-very-long-item-2' -); -$foo = array( - 'very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', - 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar' -); -$foo = array( - 'very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', - 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar' -); -$packages = array_merge( - idx($composer, 'require', []), - idx($composer, 'require-dev', []) -); - -`; - -exports[`trailing_commas.php 2`] = ` - 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar']; -$foo = ['very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',]; -$foo = array('foo', 'bar'); -$foo = array('foo', 'bar',); -$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2'); -$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2',); -$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar'); -$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',); -$packages = array_merge( - idx($composer, 'require', []), - idx($composer, 'require-dev', []) -); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 'foo', - 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar', -]; -$foo = [ - 'very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', - 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar', -]; -$foo = array('foo', 'bar'); -$foo = array('foo', 'bar'); -$foo = array( - 'very-very-very-very-very-very-very-very-very-long-item-1', - 'very-very-very-very-very-very-very-very-very-long-item-2', -); -$foo = array( - 'very-very-very-very-very-very-very-very-very-long-item-1', - 'very-very-very-very-very-very-very-very-very-long-item-2', -); -$foo = array( - 'very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', - 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar', -); -$foo = array( - 'very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', - 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar', -); -$packages = array_merge( - idx($composer, 'require', []), - idx($composer, 'require-dev', []) -); - -`; diff --git a/tests/trailing_commas/__snapshots__/jsfmt.spec.mjs.snap b/tests/trailing_commas/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..c570a1a63 --- /dev/null +++ b/tests/trailing_commas/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,4671 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`array.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "7.0" +printWidth: 80 + | printWidth +=====================================input====================================== + 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar']; +$foo = ['very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',]; +$foo = array('foo', 'bar'); +$foo = array('foo', 'bar',); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2'); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2',); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar'); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',); +$packages = array_merge( + idx($composer, 'require', []), + idx($composer, 'require-dev', []) +); + +// nowdoc +$expected = array( + <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'foo', + <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar', +); + +// heredoc +$expected = array( + << <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'foo', + 'key' => <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'key' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar', +); + +// Associative array with heredoc +$expected = array( + 'key' => << << << <<<'EOT' +foo +# bar +baz + +EOT +, + 'collection' => array( + array( + 'one' => <<<'EOT' +foo +# bar +baz + +EOT + ), + array( + 'two' => <<<'EOT' +foo +# bar +baz +EOT + ) + ) +); + +// Nested with heredoc +$expected = array( + 'test' => << array( + array( + 'one' => << << "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +]; +$foo = ["foo", "bar"]; +$foo = ["foo", "bar"]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1", + "very-very-very-very-very-very-very-very-very-long-item-2", +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1", + "very-very-very-very-very-very-very-very-very-long-item-2", +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +]; +$packages = array_merge( + idx($composer, "require", []), + idx($composer, "require-dev", []) +); + +// nowdoc +$expected = [ + <<<'EOT' +foo +# bar +baz + +EOT +, +]; +$expected = [ + "foo", + <<<'EOT' +foo +# bar +baz + +EOT +, +]; +$expected = [ + <<<'EOT' +foo +# bar +baz + +EOT + , + "bar", +]; + +// heredoc +$expected = [ + << <<<'EOT' +foo +# bar +baz + +EOT +, +]; +$expected = [ + "foo", + "key" => <<<'EOT' +foo +# bar +baz + +EOT +, +]; +$expected = [ + "key" => <<<'EOT' +foo +# bar +baz + +EOT + , + "bar", +]; + +// Associative array with heredoc +$expected = [ + "key" => << << << <<<'EOT' +foo +# bar +baz + +EOT + , + "collection" => [ + [ + "one" => <<<'EOT' +foo +# bar +baz + +EOT + , + ], + [ + "two" => <<<'EOT' +foo +# bar +baz +EOT + , + ], + ], +]; + +// Nested with heredoc +$expected = [ + "test" => << [ + [ + "one" => << << 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar']; +$foo = ['very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',]; +$foo = array('foo', 'bar'); +$foo = array('foo', 'bar',); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2'); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2',); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar'); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',); +$packages = array_merge( + idx($composer, 'require', []), + idx($composer, 'require-dev', []) +); + +// nowdoc +$expected = array( + <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'foo', + <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar', +); + +// heredoc +$expected = array( + << <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'foo', + 'key' => <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'key' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar', +); + +// Associative array with heredoc +$expected = array( + 'key' => << << << <<<'EOT' +foo +# bar +baz + +EOT +, + 'collection' => array( + array( + 'one' => <<<'EOT' +foo +# bar +baz + +EOT + ), + array( + 'two' => <<<'EOT' +foo +# bar +baz +EOT + ) + ) +); + +// Nested with heredoc +$expected = array( + 'test' => << array( + array( + 'one' => << << "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +); +$foo = array( + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +); +$foo = array("foo", "bar"); +$foo = array("foo", "bar"); +$foo = array( + "very-very-very-very-very-very-very-very-very-long-item-1", + "very-very-very-very-very-very-very-very-very-long-item-2", +); +$foo = array( + "very-very-very-very-very-very-very-very-very-long-item-1", + "very-very-very-very-very-very-very-very-very-long-item-2", +); +$foo = array( + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +); +$foo = array( + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +); +$packages = array_merge( + idx($composer, "require", array()), + idx($composer, "require-dev", array()) +); + +// nowdoc +$expected = array( + <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + "foo", + <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + <<<'EOT' +foo +# bar +baz + +EOT + , + "bar", +); + +// heredoc +$expected = array( + << <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + "foo", + "key" => <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + "key" => <<<'EOT' +foo +# bar +baz + +EOT + , + "bar", +); + +// Associative array with heredoc +$expected = array( + "key" => << << << <<<'EOT' +foo +# bar +baz + +EOT + , + "collection" => array( + array( + "one" => <<<'EOT' +foo +# bar +baz + +EOT + , + ), + array( + "two" => <<<'EOT' +foo +# bar +baz +EOT + , + ), + ), +); + +// Nested with heredoc +$expected = array( + "test" => << array( + array( + "one" => << << 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar']; +$foo = ['very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',]; +$foo = array('foo', 'bar'); +$foo = array('foo', 'bar',); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2'); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2',); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar'); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',); +$packages = array_merge( + idx($composer, 'require', []), + idx($composer, 'require-dev', []) +); + +// nowdoc +$expected = array( + <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'foo', + <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar', +); + +// heredoc +$expected = array( + << <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'foo', + 'key' => <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'key' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar', +); + +// Associative array with heredoc +$expected = array( + 'key' => << << << <<<'EOT' +foo +# bar +baz + +EOT +, + 'collection' => array( + array( + 'one' => <<<'EOT' +foo +# bar +baz + +EOT + ), + array( + 'two' => <<<'EOT' +foo +# bar +baz +EOT + ) + ) +); + +// Nested with heredoc +$expected = array( + 'test' => << array( + array( + 'one' => << << "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +]; +$foo = ["foo", "bar"]; +$foo = ["foo", "bar"]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1", + "very-very-very-very-very-very-very-very-very-long-item-2", +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1", + "very-very-very-very-very-very-very-very-very-long-item-2", +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +]; +$packages = array_merge( + idx($composer, "require", []), + idx($composer, "require-dev", []) +); + +// nowdoc +$expected = [ + <<<'EOT' +foo +# bar +baz + +EOT +, +]; +$expected = [ + "foo", + <<<'EOT' +foo +# bar +baz + +EOT +, +]; +$expected = [ + <<<'EOT' +foo +# bar +baz + +EOT + , + "bar", +]; + +// heredoc +$expected = [ + << <<<'EOT' +foo +# bar +baz + +EOT +, +]; +$expected = [ + "foo", + "key" => <<<'EOT' +foo +# bar +baz + +EOT +, +]; +$expected = [ + "key" => <<<'EOT' +foo +# bar +baz + +EOT + , + "bar", +]; + +// Associative array with heredoc +$expected = [ + "key" => << << << <<<'EOT' +foo +# bar +baz + +EOT + , + "collection" => [ + [ + "one" => <<<'EOT' +foo +# bar +baz + +EOT + , + ], + [ + "two" => <<<'EOT' +foo +# bar +baz +EOT + , + ], + ], +]; + +// Nested with heredoc +$expected = [ + "test" => << [ + [ + "one" => << << 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar']; +$foo = ['very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',]; +$foo = array('foo', 'bar'); +$foo = array('foo', 'bar',); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2'); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2',); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar'); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',); +$packages = array_merge( + idx($composer, 'require', []), + idx($composer, 'require-dev', []) +); + +// nowdoc +$expected = array( + <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'foo', + <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar', +); + +// heredoc +$expected = array( + << <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'foo', + 'key' => <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'key' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar', +); + +// Associative array with heredoc +$expected = array( + 'key' => << << << <<<'EOT' +foo +# bar +baz + +EOT +, + 'collection' => array( + array( + 'one' => <<<'EOT' +foo +# bar +baz + +EOT + ), + array( + 'two' => <<<'EOT' +foo +# bar +baz +EOT + ) + ) +); + +// Nested with heredoc +$expected = array( + 'test' => << array( + array( + 'one' => << << "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +]; +$foo = ["foo", "bar"]; +$foo = ["foo", "bar"]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1", + "very-very-very-very-very-very-very-very-very-long-item-2", +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1", + "very-very-very-very-very-very-very-very-very-long-item-2", +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar", +]; +$packages = array_merge( + idx($composer, "require", []), + idx($composer, "require-dev", []), +); + +// nowdoc +$expected = [ + <<<'EOT' + foo + # bar + baz + + EOT +, +]; +$expected = [ + "foo", + <<<'EOT' + foo + # bar + baz + + EOT +, +]; +$expected = [ + <<<'EOT' + foo + # bar + baz + + EOT + , + "bar", +]; + +// heredoc +$expected = [ + << <<<'EOT' + foo + # bar + baz + + EOT +, +]; +$expected = [ + "foo", + "key" => <<<'EOT' + foo + # bar + baz + + EOT +, +]; +$expected = [ + "key" => <<<'EOT' + foo + # bar + baz + + EOT + , + "bar", +]; + +// Associative array with heredoc +$expected = [ + "key" => << << << <<<'EOT' + foo + # bar + baz + + EOT + , + "collection" => [ + [ + "one" => <<<'EOT' + foo + # bar + baz + + EOT + , + ], + [ + "two" => <<<'EOT' + foo + # bar + baz + EOT + , + ], + ], +]; + +// Nested with heredoc +$expected = [ + "test" => << [ + [ + "one" => << << 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar']; +$foo = ['very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',]; +$foo = array('foo', 'bar'); +$foo = array('foo', 'bar',); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2'); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2',); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar'); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',); +$packages = array_merge( + idx($composer, 'require', []), + idx($composer, 'require-dev', []) +); + +// nowdoc +$expected = array( + <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'foo', + <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar', +); + +// heredoc +$expected = array( + << <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'foo', + 'key' => <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'key' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar', +); + +// Associative array with heredoc +$expected = array( + 'key' => << << << <<<'EOT' +foo +# bar +baz + +EOT +, + 'collection' => array( + array( + 'one' => <<<'EOT' +foo +# bar +baz + +EOT + ), + array( + 'two' => <<<'EOT' +foo +# bar +baz +EOT + ) + ) +); + +// Nested with heredoc +$expected = array( + 'test' => << array( + array( + 'one' => << << "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar" +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar" +]; +$foo = ["foo", "bar"]; +$foo = ["foo", "bar"]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1", + "very-very-very-very-very-very-very-very-very-long-item-2" +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1", + "very-very-very-very-very-very-very-very-very-long-item-2" +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar" +]; +$foo = [ + "very-very-very-very-very-very-very-very-very-long-item-1" => "foo", + "very-very-very-very-very-very-very-very-very-long-item-2" => "bar" +]; +$packages = array_merge( + idx($composer, "require", []), + idx($composer, "require-dev", []) +); + +// nowdoc +$expected = [ + <<<'EOT' +foo +# bar +baz + +EOT +]; +$expected = [ + "foo", + <<<'EOT' +foo +# bar +baz + +EOT +]; +$expected = [ + <<<'EOT' +foo +# bar +baz + +EOT + , + "bar" +]; + +// heredoc +$expected = [ + << <<<'EOT' +foo +# bar +baz + +EOT +]; +$expected = [ + "foo", + "key" => <<<'EOT' +foo +# bar +baz + +EOT +]; +$expected = [ + "key" => <<<'EOT' +foo +# bar +baz + +EOT + , + "bar" +]; + +// Associative array with heredoc +$expected = [ + "key" => << << << <<<'EOT' +foo +# bar +baz + +EOT + , + "collection" => [ + [ + "one" => <<<'EOT' +foo +# bar +baz + +EOT + ], + [ + "two" => <<<'EOT' +foo +# bar +baz +EOT + ] + ] +]; + +// Nested with heredoc +$expected = [ + "test" => << [ + [ + "one" => << <<bar( + 'method', + 'bar', +); + +$foo->bar( + 'method', + 'bar', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +$foo( + 'invoke', + 'bar', +); + +$foo( + 'invoke', + 'bar', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +$var = strlen($var,); + +$var = strlen($var, 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, +); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +echo $twig->render( + 'index.html', + compact( + 'title', + 'body', + 'comments', + ) +); + +echo $twig->render( + 'index.html', + compact( + 'title', + 'body', + 'comments', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', + ) +); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + ['foo', 'bar'], +); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + ['foo', 'bar',], +); + +$en = 'A trailing %s makes %s a happy developer.'; +$text = sprintf( + $en, + 'comma', + 'Jane', +); + +$text = sprintf( + $en, + 'comma', + 'Jane', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +call(['very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',],['very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',],); + +call(<<<'EOT' +My name is "$name". I am printing some $foo->foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT + , +); + +call(<<foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT + , +); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { return $x->selected; }); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { return $x->selected; }, function ($x) { return $x->selected; },); +=====================================output===================================== +bar("method", "bar"); + +$foo->bar( + "method", + "bar", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +$foo("invoke", "bar"); + +$foo( + "invoke", + "bar", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +$var = strlen($var); + +$var = strlen( + $var, + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +var_dump($whatIsInThere, $probablyABugInThisOne, $oneMoreToCheck); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +echo $twig->render("index.html", compact("title", "body", "comments")); + +echo $twig->render( + "index.html", + compact( + "title", + "body", + "comments", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" + ) +); + +$newArray = array_merge($arrayOne, $arrayTwo, ["foo", "bar"]); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + ["foo", "bar"] +); + +$en = "A trailing %s makes %s a happy developer."; +$text = sprintf($en, "comma", "Jane"); + +$text = sprintf( + $en, + "comma", + "Jane", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +call( + [ + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string", + ], + [ + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string", + ] +); + +call( + <<<'EOT' +My name is "$name". I am printing some $foo->foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT +); + +call( + <<foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT +); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { + return $x->selected; + }); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter( + function ($x) { + return $x->selected; + }, + function ($x) { + return $x->selected; + } + ); + +================================================================================ +`; + +exports[`call.php 2`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "5.0" +printWidth: 80 +trailingCommaPHP: true + | printWidth +=====================================input====================================== +bar( + 'method', + 'bar', +); + +$foo->bar( + 'method', + 'bar', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +$foo( + 'invoke', + 'bar', +); + +$foo( + 'invoke', + 'bar', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +$var = strlen($var,); + +$var = strlen($var, 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, +); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +echo $twig->render( + 'index.html', + compact( + 'title', + 'body', + 'comments', + ) +); + +echo $twig->render( + 'index.html', + compact( + 'title', + 'body', + 'comments', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', + ) +); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + ['foo', 'bar'], +); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + ['foo', 'bar',], +); + +$en = 'A trailing %s makes %s a happy developer.'; +$text = sprintf( + $en, + 'comma', + 'Jane', +); + +$text = sprintf( + $en, + 'comma', + 'Jane', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +call(['very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',],['very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',],); + +call(<<<'EOT' +My name is "$name". I am printing some $foo->foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT + , +); + +call(<<foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT + , +); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { return $x->selected; }); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { return $x->selected; }, function ($x) { return $x->selected; },); +=====================================output===================================== +bar("method", "bar"); + +$foo->bar( + "method", + "bar", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +$foo("invoke", "bar"); + +$foo( + "invoke", + "bar", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +$var = strlen($var); + +$var = strlen( + $var, + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +var_dump($whatIsInThere, $probablyABugInThisOne, $oneMoreToCheck); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +echo $twig->render("index.html", compact("title", "body", "comments")); + +echo $twig->render( + "index.html", + compact( + "title", + "body", + "comments", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" + ) +); + +$newArray = array_merge($arrayOne, $arrayTwo, array("foo", "bar")); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + array("foo", "bar") +); + +$en = "A trailing %s makes %s a happy developer."; +$text = sprintf($en, "comma", "Jane"); + +$text = sprintf( + $en, + "comma", + "Jane", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +call( + array( + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string", + ), + array( + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string", + ) +); + +call( + <<<'EOT' +My name is "$name". I am printing some $foo->foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT +); + +call( + <<foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT +); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { + return $x->selected; + }); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter( + function ($x) { + return $x->selected; + }, + function ($x) { + return $x->selected; + } + ); + +================================================================================ +`; + +exports[`call.php 3`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "7.2" +printWidth: 80 +trailingCommaPHP: true + | printWidth +=====================================input====================================== +bar( + 'method', + 'bar', +); + +$foo->bar( + 'method', + 'bar', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +$foo( + 'invoke', + 'bar', +); + +$foo( + 'invoke', + 'bar', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +$var = strlen($var,); + +$var = strlen($var, 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, +); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +echo $twig->render( + 'index.html', + compact( + 'title', + 'body', + 'comments', + ) +); + +echo $twig->render( + 'index.html', + compact( + 'title', + 'body', + 'comments', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', + ) +); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + ['foo', 'bar'], +); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + ['foo', 'bar',], +); + +$en = 'A trailing %s makes %s a happy developer.'; +$text = sprintf( + $en, + 'comma', + 'Jane', +); + +$text = sprintf( + $en, + 'comma', + 'Jane', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +call(['very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',],['very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',],); + +call(<<<'EOT' +My name is "$name". I am printing some $foo->foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT + , +); + +call(<<foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT + , +); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { return $x->selected; }); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { return $x->selected; }, function ($x) { return $x->selected; },); +=====================================output===================================== +bar("method", "bar"); + +$foo->bar( + "method", + "bar", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +$foo("invoke", "bar"); + +$foo( + "invoke", + "bar", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +$var = strlen($var); + +$var = strlen( + $var, + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +var_dump($whatIsInThere, $probablyABugInThisOne, $oneMoreToCheck); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +echo $twig->render("index.html", compact("title", "body", "comments")); + +echo $twig->render( + "index.html", + compact( + "title", + "body", + "comments", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" + ) +); + +$newArray = array_merge($arrayOne, $arrayTwo, ["foo", "bar"]); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + ["foo", "bar"] +); + +$en = "A trailing %s makes %s a happy developer."; +$text = sprintf($en, "comma", "Jane"); + +$text = sprintf( + $en, + "comma", + "Jane", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +call( + [ + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string", + ], + [ + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string", + ] +); + +call( + <<<'EOT' +My name is "$name". I am printing some $foo->foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT +); + +call( + <<foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT +); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { + return $x->selected; + }); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter( + function ($x) { + return $x->selected; + }, + function ($x) { + return $x->selected; + } + ); + +================================================================================ +`; + +exports[`call.php 4`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "7.3" +printWidth: 80 +trailingCommaPHP: true + | printWidth +=====================================input====================================== +bar( + 'method', + 'bar', +); + +$foo->bar( + 'method', + 'bar', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +$foo( + 'invoke', + 'bar', +); + +$foo( + 'invoke', + 'bar', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +$var = strlen($var,); + +$var = strlen($var, 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, +); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +echo $twig->render( + 'index.html', + compact( + 'title', + 'body', + 'comments', + ) +); + +echo $twig->render( + 'index.html', + compact( + 'title', + 'body', + 'comments', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', + ) +); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + ['foo', 'bar'], +); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + ['foo', 'bar',], +); + +$en = 'A trailing %s makes %s a happy developer.'; +$text = sprintf( + $en, + 'comma', + 'Jane', +); + +$text = sprintf( + $en, + 'comma', + 'Jane', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +call(['very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',],['very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',],); + +call(<<<'EOT' +My name is "$name". I am printing some $foo->foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT + , +); + +call(<<foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT + , +); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { return $x->selected; }); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { return $x->selected; }, function ($x) { return $x->selected; },); +=====================================output===================================== +bar("method", "bar"); + +$foo->bar( + "method", + "bar", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string", +); + +$foo("invoke", "bar"); + +$foo( + "invoke", + "bar", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string", +); + +$var = strlen($var); + +$var = strlen( + $var, + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string", +); + +var_dump($whatIsInThere, $probablyABugInThisOne, $oneMoreToCheck); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string", +); + +echo $twig->render("index.html", compact("title", "body", "comments")); + +echo $twig->render( + "index.html", + compact( + "title", + "body", + "comments", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string", + ), +); + +$newArray = array_merge($arrayOne, $arrayTwo, ["foo", "bar"]); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + ["foo", "bar"], +); + +$en = "A trailing %s makes %s a happy developer."; +$text = sprintf($en, "comma", "Jane"); + +$text = sprintf( + $en, + "comma", + "Jane", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string", +); + +call( + [ + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string", + ], + [ + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string", + ], +); + +call( + <<<'EOT' + My name is "$name". I am printing some $foo->foo. + Now, I am printing some {$foo->bar[1]}. + This should not print a capital 'A': \\x41 + EOT + , +); + +call( + <<foo. + Now, I am printing some {$foo->bar[1]}. + This should not print a capital 'A': \\x41 + EOT + , +); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { + return $x->selected; + }); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter( + function ($x) { + return $x->selected; + }, + function ($x) { + return $x->selected; + }, + ); + +================================================================================ +`; + +exports[`call.php 5`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "7.0" +printWidth: 80 +trailingComma: "all" +trailingCommaPHP: false + | printWidth +=====================================input====================================== +bar( + 'method', + 'bar', +); + +$foo->bar( + 'method', + 'bar', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +$foo( + 'invoke', + 'bar', +); + +$foo( + 'invoke', + 'bar', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +$var = strlen($var,); + +$var = strlen($var, 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, +); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +echo $twig->render( + 'index.html', + compact( + 'title', + 'body', + 'comments', + ) +); + +echo $twig->render( + 'index.html', + compact( + 'title', + 'body', + 'comments', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', + ) +); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + ['foo', 'bar'], +); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + ['foo', 'bar',], +); + +$en = 'A trailing %s makes %s a happy developer.'; +$text = sprintf( + $en, + 'comma', + 'Jane', +); + +$text = sprintf( + $en, + 'comma', + 'Jane', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +call(['very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',],['very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',],); + +call(<<<'EOT' +My name is "$name". I am printing some $foo->foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT + , +); + +call(<<foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT + , +); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { return $x->selected; }); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { return $x->selected; }, function ($x) { return $x->selected; },); +=====================================output===================================== +bar("method", "bar"); + +$foo->bar( + "method", + "bar", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +$foo("invoke", "bar"); + +$foo( + "invoke", + "bar", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +$var = strlen($var); + +$var = strlen( + $var, + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +var_dump($whatIsInThere, $probablyABugInThisOne, $oneMoreToCheck); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +echo $twig->render("index.html", compact("title", "body", "comments")); + +echo $twig->render( + "index.html", + compact( + "title", + "body", + "comments", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" + ) +); + +$newArray = array_merge($arrayOne, $arrayTwo, ["foo", "bar"]); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + ["foo", "bar"] +); + +$en = "A trailing %s makes %s a happy developer."; +$text = sprintf($en, "comma", "Jane"); + +$text = sprintf( + $en, + "comma", + "Jane", + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" +); + +call( + [ + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" + ], + [ + "very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string" + ] +); + +call( + <<<'EOT' +My name is "$name". I am printing some $foo->foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT +); + +call( + <<foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \\x41 +EOT +); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { + return $x->selected; + }); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter( + function ($x) { + return $x->selected; + }, + function ($x) { + return $x->selected; + } + ); + +================================================================================ +`; + +exports[`isset.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "7.0" +printWidth: 80 + | printWidth +=====================================input====================================== + $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong) = $arr; +list(,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong,, 1 => $secondVeryVeryVeryVeryLong,, 2 => $threeVeryVeryVeryVeryLong,, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong,,, 1 => $secondVeryVeryVeryVeryLong,,, 2 => $threeVeryVeryVeryVeryLong,,, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; + +=====================================output===================================== + $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, +) = $arr; +list( + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, +) = $arr; +list( + , + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, + , +) = $arr; +list( + , + , + 0 => $firstVeryVeryVeryVeryLong, + , + 1 => $secondVeryVeryVeryVeryLong, + , + 2 => $threeVeryVeryVeryVeryLong, + , + 3 => $fourthVeryVeryVeryVeryLong, + , +) = $arr; +list( + , + , + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, + , + , +) = $arr; +list( + , + , + , + 0 => $firstVeryVeryVeryVeryLong, + , + , + 1 => $secondVeryVeryVeryVeryLong, + , + , + 2 => $threeVeryVeryVeryVeryLong, + , + , + 3 => $fourthVeryVeryVeryVeryLong, + , + , +) = $arr; + +================================================================================ +`; + +exports[`list.php 2`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "5.0" +printWidth: 80 +trailingCommaPHP: true + | printWidth +=====================================input====================================== + $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong) = $arr; +list(,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong,, 1 => $secondVeryVeryVeryVeryLong,, 2 => $threeVeryVeryVeryVeryLong,, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong,,, 1 => $secondVeryVeryVeryVeryLong,,, 2 => $threeVeryVeryVeryVeryLong,,, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; + +=====================================output===================================== + $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, +) = $arr; +list( + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, +) = $arr; +list( + , + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, + , +) = $arr; +list( + , + , + 0 => $firstVeryVeryVeryVeryLong, + , + 1 => $secondVeryVeryVeryVeryLong, + , + 2 => $threeVeryVeryVeryVeryLong, + , + 3 => $fourthVeryVeryVeryVeryLong, + , +) = $arr; +list( + , + , + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, + , + , +) = $arr; +list( + , + , + , + 0 => $firstVeryVeryVeryVeryLong, + , + , + 1 => $secondVeryVeryVeryVeryLong, + , + , + 2 => $threeVeryVeryVeryVeryLong, + , + , + 3 => $fourthVeryVeryVeryVeryLong, + , + , +) = $arr; + +================================================================================ +`; + +exports[`list.php 3`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "7.2" +printWidth: 80 +trailingCommaPHP: true + | printWidth +=====================================input====================================== + $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong) = $arr; +list(,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong,, 1 => $secondVeryVeryVeryVeryLong,, 2 => $threeVeryVeryVeryVeryLong,, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong,,, 1 => $secondVeryVeryVeryVeryLong,,, 2 => $threeVeryVeryVeryVeryLong,,, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; + +=====================================output===================================== + $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, +] = $arr; +[ + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, +] = $arr; +[ + , + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, + , +] = $arr; +[ + , + , + 0 => $firstVeryVeryVeryVeryLong, + , + 1 => $secondVeryVeryVeryVeryLong, + , + 2 => $threeVeryVeryVeryVeryLong, + , + 3 => $fourthVeryVeryVeryVeryLong, + , +] = $arr; +[ + , + , + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, + , + , +] = $arr; +[ + , + , + , + 0 => $firstVeryVeryVeryVeryLong, + , + , + 1 => $secondVeryVeryVeryVeryLong, + , + , + 2 => $threeVeryVeryVeryVeryLong, + , + , + 3 => $fourthVeryVeryVeryVeryLong, + , + , +] = $arr; + +================================================================================ +`; + +exports[`list.php 4`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "7.3" +printWidth: 80 +trailingCommaPHP: true + | printWidth +=====================================input====================================== + $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong) = $arr; +list(,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong,, 1 => $secondVeryVeryVeryVeryLong,, 2 => $threeVeryVeryVeryVeryLong,, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong,,, 1 => $secondVeryVeryVeryVeryLong,,, 2 => $threeVeryVeryVeryVeryLong,,, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; + +=====================================output===================================== + $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, +] = $arr; +[ + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, +] = $arr; +[ + , + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, + , +] = $arr; +[ + , + , + 0 => $firstVeryVeryVeryVeryLong, + , + 1 => $secondVeryVeryVeryVeryLong, + , + 2 => $threeVeryVeryVeryVeryLong, + , + 3 => $fourthVeryVeryVeryVeryLong, + , +] = $arr; +[ + , + , + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, + , + , +] = $arr; +[ + , + , + , + 0 => $firstVeryVeryVeryVeryLong, + , + , + 1 => $secondVeryVeryVeryVeryLong, + , + , + 2 => $threeVeryVeryVeryVeryLong, + , + , + 3 => $fourthVeryVeryVeryVeryLong, + , + , +] = $arr; + +================================================================================ +`; + +exports[`list.php 5`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "7.0" +printWidth: 80 +trailingComma: "all" +trailingCommaPHP: false + | printWidth +=====================================input====================================== + $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong) = $arr; +list(,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong,, 1 => $secondVeryVeryVeryVeryLong,, 2 => $threeVeryVeryVeryVeryLong,, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong,,, 1 => $secondVeryVeryVeryVeryLong,,, 2 => $threeVeryVeryVeryVeryLong,,, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; + +=====================================output===================================== + $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong +) = $arr; +list( + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong +) = $arr; +list( + , + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, + , +) = $arr; +list( + , + , + 0 => $firstVeryVeryVeryVeryLong, + , + 1 => $secondVeryVeryVeryVeryLong, + , + 2 => $threeVeryVeryVeryVeryLong, + , + 3 => $fourthVeryVeryVeryVeryLong, + , +) = $arr; +list( + , + , + , + 0 => $firstVeryVeryVeryVeryLong, + 1 => $secondVeryVeryVeryVeryLong, + 2 => $threeVeryVeryVeryVeryLong, + 3 => $fourthVeryVeryVeryVeryLong, + , + , +) = $arr; +list( + , + , + , + 0 => $firstVeryVeryVeryVeryLong, + , + , + 1 => $secondVeryVeryVeryVeryLong, + , + , + 2 => $threeVeryVeryVeryVeryLong, + , + , + 3 => $fourthVeryVeryVeryVeryLong, + , + , +) = $arr; + +================================================================================ +`; + +exports[`unset.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "7.0" +printWidth: 80 + | printWidth +=====================================input====================================== + 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar']; +$foo = ['very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',]; +$foo = array('foo', 'bar'); +$foo = array('foo', 'bar',); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2'); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2',); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar'); +$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',); +$packages = array_merge( + idx($composer, 'require', []), + idx($composer, 'require-dev', []) +); + +// nowdoc +$expected = array( + <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'foo', + <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar', +); + +// heredoc +$expected = array( + << <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'foo', + 'key' => <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'key' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar', +); + +// Associative array with heredoc +$expected = array( + 'key' => << << << <<<'EOT' +foo +# bar +baz + +EOT +, + 'collection' => array( + array( + 'one' => <<<'EOT' +foo +# bar +baz + +EOT + ), + array( + 'two' => <<<'EOT' +foo +# bar +baz +EOT + ) + ) +); + +// Nested with heredoc +$expected = array( + 'test' => << array( + array( + 'one' => << <<bar( + 'method', + 'bar', +); + +$foo->bar( + 'method', + 'bar', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +$foo( + 'invoke', + 'bar', +); + +$foo( + 'invoke', + 'bar', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +$var = strlen($var,); + +$var = strlen($var, 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, +); + +var_dump( + $whatIsInThere, + $probablyABugInThisOne, + $oneMoreToCheck, + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +echo $twig->render( + 'index.html', + compact( + 'title', + 'body', + 'comments', + ) +); + +echo $twig->render( + 'index.html', + compact( + 'title', + 'body', + 'comments', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', + ) +); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + ['foo', 'bar'], +); + +$newArray = array_merge( + $arrayOne, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + $arrayTwo, + ['foo', 'bar',], +); + +$en = 'A trailing %s makes %s a happy developer.'; +$text = sprintf( + $en, + 'comma', + 'Jane', +); + +$text = sprintf( + $en, + 'comma', + 'Jane', + 'very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string', +); + +call(['very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',],['very-very-very-very-very-very-very-very-very-very-very-very-veru-long-string',],); + +call(<<<'EOT' +My name is "$name". I am printing some $foo->foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \x41 +EOT + , +); + +call(<<foo. +Now, I am printing some {$foo->bar[1]}. +This should not print a capital 'A': \x41 +EOT + , +); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { return $x->selected; }); + +$sel = $this->connections + + ->concat($this->activities->concat($this->operators)) + ->filter(function ($x) { return $x->selected; }, function ($x) { return $x->selected; },); \ No newline at end of file diff --git a/tests/trailing_commas/isset.php b/tests/trailing_commas/isset.php new file mode 100644 index 000000000..8a55cfd80 --- /dev/null +++ b/tests/trailing_commas/isset.php @@ -0,0 +1,4 @@ + $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong) = $arr; +list(,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,0 => $firstVeryVeryVeryVeryLong,, 1 => $secondVeryVeryVeryVeryLong,, 2 => $threeVeryVeryVeryVeryLong,, 3 => $fourthVeryVeryVeryVeryLong,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong, 1 => $secondVeryVeryVeryVeryLong, 2 => $threeVeryVeryVeryVeryLong, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; +list(,,,0 => $firstVeryVeryVeryVeryLong,,, 1 => $secondVeryVeryVeryVeryLong,,, 2 => $threeVeryVeryVeryVeryLong,,, 3 => $fourthVeryVeryVeryVeryLong,,,) = $arr; diff --git a/tests/trailing_commas/trailing_commas.php b/tests/trailing_commas/trailing_commas.php deleted file mode 100644 index 7356642c6..000000000 --- a/tests/trailing_commas/trailing_commas.php +++ /dev/null @@ -1,18 +0,0 @@ - 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar']; -$foo = ['very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',]; -$foo = array('foo', 'bar'); -$foo = array('foo', 'bar',); -$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2'); -$foo = array('very-very-very-very-very-very-very-very-very-long-item-1', 'very-very-very-very-very-very-very-very-very-long-item-2',); -$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar'); -$foo = array('very-very-very-very-very-very-very-very-very-long-item-1' => 'foo', 'very-very-very-very-very-very-very-very-very-long-item-2' => 'bar',); -$packages = array_merge( - idx($composer, 'require', []), - idx($composer, 'require-dev', []) -); diff --git a/tests/trailing_commas/unset.php b/tests/trailing_commas/unset.php new file mode 100644 index 000000000..11d8d501f --- /dev/null +++ b/tests/trailing_commas/unset.php @@ -0,0 +1,4 @@ + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`trailing_whitespace_comment.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; diff --git a/tests/trailing_whitespace/jsfmt.spec.js b/tests/trailing_whitespace/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/trailing_whitespace/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/trailing_whitespace/jsfmt.spec.mjs b/tests/trailing_whitespace/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/trailing_whitespace/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/trailing_whitespace/trailing_whitespace_after_tag.php b/tests/trailing_whitespace/trailing_whitespace_after_tag.php new file mode 100644 index 000000000..662dc3406 --- /dev/null +++ b/tests/trailing_whitespace/trailing_whitespace_after_tag.php @@ -0,0 +1,3 @@ + diff --git a/tests/trailing_whitespace/trailing_whitespace_comment.php b/tests/trailing_whitespace/trailing_whitespace_comment.php new file mode 100644 index 000000000..3c2cf0d47 --- /dev/null +++ b/tests/trailing_whitespace/trailing_whitespace_comment.php @@ -0,0 +1,4 @@ + diff --git a/tests/traitalias/__snapshots__/jsfmt.spec.mjs.snap b/tests/traitalias/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..5ef13f147 --- /dev/null +++ b/tests/traitalias/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`traitalias.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +a); +unset($a->a->b); +unset($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty); + +=====================================output===================================== +a); +unset($a->a->b); +unset( + $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable + ->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty + ->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty, +); + +================================================================================ +`; diff --git a/tests/unset/jsfmt.spec.mjs b/tests/unset/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/unset/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/unset/unset.php b/tests/unset/unset.php new file mode 100644 index 000000000..852007644 --- /dev/null +++ b/tests/unset/unset.php @@ -0,0 +1,11 @@ +a); +unset($a->a->b); +unset($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty); diff --git a/tests/use/__snapshots__/jsfmt.spec.js.snap b/tests/use/__snapshots__/jsfmt.spec.mjs.snap similarity index 74% rename from tests/use/__snapshots__/jsfmt.spec.js.snap rename to tests/use/__snapshots__/jsfmt.spec.mjs.snap index 59b55368b..dca64bca2 100644 --- a/tests/use/__snapshots__/jsfmt.spec.js.snap +++ b/tests/use/__snapshots__/jsfmt.spec.mjs.snap @@ -1,6 +1,11 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`use.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== $id_field; +$id = $element->{$id_field}; +$id = $element[$id_field]; +$var = <<foo. +Now, I am printing some {$foo->bar[1]}. +This should print a capital 'A': \\x41 +EOT; +$var = "He drank some $juice juice.".PHP_EOL; +$var = "He drank some $juices[0] juice.".PHP_EOL; +$var = "He drank some $juices[koolaid1] juice.".PHP_EOL; +$var = "$people->john then said hello to $people->jane.".PHP_EOL; +$var = "{$foo->{$baz[1]}}\\n"; +$var = $var->{$var->property}; +$var = $var->$var->property; +$var = $var->{'😀'}; + +// http://php.net/manual/ru/migration70.incompatible.php#migration70.incompatible.variable-handling.indirect + +$var = $$foo['bar']['baz']; +$var = $foo->$bar['baz']; +$var = $foo->$bar['baz'](); +$var = Foo::$bar['baz'](); + +$var = \${$foo['bar']['baz']}; +$var = $foo->{$bar['baz']}; +$var = $foo->{$bar['baz']}(); +$var = Foo::{$bar['baz']}(); + +$var = ($$foo)['bar']['baz']; +$var = ($foo->$bar)['baz']; +$var = ($foo->$bar)['baz'](); +$var = Foo::$bar()['baz'](); + +$var = (Foo::$bar())['baz'](); +$var = Foo::bar()['baz'](); +$var = (Foo::bar())['baz'](); + +$var = Foo::$bar['baz']; +$var = (Foo::$bar)['baz']; + +$$$$$$$$$$var = "I like playing in the park"; + +$var = \${$a[1]}; +$var = \${$a}[1]; +$var = \${"name_$type"}; +$var = \${ 'price_for_' . $today}; +\${date("M")} = "Worked"; +\${$a}[] = "four" ; +\${$base.$suffix} = "whatever"; + +=====================================output===================================== +$id_field; +$id = $element->{$id_field}; +$id = $element[$id_field]; +$var = <<foo. +Now, I am printing some {$foo->bar[1]}. +This should print a capital 'A': \\x41 +EOT; +$var = "He drank some $juice juice." . PHP_EOL; +$var = "He drank some $juices[0] juice." . PHP_EOL; +$var = "He drank some $juices[koolaid1] juice." . PHP_EOL; +$var = "$people->john then said hello to $people->jane." . PHP_EOL; +$var = "{$foo->{$baz[1]}}\\n"; +$var = $var->{$var->property}; +$var = $var->$var->property; +$var = $var->{'😀'}; + +// http://php.net/manual/ru/migration70.incompatible.php#migration70.incompatible.variable-handling.indirect + +$var = $$foo["bar"]["baz"]; +$var = $foo->$bar["baz"]; +$var = $foo->$bar["baz"](); +$var = Foo::$bar["baz"](); + +$var = \${$foo["bar"]["baz"]}; +$var = $foo->{$bar["baz"]}; +$var = $foo->{$bar["baz"]}(); +$var = Foo::{$bar["baz"]}(); + +$var = $$foo["bar"]["baz"]; +$var = $foo->$bar["baz"]; +$var = $foo->$bar["baz"](); +$var = Foo::$bar()["baz"](); + +$var = Foo::$bar()["baz"](); +$var = Foo::bar()["baz"](); +$var = Foo::bar()["baz"](); + +$var = Foo::$bar["baz"]; +$var = Foo::$bar["baz"]; + +$$$$$$$$$$var = "I like playing in the park"; + +$var = \${$a[1]}; +$var = \${$a}[1]; +$var = \${"name_$type"}; +$var = \${"price_for_" . $today}; +\${date("M")} = "Worked"; +\${$a}[] = "four"; +\${$base . $suffix} = "whatever"; + +================================================================================ +`; diff --git a/tests/variable/jsfmt.spec.js b/tests/variable/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/variable/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/variable/jsfmt.spec.mjs b/tests/variable/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/variable/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/variable/single.php b/tests/variable/single.php new file mode 100644 index 000000000..6da0a4723 --- /dev/null +++ b/tests/variable/single.php @@ -0,0 +1,2 @@ +$id_field; +$id = $element->{$id_field}; +$id = $element[$id_field]; +$var = <<foo. +Now, I am printing some {$foo->bar[1]}. +This should print a capital 'A': \x41 +EOT; +$var = "He drank some $juice juice.".PHP_EOL; +$var = "He drank some $juices[0] juice.".PHP_EOL; +$var = "He drank some $juices[koolaid1] juice.".PHP_EOL; +$var = "$people->john then said hello to $people->jane.".PHP_EOL; +$var = "{$foo->{$baz[1]}}\n"; +$var = $var->{$var->property}; +$var = $var->$var->property; +$var = $var->{'😀'}; + +// http://php.net/manual/ru/migration70.incompatible.php#migration70.incompatible.variable-handling.indirect + +$var = $$foo['bar']['baz']; +$var = $foo->$bar['baz']; +$var = $foo->$bar['baz'](); +$var = Foo::$bar['baz'](); + +$var = ${$foo['bar']['baz']}; +$var = $foo->{$bar['baz']}; +$var = $foo->{$bar['baz']}(); +$var = Foo::{$bar['baz']}(); + +$var = ($$foo)['bar']['baz']; +$var = ($foo->$bar)['baz']; +$var = ($foo->$bar)['baz'](); +$var = Foo::$bar()['baz'](); + +$var = (Foo::$bar())['baz'](); +$var = Foo::bar()['baz'](); +$var = (Foo::bar())['baz'](); + +$var = Foo::$bar['baz']; +$var = (Foo::$bar)['baz']; + +$$$$$$$$$$var = "I like playing in the park"; + +$var = ${$a[1]}; +$var = ${$a}[1]; +$var = ${"name_$type"}; +$var = ${ 'price_for_' . $today}; +${date("M")} = "Worked"; +${$a}[] = "four" ; +${$base.$suffix} = "whatever"; diff --git a/tests/variadic/__snapshots__/jsfmt.spec.mjs.snap b/tests/variadic/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..64025ce9f --- /dev/null +++ b/tests/variadic/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,68 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`variadic.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 3; -} -function gen() { - yield 0; - yield from from(); - yield 4; -} - - -function gen_one_to_three() { - for ($i = 1; $i <= 3; $i++) { - yield $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValues; - yield $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongObjName->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); - yield from $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongObjName->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); - } -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3; -} -function gen() -{ - yield 0; - yield from from(); - yield 4; -} - -function gen_one_to_three() -{ - for ($i = 1; $i <= 3; $i++) { - yield $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValues; - yield $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongObjName->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); - yield from $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongObjName->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); - } -} - -`; diff --git a/tests/yield/__snapshots__/jsfmt.spec.mjs.snap b/tests/yield/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..8f499b575 --- /dev/null +++ b/tests/yield/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`yield.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 3; + yield [$i++, $value]; + yield $arr->current(); +} +function gen() { + yield 0; + yield from from(); + yield 4; +} + + +function gen_one_to_three() { + for ($i = 1; $i <= 3; $i++) { + yield $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValues; + yield $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongObjName->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); + yield from $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongObjName->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); + } +} + +function count_to_ten() { + yield 1; + yield 2; + yield from [3, 4]; + yield from new ArrayIterator([5, 6]); + yield from seven_eight(); + yield 9; + yield 10; +} + +function seven_eight() { + yield 7; + yield from eight(); +} + +function eight() { + yield 8; +} + +function count_to_ten() { + yield 1; + yield 2; + yield from [3, 4]; + yield from new ArrayIterator([5, 6]); + yield from seven_eight(); + + return yield from nine_ten(); +} + +function foo() { + $test = 123; + yield "bar {$test}" => 123; +} + +=====================================output===================================== + 3; + yield [$i++, $value]; + yield $arr->current(); +} +function gen() +{ + yield 0; + yield from from(); + yield 4; +} + +function gen_one_to_three() +{ + for ($i = 1; $i <= 3; $i++) { + yield $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValues; + yield $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongObjName->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); + yield from $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongObjName->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); + } +} + +function count_to_ten() +{ + yield 1; + yield 2; + yield from [3, 4]; + yield from new ArrayIterator([5, 6]); + yield from seven_eight(); + yield 9; + yield 10; +} + +function seven_eight() +{ + yield 7; + yield from eight(); +} + +function eight() +{ + yield 8; +} + +function count_to_ten() +{ + yield 1; + yield 2; + yield from [3, 4]; + yield from new ArrayIterator([5, 6]); + yield from seven_eight(); + + return yield from nine_ten(); +} + +function foo() +{ + $test = 123; + yield "bar {$test}" => 123; +} + +================================================================================ +`; diff --git a/tests/yield/jsfmt.spec.js b/tests/yield/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/yield/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/yield/jsfmt.spec.mjs b/tests/yield/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/yield/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/yield/yield.php b/tests/yield/yield.php index b255874f2..b33f58663 100644 --- a/tests/yield/yield.php +++ b/tests/yield/yield.php @@ -1,9 +1,12 @@ 3; + yield [$i++, $value]; + yield $arr->current(); } function gen() { yield 0; @@ -19,3 +22,37 @@ function gen_one_to_three() { yield from $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongObjName->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMethod(); } } + +function count_to_ten() { + yield 1; + yield 2; + yield from [3, 4]; + yield from new ArrayIterator([5, 6]); + yield from seven_eight(); + yield 9; + yield 10; +} + +function seven_eight() { + yield 7; + yield from eight(); +} + +function eight() { + yield 8; +} + +function count_to_ten() { + yield 1; + yield 2; + yield from [3, 4]; + yield from new ArrayIterator([5, 6]); + yield from seven_eight(); + + return yield from nine_ten(); +} + +function foo() { + $test = 123; + yield "bar {$test}" => 123; +} diff --git a/tests_config/get_engine.mjs b/tests_config/get_engine.mjs new file mode 100644 index 000000000..fa85a20f3 --- /dev/null +++ b/tests_config/get_engine.mjs @@ -0,0 +1,12 @@ +import url from "url"; +import { createRequire } from "module"; +import prettierModule from "prettier"; +import prettierStandalone from "prettier/standalone"; +import * as prettierPluginPhp from "../src/index.mjs"; + +const require = createRequire(import.meta.url); + +export const prettier = global.STANDALONE ? prettierStandalone : prettierModule; +export const plugin = global.STANDALONE + ? require(url.fileURLToPath(new URL("../standalone.js", import.meta.url))) + : prettierPluginPhp; diff --git a/tests_config/raw-serializer.js b/tests_config/raw-serializer.js deleted file mode 100644 index 8e447810c..000000000 --- a/tests_config/raw-serializer.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -const RAW = Symbol.for("raw"); - -module.exports = { - print(val) { - return val[RAW]; - }, - test(val) { - return ( - val && - Object.prototype.hasOwnProperty.call(val, RAW) && - typeof val[RAW] === "string" - ); - } -}; diff --git a/tests_config/run_spec.js b/tests_config/run_spec.js deleted file mode 100644 index a9d794bec..000000000 --- a/tests_config/run_spec.js +++ /dev/null @@ -1,147 +0,0 @@ -"use strict"; - -const fs = require("fs"); -const { extname } = require("path"); -const prettier = require("prettier"); -const plugin = require("../src"); -const { massageAST } = require("prettier/src/common/clean-ast"); -const { normalize } = require("prettier/src/main/options"); - -const { AST_COMPARE } = process.env; - -function run_spec(dirname, parsers, options) { - options = Object.assign( - { - plugins: ["."] - }, - options - ); - - /* instabul ignore if */ - if (!parsers || !parsers.length) { - throw new Error(`No parsers were specified for ${dirname}`); - } - - fs.readdirSync(dirname).forEach(filename => { - const path = `${dirname}/${filename}`; - if ( - extname(filename) !== ".snap" && - fs.lstatSync(path).isFile() && - filename[0] !== "." && - filename !== "jsfmt.spec.js" - ) { - const source = read(path).replace(/\r\n/g, "\n"); - - const mergedOptions = Object.assign(mergeDefaultOptions(options || {}), { - parser: parsers[0] - }); - const output = prettyprint(source, path, mergedOptions); - test(`${filename} - ${mergedOptions.parser}-verify`, () => { - expect(raw(`${source + "~".repeat(80)}\n${output}`)).toMatchSnapshot( - filename - ); - }); - - parsers.slice(1).forEach(parserName => { - test(`${filename} - ${parserName}-verify`, () => { - const verifyOptions = Object.assign(mergedOptions, { - parser: parserName - }); - const verifyOutput = prettyprint(source, path, verifyOptions); - expect(output).toEqual(verifyOutput); - }); - }); - - if (AST_COMPARE) { - const normalizedOptions = normalize(mergedOptions); - const ast = parse(source, mergedOptions); - const astMassaged = massageAST(ast, normalizedOptions); - let ppastMassaged; - let pperr = null; - try { - const ppast = parse( - prettyprint(source, path, mergedOptions), - mergedOptions - ); - ppastMassaged = massageAST(ppast, normalizedOptions); - } catch (e) { - pperr = e.stack; - } - - test(`${path} parse`, () => { - expect(pperr).toBe(null); - expect(ppastMassaged).toBeDefined(); - if (!ast.errors || ast.errors.length === 0) { - expect(astMassaged).toEqual(ppastMassaged); - } - }); - } - } - }); -} -global.run_spec = run_spec; - -function stripLocation(ast) { - if (Array.isArray(ast)) { - return ast.map(e => stripLocation(e)); - } - if (typeof ast === "object") { - const newObj = {}; - for (const key in ast) { - if ( - key === "loc" || - key === "range" || - key === "raw" || - key === "comments" || - key === "parent" || - key === "prev" - ) { - continue; - } - newObj[key] = stripLocation(ast[key]); - } - return newObj; - } - return ast; -} - -function parse(string, opts) { - return stripLocation(plugin.parsers.php.parse(string, {}, opts)); -} - -function prettyprint(src, filename, options) { - return prettier.format( - src, - Object.assign( - { - filepath: filename - }, - options - ) - ); -} - -function read(filename) { - return fs.readFileSync(filename, "utf8"); -} - -/** - * Wraps a string in a marker object that is used by `./raw-serializer.js` to - * directly print that string in a snapshot without escaping all double quotes. - * Backticks will still be escaped. - */ -function raw(string) { - if (typeof string !== "string") { - throw new Error("Raw snapshots have to be strings."); - } - return { [Symbol.for("raw")]: string }; -} - -function mergeDefaultOptions(parserConfig) { - return Object.assign( - { - printWidth: 80 - }, - parserConfig - ); -} diff --git a/tests_config/run_spec.mjs b/tests_config/run_spec.mjs new file mode 100644 index 000000000..21437ccc6 --- /dev/null +++ b/tests_config/run_spec.mjs @@ -0,0 +1,224 @@ +import fs from "fs"; +import path from "path"; +import url from "url"; +import { wrap as raw } from "jest-snapshot-serializer-raw"; +import { prettier, plugin } from "./get_engine.mjs"; + +const { AST_COMPARE, TEST_CRLF } = process.env; + +const CURSOR_PLACEHOLDER = "<|>"; +const RANGE_START_PLACEHOLDER = "<<>>"; +const RANGE_END_PLACEHOLDER = "<<>>"; + +global.run_spec = (importMeta, parsers, options) => { + const dirname = path.dirname(url.fileURLToPath(importMeta.url)); + + options = Object.assign({}, options, { + plugins: [plugin, ...((options && options.plugins) || [])], + }); + + // istanbul ignore next + if (!parsers || !parsers.length) { + throw new Error(`No parsers were specified for ${dirname}`); + } + + fs.readdirSync(dirname).forEach((basename) => { + const filename = path.join(dirname, basename); + + if ( + path.extname(basename) === ".snap" || + !fs.lstatSync(filename).isFile() || + basename[0] === "." || + basename === "jsfmt.spec.mjs" + ) { + return; + } + + let rangeStart; + let rangeEnd; + let cursorOffset; + + const text = fs.readFileSync(filename, "utf8"); + + const source = (TEST_CRLF ? text.replace(/\n/g, "\r\n") : text) + .replace(RANGE_START_PLACEHOLDER, (match, offset) => { + rangeStart = offset; + return ""; + }) + .replace(RANGE_END_PLACEHOLDER, (match, offset) => { + rangeEnd = offset; + return ""; + }); + + const input = source.replace(CURSOR_PLACEHOLDER, (match, offset) => { + cursorOffset = offset; + return ""; + }); + + const baseOptions = Object.assign({ printWidth: 80 }, options, { + rangeStart, + rangeEnd, + cursorOffset, + }); + const mainOptions = Object.assign({}, baseOptions, { + parser: parsers[0], + }); + + const hasEndOfLine = "endOfLine" in mainOptions; + + let output; + let visualizedOutput; + beforeAll(async () => { + output = await format(input, filename, mainOptions); + visualizedOutput = visualizeEndOfLine(output); + }); + + // eslint-disable-next-line jest/valid-title + test(basename, async () => { + expect(visualizedOutput).toEqual( + visualizeEndOfLine(consistentEndOfLine(output)) + ); + expect( + raw( + createSnapshot( + hasEndOfLine + ? visualizeEndOfLine( + text + .replace(RANGE_START_PLACEHOLDER, "") + .replace(RANGE_END_PLACEHOLDER, "") + ) + : source, + hasEndOfLine ? visualizedOutput : output, + Object.assign({}, baseOptions, { parsers }) + ) + ) + ).toMatchSnapshot(); + }); + + for (const parser of parsers.slice(1)) { + const verifyOptions = Object.assign({}, baseOptions, { parser }); + test(`${basename} - ${parser}-verify`, () => { + const verifyOutput = format(input, filename, verifyOptions); + expect(visualizedOutput).toEqual(visualizeEndOfLine(verifyOutput)); + }); + } + + // this will only work for php tests (since we're in the php repo) + if (AST_COMPARE && parsers[0] === "php") { + test(`${filename} parse`, async () => { + const parseOptions = { ...mainOptions, cursorOffset: undefined }; + + const originalAst = await parse(input, parseOptions); + const formattedAst = await parse( + output.replace(CURSOR_PLACEHOLDER, ""), + parseOptions + ); + + expect(originalAst).toBeDefined(); + expect(formattedAst).toEqual(originalAst); + }); + } + }); +}; + +async function parse(source, options) { + const { ast } = await prettier.__debug.parse(source, options, { + massage: true, + }); + return ast; +} + +async function format(source, filename, options) { + const result = await prettier.formatWithCursor( + source, + Object.assign({ filepath: filename }, options) + ); + + return options.cursorOffset >= 0 + ? result.formatted.slice(0, result.cursorOffset) + + CURSOR_PLACEHOLDER + + result.formatted.slice(result.cursorOffset) + : result.formatted; +} + +function consistentEndOfLine(text) { + let firstEndOfLine; + return text.replace(/\r\n?|\n/g, (endOfLine) => { + if (!firstEndOfLine) { + firstEndOfLine = endOfLine; + } + return firstEndOfLine; + }); +} + +function visualizeEndOfLine(text) { + return text.replace(/\r\n?|\n/g, (endOfLine) => { + switch (endOfLine) { + case "\n": + return "\n"; + case "\r\n": + return "\n"; + case "\r": + return "\n"; + default: + throw new Error(`Unexpected end of line ${JSON.stringify(endOfLine)}`); + } + }); +} + +function createSnapshot(input, output, options) { + const separatorWidth = 80; + const printWidthIndicator = + options.printWidth > 0 && Number.isFinite(options.printWidth) + ? `${" ".repeat(options.printWidth)}| printWidth` + : []; + return [] + .concat( + printSeparator(separatorWidth, "options"), + printOptions( + omit( + options, + (k) => k === "rangeStart" || k === "rangeEnd" || k === "cursorOffset" + ) + ), + printWidthIndicator, + printSeparator(separatorWidth, "input"), + input, + printSeparator(separatorWidth, "output"), + output, + printSeparator(separatorWidth) + ) + .join("\n"); +} + +function printSeparator(width, description) { + description = description || ""; + const leftLength = Math.floor((width - description.length) / 2); + const rightLength = width - leftLength - description.length; + return "=".repeat(leftLength) + description + "=".repeat(rightLength); +} + +function printOptions(options) { + const keys = Object.keys(options).sort(); + return keys.map((key) => `${key}: ${stringify(options[key])}`).join("\n"); + function stringify(value) { + return value === Infinity + ? "Infinity" + : Array.isArray(value) + ? `[${value.map((v) => JSON.stringify(v)).join(", ")}]` + : JSON.stringify(value); + } +} + +function omit(obj, fn) { + return Object.keys(obj).reduce((reduced, key) => { + if (key === "plugins") { + return reduced; + } + const value = obj[key]; + if (!fn(key, value)) { + reduced[key] = value; + } + return reduced; + }, {}); +} diff --git a/yarn.lock b/yarn.lock index 3f3140c8f..b36e788a3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,4184 +2,5691 @@ # yarn lockfile v1 -"@babel/code-frame@7.0.0-beta.40": - version "7.0.0-beta.40" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.40.tgz#37e2b0cf7c56026b4b21d3927cadf81adec32ac6" +"@aashutoshrathi/word-wrap@^1.2.3": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" + integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== + +"@ampproject/remapping@^2.0.0": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.1.1.tgz#7922fb0817bf3166d8d9e258c57477e3fd1c3610" + integrity sha512-Aolwjd7HSC2PyY0fDj/wA/EimQT4HfEnFYNp5s9CQlrdhyvWTtvZ5YzrUPu6R6/1jKiUlxu8bUhkdSnKHNAHMA== dependencies: - "@babel/highlight" "7.0.0-beta.40" + "@jridgewell/trace-mapping" "^0.3.0" -"@babel/highlight@7.0.0-beta.40": - version "7.0.0-beta.40" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.40.tgz#b43d67d76bf46e1d10d227f68cddcd263786b255" +"@ampproject/remapping@^2.2.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" + integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw== dependencies: + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.24" + +"@asamuzakjp/css-color@^3.2.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@asamuzakjp/css-color/-/css-color-3.2.0.tgz#cc42f5b85c593f79f1fa4f25d2b9b321e61d1794" + integrity sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw== + dependencies: + "@csstools/css-calc" "^2.1.3" + "@csstools/css-color-parser" "^3.0.9" + "@csstools/css-parser-algorithms" "^3.0.4" + "@csstools/css-tokenizer" "^3.0.3" + lru-cache "^10.4.3" + +"@babel/code-frame@^7.0.0": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" + integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg== + dependencies: + "@babel/highlight" "^7.16.7" + +"@babel/code-frame@^7.16.7": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" + integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q== + dependencies: + "@babel/highlight" "^7.18.6" + +"@babel/code-frame@^7.18.6": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.5.tgz#234d98e1551960604f1246e6475891a570ad5658" + integrity sha512-Xmwn266vad+6DAqEB2A6V/CcZVp62BbwVmcOJc2RPuwih1kw02TjQvWVWlcKGbBPd+8/0V5DEkOcizRGYsspYQ== + dependencies: + "@babel/highlight" "^7.22.5" + +"@babel/code-frame@^7.22.5": + version "7.22.13" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e" + integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w== + dependencies: + "@babel/highlight" "^7.22.13" + chalk "^2.4.2" + +"@babel/code-frame@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.27.1.tgz#200f715e66d52a23b221a9435534a91cc13ad5be" + integrity sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg== + dependencies: + "@babel/helper-validator-identifier" "^7.27.1" + js-tokens "^4.0.0" + picocolors "^1.1.1" + +"@babel/compat-data@^7.22.6", "@babel/compat-data@^7.22.9", "@babel/compat-data@^7.23.5": + version "7.23.5" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.23.5.tgz#ffb878728bb6bdcb6f4510aa51b1be9afb8cfd98" + integrity sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw== + +"@babel/compat-data@^7.27.2": + version "7.27.5" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.27.5.tgz#7d0658ec1a8420fc866d1df1b03bea0e79934c82" + integrity sha512-KiRAp/VoJaWkkte84TvUd9qjdbZAdiqyvMxrGl1N6vzFogKmaLgoM3L1kgtLicp2HP5fBJS8JrZKLVIZGVJAVg== + +"@babel/core@^7.12.3": + version "7.17.2" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.17.2.tgz#2c77fc430e95139d816d39b113b31bf40fb22337" + integrity sha512-R3VH5G42VSDolRHyUO4V2cfag8WHcZyxdq5Z/m8Xyb92lW/Erm/6kM+XtRFGf3Mulre3mveni2NHfEUws8wSvw== + dependencies: + "@ampproject/remapping" "^2.0.0" + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.17.0" + "@babel/helper-compilation-targets" "^7.16.7" + "@babel/helper-module-transforms" "^7.16.7" + "@babel/helpers" "^7.17.2" + "@babel/parser" "^7.17.0" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.17.0" + "@babel/types" "^7.17.0" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.1.2" + semver "^6.3.0" + +"@babel/core@^7.23.9", "@babel/core@^7.27.4": + version "7.27.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.27.4.tgz#cc1fc55d0ce140a1828d1dd2a2eba285adbfb3ce" + integrity sha512-bXYxrXFubeYdvB0NhD/NBB3Qi6aZeV20GOWVI47t2dkecCEoneR4NPVcb7abpXDEvejgrUfFtG6vG/zxAKmg+g== + dependencies: + "@ampproject/remapping" "^2.2.0" + "@babel/code-frame" "^7.27.1" + "@babel/generator" "^7.27.3" + "@babel/helper-compilation-targets" "^7.27.2" + "@babel/helper-module-transforms" "^7.27.3" + "@babel/helpers" "^7.27.4" + "@babel/parser" "^7.27.4" + "@babel/template" "^7.27.2" + "@babel/traverse" "^7.27.4" + "@babel/types" "^7.27.3" + convert-source-map "^2.0.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.3" + semver "^6.3.1" + +"@babel/generator@^7.17.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.19.0.tgz#785596c06425e59334df2ccee63ab166b738419a" + integrity sha512-S1ahxf1gZ2dpoiFgA+ohK9DIpz50bJ0CWs7Zlzb54Z4sG8qmdIrGrVqmy1sAtTVRb+9CU6U8VqT9L0Zj7hxHVg== + dependencies: + "@babel/types" "^7.19.0" + "@jridgewell/gen-mapping" "^0.3.2" + jsesc "^2.5.1" + +"@babel/generator@^7.27.3", "@babel/generator@^7.27.5": + version "7.27.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.27.5.tgz#3eb01866b345ba261b04911020cbe22dd4be8c8c" + integrity sha512-ZGhA37l0e/g2s1Cnzdix0O3aLYm66eF8aufiVteOgnwxgnRP8GoyMj7VWsgWnQbVKXyge7hqrFh2K2TQM6t1Hw== + dependencies: + "@babel/parser" "^7.27.5" + "@babel/types" "^7.27.3" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + jsesc "^3.0.2" + +"@babel/helper-annotate-as-pure@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz#e7f06737b197d580a01edf75d97e2c8be99d3882" + integrity sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg== + dependencies: + "@babel/types" "^7.22.5" + +"@babel/helper-annotate-as-pure@^7.27.1": + version "7.27.3" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.27.3.tgz#f31fd86b915fc4daf1f3ac6976c59be7084ed9c5" + integrity sha512-fXSwMQqitTGeHLBC08Eq5yXz2m37E4pJX1qAU1+2cNedz/ifv/bVXft90VeSav5nFO61EcNgwr0aJxbyPaWBPg== + dependencies: + "@babel/types" "^7.27.3" + +"@babel/helper-compilation-targets@^7.16.7": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz#0698fc44551a26cf29f18d4662d5bf545a6cfc52" + integrity sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw== + dependencies: + "@babel/compat-data" "^7.22.9" + "@babel/helper-validator-option" "^7.22.15" + browserslist "^4.21.9" + lru-cache "^5.1.1" + semver "^6.3.1" + +"@babel/helper-compilation-targets@^7.22.6": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz#4d79069b16cbcf1461289eccfbbd81501ae39991" + integrity sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ== + dependencies: + "@babel/compat-data" "^7.23.5" + "@babel/helper-validator-option" "^7.23.5" + browserslist "^4.22.2" + lru-cache "^5.1.1" + semver "^6.3.1" + +"@babel/helper-compilation-targets@^7.27.1", "@babel/helper-compilation-targets@^7.27.2": + version "7.27.2" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz#46a0f6efab808d51d29ce96858dd10ce8732733d" + integrity sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ== + dependencies: + "@babel/compat-data" "^7.27.2" + "@babel/helper-validator-option" "^7.27.1" + browserslist "^4.24.0" + lru-cache "^5.1.1" + semver "^6.3.1" + +"@babel/helper-create-class-features-plugin@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.27.1.tgz#5bee4262a6ea5ddc852d0806199eb17ca3de9281" + integrity sha512-QwGAmuvM17btKU5VqXfb+Giw4JcN0hjuufz3DYnpeVDvZLAObloM77bhMXiqry3Iio+Ai4phVRDwl6WU10+r5A== + dependencies: + "@babel/helper-annotate-as-pure" "^7.27.1" + "@babel/helper-member-expression-to-functions" "^7.27.1" + "@babel/helper-optimise-call-expression" "^7.27.1" + "@babel/helper-replace-supers" "^7.27.1" + "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" + "@babel/traverse" "^7.27.1" + semver "^6.3.1" + +"@babel/helper-create-regexp-features-plugin@^7.18.6": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.22.15.tgz#5ee90093914ea09639b01c711db0d6775e558be1" + integrity sha512-29FkPLFjn4TPEa3RE7GpW+qbE8tlsu3jntNYNfcGsc49LphF1PQIiD+vMZ1z1xVOKt+93khA9tc2JBs3kBjA7w== + dependencies: + "@babel/helper-annotate-as-pure" "^7.22.5" + regexpu-core "^5.3.1" + semver "^6.3.1" + +"@babel/helper-create-regexp-features-plugin@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.27.1.tgz#05b0882d97ba1d4d03519e4bce615d70afa18c53" + integrity sha512-uVDC72XVf8UbrH5qQTc18Agb8emwjTiZrQE11Nv3CuBEZmVvTwwE9CBUEvHku06gQCAyYf8Nv6ja1IN+6LMbxQ== + dependencies: + "@babel/helper-annotate-as-pure" "^7.27.1" + regexpu-core "^6.2.0" + semver "^6.3.1" + +"@babel/helper-define-polyfill-provider@^0.6.3", "@babel/helper-define-polyfill-provider@^0.6.4": + version "0.6.4" + resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.4.tgz#15e8746368bfa671785f5926ff74b3064c291fab" + integrity sha512-jljfR1rGnXXNWnmQg2K3+bvhkxB51Rl32QRaOTuwwjviGrHzIbSc8+x9CpraDtbT7mfyjXObULP4w/adunNwAw== + dependencies: + "@babel/helper-compilation-targets" "^7.22.6" + "@babel/helper-plugin-utils" "^7.22.5" + debug "^4.1.1" + lodash.debounce "^4.0.8" + resolve "^1.14.2" + +"@babel/helper-environment-visitor@^7.16.7": + version "7.18.9" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be" + integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg== + +"@babel/helper-function-name@^7.16.7": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz#941574ed5390682e872e52d3f38ce9d1bef4648c" + integrity sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w== + dependencies: + "@babel/template" "^7.18.10" + "@babel/types" "^7.19.0" + +"@babel/helper-hoist-variables@^7.16.7": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" + integrity sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-member-expression-to-functions@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.27.1.tgz#ea1211276be93e798ce19037da6f06fbb994fa44" + integrity sha512-E5chM8eWjTp/aNoVpcbfM7mLxu9XGLWYise2eBKGQomAk/Mb4XoxyqXTZbuTohbsl8EKqdlMhnDI2CCLfcs9wA== + dependencies: + "@babel/traverse" "^7.27.1" + "@babel/types" "^7.27.1" + +"@babel/helper-module-imports@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz#25612a8091a999704461c8a222d0efec5d091437" + integrity sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg== + dependencies: + "@babel/types" "^7.16.7" + +"@babel/helper-module-imports@^7.18.6": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz#16146307acdc40cc00c3b2c647713076464bdbf0" + integrity sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w== + dependencies: + "@babel/types" "^7.22.15" + +"@babel/helper-module-imports@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz#7ef769a323e2655e126673bb6d2d6913bbead204" + integrity sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w== + dependencies: + "@babel/traverse" "^7.27.1" + "@babel/types" "^7.27.1" + +"@babel/helper-module-transforms@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz#7665faeb721a01ca5327ddc6bba15a5cb34b6a41" + integrity sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng== + dependencies: + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-module-imports" "^7.16.7" + "@babel/helper-simple-access" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/helper-validator-identifier" "^7.16.7" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.16.7" + "@babel/types" "^7.16.7" + +"@babel/helper-module-transforms@^7.27.1", "@babel/helper-module-transforms@^7.27.3": + version "7.27.3" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.27.3.tgz#db0bbcfba5802f9ef7870705a7ef8788508ede02" + integrity sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg== + dependencies: + "@babel/helper-module-imports" "^7.27.1" + "@babel/helper-validator-identifier" "^7.27.1" + "@babel/traverse" "^7.27.3" + +"@babel/helper-optimise-call-expression@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.27.1.tgz#c65221b61a643f3e62705e5dd2b5f115e35f9200" + integrity sha512-URMGH08NzYFhubNSGJrpUEphGKQwMQYBySzat5cAByY1/YgIRkULnIy3tAMeszlL/so2HbeilYloUmSpd7GdVw== + dependencies: + "@babel/types" "^7.27.1" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.8.0": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz#dd7ee3735e8a313b9f7b05a773d892e88e6d7295" + integrity sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg== + +"@babel/helper-plugin-utils@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz#ddb2f876534ff8013e6c2b299bf4d39b3c51d44c" + integrity sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw== + +"@babel/helper-remap-async-to-generator@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.27.1.tgz#4601d5c7ce2eb2aea58328d43725523fcd362ce6" + integrity sha512-7fiA521aVw8lSPeI4ZOD3vRFkoqkJcS+z4hFo82bFSH/2tNd6eJ5qCVMS5OzDmZh/kaHQeBaeyxK6wljcPtveA== + dependencies: + "@babel/helper-annotate-as-pure" "^7.27.1" + "@babel/helper-wrap-function" "^7.27.1" + "@babel/traverse" "^7.27.1" + +"@babel/helper-replace-supers@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.27.1.tgz#b1ed2d634ce3bdb730e4b52de30f8cccfd692bc0" + integrity sha512-7EHz6qDZc8RYS5ElPoShMheWvEgERonFCs7IAonWLLUTXW59DP14bCZt89/GKyreYn8g3S83m21FelHKbeDCKA== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.27.1" + "@babel/helper-optimise-call-expression" "^7.27.1" + "@babel/traverse" "^7.27.1" + +"@babel/helper-simple-access@^7.16.7": + version "7.16.7" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz#d656654b9ea08dbb9659b69d61063ccd343ff0f7" + integrity sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g== + dependencies: + "@babel/types" "^7.16.7" + +"@babel/helper-skip-transparent-expression-wrappers@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.27.1.tgz#62bb91b3abba8c7f1fec0252d9dbea11b3ee7a56" + integrity sha512-Tub4ZKEXqbPjXgWLl2+3JpQAYBJ8+ikpQ2Ocj/q/r0LwE3UhENh7EUabyHjz2kCEsrRY83ew2DQdHluuiDQFzg== + dependencies: + "@babel/traverse" "^7.27.1" + "@babel/types" "^7.27.1" + +"@babel/helper-split-export-declaration@^7.16.7": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz#7367949bc75b20c6d5a5d4a97bba2824ae8ef075" + integrity sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-string-parser@^7.22.5", "@babel/helper-string-parser@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz#9478c707febcbbe1ddb38a3d91a2e054ae622d83" + integrity sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ== + +"@babel/helper-string-parser@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687" + integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA== + +"@babel/helper-validator-identifier@^7.16.7": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz#9c97e30d31b2b8c72a1d08984f2ca9b574d7a076" + integrity sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g== + +"@babel/helper-validator-identifier@^7.18.6": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz#9544ef6a33999343c8740fa51350f30eeaaaf193" + integrity sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ== + +"@babel/helper-validator-identifier@^7.22.15", "@babel/helper-validator-identifier@^7.22.20", "@babel/helper-validator-identifier@^7.22.5": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" + integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== + +"@babel/helper-validator-identifier@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz#a7054dcc145a967dd4dc8fee845a57c1316c9df8" + integrity sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow== + +"@babel/helper-validator-option@^7.22.15", "@babel/helper-validator-option@^7.23.5": + version "7.23.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz#907a3fbd4523426285365d1206c423c4c5520307" + integrity sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw== + +"@babel/helper-validator-option@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz#fa52f5b1e7db1ab049445b421c4471303897702f" + integrity sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg== + +"@babel/helper-wrap-function@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.27.1.tgz#b88285009c31427af318d4fe37651cd62a142409" + integrity sha512-NFJK2sHUvrjo8wAU/nQTWU890/zB2jj0qBcCbZbbf+005cAsv6tMjXz31fBign6M5ov1o0Bllu+9nbqkfsjjJQ== + dependencies: + "@babel/template" "^7.27.1" + "@babel/traverse" "^7.27.1" + "@babel/types" "^7.27.1" + +"@babel/helpers@^7.17.2": + version "7.17.2" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.17.2.tgz#23f0a0746c8e287773ccd27c14be428891f63417" + integrity sha512-0Qu7RLR1dILozr/6M0xgj+DFPmi6Bnulgm9M8BVa9ZCWxDqlSnqt3cf8IDPB5m45sVXUZ0kuQAgUrdSFFH79fQ== + dependencies: + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.17.0" + "@babel/types" "^7.17.0" + +"@babel/helpers@^7.27.4": + version "7.27.6" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.27.6.tgz#6456fed15b2cb669d2d1fabe84b66b34991d812c" + integrity sha512-muE8Tt8M22638HU31A3CgfSUciwz1fhATfoVai05aPXGor//CdWDCbnlY1yvBPo07njuVOCNGCSp/GTt12lIug== + dependencies: + "@babel/template" "^7.27.2" + "@babel/types" "^7.27.6" + +"@babel/highlight@^7.16.7": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" + integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== + dependencies: + "@babel/helper-validator-identifier" "^7.18.6" chalk "^2.0.0" - esutils "^2.0.2" - js-tokens "^3.0.0" + js-tokens "^4.0.0" -"@glimmer/interfaces@^0.30.3": - version "0.30.5" - resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.30.5.tgz#9fd391ff4b9e4b29cf56495a2c3f5f660e45497a" +"@babel/highlight@^7.18.6": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.5.tgz#aa6c05c5407a67ebce408162b7ede789b4d22031" + integrity sha512-BSKlD1hgnedS5XRnGOljZawtag7H1yPfQp0tdNJCHoH6AZ+Pcm9VvkrK59/Yy593Ypg0zMxH2BxD1VPYUQ7UIw== dependencies: - "@glimmer/wire-format" "^0.30.5" + "@babel/helper-validator-identifier" "^7.22.5" + chalk "^2.0.0" + js-tokens "^4.0.0" + +"@babel/highlight@^7.22.13": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.23.4.tgz#edaadf4d8232e1a961432db785091207ead0621b" + integrity sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A== + dependencies: + "@babel/helper-validator-identifier" "^7.22.20" + chalk "^2.4.2" + js-tokens "^4.0.0" -"@glimmer/syntax@0.30.3": - version "0.30.3" - resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.30.3.tgz#31ca56d00b4f7c63af13aeb70b5d58a9b250f02e" - dependencies: - "@glimmer/interfaces" "^0.30.3" - "@glimmer/util" "^0.30.3" - handlebars "^4.0.6" - simple-html-tokenizer "^0.4.1" +"@babel/highlight@^7.22.5": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.20.tgz#4ca92b71d80554b01427815e06f2df965b9c1f54" + integrity sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg== + dependencies: + "@babel/helper-validator-identifier" "^7.22.20" + chalk "^2.4.2" + js-tokens "^4.0.0" + +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7": + version "7.17.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.17.0.tgz#f0ac33eddbe214e4105363bb17c3341c5ffcc43c" + integrity sha512-VKXSCQx5D8S04ej+Dqsr1CzYvvWgf20jIw2D+YhQCrIlr2UZGaDds23Y0xg75/skOxpLCRpUZvk/1EAVkGoDOw== -"@glimmer/util@^0.30.3", "@glimmer/util@^0.30.5": - version "0.30.5" - resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.30.5.tgz#97f3dcd4029f713c503371e1608e129a833a70e1" +"@babel/parser@^7.17.0": + version "7.19.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.19.0.tgz#497fcafb1d5b61376959c1c338745ef0577aa02c" + integrity sha512-74bEXKX2h+8rrfQUfsBfuZZHzsEs6Eql4pqy/T4Nn6Y9wNPggQOqD6z6pn5Bl8ZfysKouFZT/UXEH94ummEeQw== -"@glimmer/wire-format@^0.30.5": - version "0.30.5" - resolved "https://registry.yarnpkg.com/@glimmer/wire-format/-/wire-format-0.30.5.tgz#17d79a320b931950ac03887733e56ecc7bbd0a06" - dependencies: - "@glimmer/util" "^0.30.5" +"@babel/parser@^7.18.10": + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.7.tgz#66fe23b3c8569220817d5feb8b9dcdc95bb4f71b" + integrity sha512-T3Z9oHybU+0vZlY9CiDSJQTD5ZapcW18ZctFMi0MOAl/4BjFF4ul7NVSARLdbGO5vDqy9eQiGTV0LtKfvCYvcg== -"@types/commander@^2.11.0": - version "2.12.2" - resolved "https://registry.yarnpkg.com/@types/commander/-/commander-2.12.2.tgz#183041a23842d4281478fa5d23c5ca78e6fd08ae" +"@babel/parser@^7.20.7", "@babel/parser@^7.27.2", "@babel/parser@^7.27.4", "@babel/parser@^7.27.5": + version "7.27.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.5.tgz#ed22f871f110aa285a6fd934a0efed621d118826" + integrity sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg== dependencies: - commander "*" - -"@types/node@*": - version "9.6.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.2.tgz#e49ac1adb458835e95ca6487bc20f916b37aff23" + "@babel/types" "^7.27.3" -"@types/semver@^5.4.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45" - -abab@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" +"@babel/parser@^7.22.5": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719" + integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw== -abbrev@1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" +"@babel/parser@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.9.tgz#7b903b6149b0f8fa7ad564af646c4c38a77fc44b" + integrity sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA== -acorn-globals@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf" +"@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.27.1.tgz#61dd8a8e61f7eb568268d1b5f129da3eee364bf9" + integrity sha512-QPG3C9cCVRQLxAVwmefEmwdTanECuUBMQZ/ym5kiw3XKCGA7qkuQLcjWWHcrD/GKbn/WmJwaezfuuAOcyKlRPA== dependencies: - acorn "^4.0.4" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/traverse" "^7.27.1" -acorn-jsx@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" +"@babel/plugin-bugfix-safari-class-field-initializer-scope@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.27.1.tgz#43f70a6d7efd52370eefbdf55ae03d91b293856d" + integrity sha512-qNeq3bCKnGgLkEXUuFry6dPlGfCdQNZbn7yUAPCInwAJHMU7THJfrBSozkcWq5sNM6RcF3S8XyQL2A52KNR9IA== dependencies: - acorn "^3.0.4" + "@babel/helper-plugin-utils" "^7.27.1" -acorn@^3.0.4: - version "3.3.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" +"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.27.1.tgz#beb623bd573b8b6f3047bd04c32506adc3e58a72" + integrity sha512-g4L7OYun04N1WyqMNjldFwlfPCLVkgB54A/YCXICZYBsvJJE3kByKv9c9+R/nAfmIfjl2rKYLNyMHboYbZaWaA== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" -acorn@^4.0.4: - version "4.0.13" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" +"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.27.1.tgz#e134a5479eb2ba9c02714e8c1ebf1ec9076124fd" + integrity sha512-oO02gcONcD5O1iTLi/6frMJBIwWEHceWGSGqrpCmEL8nogiS6J9PBlE48CaK20/Jx1LuRml9aDftLgdjXT8+Cw== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" + "@babel/plugin-transform-optional-chaining" "^7.27.1" -acorn@^5.5.0: - version "5.5.3" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.5.3.tgz#f473dd47e0277a08e28e9bec5aeeb04751f0b8c9" +"@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.27.1.tgz#bb1c25af34d75115ce229a1de7fa44bf8f955670" + integrity sha512-6BpaYGDavZqkI6yT+KSPdpZFfpnd68UKXbcjI9pJ13pvHhPrCKWOOLp+ysvMeA+DxnhuPpgIaRpxRxo5A9t5jw== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/traverse" "^7.27.1" -ajv-keywords@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.1.0.tgz#ac2b27939c543e95d2c06e7f7f5c27be4aa543be" +"@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2": + version "7.21.0-placeholder-for-preset-env.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz#7844f9289546efa9febac2de4cfe358a050bd703" + integrity sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w== -ajv@^4.9.1: - version "4.11.8" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" +"@babel/plugin-syntax-async-generators@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" + integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== dependencies: - co "^4.6.0" - json-stable-stringify "^1.0.1" + "@babel/helper-plugin-utils" "^7.8.0" -ajv@^5.1.0, ajv@^5.2.0: - version "5.5.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" +"@babel/plugin-syntax-bigint@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" + integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== dependencies: - co "^4.6.0" - fast-deep-equal "^1.0.0" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.3.0" + "@babel/helper-plugin-utils" "^7.8.0" -ajv@^6.0.1: - version "6.4.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.4.0.tgz#d3aff78e9277549771daf0164cff48482b754fc6" +"@babel/plugin-syntax-class-properties@^7.12.13": + version "7.12.13" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" + integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== dependencies: - fast-deep-equal "^1.0.0" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.3.0" - uri-js "^3.0.2" + "@babel/helper-plugin-utils" "^7.12.13" -align-text@^0.1.1, align-text@^0.1.3: - version "0.1.4" - resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" +"@babel/plugin-syntax-class-static-block@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz#195df89b146b4b78b3bf897fd7a257c84659d406" + integrity sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw== dependencies: - kind-of "^3.0.2" - longest "^1.0.1" - repeat-string "^1.5.2" - -amdefine@>=0.0.4: - version "1.0.1" - resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" - -ansi-escapes@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30" + "@babel/helper-plugin-utils" "^7.14.5" -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - -ansi-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - -ansi-styles@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - -ansi-styles@^3.1.0, ansi-styles@^3.2.0, ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" +"@babel/plugin-syntax-import-assertions@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.27.1.tgz#88894aefd2b03b5ee6ad1562a7c8e1587496aecd" + integrity sha512-UT/Jrhw57xg4ILHLFnzFpPDlMbcdEicaAtjPQpbj9wa8T4r5KVWCimHcL/460g8Ht0DMxDyjsLgiWSkVjnwPFg== dependencies: - color-convert "^1.9.0" + "@babel/helper-plugin-utils" "^7.27.1" -anymatch@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" +"@babel/plugin-syntax-import-attributes@^7.24.7", "@babel/plugin-syntax-import-attributes@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.27.1.tgz#34c017d54496f9b11b61474e7ea3dfd5563ffe07" + integrity sha512-oFT0FrKHgF53f4vOsZGi2Hh3I35PfSmVs4IBFLFj4dnafP+hIWDLg3VyKmUHfLoLHlyxY4C7DGtmHuJgn+IGww== dependencies: - micromatch "^3.1.4" - normalize-path "^2.1.1" + "@babel/helper-plugin-utils" "^7.27.1" -append-transform@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" +"@babel/plugin-syntax-import-meta@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" + integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== dependencies: - default-require-extensions "^1.0.0" + "@babel/helper-plugin-utils" "^7.10.4" -aproba@^1.0.3: - version "1.2.0" - resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" +"@babel/plugin-syntax-json-strings@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" + integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" -are-we-there-yet@~1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz#bb5dca382bb94f05e15194373d16fd3ba1ca110d" +"@babel/plugin-syntax-jsx@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.27.1.tgz#2f9beb5eff30fa507c5532d107daac7b888fa34c" + integrity sha512-y8YTNIeKoyhGd9O0Jiyzyyqk8gdjnumGTQPsz0xOZOQ2RmkVJeZ1vmmfIvFEKqucBG6axJGBZDE/7iI5suUI/w== dependencies: - delegates "^1.0.0" - readable-stream "^2.0.6" + "@babel/helper-plugin-utils" "^7.27.1" -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" +"@babel/plugin-syntax-logical-assignment-operators@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" + integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== dependencies: - sprintf-js "~1.0.2" + "@babel/helper-plugin-utils" "^7.10.4" -arr-diff@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" +"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" + integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== dependencies: - arr-flatten "^1.0.1" + "@babel/helper-plugin-utils" "^7.8.0" -arr-diff@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" +"@babel/plugin-syntax-numeric-separator@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" + integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== + dependencies: + "@babel/helper-plugin-utils" "^7.10.4" -arr-flatten@^1.0.1, arr-flatten@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" +"@babel/plugin-syntax-object-rest-spread@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" + integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" -arr-union@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" +"@babel/plugin-syntax-optional-catch-binding@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" + integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" -array-equal@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" +"@babel/plugin-syntax-optional-chaining@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" + integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.0" -array-union@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" +"@babel/plugin-syntax-private-property-in-object@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz#0dc6671ec0ea22b6e94a1114f857970cd39de1ad" + integrity sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg== dependencies: - array-uniq "^1.0.1" + "@babel/helper-plugin-utils" "^7.14.5" -array-uniq@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" +"@babel/plugin-syntax-top-level-await@^7.14.5": + version "7.14.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" + integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== + dependencies: + "@babel/helper-plugin-utils" "^7.14.5" -array-unique@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" +"@babel/plugin-syntax-typescript@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.27.1.tgz#5147d29066a793450f220c63fa3a9431b7e6dd18" + integrity sha512-xfYCBMxveHrRMnAWl1ZlPXOZjzkN82THFvLhQhFXFt81Z5HnN+EtUkZhv/zcKpmT3fzmWZB0ywiBrbC3vogbwQ== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" -array-unique@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" +"@babel/plugin-syntax-unicode-sets-regex@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz#d49a3b3e6b52e5be6740022317580234a6a47357" + integrity sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" -arrify@^1.0.0, arrify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" +"@babel/plugin-transform-arrow-functions@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.27.1.tgz#6e2061067ba3ab0266d834a9f94811196f2aba9a" + integrity sha512-8Z4TGic6xW70FKThA5HYEKKyBpOOsucTOD1DjU3fZxDg+K3zBJcXMFnt/4yQiZnf5+MiOMSXQ9PaEK/Ilh1DeA== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" -asn1@~0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" +"@babel/plugin-transform-async-generator-functions@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.27.1.tgz#ca433df983d68e1375398e7ca71bf2a4f6fd89d7" + integrity sha512-eST9RrwlpaoJBDHShc+DS2SG4ATTi2MYNb4OxYkf3n+7eb49LWpnS+HSpVfW4x927qQwgk8A2hGNVaajAEw0EA== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-remap-async-to-generator" "^7.27.1" + "@babel/traverse" "^7.27.1" -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" +"@babel/plugin-transform-async-to-generator@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.27.1.tgz#9a93893b9379b39466c74474f55af03de78c66e7" + integrity sha512-NREkZsZVJS4xmTr8qzE5y8AfIPqsdQfRuUiLRTEzb7Qii8iFWCyDKaUV2c0rCuh4ljDZ98ALHP/PetiBV2nddA== + dependencies: + "@babel/helper-module-imports" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-remap-async-to-generator" "^7.27.1" -assert-plus@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" +"@babel/plugin-transform-block-scoped-functions@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.27.1.tgz#558a9d6e24cf72802dd3b62a4b51e0d62c0f57f9" + integrity sha512-cnqkuOtZLapWYZUYM5rVIdv1nXYuFVIltZ6ZJ7nIj585QsjKM5dhL2Fu/lICXZ1OyIAFc7Qy+bvDAtTXqGrlhg== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" -assign-symbols@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" +"@babel/plugin-transform-block-scoping@^7.27.1": + version "7.27.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.27.5.tgz#98c37485d815533623d992fd149af3e7b3140157" + integrity sha512-JF6uE2s67f0y2RZcm2kpAUEbD50vH62TyWVebxwHAlbSdM49VqPz8t4a1uIjp4NIOIZ4xzLfjY5emt/RCyC7TQ== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" -astral-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" +"@babel/plugin-transform-class-properties@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.27.1.tgz#dd40a6a370dfd49d32362ae206ddaf2bb082a925" + integrity sha512-D0VcalChDMtuRvJIu3U/fwWjf8ZMykz5iZsg77Nuj821vCKI3zCyRLwRdWbsuJ/uRwZhZ002QtCqIkwC/ZkvbA== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -async@^1.4.0: - version "1.5.2" - resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" +"@babel/plugin-transform-class-static-block@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.27.1.tgz#7e920d5625b25bbccd3061aefbcc05805ed56ce4" + integrity sha512-s734HmYU78MVzZ++joYM+NkJusItbdRcbm+AGRgJCt3iA+yux0QpD9cBVdz3tKyrjVYWRl7j0mHSmv4lhV0aoA== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -async@^2.1.4: - version "2.6.0" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.0.tgz#61a29abb6fcc026fea77e56d1c6ec53a795951f4" +"@babel/plugin-transform-classes@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.27.1.tgz#03bb04bea2c7b2f711f0db7304a8da46a85cced4" + integrity sha512-7iLhfFAubmpeJe/Wo2TVuDrykh/zlWXLzPNdL0Jqn/Xu8R3QQ8h9ff8FQoISZOsw74/HFqFI7NX63HN7QFIHKA== dependencies: - lodash "^4.14.0" + "@babel/helper-annotate-as-pure" "^7.27.1" + "@babel/helper-compilation-targets" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-replace-supers" "^7.27.1" + "@babel/traverse" "^7.27.1" + globals "^11.1.0" -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" +"@babel/plugin-transform-computed-properties@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.27.1.tgz#81662e78bf5e734a97982c2b7f0a793288ef3caa" + integrity sha512-lj9PGWvMTVksbWiDT2tW68zGS/cyo4AkZ/QTp0sQT0mjPopCmrSkzxeXkznjqBxzDI6TclZhOJbBmbBLjuOZUw== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/template" "^7.27.1" -atob@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.0.tgz#ab2b150e51d7b122b9efc8d7340c06b6c41076bc" +"@babel/plugin-transform-destructuring@^7.27.1", "@babel/plugin-transform-destructuring@^7.27.3": + version "7.27.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.27.3.tgz#3cc8299ed798d9a909f8d66ddeb40849ec32e3b0" + integrity sha512-s4Jrok82JpiaIprtY2nHsYmrThKvvwgHwjgd7UMiYhZaN0asdXNLr0y+NjTfkA7SyQE5i2Fb7eawUOZmLvyqOA== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" -aws-sign2@~0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" +"@babel/plugin-transform-dotall-regex@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.27.1.tgz#aa6821de864c528b1fecf286f0a174e38e826f4d" + integrity sha512-gEbkDVGRvjj7+T1ivxrfgygpT7GUd4vmODtYpbs0gZATdkX8/iSnOtZSxiZnsgm1YjTgjI6VKBGSJJevkrclzw== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" +"@babel/plugin-transform-duplicate-keys@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.27.1.tgz#f1fbf628ece18e12e7b32b175940e68358f546d1" + integrity sha512-MTyJk98sHvSs+cvZ4nOauwTTG1JeonDjSGvGGUNHreGQns+Mpt6WX/dVzWBHgg+dYZhkC4X+zTDfkTU+Vy9y7Q== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" -aws4@^1.2.1, aws4@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" +"@babel/plugin-transform-duplicate-named-capturing-groups-regex@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.27.1.tgz#5043854ca620a94149372e69030ff8cb6a9eb0ec" + integrity sha512-hkGcueTEzuhB30B3eJCbCYeCaaEQOmQR0AdvzpD4LoN0GXMWzzGSuRrxR2xTnCrvNbVwK9N6/jQ92GSLfiZWoQ== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" +"@babel/plugin-transform-dynamic-import@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.27.1.tgz#4c78f35552ac0e06aa1f6e3c573d67695e8af5a4" + integrity sha512-MHzkWQcEmjzzVW9j2q8LGjwGWpG2mjwaaB0BNQwst3FIjqsg8Ct/mIZlvSPJvfi9y2AC8mi/ktxbFVL9pZ1I4A== dependencies: - chalk "^1.1.3" - esutils "^2.0.2" - js-tokens "^3.0.2" - -babel-core@^6.0.0, babel-core@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.26.0.tgz#af32f78b31a6fcef119c87b0fd8d9753f03a0bb8" - dependencies: - babel-code-frame "^6.26.0" - babel-generator "^6.26.0" - babel-helpers "^6.24.1" - babel-messages "^6.23.0" - babel-register "^6.26.0" - babel-runtime "^6.26.0" - babel-template "^6.26.0" - babel-traverse "^6.26.0" - babel-types "^6.26.0" - babylon "^6.18.0" - convert-source-map "^1.5.0" - debug "^2.6.8" - json5 "^0.5.1" - lodash "^4.17.4" - minimatch "^3.0.4" - path-is-absolute "^1.0.1" - private "^0.1.7" - slash "^1.0.0" - source-map "^0.5.6" - -babel-generator@^6.18.0, babel-generator@^6.26.0: - version "6.26.1" - resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" - dependencies: - babel-messages "^6.23.0" - babel-runtime "^6.26.0" - babel-types "^6.26.0" - detect-indent "^4.0.0" - jsesc "^1.3.0" - lodash "^4.17.4" - source-map "^0.5.7" - trim-right "^1.0.1" - -babel-helpers@^6.24.1: - version "6.24.1" - resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2" - dependencies: - babel-runtime "^6.22.0" - babel-template "^6.24.1" - -babel-jest@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-21.2.0.tgz#2ce059519a9374a2c46f2455b6fbef5ad75d863e" - dependencies: - babel-plugin-istanbul "^4.0.0" - babel-preset-jest "^21.2.0" - -babel-messages@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-istanbul@^4.0.0: - version "4.1.5" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.5.tgz#6760cdd977f411d3e175bb064f2bc327d99b2b6e" - dependencies: - find-up "^2.1.0" - istanbul-lib-instrument "^1.7.5" - test-exclude "^4.1.1" - -babel-plugin-jest-hoist@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-21.2.0.tgz#2cef637259bd4b628a6cace039de5fcd14dbb006" - -babel-plugin-syntax-object-rest-spread@^6.13.0: - version "6.13.0" - resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5" - -babel-preset-jest@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-21.2.0.tgz#ff9d2bce08abd98e8a36d9a8a5189b9173b85638" - dependencies: - babel-plugin-jest-hoist "^21.2.0" - babel-plugin-syntax-object-rest-spread "^6.13.0" - -babel-register@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.26.0.tgz#6ed021173e2fcb486d7acb45c6009a856f647071" - dependencies: - babel-core "^6.26.0" - babel-runtime "^6.26.0" - core-js "^2.5.0" - home-or-tmp "^2.0.0" - lodash "^4.17.4" - mkdirp "^0.5.1" - source-map-support "^0.4.15" - -babel-runtime@^6.22.0, babel-runtime@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" - dependencies: - core-js "^2.4.0" - regenerator-runtime "^0.11.0" - -babel-template@^6.16.0, babel-template@^6.24.1, babel-template@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" - dependencies: - babel-runtime "^6.26.0" - babel-traverse "^6.26.0" - babel-types "^6.26.0" - babylon "^6.18.0" - lodash "^4.17.4" - -babel-traverse@^6.18.0, babel-traverse@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" - dependencies: - babel-code-frame "^6.26.0" - babel-messages "^6.23.0" - babel-runtime "^6.26.0" - babel-types "^6.26.0" - babylon "^6.18.0" - debug "^2.6.8" - globals "^9.18.0" - invariant "^2.2.2" - lodash "^4.17.4" - -babel-types@^6.18.0, babel-types@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" - dependencies: - babel-runtime "^6.26.0" - esutils "^2.0.2" - lodash "^4.17.4" - to-fast-properties "^1.0.3" + "@babel/helper-plugin-utils" "^7.27.1" -babylon@7.0.0-beta.34: - version "7.0.0-beta.34" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.34.tgz#2ccdf97bb4fbc1617619a030a6c0390b2c8f16d6" +"@babel/plugin-transform-exponentiation-operator@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.27.1.tgz#fc497b12d8277e559747f5a3ed868dd8064f83e1" + integrity sha512-uspvXnhHvGKf2r4VVtBpeFnuDWsJLQ6MF6lGJLC89jBR1uoVeqM416AZtTuhTezOfgHicpJQmoD5YUakO/YmXQ== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" -babylon@^6.18.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" +"@babel/plugin-transform-export-namespace-from@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.27.1.tgz#71ca69d3471edd6daa711cf4dfc3400415df9c23" + integrity sha512-tQvHWSZ3/jH2xuq/vZDy0jNn+ZdXJeM8gHvX4lnJmsc3+50yPlWdZXIc5ay+umX+2/tJIqHqiEqcJvxlmIvRvQ== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" -bail@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bail/-/bail-1.0.2.tgz#f7d6c1731630a9f9f0d4d35ed1f962e2074a1764" +"@babel/plugin-transform-for-of@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.27.1.tgz#bc24f7080e9ff721b63a70ac7b2564ca15b6c40a" + integrity sha512-BfbWFFEJFQzLCQ5N8VocnCtA8J1CLkNTe2Ms2wocj75dd6VpiqS5Z5quTYcUoo4Yq+DN0rtikODccuv7RU81sw== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" +"@babel/plugin-transform-function-name@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.27.1.tgz#4d0bf307720e4dce6d7c30fcb1fd6ca77bdeb3a7" + integrity sha512-1bQeydJF9Nr1eBCMMbC+hdwmRlsv5XYOMu03YSWFwNs0HsAmtSxxF1fyuYPqemVldVyFmlCU7w8UE14LupUSZQ== + dependencies: + "@babel/helper-compilation-targets" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/traverse" "^7.27.1" -base@^0.11.1: - version "0.11.2" - resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" +"@babel/plugin-transform-json-strings@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.27.1.tgz#a2e0ce6ef256376bd527f290da023983527a4f4c" + integrity sha512-6WVLVJiTjqcQauBhn1LkICsR2H+zm62I3h9faTDKt1qP4jn2o72tSvqMwtGFKGTpojce0gJs+76eZ2uCHRZh0Q== dependencies: - cache-base "^1.0.1" - class-utils "^0.3.5" - component-emitter "^1.2.1" - define-property "^1.0.0" - isobject "^3.0.1" - mixin-deep "^1.2.0" - pascalcase "^0.1.1" + "@babel/helper-plugin-utils" "^7.27.1" -bcrypt-pbkdf@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" +"@babel/plugin-transform-literals@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.27.1.tgz#baaefa4d10a1d4206f9dcdda50d7d5827bb70b24" + integrity sha512-0HCFSepIpLTkLcsi86GG3mTUzxV5jpmbv97hTETW3yzrAij8aqlD36toB1D0daVFJM8NK6GvKO0gslVQmm+zZA== dependencies: - tweetnacl "^0.14.3" + "@babel/helper-plugin-utils" "^7.27.1" -block-stream@*: - version "0.0.9" - resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" +"@babel/plugin-transform-logical-assignment-operators@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.27.1.tgz#890cb20e0270e0e5bebe3f025b434841c32d5baa" + integrity sha512-SJvDs5dXxiae4FbSL1aBJlG4wvl594N6YEVVn9e3JGulwioy6z3oPjx/sQBO3Y4NwUu5HNix6KJ3wBZoewcdbw== dependencies: - inherits "~2.0.0" + "@babel/helper-plugin-utils" "^7.27.1" -boom@2.x.x: - version "2.10.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" +"@babel/plugin-transform-member-expression-literals@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.27.1.tgz#37b88ba594d852418e99536f5612f795f23aeaf9" + integrity sha512-hqoBX4dcZ1I33jCSWcXrP+1Ku7kdqXf1oeah7ooKOIiAdKQ+uqftgCFNOSzA5AMS2XIHEYeGFg4cKRCdpxzVOQ== dependencies: - hoek "2.x.x" + "@babel/helper-plugin-utils" "^7.27.1" -boom@4.x.x: - version "4.3.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31" +"@babel/plugin-transform-modules-amd@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.27.1.tgz#a4145f9d87c2291fe2d05f994b65dba4e3e7196f" + integrity sha512-iCsytMg/N9/oFq6n+gFTvUYDZQOMK5kEdeYxmxt91fcJGycfxVP9CnrxoliM0oumFERba2i8ZtwRUCMhvP1LnA== dependencies: - hoek "4.x.x" + "@babel/helper-module-transforms" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -boom@5.x.x: - version "5.2.0" - resolved "https://registry.yarnpkg.com/boom/-/boom-5.2.0.tgz#5dd9da6ee3a5f302077436290cb717d3f4a54e02" +"@babel/plugin-transform-modules-commonjs@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.27.1.tgz#8e44ed37c2787ecc23bdc367f49977476614e832" + integrity sha512-OJguuwlTYlN0gBZFRPqwOGNWssZjfIUdS7HMYtN8c1KmwpwHFBwTeFZrg9XZa+DFTitWOW5iTAG7tyCUPsCCyw== dependencies: - hoek "4.x.x" + "@babel/helper-module-transforms" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" +"@babel/plugin-transform-modules-systemjs@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.27.1.tgz#00e05b61863070d0f3292a00126c16c0e024c4ed" + integrity sha512-w5N1XzsRbc0PQStASMksmUeqECuzKuTJer7kFagK8AXgpCMkeDMO5S+aaFb7A51ZYDF7XI34qsTX+fkHiIm5yA== dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" + "@babel/helper-module-transforms" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-validator-identifier" "^7.27.1" + "@babel/traverse" "^7.27.1" -braces@^1.8.2: - version "1.8.5" - resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" +"@babel/plugin-transform-modules-umd@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.27.1.tgz#63f2cf4f6dc15debc12f694e44714863d34cd334" + integrity sha512-iQBE/xC5BV1OxJbp6WG7jq9IWiD+xxlZhLrdwpPkTX3ydmXdvoCpyfJN7acaIBZaOqTfr76pgzqBJflNbeRK+w== dependencies: - expand-range "^1.8.1" - preserve "^0.2.0" - repeat-element "^1.1.2" + "@babel/helper-module-transforms" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -braces@^2.3.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.1.tgz#7086c913b4e5a08dbe37ac0ee6a2500c4ba691bb" - dependencies: - arr-flatten "^1.1.0" - array-unique "^0.3.2" - define-property "^1.0.0" - extend-shallow "^2.0.1" - fill-range "^4.0.0" - isobject "^3.0.1" - kind-of "^6.0.2" - repeat-element "^1.1.2" - snapdragon "^0.8.1" - snapdragon-node "^2.0.1" - split-string "^3.0.2" - to-regex "^3.0.1" - -browser-resolve@^1.11.2: - version "1.11.2" - resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce" - dependencies: - resolve "1.1.7" - -bser@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/bser/-/bser-2.0.0.tgz#9ac78d3ed5d915804fd87acb158bc797147a1719" +"@babel/plugin-transform-named-capturing-groups-regex@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.27.1.tgz#f32b8f7818d8fc0cc46ee20a8ef75f071af976e1" + integrity sha512-SstR5JYy8ddZvD6MhV0tM/j16Qds4mIpJTOd1Yu9J9pJjH93bxHECF7pgtc28XvkzTD6Pxcm/0Z73Hvk7kb3Ng== dependencies: - node-int64 "^0.4.0" + "@babel/helper-create-regexp-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -buffer-from@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.0.0.tgz#4cb8832d23612589b0406e9e2956c17f06fdf531" +"@babel/plugin-transform-new-target@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.27.1.tgz#259c43939728cad1706ac17351b7e6a7bea1abeb" + integrity sha512-f6PiYeqXQ05lYq3TIfIDu/MtliKUbNwkGApPUvyo6+tc7uaR4cPjPe7DFPr15Uyycg2lZU6btZ575CuQoYh7MQ== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" -builtin-modules@^1.0.0, builtin-modules@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" +"@babel/plugin-transform-nullish-coalescing-operator@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.27.1.tgz#4f9d3153bf6782d73dd42785a9d22d03197bc91d" + integrity sha512-aGZh6xMo6q9vq1JGcw58lZ1Z0+i0xB2x0XaauNIUXd6O1xXc3RwoWEBlsTQrY4KQ9Jf0s5rgD6SiNkaUdJegTA== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" -cache-base@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" - dependencies: - collection-visit "^1.0.0" - component-emitter "^1.2.1" - get-value "^2.0.6" - has-value "^1.0.0" - isobject "^3.0.1" - set-value "^2.0.0" - to-object-path "^0.3.0" - union-value "^1.0.0" - unset-value "^1.0.0" - -caller-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" +"@babel/plugin-transform-numeric-separator@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.27.1.tgz#614e0b15cc800e5997dadd9bd6ea524ed6c819c6" + integrity sha512-fdPKAcujuvEChxDBJ5c+0BTaS6revLV7CJL08e4m3de8qJfNIuCc2nc7XJYOjBoTMJeqSmwXJ0ypE14RCjLwaw== dependencies: - callsites "^0.2.0" + "@babel/helper-plugin-utils" "^7.27.1" -callsites@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" +"@babel/plugin-transform-object-rest-spread@^7.27.2": + version "7.27.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.27.3.tgz#ce130aa73fef828bc3e3e835f9bc6144be3eb1c0" + integrity sha512-7ZZtznF9g4l2JCImCo5LNKFHB5eXnN39lLtLY5Tg+VkR0jwOt7TBciMckuiQIOIW7L5tkQOCh3bVGYeXgMx52Q== + dependencies: + "@babel/helper-compilation-targets" "^7.27.2" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/plugin-transform-destructuring" "^7.27.3" + "@babel/plugin-transform-parameters" "^7.27.1" -callsites@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" +"@babel/plugin-transform-object-super@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.27.1.tgz#1c932cd27bf3874c43a5cac4f43ebf970c9871b5" + integrity sha512-SFy8S9plRPbIcxlJ8A6mT/CxFdJx/c04JEctz4jf8YZaVS2px34j7NXRrlGlHkN/M2gnpL37ZpGRGVFLd3l8Ng== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-replace-supers" "^7.27.1" -camelcase@4.1.0, camelcase@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" +"@babel/plugin-transform-optional-catch-binding@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.27.1.tgz#84c7341ebde35ccd36b137e9e45866825072a30c" + integrity sha512-txEAEKzYrHEX4xSZN4kJ+OfKXFVSWKB2ZxM9dpcE3wT7smwkNmXo5ORRlVzMVdJbD+Q8ILTgSD7959uj+3Dm3Q== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" -camelcase@^1.0.2: - version "1.2.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" +"@babel/plugin-transform-optional-chaining@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.27.1.tgz#874ce3c4f06b7780592e946026eb76a32830454f" + integrity sha512-BQmKPPIuc8EkZgNKsv0X4bPmOoayeu4F1YCwx2/CfmDSXDbp7GnzlUH+/ul5VGfRg1AoFPsrIThlEBj2xb4CAg== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" +"@babel/plugin-transform-parameters@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.27.1.tgz#80334b54b9b1ac5244155a0c8304a187a618d5a7" + integrity sha512-018KRk76HWKeZ5l4oTj2zPpSh+NbGdt0st5S6x0pga6HgrjBOJb24mMDHorFopOOd6YHkLgOZ+zaCjZGPO4aKg== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" -center-align@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" +"@babel/plugin-transform-private-methods@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.27.1.tgz#fdacbab1c5ed81ec70dfdbb8b213d65da148b6af" + integrity sha512-10FVt+X55AjRAYI9BrdISN9/AQWHqldOeZDUoLyif1Kn05a56xVBXb8ZouL8pZ9jem8QpXaOt8TS7RHUIS+GPA== dependencies: - align-text "^0.1.3" - lazy-cache "^1.0.3" + "@babel/helper-create-class-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -chalk@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.1.0.tgz#ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e" +"@babel/plugin-transform-private-property-in-object@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.27.1.tgz#4dbbef283b5b2f01a21e81e299f76e35f900fb11" + integrity sha512-5J+IhqTi1XPa0DXF83jYOaARrX+41gOewWbkPyjMNRDqgOCqdffGh8L3f/Ek5utaEBZExjSAzcyjmV9SSAWObQ== dependencies: - ansi-styles "^3.1.0" - escape-string-regexp "^1.0.5" - supports-color "^4.0.0" + "@babel/helper-annotate-as-pure" "^7.27.1" + "@babel/helper-create-class-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" -chalk@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" +"@babel/plugin-transform-property-literals@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.27.1.tgz#07eafd618800591e88073a0af1b940d9a42c6424" + integrity sha512-oThy3BCuCha8kDZ8ZkgOg2exvPYUlprMukKQXI1r1pJ47NCvxfkEy8vK+r/hT9nF0Aa4H1WUPZZjHTFtAhGfmQ== dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" + "@babel/helper-plugin-utils" "^7.27.1" -chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.2.tgz#250dc96b07491bfd601e648d66ddf5f60c7a5c65" +"@babel/plugin-transform-regenerator@^7.27.1": + version "7.27.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.27.5.tgz#0c01f4e0e4cced15f68ee14b9c76dac9813850c7" + integrity sha512-uhB8yHerfe3MWnuLAhEbeQ4afVoqv8BQsPqrTv7e/jZ9y00kJL6l9a/f4OWaKxotmjzewfEyXE1vgDJenkQ2/Q== dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" + "@babel/helper-plugin-utils" "^7.27.1" -character-entities-legacy@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/character-entities-legacy/-/character-entities-legacy-1.1.1.tgz#f40779df1a101872bb510a3d295e1fccf147202f" +"@babel/plugin-transform-regexp-modifiers@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.27.1.tgz#df9ba5577c974e3f1449888b70b76169998a6d09" + integrity sha512-TtEciroaiODtXvLZv4rmfMhkCv8jx3wgKpL68PuiPh2M4fvz5jhsA7697N1gMvkvr/JTF13DrFYyEbY9U7cVPA== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + +"@babel/plugin-transform-reserved-words@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.27.1.tgz#40fba4878ccbd1c56605a4479a3a891ac0274bb4" + integrity sha512-V2ABPHIJX4kC7HegLkYoDpfg9PVmuWy/i6vUM5eGK22bx4YVFD3M5F0QQnWQoDs6AGsUWTVOopBiMFQgHaSkVw== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + +"@babel/plugin-transform-shorthand-properties@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.27.1.tgz#532abdacdec87bfee1e0ef8e2fcdee543fe32b90" + integrity sha512-N/wH1vcn4oYawbJ13Y/FxcQrWk63jhfNa7jef0ih7PHSIHX2LB7GWE1rkPrOnka9kwMxb6hMl19p7lidA+EHmQ== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + +"@babel/plugin-transform-spread@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.27.1.tgz#1a264d5fc12750918f50e3fe3e24e437178abb08" + integrity sha512-kpb3HUqaILBJcRFVhFUs6Trdd4mkrzcGXss+6/mxUd273PfbWqSDHRzMT2234gIg2QYfAjvXLSquP1xECSg09Q== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-skip-transparent-expression-wrappers" "^7.27.1" + +"@babel/plugin-transform-sticky-regex@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.27.1.tgz#18984935d9d2296843a491d78a014939f7dcd280" + integrity sha512-lhInBO5bi/Kowe2/aLdBAawijx+q1pQzicSgnkB6dUPc1+RC8QmJHKf2OjvU+NZWitguJHEaEmbV6VWEouT58g== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + +"@babel/plugin-transform-template-literals@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.27.1.tgz#1a0eb35d8bb3e6efc06c9fd40eb0bcef548328b8" + integrity sha512-fBJKiV7F2DxZUkg5EtHKXQdbsbURW3DZKQUWphDum0uRP6eHGGa/He9mc0mypL680pb+e/lDIthRohlv8NCHkg== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + +"@babel/plugin-transform-typeof-symbol@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.27.1.tgz#70e966bb492e03509cf37eafa6dcc3051f844369" + integrity sha512-RiSILC+nRJM7FY5srIyc4/fGIwUhyDuuBSdWn4y6yT6gm652DpCHZjIipgn6B7MQ1ITOUnAKWixEUjQRIBIcLw== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + +"@babel/plugin-transform-unicode-escapes@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.27.1.tgz#3e3143f8438aef842de28816ece58780190cf806" + integrity sha512-Ysg4v6AmF26k9vpfFuTZg8HRfVWzsh1kVfowA23y9j/Gu6dOuahdUVhkLqpObp3JIv27MLSii6noRnuKN8H0Mg== + dependencies: + "@babel/helper-plugin-utils" "^7.27.1" + +"@babel/plugin-transform-unicode-property-regex@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.27.1.tgz#bdfe2d3170c78c5691a3c3be934c8c0087525956" + integrity sha512-uW20S39PnaTImxp39O5qFlHLS9LJEmANjMG7SxIhap8rCHqu0Ik+tLEPX5DKmHn6CsWQ7j3lix2tFOa5YtL12Q== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + +"@babel/plugin-transform-unicode-regex@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.27.1.tgz#25948f5c395db15f609028e370667ed8bae9af97" + integrity sha512-xvINq24TRojDuyt6JGtHmkVkrfVV3FPT16uytxImLeBZqW3/H52yN+kM1MGuyPkIQxrzKwPHs5U/MP3qKyzkGw== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + +"@babel/plugin-transform-unicode-sets-regex@^7.27.1": + version "7.27.1" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.27.1.tgz#6ab706d10f801b5c72da8bb2548561fa04193cd1" + integrity sha512-EtkOujbc4cgvb0mlpQefi4NTPBzhSIevblFevACNLUspmrALgmEBdL/XfnyyITfd8fKBZrZys92zOWcik7j9Tw== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.27.1" + "@babel/helper-plugin-utils" "^7.27.1" + +"@babel/preset-env@^7.27.2": + version "7.27.2" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.27.2.tgz#106e6bfad92b591b1f6f76fd4cf13b7725a7bf9a" + integrity sha512-Ma4zSuYSlGNRlCLO+EAzLnCmJK2vdstgv+n7aUP+/IKZrOfWHOJVdSJtuub8RzHTj3ahD37k5OKJWvzf16TQyQ== + dependencies: + "@babel/compat-data" "^7.27.2" + "@babel/helper-compilation-targets" "^7.27.2" + "@babel/helper-plugin-utils" "^7.27.1" + "@babel/helper-validator-option" "^7.27.1" + "@babel/plugin-bugfix-firefox-class-in-computed-class-key" "^7.27.1" + "@babel/plugin-bugfix-safari-class-field-initializer-scope" "^7.27.1" + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.27.1" + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.27.1" + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly" "^7.27.1" + "@babel/plugin-proposal-private-property-in-object" "7.21.0-placeholder-for-preset-env.2" + "@babel/plugin-syntax-import-assertions" "^7.27.1" + "@babel/plugin-syntax-import-attributes" "^7.27.1" + "@babel/plugin-syntax-unicode-sets-regex" "^7.18.6" + "@babel/plugin-transform-arrow-functions" "^7.27.1" + "@babel/plugin-transform-async-generator-functions" "^7.27.1" + "@babel/plugin-transform-async-to-generator" "^7.27.1" + "@babel/plugin-transform-block-scoped-functions" "^7.27.1" + "@babel/plugin-transform-block-scoping" "^7.27.1" + "@babel/plugin-transform-class-properties" "^7.27.1" + "@babel/plugin-transform-class-static-block" "^7.27.1" + "@babel/plugin-transform-classes" "^7.27.1" + "@babel/plugin-transform-computed-properties" "^7.27.1" + "@babel/plugin-transform-destructuring" "^7.27.1" + "@babel/plugin-transform-dotall-regex" "^7.27.1" + "@babel/plugin-transform-duplicate-keys" "^7.27.1" + "@babel/plugin-transform-duplicate-named-capturing-groups-regex" "^7.27.1" + "@babel/plugin-transform-dynamic-import" "^7.27.1" + "@babel/plugin-transform-exponentiation-operator" "^7.27.1" + "@babel/plugin-transform-export-namespace-from" "^7.27.1" + "@babel/plugin-transform-for-of" "^7.27.1" + "@babel/plugin-transform-function-name" "^7.27.1" + "@babel/plugin-transform-json-strings" "^7.27.1" + "@babel/plugin-transform-literals" "^7.27.1" + "@babel/plugin-transform-logical-assignment-operators" "^7.27.1" + "@babel/plugin-transform-member-expression-literals" "^7.27.1" + "@babel/plugin-transform-modules-amd" "^7.27.1" + "@babel/plugin-transform-modules-commonjs" "^7.27.1" + "@babel/plugin-transform-modules-systemjs" "^7.27.1" + "@babel/plugin-transform-modules-umd" "^7.27.1" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.27.1" + "@babel/plugin-transform-new-target" "^7.27.1" + "@babel/plugin-transform-nullish-coalescing-operator" "^7.27.1" + "@babel/plugin-transform-numeric-separator" "^7.27.1" + "@babel/plugin-transform-object-rest-spread" "^7.27.2" + "@babel/plugin-transform-object-super" "^7.27.1" + "@babel/plugin-transform-optional-catch-binding" "^7.27.1" + "@babel/plugin-transform-optional-chaining" "^7.27.1" + "@babel/plugin-transform-parameters" "^7.27.1" + "@babel/plugin-transform-private-methods" "^7.27.1" + "@babel/plugin-transform-private-property-in-object" "^7.27.1" + "@babel/plugin-transform-property-literals" "^7.27.1" + "@babel/plugin-transform-regenerator" "^7.27.1" + "@babel/plugin-transform-regexp-modifiers" "^7.27.1" + "@babel/plugin-transform-reserved-words" "^7.27.1" + "@babel/plugin-transform-shorthand-properties" "^7.27.1" + "@babel/plugin-transform-spread" "^7.27.1" + "@babel/plugin-transform-sticky-regex" "^7.27.1" + "@babel/plugin-transform-template-literals" "^7.27.1" + "@babel/plugin-transform-typeof-symbol" "^7.27.1" + "@babel/plugin-transform-unicode-escapes" "^7.27.1" + "@babel/plugin-transform-unicode-property-regex" "^7.27.1" + "@babel/plugin-transform-unicode-regex" "^7.27.1" + "@babel/plugin-transform-unicode-sets-regex" "^7.27.1" + "@babel/preset-modules" "0.1.6-no-external-plugins" + babel-plugin-polyfill-corejs2 "^0.4.10" + babel-plugin-polyfill-corejs3 "^0.11.0" + babel-plugin-polyfill-regenerator "^0.6.1" + core-js-compat "^3.40.0" + semver "^6.3.1" + +"@babel/preset-modules@0.1.6-no-external-plugins": + version "0.1.6-no-external-plugins" + resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz#ccb88a2c49c817236861fee7826080573b8a923a" + integrity sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/types" "^7.4.4" + esutils "^2.0.2" -character-entities@^1.0.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/character-entities/-/character-entities-1.2.1.tgz#f76871be5ef66ddb7f8f8e3478ecc374c27d6dca" +"@babel/regjsgen@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310" + integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== + +"@babel/template@^7.16.7": + version "7.18.10" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.18.10.tgz#6f9134835970d1dbf0835c0d100c9f38de0c5e71" + integrity sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA== + dependencies: + "@babel/code-frame" "^7.18.6" + "@babel/parser" "^7.18.10" + "@babel/types" "^7.18.10" + +"@babel/template@^7.18.10": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.5.tgz#0c8c4d944509875849bd0344ff0050756eefc6ec" + integrity sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw== + dependencies: + "@babel/code-frame" "^7.22.5" + "@babel/parser" "^7.22.5" + "@babel/types" "^7.22.5" + +"@babel/template@^7.27.1", "@babel/template@^7.27.2": + version "7.27.2" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.27.2.tgz#fa78ceed3c4e7b63ebf6cb39e5852fca45f6809d" + integrity sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw== + dependencies: + "@babel/code-frame" "^7.27.1" + "@babel/parser" "^7.27.2" + "@babel/types" "^7.27.1" + +"@babel/traverse@^7.16.7", "@babel/traverse@^7.17.0": + version "7.17.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.17.0.tgz#3143e5066796408ccc880a33ecd3184f3e75cd30" + integrity sha512-fpFIXvqD6kC7c7PUNnZ0Z8cQXlarCLtCUpt2S1Dx7PjoRtCFffvOkHHSom+m5HIxMZn5bIBVb71lhabcmjEsqg== + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.17.0" + "@babel/helper-environment-visitor" "^7.16.7" + "@babel/helper-function-name" "^7.16.7" + "@babel/helper-hoist-variables" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/parser" "^7.17.0" + "@babel/types" "^7.17.0" + debug "^4.1.0" + globals "^11.1.0" + +"@babel/traverse@^7.27.1", "@babel/traverse@^7.27.3", "@babel/traverse@^7.27.4": + version "7.27.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.27.4.tgz#b0045ac7023c8472c3d35effd7cc9ebd638da6ea" + integrity sha512-oNcu2QbHqts9BtOWJosOVJapWjBDSxGCpFvikNR5TGDYDQf3JwpIoMzIKrvfoti93cLfPJEG4tH9SPVeyCGgdA== + dependencies: + "@babel/code-frame" "^7.27.1" + "@babel/generator" "^7.27.3" + "@babel/parser" "^7.27.4" + "@babel/template" "^7.27.2" + "@babel/types" "^7.27.3" + debug "^4.3.1" + globals "^11.1.0" + +"@babel/types@^7.0.0", "@babel/types@^7.16.7", "@babel/types@^7.17.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.19.0", "@babel/types@^7.3.0": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.15.tgz#266cb21d2c5fd0b3931e7a91b6dd72d2f617d282" + integrity sha512-X+NLXr0N8XXmN5ZsaQdm9U2SSC3UbIYq/doL++sueHOTisgZHoKaQtZxGuV2cUPQHMfjKEfg/g6oy7Hm6SKFtA== + dependencies: + "@babel/helper-string-parser" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.15" + to-fast-properties "^2.0.0" + +"@babel/types@^7.20.7", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.27.6": + version "7.27.6" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.6.tgz#a434ca7add514d4e646c80f7375c0aa2befc5535" + integrity sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q== + dependencies: + "@babel/helper-string-parser" "^7.27.1" + "@babel/helper-validator-identifier" "^7.27.1" + +"@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.4.4": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.9.tgz#1dd7b59a9a2b5c87f8b41e52770b5ecbf492e002" + integrity sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q== + dependencies: + "@babel/helper-string-parser" "^7.23.4" + "@babel/helper-validator-identifier" "^7.22.20" + to-fast-properties "^2.0.0" + +"@bcoe/v8-coverage@^0.2.3": + version "0.2.3" + resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" + integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -character-reference-invalid@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-1.1.1.tgz#942835f750e4ec61a308e60c2ef8cc1011202efc" +"@bcoe/v8-coverage@^1.0.1": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz#bbe12dca5b4ef983a0d0af4b07b9bc90ea0ababa" + integrity sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA== -chardet@^0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" +"@csstools/color-helpers@^5.0.2": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@csstools/color-helpers/-/color-helpers-5.0.2.tgz#82592c9a7c2b83c293d9161894e2a6471feb97b8" + integrity sha512-JqWH1vsgdGcw2RR6VliXXdA0/59LttzlU8UlRT/iUUsEeWfYq8I+K0yhihEUTTHLRm1EXvpsCx3083EU15ecsA== -ci-info@^1.0.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.1.3.tgz#710193264bb05c77b8c90d02f5aaf22216a667b2" +"@csstools/css-calc@^2.1.3", "@csstools/css-calc@^2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@csstools/css-calc/-/css-calc-2.1.4.tgz#8473f63e2fcd6e459838dd412401d5948f224c65" + integrity sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ== -circular-json@^0.3.1: - version "0.3.3" - resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" +"@csstools/css-color-parser@^3.0.9": + version "3.0.10" + resolved "https://registry.yarnpkg.com/@csstools/css-color-parser/-/css-color-parser-3.0.10.tgz#79fc68864dd43c3b6782d2b3828bc0fa9d085c10" + integrity sha512-TiJ5Ajr6WRd1r8HSiwJvZBiJOqtH86aHpUjq5aEKWHiII2Qfjqd/HCWKPOW8EP4vcspXbHnXrwIDlu5savQipg== + dependencies: + "@csstools/color-helpers" "^5.0.2" + "@csstools/css-calc" "^2.1.4" -cjk-regex@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/cjk-regex/-/cjk-regex-1.0.2.tgz#86f5170ecfaef9049ec91f8068e15d63d8e10154" +"@csstools/css-parser-algorithms@^3.0.4": + version "3.0.5" + resolved "https://registry.yarnpkg.com/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.5.tgz#5755370a9a29abaec5515b43c8b3f2cf9c2e3076" + integrity sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ== -class-utils@^0.3.5: - version "0.3.6" - resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" - dependencies: - arr-union "^3.1.0" - define-property "^0.2.5" - isobject "^3.0.0" - static-extend "^0.1.1" +"@csstools/css-tokenizer@^3.0.3": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@csstools/css-tokenizer/-/css-tokenizer-3.0.4.tgz#333fedabc3fd1a8e5d0100013731cf19e6a8c5d3" + integrity sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw== -cli-cursor@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" +"@emnapi/core@^1.4.3": + version "1.4.3" + resolved "https://registry.yarnpkg.com/@emnapi/core/-/core-1.4.3.tgz#9ac52d2d5aea958f67e52c40a065f51de59b77d6" + integrity sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g== dependencies: - restore-cursor "^2.0.0" + "@emnapi/wasi-threads" "1.0.2" + tslib "^2.4.0" -cli-width@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" +"@emnapi/runtime@^1.4.3": + version "1.4.3" + resolved "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.4.3.tgz#c0564665c80dc81c448adac23f9dfbed6c838f7d" + integrity sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ== + dependencies: + tslib "^2.4.0" -cliui@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" +"@emnapi/wasi-threads@1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@emnapi/wasi-threads/-/wasi-threads-1.0.2.tgz#977f44f844eac7d6c138a415a123818c655f874c" + integrity sha512-5n3nTJblwRi8LlXkJ9eBzu+kZR8Yxcc7ubakyQTFzPMtIhFpUBRbsnc2Dv88IZDIbCDlBiWrknhB4Lsz7mg6BA== dependencies: - center-align "^0.1.1" - right-align "^0.1.1" - wordwrap "0.0.2" + tslib "^2.4.0" -cliui@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" +"@eslint-community/eslint-utils@^4.2.0": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.2.0.tgz#a831e6e468b4b2b5ae42bf658bea015bf10bc518" + integrity sha512-gB8T4H4DEfX2IV9zGDJPOBgP1e/DbfCPDTtEqUMckpvzS1OYtva8JdFYBqMwYk7xAQ429WGF/UPqn8uQ//h2vQ== dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" - wrap-ansi "^2.0.0" + eslint-visitor-keys "^3.3.0" -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" +"@eslint-community/regexpp@^4.6.1": + version "4.6.2" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.6.2.tgz#1816b5f6948029c5eaacb0703b850ee0cb37d8f8" + integrity sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw== + +"@eslint/eslintrc@^2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad" + integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.6.0" + globals "^13.19.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@eslint/js@8.57.0": + version "8.57.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.0.tgz#a5417ae8427873f1dd08b70b3574b453e67b5f7f" + integrity sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g== + +"@humanwhocodes/config-array@^0.11.14": + version "0.11.14" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b" + integrity sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg== + dependencies: + "@humanwhocodes/object-schema" "^2.0.2" + debug "^4.3.1" + minimatch "^3.0.5" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== -code-point-at@^1.0.0: +"@humanwhocodes/object-schema@^2.0.2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz#d9fae00a2d5cb40f92cfe64b47ad749fbc38f917" + integrity sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw== + +"@isaacs/cliui@^8.0.2": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" + integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== + dependencies: + string-width "^5.1.2" + string-width-cjs "npm:string-width@^4.2.0" + strip-ansi "^7.0.1" + strip-ansi-cjs "npm:strip-ansi@^6.0.1" + wrap-ansi "^8.1.0" + wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" + +"@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" + integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== + dependencies: + camelcase "^5.3.1" + find-up "^4.1.0" + get-package-type "^0.1.0" + js-yaml "^3.13.1" + resolve-from "^5.0.0" -collapse-white-space@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/collapse-white-space/-/collapse-white-space-1.0.3.tgz#4b906f670e5a963a87b76b0e1689643341b6023c" +"@istanbuljs/schema@^0.1.2", "@istanbuljs/schema@^0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" + integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -collection-visit@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" +"@jest/console@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-30.0.2.tgz#e2bf6c7703d45f9824d77c7332388c3e1685afd7" + integrity sha512-krGElPU0FipAqpVZ/BRZOy0MZh/ARdJ0Nj+PiH1ykFY1+VpBlYNLjdjVA5CFKxnKR6PFqFutO4Z7cdK9BlGiDA== dependencies: - map-visit "^1.0.0" - object-visit "^1.0.0" + "@jest/types" "30.0.1" + "@types/node" "*" + chalk "^4.1.2" + jest-message-util "30.0.2" + jest-util "30.0.2" + slash "^3.0.0" + +"@jest/core@30.0.3": + version "30.0.3" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-30.0.3.tgz#87967dd3ea6bd6bc98e99aa4b47bfbb0b7f2a77e" + integrity sha512-Mgs1N+NSHD3Fusl7bOq1jyxv1JDAUwjy+0DhVR93Q6xcBP9/bAQ+oZhXb5TTnP5sQzAHgb7ROCKQ2SnovtxYtg== + dependencies: + "@jest/console" "30.0.2" + "@jest/pattern" "30.0.1" + "@jest/reporters" "30.0.2" + "@jest/test-result" "30.0.2" + "@jest/transform" "30.0.2" + "@jest/types" "30.0.1" + "@types/node" "*" + ansi-escapes "^4.3.2" + chalk "^4.1.2" + ci-info "^4.2.0" + exit-x "^0.2.2" + graceful-fs "^4.2.11" + jest-changed-files "30.0.2" + jest-config "30.0.3" + jest-haste-map "30.0.2" + jest-message-util "30.0.2" + jest-regex-util "30.0.1" + jest-resolve "30.0.2" + jest-resolve-dependencies "30.0.3" + jest-runner "30.0.3" + jest-runtime "30.0.3" + jest-snapshot "30.0.3" + jest-util "30.0.2" + jest-validate "30.0.2" + jest-watcher "30.0.2" + micromatch "^4.0.8" + pretty-format "30.0.2" + slash "^3.0.0" + +"@jest/diff-sequences@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/diff-sequences/-/diff-sequences-30.0.1.tgz#0ededeae4d071f5c8ffe3678d15f3a1be09156be" + integrity sha512-n5H8QLDJ47QqbCNn5SuFjCRDrOLEZ0h8vAHCK5RL9Ls7Xa8AQLa/YxAc9UjFqoEDM48muwtBGjtMY5cr0PLDCw== + +"@jest/environment-jsdom-abstract@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/environment-jsdom-abstract/-/environment-jsdom-abstract-30.0.2.tgz#3538bcc206704a4a37ee18afcb5b88ce55f02dc4" + integrity sha512-8aMoEzGdUuJeQl71BUACkys1ZEX437AF376VBqdYXsGFd4l3F1SdTjFHmNq8vF0Rp+CYhUyxa0kRAzXbBaVzfQ== + dependencies: + "@jest/environment" "30.0.2" + "@jest/fake-timers" "30.0.2" + "@jest/types" "30.0.1" + "@types/jsdom" "^21.1.7" + "@types/node" "*" + jest-mock "30.0.2" + jest-util "30.0.2" -color-convert@^1.9.0: - version "1.9.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" +"@jest/environment@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-30.0.2.tgz#1b0d055070e97f697e9edb25059e9435221cbe65" + integrity sha512-hRLhZRJNxBiOhxIKSq2UkrlhMt3/zVFQOAi5lvS8T9I03+kxsbflwHJEF+eXEYXCrRGRhHwECT7CDk6DyngsRA== dependencies: - color-name "^1.1.1" - -color-name@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + "@jest/fake-timers" "30.0.2" + "@jest/types" "30.0.1" + "@types/node" "*" + jest-mock "30.0.2" -combined-stream@1.0.6, combined-stream@^1.0.5, combined-stream@~1.0.5: - version "1.0.6" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818" +"@jest/expect-utils@30.0.3": + version "30.0.3" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-30.0.3.tgz#2a9fb40110c8a13ae464da41f877df90d2e6bc3b" + integrity sha512-SMtBvf2sfX2agcT0dA9pXwcUrKvOSDqBY4e4iRfT+Hya33XzV35YVg+98YQFErVGA/VR1Gto5Y2+A6G9LSQ3Yg== dependencies: - delayed-stream "~1.0.0" + "@jest/get-type" "30.0.1" -commander@*, commander@^2.11.0: - version "2.15.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f" +"@jest/expect@30.0.3", "@jest/expect@^30.0.0": + version "30.0.3" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-30.0.3.tgz#9653e868ca27dd2194f6c20c81b8a690f9669465" + integrity sha512-73BVLqfCeWjYWPEQoYjiRZ4xuQRhQZU0WdgvbyXGRHItKQqg5e6mt2y1kVhzLSuZpmUnccZHbGynoaL7IcLU3A== + dependencies: + expect "30.0.3" + jest-snapshot "30.0.3" -compare-versions@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-3.1.0.tgz#43310256a5c555aaed4193c04d8f154cf9c6efd5" +"@jest/fake-timers@30.0.2", "@jest/fake-timers@^30.0.0": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-30.0.2.tgz#ec758b28ae6f63a49eda9e8d6af274d152d37c09" + integrity sha512-jfx0Xg7l0gmphTY9UKm5RtH12BlLYj/2Plj6wXjVW5Era4FZKfXeIvwC67WX+4q8UCFxYS20IgnMcFBcEU0DtA== + dependencies: + "@jest/types" "30.0.1" + "@sinonjs/fake-timers" "^13.0.0" + "@types/node" "*" + jest-message-util "30.0.2" + jest-mock "30.0.2" + jest-util "30.0.2" + +"@jest/get-type@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/get-type/-/get-type-30.0.1.tgz#0d32f1bbfba511948ad247ab01b9007724fc9f52" + integrity sha512-AyYdemXCptSRFirI5EPazNxyPwAL0jXt3zceFjaj8NFiKP9pOi0bfXonf6qkf82z2t3QWPeLCWWw4stPBzctLw== + +"@jest/globals@30.0.3": + version "30.0.3" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-30.0.3.tgz#9c9ef55e6f5e6b7e946244bdbf2af85044b7bb04" + integrity sha512-fIduqNyYpMeeSr5iEAiMn15KxCzvrmxl7X7VwLDRGj7t5CoHtbF+7K3EvKk32mOUIJ4kIvFRlaixClMH2h/Vaw== + dependencies: + "@jest/environment" "30.0.2" + "@jest/expect" "30.0.3" + "@jest/types" "30.0.1" + jest-mock "30.0.2" + +"@jest/pattern@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/pattern/-/pattern-30.0.1.tgz#d5304147f49a052900b4b853dedb111d080e199f" + integrity sha512-gWp7NfQW27LaBQz3TITS8L7ZCQ0TLvtmI//4OwlQRx4rnWxcPNIYjxZpDcN4+UlGxgm3jS5QPz8IPTCkb59wZA== + dependencies: + "@types/node" "*" + jest-regex-util "30.0.1" + +"@jest/reporters@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-30.0.2.tgz#e804435ab77cd05b7e8732b91006cd00bd822399" + integrity sha512-l4QzS/oKf57F8WtPZK+vvF4Io6ukplc6XgNFu4Hd/QxaLEO9f+8dSFzUua62Oe0HKlCUjKHpltKErAgDiMJKsA== + dependencies: + "@bcoe/v8-coverage" "^0.2.3" + "@jest/console" "30.0.2" + "@jest/test-result" "30.0.2" + "@jest/transform" "30.0.2" + "@jest/types" "30.0.1" + "@jridgewell/trace-mapping" "^0.3.25" + "@types/node" "*" + chalk "^4.1.2" + collect-v8-coverage "^1.0.2" + exit-x "^0.2.2" + glob "^10.3.10" + graceful-fs "^4.2.11" + istanbul-lib-coverage "^3.0.0" + istanbul-lib-instrument "^6.0.0" + istanbul-lib-report "^3.0.0" + istanbul-lib-source-maps "^5.0.0" + istanbul-reports "^3.1.3" + jest-message-util "30.0.2" + jest-util "30.0.2" + jest-worker "30.0.2" + slash "^3.0.0" + string-length "^4.0.2" + v8-to-istanbul "^9.0.1" + +"@jest/schemas@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-30.0.1.tgz#27c00d707d480ece0c19126af97081a1af3bc46e" + integrity sha512-+g/1TKjFuGrf1Hh0QPCv0gISwBxJ+MQSNXmG9zjHy7BmFhtoJ9fdNhWJp3qUKRi93AOZHXtdxZgJ1vAtz6z65w== + dependencies: + "@sinclair/typebox" "^0.34.0" + +"@jest/snapshot-utils@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/snapshot-utils/-/snapshot-utils-30.0.1.tgz#536108aa6b74858d758ae3b5229518c3d818bd68" + integrity sha512-6Dpv7vdtoRiISEFwYF8/c7LIvqXD7xDXtLPNzC2xqAfBznKip0MQM+rkseKwUPUpv2PJ7KW/YsnwWXrIL2xF+A== + dependencies: + "@jest/types" "30.0.1" + chalk "^4.1.2" + graceful-fs "^4.2.11" + natural-compare "^1.4.0" -component-emitter@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" +"@jest/source-map@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-30.0.1.tgz#305ebec50468f13e658b3d5c26f85107a5620aaa" + integrity sha512-MIRWMUUR3sdbP36oyNyhbThLHyJ2eEDClPCiHVbrYAe5g3CHRArIVpBw7cdSB5fr+ofSfIb2Tnsw8iEHL0PYQg== + dependencies: + "@jridgewell/trace-mapping" "^0.3.25" + callsites "^3.1.0" + graceful-fs "^4.2.11" + +"@jest/test-result@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-30.0.2.tgz#786849e33da6060381c508986fa7309ff855a367" + integrity sha512-KKMuBKkkZYP/GfHMhI+cH2/P3+taMZS3qnqqiPC1UXZTJskkCS+YU/ILCtw5anw1+YsTulDHFpDo70mmCedW8w== + dependencies: + "@jest/console" "30.0.2" + "@jest/types" "30.0.1" + "@types/istanbul-lib-coverage" "^2.0.6" + collect-v8-coverage "^1.0.2" + +"@jest/test-sequencer@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-30.0.2.tgz#2693692d285b1c929ed353f7f0b7cbea51c57515" + integrity sha512-fbyU5HPka0rkalZ3MXVvq0hwZY8dx3Y6SCqR64zRmh+xXlDeFl0IdL4l9e7vp4gxEXTYHbwLFA1D+WW5CucaSw== + dependencies: + "@jest/test-result" "30.0.2" + graceful-fs "^4.2.11" + jest-haste-map "30.0.2" + slash "^3.0.0" + +"@jest/transform@30.0.2": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-30.0.2.tgz#62ba84fcc2389ab751e7ec923958c9b1163d90c3" + integrity sha512-kJIuhLMTxRF7sc0gPzPtCDib/V9KwW3I2U25b+lYCYMVqHHSrcZopS8J8H+znx9yixuFv+Iozl8raLt/4MoxrA== + dependencies: + "@babel/core" "^7.27.4" + "@jest/types" "30.0.1" + "@jridgewell/trace-mapping" "^0.3.25" + babel-plugin-istanbul "^7.0.0" + chalk "^4.1.2" + convert-source-map "^2.0.0" + fast-json-stable-stringify "^2.1.0" + graceful-fs "^4.2.11" + jest-haste-map "30.0.2" + jest-regex-util "30.0.1" + jest-util "30.0.2" + micromatch "^4.0.8" + pirates "^4.0.7" + slash "^3.0.0" + write-file-atomic "^5.0.1" + +"@jest/types@30.0.1": + version "30.0.1" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-30.0.1.tgz#a46df6a99a416fa685740ac4264b9f9cd7da1598" + integrity sha512-HGwoYRVF0QSKJu1ZQX0o5ZrUrrhj0aOOFA8hXrumD7SIzjouevhawbTjmXdwOmURdGluU9DM/XvGm3NyFoiQjw== + dependencies: + "@jest/pattern" "30.0.1" + "@jest/schemas" "30.0.1" + "@types/istanbul-lib-coverage" "^2.0.6" + "@types/istanbul-reports" "^3.0.4" + "@types/node" "*" + "@types/yargs" "^17.0.33" + chalk "^4.1.2" -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" +"@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" + integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== + dependencies: + "@jridgewell/set-array" "^1.0.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.9" -concat-stream@^1.6.0: - version "1.6.2" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" +"@jridgewell/gen-mapping@^0.3.5": + version "0.3.8" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz#4f0e06362e01362f823d348f1872b08f666d8142" + integrity sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA== dependencies: - buffer-from "^1.0.0" - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" + "@jridgewell/set-array" "^1.2.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.24" -console-control-strings@^1.0.0, console-control-strings@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" +"@jridgewell/resolve-uri@^3.0.3": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" + integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== -contains-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" + integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== -content-type-parser@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/content-type-parser/-/content-type-parser-1.0.2.tgz#caabe80623e63638b2502fd4c7f12ff4ce2352e7" +"@jridgewell/set-array@^1.0.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" + integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== -convert-source-map@^1.4.0, convert-source-map@^1.5.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" +"@jridgewell/set-array@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" + integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== -copy-descriptor@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" +"@jridgewell/source-map@^0.3.3": + version "0.3.5" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.5.tgz#a3bb4d5c6825aab0d281268f47f6ad5853431e91" + integrity sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ== + dependencies: + "@jridgewell/gen-mapping" "^0.3.0" + "@jridgewell/trace-mapping" "^0.3.9" -core-js@^2.4.0, core-js@^2.5.0: - version "2.5.4" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.4.tgz#f2c8bf181f2a80b92f360121429ce63a2f0aeae0" +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== -core-util-is@1.0.2, core-util-is@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +"@jridgewell/sourcemap-codec@^1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== -cosmiconfig@3.1.0, cosmiconfig@^3.0.1: - version "3.1.0" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-3.1.0.tgz#640a94bf9847f321800403cd273af60665c73397" +"@jridgewell/trace-mapping@^0.3.0": + version "0.3.4" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.4.tgz#f6a0832dffd5b8a6aaa633b7d9f8e8e94c83a0c3" + integrity sha512-vFv9ttIedivx0ux3QSjhgtCVjPZd5l46ZOMDSCwnH1yUO2e964gO8LZGyv2QkqcgR6TnBU1v+1IFqmeoG+0UJQ== dependencies: - is-directory "^0.3.1" - js-yaml "^3.9.0" - parse-json "^3.0.0" - require-from-string "^2.0.1" + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" -cross-spawn@^5.0.1, cross-spawn@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" +"@jridgewell/trace-mapping@^0.3.12": + version "0.3.14" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz#b231a081d8f66796e475ad588a1ef473112701ed" + integrity sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ== dependencies: - lru-cache "^4.0.1" - shebang-command "^1.2.0" - which "^1.2.9" + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" -cryptiles@2.x.x: - version "2.0.5" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" +"@jridgewell/trace-mapping@^0.3.23", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": + version "0.3.25" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" + integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== dependencies: - boom "2.x.x" + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" -cryptiles@3.x.x: - version "3.1.2" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe" +"@jridgewell/trace-mapping@^0.3.9": + version "0.3.19" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz#f8a3249862f91be48d3127c3cfe992f79b4b8811" + integrity sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw== dependencies: - boom "5.x.x" - -cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": - version "0.3.2" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b" + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" -"cssstyle@>= 0.2.37 < 0.3.0": - version "0.2.37" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-0.2.37.tgz#541097234cb2513c83ceed3acddc27ff27987d54" +"@napi-rs/wasm-runtime@^0.2.11": + version "0.2.11" + resolved "https://registry.yarnpkg.com/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.11.tgz#192c1610e1625048089ab4e35bc0649ce478500e" + integrity sha512-9DPkXtvHydrcOsopiYpUgPHpmj0HWZKMUnL2dZqpvC42lsratuBG06V5ipyno0fUek5VlFsNQ+AcFATSrJXgMA== dependencies: - cssom "0.3.x" + "@emnapi/core" "^1.4.3" + "@emnapi/runtime" "^1.4.3" + "@tybys/wasm-util" "^0.9.0" -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== dependencies: - assert-plus "^1.0.0" - -dashify@0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/dashify/-/dashify-0.2.2.tgz#6a07415a01c91faf4a32e38d9dfba71f61cb20fe" + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" -debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - dependencies: - ms "2.0.0" +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== -debug@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" +"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== dependencies: - ms "2.0.0" - -decamelize@^1.0.0, decamelize@^1.1.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" -decode-uri-component@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" - -dedent@0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" +"@pkgjs/parseargs@^0.11.0": + version "0.11.0" + resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" + integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== -deep-extend@~0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" +"@pkgr/core@^0.1.0": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" + integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== -deep-is@~0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" +"@pkgr/core@^0.2.4": + version "0.2.7" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.2.7.tgz#eb5014dfd0b03e7f3ba2eeeff506eed89b028058" + integrity sha512-YLT9Zo3oNPJoBjBc4q8G2mjU4tqIbf5CEOORbUUr48dCD9q3umJ3IPlVqOqDakPfd2HuwccBaqlGhN4Gmr5OWg== -default-require-extensions@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8" +"@rollup/plugin-alias@^5.1.0": + version "5.1.1" + resolved "https://registry.yarnpkg.com/@rollup/plugin-alias/-/plugin-alias-5.1.1.tgz#53601d88cda8b1577aa130b4a6e452283605bf26" + integrity sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ== + +"@rollup/plugin-babel@^6.0.3": + version "6.0.4" + resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-6.0.4.tgz#bd698e351fa9aa9619fcae780aea2a603d98e4c4" + integrity sha512-YF7Y52kFdFT/xVSuVdjkV5ZdX/3YtmX0QulG+x0taQOtJdHYzVU61aSSkAgVJ7NOv6qPkIYiJSgSWWN/DM5sGw== + dependencies: + "@babel/helper-module-imports" "^7.18.6" + "@rollup/pluginutils" "^5.0.1" + +"@rollup/plugin-commonjs@^25.0.7": + version "25.0.8" + resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.8.tgz#c77e608ab112a666b7f2a6bea625c73224f7dd34" + integrity sha512-ZEZWTK5n6Qde0to4vS9Mr5x/0UZoqCxPVR9KRUjU4kA2sO7GEUn1fop0DAwpO6z0Nw/kJON9bDmSxdWxO/TT1A== + dependencies: + "@rollup/pluginutils" "^5.0.1" + commondir "^1.0.1" + estree-walker "^2.0.2" + glob "^8.0.3" + is-reference "1.2.1" + magic-string "^0.30.3" + +"@rollup/plugin-inject@^5.0.5": + version "5.0.5" + resolved "https://registry.yarnpkg.com/@rollup/plugin-inject/-/plugin-inject-5.0.5.tgz#616f3a73fe075765f91c5bec90176608bed277a3" + integrity sha512-2+DEJbNBoPROPkgTDNe8/1YXWcqxbN5DTjASVIOx8HS+pITXushyNiBV56RB08zuptzz8gT3YfkqriTBVycepg== + dependencies: + "@rollup/pluginutils" "^5.0.1" + estree-walker "^2.0.2" + magic-string "^0.30.3" + +"@rollup/plugin-json@^6.1.0": + version "6.1.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-6.1.0.tgz#fbe784e29682e9bb6dee28ea75a1a83702e7b805" + integrity sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA== dependencies: - strip-bom "^2.0.0" + "@rollup/pluginutils" "^5.1.0" -define-property@^0.2.5: - version "0.2.5" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" +"@rollup/plugin-node-resolve@^15.2.1": + version "15.3.1" + resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.3.1.tgz#66008953c2524be786aa319d49e32f2128296a78" + integrity sha512-tgg6b91pAybXHJQMAAwW9VuWBO6Thi+q7BCNARLwSqlmsHz0XYURtGvh/AuwSADXSI4h/2uHbs7s4FzlZDGSGA== dependencies: - is-descriptor "^0.1.0" + "@rollup/pluginutils" "^5.0.1" + "@types/resolve" "1.20.2" + deepmerge "^4.2.2" + is-module "^1.0.0" + resolve "^1.22.1" -define-property@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" +"@rollup/plugin-replace@^5.0.5": + version "5.0.7" + resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-5.0.7.tgz#150c9ee9db8031d9e4580a61a0edeaaed3d37687" + integrity sha512-PqxSfuorkHz/SPpyngLyg5GCEkOcee9M1bkxiVDr41Pd61mqP1PLOoDPbpl44SB2mQGKwV/In74gqQmGITOhEQ== dependencies: - is-descriptor "^1.0.0" + "@rollup/pluginutils" "^5.0.1" + magic-string "^0.30.3" -define-property@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" +"@rollup/plugin-terser@^0.4.3": + version "0.4.4" + resolved "https://registry.yarnpkg.com/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz#15dffdb3f73f121aa4fbb37e7ca6be9aeea91962" + integrity sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A== dependencies: - is-descriptor "^1.0.2" - isobject "^3.0.1" + serialize-javascript "^6.0.1" + smob "^1.0.0" + terser "^5.17.4" -del@^2.0.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" +"@rollup/pluginutils@^5.0.1": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.2.0.tgz#eac25ca5b0bdda4ba735ddaca5fbf26bd435f602" + integrity sha512-qWJ2ZTbmumwiLFomfzTyt5Kng4hwPi9rwCYN4SHb6eaRU1KNO4ccxINHr/VhH4GgPlt1XfSTLX2LBTme8ne4Zw== dependencies: - globby "^5.0.0" - is-path-cwd "^1.0.0" - is-path-in-cwd "^1.0.0" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" - rimraf "^2.2.8" + "@types/estree" "^1.0.0" + estree-walker "^2.0.2" + picomatch "^4.0.2" -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" +"@rollup/pluginutils@^5.1.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.0.tgz#7e53eddc8c7f483a4ad0b94afb1f7f5fd3c771e0" + integrity sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g== + dependencies: + "@types/estree" "^1.0.0" + estree-walker "^2.0.2" + picomatch "^2.3.1" -delegates@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" +"@sinclair/typebox@^0.34.0": + version "0.34.37" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.34.37.tgz#f331e4db64ff8195e9e3d8449343c85aaa237d6e" + integrity sha512-2TRuQVgQYfy+EzHRTIvkhv2ADEouJ2xNS/Vq+W5EuuewBdOrvATvljZTxHWZSTYr2sTjTHpGvucaGAt67S2akw== -detect-indent@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" +"@sinonjs/commons@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" + integrity sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ== dependencies: - repeating "^2.0.0" - -detect-libc@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + type-detect "4.0.8" -detect-newline@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" +"@sinonjs/fake-timers@^13.0.0": + version "13.0.5" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-13.0.5.tgz#36b9dbc21ad5546486ea9173d6bea063eb1717d5" + integrity sha512-36/hTbH2uaWuGVERyC6da9YwGWnzUZXuPro/F2LfsdOsLnCojz/iSH8MxUt/FD2S5XBSVPhmArFUXcpCQ2Hkiw== + dependencies: + "@sinonjs/commons" "^3.0.1" -diff@3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" +"@tybys/wasm-util@^0.9.0": + version "0.9.0" + resolved "https://registry.yarnpkg.com/@tybys/wasm-util/-/wasm-util-0.9.0.tgz#3e75eb00604c8d6db470bf18c37b7d984a0e3355" + integrity sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw== + dependencies: + tslib "^2.4.0" -diff@^3.2.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" +"@types/babel__core@^7.20.5": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" + integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== + dependencies: + "@babel/parser" "^7.20.7" + "@babel/types" "^7.20.7" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" -doctrine@1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" +"@types/babel__generator@*": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.4.tgz#1f20ce4c5b1990b37900b63f050182d28c2439b7" + integrity sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg== dependencies: - esutils "^2.0.2" - isarray "^1.0.0" + "@babel/types" "^7.0.0" -doctrine@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" +"@types/babel__template@*": + version "7.4.1" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.1.tgz#3d1a48fd9d6c0edfd56f2ff578daed48f36c8969" + integrity sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g== dependencies: - esutils "^2.0.2" + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" -ecc-jsbn@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" +"@types/babel__traverse@*": + version "7.14.2" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.14.2.tgz#ffcd470bbb3f8bf30481678fb5502278ca833a43" + integrity sha512-K2waXdXBi2302XUdcHcR1jCeU0LL4TD9HRs/gk0N2Xvrht+G/BfJa4QObBQZfhMdxiCpV3COl5Nfq4uKTeTnJA== dependencies: - jsbn "~0.1.0" + "@babel/types" "^7.3.0" -editorconfig-to-prettier@0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/editorconfig-to-prettier/-/editorconfig-to-prettier-0.0.6.tgz#d79bc1a2574e0a94315dd43da3275f92f9331b27" +"@types/estree@*", "@types/estree@^1.0.0": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e" + integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w== -editorconfig@0.15.0: - version "0.15.0" - resolved "https://registry.yarnpkg.com/editorconfig/-/editorconfig-0.15.0.tgz#b6dd4a0b6b9e76ce48e066bdc15381aebb8804fd" - dependencies: - "@types/commander" "^2.11.0" - "@types/semver" "^5.4.0" - commander "^2.11.0" - lru-cache "^4.1.1" - semver "^5.4.1" - sigmund "^1.0.1" +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.1": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" + integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== -emoji-regex@6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.5.1.tgz#9baea929b155565c11ea41c6626eaa65cef992c2" +"@types/istanbul-lib-coverage@^2.0.6": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" + integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== -errno@^0.1.4, errno@~0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" +"@types/istanbul-lib-report@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" + integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== dependencies: - prr "~1.0.1" + "@types/istanbul-lib-coverage" "*" -error-ex@^1.2.0, error-ex@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" +"@types/istanbul-reports@^3.0.4": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" + integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== dependencies: - is-arrayish "^0.2.1" + "@types/istanbul-lib-report" "*" -escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - -escodegen@^1.6.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.9.1.tgz#dbae17ef96c8e4bedb1356f4504fa4cc2f7cb7e2" +"@types/jsdom@^21.1.7": + version "21.1.7" + resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-21.1.7.tgz#9edcb09e0b07ce876e7833922d3274149c898cfa" + integrity sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA== dependencies: - esprima "^3.1.3" - estraverse "^4.2.0" - esutils "^2.0.2" - optionator "^0.8.1" - optionalDependencies: - source-map "~0.6.1" + "@types/node" "*" + "@types/tough-cookie" "*" + parse5 "^7.0.0" -eslint-config-prettier@2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-2.9.0.tgz#5ecd65174d486c22dff389fe036febf502d468a3" - dependencies: - get-stdin "^5.0.1" +"@types/json-schema@^7.0.9": + version "7.0.9" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" + integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== -eslint-import-resolver-node@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" - dependencies: - debug "^2.6.9" - resolve "^1.5.0" +"@types/json5@^0.0.29": + version "0.0.29" + resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= -eslint-module-utils@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz#b270362cd88b1a48ad308976ce7fa54e98411746" - dependencies: - debug "^2.6.8" - pkg-dir "^1.0.0" - -eslint-plugin-import@2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.6.1.tgz#f580be62bb809421d46e338372764afcc9f59bf6" - dependencies: - builtin-modules "^1.1.1" - contains-path "^0.1.0" - debug "^2.6.8" - doctrine "1.5.0" - eslint-import-resolver-node "^0.3.1" - eslint-module-utils "^2.0.0" - has "^1.0.1" - lodash.cond "^4.3.0" - minimatch "^3.0.3" - read-pkg-up "^2.0.0" - -eslint-plugin-jest@21.5.0: - version "21.5.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-21.5.0.tgz#c7a3bd2ee9d1c832b4e31dec89f6ad93e08d4853" - -eslint-plugin-prettier@2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.4.0.tgz#85cab0775c6d5e3344ef01e78d960f166fb93aae" - dependencies: - fast-diff "^1.1.1" - jest-docblock "^21.0.0" - -eslint-scope@^3.7.1: - version "3.7.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" - dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" +"@types/node@*": + version "17.0.17" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.17.tgz#a8ddf6e0c2341718d74ee3dc413a13a042c45a0c" + integrity sha512-e8PUNQy1HgJGV3iU/Bp2+D/DXh3PYeyli8LgIwsQcs1Ar1LoaWHSIT6Rw+H2rNJmiq6SNWiDytfx8+gYj7wDHw== -eslint@4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.1.1.tgz#facbdfcfe3e0facd3a8b80dc98c4e6c13ae582df" - dependencies: - babel-code-frame "^6.22.0" - chalk "^1.1.3" - concat-stream "^1.6.0" - debug "^2.6.8" - doctrine "^2.0.0" - eslint-scope "^3.7.1" - espree "^3.4.3" - esquery "^1.0.0" - estraverse "^4.2.0" - esutils "^2.0.2" - file-entry-cache "^2.0.0" - glob "^7.1.2" - globals "^9.17.0" - ignore "^3.3.3" - imurmurhash "^0.1.4" - inquirer "^3.0.6" - is-my-json-valid "^2.16.0" - is-resolvable "^1.0.0" - js-yaml "^3.8.4" - json-stable-stringify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.4" - minimatch "^3.0.2" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" - pluralize "^4.0.0" - progress "^2.0.0" - require-uncached "^1.0.3" - strip-json-comments "~2.0.1" - table "^4.0.1" - text-table "~0.2.0" - -eslint@4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.5.0.tgz#bb75d3b8bde97fb5e13efcd539744677feb019c3" - dependencies: - ajv "^5.2.0" - babel-code-frame "^6.22.0" - chalk "^2.1.0" - concat-stream "^1.6.0" - cross-spawn "^5.1.0" - debug "^2.6.8" - doctrine "^2.0.0" - eslint-scope "^3.7.1" - espree "^3.5.0" - esquery "^1.0.0" - estraverse "^4.2.0" - esutils "^2.0.2" - file-entry-cache "^2.0.0" - functional-red-black-tree "^1.0.1" - glob "^7.1.2" - globals "^9.17.0" - ignore "^3.3.3" - imurmurhash "^0.1.4" - inquirer "^3.0.6" - is-resolvable "^1.0.0" - js-yaml "^3.9.1" - json-stable-stringify "^1.0.1" - levn "^0.3.0" - lodash "^4.17.4" - minimatch "^3.0.2" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.2" - pluralize "^4.0.0" - progress "^2.0.0" - require-uncached "^1.0.3" - semver "^5.3.0" - strip-ansi "^4.0.0" - strip-json-comments "~2.0.1" - table "^4.0.1" - text-table "~0.2.0" - -espree@^3.4.3, espree@^3.5.0: - version "3.5.4" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" - dependencies: - acorn "^5.5.0" - acorn-jsx "^3.0.0" - -esprima@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" +"@types/resolve@1.20.2": + version "1.20.2" + resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.20.2.tgz#97d26e00cd4a0423b4af620abecf3e6f442b7975" + integrity sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q== -esprima@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" +"@types/stack-utils@^2.0.3": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" + integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== -esquery@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708" - dependencies: - estraverse "^4.0.0" +"@types/tough-cookie@*": + version "4.0.2" + resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.2.tgz#6286b4c7228d58ab7866d19716f3696e03a09397" + integrity sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw== + +"@types/yargs-parser@*": + version "20.2.1" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.1.tgz#3b9ce2489919d9e4fea439b76916abc34b2df129" + integrity sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw== + +"@types/yargs@^17.0.33": + version "17.0.33" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.33.tgz#8c32303da83eec050a84b3c7ae7b9f922d13e32d" + integrity sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA== + dependencies: + "@types/yargs-parser" "*" + +"@typescript-eslint/scope-manager@5.11.0": + version "5.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.11.0.tgz#f5aef83ff253f457ecbee5f46f762298f0101e4b" + integrity sha512-z+K4LlahDFVMww20t/0zcA7gq/NgOawaLuxgqGRVKS0PiZlCTIUtX0EJbC0BK1JtR4CelmkPK67zuCgpdlF4EA== + dependencies: + "@typescript-eslint/types" "5.11.0" + "@typescript-eslint/visitor-keys" "5.11.0" + +"@typescript-eslint/types@5.11.0": + version "5.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.11.0.tgz#ba345818a2540fdf2755c804dc2158517ab61188" + integrity sha512-cxgBFGSRCoBEhvSVLkKw39+kMzUKHlJGVwwMbPcTZX3qEhuXhrjwaZXWMxVfxDgyMm+b5Q5b29Llo2yow8Y7xQ== + +"@typescript-eslint/typescript-estree@5.11.0": + version "5.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.11.0.tgz#53f9e09b88368191e52020af77c312a4777ffa43" + integrity sha512-yVH9hKIv3ZN3lw8m/Jy5I4oXO4ZBMqijcXCdA4mY8ull6TPTAoQnKKrcZ0HDXg7Bsl0Unwwx7jcXMuNZc0m4lg== + dependencies: + "@typescript-eslint/types" "5.11.0" + "@typescript-eslint/visitor-keys" "5.11.0" + debug "^4.3.2" + globby "^11.0.4" + is-glob "^4.0.3" + semver "^7.3.5" + tsutils "^3.21.0" + +"@typescript-eslint/utils@^5.10.0": + version "5.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.11.0.tgz#d91548ef180d74c95d417950336d9260fdbe1dc5" + integrity sha512-g2I480tFE1iYRDyMhxPAtLQ9HAn0jjBtipgTCZmd9I9s11OV8CTsG+YfFciuNDcHqm4csbAgC2aVZCHzLxMSUw== + dependencies: + "@types/json-schema" "^7.0.9" + "@typescript-eslint/scope-manager" "5.11.0" + "@typescript-eslint/types" "5.11.0" + "@typescript-eslint/typescript-estree" "5.11.0" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" + +"@typescript-eslint/visitor-keys@5.11.0": + version "5.11.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.11.0.tgz#888542381f1a2ac745b06d110c83c0b261487ebb" + integrity sha512-E8w/vJReMGuloGxJDkpPlGwhxocxOpSVgSvjiLO5IxZPmxZF30weOeJYyPSEACwM+X4NziYS9q+WkN/2DHYQwA== + dependencies: + "@typescript-eslint/types" "5.11.0" + eslint-visitor-keys "^3.0.0" + +"@ungap/structured-clone@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" + integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== + +"@ungap/structured-clone@^1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.3.0.tgz#d06bbb384ebcf6c505fde1c3d0ed4ddffe0aaff8" + integrity sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g== + +"@unrs/resolver-binding-android-arm-eabi@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-android-arm-eabi/-/resolver-binding-android-arm-eabi-1.9.2.tgz#6cb01dde20bef06397ffd4924f502596cb458851" + integrity sha512-tS+lqTU3N0kkthU+rYp0spAYq15DU8ld9kXkaKg9sbQqJNF+WPMuNHZQGCgdxrUOEO0j22RKMwRVhF1HTl+X8A== + +"@unrs/resolver-binding-android-arm64@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-android-arm64/-/resolver-binding-android-arm64-1.9.2.tgz#1672b533f01f98119095860683496def93929a2e" + integrity sha512-MffGiZULa/KmkNjHeuuflLVqfhqLv1vZLm8lWIyeADvlElJ/GLSOkoUX+5jf4/EGtfwrNFcEaB8BRas03KT0/Q== + +"@unrs/resolver-binding-darwin-arm64@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-darwin-arm64/-/resolver-binding-darwin-arm64-1.9.2.tgz#dad66a21553b1ba4088c6eb922332846550bd9b2" + integrity sha512-dzJYK5rohS1sYl1DHdJ3mwfwClJj5BClQnQSyAgEfggbUwA9RlROQSSbKBLqrGfsiC/VyrDPtbO8hh56fnkbsQ== + +"@unrs/resolver-binding-darwin-x64@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-darwin-x64/-/resolver-binding-darwin-x64-1.9.2.tgz#bfaedca218078862f3d536d44269fed94a6158e2" + integrity sha512-gaIMWK+CWtXcg9gUyznkdV54LzQ90S3X3dn8zlh+QR5Xy7Y+Efqw4Rs4im61K1juy4YNb67vmJsCDAGOnIeffQ== + +"@unrs/resolver-binding-freebsd-x64@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-freebsd-x64/-/resolver-binding-freebsd-x64-1.9.2.tgz#bdab0e754c45831522b16df0b6fe4b0ffde22628" + integrity sha512-S7QpkMbVoVJb0xwHFwujnwCAEDe/596xqY603rpi/ioTn9VDgBHnCCxh+UFrr5yxuMH+dliHfjwCZJXOPJGPnw== + +"@unrs/resolver-binding-linux-arm-gnueabihf@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-arm-gnueabihf/-/resolver-binding-linux-arm-gnueabihf-1.9.2.tgz#2bac9c19599888d4ba4787b437b0273ac7a7a9f2" + integrity sha512-+XPUMCuCCI80I46nCDFbGum0ZODP5NWGiwS3Pj8fOgsG5/ctz+/zzuBlq/WmGa+EjWZdue6CF0aWWNv84sE1uw== + +"@unrs/resolver-binding-linux-arm-musleabihf@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-arm-musleabihf/-/resolver-binding-linux-arm-musleabihf-1.9.2.tgz#49d27d5d63e5f26cf7b93a0731334b302b9b7fec" + integrity sha512-sqvUyAd1JUpwbz33Ce2tuTLJKM+ucSsYpPGl2vuFwZnEIg0CmdxiZ01MHQ3j6ExuRqEDUCy8yvkDKvjYFPb8Zg== + +"@unrs/resolver-binding-linux-arm64-gnu@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-arm64-gnu/-/resolver-binding-linux-arm64-gnu-1.9.2.tgz#95ba5d1654a04b1049d944871e165d786e8da68f" + integrity sha512-UYA0MA8ajkEDCFRQdng/FVx3F6szBvk3EPnkTTQuuO9lV1kPGuTB+V9TmbDxy5ikaEgyWKxa4CI3ySjklZ9lFA== + +"@unrs/resolver-binding-linux-arm64-musl@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-arm64-musl/-/resolver-binding-linux-arm64-musl-1.9.2.tgz#23f90a48b1d343189b1c20c89b694140e2d5a210" + integrity sha512-P/CO3ODU9YJIHFqAkHbquKtFst0COxdphc8TKGL5yCX75GOiVpGqd1d15ahpqu8xXVsqP4MGFP2C3LRZnnL5MA== + +"@unrs/resolver-binding-linux-ppc64-gnu@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-ppc64-gnu/-/resolver-binding-linux-ppc64-gnu-1.9.2.tgz#076f2c2e95dbcd4824cc9929bc504151b402ac11" + integrity sha512-uKStFlOELBxBum2s1hODPtgJhY4NxYJE9pAeyBgNEzHgTqTiVBPjfTlPFJkfxyTjQEuxZbbJlJnMCrRgD7ubzw== + +"@unrs/resolver-binding-linux-riscv64-gnu@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-riscv64-gnu/-/resolver-binding-linux-riscv64-gnu-1.9.2.tgz#f7de54d45df430c74bbd12794946a55805bed6dd" + integrity sha512-LkbNnZlhINfY9gK30AHs26IIVEZ9PEl9qOScYdmY2o81imJYI4IMnJiW0vJVtXaDHvBvxeAgEy5CflwJFIl3tQ== + +"@unrs/resolver-binding-linux-riscv64-musl@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-riscv64-musl/-/resolver-binding-linux-riscv64-musl-1.9.2.tgz#ad1fcdcf5f112d7432fcfe38269a084bdccad266" + integrity sha512-vI+e6FzLyZHSLFNomPi+nT+qUWN4YSj8pFtQZSFTtmgFoxqB6NyjxSjAxEC1m93qn6hUXhIsh8WMp+fGgxCoRg== + +"@unrs/resolver-binding-linux-s390x-gnu@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-s390x-gnu/-/resolver-binding-linux-s390x-gnu-1.9.2.tgz#d914a4f12b9048e1a4de0040f64d73274104e301" + integrity sha512-sSO4AlAYhSM2RAzBsRpahcJB1msc6uYLAtP6pesPbZtptF8OU/CbCPhSRW6cnYOGuVmEmWVW5xVboAqCnWTeHQ== + +"@unrs/resolver-binding-linux-x64-gnu@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-x64-gnu/-/resolver-binding-linux-x64-gnu-1.9.2.tgz#d8f8cddc42ae267ef45ed4b61ff72b9e22aa3b82" + integrity sha512-jkSkwch0uPFva20Mdu8orbQjv2A3G88NExTN2oPTI1AJ+7mZfYW3cDCTyoH6OnctBKbBVeJCEqh0U02lTkqD5w== + +"@unrs/resolver-binding-linux-x64-musl@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-linux-x64-musl/-/resolver-binding-linux-x64-musl-1.9.2.tgz#7bfce67acb51b3f4a7cff8383f46600f7b055a96" + integrity sha512-Uk64NoiTpQbkpl+bXsbeyOPRpUoMdcUqa+hDC1KhMW7aN1lfW8PBlBH4mJ3n3Y47dYE8qi0XTxy1mBACruYBaw== + +"@unrs/resolver-binding-wasm32-wasi@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-wasm32-wasi/-/resolver-binding-wasm32-wasi-1.9.2.tgz#b133c9b6941aba54eea007ca2f27ff6ce917ae55" + integrity sha512-EpBGwkcjDicjR/ybC0g8wO5adPNdVuMrNalVgYcWi+gYtC1XYNuxe3rufcO7dA76OHGeVabcO6cSkPJKVcbCXQ== + dependencies: + "@napi-rs/wasm-runtime" "^0.2.11" + +"@unrs/resolver-binding-win32-arm64-msvc@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.9.2.tgz#5f95f590f06c1e9ba15b24292c956c21a6294b30" + integrity sha512-EdFbGn7o1SxGmN6aZw9wAkehZJetFPao0VGZ9OMBwKx6TkvDuj6cNeLimF/Psi6ts9lMOe+Dt6z19fZQ9Ye2fw== + +"@unrs/resolver-binding-win32-ia32-msvc@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-win32-ia32-msvc/-/resolver-binding-win32-ia32-msvc-1.9.2.tgz#aac6595c6de6b26e5314372ab977b0f6a869c903" + integrity sha512-JY9hi1p7AG+5c/dMU8o2kWemM8I6VZxfGwn1GCtf3c5i+IKcMo2NQ8OjZ4Z3/itvY/Si3K10jOBQn7qsD/whUA== + +"@unrs/resolver-binding-win32-x64-msvc@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@unrs/resolver-binding-win32-x64-msvc/-/resolver-binding-win32-x64-msvc-1.9.2.tgz#f755c5229f1401bbff7307d037c6e38fa169ad1d" + integrity sha512-ryoo+EB19lMxAd80ln9BVf8pdOAxLb97amrQ3SFN9OCRn/5M5wvwDgAe4i8ZjhpbiHoDeP8yavcTEnpKBo7lZg== + +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + +acorn@^8.8.2, acorn@^8.9.0: + version "8.10.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" + integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== + +agent-base@^7.1.0, agent-base@^7.1.2: + version "7.1.3" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.3.tgz#29435eb821bc4194633a5b89e5bc4703bafc25a1" + integrity sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw== + +ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" -esrecurse@^4.1.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" +ansi-escapes@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" + integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== dependencies: - estraverse "^4.1.0" + type-fest "^0.21.3" -estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== -esutils@2.0.2, esutils@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" +ansi-regex@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.0.1.tgz#3183e38fae9a65d7cb5e53945cd5897d0260a06a" + integrity sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA== -exec-sh@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.1.tgz#163b98a6e89e6b65b47c2a28d215bc1f63989c38" +ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: - merge "^1.1.3" + color-convert "^1.9.0" -execa@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: - cross-spawn "^5.0.1" - get-stream "^3.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" + color-convert "^2.0.1" -expand-brackets@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" - dependencies: - is-posix-bracket "^0.1.0" +ansi-styles@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== -expand-brackets@^2.1.4: - version "2.1.4" - resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" - dependencies: - debug "^2.3.3" - define-property "^0.2.5" - extend-shallow "^2.0.1" - posix-character-classes "^0.1.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -expand-range@^1.8.1: - version "1.8.2" - resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" - dependencies: - fill-range "^2.1.0" - -expect@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/expect/-/expect-21.2.1.tgz#003ac2ac7005c3c29e73b38a272d4afadd6d1d7b" - dependencies: - ansi-styles "^3.2.0" - jest-diff "^21.2.1" - jest-get-type "^21.2.0" - jest-matcher-utils "^21.2.1" - jest-message-util "^21.2.1" - jest-regex-util "^21.2.0" - -extend-shallow@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" +ansi-styles@^6.1.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" + integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== + +anymatch@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== dependencies: - is-extendable "^0.1.0" + normalize-path "^3.0.0" + picomatch "^2.0.4" -extend-shallow@^3.0.0, extend-shallow@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: - assign-symbols "^1.0.0" - is-extendable "^1.0.1" + sprintf-js "~1.0.2" -extend@^3.0.0, extend@~3.0.0, extend@~3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -external-editor@^2.0.4: - version "2.2.0" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5" +array-buffer-byte-length@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz#fabe8bc193fea865f317fe7807085ee0dee5aead" + integrity sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A== dependencies: - chardet "^0.4.0" - iconv-lite "^0.4.17" - tmp "^0.0.33" + call-bind "^1.0.2" + is-array-buffer "^3.0.1" -extglob@^0.3.1: - version "0.3.2" - resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" +array-includes@^3.1.7: + version "3.1.7" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.7.tgz#8cd2e01b26f7a3086cbc87271593fe921c62abda" + integrity sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ== dependencies: - is-extglob "^1.0.0" - -extglob@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" - dependencies: - array-unique "^0.3.2" - define-property "^1.0.0" - expand-brackets "^2.1.4" - extend-shallow "^2.0.1" - fragment-cache "^0.2.1" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" - -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" + is-string "^1.0.7" -extsprintf@^1.2.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== -fast-deep-equal@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614" +array.prototype.findlastindex@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz#b37598438f97b579166940814e2c0493a4f50207" + integrity sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + es-shim-unscopables "^1.0.0" + get-intrinsic "^1.2.1" + +array.prototype.flat@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz#1476217df8cff17d72ee8f3ba06738db5b387d18" + integrity sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + es-shim-unscopables "^1.0.0" + +array.prototype.flatmap@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz#c9a7c6831db8e719d6ce639190146c24bbd3e527" + integrity sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + es-shim-unscopables "^1.0.0" + +arraybuffer.prototype.slice@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz#98bd561953e3e74bb34938e77647179dfe6e9f12" + integrity sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw== + dependencies: + array-buffer-byte-length "^1.0.0" + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" + is-array-buffer "^3.0.2" + is-shared-array-buffer "^1.0.2" + +available-typed-arrays@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" + integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== + +babel-jest@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-30.0.2.tgz#f627dc5afc3bd5795fc84735b4f1d74f9d4b8e91" + integrity sha512-A5kqR1/EUTidM2YC2YMEUDP2+19ppgOwK0IAd9Swc3q2KqFb5f9PtRUXVeZcngu0z5mDMyZ9zH2huJZSOMLiTQ== + dependencies: + "@jest/transform" "30.0.2" + "@types/babel__core" "^7.20.5" + babel-plugin-istanbul "^7.0.0" + babel-preset-jest "30.0.1" + chalk "^4.1.2" + graceful-fs "^4.2.11" + slash "^3.0.0" + +babel-plugin-istanbul@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-7.0.0.tgz#629a178f63b83dc9ecee46fd20266283b1f11280" + integrity sha512-C5OzENSx/A+gt7t4VH1I2XsflxyPUmXRFPKBxt33xncdOmq7oROVM3bZv9Ysjjkv8OJYDMa+tKuKMvqU/H3xdw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@istanbuljs/load-nyc-config" "^1.0.0" + "@istanbuljs/schema" "^0.1.3" + istanbul-lib-instrument "^6.0.2" + test-exclude "^6.0.0" + +babel-plugin-jest-hoist@30.0.1: + version "30.0.1" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-30.0.1.tgz#f271b2066d2c1fb26a863adb8e13f85b06247125" + integrity sha512-zTPME3pI50NsFW8ZBaVIOeAxzEY7XHlmWeXXu9srI+9kNfzCUTy8MFan46xOGZY8NZThMqq+e3qZUKsvXbasnQ== + dependencies: + "@babel/template" "^7.27.2" + "@babel/types" "^7.27.3" + "@types/babel__core" "^7.20.5" + +babel-plugin-polyfill-corejs2@^0.4.10: + version "0.4.13" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.13.tgz#7d445f0e0607ebc8fb6b01d7e8fb02069b91dd8b" + integrity sha512-3sX/eOms8kd3q2KZ6DAhKPc0dgm525Gqq5NtWKZ7QYYZEv57OQ54KtblzJzH1lQF/eQxO8KjWGIK9IPUJNus5g== + dependencies: + "@babel/compat-data" "^7.22.6" + "@babel/helper-define-polyfill-provider" "^0.6.4" + semver "^6.3.1" + +babel-plugin-polyfill-corejs3@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.11.1.tgz#4e4e182f1bb37c7ba62e2af81d8dd09df31344f6" + integrity sha512-yGCqvBT4rwMczo28xkH/noxJ6MZ4nJfkVYdoDaC/utLtWrXxv27HVrzAeSbqR8SxDsp46n0YF47EbHoixy6rXQ== + dependencies: + "@babel/helper-define-polyfill-provider" "^0.6.3" + core-js-compat "^3.40.0" -fast-diff@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.2.tgz#4b62c42b8e03de3f848460b639079920695d0154" +babel-plugin-polyfill-regenerator@^0.6.1: + version "0.6.4" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.4.tgz#428c615d3c177292a22b4f93ed99e358d7906a9b" + integrity sha512-7gD3pRadPrbjhjLyxebmx/WrFYcuSjZ0XbdUujQMZ/fcE9oeewk2U/7PCvez84UeuK3oSjmPZ0Ch0dlupQvGzw== + dependencies: + "@babel/helper-define-polyfill-provider" "^0.6.4" -fast-json-stable-stringify@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" +babel-preset-current-node-syntax@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz#9a929eafece419612ef4ae4f60b1862ebad8ef30" + integrity sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw== + dependencies: + "@babel/plugin-syntax-async-generators" "^7.8.4" + "@babel/plugin-syntax-bigint" "^7.8.3" + "@babel/plugin-syntax-class-properties" "^7.12.13" + "@babel/plugin-syntax-class-static-block" "^7.14.5" + "@babel/plugin-syntax-import-attributes" "^7.24.7" + "@babel/plugin-syntax-import-meta" "^7.10.4" + "@babel/plugin-syntax-json-strings" "^7.8.3" + "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-syntax-numeric-separator" "^7.10.4" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-syntax-private-property-in-object" "^7.14.5" + "@babel/plugin-syntax-top-level-await" "^7.14.5" + +babel-preset-jest@30.0.1: + version "30.0.1" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-30.0.1.tgz#7d28db9531bce264e846c8483d54236244b8ae88" + integrity sha512-+YHejD5iTWI46cZmcc/YtX4gaKBtdqCHCVfuVinizVpbmyjO3zYmeuyFdfA8duRqQZfgCAMlsfmkVbJ+e2MAJw== + dependencies: + babel-plugin-jest-hoist "30.0.1" + babel-preset-current-node-syntax "^1.1.0" -fast-levenshtein@~2.0.4: - version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -fault@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/fault/-/fault-1.0.1.tgz#de8d350dfd48be24b5dc1b02867e0871b9135092" +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: - format "^0.2.2" + balanced-match "^1.0.0" + concat-map "0.0.1" -fb-watchman@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.0.tgz#54e9abf7dfa2f26cd9b1636c588c1afc05de5d58" +brace-expansion@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.2.tgz#54fc53237a613d854c7bd37463aad17df87214e7" + integrity sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ== dependencies: - bser "^2.0.0" + balanced-match "^1.0.0" -figures@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" +braces@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== dependencies: - escape-string-regexp "^1.0.5" + fill-range "^7.0.1" -file-entry-cache@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" +braces@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== dependencies: - flat-cache "^1.2.1" - object-assign "^4.0.1" + fill-range "^7.1.1" -filename-regex@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" - -fileset@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/fileset/-/fileset-2.0.3.tgz#8e7548a96d3cc2327ee5e674168723a333bba2a0" +browserslist@^4.21.9, browserslist@^4.22.2: + version "4.22.3" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.22.3.tgz#299d11b7e947a6b843981392721169e27d60c5a6" + integrity sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A== dependencies: - glob "^7.0.3" - minimatch "^3.0.3" + caniuse-lite "^1.0.30001580" + electron-to-chromium "^1.4.648" + node-releases "^2.0.14" + update-browserslist-db "^1.0.13" -fill-range@^2.1.0: - version "2.2.3" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" +browserslist@^4.24.0, browserslist@^4.25.0: + version "4.25.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.25.1.tgz#ba9e8e6f298a1d86f829c9b975e07948967bb111" + integrity sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw== dependencies: - is-number "^2.1.0" - isobject "^2.0.0" - randomatic "^1.1.3" - repeat-element "^1.1.2" - repeat-string "^1.5.2" + caniuse-lite "^1.0.30001726" + electron-to-chromium "^1.5.173" + node-releases "^2.0.19" + update-browserslist-db "^1.1.3" -fill-range@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" +bser@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" + integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== dependencies: - extend-shallow "^2.0.1" - is-number "^3.0.0" - repeat-string "^1.6.1" - to-regex-range "^2.1.0" - -find-project-root@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/find-project-root/-/find-project-root-1.1.1.tgz#d242727a2d904725df5714f23dfdcdedda0b6ef8" + node-int64 "^0.4.0" -find-up@^1.0.0: +buffer-from@^1.0.0: version "1.1.2" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" + integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== + +c8@^10.1.3: + version "10.1.3" + resolved "https://registry.yarnpkg.com/c8/-/c8-10.1.3.tgz#54afb25ebdcc7f3b00112482c6d90d7541ad2fcd" + integrity sha512-LvcyrOAaOnrrlMpW22n690PUvxiq4Uf9WMhQwNJ9vgagkL/ph1+D4uvjvDA5XCbykrc0sx+ay6pVi9YZ1GnhyA== + dependencies: + "@bcoe/v8-coverage" "^1.0.1" + "@istanbuljs/schema" "^0.1.3" + find-up "^5.0.0" + foreground-child "^3.1.1" + istanbul-lib-coverage "^3.2.0" + istanbul-lib-report "^3.0.1" + istanbul-reports "^3.1.6" + test-exclude "^7.0.1" + v8-to-istanbul "^9.0.0" + yargs "^17.7.2" + yargs-parser "^21.1.1" + +call-bind@^1.0.0, call-bind@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" + integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== dependencies: - path-exists "^2.0.0" - pinkie-promise "^2.0.0" + function-bind "^1.1.1" + get-intrinsic "^1.0.2" -find-up@^2.0.0, find-up@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" +call-bind@^1.0.4, call-bind@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.5.tgz#6fa2b7845ce0ea49bf4d8b9ef64727a2c2e2e513" + integrity sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ== dependencies: - locate-path "^2.0.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.1" + set-function-length "^1.1.1" -flat-cache@^1.2.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" +callsites@^3.0.0, callsites@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +camelcase@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== + +caniuse-lite@^1.0.30001580: + version "1.0.30001583" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001583.tgz#abb2970cc370801dc7e27bf290509dc132cfa390" + integrity sha512-acWTYaha8xfhA/Du/z4sNZjHUWjkiuoAi2LM+T/aL+kemKQgPT1xBb/YKjlQ0Qo8gvbHsGNplrEJ+9G3gL7i4Q== + +caniuse-lite@^1.0.30001726: + version "1.0.30001726" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001726.tgz#a15bd87d5a4bf01f6b6f70ae7c97fdfd28b5ae47" + integrity sha512-VQAUIUzBiZ/UnlM28fSp2CRF3ivUn1BWEvxMcVTNwpw91Py1pGbPIyIKtd+tzct9C3ouceCVdGAXxZOpZAsgdw== + +chalk@^2.0.0, chalk@^2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== dependencies: - circular-json "^0.3.1" - del "^2.0.2" - graceful-fs "^4.1.2" - write "^0.2.1" - -flatten@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782" + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" -flow-parser@0.70: - version "0.70.0" - resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.70.0.tgz#9c310187efe4380ba9a251284e9b83b95c49e857" +chalk@^4.0.0, chalk@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" -for-in@^1.0.1, for-in@^1.0.2: +char-regex@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" + integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== -for-own@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" - dependencies: - for-in "^1.0.1" +ci-info@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-4.2.0.tgz#cbd21386152ebfe1d56f280a3b5feccbd96764c7" + integrity sha512-cYY9mypksY8NRqgDB1XD1RiJL338v/551niynFTGkZOO2LHuB2OmOYxDIe/ttN9AHwrqdum1360G3ald0W9kCg== -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" +cjs-module-lexer@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-2.1.0.tgz#586e87d4341cb2661850ece5190232ccdebcff8b" + integrity sha512-UX0OwmYRYQQetfrLEZeewIFFI+wSTofC+pMBLNuH3RUuu/xzG1oz84UCEDOSoQlN3fZ4+AzmV50ZYvGqkMh9yA== -form-data@~2.1.1: - version "2.1.4" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.4.tgz#33c183acf193276ecaa98143a69e94bfee1750d1" +cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.5" - mime-types "^2.1.12" + string-width "^4.2.0" + strip-ansi "^6.0.1" + wrap-ansi "^7.0.0" -form-data@~2.3.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.2.tgz#4970498be604c20c005d4f5c23aecd21d6b49099" - dependencies: - asynckit "^0.4.0" - combined-stream "1.0.6" - mime-types "^2.1.12" +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= -format@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b" +collect-v8-coverage@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz#c0b29bcd33bcd0779a1344c2136051e6afd3d9e9" + integrity sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q== -fragment-cache@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: - map-cache "^0.2.2" + color-name "1.1.3" -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - -fsevents@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.1.3.tgz#11f82318f5fe7bb2cd22965a108e9306208216d8" +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== dependencies: - nan "^2.3.0" - node-pre-gyp "^0.6.39" + color-name "~1.1.4" -fstream-ignore@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/fstream-ignore/-/fstream-ignore-1.0.5.tgz#9c31dae34767018fe1d249b24dada67d092da105" - dependencies: - fstream "^1.0.0" - inherits "2" - minimatch "^3.0.0" +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== -fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2: - version "1.0.11" - resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.11.tgz#5c1fb1f117477114f0632a0eb4b71b3cb0fd3171" - dependencies: - graceful-fs "^4.1.2" - inherits "~2.0.0" - mkdirp ">=0.5 0" - rimraf "2" +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -function-bind@^1.0.2: - version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" +commander@^2.20.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -functional-red-black-tree@^1.0.1: +commondir@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" - -gauge@~2.7.3: - version "2.7.4" - resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" - dependencies: - aproba "^1.0.3" - console-control-strings "^1.0.0" - has-unicode "^2.0.0" - object-assign "^4.1.0" - signal-exit "^3.0.0" - string-width "^1.0.1" - strip-ansi "^3.0.1" - wide-align "^1.1.0" - -generate-function@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" + resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + integrity sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg== -generate-object-property@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" - dependencies: - is-property "^1.0.0" - -get-caller-file@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" - -get-stdin@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398" +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -get-stream@3.0.0, get-stream@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" +convert-source-map@^1.6.0, convert-source-map@^1.7.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.8.0.tgz#f3373c32d21b4d780dd8004514684fb791ca4369" + integrity sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA== + dependencies: + safe-buffer "~5.1.1" -get-value@^2.0.3, get-value@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" +convert-source-map@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" + integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" +core-js-compat@^3.40.0: + version "3.43.0" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.43.0.tgz#055587369c458795ef316f65e0aabb808fb15840" + integrity sha512-2GML2ZsCc5LR7hZYz4AXmjQw8zuy2T//2QntwdnpuYI7jteT6GVYJL7F6C2C57R7gSYrcqVW3lAALefdbhBLDA== dependencies: - assert-plus "^1.0.0" + browserslist "^4.25.0" -glob-base@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" +cross-env@^7.0.2: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf" + integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw== dependencies: - glob-parent "^2.0.0" - is-glob "^2.0.0" + cross-spawn "^7.0.1" -glob-parent@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" +cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== dependencies: - is-glob "^2.0.0" + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" -glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2: - version "7.1.2" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" +cross-spawn@^7.0.6: + version "7.0.6" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" + integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" -globals@^9.17.0, globals@^9.18.0: - version "9.18.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" - -globby@6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" +cssstyle@^4.2.1: + version "4.6.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-4.6.0.tgz#ea18007024e3167f4f105315f3ec2d982bf48ed9" + integrity sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg== dependencies: - array-union "^1.0.1" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" + "@asamuzakjp/css-color" "^3.2.0" + rrweb-cssom "^0.8.0" -globby@^5.0.0: +data-urls@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-5.0.0.tgz#2f76906bce1824429ffecb6920f45a0b30f00dde" + integrity sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg== dependencies: - array-union "^1.0.1" - arrify "^1.0.0" - glob "^7.0.3" - object-assign "^4.0.1" - pify "^2.0.0" - pinkie-promise "^2.0.0" + whatwg-mimetype "^4.0.0" + whatwg-url "^14.0.0" -graceful-fs@^4.1.11, graceful-fs@^4.1.2: - version "4.1.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" -graphql@0.13.2: - version "0.13.2" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.13.2.tgz#4c740ae3c222823e7004096f832e7b93b2108270" +debug@^3.2.7: + version "3.2.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" + integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== dependencies: - iterall "^1.2.1" + ms "^2.1.1" -gray-matter@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/gray-matter/-/gray-matter-3.1.1.tgz#101f80d9e69eeca6765cdce437705b18f40876ac" +debug@^4.3.4: + version "4.4.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" + integrity sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ== dependencies: - extend-shallow "^2.0.1" - js-yaml "^3.10.0" - kind-of "^5.0.2" - strip-bom-string "^1.0.0" + ms "^2.1.3" -growly@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" +decimal.js@^10.5.0: + version "10.5.0" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.5.0.tgz#0f371c7cf6c4898ce0afb09836db73cd82010f22" + integrity sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw== -handlebars@^4.0.3, handlebars@^4.0.6: - version "4.0.11" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.11.tgz#630a35dfe0294bc281edae6ffc5d329fc7982dcc" - dependencies: - async "^1.4.0" - optimist "^0.6.1" - source-map "^0.4.4" - optionalDependencies: - uglify-js "^2.6" +dedent@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.6.0.tgz#79d52d6389b1ffa67d2bcef59ba51847a9d503b2" + integrity sha512-F1Z+5UCFpmQUzJa11agbyPVMbpgT/qA3/SKyJ1jyBgm7dUcUEa8v9JwDkerSQXfakBwFljIxhOJqGkjUwZ9FSA== -har-schema@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" +deep-is@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" +deepmerge@^4.2.2, deepmerge@^4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" + integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== -har-validator@~4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a" +define-data-property@^1.0.1, define-data-property@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.1.tgz#c35f7cd0ab09883480d12ac5cb213715587800b3" + integrity sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ== dependencies: - ajv "^4.9.1" - har-schema "^1.0.5" + get-intrinsic "^1.2.1" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" -har-validator@~5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd" +define-properties@^1.1.3, define-properties@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.4.tgz#0b14d7bd7fbeb2f3572c3a7eda80ea5d57fb05b1" + integrity sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA== dependencies: - ajv "^5.1.0" - har-schema "^2.0.0" + has-property-descriptors "^1.0.0" + object-keys "^1.1.1" -has-ansi@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" +define-properties@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.0.tgz#52988570670c9eacedd8064f4a990f2405849bd5" + integrity sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA== dependencies: - ansi-regex "^2.0.0" - -has-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" - -has-flag@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + has-property-descriptors "^1.0.0" + object-keys "^1.1.1" -has-unicode@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" +detect-newline@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" + integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== -has-value@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== dependencies: - get-value "^2.0.3" - has-values "^0.1.4" - isobject "^2.0.0" + path-type "^4.0.0" -has-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== dependencies: - get-value "^2.0.6" - has-values "^1.0.0" - isobject "^3.0.0" + esutils "^2.0.2" -has-values@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" -has-values@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" +eastasianwidth@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" + integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== + +electron-to-chromium@^1.4.648: + version "1.4.656" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.656.tgz#b374fb7cab9b782a5bc967c0ce0e19826186b9c9" + integrity sha512-9AQB5eFTHyR3Gvt2t/NwR0le2jBSUNwCnMbUCejFWHD+so4tH40/dRLgoE+jxlPeWS43XJewyvCv+I8LPMl49Q== + +electron-to-chromium@^1.5.173: + version "1.5.174" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.174.tgz#c7d273755d4dc9bc4f1d192f6f2092bee42771f3" + integrity sha512-HE43yYdUUiJVjewV2A9EP8o89Kb4AqMKplMQP2IxEPUws1Etu/ZkdsgUDabUZ/WmbP4ZbvJDOcunvbBUPPIfmw== + +emittery@^0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" + integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +emoji-regex@^9.2.2: + version "9.2.2" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" + integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== + +entities@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-4.4.0.tgz#97bdaba170339446495e653cfd2db78962900174" + integrity sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA== + +entities@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/entities/-/entities-6.0.1.tgz#c28c34a43379ca7f61d074130b2f5f7020a30694" + integrity sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g== + +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" + is-arrayish "^0.2.1" -has@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" +es-abstract@^1.22.1: + version "1.22.3" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.22.3.tgz#48e79f5573198de6dee3589195727f4f74bc4f32" + integrity sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA== + dependencies: + array-buffer-byte-length "^1.0.0" + arraybuffer.prototype.slice "^1.0.2" + available-typed-arrays "^1.0.5" + call-bind "^1.0.5" + es-set-tostringtag "^2.0.1" + es-to-primitive "^1.2.1" + function.prototype.name "^1.1.6" + get-intrinsic "^1.2.2" + get-symbol-description "^1.0.0" + globalthis "^1.0.3" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + internal-slot "^1.0.5" + is-array-buffer "^3.0.2" + is-callable "^1.2.7" + is-negative-zero "^2.0.2" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.2" + is-string "^1.0.7" + is-typed-array "^1.1.12" + is-weakref "^1.0.2" + object-inspect "^1.13.1" + object-keys "^1.1.1" + object.assign "^4.1.4" + regexp.prototype.flags "^1.5.1" + safe-array-concat "^1.0.1" + safe-regex-test "^1.0.0" + string.prototype.trim "^1.2.8" + string.prototype.trimend "^1.0.7" + string.prototype.trimstart "^1.0.7" + typed-array-buffer "^1.0.0" + typed-array-byte-length "^1.0.0" + typed-array-byte-offset "^1.0.0" + typed-array-length "^1.0.4" + unbox-primitive "^1.0.2" + which-typed-array "^1.1.13" + +es-set-tostringtag@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz#338d502f6f674301d710b80c8592de8a15f09cd8" + integrity sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg== dependencies: - function-bind "^1.0.2" + get-intrinsic "^1.1.3" + has "^1.0.3" + has-tostringtag "^1.0.0" -hawk@3.1.3, hawk@~3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" +es-shim-unscopables@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz#702e632193201e3edf8713635d083d378e510241" + integrity sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w== dependencies: - boom "2.x.x" - cryptiles "2.x.x" - hoek "2.x.x" - sntp "1.x.x" + has "^1.0.3" -hawk@~6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038" +es-to-primitive@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" + integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== dependencies: - boom "4.x.x" - cryptiles "3.x.x" - hoek "4.x.x" - sntp "2.x.x" + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" + +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== -hoek@2.x.x: - version "2.16.3" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" +escalade@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" + integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== -hoek@4.x.x: - version "4.2.1" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb" +escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== -home-or-tmp@^2.0.0: +escape-string-regexp@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" - dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.1" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== -hosted-git-info@^2.1.4: - version "2.6.0" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.6.0.tgz#23235b29ab230c576aab0d4f13fc046b0b038222" +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +eslint-config-prettier@9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f" + integrity sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw== + +eslint-import-resolver-node@^0.3.9: + version "0.3.9" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz#d4eaac52b8a2e7c3cd1903eb00f7e053356118ac" + integrity sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g== + dependencies: + debug "^3.2.7" + is-core-module "^2.13.0" + resolve "^1.22.4" + +eslint-module-utils@^2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz#e439fee65fc33f6bba630ff621efc38ec0375c49" + integrity sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw== + dependencies: + debug "^3.2.7" + +eslint-plugin-import@2.29.1: + version "2.29.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz#d45b37b5ef5901d639c15270d74d46d161150643" + integrity sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw== + dependencies: + array-includes "^3.1.7" + array.prototype.findlastindex "^1.2.3" + array.prototype.flat "^1.3.2" + array.prototype.flatmap "^1.3.2" + debug "^3.2.7" + doctrine "^2.1.0" + eslint-import-resolver-node "^0.3.9" + eslint-module-utils "^2.8.0" + hasown "^2.0.0" + is-core-module "^2.13.1" + is-glob "^4.0.3" + minimatch "^3.1.2" + object.fromentries "^2.0.7" + object.groupby "^1.0.1" + object.values "^1.1.7" + semver "^6.3.1" + tsconfig-paths "^3.15.0" + +eslint-plugin-jest@27.6.3: + version "27.6.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-27.6.3.tgz#8acb8b1e45597fe1f4d4cf25163d90119efc12be" + integrity sha512-+YsJFVH6R+tOiO3gCJon5oqn4KWc+mDq2leudk8mrp8RFubLOo9CVyi3cib4L7XMpxExmkmBZQTPDYVBzgpgOA== + dependencies: + "@typescript-eslint/utils" "^5.10.0" + +eslint-plugin-prettier-doc@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier-doc/-/eslint-plugin-prettier-doc-1.1.0.tgz#ebf679b480e6048e90d5b152e6043714780bb4e6" + integrity sha512-ytzztiiqobTeYLqdRnv+dgowcb63gFFy31RekPeVPB6YOshwuGKJVKPdkq/mYtwsJ+eDtLiHksfwH5/M5nU09g== -html-encoding-sniffer@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" +eslint-plugin-prettier@5.1.3: + version "5.1.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz#17cfade9e732cef32b5f5be53bd4e07afd8e67e1" + integrity sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw== dependencies: - whatwg-encoding "^1.0.1" + prettier-linter-helpers "^1.0.0" + synckit "^0.8.6" -html-tag-names@1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/html-tag-names/-/html-tag-names-1.1.2.tgz#f65168964c5a9c82675efda882875dcb2a875c22" +eslint-scope@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" -http-signature@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" +eslint-scope@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== dependencies: - assert-plus "^0.2.0" - jsprim "^1.2.2" - sshpk "^1.7.0" + esrecurse "^4.3.0" + estraverse "^5.2.0" -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" +eslint-utils@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" + integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" + eslint-visitor-keys "^2.0.0" -iconv-lite@0.4.19: - version "0.4.19" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" +eslint-visitor-keys@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" + integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== + +eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== + +eslint@8.57.0: + version "8.57.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.57.0.tgz#c786a6fd0e0b68941aaf624596fb987089195668" + integrity sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.6.1" + "@eslint/eslintrc" "^2.1.4" + "@eslint/js" "8.57.0" + "@humanwhocodes/config-array" "^0.11.14" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" + "@ungap/structured-clone" "^1.2.0" + ajv "^6.12.4" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.2.2" + eslint-visitor-keys "^3.4.3" + espree "^9.6.1" + esquery "^1.4.2" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + find-up "^5.0.0" + glob-parent "^6.0.2" + globals "^13.19.0" + graphemer "^1.4.0" + ignore "^5.2.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + is-path-inside "^3.0.3" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.3" + strip-ansi "^6.0.1" + text-table "^0.2.0" -iconv-lite@^0.4.17: - version "0.4.21" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.21.tgz#c47f8733d02171189ebc4a400f3218d348094798" +espree@^9.6.0, espree@^9.6.1: + version "9.6.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== dependencies: - safer-buffer "^2.1.0" - -ignore@3.3.7, ignore@^3.3.3: - version "3.3.7" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" + acorn "^8.9.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.4.1" -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -indexes-of@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" +esquery@^1.4.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" + integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== + dependencies: + estraverse "^5.1.0" -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== dependencies: - once "^1.3.0" - wrappy "1" + estraverse "^5.2.0" -inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" +estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== -ini@~1.3.0: - version "1.3.5" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== -inquirer@^3.0.6: - version "3.3.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" - dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.0" - cli-cursor "^2.1.0" - cli-width "^2.0.0" - external-editor "^2.0.4" - figures "^2.0.0" - lodash "^4.3.0" - mute-stream "0.0.7" - run-async "^2.2.0" - rx-lite "^4.0.8" - rx-lite-aggregates "^4.0.8" - string-width "^2.1.0" - strip-ansi "^4.0.0" - through "^2.3.6" - -invariant@^2.2.2: - version "2.2.4" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" - dependencies: - loose-envify "^1.0.0" - -invert-kv@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" +estree-walker@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" + integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== -is-accessor-descriptor@^0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" - dependencies: - kind-of "^3.0.2" +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -is-accessor-descriptor@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" - dependencies: - kind-of "^6.0.0" +execa@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + +exit-x@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/exit-x/-/exit-x-0.2.2.tgz#1f9052de3b8d99a696b10dad5bced9bdd5c3aa64" + integrity sha512-+I6B/IkJc1o/2tiURyz/ivu/O0nKNEArIUB5O7zBrlDVJr22SCLH3xTeEry428LvFhRzIA1g8izguxJ/gbNcVQ== + +expect@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/expect/-/expect-30.0.3.tgz#8bf31a67514f78c5e4ac8d67774192ab95d5ec25" + integrity sha512-HXg6NvK35/cSYZCUKAtmlgCFyqKM4frEPbzrav5hRqb0GMz0E0lS5hfzYjSaiaE5ysnp/qI2aeZkeyeIAOeXzQ== + dependencies: + "@jest/expect-utils" "30.0.3" + "@jest/get-type" "30.0.1" + jest-matcher-utils "30.0.3" + jest-message-util "30.0.2" + jest-mock "30.0.2" + jest-util "30.0.2" + +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -is-alphabetical@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-alphabetical/-/is-alphabetical-1.0.1.tgz#c77079cc91d4efac775be1034bf2d243f95e6f08" +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== -is-alphanumerical@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-alphanumerical/-/is-alphanumerical-1.0.1.tgz#dfb4aa4d1085e33bdb61c2dee9c80e9c6c19f53b" +fast-glob@^3.2.9: + version "3.2.11" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9" + integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew== dependencies: - is-alphabetical "^1.0.0" - is-decimal "^1.0.0" + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" +fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== -is-buffer@^1.1.4, is-buffer@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" +fast-levenshtein@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= -is-builtin-module@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" +fastq@^1.6.0: + version "1.13.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" + integrity sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw== dependencies: - builtin-modules "^1.0.0" + reusify "^1.0.4" -is-ci@^1.0.10: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.1.0.tgz#247e4162e7860cebbdaf30b774d6b0ac7dcfe7a5" +fb-watchman@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" + integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== dependencies: - ci-info "^1.0.0" + bser "2.1.1" -is-data-descriptor@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: - kind-of "^3.0.2" + flat-cache "^3.0.4" -is-data-descriptor@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== dependencies: - kind-of "^6.0.0" + to-regex-range "^5.0.1" -is-decimal@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-decimal/-/is-decimal-1.0.1.tgz#f5fb6a94996ad9e8e3761fbfbd091f1fca8c4e82" - -is-descriptor@^0.1.0: - version "0.1.6" - resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== dependencies: - is-accessor-descriptor "^0.1.6" - is-data-descriptor "^0.1.4" - kind-of "^5.0.0" + to-regex-range "^5.0.1" -is-descriptor@^1.0.0, is-descriptor@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" +find-up@^4.0.0, find-up@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== dependencies: - is-accessor-descriptor "^1.0.0" - is-data-descriptor "^1.0.0" - kind-of "^6.0.2" - -is-directory@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" - -is-dotfile@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + locate-path "^5.0.0" + path-exists "^4.0.0" -is-equal-shallow@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== dependencies: - is-primitive "^2.0.0" + locate-path "^6.0.0" + path-exists "^4.0.0" -is-extendable@^0.1.0, is-extendable@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" - -is-extendable@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== dependencies: - is-plain-object "^2.0.4" + flatted "^3.1.0" + rimraf "^3.0.2" -is-extglob@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" +flatted@^3.1.0: + version "3.2.5" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.5.tgz#76c8584f4fc843db64702a6bd04ab7a8bd666da3" + integrity sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg== -is-finite@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" +for-each@^0.3.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" + integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw== dependencies: - number-is-nan "^1.0.0" + is-callable "^1.1.3" -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" +foreground-child@^3.1.0: + version "3.3.1" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.1.tgz#32e8e9ed1b68a3497befb9ac2b6adf92a638576f" + integrity sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw== dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + cross-spawn "^7.0.6" + signal-exit "^4.0.1" -is-glob@^2.0.0, is-glob@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" +foreground-child@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.1.1.tgz#1d173e776d75d2772fed08efe4a0de1ea1b12d0d" + integrity sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg== dependencies: - is-extglob "^1.0.0" + cross-spawn "^7.0.0" + signal-exit "^4.0.1" -is-hexadecimal@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-hexadecimal/-/is-hexadecimal-1.0.1.tgz#6e084bbc92061fbb0971ec58b6ce6d404e24da69" - -is-my-ip-valid@^1.0.0: +fs.realpath@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz#7b351b8e8edd4d3995d4d066680e664d94696824" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -is-my-json-valid@^2.16.0: - version "2.17.2" - resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz#6b2103a288e94ef3de5cf15d29dd85fc4b78d65c" - dependencies: - generate-function "^2.0.0" - generate-object-property "^1.1.0" - is-my-ip-valid "^1.0.0" - jsonpointer "^4.0.0" - xtend "^4.0.0" +fsevents@^2.3.3, fsevents@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== -is-number@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" - dependencies: - kind-of "^3.0.2" +function-bind@^1.1.1, function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== -is-number@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" +function.prototype.name@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.6.tgz#cdf315b7d90ee77a4c6ee216c3c3362da07533fd" + integrity sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg== dependencies: - kind-of "^3.0.2" + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + functions-have-names "^1.2.3" -is-number@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" +functions-have-names@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" + integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== -is-odd@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-odd/-/is-odd-2.0.0.tgz#7646624671fd7ea558ccd9a2795182f2958f1b24" - dependencies: - is-number "^4.0.0" +gensync@^1.0.0-beta.2: + version "1.0.0-beta.2" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" + integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== -is-path-cwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" +get-caller-file@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -is-path-in-cwd@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz#5ac48b345ef675339bd6c7a48a912110b241cf52" +get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.3.tgz#063c84329ad93e83893c7f4f243ef63ffa351385" + integrity sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A== dependencies: - is-path-inside "^1.0.0" + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.3" -is-path-inside@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" +get-intrinsic@^1.2.0, get-intrinsic@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.1.tgz#d295644fed4505fc9cde952c37ee12b477a83d82" + integrity sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw== dependencies: - path-is-inside "^1.0.1" - -is-plain-obj@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + function-bind "^1.1.1" + has "^1.0.3" + has-proto "^1.0.1" + has-symbols "^1.0.3" -is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" +get-intrinsic@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.2.tgz#281b7622971123e1ef4b3c90fd7539306da93f3b" + integrity sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA== dependencies: - isobject "^3.0.1" + function-bind "^1.1.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" -is-posix-bracket@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" - -is-primitive@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" - -is-promise@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" - -is-property@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" - -is-resolvable@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" - -is-stream@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - -is-typedarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - -is-utf8@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" - -is-whitespace-character@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-whitespace-character/-/is-whitespace-character-1.0.1.tgz#9ae0176f3282b65457a1992cdb084f8a5f833e3b" - -is-windows@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" +get-package-type@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" + integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== -is-word-character@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-word-character/-/is-word-character-1.0.1.tgz#5a03fa1ea91ace8a6eb0c7cd770eb86d65c8befb" +get-stream@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== -isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: +get-symbol-description@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - -isobject@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" - dependencies: - isarray "1.0.0" - -isobject@^3.0.0, isobject@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" - -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - -istanbul-api@^1.1.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/istanbul-api/-/istanbul-api-1.3.1.tgz#4c3b05d18c0016d1022e079b98dc82c40f488954" - dependencies: - async "^2.1.4" - compare-versions "^3.1.0" - fileset "^2.0.2" - istanbul-lib-coverage "^1.2.0" - istanbul-lib-hook "^1.2.0" - istanbul-lib-instrument "^1.10.1" - istanbul-lib-report "^1.1.4" - istanbul-lib-source-maps "^1.2.4" - istanbul-reports "^1.3.0" - js-yaml "^3.7.0" - mkdirp "^0.5.1" - once "^1.4.0" - -istanbul-lib-coverage@^1.0.1, istanbul-lib-coverage@^1.1.2, istanbul-lib-coverage@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.2.0.tgz#f7d8f2e42b97e37fe796114cb0f9d68b5e3a4341" - -istanbul-lib-hook@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.2.0.tgz#ae556fd5a41a6e8efa0b1002b1e416dfeaf9816c" + resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" + integrity sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw== dependencies: - append-transform "^0.4.0" + call-bind "^1.0.2" + get-intrinsic "^1.1.1" -istanbul-lib-instrument@^1.10.1, istanbul-lib-instrument@^1.4.2, istanbul-lib-instrument@^1.7.5: - version "1.10.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.10.1.tgz#724b4b6caceba8692d3f1f9d0727e279c401af7b" +glob-parent@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: - babel-generator "^6.18.0" - babel-template "^6.16.0" - babel-traverse "^6.18.0" - babel-types "^6.18.0" - babylon "^6.18.0" - istanbul-lib-coverage "^1.2.0" - semver "^5.3.0" + is-glob "^4.0.1" -istanbul-lib-report@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.1.4.tgz#e886cdf505c4ebbd8e099e4396a90d0a28e2acb5" +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== dependencies: - istanbul-lib-coverage "^1.2.0" - mkdirp "^0.5.1" - path-parse "^1.0.5" - supports-color "^3.1.2" + is-glob "^4.0.3" -istanbul-lib-source-maps@^1.1.0: - version "1.2.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.3.tgz#20fb54b14e14b3fb6edb6aca3571fd2143db44e6" +glob@^10.3.10, glob@^10.4.1: + version "10.4.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956" + integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== dependencies: - debug "^3.1.0" - istanbul-lib-coverage "^1.1.2" - mkdirp "^0.5.1" - rimraf "^2.6.1" - source-map "^0.5.3" + foreground-child "^3.1.0" + jackspeak "^3.1.2" + minimatch "^9.0.4" + minipass "^7.1.2" + package-json-from-dist "^1.0.0" + path-scurry "^1.11.1" -istanbul-lib-source-maps@^1.2.4: - version "1.2.4" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.4.tgz#cc7ccad61629f4efff8e2f78adb8c522c9976ec7" +glob@^7.1.3, glob@^7.1.4: + version "7.2.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" + integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== dependencies: - debug "^3.1.0" - istanbul-lib-coverage "^1.2.0" - mkdirp "^0.5.1" - rimraf "^2.6.1" - source-map "^0.5.3" + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" -istanbul-reports@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.3.0.tgz#2f322e81e1d9520767597dca3c20a0cce89a3554" +glob@^8.0.3: + version "8.1.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" + integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== dependencies: - handlebars "^4.0.3" - -iterall@^1.2.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.2.2.tgz#92d70deb8028e0c39ff3164fdbf4d8b088130cd7" - -jest-changed-files@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-21.2.0.tgz#5dbeecad42f5d88b482334902ce1cba6d9798d29" - dependencies: - throat "^4.0.0" - -jest-cli@^21.1.0: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-21.2.1.tgz#9c528b6629d651911138d228bdb033c157ec8c00" - dependencies: - ansi-escapes "^3.0.0" - chalk "^2.0.1" - glob "^7.1.2" - graceful-fs "^4.1.11" - is-ci "^1.0.10" - istanbul-api "^1.1.1" - istanbul-lib-coverage "^1.0.1" - istanbul-lib-instrument "^1.4.2" - istanbul-lib-source-maps "^1.1.0" - jest-changed-files "^21.2.0" - jest-config "^21.2.1" - jest-environment-jsdom "^21.2.1" - jest-haste-map "^21.2.0" - jest-message-util "^21.2.1" - jest-regex-util "^21.2.0" - jest-resolve-dependencies "^21.2.0" - jest-runner "^21.2.1" - jest-runtime "^21.2.1" - jest-snapshot "^21.2.1" - jest-util "^21.2.1" - micromatch "^2.3.11" - node-notifier "^5.0.2" - pify "^3.0.0" - slash "^1.0.0" - string-length "^2.0.0" - strip-ansi "^4.0.0" - which "^1.2.12" - worker-farm "^1.3.1" - yargs "^9.0.0" - -jest-config@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-21.2.1.tgz#c7586c79ead0bcc1f38c401e55f964f13bf2a480" - dependencies: - chalk "^2.0.1" - glob "^7.1.1" - jest-environment-jsdom "^21.2.1" - jest-environment-node "^21.2.1" - jest-get-type "^21.2.0" - jest-jasmine2 "^21.2.1" - jest-regex-util "^21.2.0" - jest-resolve "^21.2.0" - jest-util "^21.2.1" - jest-validate "^21.2.1" - pretty-format "^21.2.1" - -jest-diff@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-21.2.1.tgz#46cccb6cab2d02ce98bc314011764bb95b065b4f" - dependencies: - chalk "^2.0.1" - diff "^3.2.0" - jest-get-type "^21.2.0" - pretty-format "^21.2.1" - -jest-docblock@22.2.2: - version "22.2.2" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-22.2.2.tgz#617f13edb16ec64202002b3c336cd14ae36c0631" - dependencies: - detect-newline "^2.1.0" - -jest-docblock@^21.0.0, jest-docblock@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" - -jest-environment-jsdom@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-21.2.1.tgz#38d9980c8259b2a608ec232deee6289a60d9d5b4" - dependencies: - jest-mock "^21.2.0" - jest-util "^21.2.1" - jsdom "^9.12.0" - -jest-environment-node@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-21.2.1.tgz#98c67df5663c7fbe20f6e792ac2272c740d3b8c8" - dependencies: - jest-mock "^21.2.0" - jest-util "^21.2.1" - -jest-get-type@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-21.2.0.tgz#f6376ab9db4b60d81e39f30749c6c466f40d4a23" - -jest-haste-map@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-21.2.0.tgz#1363f0a8bb4338f24f001806571eff7a4b2ff3d8" - dependencies: - fb-watchman "^2.0.0" - graceful-fs "^4.1.11" - jest-docblock "^21.2.0" - micromatch "^2.3.11" - sane "^2.0.0" - worker-farm "^1.3.1" - -jest-jasmine2@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-21.2.1.tgz#9cc6fc108accfa97efebce10c4308548a4ea7592" - dependencies: - chalk "^2.0.1" - expect "^21.2.1" - graceful-fs "^4.1.11" - jest-diff "^21.2.1" - jest-matcher-utils "^21.2.1" - jest-message-util "^21.2.1" - jest-snapshot "^21.2.1" - p-cancelable "^0.3.0" - -jest-matcher-utils@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-21.2.1.tgz#72c826eaba41a093ac2b4565f865eb8475de0f64" - dependencies: - chalk "^2.0.1" - jest-get-type "^21.2.0" - pretty-format "^21.2.1" - -jest-message-util@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-21.2.1.tgz#bfe5d4692c84c827d1dcf41823795558f0a1acbe" - dependencies: - chalk "^2.0.1" - micromatch "^2.3.11" - slash "^1.0.0" - -jest-mock@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-21.2.0.tgz#7eb0770e7317968165f61ea2a7281131534b3c0f" - -jest-regex-util@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-21.2.0.tgz#1b1e33e63143babc3e0f2e6c9b5ba1eb34b2d530" - -jest-resolve-dependencies@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-21.2.0.tgz#9e231e371e1a736a1ad4e4b9a843bc72bfe03d09" - dependencies: - jest-regex-util "^21.2.0" - -jest-resolve@^21.2.0: - version "21.2.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-21.2.0.tgz#068913ad2ba6a20218e5fd32471f3874005de3a6" - dependencies: - browser-resolve "^1.11.2" - chalk "^2.0.1" - is-builtin-module "^1.0.0" - -jest-runner-eslint@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/jest-runner-eslint/-/jest-runner-eslint-0.3.0.tgz#ad6461ddac9826292ccfbcbe551ec7eda1053ef6" - dependencies: - cosmiconfig "^3.0.1" - eslint "4.5.0" - find-up "^2.1.0" - pify "3.0.0" - throat "4.1.0" - worker-farm "1.5.0" - -jest-runner@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-21.2.1.tgz#194732e3e518bfb3d7cbfc0fd5871246c7e1a467" - dependencies: - jest-config "^21.2.1" - jest-docblock "^21.2.0" - jest-haste-map "^21.2.0" - jest-jasmine2 "^21.2.1" - jest-message-util "^21.2.1" - jest-runtime "^21.2.1" - jest-util "^21.2.1" - pify "^3.0.0" - throat "^4.0.0" - worker-farm "^1.3.1" - -jest-runtime@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-21.2.1.tgz#99dce15309c670442eee2ebe1ff53a3cbdbbb73e" - dependencies: - babel-core "^6.0.0" - babel-jest "^21.2.0" - babel-plugin-istanbul "^4.0.0" - chalk "^2.0.1" - convert-source-map "^1.4.0" - graceful-fs "^4.1.11" - jest-config "^21.2.1" - jest-haste-map "^21.2.0" - jest-regex-util "^21.2.0" - jest-resolve "^21.2.0" - jest-util "^21.2.1" - json-stable-stringify "^1.0.1" - micromatch "^2.3.11" - slash "^1.0.0" - strip-bom "3.0.0" - write-file-atomic "^2.1.0" - yargs "^9.0.0" - -jest-snapshot@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-21.2.1.tgz#29e49f16202416e47343e757e5eff948c07fd7b0" - dependencies: - chalk "^2.0.1" - jest-diff "^21.2.1" - jest-matcher-utils "^21.2.1" - mkdirp "^0.5.1" - natural-compare "^1.4.0" - pretty-format "^21.2.1" + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^5.0.1" + once "^1.3.0" -jest-util@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-21.2.1.tgz#a274b2f726b0897494d694a6c3d6a61ab819bb78" - dependencies: - callsites "^2.0.0" - chalk "^2.0.1" - graceful-fs "^4.1.11" - jest-message-util "^21.2.1" - jest-mock "^21.2.0" - jest-validate "^21.2.1" - mkdirp "^0.5.1" +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -jest-validate@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-21.2.1.tgz#cc0cbca653cd54937ba4f2a111796774530dd3c7" +globals@^13.19.0: + version "13.19.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.19.0.tgz#7a42de8e6ad4f7242fbcca27ea5b23aca367b5c8" + integrity sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ== dependencies: - chalk "^2.0.1" - jest-get-type "^21.2.0" - leven "^2.1.0" - pretty-format "^21.2.1" + type-fest "^0.20.2" -jest@21.1.0: - version "21.1.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-21.1.0.tgz#77c7baa8aa9e8bace7fe41a30d748ab56e89476a" +globalthis@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf" + integrity sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA== dependencies: - jest-cli "^21.1.0" + define-properties "^1.1.3" -js-base64@^2.1.9: - version "2.4.3" - resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.4.3.tgz#2e545ec2b0f2957f41356510205214e98fad6582" - -js-tokens@^3.0.0, js-tokens@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" - -js-yaml@^3.10.0, js-yaml@^3.7.0, js-yaml@^3.8.4, js-yaml@^3.9.0, js-yaml@^3.9.1: - version "3.11.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef" +globby@^11.0.4: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - -jsdom@^9.12.0: - version "9.12.0" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.12.0.tgz#e8c546fffcb06c00d4833ca84410fed7f8a097d4" - dependencies: - abab "^1.0.3" - acorn "^4.0.4" - acorn-globals "^3.1.0" - array-equal "^1.0.0" - content-type-parser "^1.0.1" - cssom ">= 0.3.2 < 0.4.0" - cssstyle ">= 0.2.37 < 0.3.0" - escodegen "^1.6.1" - html-encoding-sniffer "^1.0.1" - nwmatcher ">= 1.3.9 < 2.0.0" - parse5 "^1.5.1" - request "^2.79.0" - sax "^1.2.1" - symbol-tree "^3.2.1" - tough-cookie "^2.3.2" - webidl-conversions "^4.0.0" - whatwg-encoding "^1.0.1" - whatwg-url "^4.3.0" - xml-name-validator "^2.0.1" - -jsesc@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" - -json-parse-better-errors@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" - -json-schema-traverse@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^3.0.0" -json-schema@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" - -json-stable-stringify@1.0.1, json-stable-stringify@^1.0.1: +gopd@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== dependencies: - jsonify "~0.0.0" - -json-stringify-safe@~5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + get-intrinsic "^1.1.3" -json5@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" +graceful-fs@^4.2.11: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== -jsonify@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== -jsonpointer@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" +has-bigints@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113" + integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== -jsprim@^1.2.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.2.3" - verror "1.10.0" +has-bigints@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" + integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== -kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: - version "3.2.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" - dependencies: - is-buffer "^1.1.5" +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== -kind-of@^4.0.0: +has-flag@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" - dependencies: - is-buffer "^1.1.5" - -kind-of@^5.0.0, kind-of@^5.0.2: - version "5.1.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" - -kind-of@^6.0.0, kind-of@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -lazy-cache@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" - -lcid@^1.0.0: +has-property-descriptors@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz#610708600606d36961ed04c196193b6a607fa861" + integrity sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ== dependencies: - invert-kv "^1.0.0" + get-intrinsic "^1.1.1" -leven@2.1.0, leven@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" +has-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" + integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== -levn@^0.3.0, levn@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" +has-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" + integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== -load-json-file@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" - dependencies: - graceful-fs "^4.1.2" - parse-json "^2.2.0" - pify "^2.0.0" - pinkie-promise "^2.0.0" - strip-bom "^2.0.0" +has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== -load-json-file@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" +has-tostringtag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" + integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== dependencies: - graceful-fs "^4.1.2" - parse-json "^2.2.0" - pify "^2.0.0" - strip-bom "^3.0.0" + has-symbols "^1.0.2" -load-json-file@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" +has@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.4.tgz#2eb2860e000011dae4f1406a86fe80e530fb2ec6" + integrity sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ== + +hasown@^2.0.0, hasown@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== dependencies: - graceful-fs "^4.1.2" - parse-json "^4.0.0" - pify "^3.0.0" - strip-bom "^3.0.0" + function-bind "^1.1.2" -locate-path@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" +html-encoding-sniffer@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz#696df529a7cfd82446369dc5193e590a3735b448" + integrity sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ== dependencies: - p-locate "^2.0.0" - path-exists "^3.0.0" + whatwg-encoding "^3.1.1" -lodash.cond@^4.3.0: - version "4.5.2" - resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" +html-escaper@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" + integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== -lodash.unescape@4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c" +http-proxy-agent@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz#9a8b1f246866c028509486585f62b8f2c18c270e" + integrity sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig== + dependencies: + agent-base "^7.1.0" + debug "^4.3.4" -lodash@^4.14.0, lodash@^4.17.4, lodash@^4.3.0: - version "4.17.5" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" +https-proxy-agent@^7.0.6: + version "7.0.6" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz#da8dfeac7da130b05c2ba4b59c9b6cd66611a6b9" + integrity sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw== + dependencies: + agent-base "^7.1.2" + debug "4" -longest@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" +human-signals@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== -loose-envify@^1.0.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" +iconv-lite@0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== dependencies: - js-tokens "^3.0.0" + safer-buffer ">= 2.1.2 < 3.0.0" -lru-cache@^4.0.1, lru-cache@^4.1.1: - version "4.1.2" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.2.tgz#45234b2e6e2f2b33da125624c4664929a0224c3f" - dependencies: - pseudomap "^1.0.2" - yallist "^2.1.2" +ignore@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" + integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== -makeerror@1.0.x: - version "1.0.11" - resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" +import-fresh@^3.2.1: + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== dependencies: - tmpl "1.0.x" - -map-cache@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + parent-module "^1.0.0" + resolve-from "^4.0.0" -map-visit@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" +import-local@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.2.0.tgz#c3d5c745798c02a6f8b897726aba5100186ee260" + integrity sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA== dependencies: - object-visit "^1.0.0" + pkg-dir "^4.2.0" + resolve-cwd "^3.0.0" -markdown-escapes@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/markdown-escapes/-/markdown-escapes-1.0.1.tgz#1994df2d3af4811de59a6714934c2b2292734518" +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= -mem@1.1.0, mem@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== dependencies: - mimic-fn "^1.0.0" + once "^1.3.0" + wrappy "1" -merge@^1.1.3: - version "1.2.0" - resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da" - -micromatch@^2.3.11: - version "2.3.11" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" - dependencies: - arr-diff "^2.0.0" - array-unique "^0.2.1" - braces "^1.8.2" - expand-brackets "^0.1.4" - extglob "^0.3.1" - filename-regex "^2.0.0" - is-extglob "^1.0.0" - is-glob "^2.0.1" - kind-of "^3.0.2" - normalize-path "^2.0.1" - object.omit "^2.0.0" - parse-glob "^3.0.4" - regex-cache "^0.4.2" - -micromatch@^3.1.4, micromatch@^3.1.8: - version "3.1.10" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - braces "^2.3.1" - define-property "^2.0.2" - extend-shallow "^3.0.2" - extglob "^2.0.4" - fragment-cache "^0.2.1" - kind-of "^6.0.2" - nanomatch "^1.2.9" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.2" - -mime-db@~1.33.0: - version "1.33.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db" - -mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.7: - version "2.1.18" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8" - dependencies: - mime-db "~1.33.0" - -mimic-fn@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -minimatch@3.0.4, minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" +internal-slot@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.5.tgz#f2a2ee21f668f8627a4667f309dc0f4fb6674986" + integrity sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ== dependencies: - brace-expansion "^1.1.7" + get-intrinsic "^1.2.0" + has "^1.0.3" + side-channel "^1.0.4" -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" +is-array-buffer@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.1.tgz#deb1db4fcae48308d54ef2442706c0393997052a" + integrity sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.1.3" + is-typed-array "^1.1.10" -minimist@1.2.0, minimist@^1.1.1, minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" +is-array-buffer@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.2.tgz#f2653ced8412081638ecb0ebbd0c41c6e0aecbbe" + integrity sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.2.0" + is-typed-array "^1.1.10" -minimist@~0.0.1: - version "0.0.10" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= -mixin-deep@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" +is-bigint@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.4.tgz#08147a1875bc2b32005d41ccd8291dffc6691df3" + integrity sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg== dependencies: - for-in "^1.0.2" - is-extendable "^1.0.1" + has-bigints "^1.0.1" -"mkdirp@>=0.5 0", mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" +is-boolean-object@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719" + integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== dependencies: - minimist "0.0.8" + call-bind "^1.0.2" + has-tostringtag "^1.0.0" -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - -mute-stream@0.0.7: - version "0.0.7" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" - -nan@^2.3.0: - version "2.10.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f" - -nanomatch@^1.2.9: - version "1.2.9" - resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.9.tgz#879f7150cb2dab7a471259066c104eee6e0fa7c2" - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - define-property "^2.0.2" - extend-shallow "^3.0.2" - fragment-cache "^0.2.1" - is-odd "^2.0.0" - is-windows "^1.0.2" - kind-of "^6.0.2" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.1" +is-callable@^1.1.3, is-callable@^1.2.7: + version "1.2.7" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" + integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" +is-callable@^1.1.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945" + integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w== -node-int64@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" +is-core-module@^2.13.0, is-core-module@^2.16.0: + version "2.16.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" + integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w== + dependencies: + hasown "^2.0.2" -node-notifier@^5.0.2: - version "5.2.1" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.2.1.tgz#fa313dd08f5517db0e2502e5758d664ac69f9dea" - dependencies: - growly "^1.3.0" - semver "^5.4.1" - shellwords "^0.1.1" - which "^1.3.0" - -node-pre-gyp@^0.6.39: - version "0.6.39" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.39.tgz#c00e96860b23c0e1420ac7befc5044e1d78d8649" - dependencies: - detect-libc "^1.0.2" - hawk "3.1.3" - mkdirp "^0.5.1" - nopt "^4.0.1" - npmlog "^4.0.2" - rc "^1.1.7" - request "2.81.0" - rimraf "^2.6.1" - semver "^5.3.0" - tar "^2.2.1" - tar-pack "^3.4.0" - -nopt@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" +is-core-module@^2.13.1: + version "2.13.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" + integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== dependencies: - abbrev "1" - osenv "^0.1.4" + hasown "^2.0.0" -normalize-package-data@^2.3.2: - version "2.4.0" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" +is-date-object@^1.0.1: + version "1.0.5" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f" + integrity sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ== dependencies: - hosted-git-info "^2.1.4" - is-builtin-module "^1.0.0" - semver "2 || 3 || 4 || 5" - validate-npm-package-license "^3.0.1" + has-tostringtag "^1.0.0" -normalize-path@^2.0.1, normalize-path@^2.1.1: +is-extglob@^2.1.1: version "2.1.1" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" - dependencies: - remove-trailing-separator "^1.0.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= -npm-run-path@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" - dependencies: - path-key "^2.0.0" +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== -npmlog@^4.0.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" +is-generator-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== + +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== dependencies: - are-we-there-yet "~1.1.2" - console-control-strings "~1.1.0" - gauge "~2.7.3" - set-blocking "~2.0.0" + is-extglob "^2.1.1" -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" +is-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" + integrity sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g== -"nwmatcher@>= 1.3.9 < 2.0.0": - version "1.4.4" - resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.4.4.tgz#2285631f34a95f0d0395cd900c96ed39b58f346e" +is-negative-zero@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150" + integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== -oauth-sign@~0.8.1, oauth-sign@~0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" +is-number-object@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.6.tgz#6a7aaf838c7f0686a50b4553f7e54a96494e89f0" + integrity sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g== + dependencies: + has-tostringtag "^1.0.0" -object-assign@^4.0.1, object-assign@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== -object-copy@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" - dependencies: - copy-descriptor "^0.1.0" - define-property "^0.2.5" - kind-of "^3.0.3" +is-path-inside@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== -object-visit@^1.0.0: +is-potential-custom-element-name@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" - dependencies: - isobject "^3.0.0" + resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" + integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== -object.omit@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" +is-reference@1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7" + integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ== dependencies: - for-own "^0.1.4" - is-extendable "^0.1.1" + "@types/estree" "*" -object.pick@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" +is-regex@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" + integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== dependencies: - isobject "^3.0.1" + call-bind "^1.0.2" + has-tostringtag "^1.0.0" -once@^1.3.0, once@^1.3.3, once@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" +is-shared-array-buffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz#8f259c573b60b6a32d4058a1a07430c0a7344c79" + integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA== dependencies: - wrappy "1" + call-bind "^1.0.2" -onetime@^2.0.0: +is-stream@^2.0.0: version "2.0.1" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" - dependencies: - mimic-fn "^1.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== -optimist@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" +is-string@^1.0.5, is-string@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" + integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== dependencies: - minimist "~0.0.1" - wordwrap "~0.0.2" + has-tostringtag "^1.0.0" -optionator@^0.8.1, optionator@^0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" +is-symbol@^1.0.2, is-symbol@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" + integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.4" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - wordwrap "~1.0.0" + has-symbols "^1.0.2" -os-homedir@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" +is-typed-array@^1.1.10, is-typed-array@^1.1.9: + version "1.1.10" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.10.tgz#36a5b5cb4189b575d1a3e4b08536bfb485801e3f" + integrity sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.2" + for-each "^0.3.3" + gopd "^1.0.1" + has-tostringtag "^1.0.0" -os-locale@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" +is-typed-array@^1.1.12: + version "1.1.12" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.12.tgz#d0bab5686ef4a76f7a73097b95470ab199c57d4a" + integrity sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg== dependencies: - execa "^0.7.0" - lcid "^1.0.0" - mem "^1.1.0" + which-typed-array "^1.1.11" -os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.2: +is-weakref@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - -osenv@^0.1.4: - version "0.1.5" - resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" + resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.2.tgz#9529f383a9338205e89765e0392efc2f100f06f2" + integrity sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ== dependencies: - os-homedir "^1.0.0" - os-tmpdir "^1.0.0" + call-bind "^1.0.2" -p-cancelable@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-0.3.0.tgz#b9e123800bcebb7ac13a479be195b507b98d30fa" +isarray@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" + integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== -p-finally@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== -p-limit@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c" +istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz#189e7909d0a39fa5a3dfad5b03f71947770191d3" + integrity sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw== + +istanbul-lib-instrument@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.0.tgz#7a8af094cbfff1d5bb280f62ce043695ae8dd5b8" + integrity sha512-x58orMzEVfzPUKqlbLd1hXCnySCxKdDKa6Rjg97CwuLLRI4g3FHTdnExu1OqffVFay6zeMW+T6/DowFLndWnIw== + dependencies: + "@babel/core" "^7.12.3" + "@babel/parser" "^7.14.7" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-coverage "^3.2.0" + semver "^7.5.4" + +istanbul-lib-instrument@^6.0.2: + version "6.0.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz#fa15401df6c15874bcb2105f773325d78c666765" + integrity sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q== + dependencies: + "@babel/core" "^7.23.9" + "@babel/parser" "^7.23.9" + "@istanbuljs/schema" "^0.1.3" + istanbul-lib-coverage "^3.2.0" + semver "^7.5.4" + +istanbul-lib-report@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#7518fe52ea44de372f460a76b5ecda9ffb73d8a6" + integrity sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw== dependencies: - p-try "^1.0.0" + istanbul-lib-coverage "^3.0.0" + make-dir "^3.0.0" + supports-color "^7.1.0" -p-locate@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" +istanbul-lib-report@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" + integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== dependencies: - p-limit "^1.1.0" - -p-try@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + istanbul-lib-coverage "^3.0.0" + make-dir "^4.0.0" + supports-color "^7.1.0" -parse-entities@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-1.1.1.tgz#8112d88471319f27abae4d64964b122fe4e1b890" +istanbul-lib-source-maps@^5.0.0: + version "5.0.6" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz#acaef948df7747c8eb5fbf1265cb980f6353a441" + integrity sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A== dependencies: - character-entities "^1.0.0" - character-entities-legacy "^1.0.0" - character-reference-invalid "^1.0.0" - is-alphanumerical "^1.0.0" - is-decimal "^1.0.0" - is-hexadecimal "^1.0.0" + "@jridgewell/trace-mapping" "^0.3.23" + debug "^4.1.1" + istanbul-lib-coverage "^3.0.0" -parse-glob@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" +istanbul-reports@^3.1.3: + version "3.1.4" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.4.tgz#1b6f068ecbc6c331040aab5741991273e609e40c" + integrity sha512-r1/DshN4KSE7xWEknZLLLLDn5CJybV3nw01VTkp6D5jzLuELlcbudfj/eSQFvrKsJuTVCGnePO7ho82Nw9zzfw== dependencies: - glob-base "^0.3.0" - is-dotfile "^1.0.0" - is-extglob "^1.0.0" - is-glob "^2.0.0" + html-escaper "^2.0.0" + istanbul-lib-report "^3.0.0" -parse-json@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" +istanbul-reports@^3.1.6: + version "3.1.6" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.6.tgz#2544bcab4768154281a2f0870471902704ccaa1a" + integrity sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg== dependencies: - error-ex "^1.2.0" + html-escaper "^2.0.0" + istanbul-lib-report "^3.0.0" -parse-json@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-3.0.0.tgz#fa6f47b18e23826ead32f263e744d0e1e847fb13" +jackspeak@^3.1.2: + version "3.4.3" + resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a" + integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw== dependencies: - error-ex "^1.3.1" + "@isaacs/cliui" "^8.0.2" + optionalDependencies: + "@pkgjs/parseargs" "^0.11.0" + +jest-changed-files@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-30.0.2.tgz#2c275263037f8f291b71cbb0a4f639c519ab7eb8" + integrity sha512-Ius/iRST9FKfJI+I+kpiDh8JuUlAISnRszF9ixZDIqJF17FckH5sOzKC8a0wd0+D+8em5ADRHA5V5MnfeDk2WA== + dependencies: + execa "^5.1.1" + jest-util "30.0.2" + p-limit "^3.1.0" + +jest-circus@30.0.3, jest-circus@^30.0.0: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-30.0.3.tgz#d2de4adb92cfdbce18668e27176c1b9f79afdf5a" + integrity sha512-rD9qq2V28OASJHJWDRVdhoBdRs6k3u3EmBzDYcyuMby8XCO3Ll1uq9kyqM41ZcC4fMiPulMVh3qMw0cBvDbnyg== + dependencies: + "@jest/environment" "30.0.2" + "@jest/expect" "30.0.3" + "@jest/test-result" "30.0.2" + "@jest/types" "30.0.1" + "@types/node" "*" + chalk "^4.1.2" + co "^4.6.0" + dedent "^1.6.0" + is-generator-fn "^2.1.0" + jest-each "30.0.2" + jest-matcher-utils "30.0.3" + jest-message-util "30.0.2" + jest-runtime "30.0.3" + jest-snapshot "30.0.3" + jest-util "30.0.2" + p-limit "^3.1.0" + pretty-format "30.0.2" + pure-rand "^7.0.0" + slash "^3.0.0" + stack-utils "^2.0.6" + +jest-cli@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-30.0.3.tgz#2340b69c580c471fd9f4a197f969025a545608dd" + integrity sha512-UWDSj0ayhumEAxpYRlqQLrssEi29kdQ+kddP94AuHhZknrE+mT0cR0J+zMHKFe9XPfX3dKQOc2TfWki3WhFTsA== + dependencies: + "@jest/core" "30.0.3" + "@jest/test-result" "30.0.2" + "@jest/types" "30.0.1" + chalk "^4.1.2" + exit-x "^0.2.2" + import-local "^3.2.0" + jest-config "30.0.3" + jest-util "30.0.2" + jest-validate "30.0.2" + yargs "^17.7.2" + +jest-config@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-30.0.3.tgz#978853722b9b0f2d0596025ea423cc6c7b603c07" + integrity sha512-j0L4oRCtJwNyZktXIqwzEiDVQXBbQ4dqXuLD/TZdn++hXIcIfZmjHgrViEy5s/+j4HvITmAXbexVZpQ/jnr0bg== + dependencies: + "@babel/core" "^7.27.4" + "@jest/get-type" "30.0.1" + "@jest/pattern" "30.0.1" + "@jest/test-sequencer" "30.0.2" + "@jest/types" "30.0.1" + babel-jest "30.0.2" + chalk "^4.1.2" + ci-info "^4.2.0" + deepmerge "^4.3.1" + glob "^10.3.10" + graceful-fs "^4.2.11" + jest-circus "30.0.3" + jest-docblock "30.0.1" + jest-environment-node "30.0.2" + jest-regex-util "30.0.1" + jest-resolve "30.0.2" + jest-runner "30.0.3" + jest-util "30.0.2" + jest-validate "30.0.2" + micromatch "^4.0.8" + parse-json "^5.2.0" + pretty-format "30.0.2" + slash "^3.0.0" + strip-json-comments "^3.1.1" + +jest-diff@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-30.0.3.tgz#50ac056b90fe9151d6266b18a27adeb064c30235" + integrity sha512-Q1TAV0cUcBTic57SVnk/mug0/ASyAqtSIOkr7RAlxx97llRYsM74+E8N5WdGJUlwCKwgxPAkVjKh653h1+HA9A== + dependencies: + "@jest/diff-sequences" "30.0.1" + "@jest/get-type" "30.0.1" + chalk "^4.1.2" + pretty-format "30.0.2" + +jest-docblock@30.0.1: + version "30.0.1" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-30.0.1.tgz#545ff59f2fa88996bd470dba7d3798a8421180b1" + integrity sha512-/vF78qn3DYphAaIc3jy4gA7XSAz167n9Bm/wn/1XhTLW7tTBIzXtCJpb/vcmc73NIIeeohCbdL94JasyXUZsGA== + dependencies: + detect-newline "^3.1.0" + +jest-each@30.0.2, jest-each@^30.0.0: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-30.0.2.tgz#402e189784715f5c76f1bb97c29842e79abe99a1" + integrity sha512-ZFRsTpe5FUWFQ9cWTMguCaiA6kkW5whccPy9JjD1ezxh+mJeqmz8naL8Fl/oSbNJv3rgB0x87WBIkA5CObIUZQ== + dependencies: + "@jest/get-type" "30.0.1" + "@jest/types" "30.0.1" + chalk "^4.1.2" + jest-util "30.0.2" + pretty-format "30.0.2" + +jest-environment-jsdom@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-30.0.2.tgz#8f0eb3544ba5abb8de71a2be42b5a95f04485e91" + integrity sha512-lwMpe7hZ81e2PpHj+4nowAzSkC0p8ftRfzC+qEjav9p5ElCs6LAce3y46iLwMS27oL9+/KQe55gUvUDwrlDeJQ== + dependencies: + "@jest/environment" "30.0.2" + "@jest/environment-jsdom-abstract" "30.0.2" + "@types/jsdom" "^21.1.7" + "@types/node" "*" + jsdom "^26.1.0" -parse-json@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" +jest-environment-node@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-30.0.2.tgz#3c24d6becb505f344f52cddb15ea506cf3288543" + integrity sha512-XsGtZ0H+a70RsxAQkKuIh0D3ZlASXdZdhpOSBq9WRPq6lhe0IoQHGW0w9ZUaPiZQ/CpkIdprvlfV1QcXcvIQLQ== dependencies: - error-ex "^1.3.1" - json-parse-better-errors "^1.0.1" + "@jest/environment" "30.0.2" + "@jest/fake-timers" "30.0.2" + "@jest/types" "30.0.1" + "@types/node" "*" + jest-mock "30.0.2" + jest-util "30.0.2" + jest-validate "30.0.2" -parse5@3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-3.0.3.tgz#042f792ffdd36851551cf4e9e066b3874ab45b5c" +jest-haste-map@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-30.0.2.tgz#83826e7e352fa139dc95100337aff4de58c99453" + integrity sha512-telJBKpNLeCb4MaX+I5k496556Y2FiKR/QLZc0+MGBYl4k3OO0472drlV2LUe7c1Glng5HuAu+5GLYp//GpdOQ== dependencies: + "@jest/types" "30.0.1" "@types/node" "*" + anymatch "^3.1.3" + fb-watchman "^2.0.2" + graceful-fs "^4.2.11" + jest-regex-util "30.0.1" + jest-util "30.0.2" + jest-worker "30.0.2" + micromatch "^4.0.8" + walker "^1.0.8" + optionalDependencies: + fsevents "^2.3.3" + +jest-leak-detector@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-30.0.2.tgz#da4df660615d170136d2b468af3bf1c9bff0137e" + integrity sha512-U66sRrAYdALq+2qtKffBLDWsQ/XoNNs2Lcr83sc9lvE/hEpNafJlq2lXCPUBMNqamMECNxSIekLfe69qg4KMIQ== + dependencies: + "@jest/get-type" "30.0.1" + pretty-format "30.0.2" + +jest-light-runner@^0.7.9: + version "0.7.9" + resolved "https://registry.yarnpkg.com/jest-light-runner/-/jest-light-runner-0.7.9.tgz#ba899ec712e52fd0c239d3846bfc061ccdc028b2" + integrity sha512-KlgZvwca6IlRYtpmy+fdgEAi+LP+TjqH96TrAw+56wF8A3JZpW/IzWaukqB4vPVcG8v4y7EF0AMJgZ8u4H6Yew== + dependencies: + "@jest/expect" "^30.0.0" + "@jest/fake-timers" "^30.0.0" + jest-circus "^30.0.0" + jest-each "^30.0.0" + jest-mock "^30.0.0" + jest-snapshot "^30.0.0" + p-limit "^6.2.0" + supports-color "^9.2.1" + tinypool "0.8.4" + +jest-matcher-utils@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-30.0.3.tgz#e07e4776bade71a3a7948a9bf8aeede311c5013a" + integrity sha512-hMpVFGFOhYmIIRGJ0HgM9htC5qUiJ00famcc9sRFchJJiLZbbVKrAztcgE6VnXLRxA3XZ0bvNA7hQWh3oHXo/A== + dependencies: + "@jest/get-type" "30.0.1" + chalk "^4.1.2" + jest-diff "30.0.3" + pretty-format "30.0.2" + +jest-message-util@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-30.0.2.tgz#9dfdc37570d172f0ffdc42a0318036ff4008837f" + integrity sha512-vXywcxmr0SsKXF/bAD7t7nMamRvPuJkras00gqYeB1V0WllxZrbZ0paRr3XqpFU2sYYjD0qAaG2fRyn/CGZ0aw== + dependencies: + "@babel/code-frame" "^7.27.1" + "@jest/types" "30.0.1" + "@types/stack-utils" "^2.0.3" + chalk "^4.1.2" + graceful-fs "^4.2.11" + micromatch "^4.0.8" + pretty-format "30.0.2" + slash "^3.0.0" + stack-utils "^2.0.6" + +jest-mock@30.0.2, jest-mock@^30.0.0: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-30.0.2.tgz#5e4245f25f6f9532714906cab10a2b9e39eb2183" + integrity sha512-PnZOHmqup/9cT/y+pXIVbbi8ID6U1XHRmbvR7MvUy4SLqhCbwpkmXhLbsWbGewHrV5x/1bF7YDjs+x24/QSvFA== + dependencies: + "@jest/types" "30.0.1" + "@types/node" "*" + jest-util "30.0.2" -parse5@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-1.5.1.tgz#9b7f3b0de32be78dc2401b17573ccaf0f6f59d94" +jest-pnp-resolver@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" + integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== + +jest-regex-util@30.0.1: + version "30.0.1" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-30.0.1.tgz#f17c1de3958b67dfe485354f5a10093298f2a49b" + integrity sha512-jHEQgBXAgc+Gh4g0p3bCevgRCVRkB4VB70zhoAE48gxeSr1hfUOsM/C2WoJgVL7Eyg//hudYENbm3Ne+/dRVVA== + +jest-resolve-dependencies@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-30.0.3.tgz#8278f54a84009028b823f5c1f7033fb968405b2f" + integrity sha512-FlL6u7LiHbF0Oe27k7DHYMq2T2aNpPhxnNo75F7lEtu4A6sSw+TKkNNUGNcVckdFoL0RCWREJsC1HsKDwKRZzQ== + dependencies: + jest-regex-util "30.0.1" + jest-snapshot "30.0.3" + +jest-resolve@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-30.0.2.tgz#4b7c826a35e9657189568e4dafc0ba5f05868cf2" + integrity sha512-q/XT0XQvRemykZsvRopbG6FQUT6/ra+XV6rPijyjT6D0msOyCvR2A5PlWZLd+fH0U8XWKZfDiAgrUNDNX2BkCw== + dependencies: + chalk "^4.1.2" + graceful-fs "^4.2.11" + jest-haste-map "30.0.2" + jest-pnp-resolver "^1.2.3" + jest-util "30.0.2" + jest-validate "30.0.2" + slash "^3.0.0" + unrs-resolver "^1.7.11" + +jest-runner@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-30.0.3.tgz#baa1d5e77655c70cea9aa4138cfb437f6bada607" + integrity sha512-CxYBzu9WStOBBXAKkLXGoUtNOWsiS1RRmUQb6SsdUdTcqVncOau7m8AJ4cW3Mz+YL1O9pOGPSYLyvl8HBdFmkQ== + dependencies: + "@jest/console" "30.0.2" + "@jest/environment" "30.0.2" + "@jest/test-result" "30.0.2" + "@jest/transform" "30.0.2" + "@jest/types" "30.0.1" + "@types/node" "*" + chalk "^4.1.2" + emittery "^0.13.1" + exit-x "^0.2.2" + graceful-fs "^4.2.11" + jest-docblock "30.0.1" + jest-environment-node "30.0.2" + jest-haste-map "30.0.2" + jest-leak-detector "30.0.2" + jest-message-util "30.0.2" + jest-resolve "30.0.2" + jest-runtime "30.0.3" + jest-util "30.0.2" + jest-watcher "30.0.2" + jest-worker "30.0.2" + p-limit "^3.1.0" + source-map-support "0.5.13" + +jest-runtime@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-30.0.3.tgz#1eb112924426e8b90c37f0ea7da1b51966e252bf" + integrity sha512-Xjosq0C48G9XEQOtmgrjXJwPaUPaq3sPJwHDRaiC+5wi4ZWxO6Lx6jNkizK/0JmTulVNuxP8iYwt77LGnfg3/w== + dependencies: + "@jest/environment" "30.0.2" + "@jest/fake-timers" "30.0.2" + "@jest/globals" "30.0.3" + "@jest/source-map" "30.0.1" + "@jest/test-result" "30.0.2" + "@jest/transform" "30.0.2" + "@jest/types" "30.0.1" + "@types/node" "*" + chalk "^4.1.2" + cjs-module-lexer "^2.1.0" + collect-v8-coverage "^1.0.2" + glob "^10.3.10" + graceful-fs "^4.2.11" + jest-haste-map "30.0.2" + jest-message-util "30.0.2" + jest-mock "30.0.2" + jest-regex-util "30.0.1" + jest-resolve "30.0.2" + jest-snapshot "30.0.3" + jest-util "30.0.2" + slash "^3.0.0" + strip-bom "^4.0.0" + +jest-snapshot-serializer-raw@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/jest-snapshot-serializer-raw/-/jest-snapshot-serializer-raw-2.0.0.tgz#c2be865a20feb2b4d9fa4bbac8c48ce1c6dbfa10" + integrity sha512-E/gWFBAltOPQVAvafH/zYkob3G/TqL/DFG3fHurinwLcFRkz6kASjuihyJJ6zoizlLUNaiOdS3v5ZflTvifpBA== + +jest-snapshot@30.0.3, jest-snapshot@^30.0.0: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-30.0.3.tgz#f605254223eee0946d205c6e7ede7238e87be920" + integrity sha512-F05JCohd3OA1N9+5aEPXA6I0qOfZDGIx0zTq5Z4yMBg2i1p5ELfBusjYAWwTkC12c7dHcbyth4QAfQbS7cRjow== + dependencies: + "@babel/core" "^7.27.4" + "@babel/generator" "^7.27.5" + "@babel/plugin-syntax-jsx" "^7.27.1" + "@babel/plugin-syntax-typescript" "^7.27.1" + "@babel/types" "^7.27.3" + "@jest/expect-utils" "30.0.3" + "@jest/get-type" "30.0.1" + "@jest/snapshot-utils" "30.0.1" + "@jest/transform" "30.0.2" + "@jest/types" "30.0.1" + babel-preset-current-node-syntax "^1.1.0" + chalk "^4.1.2" + expect "30.0.3" + graceful-fs "^4.2.11" + jest-diff "30.0.3" + jest-matcher-utils "30.0.3" + jest-message-util "30.0.2" + jest-util "30.0.2" + pretty-format "30.0.2" + semver "^7.7.2" + synckit "^0.11.8" + +jest-util@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-30.0.2.tgz#1bd8411f81e6f5e2ca8b31bb2534ebcd7cbac065" + integrity sha512-8IyqfKS4MqprBuUpZNlFB5l+WFehc8bfCe1HSZFHzft2mOuND8Cvi9r1musli+u6F3TqanCZ/Ik4H4pXUolZIg== + dependencies: + "@jest/types" "30.0.1" + "@types/node" "*" + chalk "^4.1.2" + ci-info "^4.2.0" + graceful-fs "^4.2.11" + picomatch "^4.0.2" + +jest-validate@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-30.0.2.tgz#f62a2f0e014dac94747509ba8c2bcd5d48215b7f" + integrity sha512-noOvul+SFER4RIvNAwGn6nmV2fXqBq67j+hKGHKGFCmK4ks/Iy1FSrqQNBLGKlu4ZZIRL6Kg1U72N1nxuRCrGQ== + dependencies: + "@jest/get-type" "30.0.1" + "@jest/types" "30.0.1" + camelcase "^6.3.0" + chalk "^4.1.2" + leven "^3.1.0" + pretty-format "30.0.2" + +jest-watcher@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-30.0.2.tgz#ec93ed25183679f549a47f6197267d50ec83ea51" + integrity sha512-vYO5+E7jJuF+XmONr6CrbXdlYrgvZqtkn6pdkgjt/dU64UAdc0v1cAVaAeWtAfUUMScxNmnUjKPUMdCpNVASwg== + dependencies: + "@jest/test-result" "30.0.2" + "@jest/types" "30.0.1" + "@types/node" "*" + ansi-escapes "^4.3.2" + chalk "^4.1.2" + emittery "^0.13.1" + jest-util "30.0.2" + string-length "^4.0.2" -pascalcase@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" +jest-worker@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-30.0.2.tgz#e67bd7debbc9d8445907a17067a89359acedc8c5" + integrity sha512-RN1eQmx7qSLFA+o9pfJKlqViwL5wt+OL3Vff/A+/cPsmuw7NPwfgl33AP+/agRmHzPOFgXviRycR9kYwlcRQXg== + dependencies: + "@types/node" "*" + "@ungap/structured-clone" "^1.3.0" + jest-util "30.0.2" + merge-stream "^2.0.0" + supports-color "^8.1.1" + +jest@30.0.3: + version "30.0.3" + resolved "https://registry.yarnpkg.com/jest/-/jest-30.0.3.tgz#fc3b6b370e2820d718ea299d159a7ba4637dbd35" + integrity sha512-Uy8xfeE/WpT2ZLGDXQmaYNzw2v8NUKuYeKGtkS6sDxwsdQihdgYCXaKIYnph1h95DN5H35ubFDm0dfmsQnjn4Q== + dependencies: + "@jest/core" "30.0.3" + "@jest/types" "30.0.1" + import-local "^3.2.0" + jest-cli "30.0.3" + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -path-exists@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" +js-yaml@^3.13.1: + version "3.14.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" + integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== dependencies: - pinkie-promise "^2.0.0" + argparse "^1.0.7" + esprima "^4.0.0" -path-exists@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + +jsdom@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-26.1.0.tgz#ab5f1c1cafc04bd878725490974ea5e8bf0c72b3" + integrity sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg== + dependencies: + cssstyle "^4.2.1" + data-urls "^5.0.0" + decimal.js "^10.5.0" + html-encoding-sniffer "^4.0.0" + http-proxy-agent "^7.0.2" + https-proxy-agent "^7.0.6" + is-potential-custom-element-name "^1.0.1" + nwsapi "^2.2.16" + parse5 "^7.2.1" + rrweb-cssom "^0.8.0" + saxes "^6.0.0" + symbol-tree "^3.2.4" + tough-cookie "^5.1.1" + w3c-xmlserializer "^5.0.0" + webidl-conversions "^7.0.0" + whatwg-encoding "^3.1.1" + whatwg-mimetype "^4.0.0" + whatwg-url "^14.1.1" + ws "^8.18.0" + xml-name-validator "^5.0.0" + +jsesc@^2.5.1: + version "2.5.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== + +jsesc@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.1.0.tgz#74d335a234f67ed19907fdadfac7ccf9d409825d" + integrity sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA== + +jsesc@~0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" + integrity sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA== + +jsesc@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-3.0.2.tgz#bb8b09a6597ba426425f2e4a07245c3d00b9343e" + integrity sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g== + +json-parse-even-better-errors@^2.3.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== -path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= -path-is-inside@^1.0.1, path-is-inside@^1.0.2: +json5@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593" + integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA== + dependencies: + minimist "^1.2.0" -path-key@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" +json5@^2.1.2: + version "2.2.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" + integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== -path-parse@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" +json5@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" + integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== -path-type@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" - dependencies: - graceful-fs "^4.1.2" - pify "^2.0.0" - pinkie-promise "^2.0.0" +leven@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== -path-type@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== dependencies: - pify "^2.0.0" + prelude-ls "^1.2.1" + type-check "~0.4.0" -path-type@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" +lines-and-columns@^1.1.6: + version "1.2.4" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" + integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== + +linguist-languages@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/linguist-languages/-/linguist-languages-8.0.0.tgz#0ca116ca26bafcf0dd4780c8718aa3b8c0435fa8" + integrity sha512-qfzYmWmM/HOsrO/6YwN2f1DD39p3ObSuq8YgF9JLY9toQO39ZsPBPJoWwTtrqRvhkG+cQUgCOS9h/xRgwfqLxQ== + +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== dependencies: - pify "^3.0.0" + p-locate "^4.1.0" -performance-now@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" +lodash.debounce@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" + integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== -php-parser@glayzzle/php-parser#29e53aa16247499ef5d8987d780d3b33ac27b538: - version "3.0.0-alpha2" - resolved "https://codeload.github.com/glayzzle/php-parser/tar.gz/29e53aa16247499ef5d8987d780d3b33ac27b538" +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -pify@3.0.0, pify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" +lru-cache@^10.2.0, lru-cache@^10.4.3: + version "10.4.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" + integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== -pify@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" +lru-cache@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== + dependencies: + yallist "^3.0.2" -pinkie-promise@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== dependencies: - pinkie "^2.0.0" + yallist "^4.0.0" -pinkie@^2.0.0: - version "2.0.4" - resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" +magic-string@^0.30.3: + version "0.30.17" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.17.tgz#450a449673d2460e5bbcfba9a61916a1714c7453" + integrity sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA== + dependencies: + "@jridgewell/sourcemap-codec" "^1.5.0" -pkg-dir@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" +make-dir@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" + integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== dependencies: - find-up "^1.0.0" + semver "^6.0.0" -pluralize@^4.0.0: +make-dir@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-4.0.0.tgz#59b708c1c0190a2f692f1c7618c446b052fd1762" - -posix-character-classes@^0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" + integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== + dependencies: + semver "^7.5.3" -postcss-less@1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/postcss-less/-/postcss-less-1.1.5.tgz#a6f0ce180cf3797eeee1d4adc0e9e6d6db665609" +makeerror@1.0.12: + version "1.0.12" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" + integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== dependencies: - postcss "^5.2.16" + tmpl "1.0.5" -postcss-media-query-parser@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz#27b39c6f4d94f81b1a73b8f76351c609e5cef244" +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -postcss-scss@1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/postcss-scss/-/postcss-scss-1.0.5.tgz#40a10cfd03766accf0a3cf8e65a8af887b2bf6c4" +merge2@^1.3.0, merge2@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +micromatch@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" + integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== dependencies: - postcss "^6.0.21" + braces "^3.0.1" + picomatch "^2.2.3" -postcss-selector-parser@2.2.3: - version "2.2.3" - resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-2.2.3.tgz#f9437788606c3c9acee16ffe8d8b16297f27bb90" +micromatch@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" + integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== dependencies: - flatten "^1.0.2" - indexes-of "^1.0.1" - uniq "^1.0.1" + braces "^3.0.3" + picomatch "^2.3.1" -postcss-values-parser@1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/postcss-values-parser/-/postcss-values-parser-1.5.0.tgz#5d9fa63e2bcb0179ce48f3235303765eb89f3047" +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: - flatten "^1.0.2" - indexes-of "^1.0.1" - uniq "^1.0.1" + brace-expansion "^1.1.7" -postcss@^5.2.16: - version "5.2.18" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.18.tgz#badfa1497d46244f6390f58b319830d9107853c5" +minimatch@^5.0.1: + version "5.1.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" + integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== dependencies: - chalk "^1.1.3" - js-base64 "^2.1.9" - source-map "^0.5.6" - supports-color "^3.2.3" + brace-expansion "^2.0.1" -postcss@^6.0.21: - version "6.0.21" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.21.tgz#8265662694eddf9e9a5960db6da33c39e4cd069d" +minimatch@^9.0.4: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== dependencies: - chalk "^2.3.2" - source-map "^0.6.1" - supports-color "^5.3.0" + brace-expansion "^2.0.1" -prelude-ls@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" +minimist@^1.2.0, minimist@^1.2.6: + version "1.2.7" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18" + integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g== -preserve@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" - -prettier@prettier/prettier#4c464133ac37a966c792cacc660853d74c776841: - version "1.12.1" - resolved "https://codeload.github.com/prettier/prettier/tar.gz/4c464133ac37a966c792cacc660853d74c776841" - dependencies: - "@babel/code-frame" "7.0.0-beta.40" - "@glimmer/syntax" "0.30.3" - babylon "7.0.0-beta.34" - camelcase "4.1.0" - chalk "2.1.0" - cjk-regex "1.0.2" - cosmiconfig "3.1.0" - dashify "0.2.2" - dedent "0.7.0" - diff "3.2.0" - editorconfig "0.15.0" - editorconfig-to-prettier "0.0.6" - emoji-regex "6.5.1" - escape-string-regexp "1.0.5" - esutils "2.0.2" - find-project-root "1.1.1" - flow-parser "0.70" - get-stream "3.0.0" - globby "6.1.0" - graphql "0.13.2" - gray-matter "3.1.1" - html-tag-names "1.1.2" - ignore "3.3.7" - jest-docblock "22.2.2" - json-stable-stringify "1.0.1" - leven "2.1.0" - mem "1.1.0" - minimatch "3.0.4" - minimist "1.2.0" - parse5 "3.0.3" - postcss-less "1.1.5" - postcss-media-query-parser "0.2.3" - postcss-scss "1.0.5" - postcss-selector-parser "2.2.3" - postcss-values-parser "1.5.0" - read-pkg-up "3.0.0" - remark-frontmatter "1.1.0" - remark-parse "5.0.0" - resolve "1.5.0" - semver "5.4.1" - string-width "2.1.1" - typescript "2.8.0-rc" - typescript-eslint-parser "14.0.0" - unicode-regex "1.0.1" - unified "6.1.6" - -pretty-format@^21.2.1: - version "21.2.1" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-21.2.1.tgz#ae5407f3cf21066cd011aa1ba5fce7b6a2eddb36" - dependencies: - ansi-regex "^3.0.0" - ansi-styles "^3.2.0" - -private@^0.1.7: - version "0.1.8" - resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" - -process-nextick-args@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" + integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== -progress@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -prr@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" +ms@^2.1.1, ms@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -pseudomap@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" +napi-postinstall@^0.2.4: + version "0.2.4" + resolved "https://registry.yarnpkg.com/napi-postinstall/-/napi-postinstall-0.2.4.tgz#419697d0288cb524623e422f919624f22a5e4028" + integrity sha512-ZEzHJwBhZ8qQSbknHqYcdtQVr8zUgGyM/q6h6qAyhtyVMNrSgDhrC4disf03dYW0e+czXyLnZINnCTEkWy0eJg== -punycode@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= -punycode@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d" +node-int64@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= -qs@~6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" +node-releases@^2.0.14: + version "2.0.14" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" + integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== -qs@~6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" +node-releases@^2.0.19: + version "2.0.19" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.19.tgz#9e445a52950951ec4d177d843af370b411caf314" + integrity sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw== -randomatic@^1.1.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" +normalize-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +npm-run-path@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== dependencies: - is-number "^3.0.0" - kind-of "^4.0.0" + path-key "^3.0.0" -rc@^1.1.7: - version "1.2.6" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.6.tgz#eb18989c6d4f4f162c399f79ddd29f3835568092" +nwsapi@^2.2.16: + version "2.2.20" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.20.tgz#22e53253c61e7b0e7e93cef42c891154bcca11ef" + integrity sha512-/ieB+mDe4MrrKMT8z+mQL8klXydZWGR5Dowt4RAGKbJ3kIGEx3X4ljUo+6V73IXtUPWgfOlU5B9MlGxFO5T+cA== + +object-inspect@^1.13.1: + version "1.13.1" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" + integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== + +object-inspect@^1.9.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.0.tgz#6e2c120e868fd1fd18cb4f18c31741d0d6e776f0" + integrity sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g== + +object-keys@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + +object.assign@^4.1.4: + version "4.1.4" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.4.tgz#9673c7c7c351ab8c4d0b516f4343ebf4dfb7799f" + integrity sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ== dependencies: - deep-extend "~0.4.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" + call-bind "^1.0.2" + define-properties "^1.1.4" + has-symbols "^1.0.3" + object-keys "^1.1.1" -read-pkg-up@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-3.0.0.tgz#3ed496685dba0f8fe118d0691dc51f4a1ff96f07" +object.fromentries@^2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.7.tgz#71e95f441e9a0ea6baf682ecaaf37fa2a8d7e616" + integrity sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA== dependencies: - find-up "^2.0.0" - read-pkg "^3.0.0" + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" -read-pkg-up@^1.0.1: +object.groupby@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + resolved "https://registry.yarnpkg.com/object.groupby/-/object.groupby-1.0.1.tgz#d41d9f3c8d6c778d9cbac86b4ee9f5af103152ee" + integrity sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ== dependencies: - find-up "^1.0.0" - read-pkg "^1.0.0" + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" -read-pkg-up@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" +object.values@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.7.tgz#617ed13272e7e1071b43973aa1655d9291b8442a" + integrity sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng== dependencies: - find-up "^2.0.0" - read-pkg "^2.0.0" + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" -read-pkg@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== dependencies: - load-json-file "^1.0.0" - normalize-package-data "^2.3.2" - path-type "^1.0.0" + wrappy "1" -read-pkg@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" +onetime@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== dependencies: - load-json-file "^2.0.0" - normalize-package-data "^2.3.2" - path-type "^2.0.0" + mimic-fn "^2.1.0" -read-pkg@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" +optionator@^0.9.3: + version "0.9.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" + integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== dependencies: - load-json-file "^4.0.0" - normalize-package-data "^2.3.2" - path-type "^3.0.0" + "@aashutoshrathi/word-wrap" "^1.2.3" + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" -readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.2.2: - version "2.3.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" +p-limit@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -regenerator-runtime@^0.11.0: - version "0.11.1" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + p-try "^2.0.0" -regex-cache@^0.4.2: - version "0.4.4" - resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" +p-limit@^3.0.2, p-limit@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== dependencies: - is-equal-shallow "^0.1.3" + yocto-queue "^0.1.0" -regex-not@^1.0.0, regex-not@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" +p-limit@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-6.2.0.tgz#c254d22ba6aeef441a3564c5e6c2f2da59268a0f" + integrity sha512-kuUqqHNUqoIWp/c467RI4X6mmyuojY5jGutNU0wVTmEOOfcuwLqyMVoAi9MKi2Ak+5i9+nhmrK4ufZE8069kHA== dependencies: - extend-shallow "^3.0.2" - safe-regex "^1.1.0" + yocto-queue "^1.1.1" -remark-frontmatter@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/remark-frontmatter/-/remark-frontmatter-1.1.0.tgz#9d23c2b376f56617bdb5c5560f1b56e45b19788b" +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== dependencies: - fault "^1.0.1" - xtend "^4.0.1" + p-limit "^2.2.0" -remark-parse@5.0.0: +p-locate@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-5.0.0.tgz#4c077f9e499044d1d5c13f80d7a98cf7b9285d95" - dependencies: - collapse-white-space "^1.0.2" - is-alphabetical "^1.0.0" - is-decimal "^1.0.0" - is-whitespace-character "^1.0.0" - is-word-character "^1.0.0" - markdown-escapes "^1.0.0" - parse-entities "^1.1.0" - repeat-string "^1.5.4" - state-toggle "^1.0.0" - trim "0.0.1" - trim-trailing-lines "^1.0.0" - unherit "^1.0.4" - unist-util-remove-position "^1.0.0" - vfile-location "^2.0.0" - xtend "^4.0.1" - -remove-trailing-separator@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" -repeat-element@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== -repeat-string@^1.5.2, repeat-string@^1.5.4, repeat-string@^1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" +package-json-from-dist@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" + integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== -repeating@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +parse-json@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-even-better-errors "^2.3.0" + lines-and-columns "^1.1.6" + +parse5@^7.0.0: + version "7.1.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.1.1.tgz#4649f940ccfb95d8754f37f73078ea20afe0c746" + integrity sha512-kwpuwzB+px5WUg9pyK0IcK/shltJN5/OVhQagxhCQNtT9Y9QRZqNY2e1cmbu/paRh5LMnz/oVTVLBpjFmMZhSg== + dependencies: + entities "^4.4.0" + +parse5@^7.2.1: + version "7.3.0" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.3.0.tgz#d7e224fa72399c7a175099f45fc2ad024b05ec05" + integrity sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw== + dependencies: + entities "^6.0.0" + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + +path-scurry@^1.11.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2" + integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA== dependencies: - is-finite "^1.0.0" + lru-cache "^10.2.0" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" + +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== -replace-ext@1.0.0: +php-parser@^3.2.5: + version "3.2.5" + resolved "https://registry.yarnpkg.com/php-parser/-/php-parser-3.2.5.tgz#24ff4b4f3e1788967f7737e43c273a5a8e7cd0ac" + integrity sha512-M1ZYlALFFnESbSdmRtTQrBFUHSriHgPhgqtTF/LCbZM4h7swR5PHtUceB2Kzby5CfqcsYwBn7OXTJ0+8Sajwkw== + +picocolors@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb" - -request@2.81.0: - version "2.81.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" - dependencies: - aws-sign2 "~0.6.0" - aws4 "^1.2.1" - caseless "~0.12.0" - combined-stream "~1.0.5" - extend "~3.0.0" - forever-agent "~0.6.1" - form-data "~2.1.1" - har-validator "~4.2.1" - hawk "~3.1.3" - http-signature "~1.1.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.7" - oauth-sign "~0.8.1" - performance-now "^0.2.0" - qs "~6.4.0" - safe-buffer "^5.0.1" - stringstream "~0.0.4" - tough-cookie "~2.3.0" - tunnel-agent "^0.6.0" - uuid "^3.0.0" - -request@^2.79.0: - version "2.85.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.85.0.tgz#5a03615a47c61420b3eb99b7dba204f83603e1fa" - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.6.0" - caseless "~0.12.0" - combined-stream "~1.0.5" - extend "~3.0.1" - forever-agent "~0.6.1" - form-data "~2.3.1" - har-validator "~5.0.3" - hawk "~6.0.2" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.17" - oauth-sign "~0.8.2" - performance-now "^2.1.0" - qs "~6.5.1" - safe-buffer "^5.1.1" - stringstream "~0.0.5" - tough-cookie "~2.3.3" - tunnel-agent "^0.6.0" - uuid "^3.1.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" +picocolors@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== -require-from-string@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.1.tgz#c545233e9d7da6616e9d59adfb39fc9f588676ff" +picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -require-main-filename@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" +picomatch@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab" + integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg== -require-uncached@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" +pirates@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.7.tgz#643b4a18c4257c8a65104b73f3049ce9a0a15e22" + integrity sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA== + +pkg-dir@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" + integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== dependencies: - caller-path "^0.1.0" - resolve-from "^1.0.0" + find-up "^4.0.0" -resolve-from@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -resolve-url@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" -resolve@1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" +prettier@^3.6.1: + version "3.6.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.6.1.tgz#cc3bce21c09a477b1e987b76ce9663925d86ae44" + integrity sha512-5xGWRa90Sp2+x1dQtNpIpeOQpTDBs9cZDmA/qs2vDNN2i18PdapqY7CmBeyLlMuGqXJRIOPaCaVZTLNQRWUH/A== -resolve@1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" +pretty-format@30.0.2: + version "30.0.2" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-30.0.2.tgz#54717b6aa2b4357a2e6d83868e10a2ea8dd647c7" + integrity sha512-yC5/EBSOrTtqhCKfLHqoUIAXVRZnukHPwWBJWR7h84Q3Be1DRQZLncwcfLoPA5RPQ65qfiCMqgYwdUuQ//eVpg== dependencies: - path-parse "^1.0.5" + "@jest/schemas" "30.0.1" + ansi-styles "^5.2.0" + react-is "^18.3.1" -resolve@^1.5.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.6.0.tgz#0fbd21278b27b4004481c395349e7aba60a9ff5c" - dependencies: - path-parse "^1.0.5" +punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== -restore-cursor@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" - dependencies: - onetime "^2.0.0" - signal-exit "^3.0.2" +punycode@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" + integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== -ret@~0.1.10: - version "0.1.15" - resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" +pure-rand@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-7.0.1.tgz#6f53a5a9e3e4a47445822af96821ca509ed37566" + integrity sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ== -right-align@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" - dependencies: - align-text "^0.1.1" +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== -rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.6.1: - version "2.6.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== dependencies: - glob "^7.0.5" + safe-buffer "^5.1.0" -run-async@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" - dependencies: - is-promise "^2.1.0" +react-is@^18.3.1: + version "18.3.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" + integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg== -rx-lite-aggregates@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" +regenerate-unicode-properties@^10.1.0: + version "10.1.1" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.1.tgz#6b0e05489d9076b04c436f318d9b067bba459480" + integrity sha512-X007RyZLsCJVVrjgEFVpLUTZwyOZk3oiL75ZcuYjlIWd6rNJtOjkBwQc5AsRrpbKVkxN6sklw/k/9m2jJYOf8Q== dependencies: - rx-lite "*" + regenerate "^1.4.2" -rx-lite@*, rx-lite@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" +regenerate-unicode-properties@^10.2.0: + version "10.2.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.0.tgz#626e39df8c372338ea9b8028d1f99dc3fd9c3db0" + integrity sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA== + dependencies: + regenerate "^1.4.2" -safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" +regenerate@^1.4.2: + version "1.4.2" + resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a" + integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A== -safe-regex@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" +regexp.prototype.flags@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz#90ce989138db209f81492edd734183ce99f9677e" + integrity sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + set-function-name "^2.0.0" + +regexpu-core@^5.3.1: + version "5.3.2" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.3.2.tgz#11a2b06884f3527aec3e93dbbf4a3b958a95546b" + integrity sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ== + dependencies: + "@babel/regjsgen" "^0.8.0" + regenerate "^1.4.2" + regenerate-unicode-properties "^10.1.0" + regjsparser "^0.9.1" + unicode-match-property-ecmascript "^2.0.0" + unicode-match-property-value-ecmascript "^2.1.0" + +regexpu-core@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-6.2.0.tgz#0e5190d79e542bf294955dccabae04d3c7d53826" + integrity sha512-H66BPQMrv+V16t8xtmq+UC0CBpiTBA60V8ibS1QVReIp8T1z8hwFxqcGzm9K6lgsN7sB5edVH8a+ze6Fqm4weA== + dependencies: + regenerate "^1.4.2" + regenerate-unicode-properties "^10.2.0" + regjsgen "^0.8.0" + regjsparser "^0.12.0" + unicode-match-property-ecmascript "^2.0.0" + unicode-match-property-value-ecmascript "^2.1.0" + +regjsgen@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.8.0.tgz#df23ff26e0c5b300a6470cad160a9d090c3a37ab" + integrity sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q== + +regjsparser@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.12.0.tgz#0e846df6c6530586429377de56e0475583b088dc" + integrity sha512-cnE+y8bz4NhMjISKbgeVJtqNbtf5QpjZP+Bslo+UqkIt9QPnX9q095eiRRASJG1/tz6dlNr6Z5NsBiWYokp6EQ== dependencies: - ret "~0.1.10" + jsesc "~3.0.2" -safer-buffer@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.0.tgz#d9f653a55538c8d7829cb1a92e90bbcbc5ff5d3b" - -sane@^2.0.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/sane/-/sane-2.5.0.tgz#6359cd676f5efd9988b264d8ce3b827dd6b27bec" - dependencies: - anymatch "^2.0.0" - exec-sh "^0.2.0" - fb-watchman "^2.0.0" - micromatch "^3.1.4" - minimist "^1.1.1" - walker "~1.0.5" - watch "~0.18.0" - optionalDependencies: - fsevents "^1.1.1" +regjsparser@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.9.1.tgz#272d05aa10c7c1f67095b1ff0addae8442fc5709" + integrity sha512-dQUtn90WanSNl+7mQKcXAgZxvUe7Z0SqXlgzv0za4LwiUhyzBC58yQO3liFoUgu8GiJVInAhJjkj1N0EtQ5nkQ== + dependencies: + jsesc "~0.5.0" -sax@^1.2.1: - version "1.2.4" - resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= -"semver@2 || 3 || 4 || 5", semver@5.5.0, semver@^5.3.0, semver@^5.4.1: - version "5.5.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" +resolve-cwd@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" + integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== + dependencies: + resolve-from "^5.0.0" -semver@5.4.1: - version "5.4.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== -set-blocking@^2.0.0, set-blocking@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" +resolve-from@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" + integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== -set-value@^0.4.3: - version "0.4.3" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" +resolve@^1.14.2, resolve@^1.22.4: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.1" - to-object-path "^0.3.0" + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" -set-value@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" +resolve@^1.22.1: + version "1.22.10" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.10.tgz#b663e83ffb09bbf2386944736baae803029b8b39" + integrity sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w== dependencies: - extend-shallow "^2.0.1" - is-extendable "^0.1.1" - is-plain-object "^2.0.3" - split-string "^3.0.1" + is-core-module "^2.16.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" -shebang-command@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== dependencies: - shebang-regex "^1.0.0" + glob "^7.1.3" -shebang-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" +rollup@^3.28.1: + version "3.29.5" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.29.5.tgz#8a2e477a758b520fb78daf04bca4c522c1da8a54" + integrity sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w== + optionalDependencies: + fsevents "~2.3.2" -shellwords@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" +rrweb-cssom@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz#3021d1b4352fbf3b614aaeed0bc0d5739abe0bc2" + integrity sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw== -sigmund@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" -signal-exit@^3.0.0, signal-exit@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" +safe-array-concat@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.0.1.tgz#91686a63ce3adbea14d61b14c99572a8ff84754c" + integrity sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.2.1" + has-symbols "^1.0.3" + isarray "^2.0.5" -simple-html-tokenizer@^0.4.1: - version "0.4.3" - resolved "https://registry.yarnpkg.com/simple-html-tokenizer/-/simple-html-tokenizer-0.4.3.tgz#9b00b766e30058b4bb377c0d4f97566a13ab1be1" +safe-buffer@^5.1.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== -slash@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" +safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -slice-ansi@1.0.0: +safe-regex-test@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" + resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.0.tgz#793b874d524eb3640d1873aad03596db2d4f2295" + integrity sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA== dependencies: - is-fullwidth-code-point "^2.0.0" + call-bind "^1.0.2" + get-intrinsic "^1.1.3" + is-regex "^1.1.4" -snapdragon-node@^2.0.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" - dependencies: - define-property "^1.0.0" - isobject "^3.0.0" - snapdragon-util "^3.0.1" +"safer-buffer@>= 2.1.2 < 3.0.0": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -snapdragon-util@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" +saxes@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/saxes/-/saxes-6.0.0.tgz#fe5b4a4768df4f14a201b1ba6a65c1f3d9988cc5" + integrity sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA== dependencies: - kind-of "^3.2.0" + xmlchars "^2.2.0" + +semver@^6.0.0, semver@^6.3.0, semver@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -snapdragon@^0.8.1: - version "0.8.2" - resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" +semver@^7.3.5, semver@^7.5.3, semver@^7.5.4: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== dependencies: - base "^0.11.1" - debug "^2.2.0" - define-property "^0.2.5" - extend-shallow "^2.0.1" - map-cache "^0.2.2" - source-map "^0.5.6" - source-map-resolve "^0.5.0" - use "^3.1.0" + lru-cache "^6.0.0" -sntp@1.x.x: - version "1.0.9" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" +semver@^7.7.2: + version "7.7.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58" + integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA== + +serialize-javascript@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.1.tgz#b206efb27c3da0b0ab6b52f48d170b7996458e5c" + integrity sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w== dependencies: - hoek "2.x.x" + randombytes "^2.1.0" -sntp@2.x.x: - version "2.1.0" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8" +set-function-length@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.1.1.tgz#4bc39fafb0307224a33e106a7d35ca1218d659ed" + integrity sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ== dependencies: - hoek "4.x.x" + define-data-property "^1.1.1" + get-intrinsic "^1.2.1" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" -source-map-resolve@^0.5.0: - version "0.5.1" - resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.1.tgz#7ad0f593f2281598e854df80f19aae4b92d7a11a" +set-function-name@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-function-name/-/set-function-name-2.0.1.tgz#12ce38b7954310b9f61faa12701620a0c882793a" + integrity sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA== dependencies: - atob "^2.0.0" - decode-uri-component "^0.2.0" - resolve-url "^0.2.1" - source-map-url "^0.4.0" - urix "^0.1.0" + define-data-property "^1.0.1" + functions-have-names "^1.2.3" + has-property-descriptors "^1.0.0" -source-map-support@^0.4.15: - version "0.4.18" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== dependencies: - source-map "^0.5.6" + shebang-regex "^3.0.0" -source-map-url@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -source-map@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" +side-channel@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" + integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== dependencies: - amdefine ">=0.0.4" + call-bind "^1.0.0" + get-intrinsic "^1.0.2" + object-inspect "^1.9.0" -source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1: - version "0.5.7" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" +signal-exit@^3.0.3: + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== -source-map@^0.6.1, source-map@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" +signal-exit@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" + integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== -spdx-correct@^3.0.0: +slash@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.0.0.tgz#05a5b4d7153a195bc92c3c425b69f3b2a9524c82" - dependencies: - spdx-expression-parse "^3.0.0" - spdx-license-ids "^3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -spdx-exceptions@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz#2c7ae61056c714a5b9b9b2b2af7d311ef5c78fe9" +smob@^1.0.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/smob/-/smob-1.4.1.tgz#66270e7df6a7527664816c5b577a23f17ba6f5b5" + integrity sha512-9LK+E7Hv5R9u4g4C3p+jjLstaLe11MDsL21UpYaCNmapvMkYhqCV4A/f/3gyH8QjMyh6l68q9xC85vihY9ahMQ== -spdx-expression-parse@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" +source-map-support@0.5.13: + version "0.5.13" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" + integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== dependencies: - spdx-exceptions "^2.1.0" - spdx-license-ids "^3.0.0" - -spdx-license-ids@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz#7a7cd28470cc6d3a1cfe6d66886f6bc430d3ac87" + buffer-from "^1.0.0" + source-map "^0.6.0" -split-string@^3.0.1, split-string@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" +source-map-support@~0.5.20: + version "0.5.21" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== dependencies: - extend-shallow "^3.0.0" + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@^0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= -sshpk@^1.7.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.14.1.tgz#130f5975eddad963f1d56f92b9ac6c51fa9f83eb" +stack-utils@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - dashdash "^1.12.0" - getpass "^0.1.1" - optionalDependencies: - bcrypt-pbkdf "^1.0.0" - ecc-jsbn "~0.1.1" - jsbn "~0.1.0" - tweetnacl "~0.14.0" + escape-string-regexp "^2.0.0" -state-toggle@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/state-toggle/-/state-toggle-1.0.0.tgz#d20f9a616bb4f0c3b98b91922d25b640aa2bc425" +string-length@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" + integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== + dependencies: + char-regex "^1.0.2" + strip-ansi "^6.0.0" -static-extend@^0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== dependencies: - define-property "^0.2.5" - object-copy "^0.1.0" + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" -string-length@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed" +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== dependencies: - astral-regex "^1.0.0" - strip-ansi "^4.0.0" + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" -string-width@2.1.1, string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" +string-width@^5.0.1, string-width@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" + integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" + eastasianwidth "^0.2.0" + emoji-regex "^9.2.2" + strip-ansi "^7.0.1" -string-width@^1.0.1, string-width@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" +string.prototype.trim@^1.2.8: + version "1.2.8" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz#f9ac6f8af4bd55ddfa8895e6aea92a96395393bd" + integrity sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ== dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" +string.prototype.trimend@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz#1bb3afc5008661d73e2dc015cd4853732d6c471e" + integrity sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA== dependencies: - safe-buffer "~5.1.0" + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" -stringstream@~0.0.4, stringstream@~0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" +string.prototype.trimstart@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz#d4cdb44b83a4737ffbac2d406e405d43d0184298" + integrity sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" -strip-ansi@^3.0.0, strip-ansi@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== dependencies: - ansi-regex "^2.0.0" + ansi-regex "^5.0.1" -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== dependencies: - ansi-regex "^3.0.0" + ansi-regex "^5.0.1" -strip-bom-string@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-bom-string/-/strip-bom-string-1.0.0.tgz#e5211e9224369fbb81d633a2f00044dc8cedad92" +strip-ansi@^7.0.1, strip-ansi@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" + integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== + dependencies: + ansi-regex "^6.0.1" -strip-bom@3.0.0, strip-bom@^3.0.0: +strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= -strip-bom@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" - dependencies: - is-utf8 "^0.2.0" - -strip-eof@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" - -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" +strip-bom@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" + integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== -supports-color@^2.0.0: +strip-final-newline@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - -supports-color@^3.1.2, supports-color@^3.2.3: - version "3.2.3" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" - dependencies: - has-flag "^1.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== -supports-color@^4.0.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" - dependencies: - has-flag "^2.0.0" +strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== supports-color@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.3.0.tgz#5b24ac15db80fa927cf5227a4a33fd3c4c7676c0" + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" -symbol-tree@^3.2.1: - version "3.2.2" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" -table@^4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/table/-/table-4.0.3.tgz#00b5e2b602f1794b9acaf9ca908a76386a7813bc" - dependencies: - ajv "^6.0.1" - ajv-keywords "^3.0.0" - chalk "^2.1.0" - lodash "^4.17.4" - slice-ansi "1.0.0" - string-width "^2.1.1" - -tar-pack@^3.4.0: - version "3.4.1" - resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.1.tgz#e1dbc03a9b9d3ba07e896ad027317eb679a10a1f" - dependencies: - debug "^2.2.0" - fstream "^1.0.10" - fstream-ignore "^1.0.5" - once "^1.3.3" - readable-stream "^2.1.4" - rimraf "^2.5.1" - tar "^2.2.1" - uid-number "^0.0.6" - -tar@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" +supports-color@^8.1.1: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== dependencies: - block-stream "*" - fstream "^1.0.2" - inherits "2" + has-flag "^4.0.0" + +supports-color@^9.2.1: + version "9.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-9.4.0.tgz#17bfcf686288f531db3dea3215510621ccb55954" + integrity sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw== + +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + +symbol-tree@^3.2.4: + version "3.2.4" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== + +synckit@^0.11.8: + version "0.11.8" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.11.8.tgz#b2aaae998a4ef47ded60773ad06e7cb821f55457" + integrity sha512-+XZ+r1XGIJGeQk3VvXhT6xx/VpbHsRzsTkGgF6E5RX9TTXD0118l87puaEBZ566FhqblC6U0d4XnubznJDm30A== + dependencies: + "@pkgr/core" "^0.2.4" + +synckit@^0.8.6: + version "0.8.8" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.8.tgz#fe7fe446518e3d3d49f5e429f443cf08b6edfcd7" + integrity sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ== + dependencies: + "@pkgr/core" "^0.1.0" + tslib "^2.6.2" + +terser@^5.17.4: + version "5.21.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.21.0.tgz#d2b27e92b5e56650bc83b6defa00a110f0b124b2" + integrity sha512-WtnFKrxu9kaoXuiZFSGrcAvvBqAdmKx0SFNmVNYdJamMu9yyN3I/QF0FbH4QcqJQ+y1CJnzxGIKH0cSj+FGYRw== + dependencies: + "@jridgewell/source-map" "^0.3.3" + acorn "^8.8.2" + commander "^2.20.0" + source-map-support "~0.5.20" + +test-exclude@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" + integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== + dependencies: + "@istanbuljs/schema" "^0.1.2" + glob "^7.1.4" + minimatch "^3.0.4" -test-exclude@^4.1.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.2.1.tgz#dfa222f03480bca69207ca728b37d74b45f724fa" +test-exclude@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-7.0.1.tgz#20b3ba4906ac20994e275bbcafd68d510264c2a2" + integrity sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg== dependencies: - arrify "^1.0.1" - micromatch "^3.1.8" - object-assign "^4.1.0" - read-pkg-up "^1.0.1" - require-main-filename "^1.0.1" + "@istanbuljs/schema" "^0.1.2" + glob "^10.4.1" + minimatch "^9.0.4" -text-table@~0.2.0: +text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= -throat@4.1.0, throat@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" +tinypool@0.8.4: + version "0.8.4" + resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-0.8.4.tgz#e217fe1270d941b39e98c625dcecebb1408c9aa8" + integrity sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ== -through@^2.3.6: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" +tldts-core@^6.1.86: + version "6.1.86" + resolved "https://registry.yarnpkg.com/tldts-core/-/tldts-core-6.1.86.tgz#a93e6ed9d505cb54c542ce43feb14c73913265d8" + integrity sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA== -tmp@^0.0.33: - version "0.0.33" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" +tldts@^6.1.32: + version "6.1.86" + resolved "https://registry.yarnpkg.com/tldts/-/tldts-6.1.86.tgz#087e0555b31b9725ee48ca7e77edc56115cd82f7" + integrity sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ== dependencies: - os-tmpdir "~1.0.2" - -tmpl@1.0.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" + tldts-core "^6.1.86" -to-fast-properties@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" +tmpl@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== -to-object-path@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" - dependencies: - kind-of "^3.0.2" +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== -to-regex-range@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== dependencies: - is-number "^3.0.0" - repeat-string "^1.6.1" + is-number "^7.0.0" -to-regex@^3.0.1, to-regex@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" +tough-cookie@^5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-5.1.2.tgz#66d774b4a1d9e12dc75089725af3ac75ec31bed7" + integrity sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A== dependencies: - define-property "^2.0.2" - extend-shallow "^3.0.2" - regex-not "^1.0.2" - safe-regex "^1.1.0" + tldts "^6.1.32" -tough-cookie@^2.3.2, tough-cookie@~2.3.0, tough-cookie@~2.3.3: - version "2.3.4" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655" +tr46@^5.1.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-5.1.1.tgz#96ae867cddb8fdb64a49cc3059a8d428bcf238ca" + integrity sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw== dependencies: - punycode "^1.4.1" - -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - -trim-right@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" - -trim-trailing-lines@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/trim-trailing-lines/-/trim-trailing-lines-1.1.0.tgz#7aefbb7808df9d669f6da2e438cac8c46ada7684" + punycode "^2.3.1" -trim@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/trim/-/trim-0.0.1.tgz#5858547f6b290757ee95cccc666fb50084c460dd" - -trough@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.1.tgz#a9fd8b0394b0ae8fff82e0633a0a36ccad5b5f86" - -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" +tsconfig-paths@^3.15.0: + version "3.15.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4" + integrity sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg== dependencies: - safe-buffer "^5.0.1" + "@types/json5" "^0.0.29" + json5 "^1.0.2" + minimist "^1.2.6" + strip-bom "^3.0.0" -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" +tslib@^1.8.1: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -type-check@~0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - dependencies: - prelude-ls "~1.1.2" +tslib@^2.4.0: + version "2.8.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" + integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== -typedarray@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" +tslib@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" + integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== -typescript-eslint-parser@14.0.0: - version "14.0.0" - resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-14.0.0.tgz#c90a8f541c1d96e5c55e2807c61d154e788520f9" +tsutils@^3.21.0: + version "3.21.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== dependencies: - lodash.unescape "4.0.1" - semver "5.5.0" + tslib "^1.8.1" -typescript@2.8.0-rc: - version "2.8.0-rc" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.0-rc.tgz#a0256b7d1d39fb7493ba0403f55e95d31e8bc374" - -uglify-js@^2.6: - version "2.8.29" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== dependencies: - source-map "~0.5.1" - yargs "~3.10.0" - optionalDependencies: - uglify-to-browserify "~1.0.0" - -uglify-to-browserify@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" - -uid-number@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" + prelude-ls "^1.2.1" -unherit@^1.0.4: - version "1.1.0" - resolved "https://registry.yarnpkg.com/unherit/-/unherit-1.1.0.tgz#6b9aaedfbf73df1756ad9e316dd981885840cd7d" - dependencies: - inherits "^2.0.1" - xtend "^4.0.1" +type-detect@4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== -unicode-regex@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/unicode-regex/-/unicode-regex-1.0.1.tgz#f819e050191d5b9561a339a58dd3b9095ed94b35" +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== -unified@6.1.6: - version "6.1.6" - resolved "https://registry.yarnpkg.com/unified/-/unified-6.1.6.tgz#5ea7f807a0898f1f8acdeefe5f25faa010cc42b1" - dependencies: - bail "^1.0.0" - extend "^3.0.0" - is-plain-obj "^1.1.0" - trough "^1.0.0" - vfile "^2.0.0" - x-is-function "^1.0.4" - x-is-string "^0.1.0" +type-fest@^0.21.3: + version "0.21.3" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" + integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== -union-value@^1.0.0: +typed-array-buffer@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz#18de3e7ed7974b0a729d3feecb94338d1472cd60" + integrity sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw== dependencies: - arr-union "^3.1.0" - get-value "^2.0.6" - is-extendable "^0.1.1" - set-value "^0.4.3" - -uniq@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" - -unist-util-is@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-2.1.1.tgz#0c312629e3f960c66e931e812d3d80e77010947b" + call-bind "^1.0.2" + get-intrinsic "^1.2.1" + is-typed-array "^1.1.10" -unist-util-remove-position@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/unist-util-remove-position/-/unist-util-remove-position-1.1.1.tgz#5a85c1555fc1ba0c101b86707d15e50fa4c871bb" +typed-array-byte-length@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz#d787a24a995711611fb2b87a4052799517b230d0" + integrity sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA== dependencies: - unist-util-visit "^1.1.0" - -unist-util-stringify-position@^1.0.0, unist-util-stringify-position@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/unist-util-stringify-position/-/unist-util-stringify-position-1.1.1.tgz#3ccbdc53679eed6ecf3777dd7f5e3229c1b6aa3c" + call-bind "^1.0.2" + for-each "^0.3.3" + has-proto "^1.0.1" + is-typed-array "^1.1.10" -unist-util-visit@^1.1.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-1.3.0.tgz#41ca7c82981fd1ce6c762aac397fc24e35711444" +typed-array-byte-offset@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz#cbbe89b51fdef9cd6aaf07ad4707340abbc4ea0b" + integrity sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg== dependencies: - unist-util-is "^2.1.1" + available-typed-arrays "^1.0.5" + call-bind "^1.0.2" + for-each "^0.3.3" + has-proto "^1.0.1" + is-typed-array "^1.1.10" -unset-value@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" +typed-array-length@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.4.tgz#89d83785e5c4098bec72e08b319651f0eac9c1bb" + integrity sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng== dependencies: - has-value "^0.3.1" - isobject "^3.0.0" + call-bind "^1.0.2" + for-each "^0.3.3" + is-typed-array "^1.1.9" -uri-js@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-3.0.2.tgz#f90b858507f81dea4dcfbb3c4c3dbfa2b557faaa" +unbox-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" + integrity sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw== dependencies: - punycode "^2.1.0" + call-bind "^1.0.2" + has-bigints "^1.0.2" + has-symbols "^1.0.3" + which-boxed-primitive "^1.0.2" -urix@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" +unicode-canonical-property-names-ecmascript@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc" + integrity sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ== -use@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/use/-/use-3.1.0.tgz#14716bf03fdfefd03040aef58d8b4b85f3a7c544" +unicode-match-property-ecmascript@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz#54fd16e0ecb167cf04cf1f756bdcc92eba7976c3" + integrity sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q== dependencies: - kind-of "^6.0.2" + unicode-canonical-property-names-ecmascript "^2.0.0" + unicode-property-aliases-ecmascript "^2.0.0" -util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" +unicode-match-property-value-ecmascript@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz#cb5fffdcd16a05124f5a4b0bf7c3770208acbbe0" + integrity sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA== -uuid@^3.0.0, uuid@^3.1.0: - version "3.2.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" +unicode-property-aliases-ecmascript@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz#43d41e3be698bd493ef911077c9b131f827e8ccd" + integrity sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w== -validate-npm-package-license@^3.0.1: - version "3.0.3" - resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz#81643bcbef1bdfecd4623793dc4648948ba98338" +unrs-resolver@^1.7.11: + version "1.9.2" + resolved "https://registry.yarnpkg.com/unrs-resolver/-/unrs-resolver-1.9.2.tgz#1a7c73335a5e510643664d7bb4bb6f5c28782e36" + integrity sha512-VUyWiTNQD7itdiMuJy+EuLEErLj3uwX/EpHQF8EOf33Dq3Ju6VW1GXm+swk6+1h7a49uv9fKZ+dft9jU7esdLA== dependencies: - spdx-correct "^3.0.0" - spdx-expression-parse "^3.0.0" - -verror@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + napi-postinstall "^0.2.4" + optionalDependencies: + "@unrs/resolver-binding-android-arm-eabi" "1.9.2" + "@unrs/resolver-binding-android-arm64" "1.9.2" + "@unrs/resolver-binding-darwin-arm64" "1.9.2" + "@unrs/resolver-binding-darwin-x64" "1.9.2" + "@unrs/resolver-binding-freebsd-x64" "1.9.2" + "@unrs/resolver-binding-linux-arm-gnueabihf" "1.9.2" + "@unrs/resolver-binding-linux-arm-musleabihf" "1.9.2" + "@unrs/resolver-binding-linux-arm64-gnu" "1.9.2" + "@unrs/resolver-binding-linux-arm64-musl" "1.9.2" + "@unrs/resolver-binding-linux-ppc64-gnu" "1.9.2" + "@unrs/resolver-binding-linux-riscv64-gnu" "1.9.2" + "@unrs/resolver-binding-linux-riscv64-musl" "1.9.2" + "@unrs/resolver-binding-linux-s390x-gnu" "1.9.2" + "@unrs/resolver-binding-linux-x64-gnu" "1.9.2" + "@unrs/resolver-binding-linux-x64-musl" "1.9.2" + "@unrs/resolver-binding-wasm32-wasi" "1.9.2" + "@unrs/resolver-binding-win32-arm64-msvc" "1.9.2" + "@unrs/resolver-binding-win32-ia32-msvc" "1.9.2" + "@unrs/resolver-binding-win32-x64-msvc" "1.9.2" + +update-browserslist-db@^1.0.13: + version "1.0.13" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" + integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg== + dependencies: + escalade "^3.1.1" + picocolors "^1.0.0" + +update-browserslist-db@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz#348377dd245216f9e7060ff50b15a1b740b75420" + integrity sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw== dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - -vfile-location@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/vfile-location/-/vfile-location-2.0.2.tgz#d3675c59c877498e492b4756ff65e4af1a752255" + escalade "^3.2.0" + picocolors "^1.1.1" -vfile-message@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-1.0.0.tgz#a6adb0474ea400fa25d929f1d673abea6a17e359" +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== dependencies: - unist-util-stringify-position "^1.1.1" + punycode "^2.1.0" -vfile@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/vfile/-/vfile-2.3.0.tgz#e62d8e72b20e83c324bc6c67278ee272488bf84a" +v8-to-istanbul@^9.0.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz#1b83ed4e397f58c85c266a570fc2558b5feb9265" + integrity sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA== dependencies: - is-buffer "^1.1.4" - replace-ext "1.0.0" - unist-util-stringify-position "^1.0.0" - vfile-message "^1.0.0" + "@jridgewell/trace-mapping" "^0.3.12" + "@types/istanbul-lib-coverage" "^2.0.1" + convert-source-map "^1.6.0" -walker@~1.0.5: - version "1.0.7" - resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" +v8-to-istanbul@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz#b6f994b0b5d4ef255e17a0d17dc444a9f5132fa4" + integrity sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w== dependencies: - makeerror "1.0.x" + "@jridgewell/trace-mapping" "^0.3.12" + "@types/istanbul-lib-coverage" "^2.0.1" + convert-source-map "^1.6.0" -watch@~0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/watch/-/watch-0.18.0.tgz#28095476c6df7c90c963138990c0a5423eb4b986" +w3c-xmlserializer@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz#f925ba26855158594d907313cedd1476c5967f6c" + integrity sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA== dependencies: - exec-sh "^0.2.0" - minimist "^1.2.0" - -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - -webidl-conversions@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" + xml-name-validator "^5.0.0" -whatwg-encoding@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz#57c235bc8657e914d24e1a397d3c82daee0a6ba3" +walker@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" + integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== dependencies: - iconv-lite "0.4.19" + makeerror "1.0.12" -whatwg-url@^4.3.0: - version "4.8.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.8.0.tgz#d2981aa9148c1e00a41c5a6131166ab4683bbcc0" +webidl-conversions@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" + integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== + +whatwg-encoding@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz#d0f4ef769905d426e1688f3e34381a99b60b76e5" + integrity sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ== dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" + iconv-lite "0.6.3" -which-module@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" +whatwg-mimetype@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz#bc1bf94a985dc50388d54a9258ac405c3ca2fc0a" + integrity sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg== -which@^1.2.12, which@^1.2.9, which@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" +whatwg-url@^14.0.0, whatwg-url@^14.1.1: + version "14.2.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-14.2.0.tgz#4ee02d5d725155dae004f6ae95c73e7ef5d95663" + integrity sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw== dependencies: - isexe "^2.0.0" + tr46 "^5.1.0" + webidl-conversions "^7.0.0" -wide-align@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.2.tgz#571e0f1b0604636ebc0dfc21b0339bbe31341710" +which-boxed-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" + integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== + dependencies: + is-bigint "^1.0.1" + is-boolean-object "^1.1.0" + is-number-object "^1.0.4" + is-string "^1.0.5" + is-symbol "^1.0.3" + +which-typed-array@^1.1.11, which-typed-array@^1.1.13: + version "1.1.13" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.13.tgz#870cd5be06ddb616f504e7b039c4c24898184d36" + integrity sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.4" + for-each "^0.3.3" + gopd "^1.0.1" + has-tostringtag "^1.0.0" + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== dependencies: - string-width "^1.0.2" - -window-size@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" - -wordwrap@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" - -wordwrap@~0.0.2: - version "0.0.3" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" - -wordwrap@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + isexe "^2.0.0" -worker-farm@1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.5.0.tgz#adfdf0cd40581465ed0a1f648f9735722afd5c8d" +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== dependencies: - errno "^0.1.4" - xtend "^4.0.1" + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" -worker-farm@^1.3.1: - version "1.6.0" - resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.6.0.tgz#aecc405976fab5a95526180846f0dba288f3a4a0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== dependencies: - errno "~0.1.7" + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" -wrap-ansi@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" +wrap-ansi@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" + integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" + ansi-styles "^6.1.0" + string-width "^5.0.1" + strip-ansi "^7.0.1" wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -write-file-atomic@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.3.0.tgz#1ff61575c2e2a4e8e510d6fa4e243cce183999ab" +write-file-atomic@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-5.0.1.tgz#68df4717c55c6fa4281a7860b4c2ba0a6d2b11e7" + integrity sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw== dependencies: - graceful-fs "^4.1.11" imurmurhash "^0.1.4" - signal-exit "^3.0.2" + signal-exit "^4.0.1" -write@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" - dependencies: - mkdirp "^0.5.1" - -x-is-function@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/x-is-function/-/x-is-function-1.0.4.tgz#5d294dc3d268cbdd062580e0c5df77a391d1fa1e" +ws@^8.18.0: + version "8.18.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.2.tgz#42738b2be57ced85f46154320aabb51ab003705a" + integrity sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ== -x-is-string@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/x-is-string/-/x-is-string-0.1.0.tgz#474b50865af3a49a9c4657f05acd145458f77d82" +xml-name-validator@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-5.0.0.tgz#82be9b957f7afdacf961e5980f1bf227c0bf7673" + integrity sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg== -xml-name-validator@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635" +xmlchars@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" + integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== -xtend@^4.0.0, xtend@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== -y18n@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" +yallist@^3.0.2: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== -yallist@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +yargs-parser@^21.1.1: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== + +yargs@^17.7.2: + version "17.7.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" + integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== + dependencies: + cliui "^8.0.1" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.1.1" -yargs-parser@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9" - dependencies: - camelcase "^4.1.0" +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== -yargs@^9.0.0: - version "9.0.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-9.0.1.tgz#52acc23feecac34042078ee78c0c007f5085db4c" - dependencies: - camelcase "^4.1.0" - cliui "^3.2.0" - decamelize "^1.1.1" - get-caller-file "^1.0.1" - os-locale "^2.0.0" - read-pkg-up "^2.0.0" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1" - yargs-parser "^7.0.0" - -yargs@~3.10.0: - version "3.10.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" - dependencies: - camelcase "^1.0.2" - cliui "^2.1.0" - decamelize "^1.0.0" - window-size "0.1.0" +yocto-queue@^1.1.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.2.1.tgz#36d7c4739f775b3cbc28e6136e21aa057adec418" + integrity sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg==
- - -
- Mike Grip -
-
diff --git a/build/rollup.config.mjs b/build/rollup.config.mjs new file mode 100644 index 000000000..8fa108523 --- /dev/null +++ b/build/rollup.config.mjs @@ -0,0 +1,63 @@ +import url from "url"; + +import nodeResolve from "@rollup/plugin-node-resolve"; +import commonjs from "@rollup/plugin-commonjs"; +import alias from "@rollup/plugin-alias"; +import inject from "@rollup/plugin-inject"; +import replace from "@rollup/plugin-replace"; +import babel from "@rollup/plugin-babel"; +import json from "@rollup/plugin-json"; +import terser from "@rollup/plugin-terser"; + +const getPath = (file) => url.fileURLToPath(new URL(file, import.meta.url)); + +export default { + input: getPath("../src/index.mjs"), + output: { + file: "standalone.js", + format: "umd", + name: "prettierPlugins.php", + exports: "named", + globals: { + prettier: "prettier", + }, + paths: { + prettier: "prettier/standalone", + }, + }, + external: ["prettier"], + plugins: [ + nodeResolve({ + preferBuiltins: true, + }), + commonjs(), + alias({ + entries: [{ find: "assert", replacement: getPath("./shims/assert.mjs") }], + }), + inject({ + Buffer: getPath("./shims/buffer.mjs"), + }), + replace({ + preventAssignment: true, + "process.arch": JSON.stringify("x32"), + }), + json(), + babel({ + babelHelpers: "bundled", + configFile: false, + babelrc: false, + plugins: [], + compact: false, + presets: [ + [ + "@babel/preset-env", + { + targets: { browsers: [">0.25%", "not ie 11", "not op_mini all"] }, + modules: false, + }, + ], + ], + }), + terser(), + ], +}; diff --git a/build/shims/assert.mjs b/build/shims/assert.mjs new file mode 100644 index 000000000..97ea2db2d --- /dev/null +++ b/build/shims/assert.mjs @@ -0,0 +1,3 @@ +const assert = new Proxy(() => {}, { get: () => assert }); + +export default assert; diff --git a/build/shims/buffer.mjs b/build/shims/buffer.mjs new file mode 100644 index 000000000..789f28c87 --- /dev/null +++ b/build/shims/buffer.mjs @@ -0,0 +1,5 @@ +const Buffer = { + isBuffer: () => false, +}; + +export default Buffer; diff --git a/docs/recipes/php-cs-fixer/.php_cs.dist b/docs/recipes/php-cs-fixer/.php_cs.dist new file mode 100644 index 000000000..88f7719be --- /dev/null +++ b/docs/recipes/php-cs-fixer/.php_cs.dist @@ -0,0 +1,11 @@ +registerCustomFixers([ + (new PrettierPHPFixer()), + ]) + ->setRules([ + 'Prettier/php' => true, + ]); diff --git a/docs/recipes/php-cs-fixer/PrettierPHPFixer.php b/docs/recipes/php-cs-fixer/PrettierPHPFixer.php new file mode 100644 index 000000000..dcb2fe69c --- /dev/null +++ b/docs/recipes/php-cs-fixer/PrettierPHPFixer.php @@ -0,0 +1,70 @@ +count() && + $this->isCandidate($tokens) && + $this->supports($file) + ) { + $this->applyFix($file, $tokens); + } + } + + /** + * {@inheritdoc} + */ + public function getName() { + return 'Prettier/php'; + } + + /** + * {@inheritdoc} + */ + public function supports(SplFileInfo $file) { + return true; + } + + /** + * @param SplFileInfo $file + * @param Tokens $tokens + */ + private function applyFix(SplFileInfo $file, Tokens $tokens): void + { + exec("yarn exec -- prettier $file", $prettierOutput); + $code = implode(PHP_EOL, $prettierOutput); + $tokens->setCode($code); + } +} diff --git a/docs/recipes/php-cs-fixer/README.md b/docs/recipes/php-cs-fixer/README.md new file mode 100644 index 000000000..e03c2b531 --- /dev/null +++ b/docs/recipes/php-cs-fixer/README.md @@ -0,0 +1,34 @@ +# Prettier integration to php-cs-fixer + +This recipe uses `prettier/plugin-php` as a Fixer for `php-cs-fixer`. + +`prettier` will be executed at the very beginning before the other fixers are +applied, such that the `php-cs-fixer` user's configurations is respected. + +## Useful Configurations + +### Priority + +If you would like `prettier` to execute last, which means you prefer to use +`php-cs-fixer` to complement the current missing features of `prettier`, you +can decrease the priority value of this fixer by decreasing the value returned +by `getPriority` function to something like `-999` + +### Configure Prettier's setting + +If you would like to add configuration settings for `prettier` to this Fixer, +you can modify the `exec` line in `applyFix` function. + +For example, + +```diff + - exec("yarn exec -- prettier $file"); + + exec("yarn exec -- prettier --brace-style=1tbs $file"); +``` + +will allow you to change the `braceStyle` for this fixer + +## Possible Improvement + +- the configuration can be modified from `php-cs-fixer` configuration +- autoloading diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 000000000..462b5f144 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,4 @@ +import type { Plugin } from "prettier"; + +declare const plugin: Plugin; +export default plugin; diff --git a/jest.config.mjs b/jest.config.mjs new file mode 100644 index 000000000..0170dafb7 --- /dev/null +++ b/jest.config.mjs @@ -0,0 +1,25 @@ +const RUN_STANDALONE_TESTS = Boolean(process.env.RUN_STANDALONE_TESTS); +// Can't work on `jest-light-runner` +// const ENABLE_COVERAGE = +// !RUN_STANDALONE_TESTS && Boolean(process.env.ENABLE_COVERAGE); + +export default { + // collectCoverage: ENABLE_COVERAGE, + collectCoverageFrom: [ + "/src/**/*.mjs", + "!/node_modules/", + "!/tests_config/", + ], + runner: "jest-light-runner", + transform: {}, + setupFiles: ["/tests_config/run_spec.mjs"], + // Matches `.js` file to prevent files use `.js` extension by mistake, https://github.com/prettier/plugin-php/pull/2247#discussion_r1331847801 + testRegex: ".*\\.spec\\.m?js$", + snapshotSerializers: ["jest-snapshot-serializer-raw"], + globals: { + STANDALONE: RUN_STANDALONE_TESTS, + }, + ...(RUN_STANDALONE_TESTS + ? { displayName: "test-standalone", testEnvironment: "jsdom" } + : { displayName: "test-node", testEnvironment: "node" }), +}; diff --git a/jest.eslint.config.js b/jest.eslint.config.js deleted file mode 100644 index 5c135eeb4..000000000 --- a/jest.eslint.config.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; - -module.exports = { - runner: "jest-runner-eslint", - displayName: "lint", - testMatch: ["/**/*.js"], - testPathIgnorePatterns: ["node_modules/"] -}; diff --git a/jest.test.config.js b/jest.test.config.js deleted file mode 100644 index a11dcbc14..000000000 --- a/jest.test.config.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -const ENABLE_COVERAGE = false; // !!process.env.CI; - -module.exports = { - displayName: "test", - setupFiles: ["/tests_config/run_spec.js"], - snapshotSerializers: ["/tests_config/raw-serializer.js"], - testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$", - testPathIgnorePatterns: [], - collectCoverage: ENABLE_COVERAGE, - collectCoverageFrom: ["src/**/*.js", "!/node_modules/"], - transform: {} -}; diff --git a/package.json b/package.json index 5ce157bd1..bb2c4c42e 100644 --- a/package.json +++ b/package.json @@ -1,37 +1,86 @@ { "name": "@prettier/plugin-php", - "version": "0.1.0", + "version": "0.24.0", "description": "Prettier PHP Plugin", "repository": "prettier/prettier-php", "author": "Lucas Azzola <@azz>", "license": "MIT", - "main": "src", + "unpkg": "./standalone.js", + "browser": "./standalone.js", + "types": "./index.d.ts", + "exports": { + ".": { + "types": "./index.d.ts", + "browser": "./standalone.js", + "default": "./src/index.mjs" + }, + "./standalone": { + "types": "./index.d.ts", + "default": "./standalone.js" + }, + "./package.json": "./package.json" + }, "files": [ - "src" + "src", + "standalone.js", + "index.d.ts" ], "dependencies": { - "php-parser": "glayzzle/php-parser#29e53aa16247499ef5d8987d780d3b33ac27b538" + "linguist-languages": "^8.0.0", + "php-parser": "^3.2.5" }, "devDependencies": { - "eslint": "4.1.1", - "eslint-config-prettier": "2.9.0", - "eslint-plugin-import": "2.6.1", - "eslint-plugin-jest": "21.5.0", - "eslint-plugin-prettier": "2.4.0", - "prettier": "prettier/prettier#4c464133ac37a966c792cacc660853d74c776841", - "jest": "21.1.0", - "jest-runner-eslint": "0.3.0" + "@babel/preset-env": "^7.27.2", + "@rollup/plugin-alias": "^5.1.0", + "@rollup/plugin-babel": "^6.0.3", + "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-inject": "^5.0.5", + "@rollup/plugin-json": "^6.1.0", + "@rollup/plugin-node-resolve": "^15.2.1", + "@rollup/plugin-replace": "^5.0.5", + "@rollup/plugin-terser": "^0.4.3", + "c8": "^10.1.3", + "cross-env": "^7.0.2", + "eslint": "8.57.0", + "eslint-config-prettier": "9.1.0", + "eslint-plugin-import": "2.29.1", + "eslint-plugin-jest": "27.6.3", + "eslint-plugin-prettier": "5.1.3", + "eslint-plugin-prettier-doc": "^1.1.0", + "jest": "30.0.3", + "jest-environment-jsdom": "30.0.2", + "jest-light-runner": "^0.7.9", + "jest-snapshot-serializer-raw": "^2.0.0", + "prettier": "^3.6.1", + "rollup": "^3.28.1", + "strip-ansi": "^7.1.0" }, "peerDependencies": { - "prettier": "^1.12.0" + "prettier": "^3.0.0" }, "scripts": { - "test": "jest", - "prettier": "prettier --plugin=. --parser=php" + "lint": "yarn lint:eslint && yarn lint:prettier", + "lint:eslint": "eslint .", + "lint:prettier": "prettier . --check", + "fix": "yarn fix:eslint && yarn fix:prettier", + "fix:eslint": "eslint . --fix", + "fix:prettier": "prettier . --write", + "test": "yarn test:node && yarn test:standalone", + "test:node": "jest", + "test:standalone": "yarn run build && cross-env RUN_STANDALONE_TESTS=true yarn jest", + "prepublishOnly": "yarn test", + "prettier": "prettier --plugin=src/index.mjs --parser=php", + "build": "rollup --config build/rollup.config.mjs", + "debug": "node --inspect-brk node_modules/.bin/jest --runInBand" }, - "jest": { - "projects": [ - "/jest.*.config.js" + "c8": { + "reporter": [ + "lcov", + "text" + ], + "all": true, + "include": [ + "src/**" ] } } diff --git a/src/clean.js b/src/clean.js deleted file mode 100644 index 3f6f2563c..000000000 --- a/src/clean.js +++ /dev/null @@ -1,136 +0,0 @@ -"use strict"; - -const util = require("./util"); - -/** - * This function takes the existing ast node and a copy, by reference - * We use it for testing, so that we can compare pre-post versions of the AST, - * excluding things we don't care about (like node location, case that will be - * changed by the printer, etc.) - */ -function clean(node, newObj) { - // Ignore `parenthesis` inside `parenthesis` - if (node.kind === "parenthesis" && node.inner.kind === "parenthesis") { - while (newObj.inner.kind === "parenthesis") { - newObj.inner = newObj.inner.inner; - } - } - - // continue ((2)); -> continue 2; - // continue 1; -> continue; - if ((node.kind === "continue" || node.kind === "break") && node.level) { - let { level } = newObj; - if (level.kind === "parenthesis") { - level = level.inner; - } - if (level.kind === "number") { - newObj.level = level.value == 1 ? {} : level; - } - } - - // Normalize numbers - if (node.kind === "number") { - newObj.value = util.printNumber(node.value); - } - - // All magic constant should be upper case - if (node.kind === "magic") { - newObj.value = node.value.toUpperCase(); - } - - // All reserved words should be lowercase case - if (node.kind === "identifier" && typeof node.name === "string") { - const lowerCasedName = node.name.toLowerCase(); - const isLowerCase = - [ - "int", - "float", - "bool", - "string", - "null", - "void", - "iterable", - "object", - "self" - ].indexOf(lowerCasedName) !== -1; - - newObj.name = isLowerCase ? lowerCasedName : node.name; - } - - if (["Location", "Position"].includes(node.constructor.name)) { - newObj = "locationNode"; - } - - const statements = ["foreach", "for", "if", "while", "do"]; - - if (statements.includes(node.kind)) { - // need to account for the case of nested block nodes ie - // if (true) {{{ - // $test = 1; - // }}} - const getBlockContents = blockNode => { - if ( - blockNode.children && - blockNode.children[0] && - blockNode.children[0].kind === "block" - ) { - return getBlockContents(blockNode.children[0]); - } - return blockNode; - }; - if (node.body && node.body.kind !== "block") { - newObj.body = { - kind: "block", - children: [newObj.body] - }; - } else { - newObj.body = newObj.body ? getBlockContents(newObj.body) : null; - } - - if (node.alternate && node.alternate.kind !== "block") { - newObj.alternate = { - kind: "block", - children: [newObj.alternate] - }; - } else { - newObj.alternate = newObj.alternate - ? getBlockContents(newObj.alternate) - : null; - } - } - - // Ignore `parenthesis` for `return` - if (node.kind === "return" && node.expr && node.expr.kind === "parenthesis") { - newObj.expr = newObj.expr.inner; - } - - // Ignore `parenthesis` for `print` - if (node.kind === "print" && node.arguments.kind === "parenthesis") { - newObj.arguments = newObj.arguments.inner; - } - - // Ignore `parenthesis` for `echo` - if (node.kind === "echo" && node.arguments.length > 0) { - node.arguments.forEach((argument, index) => { - newObj.arguments[index] = - node.arguments[index].kind === "parenthesis" - ? newObj.arguments[index].inner - : newObj.arguments[index]; - }); - } - - // Ignore `parenthesis` for `include` - if (node.kind === "include" && node.target.kind === "parenthesis") { - newObj.target = newObj.target.inner; - } - - if (node.kind === "usegroup" && typeof node.name === "string") { - newObj.name = newObj.name.replace(/^\\/, ""); - } - - if (node.kind === "useitem") { - newObj.name = newObj.name.replace(/^\\/, ""); - } -} - -module.exports = clean; diff --git a/src/clean.mjs b/src/clean.mjs new file mode 100644 index 000000000..3622417ca --- /dev/null +++ b/src/clean.mjs @@ -0,0 +1,111 @@ +import { printNumber, normalizeMagicMethodName } from "./util.mjs"; + +const ignoredProperties = new Set([ + "loc", + "range", + "raw", + "comments", + "leadingComments", + "trailingComments", + "parenthesizedExpression", + "parent", + "prev", + "start", + "end", + "tokens", + "errors", + "extra", +]); + +/** + * This function takes the existing ast node and a copy, by reference + * We use it for testing, so that we can compare pre-post versions of the AST, + * excluding things we don't care about (like node location, case that will be + * changed by the printer, etc.) + */ +function clean(node, newObj) { + if (node.kind === "string") { + // TODO if options are available in this method, replace with + // newObj.isDoubleQuote = !useSingleQuote(node, options); + delete newObj.isDoubleQuote; + } + + if (["array", "list"].includes(node.kind)) { + // TODO if options are available in this method, assign instead of delete + delete newObj.shortForm; + } + + if (node.kind === "inline") { + if (node.value.includes("___PSEUDO_INLINE_PLACEHOLDER___")) { + return null; + } + + newObj.value = newObj.value.replace(/\n/g, ""); + } + + // continue ((2)); -> continue 2; + // continue 1; -> continue; + if ((node.kind === "continue" || node.kind === "break") && node.level) { + const { level } = newObj; + + if (level.kind === "number") { + newObj.level = level.value === "1" ? null : level; + } + } + + // if () {{ }} -> if () {} + if (node.kind === "block") { + if (node.children.length === 1 && node.children[0].kind === "block") { + while (newObj.children[0].kind === "block") { + newObj.children = newObj.children[0].children; + } + } + } + + // Normalize numbers + if (node.kind === "number") { + newObj.value = printNumber(node.value); + } + + const statements = ["foreach", "for", "if", "while", "do"]; + + if (statements.includes(node.kind)) { + if (node.body && node.body.kind !== "block") { + newObj.body = { + kind: "block", + children: [newObj.body], + }; + } else { + newObj.body = newObj.body ? newObj.body : null; + } + + if (node.alternate && node.alternate.kind !== "block") { + newObj.alternate = { + kind: "block", + children: [newObj.alternate], + }; + } else { + newObj.alternate = newObj.alternate ? newObj.alternate : null; + } + } + + if (node.kind === "usegroup" && typeof node.name === "string") { + newObj.name = newObj.name.replace(/^\\/, ""); + } + + if (node.kind === "useitem") { + newObj.name = newObj.name.replace(/^\\/, ""); + } + + if (node.kind === "method" && node.name.kind === "identifier") { + newObj.name.name = normalizeMagicMethodName(newObj.name.name); + } + + if (node.kind === "noop") { + return null; + } +} + +clean.ignoredProperties = ignoredProperties; + +export default clean; diff --git a/src/comments.js b/src/comments.js deleted file mode 100644 index 8c9f579a5..000000000 --- a/src/comments.js +++ /dev/null @@ -1,284 +0,0 @@ -"use strict"; - -const { - addLeadingComment, - addDanglingComment, - addTrailingComment, - getNextNonSpaceNonCommentCharacterIndex -} = require("prettier").util; -const { concat, join, indent, hardline } = require("prettier").doc.builders; - -/* -Comment functions are meant to inspect various edge cases using given comment nodes, -with information about where those comment nodes exist in the tree (ie enclosingNode, -previousNode, followingNode), and then either call the built in functions to handle -certain cases (ie addLeadingComment, addTrailingComment, addDanglingComment), or just -let prettier core handle them. To signal that the plugin is taking over, the comment -handler function should return true, otherwise returning false signals that prettier -core should handle the comment - -args: - comment - text - options - ast - isLastComment -*/ - -const handleOwnLineComment = (comment, text, options) => { - return ( - handleClass(comment) || - handleFunctionParameter(comment, text, options) || - handleFunction(comment, text, options) || - handleForLoop(comment) || - handleTryCatch(comment) || - handleAlternate(comment) - ); -}; - -const handleEndOfLineComment = (comment, text, options) => { - return ( - handleClass(comment) || - handleFunctionParameter(comment, text, options) || - handleFunction(comment, text, options) || - handleForLoop(comment) || - handleTryCatch(comment) - ); -}; - -const handleRemainingComment = (comment, text, options) => { - return ( - handleClass(comment) || - handleFunctionParameter(comment, text, options) || - handleFunction(comment, text, options) || - handleForLoop(comment) || - handleTryCatch(comment) || - handleBreakAndContinueStatementComments(comment) || - handleGoto(comment) || - handleHalt(comment) - ); -}; - -const handleForLoop = comment => { - const { enclosingNode } = comment; - if ( - enclosingNode && - (enclosingNode.kind === "for" || enclosingNode.kind === "foreach") - ) { - // for an empty for loop where the body is only made up of comments, we - // need to attach this as a dangling comment on the for loop itself - if (!(enclosingNode.body && enclosingNode.body.children.length > 0)) { - addDanglingComment(enclosingNode, comment); - return true; - } - } - return false; -}; - -const handleClass = comment => { - const { enclosingNode } = comment; - if (enclosingNode && enclosingNode.kind === "class") { - // for an empty class where the body is only made up of comments, we - // need to attach this as a dangling comment on the class node itself - if (!(enclosingNode.body && enclosingNode.body.length > 0)) { - addDanglingComment(enclosingNode, comment); - return true; - } - } - return false; -}; - -const handleFunction = (comment, text, options) => { - const { enclosingNode, followingNode } = comment; - if ( - enclosingNode && - (enclosingNode.kind === "function" || enclosingNode.kind === "method") - ) { - // we need to figure out if there are any comments that should be assigned - // to the function return type. To do this we check if the comment location - // is between the last argument end location and the return type start location. - let argumentsLocEnd = 0; - for (let i = 0; i < enclosingNode.arguments.length; i++) { - argumentsLocEnd = - options.locEnd(enclosingNode.arguments[i]) > argumentsLocEnd - ? options.locEnd(enclosingNode.arguments[i]) - : argumentsLocEnd; - } - const commentIsBetweenArgumentsAndBody = - options.locStart(comment) > argumentsLocEnd && - options.locEnd(comment) < options.locStart(enclosingNode.body); - const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex( - text, - comment, - options - ); - // we additionally need to check if this isn't a trailing argument comment, - // by checking the next character isn't ")" - if ( - enclosingNode.type && - commentIsBetweenArgumentsAndBody && - text.charAt(nextCharIndex) !== ")" - ) { - if (options.locEnd(comment) < options.locStart(enclosingNode.type)) { - // we need to store this as a dangling comment in case the type is nullable - // ie function(): ?string {} - the "nullable" attribute is part of the - // function node, not the type. - addDanglingComment(enclosingNode.type, comment); - return true; - } - addTrailingComment(enclosingNode.type, comment); - return true; - } - - // for empty functions where the body is only made up of comments, we need - // to attach this as a dangling comment on the function node itself - if ( - !followingNode && // make sure we're not grabbing inline parameter comments - !(enclosingNode.body && enclosingNode.body.children.length > 0) - ) { - addDanglingComment(enclosingNode, comment); - return true; - } - } - return false; -}; - -const handleFunctionParameter = (comment, text, options) => { - const { enclosingNode } = comment; - if ( - !enclosingNode || - !["function", "method", "parameter"].includes(enclosingNode.kind) - ) { - return false; - } - // for function parameters that are assignments, we have no node to assign comments - // that fall in between the var being assigned and the "=" character. To get around this, - // we'll store any comments falling here as dangling comments on the parameter node, - // and let the printer handle them accordingly - const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex( - text, - comment, - options - ); - if (text.charAt(nextCharIndex) + text.charAt(nextCharIndex + 1) === "= ") { - addDanglingComment(enclosingNode, comment); - return true; - } - return false; -}; - -const handleTryCatch = comment => { - const { enclosingNode } = comment; - if ( - enclosingNode && - (enclosingNode.kind === "try" || enclosingNode.kind === "catch") - ) { - // for empty try/catch blocks where the body is only made up of comments, we need - // to attach this as a dangling comment on the node itself - if (!(enclosingNode.body && enclosingNode.body.children.length > 0)) { - addDanglingComment(enclosingNode, comment); - return true; - } - } - return false; -}; - -function handleBreakAndContinueStatementComments(comment) { - const { enclosingNode } = comment; - if ( - enclosingNode && - (enclosingNode.kind === "continue" || enclosingNode.kind === "break") && - !enclosingNode.label - ) { - addTrailingComment(enclosingNode, comment); - return true; - } - return false; -} - -const handleGoto = comment => { - const { enclosingNode } = comment; - if (enclosingNode && enclosingNode.kind === "goto") { - addTrailingComment(enclosingNode, comment); - return true; - } - return false; -}; - -const handleHalt = comment => { - const { enclosingNode } = comment; - if (enclosingNode && enclosingNode.kind === "halt") { - addTrailingComment(enclosingNode, comment); - return true; - } - return false; -}; - -const handleAlternate = comment => { - const { enclosingNode, followingNode } = comment; - if ( - enclosingNode && - enclosingNode.kind === "if" && - followingNode && - followingNode.kind == "if" - ) { - addLeadingComment(followingNode.body, comment); - return true; - } - return false; -}; - -// https://github.com/prettier/prettier/blob/master/src/main/comments.js#L335 -function printComment(commentPath, options) { - const comment = commentPath.getValue(); - comment.printed = true; - return options.printer.printComment(commentPath, options); -} - -// https://github.com/prettier/prettier/blob/master/src/main/comments.js#L440 -function printDanglingComments(path, options, sameIndent, filter) { - const parts = []; - const node = path.getValue(); - - if (!node || !node.comments) { - return ""; - } - - path.each(commentPath => { - const comment = commentPath.getValue(); - if ( - comment && - !comment.leading && - !comment.trailing && - (!filter || filter(comment)) - ) { - parts.push(printComment(commentPath, options)); - } - }, "comments"); - - if (parts.length === 0) { - return ""; - } - - if (sameIndent) { - return join(hardline, parts); - } - return indent(concat([hardline, join(hardline, parts)])); -} - -function hasLeadingComment(node) { - return node.comments && node.comments.some(comment => comment.leading); -} - -function hasTrailingComment(node) { - return node.comments && node.comments.some(comment => comment.trailing); -} - -module.exports = { - handleOwnLineComment, - handleEndOfLineComment, - handleRemainingComment, - printDanglingComments, - hasLeadingComment, - hasTrailingComment -}; diff --git a/src/comments.mjs b/src/comments.mjs new file mode 100644 index 000000000..828fc0162 --- /dev/null +++ b/src/comments.mjs @@ -0,0 +1,1044 @@ +import { util as prettierUtil, doc } from "prettier"; +import { isLookupNode } from "./util.mjs"; +import { locStart, locEnd } from "./loc.mjs"; + +const { + addLeadingComment, + addDanglingComment, + addTrailingComment, + skipNewline, + hasNewline, + hasNewlineInRange, + getNextNonSpaceNonCommentCharacterIndex, + isNextLineEmpty, + isPreviousLineEmpty, +} = prettierUtil; +const { join, indent, hardline, cursor, lineSuffix, breakParent } = + doc.builders; + +/* +Comment functions are meant to inspect various edge cases using given comment nodes, +with information about where those comment nodes exist in the tree (ie enclosingNode, +previousNode, followingNode), and then either call the built in functions to handle +certain cases (ie addLeadingComment, addTrailingComment, addDanglingComment), or just +let prettier core handle them. To signal that the plugin is taking over, the comment +handler function should return true, otherwise returning false signals that prettier +core should handle the comment + +args: + comment + text + options + ast + isLastComment +*/ + +function handleOwnLineComment(comment, text, options) { + const { precedingNode, enclosingNode, followingNode } = comment; + return ( + handleLastFunctionArgComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment, + options + ) || + handleMemberExpressionComments(enclosingNode, followingNode, comment) || + handleIfStatementComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment, + options + ) || + handleWhileComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment, + options + ) || + handleTryComments(enclosingNode, followingNode, comment) || + handleClassComments(enclosingNode, followingNode, comment) || + handleFunctionParameter( + text, + precedingNode, + enclosingNode, + followingNode, + comment + ) || + handleFunction(text, enclosingNode, followingNode, comment, options) || + handleForComments(enclosingNode, precedingNode, followingNode, comment) || + handleInlineComments( + enclosingNode, + precedingNode, + followingNode, + comment + ) || + handleDeclareComments(enclosingNode, precedingNode, followingNode, comment) + ); +} + +function handleEndOfLineComment(comment, text, options) { + const { precedingNode, enclosingNode, followingNode } = comment; + return ( + handleArrayComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment, + options + ) || + handleReturnComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment, + options + ) || + handleLastFunctionArgComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment, + options + ) || + handleRetifComments( + enclosingNode, + precedingNode, + followingNode, + comment, + text, + options + ) || + handleIfStatementComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment, + options + ) || + handleWhileComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment, + options + ) || + handleTryComments(enclosingNode, followingNode, comment) || + handleClassComments(enclosingNode, followingNode, comment) || + handleFunctionParameter( + text, + precedingNode, + enclosingNode, + followingNode, + comment + ) || + handleFunction(text, enclosingNode, followingNode, comment, options) || + handleEntryComments(enclosingNode, comment) || + handleCallComments(precedingNode, enclosingNode, comment) || + handleAssignComments(enclosingNode, followingNode, comment) || + handleInlineComments( + enclosingNode, + precedingNode, + followingNode, + comment + ) || + handleNamespaceComments( + enclosingNode, + precedingNode, + followingNode, + comment + ) || + handleDeclareComments( + enclosingNode, + precedingNode, + followingNode, + comment + ) || + handleGoto(enclosingNode, comment) + ); +} + +function handleRemainingComment(comment, text, options) { + const { precedingNode, enclosingNode, followingNode } = comment; + return ( + handleIfStatementComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment, + options + ) || + handleWhileComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment, + options + ) || + handleCommentInEmptyParens(text, enclosingNode, comment, options) || + handleClassComments(enclosingNode, followingNode, comment) || + handleTraitUseComments(enclosingNode, followingNode, comment) || + handleFunctionParameter( + text, + precedingNode, + enclosingNode, + followingNode, + comment + ) || + handleFunction(text, enclosingNode, followingNode, comment, options) || + handleGoto(enclosingNode, comment) || + handleHalt(precedingNode, enclosingNode, followingNode, comment) || + handleBreakAndContinueStatementComments(enclosingNode, comment) || + handleInlineComments( + enclosingNode, + precedingNode, + followingNode, + comment + ) || + handleNamespaceComments( + enclosingNode, + precedingNode, + followingNode, + comment + ) + ); +} + +function addBlockStatementFirstComment(node, comment) { + const { children } = node; + if (children.length === 0) { + addDanglingComment(node, comment); + } else { + addLeadingComment(children[0], comment); + } +} + +function addBlockOrNotComment(node, comment) { + if (node.kind === "block") { + addBlockStatementFirstComment(node, comment); + } else { + addLeadingComment(node, comment); + } +} + +function handleArrayComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment +) { + if ( + !precedingNode && + !followingNode && + enclosingNode && + enclosingNode.kind === "array" + ) { + addTrailingComment(enclosingNode, comment); + return true; + } + + return false; +} + +function handleReturnComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment +) { + if (enclosingNode && enclosingNode.kind === "return" && !enclosingNode.expr) { + addTrailingComment(enclosingNode, comment); + return true; + } + + return false; +} + +function handleLastFunctionArgComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment + /* options */ +) { + const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex( + text, + locEnd(comment) + ); + const nextCharacter = text.charAt(nextCharIndex); + + // Real functions + if ( + precedingNode && + precedingNode.kind === "identifier" && + enclosingNode && + (enclosingNode.kind === "function" || enclosingNode.kind === "method") && + nextCharacter === ")" + ) { + addTrailingComment(enclosingNode, comment); + return true; + } + + if ( + enclosingNode && + (enclosingNode.kind === "function" || enclosingNode.kind === "method") && + followingNode && + followingNode.kind === "block" + ) { + addBlockStatementFirstComment(followingNode, comment); + return true; + } + + return false; +} + +function handleMemberExpressionComments(enclosingNode, followingNode, comment) { + if ( + enclosingNode && + isLookupNode(enclosingNode) && + followingNode && + ["identifier", "variable", "encapsed"].includes(followingNode.kind) + ) { + addLeadingComment(enclosingNode, comment); + + return true; + } + + return false; +} + +function handleIfStatementComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment + /* options */ +) { + if (!enclosingNode || enclosingNode.kind !== "if" || !followingNode) { + return false; + } + + const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex( + text, + locEnd(comment) + ); + const nextCharacter = text.charAt(nextCharIndex); + + if (nextCharacter === ")") { + addTrailingComment(precedingNode, comment); + return true; + } + + // Comments before `else`/`else if` treat as a dangling comment + if ( + precedingNode === enclosingNode.body && + followingNode === enclosingNode.alternate + ) { + addDanglingComment(enclosingNode, comment); + return true; + } + + if (followingNode.kind === "if") { + addBlockOrNotComment(followingNode.body, comment); + return true; + } + + // For comments positioned after the condition parenthesis in an if statement + // before the consequent without brackets on, such as + // if (a) /* comment */ true, + // we look at the next character to see if the following node + // is the consequent for the if statement + if (enclosingNode.body === followingNode) { + addLeadingComment(followingNode, comment); + return true; + } + + return false; +} + +function handleRetifComments( + enclosingNode, + precedingNode, + followingNode, + comment, + text + /* options */ +) { + const isSameLineAsPrecedingNode = + precedingNode && + !hasNewlineInRange(text, locEnd(precedingNode), locStart(comment)); + + if ( + (!precedingNode || !isSameLineAsPrecedingNode) && + enclosingNode && + enclosingNode.kind === "retif" && + followingNode + ) { + addLeadingComment(followingNode, comment); + return true; + } + return false; +} + +function handleForComments( + enclosingNode, + precedingNode, + followingNode, + comment +) { + if ( + !followingNode && + enclosingNode && + (enclosingNode.kind === "for" || enclosingNode.kind === "foreach") + ) { + // For a shortform for loop (where the body is just one node), add + // this as a leading comment to the body + if (enclosingNode.body && enclosingNode.body.kind !== "block") { + addLeadingComment(followingNode, comment); + } else { + addLeadingComment(enclosingNode, comment); + } + return true; + } + + return false; +} + +function handleTraitUseComments(enclosingNode, followingNode, comment) { + if ( + enclosingNode && + enclosingNode.kind === "traituse" && + enclosingNode.adaptations && + !enclosingNode.adaptations.length + ) { + addDanglingComment(enclosingNode, comment); + return true; + } + return false; +} + +function handleClassComments(enclosingNode, followingNode, comment) { + if ( + enclosingNode && + ["class", "interface", "trait"].includes(enclosingNode.kind) + ) { + if (enclosingNode.__parent_new_arguments?.includes(followingNode)) { + return false; + } + + // for extends nodes that have leading comments, we can store them as + // dangling comments so we can handle them in the printer + + if (followingNode && enclosingNode.extends) { + if (!Array.isArray(enclosingNode.extends)) { + if (followingNode === enclosingNode.extends) { + addDanglingComment(followingNode, comment); + return true; + } + } else { + if ( + enclosingNode.extends.some((extendsNode) => { + if (followingNode && followingNode === extendsNode) { + addDanglingComment(followingNode, comment); + return true; + } + }) + ) { + return true; + } + } + } + + // check each implements node - if any of them have comments we can store + // them as dangling comments and handle them in the printer + if (followingNode && enclosingNode.implements) { + if ( + enclosingNode.implements.some((implementsNode) => { + if (followingNode && followingNode === implementsNode) { + addDanglingComment(followingNode, comment); + return true; + } + }) + ) { + return true; + } + } + + // For an empty class where the body is only made up of comments, we + // need to attach this as a dangling comment on the class node itself + if (!(enclosingNode.body && enclosingNode.body.length > 0)) { + addDanglingComment(enclosingNode, comment); + return true; + } + } + + if ( + followingNode && + followingNode.kind === "class" && + followingNode.isAnonymous && + followingNode.leadingComments && + comment.kind === "commentblock" + ) { + return true; + } + return false; +} + +function handleFunction( + text, + enclosingNode, + followingNode, + comment + /* options */ +) { + if ( + enclosingNode && + (enclosingNode.kind === "function" || enclosingNode.kind === "method") + ) { + // we need to figure out if there are any comments that should be assigned + // to the function return type. To do this we check if the comment location + // is between the last argument end location and the return type start location. + let argumentsLocEnd = 0; + for (let i = 0; i < enclosingNode.arguments.length; i++) { + argumentsLocEnd = + locEnd(enclosingNode.arguments[i]) > argumentsLocEnd + ? locEnd(enclosingNode.arguments[i]) + : argumentsLocEnd; + } + const commentIsBetweenArgumentsAndBody = + enclosingNode.body && + locStart(comment) > argumentsLocEnd && + locEnd(comment) < locStart(enclosingNode.body); + const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex( + text, + locEnd(comment) + ); + // we additionally need to check if this isn't a trailing argument comment, + // by checking the next character isn't ")" + if ( + enclosingNode.type && + commentIsBetweenArgumentsAndBody && + text.charAt(nextCharIndex) !== ")" + ) { + if (locEnd(comment) < locStart(enclosingNode.type)) { + // we need to store this as a dangling comment in case the type is nullable + // ie function(): ?string {} - the "nullable" attribute is part of the + // function node, not the type. + addDanglingComment(enclosingNode.type, comment); + return true; + } + addTrailingComment(enclosingNode.type, comment); + return true; + } + } + return false; +} + +function handleFunctionParameter( + text, + precedingNode, + enclosingNode, + followingNode, + comment +) { + if ( + !enclosingNode || + !["function", "method", "parameter"].includes(enclosingNode.kind) + ) { + return false; + } + if ( + precedingNode.kind === "typereference" && + followingNode.kind === "identifier" + ) { + addTrailingComment(precedingNode, comment); + return true; + } + return false; +} + +function handleBreakAndContinueStatementComments(enclosingNode, comment) { + if ( + enclosingNode && + (enclosingNode.kind === "continue" || enclosingNode.kind === "break") && + !enclosingNode.label + ) { + addTrailingComment(enclosingNode, comment); + return true; + } + return false; +} + +function handleGoto(enclosingNode, comment) { + if (enclosingNode && ["label", "goto"].includes(enclosingNode.kind)) { + addTrailingComment(enclosingNode, comment); + return true; + } + return false; +} + +function handleHalt(precedingNode, enclosingNode, followingNode, comment) { + if (enclosingNode && enclosingNode.kind === "halt") { + addDanglingComment(enclosingNode, comment); + return true; + } + + if (precedingNode && precedingNode.kind === "halt") { + addDanglingComment(precedingNode, comment); + return true; + } + + return false; +} + +function handleCommentInEmptyParens( + text, + enclosingNode, + comment + /* options */ +) { + const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex( + text, + locEnd(comment) + ); + + if (text.charAt(nextCharIndex) !== ")") { + return false; + } + + // Only add dangling comments to fix the case when no arguments are present, + // i.e. a function without any argument. + if ( + enclosingNode && + (enclosingNode.kind === "function" || + enclosingNode.kind === "closure" || + enclosingNode.kind === "method" || + enclosingNode.kind === "call" || + enclosingNode.kind === "new") && + enclosingNode.arguments.length === 0 + ) { + addDanglingComment(enclosingNode, comment); + return true; + } + return false; +} + +function handleInlineComments( + enclosingNode, + precedingNode, + followingNode, + comment +) { + if (followingNode && followingNode.kind === "inline") { + if (!followingNode.leadingComments) { + followingNode.leadingComments = []; + } + + if (!followingNode.leadingComments.includes(comment)) { + followingNode.leadingComments.push(comment); + } + + return true; + } else if ( + !enclosingNode && + !followingNode && + precedingNode && + precedingNode.kind === "inline" + ) { + addDanglingComment(precedingNode, comment); + return true; + } + return false; +} + +function handleEntryComments(enclosingNode, comment) { + if (enclosingNode && enclosingNode.kind === "entry") { + addLeadingComment(enclosingNode, comment); + return true; + } + return false; +} + +function handleAssignComments(enclosingNode, followingNode, comment) { + if (enclosingNode && enclosingNode.kind === "assign" && followingNode) { + const equalSignOffset = + enclosingNode.loc.start.offset + enclosingNode.loc.source.indexOf("="); + + if (comment.loc.start.offset > equalSignOffset) { + addLeadingComment(followingNode, comment); + return true; + } + } + + return false; +} + +function handleTryComments(enclosingNode, followingNode, comment) { + if (!enclosingNode || enclosingNode.kind !== "try" || !followingNode) { + return false; + } + + if (followingNode.kind === "block") { + addBlockStatementFirstComment(followingNode, comment); + return true; + } + + if (followingNode.kind === "try") { + addBlockOrNotComment(followingNode.always, comment); + return true; + } + + if (followingNode.kind === "catch") { + addBlockOrNotComment(followingNode.body, comment); + return true; + } + + return false; +} + +function handleCallComments(precedingNode, enclosingNode, comment) { + if ( + enclosingNode && + enclosingNode.kind === "call" && + precedingNode && + enclosingNode.what === precedingNode && + enclosingNode.arguments.length > 0 + ) { + addLeadingComment(enclosingNode.arguments[0], comment); + return true; + } + return false; +} + +function handleNamespaceComments( + enclosingNode, + precedingNode, + followingNode, + comment +) { + if ( + !followingNode && + !precedingNode && + enclosingNode && + enclosingNode.kind === "namespace" && + !enclosingNode.withBrackets + ) { + addTrailingComment(enclosingNode, comment); + return true; + } else if ( + !precedingNode && + enclosingNode && + enclosingNode.kind === "namespace" && + !enclosingNode.withBrackets + ) { + addDanglingComment(enclosingNode, comment); + return true; + } + + return false; +} + +function handleDeclareComments( + enclosingNode, + precedingNode, + followingNode, + comment +) { + if (!enclosingNode || enclosingNode.kind !== "declare") { + return false; + } + + if (precedingNode && precedingNode.kind === "noop") { + return false; + } + + if (!followingNode || enclosingNode.directives[0] === followingNode) { + if (enclosingNode.mode === "none") { + addTrailingComment(enclosingNode, comment); + } else { + addDanglingComment(enclosingNode, comment); + } + + return true; + } + + if (followingNode && precedingNode) { + addLeadingComment(followingNode, comment); + + return true; + } + + return false; +} + +function handleWhileComments( + text, + precedingNode, + enclosingNode, + followingNode, + comment + /* options */ +) { + if (!enclosingNode || enclosingNode.kind !== "while" || !followingNode) { + return false; + } + // We unfortunately have no way using the AST or location of nodes to know + // if the comment is positioned before the condition parenthesis: + // while (a /* comment */) {} + // The only workaround I found is to look at the next character to see if + // it is a ). + + const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex( + text, + locEnd(comment) + ); + const nextCharacter = text.charAt(nextCharIndex); + + if (nextCharacter === ")") { + addTrailingComment(precedingNode, comment); + return true; + } + + if (followingNode.kind === "block") { + addBlockStatementFirstComment(followingNode, comment); + return true; + } + + return false; +} + +// https://github.com/prettier/prettier/blob/c01661f311a2e1e033f1f9cb127882cc13e293bd/src/main/comments/print.js#L23 +function printComment(path, options) { + const comment = path.node; + comment.printed = true; + return options.printer.printComment(path, options); +} + +// https://github.com/prettier/prettier/blob/6bff776efd0951b7812818d02d1cae3fda184737/src/main/comments/print.js#L119 +function printDanglingComments(path, options, sameIndent, filter) { + const parts = []; + const node = path.getValue(); + + if (!node || !node.comments) { + return ""; + } + + path.each(() => { + const comment = path.node; + if ( + comment && + !comment.leading && + !comment.trailing && + (!filter || filter(comment)) + ) { + parts.push(printComment(path, options)); + } + }, "comments"); + + if (parts.length === 0) { + return ""; + } + + if (sameIndent) { + return join(hardline, parts); + } + return indent([hardline, join(hardline, parts)]); +} + +function hasLeadingComment(node) { + return node.comments && node.comments.some((comment) => comment.leading); +} + +function hasTrailingComment(node) { + return node.comments && node.comments.some((comment) => comment.trailing); +} + +function hasLeadingOwnLineComment(text, node) { + return ( + node.comments && + node.comments.some( + (comment) => comment.leading && hasNewline(text, locEnd(comment)) + ) + ); +} + +function printComments(comments, options) { + const parts = []; + comments.forEach((comment, index, comments) => { + comment.printed = true; + const isLastComment = comments.length === index + 1; + parts.push(comment.value); + if (!isLastComment) { + parts.push(hardline); + } + if ( + isNextLineEmpty(options.originalText, locEnd(comment)) && + !isLastComment + ) { + parts.push(hardline); + } + }); + return parts; +} + +function isBlockComment(comment) { + return comment.kind === "commentblock"; +} + +function getCommentChildNodes(node) { + if (node.kind === "new" && node.what.kind === "class") { + // Pretend to be child of `class` + node.what.__parent_new_arguments = [...node.arguments]; + return [node.what]; + } +} + +function canAttachComment(node) { + return ( + node.kind && node.kind !== "commentblock" && node.kind !== "commentline" + ); +} + +// Based on https://github.com/prettier/prettier/blob/master/src/main/comments.js +// TODO remove after https://github.com/prettier/prettier/issues/5087 +function prependCursorPlaceholder(path, options, printed) { + const { node } = path; + if (node && node === options.cursorNode) { + return [cursor, printed, cursor]; + } + + return printed; +} + +function printLeadingComment(path, print, options) { + const contents = printComment(path, options); + + if (!contents) { + return ""; + } + + const comment = path.node; + const isBlock = + options.printer.isBlockComment && options.printer.isBlockComment(comment); + + // Leading block comments should see if they need to stay on the + // same line or not. + if (isBlock) { + return [ + contents, + hasNewline(options.originalText, locEnd(comment)) ? hardline : " ", + ]; + } + + return [contents, hardline]; +} + +function printTrailingComment(path, print, options) { + const contents = printComment(path, options); + if (!contents) { + return ""; + } + + const comment = path.node; + const isBlock = + options.printer.isBlockComment && options.printer.isBlockComment(comment); + + if ( + hasNewline(options.originalText, locStart(comment), { + backwards: true, + }) + ) { + // This allows comments at the end of nested structures: + // { + // x: 1, + // y: 2 + // // A comment + // } + // Those kinds of comments are almost always leading comments, but + // here it doesn't go "outside" the block and turns it into a + // trailing comment for `2`. We can simulate the above by checking + // if this a comment on its own line; normal trailing comments are + // always at the end of another expression. + + const isLineBeforeEmpty = isPreviousLineEmpty( + options.originalText, + locStart(comment) + ); + + return lineSuffix([hardline, isLineBeforeEmpty ? hardline : "", contents]); + } else if (isBlock) { + // Trailing block comments never need a newline + return [" ", contents]; + } + + return [lineSuffix([" ", contents]), !isBlock ? breakParent : ""]; +} + +function printAllComments(path, print, options, needsSemi) { + const { node } = path; + const printed = print(path); + const comments = node && node.comments; + + if (!comments || comments.length === 0) { + return prependCursorPlaceholder(path, options, printed); + } + + const leadingParts = []; + const trailingParts = [needsSemi ? ";" : "", printed]; + + path.each(({ node: comment }) => { + const { leading, trailing } = comment; + + if (leading) { + const contents = printLeadingComment(path, print, options); + if (!contents) { + return; + } + leadingParts.push(contents); + + const text = options.originalText; + if (hasNewline(text, skipNewline(text, locEnd(comment)))) { + leadingParts.push(hardline); + } + } else if (trailing) { + trailingParts.push(printTrailingComment(path, print, options)); + } + }, "comments"); + + return prependCursorPlaceholder( + path, + options, + leadingParts.concat(trailingParts) + ); +} + +export { + handleOwnLineComment, + handleEndOfLineComment, + handleRemainingComment, + getCommentChildNodes, + canAttachComment, + isBlockComment, + printDanglingComments, + hasLeadingComment, + hasTrailingComment, + hasLeadingOwnLineComment, + printComments, + printAllComments, +}; diff --git a/src/index.js b/src/index.js deleted file mode 100644 index 1f00e5a74..000000000 --- a/src/index.js +++ /dev/null @@ -1,327 +0,0 @@ -"use strict"; - -const parse = require("./parser"); -const print = require("./printer"); -const clean = require("./clean"); -const options = require("./options"); -const comments = require("./comments"); -const { join, hardline } = require("prettier").doc.builders; - -const languages = [ - { - name: "PHP", - parsers: ["php"], - tmScope: "text.html.php", - aceMode: "php", - codemirrorMode: "php", - extensions: [ - ".php", - ".aw", - ".ctp", - ".fcgi", - ".inc", - ".php3", - ".php4", - ".php5", - ".phps", - ".phpt" - ], - filenames: [".php_cs", ".php_cs.dist", "Phakefile"], - vscodeLanguageIds: ["php"], - linguistLanguageId: 272 - } -]; - -// for anonymous classes, we need to keep track of the parent "new" node. -// this is because in a case like this: -// $test = new class($arg1, $arg2) extends TestClass {}; -// we actually want to pretend that the class node starts after the "new" -// node's arguments, since there is logic in prettier that assumes child nodes -// will never overlap each other (ie the "new" node has the arguments, and class -// as children, and we can't have them overlap) -const anonymousClassesNewNodes = []; -const loc = prop => node => { - if ( - node.kind === "new" && - node.what.kind === "class" && - node.what.isAnonymous && - node.arguments.length > 0 && - !anonymousClassesNewNodes.includes(node) - ) { - anonymousClassesNewNodes.push(node); - } - if (prop === "start" && node.kind === "class" && node.isAnonymous) { - const parentNewNode = anonymousClassesNewNodes.find( - newNode => newNode.what === node - ); - if (parentNewNode && parentNewNode.arguments.length > 0) { - const lastArgumentNode = - parentNewNode.arguments[parentNewNode.arguments.length - 1]; - // if this is an anonymous class node with a parent "new" node, use the - // location of the last argument in the new node as the fake start location - // for this class node - return ( - (lastArgumentNode.loc && - lastArgumentNode.loc.end && - lastArgumentNode.loc.end.offset) + 1 - ); - } - } - return node.loc && node.loc[prop] && node.loc[prop].offset; -}; - -const parsers = { - php: { - parse, - astFormat: "php", - locStart: loc("start"), - locEnd: loc("end") - } -}; - -const printers = { - php: { - print, - massageAstNode: clean, - // @TODO: determine if it makes sense to abstract this into a "getChildNodes" util function - getCommentChildNodes(node) { - const nodeMap = [ - { - kinds: ["constant", "property", "classconstant"], - children: { listNodes: [], nodes: ["value"] } - }, - { - kinds: ["return"], - children: { listNodes: [], nodes: ["expr"] } - }, - { - kinds: ["static", "array", "usegroup"], - children: { listNodes: ["items"], nodes: [] } - }, - { - kinds: ["entry"], - children: { listNodes: [], nodes: ["key", "value"] } - }, - { - kinds: ["assign"], - children: { listNodes: [], nodes: ["left", "right"] } - }, - { - kinds: ["if"], - children: { listNodes: [], nodes: ["body", "alternate", "test"] } - }, - { - kinds: ["block", "program", "namespace", "declare"], - children: { listNodes: ["children"], nodes: [] } - }, - { - kinds: ["foreach"], - children: { - listNodes: [], - nodes: ["key", "source", "value", "body"] - } - }, - { - kinds: ["try"], - children: { - listNodes: ["catches"], - nodes: ["always", "body"] - } - }, - { - kinds: ["call", "new"], - children: { listNodes: ["arguments"], nodes: ["what"] } - }, - { - kinds: ["offsetlookup", "staticlookup"], - children: { listNodes: [], nodes: ["what", "offset"] } - }, - { - kinds: ["catch"], - children: { - listNodes: ["what"], - nodes: ["variable", "body"] - } - }, - { - kinds: ["while", "do"], - children: { listNodes: [], nodes: ["test", "body"] } - }, - { - kinds: ["for"], - children: { - listNodes: [], - nodes: ["init", "test", "increment", "body"] - } - }, - { - kinds: ["trait", "class"], - children: { listNodes: ["implements", "body"], nodes: ["extends"] } - }, - { - kinds: ["interface"], - children: { listNodes: ["extends", "body"], nodes: [] } - }, - { - kinds: ["function", "method", "closure"], - children: { - listNodes: ["arguments", "uses"], - nodes: ["body", "type"] - } - }, - { - kinds: ["switch", "case"], - children: { listNodes: [], nodes: ["test", "body"] } - }, - { - kinds: ["bin"], - children: { listNodes: [], nodes: ["left", "right"] } - }, - { - kinds: ["parameter"], - children: { listNodes: [], nodes: ["type", "value"] } - }, - { - kinds: ["yieldfrom"], - children: { listNodes: [], nodes: ["value"] } - }, - { - kinds: ["retif"], - children: { listNodes: [], nodes: ["trueExpr", "falseExpr", "test"] } - }, - { - kinds: ["echo"], - children: { listNodes: ["arguments"], nodes: [] } - }, - { - kinds: ["parenthesis"], - children: { listNodes: [], nodes: ["inner"] } - }, - { - kinds: ["include"], - children: { listNodes: [], nodes: ["target"] } - }, - { - kinds: ["throw", "clone", "pre", "post", "unary", "cast", "variadic"], - children: { listNodes: [], nodes: ["what"] } - }, - { - kinds: ["list", "isset", "unset", "empty"], - children: { listNodes: ["arguments"], nodes: [] } - }, - { - kinds: ["global"], - children: { listNodes: ["items"], nodes: [] } - }, - { - kinds: ["print"], - children: { listNodes: [], nodes: ["arguments"] } - }, - { - kinds: ["eval"], - children: { listNodes: [], nodes: ["source"] } - }, - { - kinds: ["yield"], - children: { listNodes: [], nodes: ["key", "value"] } - }, - { - kinds: ["traituse"], - children: { listNodes: ["traits", "adaptations"], nodes: [] } - }, - { - kinds: ["traitprecedence"], - children: { listNodes: [], nodes: ["trait", "instead"] } - }, - { - kinds: ["traitalias"], - children: { listNodes: [], nodes: ["trait"] } - }, - { - kinds: ["silent"], - children: { listNodes: [], nodes: ["expr"] } - }, - { - kinds: ["exit"], - children: { listNodes: [], nodes: ["status"] } - } - ]; - const children = nodeMap.reduce((currentChildren, map) => { - if (map.kinds.includes(node.kind)) { - return [ - ...map.children.listNodes.reduce((accumulator, listNode) => { - const childValue = node[listNode]; - return childValue ? [...accumulator, ...childValue] : accumulator; - }, []), - ...map.children.nodes.reduce((accumulator, childNode) => { - const childValue = node[childNode]; - return childValue ? [...accumulator, childValue] : accumulator; - }, []) - ]; - } - return currentChildren; - }, false); - return children !== false ? children : []; - }, - canAttachComment(node) { - return ( - node.kind && node.kind !== "commentblock" && node.kind !== "commentline" - ); - }, - isBlockComment(comment) { - return comment.kind === "commentblock"; - }, - handleComments: { - ownLine: comments.handleOwnLineComment, - endOfLine: comments.handleEndOfLineComment, - remaining: comments.handleRemainingComment - }, - printComment(commentPath) { - const comment = commentPath.getValue(); - - switch (comment.kind) { - case "commentblock": { - // for now, don't touch single line block comments - if (!comment.value.includes("\n")) { - return comment.value; - } - - const lines = comment.value.split("\n"); - // if this is a block comment, handle indentation - if ( - lines - .slice(1, lines.length - 1) - .every(line => line.trim()[0] === "*") - ) { - return join( - hardline, - lines.map( - (line, index) => - (index > 0 ? " " : "") + - (index < lines.length - 1 ? line.trim() : line.trimLeft()) - ) - ); - } - - // otherwise we can't be sure about indentation, so just print as is - return comment.value; - } - case "commentline": { - return comment.value.trimRight(); - } - default: - throw new Error(`Not a comment: ${JSON.stringify(comment)}`); - } - } - } -}; - -module.exports = { - languages, - printers, - parsers, - options, - defaultOptions: { - tabWidth: 4 - } -}; diff --git a/src/index.mjs b/src/index.mjs new file mode 100644 index 000000000..6a35c034d --- /dev/null +++ b/src/index.mjs @@ -0,0 +1,173 @@ +import { doc } from "prettier"; +import LINGUIST_LANGUAGES_PHP from "linguist-languages/data/PHP"; +import LINGUIST_LANGUAGES_HTML_PHP from "linguist-languages/data/HTML_2b_PHP"; +import parse from "./parser.mjs"; +import print from "./printer.mjs"; +import clean from "./clean.mjs"; +import options from "./options.mjs"; +import { + handleOwnLineComment, + handleEndOfLineComment, + handleRemainingComment, + getCommentChildNodes, + canAttachComment, + isBlockComment, +} from "./comments.mjs"; +import { hasPragma, insertPragma } from "./pragma.mjs"; +import { locStart, locEnd } from "./loc.mjs"; + +const { join, hardline } = doc.builders; + +function createLanguage(linguistData, { extend, override }) { + const language = {}; + + for (const key in linguistData) { + const newKey = key === "languageId" ? "linguistLanguageId" : key; + language[newKey] = linguistData[key]; + } + + if (extend) { + for (const key in extend) { + language[key] = (language[key] || []).concat(extend[key]); + } + } + + for (const key in override) { + language[key] = override[key]; + } + + return language; +} + +const languages = [ + createLanguage(LINGUIST_LANGUAGES_PHP, { + override: { + parsers: ["php"], + vscodeLanguageIds: ["php"], + }, + }), + createLanguage(LINGUIST_LANGUAGES_HTML_PHP, { + override: { + parsers: ["php"], + vscodeLanguageIds: ["php"], + }, + }), +]; + +const parsers = { + php: { + parse, + astFormat: "php", + locStart, + locEnd, + hasPragma, + }, +}; + +const ignoredKeys = new Set([ + "kind", + "loc", + "errors", + "extra", + "comments", + "leadingComments", + "enclosingNode", + "precedingNode", + "followingNode", +]); +function getVisitorKeys(node, nonTraversableKeys) { + return Object.keys(node).filter( + (key) => !nonTraversableKeys.has(key) && !ignoredKeys.has(key) + ); +} + +const printers = { + php: { + print, + getVisitorKeys, + insertPragma, + massageAstNode: clean, + getCommentChildNodes, + canAttachComment, + isBlockComment, + handleComments: { + ownLine: handleOwnLineComment, + endOfLine: handleEndOfLineComment, + remaining: handleRemainingComment, + }, + willPrintOwnComments(path) { + const { node } = path; + + return node && node.kind === "noop"; + }, + printComment(path) { + const comment = path.node; + + switch (comment.kind) { + case "commentblock": { + // for now, don't touch single line block comments + if (!comment.value.includes("\n")) { + return comment.value; + } + + const lines = comment.value.split("\n"); + // if this is a block comment, handle indentation + if ( + lines + .slice(1, lines.length - 1) + .every((line) => line.trim()[0] === "*") + ) { + return join( + hardline, + lines.map( + (line, index) => + (index > 0 ? " " : "") + + (index < lines.length - 1 ? line.trim() : line.trimLeft()) + ) + ); + } + + // otherwise we can't be sure about indentation, so just print as is + return comment.value; + } + case "commentline": { + return comment.value.trimRight(); + } + /* c8 ignore next 2 */ + default: + throw new Error(`Not a comment: ${JSON.stringify(comment)}`); + } + }, + hasPrettierIgnore(path) { + const isSimpleIgnore = (comment) => + comment.value.includes("prettier-ignore") && + !comment.value.includes("prettier-ignore-start") && + !comment.value.includes("prettier-ignore-end"); + + const { node, parent: parentNode } = path; + + return ( + (node && + node.kind !== "classconstant" && + node.comments && + node.comments.length > 0 && + node.comments.some(isSimpleIgnore)) || + // For proper formatting, the classconstant ignore formatting should + // run on the "constant" child + (node && + node.kind === "constant" && + parentNode && + parentNode.kind === "classconstant" && + parentNode.comments && + parentNode.comments.length > 0 && + parentNode.comments.some(isSimpleIgnore)) + ); + }, + }, +}; + +const defaultOptions = { + tabWidth: 4, +}; + +export { languages, printers, parsers, options, defaultOptions }; diff --git a/src/loc.mjs b/src/loc.mjs new file mode 100644 index 000000000..c52168aa1 --- /dev/null +++ b/src/loc.mjs @@ -0,0 +1,4 @@ +const loc = (prop) => (node) => node.loc?.[prop]?.offset; + +export const locStart = loc("start"); +export const locEnd = loc("end"); diff --git a/src/needs-parens.mjs b/src/needs-parens.mjs new file mode 100644 index 000000000..c234c8da7 --- /dev/null +++ b/src/needs-parens.mjs @@ -0,0 +1,250 @@ +import { getPrecedence, shouldFlatten, isBitwiseOperator } from "./util.mjs"; + +function needsParens(path, options) { + const { parent } = path; + + if (!parent) { + return false; + } + + const { key, node } = path; + + if ( + [ + // No need parens for top level children of this nodes + "program", + "expressionstatement", + "namespace", + "declare", + "block", + + // No need parens + "include", + "print", + "return", + "echo", + ].includes(parent.kind) + ) { + return false; + } + + switch (node.kind) { + case "pre": + case "post": + if (parent.kind === "unary") { + return ( + node.kind === "pre" && + ((node.type === "+" && parent.type === "+") || + (node.type === "-" && parent.type === "-")) + ); + } + // else fallthrough + case "unary": + switch (parent.kind) { + case "unary": + return ( + node.type === parent.type && + (node.type === "+" || node.type === "-") + ); + case "propertylookup": + case "nullsafepropertylookup": + case "staticlookup": + case "offsetlookup": + case "call": + return key === "what"; + case "bin": + return parent.type === "**" && key === "left"; + default: + return false; + } + case "bin": { + switch (parent.kind) { + case "assign": + case "retif": + return ["and", "xor", "or"].includes(node.type); + case "silent": + case "cast": + // TODO: bug https://github.com/glayzzle/php-parser/issues/172 + return node.parenthesizedExpression; + case "pre": + case "post": + case "unary": + return true; + case "call": + case "propertylookup": + case "nullsafepropertylookup": + case "staticlookup": + case "offsetlookup": + return key === "what"; + case "bin": { + const po = parent.type; + const pp = getPrecedence(po); + const no = node.type; + const np = getPrecedence(no); + + if (pp > np) { + return true; + } + + if (po === "||" && no === "&&") { + return true; + } + + if (pp === np && key === "right") { + return true; + } + + if (pp === np && !shouldFlatten(po, no)) { + return true; + } + + if (pp < np && no === "%") { + return po === "+" || po === "-"; + } + + // Add parenthesis when working with bitwise operators + // It's not stricly needed but helps with code understanding + if (isBitwiseOperator(po)) { + return true; + } + + return false; + } + + default: + return false; + } + } + case "propertylookup": + case "nullsafepropertylookup": + case "staticlookup": { + switch (parent.kind) { + case "call": + return key === "what" && node.parenthesizedExpression; + + default: + return false; + } + } + case "clone": + case "new": { + const requiresParens = + node.kind === "clone" || + (node.kind === "new" && options.phpVersion < 8.4); + switch (parent.kind) { + case "propertylookup": + case "nullsafepropertylookup": + case "staticlookup": + case "offsetlookup": + case "call": + return key === "what" && requiresParens; + default: + return false; + } + } + case "yield": { + switch (parent.kind) { + case "propertylookup": + case "nullsafepropertylookup": + case "staticlookup": + case "offsetlookup": + case "call": + return key === "what"; + + case "retif": + return key === "test"; + + default: + return !!(node.key || node.value); + } + } + case "assign": { + if ( + parent.kind === "for" && + (parent.init.includes(node) || parent.increment.includes(node)) + ) { + return false; + } else if (parent.kind === "assign") { + return false; + } else if (parent.kind === "static") { + return false; + } else if ( + ["if", "do", "while", "foreach", "switch"].includes(parent.kind) + ) { + return false; + } else if (parent.kind === "silent") { + return false; + } else if (parent.kind === "call") { + return false; + } + + return true; + } + case "retif": + switch (parent.kind) { + case "cast": + return true; + case "unary": + case "bin": + case "retif": + if (key === "test" && !parent.trueExpr) { + return false; + } + + return true; + case "propertylookup": + case "nullsafepropertylookup": + case "staticlookup": + case "offsetlookup": + case "call": + return key === "what"; + + default: + return false; + } + case "closure": + switch (parent.kind) { + case "call": + return key === "what"; + + // https://github.com/prettier/plugin-php/issues/1675 + case "propertylookup": + case "nullsafepropertylookup": + return true; + + default: + return false; + } + case "silence": + case "cast": + // TODO: bug https://github.com/glayzzle/php-parser/issues/172 + return node.parenthesizedExpression; + // else fallthrough + case "string": + case "array": + switch (parent.kind) { + case "propertylookup": + case "nullsafepropertylookup": + case "staticlookup": + case "offsetlookup": + case "call": + if ( + ["string", "array"].includes(node.kind) && + parent.kind === "offsetlookup" + ) { + return false; + } + + return key === "what"; + default: + return false; + } + case "print": + case "include": + return parent.kind === "bin"; + } + + return false; +} + +export default needsParens; diff --git a/src/options.js b/src/options.js deleted file mode 100644 index 56520c57c..000000000 --- a/src/options.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -module.exports = { - // see https://github.com/prettier/plugin-php/issues/107 - // openingBraceNewLine: { - // type: "boolean", - // category: "Global", - // default: true, - // description: "Move open brace for code blocks onto new line." - // } -}; diff --git a/src/options.mjs b/src/options.mjs new file mode 100644 index 000000000..e7444d804 --- /dev/null +++ b/src/options.mjs @@ -0,0 +1,151 @@ +import fs from "fs"; +import path from "path"; + +const CATEGORY_PHP = "PHP"; + +// prettier-ignore +const SUPPORTED_PHP_VERSIONS = [ + 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, + 7.0, 7.1, 7.2, 7.3, 7.4, + 8.0, 8.1, 8.2, 8.3, 8.4, +]; + +export const LATEST_SUPPORTED_PHP_VERSION = Math.max(...SUPPORTED_PHP_VERSIONS); + +let getComposerError = ""; + +/** + * Detect the minimum PHP version from the composer.json file + * @return {number|null} The PHP version to use in the composer.json file, null when not found + */ +function getComposerPhpVersion() { + // Try to find composer.json + const currentDir = process.cwd(); + let composerPath = null; + + const directComposerPath = path.join(currentDir, "composer.json"); + if (fs.existsSync(directComposerPath)) { + composerPath = directComposerPath; + } + + if (!composerPath) { + let searchDir = path.dirname(currentDir); + while (searchDir !== path.parse(searchDir).root) { + const potentialComposerPath = path.join(searchDir, "composer.json"); + if (fs.existsSync(potentialComposerPath)) { + composerPath = potentialComposerPath; + break; + } + searchDir = path.dirname(searchDir); + } + } + + if (composerPath) { + try { + const fileContent = fs.readFileSync(composerPath, "utf8"); + const composerJson = JSON.parse(fileContent); + + if (composerJson.require && composerJson.require.php) { + // Check for a wildcard pattern like "7.*" + const wildcardMatch = composerJson.require.php.match( + /^(?:[^0-9]*)?([0-9]+)\.\*/ + ); + if (wildcardMatch) { + return parseFloat(`${wildcardMatch[1]}.0`); + } + + // Extract version from composer semver format + const versionMatch = composerJson.require.php.match( + /^(?:[^0-9]*)?([0-9]+)\.([0-9]+)/ + ); + + if (versionMatch) { + return parseFloat(`${versionMatch[1]}.${versionMatch[2]}`); + } else { + getComposerError = `Could not decode PHP version (${composerJson.require.php}})`; + return null; + } + } + } catch (e) { + getComposerError = `Error reading composer.json: ${e.message}`; + } + } else { + getComposerError = "Could not find composer.json"; + } + + return null; +} + +export { getComposerPhpVersion }; + +/** + * Resolve the PHP version to a number based on the provided options. + * + */ +export function resolvePhpVersion(options) { + if (!options) { + return; + } + if (options.phpVersion === "auto") { + options.phpVersion = + getComposerPhpVersion() ?? LATEST_SUPPORTED_PHP_VERSION; + } else if (options.phpVersion === "composer") { + const v = getComposerPhpVersion(); + if (v === null) { + throw new Error( + `Could not determine PHP version from composer; ${getComposerError}` + ); + } + options.phpVersion = v; + } else { + options.phpVersion = parseFloat(options.phpVersion); + } +} + +export default { + phpVersion: { + since: "0.13.0", + category: CATEGORY_PHP, + type: "choice", + default: "auto", + description: "Minimum target PHP version.", + choices: [ + ...SUPPORTED_PHP_VERSIONS.map((v) => ({ value: v.toFixed(1) })), + { + value: "composer", + description: "Use the PHP version defined in composer.json", + }, + { + value: "auto", + description: `Try composer.json, else latest PHP Version (${LATEST_SUPPORTED_PHP_VERSION})`, + }, + ], + }, + trailingCommaPHP: { + since: "0.0.0", + category: CATEGORY_PHP, + type: "boolean", + default: true, + description: "Print trailing commas wherever possible when multi-line.", + }, + braceStyle: { + since: "0.10.0", + category: CATEGORY_PHP, + type: "choice", + default: "per-cs", + description: + "Print one space or newline for code blocks (classes and functions).", + choices: [ + { value: "psr-2", description: "(deprecated) Use per-cs" }, + { value: "per-cs", description: "Use the PER Coding Style brace style." }, + { value: "1tbs", description: "Use 1tbs brace style." }, + ], + }, + singleQuote: { + since: "0.0.0", + category: CATEGORY_PHP, + type: "boolean", + default: false, + description: "Use single quotes instead of double quotes.", + }, +}; diff --git a/src/parser.js b/src/parser.js deleted file mode 100644 index fb51f0f87..000000000 --- a/src/parser.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -const engine = require("php-parser"); - -function parse(text) { - // initialize a new parser instance - const parser = new engine({ - // some options : - parser: { - extractDoc: true - }, - ast: { - withPositions: true - } - }); - - const ast = parser.parseCode(text); - // https://github.com/glayzzle/php-parser/issues/155 - // currently inline comments include the line break at the end, we need to - // strip those out and update the end location for each comment manually - ast.comments.forEach(comment => { - if (comment.value[comment.value.length - 1] === "\r") { - comment.value = comment.value.slice(0, -1); - comment.loc.end.offset = comment.loc.end.offset - 1; - } - if (comment.value[comment.value.length - 1] === "\n") { - comment.value = comment.value.slice(0, -1); - comment.loc.end.offset = comment.loc.end.offset - 1; - } - }); - return ast; -} - -module.exports = parse; diff --git a/src/parser.mjs b/src/parser.mjs new file mode 100644 index 000000000..8df49870d --- /dev/null +++ b/src/parser.mjs @@ -0,0 +1,67 @@ +import engine from "php-parser"; +import { LATEST_SUPPORTED_PHP_VERSION } from "./options.mjs"; +import { resolvePhpVersion } from "./options.mjs"; + +function parse(text, opts) { + const inMarkdown = opts && opts.parentParser === "markdown"; + + if (!text && inMarkdown) { + return ""; + } + resolvePhpVersion(opts); + + // Todo https://github.com/glayzzle/php-parser/issues/170 + text = text.replace(/\?>\n<\?/g, "?>\n___PSEUDO_INLINE_PLACEHOLDER___ { + if (comment.value[comment.value.length - 1] === "\n") { + comment.value = comment.value.slice(0, -1); + comment.loc.end.offset = comment.loc.end.offset - 1; + } + }); + + return ast; +} + +export default parse; diff --git a/src/pragma.mjs b/src/pragma.mjs new file mode 100644 index 000000000..976baa7d9 --- /dev/null +++ b/src/pragma.mjs @@ -0,0 +1,92 @@ +import { memoize } from "./util.mjs"; +import parse from "./parser.mjs"; + +const reHasPragma = /@prettier|@format/; + +const getPageLevelDocBlock = memoize((text) => { + const parsed = parse(text); + + const [firstChild] = parsed.children; + const [firstDocBlock] = parsed.comments.filter( + (el) => el.kind === "commentblock" + ); + + if ( + firstChild && + firstDocBlock && + firstDocBlock.loc.start.line < firstChild.loc.start.line + ) { + return firstDocBlock; + } +}); + +function hasPragma(text) { + // fast path optimization - check if the pragma shows up in the file at all + if (!reHasPragma.test(text)) { + return false; + } + + const pageLevelDocBlock = getPageLevelDocBlock(text); + + if (pageLevelDocBlock) { + const { value } = pageLevelDocBlock; + + return reHasPragma.test(value); + } + + return false; +} + +function injectPragma(docblock) { + let lines = docblock.split("\n"); + + if (lines.length === 1) { + // normalize to multiline for simplicity + const [, line] = /\/*\*\*(.*)\*\//.exec(lines[0]); + + lines = ["/**", ` * ${line.trim()}`, " */"]; + } + + // find the first @pragma + // if there happens to be one on the opening line, just put it on the next line. + const pragmaIndex = lines.findIndex((line) => /@\S/.test(line)) || 1; + + // not found => index == -1, which conveniently will splice 1 from the end. + lines.splice(pragmaIndex, 0, " * @format"); + + return lines.join("\n"); +} + +function insertPragma(text) { + const pageLevelDocBlock = getPageLevelDocBlock(text); + + if (pageLevelDocBlock) { + const { + start: { offset: startOffset }, + end: { offset: endOffset }, + } = pageLevelDocBlock.loc; + const before = text.substring(0, startOffset); + const after = text.substring(endOffset); + + return `${before}${injectPragma(pageLevelDocBlock.value, text)}${after}`; + } + + const openTag = "" - : "", - printed - ]); - } - if (node.kind === "block") { - const nodeBody = getNodeListProperty(node); - if (nodeBody.length !== 0) { - return concat([ - nodeBody[0].kind === "inline" ? "?>" : "", - printed, - nodeBody[nodeBody.length - 1].kind === "inline" ? "" - ]) - : "" - ]); -} - -function printPropertyLookup(path, options, print) { - const node = path.getValue(); - return group( - concat(["->", wrapPropertyLookup(node, path.call(print, "offset"))]) - ); -} - -function printStaticLookup(path, options, print) { - return concat(["::", path.call(print, "offset")]); -} - -function printOffsetLookup(path, options, print) { - const node = path.getValue(); - const isOffsetNumberNode = node.offset && node.offset.kind === "number"; - return concat([ - "[", - node.offset - ? group( - concat([ - indent( - concat([ - isOffsetNumberNode ? "" : softline, - path.call(print, "offset") - ]) - ), - isOffsetNumberNode ? "" : softline - ]) - ) - : "", - "]" - ]); -} - -// We detect calls on member expressions specially to format a -// common pattern better. The pattern we are looking for is this: -// -// $arr -// ->map(function(x) { return $x + 1; }) -// ->filter(function(x) { return $x > 10; }) -// ->some(function(x) { return $x % 2; }); -// -// The way it is structured in the AST is via a nested sequence of -// propertylookup, staticlookup, offsetlookup and call. -// We need to traverse the AST and make groups out of it -// to print it in the desired way. -function printMemberChain(path, options, print) { - // The first phase is to linearize the AST by traversing it down. - // - // Example: - // a()->b->c()->d(); - // has the AST structure - // call (propertylookup d ( - // call (propertylookup c ( - // propertylookup b ( - // call (identifier a) - // ) - // )) - // )) - // and we transform it into (notice the reversed order) - // [identifier a, call, propertylookup b, propertylookup c, call, - // propertylookup d, call] - const printedNodes = []; - - // Here we try to retain one typed empty line after each call expression or - // the first group whether it is in parentheses or not - // - // Example: - // $a - // ->call() - // - // ->otherCall(); - // - // ($foo ? $a : $b) - // ->call() - // ->otherCall(); - function shouldInsertEmptyLineAfter(node) { - const { originalText } = options; - const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex( - originalText, - node, - options - ); - const nextChar = originalText.charAt(nextCharIndex); - - // if it is cut off by a parenthesis, we only account for one typed empty - // line after that parenthesis - if (nextChar === ")") { - return isNextLineEmptyAfterIndex( - originalText, - nextCharIndex + 1, - options - ); - } - - return isNextLineEmpty(originalText, node, options); - } - - function traverse(path) { - const node = path.getValue(); - if ( - node.kind === "call" && - (isMemberish(node.what) || node.what.type === "call") - ) { - printedNodes.unshift({ - node, - printed: concat([ - printArgumentsList(path, options, print), - shouldInsertEmptyLineAfter(node) ? hardline : "" - ]) - }); - path.call(what => traverse(what), "what"); - } else if (isMemberish(node)) { - // Print *lookup nodes as we standard print them outside member chain - let printedMemberish = null; - if (node.kind === "propertylookup") { - printedMemberish = printPropertyLookup(path, options, print); - } else if (node.kind === "staticlookup") { - printedMemberish = printStaticLookup(path, options, print); - } else { - printedMemberish = printOffsetLookup(path, options, print); - } - printedNodes.unshift({ - node, - printed: printedMemberish - }); - path.call(what => traverse(what), "what"); - } else { - printedNodes.unshift({ - node, - printed: path.call(print) - }); - } - } - const node = path.getValue(); - printedNodes.unshift({ - node, - printed: printArgumentsList(path, options, print) - }); - path.call(what => traverse(what), "what"); - - // create groups from list of nodes, i.e. - // [identifier a, call, propertylookup b, propertylookup c, call, - // propertylookup d, call] - // will be grouped as - // [ - // [identifier a, Call], - // [propertylookup b, propertylookup c, call], - // [propertylookup d, call] - // ] - // so that we can print it as - // a() - // ->b->c() - // ->d(); - const groups = []; - let currentGroup = [printedNodes[0]]; - let i = 1; - for (; i < printedNodes.length; ++i) { - if ( - printedNodes[i].node.kind === "call" || - (printedNodes[i].node.kind === "offsetlookup" && - printedNodes[i].node.offset && - printedNodes[i].node.offset.kind === "number") - ) { - currentGroup.push(printedNodes[i]); - } else { - break; - } - } - if (printedNodes[0].node.kind !== "call") { - for (; i + 1 < printedNodes.length; ++i) { - if ( - isMemberish(printedNodes[i].node) && - isMemberish(printedNodes[i + 1].node) - ) { - currentGroup.push(printedNodes[i]); - } else { - break; - } - } - } - groups.push(currentGroup); - currentGroup = []; - - // Then, each following group is a sequence of propertylookup followed by - // a sequence of call. To compute it, we keep adding things to the - // group until we have seen a call in the past and reach a - // propertylookup - let hasSeenCallExpression = false; - for (; i < printedNodes.length; ++i) { - if (hasSeenCallExpression && isMemberish(printedNodes[i].node)) { - // [0] should be appended at the end of the group instead of the - // beginning of the next one - if ( - printedNodes[i].node.kind === "offsetlookup" && - printedNodes[i].node.offset && - printedNodes[i].node.offset.kind === "number" - ) { - currentGroup.push(printedNodes[i]); - continue; - } - - groups.push(currentGroup); - currentGroup = []; - hasSeenCallExpression = false; - } - - if (printedNodes[i].node.kind === "call") { - hasSeenCallExpression = true; - } - currentGroup.push(printedNodes[i]); - - if ( - printedNodes[i].node.comments && - comments.hasTrailingComment(printedNodes[i].node) - ) { - groups.push(currentGroup); - currentGroup = []; - hasSeenCallExpression = false; - } - } - if (currentGroup.length > 0) { - groups.push(currentGroup); - } - - // Merge next nodes when: - // - // 1. We have `$this` variable before - // - // Example: - // $this->method()->property; - // - // 2. When we have offsetlookup after *lookup node - // - // Example: - // $foo->Data['key']("foo") - // ->method(); - // - const shouldMerge = - groups.length >= 2 && - !groups[1][0].node.comments && - ((groups[0].length === 1 && - (groups[0][0].node.kind === "variable" && - groups[0][0].node.name === "this")) || - (groups[0].length > 1 && - (isMemberish(groups[0][groups[0].length - 1].node) && - groups[0][groups[0].length - 1].node.what.kind === "variable" && - (groups[1].length && groups[1][0].node.kind === "offsetlookup")))); - - function printGroup(printedGroup) { - return concat(printedGroup.map(tuple => tuple.printed)); - } - - function printIndentedGroup(groups) { - if (groups.length === 0) { - return ""; - } - return indent( - group(concat([hardline, join(hardline, groups.map(printGroup))])) - ); - } - - const printedGroups = groups.map(printGroup); - const oneLine = concat(printedGroups); - - // Indicates how many we should merge - // - // Example (true): - // $this->method()->otherMethod( - // 'argument' - // ); - // - // Example (false): - // $foo - // ->method() - // ->otherMethod(); - const cutoff = shouldMerge ? 3 : 2; - const flatGroups = groups - .slice(0, cutoff) - .reduce((res, group) => res.concat(group), []); - - const hasComment = - flatGroups - .slice(1, -1) - .some(node => comments.hasLeadingComment(node.node)) || - flatGroups - .slice(0, -1) - .some(node => comments.hasTrailingComment(node.node)) || - (groups[cutoff] && comments.hasLeadingComment(groups[cutoff][0].node)); - - // If we only have a single `->`, we shouldn't do anything fancy and just - // render everything concatenated together. - if (groups.length <= cutoff && !hasComment) { - return group(oneLine); - } - - // Find out the last node in the first group and check if it has an - // empty line after - const lastNodeBeforeIndent = getLast( - shouldMerge ? groups.slice(1, 2)[0] : groups[0] - ).node; - const shouldHaveEmptyLineBeforeIndent = - lastNodeBeforeIndent.kind !== "call" && - shouldInsertEmptyLineAfter(lastNodeBeforeIndent); - - const expanded = concat([ - printGroup(groups[0]), - shouldMerge ? concat(groups.slice(1, 2).map(printGroup)) : "", - shouldHaveEmptyLineBeforeIndent ? hardline : "", - printIndentedGroup(groups.slice(shouldMerge ? 2 : 1)) - ]); - - const callExpressionCount = printedNodes.filter( - tuple => tuple.node.kind === "call" - ).length; - - // We don't want to print in one line if there's: - // * A comment. - // * 3 or more chained calls. - // * Any group but the last one has a hard line. - // If the last group is a function it's okay to inline if it fits. - if ( - hasComment || - callExpressionCount >= 3 || - printedGroups.slice(0, -1).some(willBreak) - ) { - return group(expanded); - } - - return concat([ - // We only need to check `oneLine` because if `expanded` is chosen - // that means that the parent group has already been broken - // naturally - willBreak(oneLine) || shouldHaveEmptyLineBeforeIndent ? breakParent : "", - conditionalGroup([oneLine, expanded]) - ]); -} - -function couldGroupArg(arg) { - return ( - (arg.kind === "array" && (arg.items.length > 0 || arg.comments)) || - arg.kind === "function" || - arg.kind === "method" || - arg.kind === "closure" - ); -} - -function shouldGroupLastArg(args) { - const lastArg = getLast(args); - const penultimateArg = getPenultimate(args); - return ( - !hasLeadingComment(lastArg) && - !hasTrailingComment(lastArg) && - couldGroupArg(lastArg) && - // If the last two arguments are of the same type, - // disable last element expansion. - (!penultimateArg || penultimateArg.kind !== lastArg.kind) - ); -} - -function shouldGroupFirstArg(args) { - if (args.length !== 2) { - return false; - } - - const [firstArg, secondArg] = args; - return ( - (!firstArg.comments || !firstArg.comments.length) && - (firstArg.kind === "function" || - firstArg.kind === "method" || - firstArg.kind === "closure") && - !couldGroupArg(secondArg) - ); -} - -function printArgumentsList(path, options, print, argumentsKey = "arguments") { - const args = path.getValue()[argumentsKey]; - - if (args.length === 0) { - return concat([ - "(", - comments.printDanglingComments(path, options, /* sameIndent */ true), - ")" - ]); - } - - let anyArgEmptyLine = false; - let hasEmptyLineFollowingFirstArg = false; - const lastArgIndex = args.length - 1; - const printedArguments = path.map((argPath, index) => { - const arg = argPath.getNode(); - const parts = [print(argPath)]; - - if (index === lastArgIndex) { - // do nothing - } else if (isNextLineEmpty(options.originalText, arg, options)) { - if (index === 0) { - hasEmptyLineFollowingFirstArg = true; - } - - anyArgEmptyLine = true; - parts.push(",", hardline, hardline); - } else { - parts.push(",", line); - } - - return concat(parts); - }, argumentsKey); - - const shouldGroupFirst = shouldGroupFirstArg(args); - const shouldGroupLast = shouldGroupLastArg(args); - if (shouldGroupFirst || shouldGroupLast) { - const shouldBreak = - (shouldGroupFirst - ? printedArguments.slice(1).some(willBreak) - : printedArguments.slice(0, -1).some(willBreak)) || anyArgEmptyLine; - - // We want to print the last argument with a special flag - let printedExpanded; - let i = 0; - path.each(argPath => { - if (shouldGroupFirst && i === 0) { - printedExpanded = [ - concat([ - argPath.call(p => print(p, { expandFirstArg: true })), - printedArguments.length > 1 ? "," : "", - hasEmptyLineFollowingFirstArg ? hardline : line, - hasEmptyLineFollowingFirstArg ? hardline : "" - ]) - ].concat(printedArguments.slice(1)); - } - if (shouldGroupLast && i === args.length - 1) { - printedExpanded = printedArguments - .slice(0, -1) - .concat(argPath.call(p => print(p, { expandLastArg: true }))); - } - i++; - }, argumentsKey); - - const somePrintedArgumentsWillBreak = printedArguments.some(willBreak); - - return concat([ - somePrintedArgumentsWillBreak ? breakParent : "", - conditionalGroup( - [ - concat([ - ifBreak( - indent(concat(["(", softline, concat(printedExpanded)])), - concat(["(", concat(printedExpanded)]) - ), - somePrintedArgumentsWillBreak ? softline : "", - ")" - ]), - shouldGroupFirst - ? concat([ - "(", - group(printedExpanded[0], { shouldBreak: true }), - concat(printedExpanded.slice(1)), - ")" - ]) - : concat([ - "(", - concat(printedArguments.slice(0, -1)), - group(getLast(printedExpanded), { - shouldBreak: true - }), - ")" - ]), - group( - concat([ - "(", - indent(concat([line, concat(printedArguments)])), - line, - ")" - ]), - { shouldBreak: true } - ) - ], - { shouldBreak } - ) - ]); - } - - const lastArgument = getLast(args); - return group( - concat([ - "(", - indent(concat([softline, concat(printedArguments)])), - softline, - ")" - ]), - { - shouldBreak: - printedArguments.some(willBreak) || - anyArgEmptyLine || - (lastArgument.kind === "encapsed" && lastArgument.type === "heredoc") || - lastArgument.kind === "nowdoc" - } - ); -} - -function wrapPropertyLookup(node, doc) { - const addCurly = - node.kind === "propertylookup" && - (node.offset.kind !== "constref" || typeof node.offset.name !== "string"); - - return addCurly ? concat(["{", doc, "}"]) : doc; -} - -function isPropertyLookupChain(node) { - if (node.kind !== "propertylookup") { - return false; - } - if (node.what.kind === "variable") { - return true; - } - return isPropertyLookupChain(node.what); -} - -function shouldInlineLogicalExpression(node) { - return node.right.kind === "array" && node.right.items.length !== 0; -} - -// For binary expressions to be consistent, we need to group -// subsequent operators with the same precedence level under a single -// group. Otherwise they will be nested such that some of them break -// onto new lines but not all. Operators with the same precedence -// level should either all break or not. Because we group them by -// precedence level and the AST is structured based on precedence -// level, things are naturally broken up correctly, i.e. `&&` is -// broken before `+`. -function printBinaryExpression( - path, - print, - options, - isNested, - isInsideParenthesis -) { - let parts = []; - const node = path.getValue(); - - if (node.kind === "bin") { - // Put all operators with the same precedence level in the same - // group. The reason we only need to do this with the `left` - // expression is because given an expression like `1 + 2 - 3`, it - // is always parsed like `((1 + 2) - 3)`, meaning the `left` side - // is where the rest of the expression will exist. Binary - // expressions on the right side mean they have a difference - // precedence level and should be treated as a separate group, so - // print them normally. (This doesn't hold for the `**` operator, - // which is unique in that it is right-associative.) - if (shouldFlatten(node.type, node.left.type)) { - // Flatten them out by recursively calling this function. - parts = parts.concat( - path.call( - left => - printBinaryExpression( - left, - print, - options, - /* isNested */ true, - isInsideParenthesis - ), - "left" - ) - ); - } else { - parts.push(path.call(print, "left")); - } - - const shouldInline = shouldInlineLogicalExpression(node); - - const right = shouldInline - ? concat([node.type, " ", path.call(print, "right")]) - : concat([node.type, line, path.call(print, "right")]); - - // If there's only a single binary expression, we want to create a group - // in order to avoid having a small right part like -1 be on its own line. - const parent = path.getParentNode(); - const shouldGroup = - !(isInsideParenthesis && ["||", "&&"].includes(node.type)) && - parent.kind !== "bin" && - node.left.kind !== "bin" && - node.right.kind !== "bin"; - - parts.push(" ", shouldGroup ? group(right) : right); - } else { - // Our stopping case. Simply print the node normally. - parts.push(path.call(print)); - } - - return parts; -} - -// so this is a bit hacky, but for anonymous classes, there's a chance that an -// assumption core to prettier will break - that child nodes will not overlap. In -// this case, if we have something like this: -// $test = new class($arg1, $arg2) extends TestClass {}; -// we end up with a parent "new" node, which has children "arguments", and "what" -// the "what" is a "class" node, but it overlaps with the "arguments". To solve this, -// we use this variable to store off the printed arguments when the "new" node is printing, -// so that the "class" node can then access them later -let anonymousClassesNewArguments = null; - -const expressionKinds = [ - "array", - "variable", - "constref", - "yield", - "yieldfrom", - "variable", - "propertylookup", - "staticlookup", - "offsetlookup", - "pre", - "post", - "bin", - "parenthesis", - "unary", - "cast", - "boolean", - "string", - "number", - "inline", - "magic", - "nowdoc", - "encapsed", - "variadic" -]; -function printExpression(path, options, print) { - const node = path.getValue(); - const lookupKinds = ["propertylookup", "staticlookup", "offsetlookup"]; - function printLookup(node) { - switch (node.kind) { - case "propertylookup": - return group( - concat([ - path.call(print, "what"), - printPropertyLookup(path, options, print) - ]) - ); - case "staticlookup": - return concat([ - path.call(print, "what"), - printStaticLookup(path, options, print) - ]); - case "offsetlookup": - return group( - concat([ - path.call(print, "what"), - printOffsetLookup(path, options, print) - ]) - ); - default: - return `Have not implemented lookup kind ${node.kind} yet.`; - } - } - if (lookupKinds.includes(node.kind)) { - return printLookup(node); - } - - const operationKinds = ["pre", "post", "bin", "parenthesis", "unary", "cast"]; - function printOperation(node) { - switch (node.kind) { - case "pre": - return concat([node.type + node.type, path.call(print, "what")]); - case "post": - return concat([path.call(print, "what"), node.type + node.type]); - case "bin": { - const parent = path.getParentNode(); - const parentParent = path.getParentNode(1); - const isInsideParenthesis = - node !== parent.body && - (parent.kind === "if" || - parent.kind === "while" || - parent.kind === "do"); - - const parts = printBinaryExpression( - path, - print, - options, - /* isNested */ false, - isInsideParenthesis - ); - - // if ( - // this.hasPlugin("dynamicImports") && this.lookahead().type === tt.parenLeft - // ) { - // - // looks super weird, we want to break the children if the parent breaks - // - // if ( - // this.hasPlugin("dynamicImports") && - // this.lookahead().type === tt.parenLeft - // ) { - if (isInsideParenthesis) { - return concat(parts); - } - - // Break between the parens in unaries or in a member expression, i.e. - // - // ( - // a && - // b && - // c - // ).call() - if (parent.kind === "unary") { - return group( - concat([indent(concat([softline, concat(parts)])), softline]) - ); - } - - // Avoid indenting sub-expressions in some cases where the first sub-expression is already - // indented accordingly. We should indent sub-expressions where the first case isn't indented. - const shouldNotIndent = - parent.kind === "return" || - parent.kind === "echo" || - parent.kind === "print" || - parent.kind === "retif" || - // return ( - // $someCondition || - // $someOtherCondition - // ); - (parentParent && - ["echo", "return", "print"].includes(parentParent.kind) && - parent.kind === "parenthesis") || - // ( - // $someObject || - // $someOtherObject - // )->someFunction(); - (parentParent && - parentParent.kind === "propertylookup" && - parent.kind === "parenthesis") || - (node !== parent.body && parent.kind === "for"); - - const shouldIndentIfInlining = - parent.kind === "assign" || parent.kind === "property"; - - const samePrecedenceSubExpression = - node.left.kind === "bin" && shouldFlatten(node.type, node.left.type); - - if ( - shouldNotIndent || - (shouldInlineLogicalExpression(node) && - !samePrecedenceSubExpression) || - (!shouldInlineLogicalExpression(node) && shouldIndentIfInlining) - ) { - return group(concat(parts)); - } - - const rest = concat(parts.slice(1)); - - return group( - concat([ - // Don't include the initial expression in the indentation - // level. The first item is guaranteed to be the first - // left-most expression. - parts.length > 0 ? parts[0] : "", - indent(rest) - ]) - ); - } - case "parenthesis": { - const parentNode = path.getParentNode(); - if (parentNode && parentNode.kind === "parenthesis") { - return path.call(print, "inner"); - } - const shouldPrintParenthesis = - parentNode.kind !== "print" && - parentNode.kind !== "echo" && - parentNode.kind !== "include"; - const shouldBeInlined = - node.inner.kind === "new" || node.inner.kind === "clone"; - // don't break if this is a property lookup - ie - // ($someThing - // ? $someOtherThing - // : $someOtherOtherThing - // ) - // ->hi() - // ->other(); - // however, make sure to break for bin, since its reliant on the parens indentation - // ( - // $someThing && - // $someOtherThing - // )->map(); - const shouldAddBeginningBreak = - !shouldBeInlined && - !(parentNode.kind === "propertylookup" && node.inner.kind !== "bin"); - const printedContents = path.call(print, "inner"); - const shouldAddEndBreak = - !shouldBeInlined && - (shouldAddBeginningBreak || willBreak(printedContents)); - const dangling = comments.printDanglingComments(path, options, true); - const printedInner = concat([ - shouldAddBeginningBreak && shouldPrintParenthesis ? softline : "", - dangling ? concat([dangling, hardline]) : "", - printedContents - ]); - return group( - concat([ - shouldPrintParenthesis ? "(" : "", - shouldAddBeginningBreak ? indent(printedInner) : printedInner, - shouldPrintParenthesis - ? concat([shouldAddEndBreak ? softline : "", ")"]) - : "" - ]) - ); - } - case "unary": - return concat([node.type, path.call(print, "what")]); - case "cast": - return concat(["(", node.type, ") ", path.call(print, "what")]); - default: - return `Have not implemented operation kind ${node.kind} yet.`; - } - } - if (operationKinds.includes(node.kind)) { - return printOperation(node); - } - - const literalKinds = [ - "boolean", - "string", - "number", - "inline", - "magic", - "nowdoc", - "encapsed" - ]; - function printLiteral(node) { - function getEncapsedQuotes(node, { opening = true } = {}) { - if (node.type === "heredoc") { - return opening ? `<<<${node.label}` : node.label; - } - const quotes = { - string: '"', - shell: "`" - }; - if (quotes[node.type]) { - return quotes[node.type]; - } - return `Unimplemented encapsed type ${node.type}`; - } - - switch (node.kind) { - case "boolean": - return node.value ? "true" : "false"; - case "string": { - // @TODO: need resolve https://github.com/glayzzle/php-parser/issues/101 - // @TODO: need resolve https://github.com/glayzzle/php-parser/issues/123 - // @TODO: need resolve https://github.com/glayzzle/php-parser/issues/124 - // @TODO: for now just reusing double/single quote preference from doc. could eventually - // use setting from options. need to figure out how this works w/ complex strings and interpolation - // also need to figure out splitting long strings - const quote = node.isDoubleQuote ? '"' : "'"; - let stringValue = node.raw; - // we need to strip out the quotes from the raw value - if (['"', "'"].includes(stringValue[0])) { - stringValue = stringValue.substr(1); - } - if (['"', "'"].includes(stringValue[stringValue.length - 1])) { - stringValue = stringValue.substr(0, stringValue.length - 1); - } - return makeString(stringValue, quote, false); - } - case "number": - return printNumber(node.value); - case "encapsed": - if (node.type === "offset") { - return group(concat(path.map(print, "value"))); - } - return concat([ - getEncapsedQuotes(node), - // Respect `indent` for `heredoc` nodes - node.type === "heredoc" ? "\n" : "", - concat( - path.map(valuePath => { - const node = valuePath.getValue(); - if (node.kind === "string") { - return node.raw; - } else if (node.kind === "variable") { - if (typeof node.name === "object") { - return concat(["${", path.call(print, "name"), "}"]); - } else if (node.curly) { - return `{$${node.name}}`; - } - return print(valuePath); - } - return concat(["{", print(valuePath), "}"]); - }, "value") - ), - getEncapsedQuotes(node, { opening: false }), - node.type === "heredoc" && docShouldHaveTrailingNewline(path) - ? hardline - : "" - ]); - case "inline": - return node.raw; - case "magic": - // for magic constant we prefer upper case - return node.value.toUpperCase(); - case "nowdoc": - // Respect `indent` for `nowdoc` nodes - return concat([ - "<<<'", - node.label, - "'", - "\n", - node.value, - "\n", - node.label, - docShouldHaveTrailingNewline(path) ? "\n" : "" - ]); - default: - return `Have not implemented literal kind ${node.kind} yet.`; - } - } - if (literalKinds.includes(node.kind)) { - return printLiteral(node); - } - - switch (node.kind) { - case "variable": - return concat([ - node.byref ? "&" : "", - "$", - node.curly ? "{" : "", - path.call(print, "name"), - node.curly ? "}" : "" - ]); - case "constref": - if (typeof node.name === "object") { - return path.call(print, "name"); - } - return node.name; - case "array": { - const open = node.shortForm ? "[" : "array("; - const close = node.shortForm ? "]" : ")"; - if (node.items.length === 0) { - if (!hasDanglingComments(node)) { - return concat([open, close]); - } - return group( - concat([ - open, - comments.printDanglingComments(path, options), - softline, - close - ]) - ); - } - return group( - concat([ - open, - indent( - concat([ - softline, - join(concat([",", line]), path.map(print, "items")) - ]) - ), - ifBreak(shouldPrintComma(options) ? "," : ""), - comments.printDanglingComments(path, options, true), - softline, - close - ]) - ); - } - case "yield": - return concat([ - "yield ", - node.key ? concat([path.call(print, "key"), " => "]) : "", - path.call(print, "value") - ]); - case "yieldfrom": - return concat(["yield from ", path.call(print, "value")]); - case "variadic": - return concat(["...", path.call(print, "what")]); - default: - return `Have not implemented expression kind ${node.kind} yet.`; - } -} - -const statementKinds = [ - "eval", - "exit", - "halt", - "clone", - "declare", - "global", - "static", - "include", - "assign", - "retif", - "if", - "do", - "while", - "for", - "foreach", - "switch", - "goto", - "silent", - "try", - "catch", - "throw", - "call", - "closure", - "new", - "usegroup", - "useitem", - "block", - "program", - "namespace", - "echo", - "list", - "print", - "isset", - "unset", - "empty", - "declaration", - "class", - "interface", - "trait", - "constant", - "classconstant", - "function", - "method", - "parameter", - "property" -]; -function printLines(path, options, print, childrenAttribute = "children") { - return concat( - path.map(childPath => { - const canPrintBlankLine = - !isLastStatement(childPath) && - childPath.getValue().kind !== "inline" && - !isNextNodeInline(childPath); - return concat([ - print(childPath), - canPrintBlankLine ? hardline : "", - canPrintBlankLine && - isNextLineEmpty(options.originalText, childPath.getValue(), options) - ? hardline - : "" - ]); - }, childrenAttribute) - ); -} -function printStatement(path, options, print) { - const node = path.getValue(); - const blockKinds = ["block", "program", "namespace"]; - function printBlock(path, options, print) { - switch (node.kind) { - case "block": - return concat([ - printLines(path, options, print), - comments.printDanglingComments(path, options, true) - ]); - case "program": { - return concat([ - printLines(path, options, print), - fileShouldEndWithHardline(path) ? hardline : "" - ]); - } - case "namespace": { - const printed = printLines(path, options, print); - const hasName = node.name && typeof node.name === "string"; - return concat([ - "namespace ", - hasName ? node.name : "", - node.withBrackets ? concat([" ", "{"]) : ";", - // don't know why we need 2 line breaks here, but 1 doesn't work - node.children.length > 0 && !node.withBrackets - ? concat([hardline, hardline]) - : "", - node.withBrackets ? indent(concat([hardline, printed])) : printed, - node.withBrackets ? concat([hardline, "}"]) : "" - ]); - } - default: - return `Have not implemented block kind ${node.kind} yet.`; - } - } - if (blockKinds.includes(node.kind)) { - return printBlock(path, options, print); - } - - const sysKinds = ["echo", "list", "print", "isset", "unset", "empty"]; - function printSys(node) { - switch (node.kind) { - case "echo": { - const printedArguments = path.map(argumentPath => { - const node = argumentPath.getValue(); - return node.kind === "bin" - ? print(argumentPath) - : dedent(print(argumentPath)); - }, "arguments"); - return indent( - group( - concat([ - "echo ", - group(join(concat([",", line]), printedArguments)) - ]) - ) - ); - } - case "print": { - const printedArguments = path.call(print, "arguments"); - return concat([ - "print ", - node.arguments.kind === "bin" - ? indent(printedArguments) - : printedArguments - ]); - } - case "list": - case "isset": - case "unset": - case "empty": - return group( - concat([ - node.kind, - "(", - indent( - concat([ - softline, - join(concat([",", line]), path.map(print, "arguments")) - ]) - ), - softline, - ")" - ]) - ); - default: - return `Have not implemented sys kind ${node.kind} yet.`; - } - } - if (sysKinds.includes(node.kind)) { - return printSys(node); - } - - const declarationKinds = [ - "class", - "interface", - "trait", - "constant", - "classconstant", - "function", - "method", - "parameter", - "property" - ]; - function printDeclaration(node) { - function printDeclarationBlock({ - declaration, - argumentsList = [], - returnTypeContents = "", - bodyContents = "" - }) { - const isClassLikeNode = ["class", "interface", "trait"].includes( - node.kind - ); - const printedDeclaration = group(declaration); - const printedSignature = !isClassLikeNode - ? group( - concat([ - "(", - argumentsList.length - ? concat([ - indent( - concat([ - softline, - join(concat([",", line]), argumentsList) - ]) - ), - softline - ]) - : "", - ")", - returnTypeContents ? concat([": ", returnTypeContents]) : "" - ]) - ) - : ""; - const printedBody = bodyContents - ? concat([ - "{", - indent(concat([hardline, bodyContents])), - comments.printDanglingComments(path, options, true), - hardline, - "}" - ]) - : ""; - return concat([ - group( - concat([ - printedDeclaration, - printedSignature, - // see https://github.com/prettier/plugin-php/issues/107 - // options.openingBraceNewLine ? hardline : " ", - // Hack, we need `invertLine` command here, as `line`, but have versa vice logic - bodyContents - ? node.kind === "function" || node.kind === "method" - ? ifBreak(" ", concat([lineSuffix(""), lineSuffixBoundary])) - : hardline - : "" - ]) - ), - printedBody - ]); - } - - switch (node.kind) { - case "class": { - const classPrefixes = [ - ...(node.isFinal ? ["final"] : []), - ...(node.isAbstract ? ["abstract"] : []) - ]; - const parentNode = path.getParentNode(); - // if this is an anonymous class, we need to check if the parent was a - // "new" node. if it was, we need to get the arguments from that node - // ex: $test = new class($arg1, $arg2) extends TestClass {}; - const anonymousArguments = - node.isAnonymous && - parentNode.kind === "new" && - parentNode.arguments.length > 0 - ? anonymousClassesNewArguments - : ""; - return printDeclarationBlock({ - declaration: concat([ - classPrefixes.join(" "), - classPrefixes.length > 0 ? " " : "", - concat([ - "class", - anonymousArguments, - node.name ? concat([" ", node.name]) : "" - ]), - group( - indent( - concat([ - node.extends - ? group( - concat([line, "extends ", path.call(print, "extends")]) - ) - : "", - node.implements - ? concat([ - line, - "implements", - group( - indent( - concat([ - line, - join( - concat([",", line]), - path.map(print, "implements") - ) - ]) - ) - ) - ]) - : "" - ]) - ) - ) - ]), - bodyContents: printLines(path, options, print, "body") - }); - } - case "function": - return printDeclarationBlock({ - declaration: concat(["function ", node.byref ? "&" : "", node.name]), - argumentsList: path.map(print, "arguments"), - returnTypeContents: node.type - ? concat([ - hasDanglingComments(node.type) - ? concat([ - path.call( - typePath => - comments.printDanglingComments( - typePath, - options, - true - ), - "type" - ), - " " - ]) - : "", - node.nullable ? "?" : "", - path.call(print, "type") - ]) - : "", - bodyContents: node.body ? path.call(print, "body") : "" - }); - case "method": { - const methodPrefixes = [ - ...(node.isFinal ? ["final"] : []), - ...(node.isAbstract ? ["abstract"] : []), - ...(node.visibility ? [node.visibility] : []), - ...(node.isStatic ? ["static"] : []) - ]; - return printDeclarationBlock({ - declaration: concat([ - methodPrefixes.join(" "), - methodPrefixes.length > 0 ? " " : "", - "function ", - node.byref ? "&" : "", - node.name - ]), - argumentsList: path.map(print, "arguments"), - returnTypeContents: node.type - ? concat([ - hasDanglingComments(node.type) - ? concat([ - path.call( - typePath => - comments.printDanglingComments( - typePath, - options, - true - ), - "type" - ), - " " - ]) - : "", - node.nullable ? "?" : "", - path.call(print, "type") - ]) - : "", - bodyContents: node.body ? concat([path.call(print, "body")]) : "" - }); - } - case "parameter": { - const name = concat([ - node.nullable ? "?" : "", - node.type ? concat([path.call(print, "type"), " "]) : "", - node.variadic ? "..." : "", - node.byref ? "&" : "", - "$", - node.name - ]); - if (node.value) { - return group( - concat([ - name, - // see handleFunctionParameter() in ./comments.js - since there's - // no node to attach comments that fall in between the parameter name - // and value, we store them as dangling comments - hasDanglingComments(node) ? " " : "", - comments.printDanglingComments(path, options, true), - indent(concat([line, "= ", path.call(print, "value")])) - ]) - ); - } - return name; - } - case "property": - return group( - concat([ - node.visibility ? concat([node.visibility, " "]) : "", - node.isStatic ? "static " : "", - "$", - node.name, - node.value ? concat([" = ", path.call(print, "value")]) : "" - ]) - ); - case "interface": - return printDeclarationBlock({ - declaration: concat([ - concat(["interface ", node.name]), - node.extends - ? indent( - concat([ - line, - "extends ", - join(", ", path.map(print, "extends")) - ]) - ) - : "" - ]), - bodyContents: printLines(path, options, print, "body") - }); - case "trait": - return printDeclarationBlock({ - declaration: concat([ - concat(["trait ", node.name]), - node.extends - ? indent(concat([line, "extends ", path.call(print, "extends")])) - : "", - node.implements - ? indent( - concat([ - line, - "implements ", - join(", ", path.map(print, "implements")) - ]) - ) - : "" - ]), - bodyContents: printLines(path, options, print, "body") - }); - case "constant": - case "classconstant": - return concat([ - node.visibility ? concat([node.visibility, " "]) : "", - "const ", - node.name, - " = ", - path.call(print, "value") - ]); - default: - return `Have not implmented declaration kind ${node.kind} yet.`; - } - } - if (declarationKinds.includes(node.kind)) { - return printDeclaration(node); - } - - function printBodyControlStructure(path, bodyProperty = "body") { - const node = path.getValue(); - if (!node[bodyProperty]) { - return ";"; - } - const printedBody = path.call(print, bodyProperty); - return concat([ - node.shortForm ? ":" : " {", - indent( - concat([ - comments.printDanglingComments(path, options, true), - node[bodyProperty].kind !== "block" || - (node[bodyProperty].children && - node[bodyProperty].children.length > 0) || - (node[bodyProperty].comments && - node[bodyProperty].comments.length > 0) - ? concat([hardline, printedBody]) - : "" - ]) - ), - node.kind === "if" && bodyProperty === "body" - ? "" - : concat([ - hardline, - node.shortForm ? concat(["end", node.kind, ";"]) : "}" - ]) - ]); - } - - switch (node.kind) { - case "assign": { - const canBreak = - ["bin", "number", "string"].includes(node.right.kind) || - // for retif's that have complex test cases, we allow a break. ie - // $test = - // $someReallyLongCondition || - // $someOtherLongCondition - // ? true - // : false; - (node.right.kind === "retif" && node.right.test.kind === "bin") || - isPropertyLookupChain(node.right); - return group( - concat([ - path.call(print, "left"), - " ", - node.operator, - canBreak - ? indent(concat([line, path.call(print, "right")])) - : concat([" ", path.call(print, "right")]) - ]) - ); - } - case "if": { - const handleIfAlternate = alternate => { - if (!alternate) { - return node.shortForm ? "endif;" : "}"; - } - if (alternate.kind === "if") { - return concat([ - node.shortForm ? "" : "} ", - "else", - path.call(print, "alternate") - ]); - } - return concat([ - node.shortForm ? "" : "} ", - "else", - printBodyControlStructure(path, "alternate") - ]); - }; - return concat([ - group( - concat([ - "if (", - group( - concat([ - indent(concat([softline, path.call(print, "test")])), - softline - ]) - ), - ")", - printBodyControlStructure(path) - ]) - ), - hardline, - handleIfAlternate(node.alternate) - ]); - } - case "do": - return concat([ - "do", - printBodyControlStructure(path), - " while (", - group( - concat([ - indent(concat([softline, path.call(print, "test")])), - softline - ]) - ), - ");" - ]); - case "while": - return group( - concat([ - "while (", - group( - concat([ - indent(concat([softline, path.call(print, "test")])), - softline - ]) - ), - ")", - printBodyControlStructure(path) - ]) - ); - case "for": { - const body = printBodyControlStructure(path); - if (!node.init.length && !node.test.length && !node.increment.length) { - return concat([group(concat(["for (;;)", body]))]); - } - - return concat([ - "for (", - group( - concat([ - indent( - concat([ - softline, - group( - concat([join(concat([",", line]), path.map(print, "init"))]) - ), - ";", - line, - group( - concat([join(concat([",", line]), path.map(print, "test"))]) - ), - ";", - line, - group(join(concat([",", line]), path.map(print, "increment"))) - ]) - ), - softline - ]) - ), - ")", - body - ]); - } - case "foreach": - return concat([ - "foreach (", - group( - concat([ - indent( - concat([ - softline, - path.call(print, "source"), - line, - "as ", - node.key - ? indent( - join(concat([" =>", line]), [ - path.call(print, "key"), - path.call(print, "value") - ]) - ) - : path.call(print, "value") - ]) - ), - softline - ]) - ), - ")", - printBodyControlStructure(path) - ]); - case "switch": - return concat([ - group( - concat([ - "switch (", - indent(concat([softline, path.call(print, "test")])), - softline, - ")" - ]) - ), - printBodyControlStructure(path) - ]); - case "call": { - // chain: Call (PropertyLookup (Call (PropertyLookup (...)))) - if (node.what.kind === "propertylookup") { - return printMemberChain(path, options, print); - } - return concat([ - path.call(print, "what"), - printArgumentsList(path, options, print) - ]); - } - case "usegroup": - return group( - concat([ - "use ", - node.type ? concat([node.type, " "]) : "", - indent( - concat([ - node.name - ? concat([ - maybeStripLeadingSlashFromUse(node.name), - "\\{", - softline - ]) - : "", - join( - concat([",", line]), - path.map(item => concat([print(item)]), "items") - ) - ]) - ), - node.name ? concat([softline, "}"]) : "" - ]) - ); - case "useitem": - return concat([ - node.type ? concat([node.type, " "]) : "", - maybeStripLeadingSlashFromUse(node.name), - hasDanglingComments(node) - ? concat([" ", comments.printDanglingComments(path, options, true)]) - : "", - node.alias ? concat([" as ", node.alias]) : "" - ]); - case "closure": - return concat([ - "function ", - printArgumentsList(path, options, print), - node.uses && node.uses.length > 0 - ? group( - concat([ - " use ", - printArgumentsList(path, options, print, "uses") - ]) - ) - : "", - " {", - indent(concat([hardline, path.call(print, "body")])), - concat([hardline, "}"]) - ]); - case "retif": { - const printedExpr = concat([ - line, - "?", - node.trueExpr ? concat([" ", path.call(print, "trueExpr"), line]) : "", - ": ", - path.call(print, "falseExpr") - ]); - return group(concat([path.call(print, "test"), indent(printedExpr)])); - } - case "exit": - return group( - concat([ - node.useDie ? "die" : "exit", - "(", - node.status - ? concat([ - indent(concat([softline, path.call(print, "status")])), - softline - ]) - : comments.printDanglingComments(path, options), - ")" - ]) - ); - case "clone": - return concat(["clone ", path.call(print, "what")]); - case "declare": { - const printDeclareArguments = path => { - const [directive] = Object.keys(path.getValue().what); - return concat([directive, "=", path.call(print, "what", directive)]); - }; - if (node.mode === "short") { - return concat([ - "declare(", - printDeclareArguments(path), - "):", - hardline, - concat(path.map(print, "children")), - hardline, - "enddeclare;" - ]); - } else if (node.mode === "block") { - return concat([ - "declare(", - printDeclareArguments(path), - ") {", - indent(concat([hardline, concat(path.map(print, "children"))])), - hardline, - "}" - ]); - } - return concat(["declare(", printDeclareArguments(path), ");"]); - } - case "global": - return group( - concat([ - "global", - indent( - concat([" ", join(concat([",", line]), path.map(print, "items"))]) - ) - ]) - ); - case "static": - return group( - concat([ - "static", - indent( - concat([ - " ", - join( - concat([",", line]), - path.map(item => { - // @TODO: hacking this for now. assignments nested inside a static - // declaration doesn't have the operator set, so printing manually - if (item.getValue().kind === "assign") { - return concat([ - item.call(print, "left"), - " = ", - item.call(print, "right") - ]); - } - return item.call(print); - }, "items") - ) - ]) - ) - ]) - ); - case "include": - return concat([ - node.require ? "require" : "include", - node.once ? "_once" : "", - " ", - path.call(print, "target") - ]); - case "goto": - return concat(["goto ", node.label]); - case "new": { - // if the child node is an anonymous class, we need to store the arguments - // so the child class node can access them later - const isAnonymousClassNode = - node.what && node.what.kind === "class" && node.what.isAnonymous; - if (isAnonymousClassNode && node.arguments.length > 0) { - anonymousClassesNewArguments = printArgumentsList(path, options, print); - } - return group( - concat([ - "new ", - path.call(print, "what"), - isAnonymousClassNode ? "" : printArgumentsList(path, options, print) - ]) - ); - } - case "try": - return concat([ - "try {", - indent( - concat([ - hardline, - path.call(print, "body"), - comments.printDanglingComments(path, options, true) - ]) - ), - hardline, - "}", - node.catches ? concat(path.map(print, "catches")) : "", - node.always - ? concat([ - " finally {", - indent(concat([hardline, path.call(print, "always")])), - hardline, - "}" - ]) - : "" - ]); - case "catch": - return concat([ - " catch", - node.what - ? concat([ - " (", - join(" | ", path.map(print, "what")), - " ", - path.call(print, "variable"), - ")" - ]) - : "", - " {", - indent( - concat([ - hardline, - path.call(print, "body"), - comments.printDanglingComments(path, options, true) - ]) - ), - hardline, - "}" - ]); - case "throw": - return concat(["throw ", path.call(print, "what")]); - case "silent": - return concat(["@", path.call(print, "expr")]); - case "halt": - return concat(["__halt_compiler();", node.after.replace(/\n$/, "")]); - case "eval": - return group( - concat([ - "eval(", - indent(concat([softline, path.call(print, "source")])), - softline, - ")" - ]) - ); - default: - return `Have not implemented statement kind ${node.kind} yet.`; - } -} - -function printNode(path, options, print) { - const node = path.getValue(); - if (expressionKinds.includes(node.kind)) { - return printExpression(path, options, print); - } - if (statementKinds.includes(node.kind)) { - return printStatement(path, options, print); - } - switch (node.kind) { - case "identifier": { - // this is a hack until https://github.com/glayzzle/php-parser/issues/113 is resolved - // for reserved words we prefer lowercase case - if (node.name === "\\array") { - return "array"; - } else if (node.name === "\\callable") { - return "callable"; - } - - const lowerCasedName = node.name.toLowerCase(); - const isLowerCase = - [ - "int", - "float", - "bool", - "string", - "null", - "void", - "iterable", - "object", - "self" - ].indexOf(lowerCasedName) !== -1; - - return isLowerCase ? lowerCasedName : node.name; - } - case "case": - return concat([ - node.test - ? concat(["case ", path.call(print, "test"), ":"]) - : "default:", - node.body - ? node.body.children && node.body.children.length - ? indent(concat([hardline, path.call(print, "body")])) - : ";" - : "" - ]); - case "break": - if (node.level) { - while (node.level.kind == "parenthesis") { - node.level = node.level.inner; - } - if (node.level.kind == "number" && node.level.value != 1) { - return concat(["break ", path.call(print, "level")]); - } - return "break"; - } - return "break"; - case "continue": - if (node.level) { - while (node.level.kind == "parenthesis") { - node.level = node.level.inner; - } - if (node.level.kind == "number" && node.level.value != 1) { - return concat(["continue ", path.call(print, "level")]); - } - return "continue"; - } - return "continue"; - case "return": { - const parts = []; - parts.push("return"); - if (node.expr) { - const printedExpr = path.call(print, "expr"); - if (node.expr.kind === "bin") { - parts.push( - group( - concat([ - ifBreak(" (", " "), - indent(concat([softline, printedExpr])), - softline, - ifBreak(")") - ]) - ) - ); - } else { - parts.push(" ", printedExpr); - } - } - return concat(parts); - } - case "entry": { - const dangling = comments.printDanglingComments( - path, - options, - /* sameLine */ true - ); - const printedComments = dangling ? concat([hardline, dangling]) : ""; - - if (node.key) { - return group( - concat([ - path.call(print, "key"), - " =>", - indent(concat([line, path.call(print, "value"), printedComments])) - ]) - ); - } - return concat([path.call(print, "value"), printedComments]); - } - case "traituse": - return group( - concat([ - "use ", - join(", ", path.map(print, "traits")), - node.adaptations - ? concat([ - " {", - indent( - concat([ - line, - printLines(path, options, print, "adaptations") - ]) - ), - line, - "}" - ]) - : "" - ]) - ); - case "traitprecedence": - return concat([ - path.call(print, "trait"), - "::", - node.method, - " insteadof ", - join(", ", path.map(print, "instead")) - ]); - case "traitalias": - return concat([ - path.call(print, "trait"), - node.trait ? "::" : "", - node.method || "", - " as ", - join(" ", [ - ...(node.visibility ? [node.visibility] : []), - ...(node.as ? [node.as] : []) - ]) - ]); - case "label": - return concat([node.name, ":"]); - case "error": - default: - return `Have not implemented kind ${node.kind} yet.`; - } -} - -module.exports = genericPrint; diff --git a/src/printer.mjs b/src/printer.mjs new file mode 100644 index 000000000..c3cf11cd0 --- /dev/null +++ b/src/printer.mjs @@ -0,0 +1,2899 @@ +import { util as prettierUtil, doc } from "prettier"; +import { + printAllComments, + hasTrailingComment, + hasLeadingComment, + printDanglingComments, + printComments, + isBlockComment, + hasLeadingOwnLineComment, +} from "./comments.mjs"; +import pathNeedsParens from "./needs-parens.mjs"; +import { locStart, locEnd } from "./loc.mjs"; + +import { + getLast, + getPenultimate, + lineShouldEndWithSemicolon, + printNumber, + shouldFlatten, + maybeStripLeadingSlashFromUse, + fileShouldEndWithHardline, + hasDanglingComments, + docShouldHaveTrailingNewline, + isLookupNode, + isFirstChildrenInlineNode, + shouldPrintHardLineAfterStartInControlStructure, + shouldPrintHardLineBeforeEndInControlStructure, + getAlignment, + isProgramLikeNode, + getNodeKindIncludingLogical, + useDoubleQuote, + hasEmptyBody, + isNextLineEmptyAfterNamespace, + shouldPrintHardlineBeforeTrailingComma, + isDocNode, + getAncestorNode, + isReferenceLikeNode, + normalizeMagicMethodName, + isSimpleCallArgument, +} from "./util.mjs"; + +const { + breakParent, + join, + line, + lineSuffix, + group, + conditionalGroup, + indent, + dedent, + ifBreak, + hardline, + softline, + literalline, + align, + dedentToRoot, +} = doc.builders; +const { willBreak } = doc.utils; +const { + isNextLineEmptyAfterIndex, + hasNewline, + hasNewlineInRange, + getNextNonSpaceNonCommentCharacterIndex, + isNextLineEmpty, + isPreviousLineEmpty, +} = prettierUtil; + +/** + * Determine if we should print a trailing comma based on the config & php version + * + * @param options {object} Prettier Options + * @param requiredVersion {number} + * @returns {boolean} + */ +function shouldPrintComma(options, requiredVersion) { + if (!options.trailingCommaPHP) { + return false; + } + + return options.phpVersion >= requiredVersion; +} + +function shouldPrintHardlineForOpenBrace(options) { + switch (options.braceStyle) { + case "1tbs": + return false; + case "psr-2": + case "per-cs": + default: + return true; + } +} + +function genericPrint(path, options, print) { + const { node } = path; + + if (typeof node === "string") { + return node; + } + + const printedWithoutParens = printNode(path, options, print); + + const parts = []; + const needsParens = pathNeedsParens(path, options); + + if (needsParens) { + parts.unshift("("); + } + + parts.push(printedWithoutParens); + + if (needsParens) { + parts.push(")"); + } + + if (lineShouldEndWithSemicolon(path)) { + parts.push(";"); + } + + if (fileShouldEndWithHardline(path)) { + parts.push(hardline); + } + + return parts; +} + +function printPropertyLookup(path, options, print, nullsafe = false) { + return [nullsafe ? "?" : "", "->", print("offset")]; +} + +function printNullsafePropertyLookup(path, options, print) { + return printPropertyLookup(path, options, print, true); +} + +function printStaticLookup(path, options, print) { + const { node } = path; + const needCurly = !["variable", "identifier"].includes(node.offset.kind); + + return ["::", needCurly ? "{" : "", print("offset"), needCurly ? "}" : ""]; +} + +function printOffsetLookup(path, options, print) { + const { node } = path; + const shouldInline = + (node.offset && node.offset.kind === "number") || + getAncestorNode(path, "encapsed"); + + return [ + "[", + node.offset + ? group([ + indent([shouldInline ? "" : softline, print("offset")]), + shouldInline ? "" : softline, + ]) + : "", + "]", + ]; +} + +// We detect calls on member expressions specially to format a +// common pattern better. The pattern we are looking for is this: +// +// $arr +// ->map(function(x) { return $x + 1; }) +// ->filter(function(x) { return $x > 10; }) +// ->some(function(x) { return $x % 2; }); +// +// The way it is structured in the AST is via a nested sequence of +// propertylookup, staticlookup, offsetlookup and call. +// We need to traverse the AST and make groups out of it +// to print it in the desired way. +function printMemberChain(path, options, print) { + // The first phase is to linearize the AST by traversing it down. + // + // Example: + // a()->b->c()->d(); + // has the AST structure + // call (isLookupNode d ( + // call (isLookupNode c ( + // isLookupNode b ( + // call (variable a) + // ) + // )) + // )) + // and we transform it into (notice the reversed order) + // [identifier a, call, isLookupNode b, isLookupNode c, call, + // isLookupNode d, call] + const printedNodes = []; + + // Here we try to retain one typed empty line after each call expression or + // the first group whether it is in parentheses or not + // + // Example: + // $a + // ->call() + // + // ->otherCall(); + // + // ($foo ? $a : $b) + // ->call() + // ->otherCall(); + function shouldInsertEmptyLineAfter(node) { + const { originalText } = options; + const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex( + originalText, + locEnd(node) + ); + const nextChar = originalText.charAt(nextCharIndex); + + // if it is cut off by a parenthesis, we only account for one typed empty + // line after that parenthesis + if (nextChar === ")") { + return isNextLineEmptyAfterIndex( + originalText, + nextCharIndex + 1, + options + ); + } + + return isNextLineEmpty(originalText, locEnd(node)); + } + + function traverse(path) { + const { node } = path; + + if ( + node.kind === "call" && + (isLookupNode(node.what) || node.what.kind === "call") + ) { + printedNodes.unshift({ + node, + printed: [ + printAllComments( + path, + () => printArgumentsList(path, options, print), + options + ), + shouldInsertEmptyLineAfter(node) ? hardline : "", + ], + }); + path.call((what) => traverse(what), "what"); + } else if (isLookupNode(node)) { + // Print *lookup nodes as we standard print them outside member chain + let printedMemberish = null; + + if (node.kind === "propertylookup") { + printedMemberish = printPropertyLookup(path, options, print); + } else if (node.kind === "nullsafepropertylookup") { + printedMemberish = printNullsafePropertyLookup(path, options, print); + } else if (node.kind === "staticlookup") { + printedMemberish = printStaticLookup(path, options, print); + } else { + printedMemberish = printOffsetLookup(path, options, print); + } + + printedNodes.unshift({ + node, + needsParens: pathNeedsParens(path, options), + printed: printAllComments(path, () => printedMemberish, options), + }); + path.call((what) => traverse(what), "what"); + } else { + printedNodes.unshift({ + node, + printed: print(), + }); + } + } + + const { node } = path; + + printedNodes.unshift({ + node, + printed: printArgumentsList(path, options, print), + }); + path.call((what) => traverse(what), "what"); + + // Restore parens around `propertylookup` and `staticlookup` nodes with call. + // $value = ($object->foo)(); + // $value = ($object::$foo)(); + for (let i = 0; i < printedNodes.length; ++i) { + if ( + printedNodes[i].node.kind === "call" && + printedNodes[i - 1] && + ["propertylookup", "nullsafepropertylookup", "staticlookup"].includes( + printedNodes[i - 1].node.kind + ) && + printedNodes[i - 1].needsParens + ) { + printedNodes[0].printed = ["(", printedNodes[0].printed]; + printedNodes[i - 1].printed = [printedNodes[i - 1].printed, ")"]; + } + } + + // create groups from list of nodes, i.e. + // [identifier a, call, isLookupNode b, isLookupNode c, call, + // isLookupNode d, call] + // will be grouped as + // [ + // [identifier a, Call], + // [isLookupNode b, isLookupNode c, call], + // [isLookupNode d, call] + // ] + // so that we can print it as + // a() + // ->b->c() + // ->d(); + const groups = []; + + let currentGroup = [printedNodes[0]]; + let i = 1; + + for (; i < printedNodes.length; ++i) { + if ( + printedNodes[i].node.kind === "call" || + (isLookupNode(printedNodes[i].node) && + printedNodes[i].node.offset && + printedNodes[i].node.offset.kind === "number") + ) { + currentGroup.push(printedNodes[i]); + } else { + break; + } + } + + if (printedNodes[0].node.kind !== "call") { + for (; i + 1 < printedNodes.length; ++i) { + if ( + isLookupNode(printedNodes[i].node) && + isLookupNode(printedNodes[i + 1].node) + ) { + currentGroup.push(printedNodes[i]); + } else { + break; + } + } + } + + groups.push(currentGroup); + currentGroup = []; + + // Then, each following group is a sequence of propertylookup followed by + // a sequence of call. To compute it, we keep adding things to the + // group until we have seen a call in the past and reach a + // propertylookup + let hasSeenCallExpression = false; + + for (; i < printedNodes.length; ++i) { + if (hasSeenCallExpression && isLookupNode(printedNodes[i].node)) { + // [0] should be appended at the end of the group instead of the + // beginning of the next one + if ( + printedNodes[i].node.kind === "offsetlookup" && + printedNodes[i].node.offset && + printedNodes[i].node.offset.kind === "number" + ) { + currentGroup.push(printedNodes[i]); + continue; + } + + groups.push(currentGroup); + currentGroup = []; + hasSeenCallExpression = false; + } + + if (printedNodes[i].node.kind === "call") { + hasSeenCallExpression = true; + } + currentGroup.push(printedNodes[i]); + + if ( + printedNodes[i].node.comments && + hasTrailingComment(printedNodes[i].node) + ) { + groups.push(currentGroup); + currentGroup = []; + hasSeenCallExpression = false; + } + } + + if (currentGroup.length > 0) { + groups.push(currentGroup); + } + + // Merge next nodes when: + // + // 1. We have `$this` variable before + // + // Example: + // $this->method()->property; + // + // 2. When we have offsetlookup after *lookup node + // + // Example: + // $foo->Data['key']("foo") + // ->method(); + // + // 3. expression statements with variable names shorter than the tab width + // + // Example: + // $foo->bar() + // ->baz() + // ->buzz() + + function shouldNotWrap(groups) { + const hasComputed = + groups[1].length && groups[1][0].node.kind === "offsetlookup"; + + if (groups[0].length === 1) { + const firstNode = groups[0][0].node; + + return ( + (firstNode.kind === "variable" && + (firstNode.name === "this" || + (isExpressionStatement && isShort(firstNode.name)))) || + isReferenceLikeNode(firstNode) + ); + } + + function isShort(name) { + return name.length < options.tabWidth; + } + + const lastNode = getLast(groups[0]).node; + + return ( + isLookupNode(lastNode) && + (lastNode.offset.kind === "identifier" || + lastNode.offset.kind === "variable") && + hasComputed + ); + } + + const isExpressionStatement = path.parent.kind === "expressionstatement"; + const shouldMerge = + groups.length >= 2 && !groups[1][0].node.comments && shouldNotWrap(groups); + + function printGroup(printedGroup) { + const result = []; + + for (let i = 0; i < printedGroup.length; i++) { + // Checks if the next node (i.e. the parent node) needs parens + // and print accordingl y + if (printedGroup[i + 1] && printedGroup[i + 1].needsParens) { + result.push( + "(", + printedGroup[i].printed, + printedGroup[i + 1].printed, + ")" + ); + i++; + } else { + result.push(printedGroup[i].printed); + } + } + + return result; + } + + function printIndentedGroup(groups) { + if (groups.length === 0) { + return ""; + } + + return indent(group([hardline, join(hardline, groups.map(printGroup))])); + } + + const printedGroups = groups.map(printGroup); + const oneLine = printedGroups; + + // Indicates how many we should merge + // + // Example (true): + // $this->method()->otherMethod( + // 'argument' + // ); + // + // Example (false): + // $foo + // ->method() + // ->otherMethod(); + const cutoff = shouldMerge ? 3 : 2; + const flatGroups = groups.slice(0, cutoff).flat(); + + const hasComment = + flatGroups.slice(1, -1).some((node) => hasLeadingComment(node.node)) || + flatGroups.slice(0, -1).some((node) => hasTrailingComment(node.node)) || + (groups[cutoff] && hasLeadingComment(groups[cutoff][0].node)); + + const hasEncapsedAncestor = getAncestorNode(path, "encapsed"); + + // If we only have a single `->`, we shouldn't do anything fancy and just + // render everything concatenated together. + // In `encapsed` node we always print in one line. + if ((groups.length <= cutoff && !hasComment) || hasEncapsedAncestor) { + return group(oneLine); + } + + // Find out the last node in the first group and check if it has an + // empty line after + const lastNodeBeforeIndent = getLast( + shouldMerge ? groups.slice(1, 2)[0] : groups[0] + ).node; + const shouldHaveEmptyLineBeforeIndent = + lastNodeBeforeIndent.kind !== "call" && + shouldInsertEmptyLineAfter(lastNodeBeforeIndent); + + const expanded = [ + printGroup(groups[0]), + shouldMerge ? groups.slice(1, 2).map(printGroup) : "", + shouldHaveEmptyLineBeforeIndent ? hardline : "", + printIndentedGroup(groups.slice(shouldMerge ? 2 : 1)), + ]; + + const callExpressions = printedNodes.filter( + (tuple) => tuple.node.kind === "call" + ); + + // We don't want to print in one line if there's: + // * A comment. + // * 3 or more chained calls. + // * Any group but the last one has a hard line. + // If the last group is a function it's okay to inline if it fits. + if ( + hasComment || + (callExpressions.length > 2 && + callExpressions.some( + (exp) => !exp.node.arguments.every((arg) => isSimpleCallArgument(arg)) + )) || + printedGroups.slice(0, -1).some(willBreak) + ) { + return group(expanded); + } + + return [ + // We only need to check `oneLine` because if `expanded` is chosen + // that means that the parent group has already been broken + // naturally + willBreak(oneLine) || shouldHaveEmptyLineBeforeIndent ? breakParent : "", + conditionalGroup([oneLine, expanded]), + ]; +} + +function couldGroupArg(arg) { + return ( + (arg.kind === "array" && (arg.items.length > 0 || arg.comments)) || + arg.kind === "function" || + arg.kind === "method" || + arg.kind === "closure" + ); +} + +function shouldGroupLastArg(args) { + const lastArg = getLast(args); + const penultimateArg = getPenultimate(args); + + return ( + !hasLeadingComment(lastArg) && + !hasTrailingComment(lastArg) && + couldGroupArg(lastArg) && + // If the last two arguments are of the same type, + // disable last element expansion. + (!penultimateArg || penultimateArg.kind !== lastArg.kind) + ); +} + +function shouldGroupFirstArg(args) { + if (args.length !== 2) { + return false; + } + + const [firstArg, secondArg] = args; + + return ( + (!firstArg.comments || !firstArg.comments.length) && + (firstArg.kind === "function" || + firstArg.kind === "method" || + firstArg.kind === "closure") && + secondArg.kind !== "retif" && + !couldGroupArg(secondArg) + ); +} + +function printArgumentsList(path, options, print, argumentsKey = "arguments") { + const args = path.node[argumentsKey]; + + if (args.length === 0) { + return [ + "(", + printDanglingComments(path, options, /* sameIndent */ true), + ")", + ]; + } + + let anyArgEmptyLine = false; + let hasEmptyLineFollowingFirstArg = false; + + const printedArguments = path.map(({ node: arg, isLast, isFirst }) => { + const parts = [print()]; + + if (isLast) { + // do nothing + } else if (isNextLineEmpty(options.originalText, locEnd(arg))) { + if (isFirst) { + hasEmptyLineFollowingFirstArg = true; + } + + anyArgEmptyLine = true; + parts.push(",", hardline, hardline); + } else { + parts.push(",", line); + } + + return parts; + }, argumentsKey); + + const { node } = path; + const lastArg = getLast(args); + + const maybeTrailingComma = + (shouldPrintComma(options, 7.3) && + ["call", "new", "unset", "isset"].includes(node.kind)) || + (shouldPrintComma(options, 8.0) && + ["function", "closure", "method", "arrowfunc", "attribute"].includes( + node.kind + )) + ? indent([ + lastArg && shouldPrintHardlineBeforeTrailingComma(lastArg) + ? hardline + : "", + ",", + ]) + : ""; + + function allArgsBrokenOut() { + return group( + ["(", indent([line, ...printedArguments]), maybeTrailingComma, line, ")"], + { shouldBreak: true } + ); + } + + const shouldGroupFirst = shouldGroupFirstArg(args); + const shouldGroupLast = shouldGroupLastArg(args); + + if (shouldGroupFirst || shouldGroupLast) { + const shouldBreak = + (shouldGroupFirst + ? printedArguments.slice(1).some(willBreak) + : printedArguments.slice(0, -1).some(willBreak)) || anyArgEmptyLine; + + // We want to print the last argument with a special flag + let printedExpanded; + + path.each(({ isLast, isFirst }) => { + if (shouldGroupFirst && isFirst) { + printedExpanded = [ + print([], { expandFirstArg: true }), + printedArguments.length > 1 ? "," : "", + hasEmptyLineFollowingFirstArg ? hardline : line, + hasEmptyLineFollowingFirstArg ? hardline : "", + printedArguments.slice(1), + ]; + } + + if (shouldGroupLast && isLast) { + printedExpanded = [ + ...printedArguments.slice(0, -1), + print([], { expandLastArg: true }), + ]; + } + }, argumentsKey); + + const somePrintedArgumentsWillBreak = printedArguments.some(willBreak); + const simpleConcat = ["(", ...printedExpanded, ")"]; + + return [ + somePrintedArgumentsWillBreak ? breakParent : "", + conditionalGroup( + [ + !somePrintedArgumentsWillBreak + ? simpleConcat + : ifBreak(allArgsBrokenOut(), simpleConcat), + shouldGroupFirst + ? [ + "(", + group(printedExpanded[0], { shouldBreak: true }), + ...printedExpanded.slice(1), + ")", + ] + : [ + "(", + ...printedArguments.slice(0, -1), + group(getLast(printedExpanded), { + shouldBreak: true, + }), + ")", + ], + group( + [ + "(", + indent([line, ...printedArguments]), + ifBreak(maybeTrailingComma), + line, + ")", + ], + { shouldBreak: true } + ), + ], + { shouldBreak } + ), + ]; + } + + return group( + [ + "(", + indent([softline, ...printedArguments]), + ifBreak(maybeTrailingComma), + softline, + ")", + ], + { + shouldBreak: printedArguments.some(willBreak) || anyArgEmptyLine, + } + ); +} + +function shouldInlineRetifFalseExpression(node) { + return node.kind === "array" && node.items.length !== 0; +} + +function shouldInlineLogicalExpression(node) { + return node.right.kind === "array" && node.right.items.length !== 0; +} + +// For binary expressions to be consistent, we need to group +// subsequent operators with the same precedence level under a single +// group. Otherwise they will be nested such that some of them break +// onto new lines but not all. Operators with the same precedence +// level should either all break or not. Because we group them by +// precedence level and the AST is structured based on precedence +// level, things are naturally broken up correctly, i.e. `&&` is +// broken before `+`. +function printBinaryExpression( + path, + print, + options, + isNested, + isInsideParenthesis +) { + let parts = []; + const { node } = path; + + if (node.kind === "bin") { + // Put all operators with the same precedence level in the same + // group. The reason we only need to do this with the `left` + // expression is because given an expression like `1 + 2 - 3`, it + // is always parsed like `((1 + 2) - 3)`, meaning the `left` side + // is where the rest of the expression will exist. Binary + // expressions on the right side mean they have a difference + // precedence level and should be treated as a separate group, so + // print them normally. (This doesn't hold for the `**` operator, + // which is unique in that it is right-associative.) + if (shouldFlatten(node.type, node.left.type)) { + // Flatten them out by recursively calling this function. + parts = parts.concat( + path.call( + () => + printBinaryExpression( + path, + print, + options, + /* isNested */ true, + isInsideParenthesis + ), + "left" + ) + ); + } else { + parts.push(print("left")); + } + + const shouldInline = shouldInlineLogicalExpression(node); + + const right = shouldInline + ? [node.type, " ", print("right")] + : [node.type, line, print("right")]; + + // If there's only a single binary expression, we want to create a group + // in order to avoid having a small right part like -1 be on its own line. + const { parent } = path; + const shouldGroup = + !(isInsideParenthesis && ["||", "&&"].includes(node.type)) && + getNodeKindIncludingLogical(parent) !== + getNodeKindIncludingLogical(node) && + getNodeKindIncludingLogical(node.left) !== + getNodeKindIncludingLogical(node) && + getNodeKindIncludingLogical(node.right) !== + getNodeKindIncludingLogical(node); + + const shouldNotHaveWhitespace = + isDocNode(node.left) || + (node.left.kind === "bin" && isDocNode(node.left.right)); + + parts.push( + shouldNotHaveWhitespace ? "" : " ", + shouldGroup ? group(right) : right + ); + + // The root comments are already printed, but we need to manually print + // the other ones since we don't call the normal print on bin, + // only for the left and right parts + if (isNested && node.comments) { + parts = printAllComments(path, () => parts, options); + } + } else { + // Our stopping case. Simply print the node normally. + parts.push(print()); + } + + return parts; +} + +function printLookupNodes(path, options, print) { + const { node } = path; + + switch (node.kind) { + case "propertylookup": + return printPropertyLookup(path, options, print); + case "nullsafepropertylookup": + return printNullsafePropertyLookup(path, options, print); + case "staticlookup": + return printStaticLookup(path, options, print); + case "offsetlookup": + return printOffsetLookup(path, options, print); + /* c8 ignore next 2 */ + default: + throw new Error(`Have not implemented lookup kind ${node.kind} yet.`); + } +} + +function getEncapsedQuotes(node, { opening = true } = {}) { + if (node.type === "heredoc") { + return opening ? `<<<${node.label}` : node.label; + } + + const quotes = { + string: '"', + shell: "`", + }; + + if (quotes[node.type]) { + return quotes[node.type]; + } + + /* c8 ignore next */ + throw new Error(`Unimplemented encapsed type ${node.type}`); +} + +function printArrayItems(path, options, print) { + const printedElements = []; + let separatorParts = []; + + path.each(({ node }) => { + printedElements.push(separatorParts); + printedElements.push(group(print())); + + separatorParts = [",", line]; + + if (node && isNextLineEmpty(options.originalText, locEnd(node))) { + separatorParts.push(softline); + } + }, "items"); + + return printedElements; +} + +// Wrap parts into groups by indexes. +// It is require to have same indent on lines for all parts into group. +// The value of `alignment` option indicates how many spaces must be before each part. +// +// Example: +//
+// +//
+function wrapPartsIntoGroups(parts, indexes) { + if (indexes.length === 0) { + return parts; + } + + let lastEnd = 0; + + return indexes.reduce((accumulator, index) => { + const { start, end, alignment, before, after } = index; + const printedPartsForGrouping = [ + before || "", + ...parts.slice(start, end), + after || "", + ]; + const newArray = accumulator.concat( + parts.slice(lastEnd, start), + alignment + ? dedentToRoot( + group( + align(new Array(alignment).join(" "), printedPartsForGrouping) + ) + ) + : group(printedPartsForGrouping), + end === parts.length - 1 ? parts.slice(end) : "" + ); + + lastEnd = end; + + return newArray; + }, []); +} + +function printLines(path, options, print, childrenAttribute = "children") { + const { node, parent: parentNode } = path; + + let lastInlineIndex = -1; + + const parts = []; + const groupIndexes = []; + + path.map(() => { + const { + node: childNode, + next: nextNode, + isFirst: isFirstNode, + isLast: isLastNode, + index, + } = path; + + const isInlineNode = childNode.kind === "inline"; + const printedPath = print(); + const canPrintBlankLine = + !isLastNode && + !isInlineNode && + (nextNode && nextNode.kind === "case" + ? !isFirstChildrenInlineNode(path) + : nextNode && nextNode.kind !== "inline"); + + let printed = [ + printedPath, + canPrintBlankLine ? hardline : "", + canPrintBlankLine && + isNextLineEmpty(options.originalText, locEnd(childNode)) + ? hardline + : "", + ]; + + const isBlockNestedNode = + node.kind === "block" && + parentNode && + ["function", "closure", "method", "try", "catch"].includes( + parentNode.kind + ); + + let beforeCloseTagInlineNode = isBlockNestedNode && isFirstNode ? "" : " "; + + if (isInlineNode || (!isInlineNode && isLastNode && lastInlineIndex >= 0)) { + const prevLastInlineIndex = lastInlineIndex; + + if (isInlineNode) { + lastInlineIndex = index; + } + + const shouldCreateGroup = + (isInlineNode && !isFirstNode) || (!isInlineNode && isLastNode); + + if (shouldCreateGroup) { + const start = + (isInlineNode ? prevLastInlineIndex : lastInlineIndex) + 1; + const end = isLastNode && !isInlineNode ? index + 1 : index; + const prevInlineNode = + path.siblings[isInlineNode ? prevLastInlineIndex : lastInlineIndex]; + const alignment = prevInlineNode + ? getAlignment(prevInlineNode.raw) + : ""; + const shouldBreak = end - start > 1; + const before = shouldBreak + ? (isBlockNestedNode && !prevInlineNode) || + (isProgramLikeNode(node) && start === 0) + ? "" + : hardline + : ""; + const after = + shouldBreak && childNode.kind !== "halt" + ? isBlockNestedNode && isLastNode + ? "" + : hardline + : ""; + + if (shouldBreak) { + beforeCloseTagInlineNode = ""; + } + + groupIndexes.push({ start, end, alignment, before, after }); + } + } + + if (isInlineNode) { + const openTag = + nextNode && nextNode.kind === "echo" && nextNode.shortForm + ? "", + ] + : isProgramLikeNode(node) && isFirstNode && node.kind !== "namespace" + ? "" + : [beforeCloseTagInlineNode, "?>"]; + + //FIXME getNode is used to get ancestors, but it seems this means to get next sibling? + const nextV = path.getNode(index + 1); + const skipLastComment = nextV && nextV.children && nextV.children.length; + + const afterInline = + childNode.comments && childNode.comments.length + ? [ + openTag, + hardline, + skipLastComment ? printComments(childNode.comments, options) : "", + hardline, + ] + : isProgramLikeNode(node) && isLastNode + ? "" + : [openTag, " "]; + + printed = [beforeInline, printed, afterInline]; + } + + parts.push(printed); + }, childrenAttribute); + + const wrappedParts = wrapPartsIntoGroups(parts, groupIndexes); + + if (node.kind === "program" && !node.extra.parseAsEval) { + const parts = []; + + const [firstNode] = node.children; + const hasStartTag = !firstNode || firstNode.kind !== "inline"; + + if (hasStartTag) { + const between = options.originalText.trim().match(/^<\?(php|=)(\s+)?\S/); + const afterOpenTag = [ + between && between[2] && between[2].includes("\n") + ? [hardline, between[2].split("\n").length > 2 ? hardline : ""] + : " ", + node.comments ? printComments(node.comments, options) : "", + ]; + + const shortEcho = + firstNode && firstNode.kind === "echo" && firstNode.shortForm; + parts.push([shortEcho ? "\n?$/.test(options.originalText); + + if (hasEndTag) { + const lastNode = getLast(node.children); + const beforeCloseTag = lastNode + ? [ + hasNewlineInRange( + options.originalText.trimEnd(), + locEnd(lastNode), + locEnd(node) + ) + ? !( + lastNode.kind === "inline" && + lastNode.comments && + lastNode.comments.length + ) + ? hardline + : "" + : " ", + isNextLineEmpty(options.originalText, locEnd(lastNode)) + ? hardline + : "", + ] + : node.comments + ? hardline + : ""; + + parts.push(lineSuffix([beforeCloseTag, "?>"])); + } + + return parts; + } + + return wrappedParts; +} + +function printStatements(path, options, print, childrenAttribute) { + return path.map(({ node, isLast }) => { + const parts = []; + + parts.push(print()); + + if (!isLast) { + parts.push(hardline); + + if (isNextLineEmpty(options.originalText, locEnd(node))) { + parts.push(hardline); + } + } + + return parts; + }, childrenAttribute); +} + +function printClassPart( + path, + options, + print, + part = "extends", + beforePart = " ", + afterPart = " " +) { + const value = path.node[part]; + const printedBeforePart = hasDanglingComments(value) + ? [ + hardline, + path.call(() => printDanglingComments(path, options, true), part), + hardline, + ] + : beforePart; + const printedPartItems = Array.isArray(value) + ? group( + join( + ",", + path.map(({ node }) => { + const printedPart = print(); + // Check if any of the implements nodes have comments + return hasDanglingComments(node) + ? [ + hardline, + printDanglingComments(path, options, true), + hardline, + printedPart, + ] + : [afterPart, printedPart]; + }, part) + ) + ) + : [afterPart, print(part)]; + + return indent([ + printedBeforePart, + part, + willBreak(printedBeforePart) ? indent(printedPartItems) : printedPartItems, + ]); +} + +function printAttrs(path, options, print, { inline = false } = {}) { + const allAttrs = []; + if (!path.node.attrGroups) { + return []; + } + path.each(() => { + const attrGroup = ["#["]; + if (!inline && allAttrs.length > 0) { + allAttrs.push(hardline); + } + attrGroup.push(softline); + path.each(() => { + const attrNode = path.node; + if (attrGroup.length > 2) { + attrGroup.push(",", line); + } + const attrStmt = [attrNode.name]; + if (attrNode.args.length > 0) { + attrStmt.push(printArgumentsList(path, options, print, "args")); + } + attrGroup.push(group(attrStmt)); + }, "attrs"); + allAttrs.push( + group([ + indent(attrGroup), + ifBreak(shouldPrintComma(options, 8.0) ? "," : ""), + softline, + "]", + inline ? ifBreak(softline, " ") : "", + ]) + ); + }, "attrGroups"); + if (allAttrs.length === 0) { + return []; + } + return [...allAttrs, inline ? "" : hardline]; +} + +function printClass(path, options, print) { + const { node } = path; + const isAnonymousClass = node.kind === "class" && node.isAnonymous; + const attrs = printAttrs(path, options, print, { inline: isAnonymousClass }); + const declaration = isAnonymousClass ? [] : [...attrs]; + + if (node.isFinal) { + declaration.push("final "); + } + + if (node.isAbstract) { + declaration.push("abstract "); + } + + if (node.isReadonly) { + declaration.push("readonly "); + } + + // `new` print `class` keyword with arguments + declaration.push(isAnonymousClass ? "" : node.kind); + + if (node.name) { + declaration.push(" ", print("name")); + } + + if (node.kind === "enum" && node.valueType) { + declaration.push(": ", print("valueType")); + } + + // Only `class` can have `extends` and `implements` + if (node.extends && node.implements) { + declaration.push( + conditionalGroup( + [ + [ + printClassPart(path, options, print, "extends"), + printClassPart(path, options, print, "implements"), + ], + [ + printClassPart(path, options, print, "extends"), + printClassPart(path, options, print, "implements", " ", hardline), + ], + [ + printClassPart(path, options, print, "extends", hardline, " "), + printClassPart( + path, + options, + print, + "implements", + hardline, + node.implements.length > 1 ? hardline : " " + ), + ], + ], + { + shouldBreak: hasDanglingComments(node.extends), + } + ) + ); + } else { + if (node.extends) { + declaration.push( + conditionalGroup([ + printClassPart(path, options, print, "extends"), + printClassPart(path, options, print, "extends", " ", hardline), + printClassPart( + path, + options, + print, + "extends", + hardline, + node.extends.length > 1 ? hardline : " " + ), + ]) + ); + } + + if (node.implements) { + declaration.push( + conditionalGroup([ + printClassPart(path, options, print, "implements"), + printClassPart(path, options, print, "implements", " ", hardline), + printClassPart( + path, + options, + print, + "implements", + hardline, + node.implements.length > 1 ? hardline : " " + ), + ]) + ); + } + } + + const hasEmptyClassBody = + node.body && node.body.length === 0 && !hasDanglingComments(node); + + const printedDeclaration = group([ + group(declaration), + shouldPrintHardlineForOpenBrace(options) && !hasEmptyClassBody + ? isAnonymousClass + ? line + : hardline + : " ", + ]); + + const printedBody = [ + "{", + indent([ + hasEmptyClassBody ? "" : hardline, + printStatements(path, options, print, "body"), + ]), + printDanglingComments(path, options, true), + hasEmptyClassBody ? "" : hardline, + "}", + ]; + + return [printedDeclaration, printedBody]; +} + +function printFunction(path, options, print) { + const { node } = path; + const declAttrs = printAttrs(path, options, print, { + inline: node.kind === "closure", + }); + const declaration = []; + + if (node.isFinal) { + declaration.push("final "); + } + + if (node.isAbstract) { + declaration.push("abstract "); + } + + if (node.visibility) { + declaration.push(node.visibility, " "); + } + + if (node.isStatic) { + declaration.push("static "); + } + + declaration.push("function "); + + if (node.byref) { + declaration.push("&"); + } + + if (node.name) { + declaration.push(print("name")); + } + + declaration.push(printArgumentsList(path, options, print)); + + if (node.uses && node.uses.length > 0) { + declaration.push( + group([" use ", printArgumentsList(path, options, print, "uses")]) + ); + } + + if (node.type) { + declaration.push([ + ": ", + hasDanglingComments(node.type) + ? [ + path.call(() => printDanglingComments(path, options, true), "type"), + " ", + ] + : "", + node.nullable ? "?" : "", + print("type"), + ]); + } + + const printedDeclaration = declaration; + + if (!node.body) { + return [...declAttrs, printedDeclaration]; + } + + const printedBody = [ + "{", + indent([hasEmptyBody(path) ? "" : hardline, print("body")]), + hasEmptyBody(path) ? "" : hardline, + "}", + ]; + + const isClosure = node.kind === "closure"; + if (isClosure) { + return [...declAttrs, printedDeclaration, " ", printedBody]; + } + + if (node.arguments.length === 0) { + return [ + ...declAttrs, + printedDeclaration, + shouldPrintHardlineForOpenBrace(options) && !hasEmptyBody(path) + ? hardline + : " ", + printedBody, + ]; + } + + const willBreakDeclaration = declaration.some(willBreak); + + if (willBreakDeclaration) { + return [...declAttrs, printedDeclaration, " ", printedBody]; + } + + return [ + ...declAttrs, + conditionalGroup([ + [ + printedDeclaration, + shouldPrintHardlineForOpenBrace(options) && !hasEmptyBody(path) + ? hardline + : " ", + printedBody, + ], + [printedDeclaration, " ", printedBody], + ]), + ]; +} + +function printBodyControlStructure( + path, + options, + print, + bodyProperty = "body" +) { + const { node } = path; + + if (!node[bodyProperty]) { + return ";"; + } + + const printedBody = print(bodyProperty); + + return [ + node.shortForm ? ":" : " {", + indent( + node[bodyProperty].kind !== "block" || + (node[bodyProperty].children && + node[bodyProperty].children.length > 0) || + (node[bodyProperty].comments && node[bodyProperty].comments.length > 0) + ? [ + shouldPrintHardLineAfterStartInControlStructure(path) + ? node.kind === "switch" + ? " " + : "" + : hardline, + printedBody, + ] + : "" + ), + node.kind === "if" && bodyProperty === "body" + ? "" + : [ + shouldPrintHardLineBeforeEndInControlStructure(path) ? hardline : "", + node.shortForm ? ["end", node.kind, ";"] : "}", + ], + ]; +} + +function printAssignment( + leftNode, + printedLeft, + operator, + rightNode, + printedRight, + hasRef, + options +) { + if (!rightNode) { + return printedLeft; + } + + const printed = printAssignmentRight( + leftNode, + rightNode, + printedRight, + hasRef, + options + ); + + return group([printedLeft, operator, printed]); +} + +function isLookupNodeChain(node) { + if (!isLookupNode(node)) { + return false; + } + + if (node.what.kind === "variable" || isReferenceLikeNode(node.what)) { + return true; + } + + return isLookupNodeChain(node.what); +} + +function printAssignmentRight( + leftNode, + rightNode, + printedRight, + hasRef, + options +) { + const ref = hasRef ? "&" : ""; + + if (hasLeadingOwnLineComment(options.originalText, rightNode)) { + return indent([hardline, ref, printedRight]); + } + + const pureRightNode = rightNode.kind === "cast" ? rightNode.expr : rightNode; + + const canBreak = + (pureRightNode.kind === "bin" && + !shouldInlineLogicalExpression(pureRightNode)) || + (pureRightNode.kind === "retif" && + ((!pureRightNode.trueExpr && + !shouldInlineRetifFalseExpression(pureRightNode.falseExpr)) || + (pureRightNode.test.kind === "bin" && + !shouldInlineLogicalExpression(pureRightNode.test)))) || + ((leftNode.kind === "variable" || + leftNode.kind === "string" || + isLookupNode(leftNode)) && + ((pureRightNode.kind === "string" && !stringHasNewLines(pureRightNode)) || + isLookupNodeChain(pureRightNode))); + + if (canBreak) { + return group(indent([line, ref, printedRight])); + } + + return [" ", ref, printedRight]; +} + +function needsHardlineAfterDanglingComment(node) { + if (!node.comments) { + return false; + } + + const lastDanglingComment = getLast( + node.comments.filter((comment) => !comment.leading && !comment.trailing) + ); + + return lastDanglingComment && !isBlockComment(lastDanglingComment); +} + +function stringHasNewLines(node) { + return node.raw.includes("\n"); +} + +function isStringOnItsOwnLine(node, text) { + return ( + (node.kind === "string" || + (node.kind === "encapsed" && + (node.type === "string" || node.type === "shell"))) && + stringHasNewLines(node) && + !hasNewline(text, locStart(node), { backwards: true }) + ); +} + +function printComposedTypes(path, print, glue) { + return group( + path.map(({ isFirst }) => (isFirst ? [print()] : [glue, print()]), "types") + ); +} + +function printNode(path, options, print) { + const { node } = path; + + switch (node.kind) { + case "program": { + return group([ + printLines(path, options, print), + printDanglingComments( + path, + options, + /* sameIndent */ true, + (c) => !c.printed + ), + ]); + } + case "expressionstatement": + return print("expression"); + case "block": + return [ + printLines(path, options, print), + printDanglingComments(path, options, true), + ]; + case "declare": { + const printDeclareArguments = (path) => { + return join(", ", path.map(print, "directives")); + }; + + if (["block", "short"].includes(node.mode)) { + return [ + "declare(", + printDeclareArguments(path), + ")", + node.mode === "block" ? " {" : ":", + node.children.length > 0 + ? indent([hardline, printLines(path, options, print)]) + : "", + printDanglingComments(path, options), + hardline, + node.mode === "block" ? "}" : "enddeclare;", + ]; + } + + return [ + "declare(", + printDeclareArguments(path), + ")", + path.next?.kind === "inline" ? "" : ";", + ]; + } + case "declaredirective": + return [print("key"), "=", print("value")]; + case "namespace": + return [ + "namespace ", + node.name && typeof node.name === "string" + ? [node.name, node.withBrackets ? " " : ""] + : "", + node.withBrackets ? "{" : ";", + hasDanglingComments(node) + ? [" ", printDanglingComments(path, options, true)] + : "", + node.children.length > 0 + ? node.withBrackets + ? indent([hardline, printLines(path, options, print)]) + : [ + node.children[0].kind === "inline" + ? "" + : [ + hardline, + isNextLineEmptyAfterNamespace(options.originalText, node) + ? hardline + : "", + ], + printLines(path, options, print), + ] + : "", + node.withBrackets ? [hardline, "}"] : "", + ]; + case "usegroup": + return group([ + "use ", + node.type ? [node.type, " "] : "", + indent([ + node.name + ? [maybeStripLeadingSlashFromUse(node.name), "\\{", softline] + : "", + join([",", line], path.map(print, "items")), + ]), + node.name + ? [ifBreak(shouldPrintComma(options, 7.2) ? "," : ""), softline, "}"] + : "", + ]); + case "useitem": + return [ + node.type ? [node.type, " "] : "", + maybeStripLeadingSlashFromUse(node.name), + hasDanglingComments(node) + ? [" ", printDanglingComments(path, options, true)] + : "", + node.alias ? [" as ", print("alias")] : "", + ]; + case "class": + case "enum": + case "interface": + case "trait": + return printClass(path, options, print); + case "traitprecedence": + return [ + print("trait"), + "::", + print("method"), + " insteadof ", + join(", ", path.map(print, "instead")), + ]; + case "traitalias": + return [ + node.trait ? [print("trait"), "::"] : "", + node.method ? print("method") : "", + " as ", + join(" ", [ + ...(node.visibility ? [node.visibility] : []), + ...(node.as ? [print("as")] : []), + ]), + ]; + case "traituse": + return group([ + "use ", + indent(group(join([",", line], path.map(print, "traits")))), + node.adaptations + ? [ + " {", + node.adaptations.length > 0 + ? [ + indent([ + hardline, + printStatements(path, options, print, "adaptations"), + ]), + hardline, + ] + : hasDanglingComments(node) + ? [line, printDanglingComments(path, options, true), line] + : "", + "}", + ] + : "", + ]); + case "function": + case "closure": + case "method": + return printFunction(path, options, print); + case "arrowfunc": + return [ + node.parenthesizedExpression ? "(" : "", + ...printAttrs(path, options, print, { inline: true }), + node.isStatic ? "static " : "", + "fn", + printArgumentsList(path, options, print), + node.type ? [": ", node.nullable ? "?" : "", print("type")] : "", + " => ", + print("body"), + node.parenthesizedExpression ? ")" : "", + ]; + case "parameter": { + let promoted = ""; + if (node.flags === 1) { + promoted = "public "; + } else if (node.flags === 2) { + promoted = "protected "; + } else if (node.flags === 4) { + promoted = "private "; + } + const name = [ + ...printAttrs(path, options, print, { inline: true }), + promoted, + node.readonly ? "readonly " : "", + node.nullable ? "?" : "", + node.type ? [print("type"), " "] : "", + node.byref ? "&" : "", + node.variadic ? "..." : "", + "$", + print("name"), + ]; + + if (node.value) { + return group([ + name, + // see handleFunctionParameter() in ./comments.mjs - since there's + // no node to attach comments that fall in between the parameter name + // and value, we store them as dangling comments + hasDanglingComments(node) ? " " : "", + printDanglingComments(path, options, true), + " =", + printAssignmentRight( + node.name, + node.value, + print("value"), + false, + options + ), + ]); + } + + return name; + } + case "variadic": + return ["...", print("what")]; + case "property": + return group([ + node.readonly ? "readonly " : "", + node.type ? [node.nullable ? "?" : "", print("type"), " "] : "", + "$", + print("name"), + node.value + ? [ + " =", + printAssignmentRight( + node.name, + node.value, + print("value"), + false, + options + ), + ] + : "", + ]); + case "propertystatement": { + const attrs = []; + path.each(() => { + attrs.push(...printAttrs(path, options, print)); + }, "properties"); + const printed = path.map(print, "properties"); + + const hasValue = node.properties.some((property) => property.value); + + let firstProperty; + + if (printed.length === 1 && !node.properties[0].comments) { + [firstProperty] = printed; + } else if (printed.length > 0) { + // Indent first property + firstProperty = indent(printed[0]); + } + + const hasVisibility = node.visibility || node.visibility === null; + + return group([ + ...attrs, + hasVisibility + ? [node.visibility === null ? "var" : node.visibility, ""] + : "", + node.isStatic ? [hasVisibility ? " " : "", "static"] : "", + firstProperty ? [" ", firstProperty] : "", + indent( + printed.slice(1).map((p) => [",", hasValue ? hardline : line, p]) + ), + ]); + } + case "if": { + const parts = []; + const body = printBodyControlStructure(path, options, print, "body"); + const opening = group([ + "if (", + group([indent([softline, print("test")]), softline]), + ")", + body, + ]); + + parts.push( + opening, + isFirstChildrenInlineNode(path) || !node.body ? "" : hardline + ); + + if (node.alternate) { + parts.push(node.shortForm ? "" : "} "); + + const commentOnOwnLine = + (hasTrailingComment(node.body) && + node.body.comments.some( + (comment) => comment.trailing && !isBlockComment(comment) + )) || + needsHardlineAfterDanglingComment(node); + const elseOnSameLine = !commentOnOwnLine; + parts.push(elseOnSameLine ? "" : hardline); + + if (hasDanglingComments(node)) { + parts.push( + isNextLineEmpty(options.originalText, locEnd(node.body)) + ? hardline + : "", + printDanglingComments(path, options, true), + commentOnOwnLine ? hardline : " " + ); + } + + parts.push( + "else", + group( + node.alternate.kind === "if" + ? print("alternate") + : printBodyControlStructure(path, options, print, "alternate") + ) + ); + } else { + parts.push(node.body ? (node.shortForm ? "endif;" : "}") : ""); + } + + return parts; + } + case "do": + return [ + "do", + printBodyControlStructure(path, options, print, "body"), + " while (", + group([indent([softline, print("test")]), softline]), + ")", + ]; + case "while": + case "switch": + return group([ + node.kind, + " (", + group([indent([softline, print("test")]), softline]), + ")", + printBodyControlStructure(path, options, print, "body"), + ]); + case "for": { + const body = printBodyControlStructure(path, options, print, "body"); + + // We want to keep dangling comments above the loop to stay consistent. + // Any comment positioned between the for statement and the parentheses + // is going to be printed before the statement. + const dangling = printDanglingComments( + path, + options, + /* sameLine */ true + ); + const printedComments = dangling ? [dangling, softline] : ""; + + if (!node.init.length && !node.test.length && !node.increment.length) { + return [printedComments, group(["for (;;)", body])]; + } + + return [ + printedComments, + group([ + "for (", + group([ + indent([ + softline, + group(join([",", line], path.map(print, "init"))), + ";", + line, + group(join([",", line], path.map(print, "test"))), + ";", + line, + group(join([",", line], path.map(print, "increment"))), + ]), + softline, + ]), + ")", + body, + ]), + ]; + } + case "foreach": { + const body = printBodyControlStructure(path, options, print, "body"); + + // We want to keep dangling comments above the loop to stay consistent. + // Any comment positioned between the for statement and the parentheses + // is going to be printed before the statement. + const dangling = printDanglingComments( + path, + options, + /* sameLine */ true + ); + const printedComments = dangling ? [dangling, softline] : ""; + + return [ + printedComments, + group([ + "foreach (", + group([ + indent([ + softline, + print("source"), + line, + "as ", + group( + node.key + ? indent(join([" =>", line], [print("key"), print("value")])) + : print("value") + ), + ]), + softline, + ]), + ")", + body, + ]), + ]; + } + case "try": { + const parts = []; + + parts.push( + "try", + printBodyControlStructure(path, options, print, "body") + ); + + if (node.catches) { + parts.push(path.map(print, "catches")); + } + + if (node.always) { + parts.push( + " finally", + printBodyControlStructure(path, options, print, "always") + ); + } + + return parts; + } + case "catch": { + return [ + " catch", + node.what + ? [ + " (", + join(" | ", path.map(print, "what")), + node.variable ? [" ", print("variable")] : "", + ")", + ] + : "", + printBodyControlStructure(path, options, print, "body"), + ]; + } + case "case": + return [ + node.test + ? [ + "case ", + node.test.comments ? indent(print("test")) : print("test"), + ":", + ] + : "default:", + node.body + ? node.body.children && node.body.children.length + ? indent([ + isFirstChildrenInlineNode(path) ? "" : hardline, + print("body"), + ]) + : "" + : "", + ]; + case "break": + case "continue": + if (node.level) { + if (node.level.kind === "number" && node.level.value !== "1") { + return [`${node.kind} `, print("level")]; + } + + return node.kind; + } + + return node.kind; + case "call": { + // Multiline strings as single arguments + if ( + node.arguments.length === 1 && + isStringOnItsOwnLine(node.arguments[0], options.originalText) + ) { + return [ + print("what"), + "(", + join(", ", path.map(print, "arguments")), + ")", + ]; + } + + // chain: Call (*LookupNode (Call (*LookupNode (...)))) + if (isLookupNode(node.what)) { + return printMemberChain(path, options, print); + } + + return [print("what"), printArgumentsList(path, options, print)]; + } + case "new": { + const isAnonymousClassNode = + node.what && node.what.kind === "class" && node.what.isAnonymous; + + // Multiline strings as single arguments + if ( + !isAnonymousClassNode && + node.arguments.length === 1 && + isStringOnItsOwnLine(node.arguments[0], options.originalText) + ) { + return [ + "new ", + ...path.call(printAttrs, "what"), + print("what"), + "(", + join(", ", path.map(print, "arguments")), + ")", + ]; + } + + const parts = []; + + parts.push("new "); + + if (isAnonymousClassNode) { + parts.push( + node.what.leadingComments && + node.what.leadingComments[0].kind === "commentblock" + ? [printComments(node.what.leadingComments, options), " "] + : "", + ...path.call( + () => printAttrs(path, options, print, { inline: true }), + "what" + ), + "class", + node.arguments.length > 0 + ? [" ", printArgumentsList(path, options, print)] + : "", + group(print("what")) + ); + } else { + const isExpression = ["call", "offsetlookup"].includes(node.what.kind); + const printed = [ + isExpression ? "(" : "", + print("what"), + isExpression ? ")" : "", + printArgumentsList(path, options, print), + ]; + + parts.push(hasLeadingComment(node.what) ? indent(printed) : printed); + } + + return parts; + } + case "clone": + return [ + "clone ", + node.what.comments ? indent(print("what")) : print("what"), + ]; + case "propertylookup": + case "nullsafepropertylookup": + case "staticlookup": + case "offsetlookup": { + const { parent } = path; + + // TODO: Use `AstPath.findAncestor` when it's stable + let firstNonMemberParent; + let i = 0; + do { + firstNonMemberParent = path.getParentNode(i); + i++; + } while (firstNonMemberParent && isLookupNode(firstNonMemberParent)); + + const hasEncapsedAncestor = getAncestorNode(path, "encapsed"); + const shouldInline = + hasEncapsedAncestor || + (firstNonMemberParent && + (firstNonMemberParent.kind === "new" || + (firstNonMemberParent.kind === "assign" && + firstNonMemberParent.left.kind !== "variable"))) || + node.kind === "offsetlookup" || + ((isReferenceLikeNode(node.what) || node.what.kind === "variable") && + ["identifier", "variable", "encapsedpart"].includes( + node.offset.kind + ) && + parent && + !isLookupNode(parent)); + + return [ + print("what"), + shouldInline + ? printLookupNodes(path, options, print) + : group(indent([softline, printLookupNodes(path, options, print)])), + ]; + } + case "exit": + return group([ + node.useDie ? "die" : "exit", + "(", + node.expression + ? isStringOnItsOwnLine(node.expression, options.originalText) + ? print("expression") + : [indent([softline, print("expression")]), softline] + : printDanglingComments(path, options), + ")", + ]); + case "global": + return group([ + "global ", + indent(join([",", line], path.map(print, "items"))), + ]); + case "include": + return [ + node.require ? "require" : "include", + node.once ? "_once" : "", + " ", + node.target.comments ? indent(print("target")) : print("target"), + ]; + case "label": + return [print("name"), ":"]; + case "goto": + return ["goto ", print("label")]; + case "throw": + return [ + "throw ", + node.what.comments ? indent(print("what")) : print("what"), + ]; + case "silent": + return ["@", print("expr")]; + case "halt": + return [ + hasDanglingComments(node) + ? [ + printDanglingComments(path, options, /* sameIndent */ true), + hardline, + ] + : "", + "__halt_compiler();", + node.after, + ]; + case "eval": + return group([ + "eval(", + isStringOnItsOwnLine(node.source, options.originalText) + ? print("source") + : [indent([softline, print("source")]), softline], + ")", + ]); + case "echo": { + const printedArguments = path.map(print, "expressions"); + + let firstVariable; + + if (printedArguments.length === 1 && !node.expressions[0].comments) { + [firstVariable] = printedArguments; + } else if (printedArguments.length > 0) { + firstVariable = + isDocNode(node.expressions[0]) || node.expressions[0].comments + ? indent(printedArguments[0]) + : dedent(printedArguments[0]); + } + + return group([ + node.shortForm ? "" : "echo ", + firstVariable ? firstVariable : "", + indent(printedArguments.slice(1).map((p) => [",", line, p])), + ]); + } + case "print": { + return [ + "print ", + node.expression.comments + ? indent(print("expression")) + : print("expression"), + ]; + } + case "return": { + const parts = []; + + parts.push("return"); + + if (node.expr) { + const printedExpr = print("expr"); + + parts.push(" ", node.expr.comments ? indent(printedExpr) : printedExpr); + } + + if (hasDanglingComments(node)) { + parts.push( + " ", + printDanglingComments(path, options, /* sameIndent */ true) + ); + } + + return parts; + } + case "isset": + case "unset": + return group([ + node.kind, + printArgumentsList(path, options, print, "variables"), + ]); + case "empty": + return group([ + "empty(", + indent([softline, print("expression")]), + softline, + ")", + ]); + case "variable": { + const { parent, grandparent: parentParent } = path; + const ampersand = parent.kind === "assign" ? "" : node.byref ? "&" : ""; + const dollar = + (parent.kind === "encapsedpart" && + parent.syntax === "simple" && + parent.curly) || + (parentParent && + parent.kind === "offsetlookup" && + parentParent.kind === "encapsedpart" && + parentParent.syntax === "simple" && + parentParent.curly) + ? "" + : "$"; + const openCurly = node.curly ? "{" : ""; + const closeCurly = node.curly ? "}" : ""; + + return [ampersand, dollar, openCurly, print("name"), closeCurly]; + } + case "constantstatement": + case "classconstant": { + const attrs = printAttrs(path, options, print); + const printed = path.map(print, "constants"); + + let firstVariable; + + if (printed.length === 1 && !node.constants[0].comments) { + [firstVariable] = printed; + } else if (printed.length > 0) { + // Indent first item + firstVariable = indent(printed[0]); + } + + return group([ + ...attrs, + node.final ? "final " : "", + node.visibility ? [node.visibility, " "] : "", + "const", + node.type ? [node.nullable ? " ?" : " ", print("type")] : "", + firstVariable ? [" ", firstVariable] : "", + indent(printed.slice(1).map((p) => [",", hardline, p])), + ]); + } + case "constant": + return printAssignment( + node.name, + print("name"), + " =", + node.value, + print("value"), + false, + options + ); + case "static": { + const printed = path.map(print, "variables"); + + const hasValue = node.variables.some((item) => item.defaultValue); + + let firstVariable; + + if (printed.length === 1 && !node.variables[0].comments) { + [firstVariable] = printed; + } else if (printed.length > 0) { + // Indent first item + firstVariable = indent(printed[0]); + } + + return group([ + "static", + firstVariable ? [" ", firstVariable] : "", + indent( + printed.slice(1).map((p) => [",", hasValue ? hardline : line, p]) + ), + ]); + } + case "staticvariable": { + return printAssignment( + node.variable, + print("variable"), + " =", + node.defaultValue, + print("defaultValue"), + false, + options + ); + } + case "list": + case "array": { + const useShortForm = + (node.kind === "array" && options.phpVersion >= 5.4) || + (node.kind === "list" && (node.shortForm || options.phpVersion >= 7.1)); + const open = useShortForm ? "[" : [node.kind, "("]; + const close = useShortForm ? "]" : ")"; + + if (node.items.length === 0) { + if (!hasDanglingComments(node)) { + return [open, close]; + } + + return group([ + open, + printDanglingComments(path, options), + softline, + close, + ]); + } + + const lastElem = getLast(node.items); + + // PHP allows you to have empty elements in an array which + // changes its length based on the number of commas. The algorithm + // is that if the last argument is null, we need to force insert + // a comma to ensure PHP recognizes it. + // [,] === $arr; + // [1,] === $arr; + // [1,,] === $arr; + // + // Note that getLast returns null if the array is empty, but + // we already check for an empty array just above so we are safe + const needsForcedTrailingComma = lastElem && lastElem.kind === "noop"; + + const [firstProperty] = node.items + .filter((node) => node.kind !== "noop") + .sort((a, b) => locStart(a) - locStart(b)); + const isAssociative = !!(firstProperty && firstProperty.key); + const shouldBreak = + isAssociative && + firstProperty && + hasNewlineInRange( + options.originalText, + locStart(node), + locStart(firstProperty) + ); + + return group( + [ + open, + indent([softline, printArrayItems(path, options, print)]), + needsForcedTrailingComma ? "," : "", + ifBreak( + !needsForcedTrailingComma && shouldPrintComma(options, 5.0) + ? [ + lastElem && shouldPrintHardlineBeforeTrailingComma(lastElem) + ? hardline + : "", + ",", + ] + : "" + ), + printDanglingComments(path, options, true), + softline, + close, + ], + { shouldBreak } + ); + } + case "entry": { + const ref = node.byRef ? "&" : ""; + const unpack = node.unpack ? "..." : ""; + return node.key + ? printAssignment( + node.key, + print("key"), + " =>", + node.value, + print("value"), + ref, + options + ) + : [ref, unpack, print("value")]; + } + case "yield": { + const printedKeyAndValue = [ + node.key ? [print("key"), " => "] : "", + print("value"), + ]; + + return [ + "yield", + node.key || node.value ? " " : "", + node.value && node.value.comments + ? indent(printedKeyAndValue) + : printedKeyAndValue, + ]; + } + case "yieldfrom": + return [ + "yield from ", + node.value.comments ? indent(print("value")) : print("value"), + ]; + case "unary": + return [node.type, print("what")]; + case "pre": + return [node.type + node.type, print("what")]; + case "post": + return [print("what"), node.type + node.type]; + case "cast": + return [ + "(", + node.type, + ") ", + node.expr.comments ? indent(print("expr")) : print("expr"), + ]; + case "assignref": + case "assign": { + const hasRef = node.kind === "assignref"; + + return printAssignment( + node.left, + print("left"), + [" ", hasRef ? "=" : node.operator], + node.right, + print("right"), + hasRef, + options + ); + } + case "bin": { + const { parent, grandparent: parentParent } = path; + const isInsideParenthesis = + node !== parent.body && + (parent.kind === "if" || + parent.kind === "while" || + parent.kind === "switch" || + parent.kind === "do"); + + const parts = printBinaryExpression( + path, + print, + options, + /* isNested */ false, + isInsideParenthesis + ); + + // if ( + // $this->hasPlugin('dynamicImports') && $this->lookahead()->type === tt->parenLeft + // ) { + // + // looks super weird, we want to break the children if the parent breaks + // + // if ( + // $this->hasPlugin('dynamicImports') && + // $this->lookahead()->type === tt->parenLeft + // ) { + if (isInsideParenthesis) { + return parts; + } + + // Break between the parens in unaries or in a member expression, i.e. + // + // ( + // a && + // b && + // c + // )->call() + if ( + parent.kind === "unary" || + (isLookupNode(parent) && parent.kind !== "offsetlookup") + ) { + return group([indent([softline, ...parts]), softline]); + } + + // Avoid indenting sub-expressions in some cases where the first sub-expression is already + // indented accordingly. We should indent sub-expressions where the first case isn't indented. + const shouldNotIndent = + (node !== parent.body && parent.kind === "for") || + (parent.kind === "retif" && + parentParent && + parentParent.kind !== "return"); + + const shouldIndentIfInlining = [ + "assign", + "property", + "constant", + "staticvariable", + "entry", + ].includes(parent.kind); + + const samePrecedenceSubExpression = + node.left.kind === "bin" && shouldFlatten(node.type, node.left.type); + + if ( + shouldNotIndent || + (shouldInlineLogicalExpression(node) && !samePrecedenceSubExpression) || + (!shouldInlineLogicalExpression(node) && shouldIndentIfInlining) + ) { + return group(parts); + } + + const rest = parts.slice(1); + + return group([ + // Don't include the initial expression in the indentation + // level. The first item is guaranteed to be the first + // left-most expression. + parts.length > 0 ? parts[0] : "", + indent(rest), + ]); + } + case "retif": { + const parts = []; + const { parent } = path; + + // TODO: Use `AstPath.findAncestor` when it's stable + // Find the outermost non-retif parent, and the outermost retif parent. + let currentParent; + let i = 0; + + do { + currentParent = path.getParentNode(i); + i++; + } while (currentParent && currentParent.kind === "retif"); + const firstNonRetifParent = currentParent || parent; + + const printedFalseExpr = + node.falseExpr.kind === "bin" + ? indent(print("falseExpr")) + : print("falseExpr"); + const part = [ + node.trueExpr ? line : " ", + "?", + node.trueExpr + ? [ + " ", + node.trueExpr.kind === "bin" + ? indent(print("trueExpr")) + : print("trueExpr"), + line, + ] + : "", + ":", + node.trueExpr + ? [" ", printedFalseExpr] + : [ + shouldInlineRetifFalseExpression(node.falseExpr) ? " " : line, + printedFalseExpr, + ], + ]; + + parts.push(part); + + // We want a whole chain of retif to all break if any of them break. + const maybeGroup = (doc) => + parent === firstNonRetifParent ? group(doc) : doc; + + // Break the closing parens to keep the chain right after it: + // ($a + // ? $b + // : $c + // )->call() + const parentParent = path.grandparent; + const pureParent = + parent.kind === "cast" && parentParent ? parentParent : parent; + const breakLookupNodes = [ + "propertylookup", + "nullsafepropertylookup", + "staticlookup", + ]; + const breakClosingParens = breakLookupNodes.includes(pureParent.kind); + + const printedTest = print("test"); + + if (!node.trueExpr) { + const printed = [ + printedTest, + pureParent.kind === "bin" || + ["print", "echo", "return", "include"].includes( + firstNonRetifParent.kind + ) + ? indent(parts) + : parts, + ]; + + // Break between the parens in unaries or in a lookup nodes, i.e. + // + // ( + // a ?: + // b ?: + // c + // )->call() + if ( + (pureParent.kind === "call" && pureParent.what === node) || + pureParent.kind === "unary" || + (isLookupNode(pureParent) && pureParent.kind !== "offsetlookup") + ) { + return group([indent([softline, printed]), softline]); + } + + return maybeGroup(printed); + } + + return maybeGroup([ + node.test.kind === "retif" ? indent(printedTest) : printedTest, + indent(parts), + breakClosingParens ? softline : "", + ]); + } + case "boolean": + return node.value ? "true" : "false"; + case "number": + return printNumber(node.value); + case "string": { + const { parent } = path; + + if (parent.kind === "encapsedpart") { + const parentParent = path.grandparent; + let closingTagIndentation = 0; + const flexible = options.phpVersion >= 7.3; + let linebreak = literalline; + if (parentParent.type === "heredoc") { + linebreak = flexible ? hardline : literalline; + const lines = parentParent.raw.split("\n"); + closingTagIndentation = lines[lines.length - 1].search(/\S/); + if (closingTagIndentation === -1) { + closingTagIndentation = lines[lines.length - 2].search(/\S/); + } + } + return join( + linebreak, + node.raw + .split("\n") + .map((s, i) => + i > 0 || node.loc.start.column === 0 + ? s.substring(closingTagIndentation) + : s + ) + ); + } + + const quote = useDoubleQuote(node, options) ? '"' : "'"; + + let stringValue = node.raw; + + if (node.raw[0] === "b") { + stringValue = stringValue.slice(1); + } + + // We need to strip out the quotes from the raw value + if (['"', "'"].includes(stringValue[0])) { + stringValue = stringValue.substr(1); + } + + if (['"', "'"].includes(stringValue[stringValue.length - 1])) { + stringValue = stringValue.substr(0, stringValue.length - 1); + } + + return [ + node.raw[0] === "b" ? "b" : "", + quote, + join(literalline, stringValue.split("\n")), + quote, + ]; + } + case "intersectiontype": { + return printComposedTypes(path, print, "&"); + } + case "uniontype": { + return printComposedTypes(path, print, "|"); + } + case "encapsedpart": { + const open = + (node.syntax === "simple" && node.curly) || node.syntax === "complex" + ? [node.curly ? "$" : "", "{"] + : ""; + const close = + (node.syntax === "simple" && node.curly) || node.syntax === "complex" + ? "}" + : ""; + + return [open, print("expression"), close]; + } + case "encapsed": + switch (node.type) { + case "string": + case "shell": + case "heredoc": { + const flexible = options.phpVersion >= 7.3; + const linebreak = flexible ? hardline : literalline; + return [ + getEncapsedQuotes(node), + // Respect `indent` for `heredoc` nodes + node.type === "heredoc" ? linebreak : "", + ...path.map(print, "value"), + getEncapsedQuotes(node, { opening: false }), + node.type === "heredoc" && docShouldHaveTrailingNewline(path) + ? hardline + : "", + ]; + } + /* c8 ignore next 2 */ + default: + throw new Error(`Have not implemented kind ${node.type} yet.`); + } + case "inline": + return join( + literalline, + node.raw.replace("___PSEUDO_INLINE_PLACEHOLDER___", "").split("\n") + ); + case "magic": + return node.value; + case "nowdoc": { + const flexible = options.phpVersion >= 7.3; + const linebreak = flexible ? hardline : literalline; + return [ + "<<<'", + node.label, + "'", + linebreak, + join(linebreak, node.value.split("\n")), + linebreak, + node.label, + docShouldHaveTrailingNewline(path) ? hardline : "", + ]; + } + case "name": + return [node.resolution === "rn" ? "namespace\\" : "", node.name]; + case "literal": + return print("value"); + case "parentreference": + return "parent"; + case "selfreference": + return "self"; + case "staticreference": + return "static"; + case "typereference": + return node.name; + case "nullkeyword": + return "null"; + case "identifier": { + const { parent } = path; + + if (parent.kind === "method") { + node.name = normalizeMagicMethodName(node.name); + } + + return print("name"); + } + case "match": { + const arms = path.map(() => { + const armNode = path.node; + + const maybeLeadingComment = hasLeadingComment(armNode) + ? [printComments(armNode.leadingComments, options), hardline] + : []; + const maybeTrailingComma = + !path.isLast || options.trailingCommaPHP ? "," : ""; + const maybeTrailingComment = hasTrailingComment(armNode) + ? [ + " ", + printComments( + armNode.comments.filter((c) => c.trailing), + options + ), + ] + : []; + + const conds = + armNode.conds === null + ? "default" + : path.map( + ({ isFirst }) => [",", line, print()].slice(isFirst ? 2 : 0), + "conds" + ); + const body = print("body"); + const maybeEmptyLineBetweenArms = + !path.isFirst && + isPreviousLineEmpty(options.originalText, locStart(armNode)) + ? hardline + : ""; + + return [ + "", + hardline, + maybeEmptyLineBetweenArms, + ...maybeLeadingComment, + group([ + group([conds, indent(line)]), + "=> ", + body, + maybeTrailingComma, + ...maybeTrailingComment, + ]), + ].slice(!path.isFirst ? 0 : 1); + }, "arms"); + return group([ + "match (", + group([indent([softline, print("cond")]), softline]), + ") {", + group(indent([...arms])), + " ", + softline, + "}", + ]); + } + + case "noop": + return node.comments ? printComments(node.comments, options) : ""; + case "namedargument": + return [node.name, ": ", print("value")]; + + case "enumcase": + return group([ + "case ", + print("name"), + node.value + ? [ + " =", + printAssignmentRight( + node.name, + node.value, + print("value"), + false, + options + ), + ] + : "", + ]); + case "variadicplaceholder": + return "..."; + + /* c8 ignore next 3 */ + case "error": + default: + throw new Error(`Have not implemented kind '${node.kind}' yet.`); + } +} + +export default genericPrint; diff --git a/src/util.js b/src/util.js deleted file mode 100644 index 43c5afb35..000000000 --- a/src/util.js +++ /dev/null @@ -1,445 +0,0 @@ -"use strict"; - -const docUtils = require("prettier").doc.utils; - -function printNumber(rawNumber) { - return ( - rawNumber - .toLowerCase() - // Remove unnecessary plus and zeroes from scientific notation. - .replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(\d)/, "$1$2$3") - // Remove unnecessary scientific notation (1e0). - .replace(/^([+-]?[\d.]+)e[+-]?0+$/, "$1") - // Make sure numbers always start with a digit. - .replace(/^([+-])?\./, "$10.") - // Remove extraneous trailing decimal zeroes. - .replace(/(\.\d+?)0+(?=e|$)/, "$1") - // Remove trailing dot. - .replace(/\.(?=e|$)/, "") - ); -} - -// @TODO: if we're using the "raw" value from the parser, do we need this? -function stringEscape(str) { - return str.replace(/[\n\r\t\v\f\u001b\\]/g, (character, index) => { - switch (character) { - case "\n": - return "\\n"; - case "\r": - return "\\r"; - case "\t": - return "\\t"; - case "\v": - return "\\v"; - case "\f": - return "\\f"; - case "\u001b": - return "\\e"; - case "\\": { - const nextCharacter = str[index + 1]; - return !nextCharacter || !/[ux0-7]/.test(nextCharacter) ? "\\\\" : "\\"; - } - } - }); -} - -// http://php.net/manual/en/language.operators.precedence.php -const PRECEDENCE = {}; -[ - ["or"], - ["xor"], - ["and"], - [ - "=", - "+=", - "-=", - "*=", - "**=", - "/=", - ".=", - "%=", - "&=", - "|=", - "^=", - "<<=", - ">>=" - ], - ["?:"], - ["??"], - ["||"], - ["&&"], - ["|"], - ["^"], - ["&"], - ["==", "===", "!=", "!==", "<>", "<=>"], - ["<", ">", "<=", ">="], - [">>", "<<"], - ["+", "-", "."], - ["*", "/", "%"], - ["!"], - ["++", "--", "~"], - ["**"], - ["["], - ["clone", "new"] -].forEach((tier, i) => { - tier.forEach(op => { - PRECEDENCE[op] = i; - }); -}); - -function getPrecedence(op) { - return PRECEDENCE[op]; -} - -const equalityOperators = ["==", "!=", "===", "!==", "<>", "<=>"]; -const multiplicativeOperators = ["*", "/", "%"]; -const bitshiftOperators = [">>", "<<"]; - -function shouldFlatten(parentOp, nodeOp) { - if (getPrecedence(nodeOp) !== getPrecedence(parentOp)) { - return false; - } - - // ** is right-associative - // x ** y ** z --> x ** (y ** z) - if (parentOp === "**") { - return false; - } - - // x == y == z --> (x == y) == z - if ( - equalityOperators.includes(parentOp) && - equalityOperators.includes(nodeOp) - ) { - return false; - } - - // x * y % z --> (x * y) % z - if ( - (nodeOp === "%" && multiplicativeOperators.includes(parentOp)) || - (parentOp === "%" && multiplicativeOperators.includes(nodeOp)) - ) { - return false; - } - - // x << y << z --> (x << y) << z - if ( - bitshiftOperators.includes(parentOp) && - bitshiftOperators.includes(nodeOp) - ) { - return false; - } - - return true; -} - -function nodeHasStatement(node) { - return [ - "block", - "program", - "namespace", - "class", - "interface", - "trait", - "traituse", - "declare" - ].includes(node.kind); -} - -function isControlStructureNode(node) { - return ["if", "while", "do", "for", "foreach"].includes(node.kind); -} - -function getBodyFirstChild({ body }) { - if (!body) { - return null; - } - if (body.kind === "block") { - body = body.children; - } - return body[0]; -} - -function shouldRemoveLines(path) { - const node = path.getValue(); - const firstChild = getBodyFirstChild(node); - - return ( - (isPrevNodeInline(path) && isNextNodeInline(path)) || - (isControlStructureNode(node) && firstChild && firstChild.kind === "inline") - ); -} - -function removeNewlines(doc) { - return docUtils.mapDoc(doc, d => { - if (d.type === "line") { - return d.soft ? "" : " "; - } else if (d.type === "if-break") { - return d.flatContents || ""; - } - return d; - }); -} - -function getNodeListProperty(node) { - const body = node.children || node.body || node.adaptations; - return Array.isArray(body) ? body : null; -} - -function getParentNodeListProperty(path) { - const parent = path.getParentNode(); - if (!parent) { - return null; - } - return getNodeListProperty(parent); -} - -function getNodeIndex(path) { - const body = getParentNodeListProperty(path); - if (!body) { - return -1; - } - return body.indexOf(path.getValue()); -} - -function getLast(arr) { - if (arr.length > 0) { - return arr[arr.length - 1]; - } - return null; -} - -function getPenultimate(arr) { - if (arr.length > 1) { - return arr[arr.length - 2]; - } - return null; -} - -function isLastStatement(path) { - const body = getParentNodeListProperty(path); - if (!body) { - return true; - } - const node = path.getValue(); - return body[body.length - 1] === node; -} - -function isFirstNodeInParentProgramNode(path) { - const parentNode = path.getParentNode(); - const nodeIndex = getNodeIndex(path); - const isParentProgramNode = parentNode && parentNode.kind === "program"; - return isParentProgramNode && nodeIndex === 0; -} - -function isFirstNodeInParentNode(path) { - const nodeIndex = getNodeIndex(path); - return nodeIndex === 0; -} - -function isLastNodeInParentNode(path) { - const parentNodeBody = getParentNodeListProperty(path); - const nodeIndex = getNodeIndex(path); - return parentNodeBody && nodeIndex === parentNodeBody.length - 1; -} - -function isPrevNodeInline(path) { - const nodeIndex = getNodeIndex(path); - const parentNodeBody = getParentNodeListProperty(path); - const prevNode = nodeIndex !== -1 && parentNodeBody[nodeIndex - 1]; - return prevNode && prevNode.kind === "inline"; -} - -function isNextNodeInline(path) { - const parentNodeBody = getParentNodeListProperty(path); - const nodeIndex = getNodeIndex(path); - const nextNode = nodeIndex !== -1 && parentNodeBody[nodeIndex + 1]; - return nextNode && nextNode.kind === "inline"; -} - -function lineShouldHaveStartPHPTag(path) { - const node = path.getValue(); - return ( - (node.kind === "program" && - node.children[0] && - node.children[0].kind !== "inline") || - isPrevNodeInline(path) - ); -} - -/** - * Heredoc/Nowdoc nodes need a trailing linebreak if they - * appear as function arguments or array elements - */ -function docShouldHaveTrailingNewline(path) { - return ["entry"].includes(path.getParentNode().kind); -} - -function lineShouldEndWithSemicolon(path) { - let node = path.getValue(); - while (node.kind === "parenthesis") { - node = node.inner; - } - const parentNode = path.getParentNode(); - if (!parentNode) { - return false; - } - // for single line control structures written in a shortform (ie without a block), - // we need to make sure the single body node gets a semicolon - if ( - ["for", "foreach", "while", "do", "if", "switch"].includes( - parentNode.kind - ) && - node.kind !== "block" && - node.kind !== "if" && - (parentNode.body === node || parentNode.alternate === node) - ) { - return true; - } - if (!nodeHasStatement(parentNode)) { - return false; - } - const semiColonWhitelist = [ - "assign", - "return", - "break", - "continue", - "call", - "pre", - "post", - "bin", - "unary", - "yield", - "yieldfrom", - "echo", - "list", - "print", - "isset", - "retif", - "unset", - "empty", - "traitprecedence", - "traitalias", - "constant", - "classconstant", - "exit", - "global", - "static", - "include", - "goto", - "throw", - "magic", - "new", - "eval", - "propertylookup", - "offsetlookup", - "silent", - "usegroup", - "property", - "string", - "boolean", - "number", - "nowdoc", - "encapsed" - ]; - if (node.kind === "traituse") { - return !node.adaptations; - } - if (node.kind === "method" && node.isAbstract) { - return true; - } - if (node.kind === "method") { - const parent = path.getParentNode(); - if (parent && parent.kind === "interface") { - return true; - } - } - return semiColonWhitelist.includes(node.kind); -} - -function lineShouldHaveEndPHPTag(path) { - return isNextNodeInline(path); -} - -function fileShouldEndWithHardline(path) { - const node = path.getValue(); - const isProgramNode = node.kind === "program"; - const lastNode = node.children && getLast(node.children); - if (!isProgramNode) { - return false; - } - if (lastNode && lastNode.kind === "inline") { - return false; - } - if (lastNode.kind === "declare") { - const lastNestedNode = lastNode.children && getLast(lastNode.children); - if (lastNestedNode && lastNestedNode.kind === "inline") { - return false; - } - } - return true; -} - -function maybeStripLeadingSlashFromUse(name) { - const nameWithoutLeadingSlash = name.replace(/^\\/, ""); - if (nameWithoutLeadingSlash.indexOf("\\") !== -1) { - return nameWithoutLeadingSlash; - } - return name; -} - -function hasDanglingComments(node) { - return ( - node.comments && - node.comments.some(comment => !comment.leading && !comment.trailing) - ); -} - -function hasLeadingComment(node) { - return node.comments && node.comments.some(comment => comment.leading); -} - -function hasTrailingComment(node) { - return node.comments && node.comments.some(comment => comment.trailing); -} - -function isMemberish(node) { - return ( - node.kind === "propertylookup" || - node.kind === "staticlookup" || - node.kind === "offsetlookup" - ); -} - -module.exports = { - printNumber, - stringEscape, - getPrecedence, - shouldFlatten, - nodeHasStatement, - getNodeListProperty, - getParentNodeListProperty, - getNodeIndex, - getLast, - getPenultimate, - isLastStatement, - getBodyFirstChild, - isControlStructureNode, - isFirstNodeInParentProgramNode, - isFirstNodeInParentNode, - isLastNodeInParentNode, - isPrevNodeInline, - isNextNodeInline, - lineShouldHaveStartPHPTag, - lineShouldEndWithSemicolon, - lineShouldHaveEndPHPTag, - fileShouldEndWithHardline, - shouldRemoveLines, - removeNewlines, - maybeStripLeadingSlashFromUse, - hasDanglingComments, - hasLeadingComment, - hasTrailingComment, - docShouldHaveTrailingNewline, - isMemberish -}; diff --git a/src/util.mjs b/src/util.mjs new file mode 100644 index 000000000..b4bf9e473 --- /dev/null +++ b/src/util.mjs @@ -0,0 +1,743 @@ +import { util as prettierUtil } from "prettier"; +import { locStart } from "./loc.mjs"; + +const { hasNewline, skipEverythingButNewLine, skipNewline } = prettierUtil; + +function printNumber(rawNumber) { + return ( + rawNumber + .toLowerCase() + // Remove unnecessary plus and zeroes from scientific notation. + .replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(\d)/, "$1$2$3") + // Remove unnecessary scientific notation (1e0). + .replace(/^([+-]?[\d.]+)e[+-]?0+$/, "$1") + // Make sure numbers always start with a digit. + .replace(/^([+-])?\./, "$10.") + // Remove extraneous trailing decimal zeroes. + .replace(/(\.\d+?)0+(?=e|$)/, "$1") + // Remove unnecessary .e notation + .replace(/\.(?=e)/, "") + ); +} + +// http://php.net/manual/en/language.operators.precedence.php +const PRECEDENCE = new Map( + [ + ["or"], + ["xor"], + ["and"], + [ + "=", + "+=", + "-=", + "*=", + "**=", + "/=", + ".=", + "%=", + "&=", + "|=", + "^=", + "<<=", + ">>=", + ], + ["??"], + ["||"], + ["&&"], + ["|"], + ["^"], + ["&"], + ["==", "===", "!=", "!==", "<>", "<=>"], + ["<", ">", "<=", ">="], + [">>", "<<"], + ["+", "-", "."], + ["*", "/", "%"], + ["!"], + ["instanceof"], + ["++", "--", "~"], + ["**"], + ].flatMap((operators, index) => + operators.map((operator) => [operator, index]) + ) +); +function getPrecedence(operator) { + return PRECEDENCE.get(operator); +} + +const equalityOperators = ["==", "!=", "===", "!==", "<>", "<=>"]; +const multiplicativeOperators = ["*", "/", "%"]; +const bitshiftOperators = [">>", "<<"]; + +function isBitwiseOperator(operator) { + return ( + !!bitshiftOperators[operator] || + operator === "|" || + operator === "^" || + operator === "&" + ); +} + +function shouldFlatten(parentOp, nodeOp) { + if (getPrecedence(nodeOp) !== getPrecedence(parentOp)) { + return false; + } + + // ** is right-associative + // x ** y ** z --> x ** (y ** z) + if (parentOp === "**") { + return false; + } + + // x == y == z --> (x == y) == z + if ( + equalityOperators.includes(parentOp) && + equalityOperators.includes(nodeOp) + ) { + return false; + } + + // x * y % z --> (x * y) % z + if ( + (nodeOp === "%" && multiplicativeOperators.includes(parentOp)) || + (parentOp === "%" && multiplicativeOperators.includes(nodeOp)) + ) { + return false; + } + + // x * y / z --> (x * y) / z + // x / y * z --> (x / y) * z + if ( + nodeOp !== parentOp && + multiplicativeOperators.includes(nodeOp) && + multiplicativeOperators.includes(parentOp) + ) { + return false; + } + + // x << y << z --> (x << y) << z + if ( + bitshiftOperators.includes(parentOp) && + bitshiftOperators.includes(nodeOp) + ) { + return false; + } + + return true; +} + +function nodeHasStatement(node) { + return [ + "block", + "program", + "namespace", + "class", + "enum", + "interface", + "trait", + "traituse", + "declare", + ].includes(node.kind); +} + +function getBodyFirstChild({ body }) { + if (!body) { + return null; + } + if (body.kind === "block") { + body = body.children; + } + return body[0]; +} + +function getNodeListProperty(node) { + const body = node.children || node.body || node.adaptations; + return Array.isArray(body) ? body : null; +} + +function getLast(arr) { + if (arr.length > 0) { + return arr[arr.length - 1]; + } + return null; +} + +function getPenultimate(arr) { + if (arr.length > 1) { + return arr[arr.length - 2]; + } + return null; +} + +function isFirstChildrenInlineNode(path) { + const { node } = path; + + if (node.kind === "program") { + const children = getNodeListProperty(node); + + if (!children || children.length === 0) { + return false; + } + + return children[0].kind === "inline"; + } + + if (node.kind === "switch") { + if (!node.body) { + return false; + } + + const children = getNodeListProperty(node.body); + + if (children.length === 0) { + return false; + } + + const [firstCase] = children; + + if (!firstCase.body) { + return false; + } + + const firstCaseChildren = getNodeListProperty(firstCase.body); + + if (firstCaseChildren.length === 0) { + return false; + } + + return firstCaseChildren[0].kind === "inline"; + } + + const firstChild = getBodyFirstChild(node); + + if (!firstChild) { + return false; + } + + return firstChild.kind === "inline"; +} + +function isDocNode(node) { + return ( + node.kind === "nowdoc" || + (node.kind === "encapsed" && node.type === "heredoc") + ); +} + +/** + * Heredoc/Nowdoc nodes need a trailing linebreak if they + * appear as function arguments or array elements + */ +function docShouldHaveTrailingNewline(path, recurse = 0) { + const node = path.getNode(recurse); + const parent = path.getNode(recurse + 1); + const parentParent = path.getNode(recurse + 2); + + if (!parent) { + return false; + } + + if ( + (parentParent && + ["call", "new", "echo"].includes(parentParent.kind) && + !["call", "array"].includes(parent.kind)) || + parent.kind === "parameter" + ) { + const lastIndex = parentParent.arguments.length - 1; + const index = parentParent.arguments.indexOf(parent); + + return index !== lastIndex; + } + + if (parentParent && parentParent.kind === "for") { + const initIndex = parentParent.init.indexOf(parent); + + if (initIndex !== -1) { + return initIndex !== parentParent.init.length - 1; + } + + const testIndex = parentParent.test.indexOf(parent); + + if (testIndex !== -1) { + return testIndex !== parentParent.test.length - 1; + } + + const incrementIndex = parentParent.increment.indexOf(parent); + + if (incrementIndex !== -1) { + return incrementIndex !== parentParent.increment.length - 1; + } + } + + if (parent.kind === "bin") { + return ( + parent.left === node || docShouldHaveTrailingNewline(path, recurse + 1) + ); + } + + if (parent.kind === "case" && parent.test === node) { + return true; + } + + if (parent.kind === "staticvariable") { + const lastIndex = parentParent.variables.length - 1; + const index = parentParent.variables.indexOf(parent); + + return index !== lastIndex; + } + + if (parent.kind === "entry") { + if (parent.key === node) { + return true; + } + + const lastIndex = parentParent.items.length - 1; + const index = parentParent.items.indexOf(parent); + + return index !== lastIndex; + } + + if (["call", "new"].includes(parent.kind)) { + const lastIndex = parent.arguments.length - 1; + const index = parent.arguments.indexOf(node); + + return index !== lastIndex; + } + + if (parent.kind === "echo") { + const lastIndex = parent.expressions.length - 1; + const index = parent.expressions.indexOf(node); + + return index !== lastIndex; + } + + if (parent.kind === "array") { + const lastIndex = parent.items.length - 1; + const index = parent.items.indexOf(node); + + return index !== lastIndex; + } + + if (parent.kind === "retif") { + return docShouldHaveTrailingNewline(path, recurse + 1); + } + + return false; +} + +function lineShouldEndWithSemicolon(path) { + const { node, parent: parentNode } = path; + if (!parentNode) { + return false; + } + // for single line control structures written in a shortform (ie without a block), + // we need to make sure the single body node gets a semicolon + if ( + ["for", "foreach", "while", "do", "if", "switch"].includes( + parentNode.kind + ) && + node.kind !== "block" && + node.kind !== "if" && + (parentNode.body === node || parentNode.alternate === node) + ) { + return true; + } + if (!nodeHasStatement(parentNode)) { + return false; + } + if (node.kind === "echo" && node.shortForm) { + return false; + } + if (node.kind === "traituse") { + return !node.adaptations; + } + if (node.kind === "method" && node.isAbstract) { + return true; + } + if (node.kind === "method") { + const { parent } = path; + if (parent && parent.kind === "interface") { + return true; + } + } + return [ + "expressionstatement", + "do", + "usegroup", + "classconstant", + "propertystatement", + "traitprecedence", + "traitalias", + "goto", + "constantstatement", + "enumcase", + "global", + "static", + "echo", + "unset", + "return", + "break", + "continue", + "throw", + ].includes(node.kind); +} + +function fileShouldEndWithHardline(path) { + const { node } = path; + const isProgramNode = node.kind === "program"; + const lastNode = node.children && getLast(node.children); + + if (!isProgramNode) { + return false; + } + + if (lastNode && ["halt", "inline"].includes(lastNode.kind)) { + return false; + } + + if ( + lastNode && + (lastNode.kind === "declare" || lastNode.kind === "namespace") + ) { + const lastNestedNode = + lastNode.children.length > 0 && getLast(lastNode.children); + + if (lastNestedNode && ["halt", "inline"].includes(lastNestedNode.kind)) { + return false; + } + } + + return true; +} + +function maybeStripLeadingSlashFromUse(name) { + const nameWithoutLeadingSlash = name.replace(/^\\/, ""); + if (nameWithoutLeadingSlash.indexOf("\\") !== -1) { + return nameWithoutLeadingSlash; + } + return name; +} + +function hasDanglingComments(node) { + return ( + node.comments && + node.comments.some((comment) => !comment.leading && !comment.trailing) + ); +} + +function isLookupNode(node) { + return ( + node.kind === "propertylookup" || + node.kind === "nullsafepropertylookup" || + node.kind === "staticlookup" || + node.kind === "offsetlookup" + ); +} + +function shouldPrintHardLineAfterStartInControlStructure(path) { + const { node } = path; + + if (["try", "catch"].includes(node.kind)) { + return false; + } + + return isFirstChildrenInlineNode(path); +} + +function shouldPrintHardLineBeforeEndInControlStructure(path) { + const { node } = path; + + if (["try", "catch"].includes(node.kind)) { + return true; + } + + if (node.kind === "switch") { + const children = getNodeListProperty(node.body); + + if (children.length === 0) { + return true; + } + + const lastCase = getLast(children); + + if (!lastCase.body) { + return true; + } + + const childrenInCase = getNodeListProperty(lastCase.body); + + if (childrenInCase.length === 0) { + return true; + } + + return childrenInCase[0].kind !== "inline"; + } + + return !isFirstChildrenInlineNode(path); +} + +function getAlignment(text) { + const lines = text.split("\n"); + const lastLine = lines.pop(); + + return lastLine.length - lastLine.trimLeft().length + 1; +} + +function isProgramLikeNode(node) { + return ["program", "declare", "namespace"].includes(node.kind); +} + +function isReferenceLikeNode(node) { + return [ + "name", + "parentreference", + "selfreference", + "staticreference", + ].includes(node.kind); +} + +// Return `logical` value for `bin` node containing `||` or `&&` type otherwise return kind of node. +// Require for grouping logical and binary nodes in right way. +function getNodeKindIncludingLogical(node) { + if (node.kind === "bin" && ["||", "&&"].includes(node.type)) { + return "logical"; + } + + return node.kind; +} + +/** + * Check if string can safely be converted from double to single quotes and vice-versa, i.e. + * + * - no embedded variables ("foo $bar") + * - no linebreaks + * - no special characters like \n, \t, ... + * - no octal/hex/unicode characters + * + * See https://php.net/manual/en/language.types.string.php#language.types.string.syntax.double + */ +function useDoubleQuote(node, options) { + if (node.isDoubleQuote === options.singleQuote) { + // We have a double quote and the user passed singleQuote:true, or the other way around. + const rawValue = node.raw.slice(node.raw[0] === "b" ? 2 : 1, -1); + const isComplex = rawValue.match( + /\\([$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3}|u{([0-9a-fA-F]+)})|\r?\n|'|"|\$/ + ); + return node.isDoubleQuote ? isComplex : !isComplex; + } + return node.isDoubleQuote; +} + +function hasEmptyBody(path, name = "body") { + const { node } = path; + + return ( + node[name] && + node[name].children && + node[name].children.length === 0 && + (!node[name].comments || node[name].comments.length === 0) + ); +} + +function isNextLineEmptyAfterNamespace(text, node) { + let idx = locStart(node); + idx = skipEverythingButNewLine(text, idx); + idx = skipNewline(text, idx); + return hasNewline(text, idx); +} + +function shouldPrintHardlineBeforeTrailingComma(lastElem) { + if ( + lastElem.kind === "nowdoc" || + (lastElem.kind === "encapsed" && lastElem.type === "heredoc") + ) { + return true; + } + + if ( + lastElem.kind === "entry" && + (lastElem.value.kind === "nowdoc" || + (lastElem.value.kind === "encapsed" && lastElem.value.type === "heredoc")) + ) { + return true; + } + + return false; +} + +function getAncestorCounter(path, typeOrTypes) { + const types = [].concat(typeOrTypes); + let counter = -1; + let ancestorNode; + while ((ancestorNode = path.getParentNode(++counter))) { + if (types.indexOf(ancestorNode.kind) !== -1) { + return counter; + } + } + return -1; +} + +function getAncestorNode(path, typeOrTypes) { + const counter = getAncestorCounter(path, typeOrTypes); + return counter === -1 ? null : path.getParentNode(counter); +} + +const magicMethods = [ + "__construct", + "__destruct", + "__call", + "__callStatic", + "__get", + "__set", + "__isset", + "__unset", + "__sleep", + "__wakeup", + "__toString", + "__invoke", + "__set_state", + "__clone", + "__debugInfo", +]; +const magicMethodsMap = new Map( + magicMethods.map((name) => [name.toLowerCase(), name]) +); + +function normalizeMagicMethodName(name) { + const loweredName = name.toLowerCase(); + + if (magicMethodsMap.has(loweredName)) { + return magicMethodsMap.get(loweredName); + } + + return name; +} + +/** + * @param {string[]} kindsArray + * @returns {(node: Node | Comment) => Boolean} + */ +function createTypeCheckFunction(kindsArray) { + const kinds = new Set(kindsArray); + return (node) => kinds.has(node?.kind); +} + +const isSingleWordType = createTypeCheckFunction([ + "variadicplaceholder", + "namedargument", + "nullkeyword", + "identifier", + "parameter", + "variable", + "variadic", + "boolean", + "literal", + "number", + "string", + "clone", + "cast", +]); + +const isArrayExpression = createTypeCheckFunction(["array"]); +const isCallLikeExpression = createTypeCheckFunction([ + "nullsafepropertylookup", + "propertylookup", + "staticlookup", + "offsetlookup", + "call", + "new", +]); +const isArrowFuncExpression = createTypeCheckFunction(["arrowfunc"]); + +function getChainParts(node, prev = []) { + const parts = prev; + if (isCallLikeExpression(node)) { + parts.push(node); + } + + if (!node.what) { + return parts; + } + + return getChainParts(node.what, parts); +} + +function isSimpleCallArgument(node, depth = 2) { + if (depth <= 0) { + return false; + } + + const isChildSimple = (child) => isSimpleCallArgument(child, depth - 1); + + if (isSingleWordType(node)) { + return true; + } + + if (isArrayExpression(node)) { + return node.items.every((x) => x === null || isChildSimple(x)); + } + + if (isCallLikeExpression(node)) { + const parts = getChainParts(node); + parts.unshift(); + + return ( + parts.length <= depth && + parts.every((node) => + isLookupNode(node) + ? isChildSimple(node.offset) + : node.arguments.every(isChildSimple) + ) + ); + } + + if (isArrowFuncExpression(node)) { + return ( + node.arguments.length <= depth && node.arguments.every(isChildSimple) + ); + } + + return false; +} + +function memoize(fn) { + const cache = new Map(); + return (key) => { + if (!cache.has(key)) { + cache.set(key, fn(key)); + } + return cache.get(key); + }; +} + +export { + printNumber, + getPrecedence, + isBitwiseOperator, + shouldFlatten, + nodeHasStatement, + getLast, + getPenultimate, + getBodyFirstChild, + lineShouldEndWithSemicolon, + fileShouldEndWithHardline, + maybeStripLeadingSlashFromUse, + hasDanglingComments, + docShouldHaveTrailingNewline, + isLookupNode, + isFirstChildrenInlineNode, + shouldPrintHardLineAfterStartInControlStructure, + shouldPrintHardLineBeforeEndInControlStructure, + getAlignment, + isProgramLikeNode, + isReferenceLikeNode, + getNodeKindIncludingLogical, + useDoubleQuote, + hasEmptyBody, + isNextLineEmptyAfterNamespace, + shouldPrintHardlineBeforeTrailingComma, + isDocNode, + getAncestorNode, + normalizeMagicMethodName, + isSimpleCallArgument, + memoize, +}; diff --git a/tests/array/__snapshots__/jsfmt.spec.js.snap b/tests/array/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 268d94a7b..000000000 --- a/tests/array/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,430 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`arrays.php 1`] = ` - 123, 'two' => $other); -$keyed_test = array('one'=>123,'two'=>$other); -$keyed_test = array ( 'one' => 123 , 'two' => $other ) ; -$keyed_test = array( - 'one' => 123, - 'two' => $other -); -$keyed_test = - array( - 'one' => 123, - 'two' => $other - ); -$keyed_test -= -array -( -'one' -=> -123, -'two' -=> -$other -) -; -$keyed_test - -= - -array - -( - -'one' - -=> - -123, - -'two' - -=> - -$other - -) - -; -$keyed_test = ['one' => 123, 'two' => $other]; -$keyed_test = ['one'=>123,'two'=>$other]; -$keyed_test = [ 'one' => 123 , 'two' => $other ] ; -$keyed_test = [ - 'one' => 123, - 'two' => $other -]; -$keyed_test = - [ - 'one' => 123, - 'two' => $other - ]; -$keyed_test -= -[ -'one' -=> -123, -'two' -=> -$other -] -; -$keyed_test - -= - -[ - -'one' - -=> - -123, - -'two' - -=> - -$other - -] - -; -$short_keyed_test = array('reallyreallyreallyreallylongkey' => 1248, 'otherkey' => 234, 'one more' => $hi); -$short_keyed_test = ['reallyreallyreallyreallylongkey' => 1248, 'otherkey' => 234, 'one more' => $hi]; -$foo = $bar[1][2][3][4][5][6]; -$foo = $bar [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] ; -$foo = $bar [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] ; -$foo = $bar -[ -1 -] -[ -2 -] -[ -3 -] -[ -4 -] -[ -5 -] -[ -6 -] -; -$foo = $bar - -[ - -1 - -] - -[ - -2 - -] - -[ - -3 - -] - -[ - -4 - -] - -[ - -5 - -] - -[ - -6 - -] - -; -$array = array( - 1 => "a", - "1" => "b", - 1.5 => "c", - true => "d", -); -$array = array( - "a", - "b", - 6 => "c", - "d", -); -$array = array( - "foo" => "bar", - 42 => 24, - "multi" => array( - "dimensional" => array( - "array" => "foo" - ) - ) -); -$secondElement = getArray()[1]; -$arr[] = 56; -$arr[ ] = 56; -$arr[ ] = 56; -$arr -[ -] -= -56 -; -$arr - -[ - -] - -= - -56 - -; -echo $arr[somefunc($bar)]; -echo $arr [ somefunc ( $bar ) ] ; -echo $arr [ somefunc ( $bar ) ] ; -echo -$arr -[ -somefunc -( -$bar -) -] -; -echo - -$arr - -[ - -somefunc - -( - -$bar - -) - -] - -; -$a = array_fill_keys(array('foo', 5, 10, 'bar'), 'banana'); -$a = array_fill_keys(array('foo',5,10,'bar'),'banana'); -$a = array_fill_keys(['foo', 5, 10, 'bar'], 'banana') ; -$a = array_fill_keys( [ 'foo' , 5 , 10 , 'bar' ] , 'banana' ) ; -$secondElement = getArray()[1]; -unset($arr[5]); -$arr["x"] = 42; -echo $arr[somefunc($bar)]; -$test = $array[foo]; - -$this->long->expression->before->array->statesArray[ - $state->getCirculationStateId() -] = $state->getName(); -$arr[ ] = 1; -$arr{"x"} = 42; -[ $a, $b ] = [ 1, 2 ]; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 123, 'two' => $other); -$keyed_test = array('one' => 123, 'two' => $other); -$keyed_test = array('one' => 123, 'two' => $other); -$keyed_test = array('one' => 123, 'two' => $other); -$keyed_test = array('one' => 123, 'two' => $other); -$keyed_test = array('one' => 123, 'two' => $other); -$keyed_test = array('one' => 123, 'two' => $other); - -$keyed_test = ['one' => 123, 'two' => $other]; -$keyed_test = ['one' => 123, 'two' => $other]; -$keyed_test = ['one' => 123, 'two' => $other]; -$keyed_test = ['one' => 123, 'two' => $other]; -$keyed_test = ['one' => 123, 'two' => $other]; -$keyed_test = ['one' => 123, 'two' => $other]; -$keyed_test = ['one' => 123, 'two' => $other]; - -$short_keyed_test = array( - 'reallyreallyreallyreallylongkey' => 1248, - 'otherkey' => 234, - 'one more' => $hi -); -$short_keyed_test = [ - 'reallyreallyreallyreallylongkey' => 1248, - 'otherkey' => 234, - 'one more' => $hi -]; -$foo = $bar[1][2][3][4][5][6]; -$foo = $bar[1][2][3][4][5][6]; -$foo = $bar[1][2][3][4][5][6]; -$foo = $bar[1][2][3][4][5][6]; -$foo = $bar[1][2][3][4][5][6]; - -$array = array(1 => "a", "1" => "b", 1.5 => "c", true => "d"); -$array = array("a", "b", 6 => "c", "d"); -$array = array( - "foo" => "bar", - 42 => 24, - "multi" => array("dimensional" => array("array" => "foo")) -); -$secondElement = getArray()[1]; -$arr[] = 56; -$arr[] = 56; -$arr[] = 56; -$arr[] = 56; -$arr[] = 56; - -echo $arr[somefunc($bar)]; -echo $arr[somefunc($bar)]; -echo $arr[somefunc($bar)]; -echo $arr[somefunc($bar)]; -echo $arr[somefunc($bar)]; -$a = array_fill_keys(array('foo', 5, 10, 'bar'), 'banana'); -$a = array_fill_keys(array('foo', 5, 10, 'bar'), 'banana'); -$a = array_fill_keys(['foo', 5, 10, 'bar'], 'banana'); -$a = array_fill_keys(['foo', 5, 10, 'bar'], 'banana'); -$secondElement = getArray()[1]; -unset($arr[5]); -$arr["x"] = 42; -echo $arr[somefunc($bar)]; -$test = $array[foo]; - -$this->long->expression->before->array->statesArray[ - $state->getCirculationStateId() -] = $state->getName(); -$arr[] = 1; -$arr["x"] = 42; -[$a, $b] = [1, 2]; - -`; diff --git a/tests/array/__snapshots__/jsfmt.spec.mjs.snap b/tests/array/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..e5a1aa0c1 --- /dev/null +++ b/tests/array/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,1802 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`arrays.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 123, 'two' => $other); +$keyed_test = array('one'=>123,'two'=>$other); +$keyed_test = array ( 'one' => 123 , 'two' => $other ) ; +$keyed_test = array( + 'one' => 123, + 'two' => $other +); +$keyed_test = + array( + 'one' => 123, + 'two' => $other + ); +$keyed_test += +array +( +'one' +=> +123, +'two' +=> +$other +) +; +$keyed_test + += + +array + +( + +'one' + +=> + +123, + +'two' + +=> + +$other + +) + +; +$keyed_test = ['one' => 123, 'two' => $other]; +$keyed_test = ['one'=>123,'two'=>$other]; +$keyed_test = [ 'one' => 123 , 'two' => $other ] ; +$keyed_test = [ + 'one' => 123, + 'two' => $other +]; +$keyed_test = + [ + 'one' => 123, + 'two' => $other + ]; +$keyed_test += +[ +'one' +=> +123, +'two' +=> +$other +] +; +$keyed_test + += + +[ + +'one' + +=> + +123, + +'two' + +=> + +$other + +] + +; +$short_keyed_test = array('reallyreallyreallyreallylongkey' => 1248, 'otherkey' => 234, 'one more' => $hi); +$short_keyed_test = ['reallyreallyreallyreallylongkey' => 1248, 'otherkey' => 234, 'one more' => $hi]; +$foo = $bar[1][2][3][4][5][6]; +$foo = $bar [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] ; +$foo = $bar [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] ; +$foo = $bar +[ +1 +] +[ +2 +] +[ +3 +] +[ +4 +] +[ +5 +] +[ +6 +] +; +$foo = $bar + +[ + +1 + +] + +[ + +2 + +] + +[ + +3 + +] + +[ + +4 + +] + +[ + +5 + +] + +[ + +6 + +] + +; +$array = array( + 1 => "a", + "1" => "b", + 1.5 => "c", + true => "d", +); +$array = array( + "a", + "b", + 6 => "c", + "d", +); +$array = array( + "foo" => "bar", + 42 => 24, + "multi" => array( + "dimensional" => array( + "array" => "foo" + ) + ) +); +$secondElement = getArray()[1]; +$arr[] = 56; +$arr[ ] = 56; +$arr[ ] = 56; +$arr +[ +] += +56 +; +$arr + +[ + +] + += + +56 + +; +echo $arr[somefunc($bar)]; +echo $arr [ somefunc ( $bar ) ] ; +echo $arr [ somefunc ( $bar ) ] ; +echo +$arr +[ +somefunc +( +$bar +) +] +; +echo + +$arr + +[ + +somefunc + +( + +$bar + +) + +] + +; +$a = array_fill_keys(array('foo', 5, 10, 'bar'), 'banana'); +$a = array_fill_keys(array('foo',5,10,'bar'),'banana'); +$a = array_fill_keys(['foo', 5, 10, 'bar'], 'banana') ; +$a = array_fill_keys( [ 'foo' , 5 , 10 , 'bar' ] , 'banana' ) ; +$secondElement = getArray()[1]; +unset($arr[5]); +$arr["x"] = 42; +echo $arr[somefunc($bar)]; +$test = $array[foo]; + +$this->long->expression->before->array->statesArray[ + $state->getCirculationStateId() +] = $state->getName(); +$arr[ ] = 1; +$arr{"x"} = 42; +[ $a, $b ] = [ 1, 2 ]; +$helpers = [ + 'Lazy', + 'Form' => + [ + 'templates' => 'app_form', + 'widgets' => + [ + 'select' => ['App\\View\\Widget\\SelectBoxWidget'], + 'nestingLabel' => ['App\\View\\Widget\\NestingLabelWidget'] + ] + ], + 'MagicMenu.MagicMenu' +]; + +$data = [ + + + 'value', + 'value', + + + // a comment + 'value', + 'value' + + +]; + +$arr = [ + 'niveisFederativos' => + app(NiveisFederativosRepository::class) + ->allOrderBy('nome') + ->pluck('nome', 'id'), + + 'tiposLeis' => + app(TiposLeisRepository::class) + ->allOrderBy('nome') + ->pluck('nome', 'id') +]; +[[$id1, $name1]] = $data; +[[$id1], [$id2], [$id]] = $data; +[[$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongOtherValue]] = $data; +["id" => $id1, "name" => $name1] = $data; +[["id" => $id1, "name" => $name1]] = $data; +[["veryVeryVeryVeryLongKey" => $veryVeryVeryVeryLongValue, "veryVeryVeryVeryLongOtherKey" => $veryVeryVeryVeryLongValue]] = $data; +$arr = [ + 'niveisFederativos' => + function () { + return "value"; + }, + + 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongKey' => + function () { + return "other-value"; + } +]; + +$singleLine = [ 'do' => [ 'collapse' => 'this' ]]; +$singleLine = array('do' => array('collapse' => 'this')); + +$multiline = [ + 'do' => [ + 'not' => 'collapse' + ] +]; +$multiline = ['do' => 'collapse' +]; +$multiline = array('do' => 'collapse' +); + +$mixed = [ + 'only' => [ 'partly' => 'collapsed' ] +]; +$mixed = [ 'only' => [ + 'partly' => ['coll', 'apsed'] +]]; + +$arr = array($var +); +$arr = array( +$var); +$arr = [$var +]; +$arr = [ +$var]; +$arr = [$foo => $bar]; +$arr = [$foo => +$bar]; + +$collapse = [ + "not", + "associative" +]; +$collapse = ["not", "associative" +]; + +$array = [ + 'key-one' => true ? 1 : 2, + 'key-two' => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' ? 1 : 2, + 'key-two' => true ? 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' : 2, + 'key-two' => true ? 1 : 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', + 'key-two' => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . + 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' + ? 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . + 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' + : 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . + 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', +]; + +$array = [ + 'key' => 1, + 'key' => 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111, + 'key' => 'string', + 'key' => __LINE__, + 'key' => "string \${var} {$var}", + 'key' => 'string +string + string', + 'key' => 'string' . 'other-string', + 'key' => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . + 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', +]; + +$array = [ +'string +string +string' +]; + +$array = [ +'string +string +string', +'string +string +string' +]; + +$array = [ + 'key' => 'string +string +string', + 'other-key' => 'string +string +string' +]; + +$array = [ + 'string +string +string' => 'value', + 'string +string +string +other' => 'other-value' +]; + +$array = [ + 'string +string +string' => 'string +string +string', + 'string +string +string +other' => 'string +string +string' +]; + +$wp_admin_bar->add_menu(array( + 'id' => 'menu-toggle', + 'title' => + '' . + __('Menu') . + '', + 'href' => '#' +)); + +$k = [ + "blablah" => "aldkfkladfskladklsfkladklfkaldfadfkdaf" + + "adlfasdklfkldsklfakldsfkladsfkadsfladsfa" + + "dflkadfkladsfklkadlfkladlfkadklfjadlfdfdaf" +]; + +$o = [ + "somethingThatsAReallyLongPropName" => + $obj->props->cardType === $AwesomizerCardEnum->SEEFIRST, +]; + +// spread +$var = ['banana', 'orange', ...$parts, 'watermelon']; +$var = [...$arr1]; +$var = [0, ...$arr1]; +$var = array(...$arr1, ...$arr2, 111); +$var = [...$arr1, ...$arr1]; +$var = [...getArr(), 'c']; +$var = [...new ArrayIterator(['a', 'b', 'c'])]; + +=====================================output===================================== + 123, "two" => $other]; +$keyed_test = ["one" => 123, "two" => $other]; +$keyed_test = ["one" => 123, "two" => $other]; +$keyed_test = [ + "one" => 123, + "two" => $other, +]; +$keyed_test = [ + "one" => 123, + "two" => $other, +]; +$keyed_test = [ + "one" => 123, + "two" => $other, +]; +$keyed_test = [ + "one" => 123, + + "two" => $other, +]; +$keyed_test = ["one" => 123, "two" => $other]; +$keyed_test = ["one" => 123, "two" => $other]; +$keyed_test = ["one" => 123, "two" => $other]; +$keyed_test = [ + "one" => 123, + "two" => $other, +]; +$keyed_test = [ + "one" => 123, + "two" => $other, +]; +$keyed_test = [ + "one" => 123, + "two" => $other, +]; +$keyed_test = [ + "one" => 123, + + "two" => $other, +]; +$short_keyed_test = [ + "reallyreallyreallyreallylongkey" => 1248, + "otherkey" => 234, + "one more" => $hi, +]; +$short_keyed_test = [ + "reallyreallyreallyreallylongkey" => 1248, + "otherkey" => 234, + "one more" => $hi, +]; +$foo = $bar[1][2][3][4][5][6]; +$foo = $bar[1][2][3][4][5][6]; +$foo = $bar[1][2][3][4][5][6]; +$foo = $bar[1][2][3][4][5][6]; +$foo = $bar[1][2][3][4][5][6]; +$array = [ + 1 => "a", + "1" => "b", + 1.5 => "c", + true => "d", +]; +$array = ["a", "b", 6 => "c", "d"]; +$array = [ + "foo" => "bar", + 42 => 24, + "multi" => [ + "dimensional" => [ + "array" => "foo", + ], + ], +]; +$secondElement = getArray()[1]; +$arr[] = 56; +$arr[] = 56; +$arr[] = 56; +$arr[] = 56; +$arr[] = 56; +echo $arr[somefunc($bar)]; +echo $arr[somefunc($bar)]; +echo $arr[somefunc($bar)]; +echo $arr[somefunc($bar)]; +echo $arr[somefunc($bar)]; +$a = array_fill_keys(["foo", 5, 10, "bar"], "banana"); +$a = array_fill_keys(["foo", 5, 10, "bar"], "banana"); +$a = array_fill_keys(["foo", 5, 10, "bar"], "banana"); +$a = array_fill_keys(["foo", 5, 10, "bar"], "banana"); +$secondElement = getArray()[1]; +unset($arr[5]); +$arr["x"] = 42; +echo $arr[somefunc($bar)]; +$test = $array[foo]; + +$this->long->expression->before->array->statesArray[ + $state->getCirculationStateId() +] = $state->getName(); +$arr[] = 1; +$arr["x"] = 42; +[$a, $b] = [1, 2]; +$helpers = [ + "Lazy", + "Form" => [ + "templates" => "app_form", + "widgets" => [ + "select" => ["App\\View\\Widget\\SelectBoxWidget"], + "nestingLabel" => ["App\\View\\Widget\\NestingLabelWidget"], + ], + ], + "MagicMenu.MagicMenu", +]; + +$data = [ + "value", + "value", + + // a comment + "value", + "value", +]; + +$arr = [ + "niveisFederativos" => app(NiveisFederativosRepository::class) + ->allOrderBy("nome") + ->pluck("nome", "id"), + + "tiposLeis" => app(TiposLeisRepository::class) + ->allOrderBy("nome") + ->pluck("nome", "id"), +]; +[[$id1, $name1]] = $data; +[[$id1], [$id2], [$id]] = $data; +[ + [ + $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, + $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongOtherValue, + ], +] = $data; +["id" => $id1, "name" => $name1] = $data; +[["id" => $id1, "name" => $name1]] = $data; +[ + [ + "veryVeryVeryVeryLongKey" => $veryVeryVeryVeryLongValue, + "veryVeryVeryVeryLongOtherKey" => $veryVeryVeryVeryLongValue, + ], +] = $data; +$arr = [ + "niveisFederativos" => function () { + return "value"; + }, + + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => function () { + return "other-value"; + }, +]; + +$singleLine = ["do" => ["collapse" => "this"]]; +$singleLine = ["do" => ["collapse" => "this"]]; + +$multiline = [ + "do" => [ + "not" => "collapse", + ], +]; +$multiline = ["do" => "collapse"]; +$multiline = ["do" => "collapse"]; + +$mixed = [ + "only" => ["partly" => "collapsed"], +]; +$mixed = [ + "only" => [ + "partly" => ["coll", "apsed"], + ], +]; + +$arr = [$var]; +$arr = [$var]; +$arr = [$var]; +$arr = [$var]; +$arr = [$foo => $bar]; +$arr = [$foo => $bar]; + +$collapse = ["not", "associative"]; +$collapse = ["not", "associative"]; + +$array = [ + "key-one" => true ? 1 : 2, + "key-two" => "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + ? 1 + : 2, + "key-two" => true + ? "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + : 2, + "key-two" => true + ? 1 + : "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString", + "key-two" => + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + ? "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + : "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString", +]; + +$array = [ + "key" => 1, + "key" => 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111, + "key" => "string", + "key" => __LINE__, + "key" => "string \${var} {$var}", + "key" => 'string +string + string', + "key" => "string" . "other-string", + "key" => + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString", +]; + +$array = [ + 'string +string +string', +]; + +$array = [ + 'string +string +string', + 'string +string +string', +]; + +$array = [ + "key" => 'string +string +string', + "other-key" => 'string +string +string', +]; + +$array = [ + 'string +string +string' => "value", + 'string +string +string +other' => "other-value", +]; + +$array = [ + 'string +string +string' => 'string +string +string', + 'string +string +string +other' => 'string +string +string', +]; + +$wp_admin_bar->add_menu([ + "id" => "menu-toggle", + "title" => + '' . + __("Menu") . + "", + "href" => "#", +]); + +$k = [ + "blablah" => + "aldkfkladfskladklsfkladklfkaldfadfkdaf" + + "adlfasdklfkldsklfakldsfkladsfkadsfladsfa" + + "dflkadfkladsfklkadlfkladlfkadklfjadlfdfdaf", +]; + +$o = [ + "somethingThatsAReallyLongPropName" => + $obj->props->cardType === $AwesomizerCardEnum->SEEFIRST, +]; + +// spread +$var = ["banana", "orange", ...$parts, "watermelon"]; +$var = [...$arr1]; +$var = [0, ...$arr1]; +$var = [...$arr1, ...$arr2, 111]; +$var = [...$arr1, ...$arr1]; +$var = [...getArr(), "c"]; +$var = [...new ArrayIterator(["a", "b", "c"])]; + +================================================================================ +`; + +exports[`arrays.php 2`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "5.3" +printWidth: 80 + | printWidth +=====================================input====================================== + 123, 'two' => $other); +$keyed_test = array('one'=>123,'two'=>$other); +$keyed_test = array ( 'one' => 123 , 'two' => $other ) ; +$keyed_test = array( + 'one' => 123, + 'two' => $other +); +$keyed_test = + array( + 'one' => 123, + 'two' => $other + ); +$keyed_test += +array +( +'one' +=> +123, +'two' +=> +$other +) +; +$keyed_test + += + +array + +( + +'one' + +=> + +123, + +'two' + +=> + +$other + +) + +; +$keyed_test = ['one' => 123, 'two' => $other]; +$keyed_test = ['one'=>123,'two'=>$other]; +$keyed_test = [ 'one' => 123 , 'two' => $other ] ; +$keyed_test = [ + 'one' => 123, + 'two' => $other +]; +$keyed_test = + [ + 'one' => 123, + 'two' => $other + ]; +$keyed_test += +[ +'one' +=> +123, +'two' +=> +$other +] +; +$keyed_test + += + +[ + +'one' + +=> + +123, + +'two' + +=> + +$other + +] + +; +$short_keyed_test = array('reallyreallyreallyreallylongkey' => 1248, 'otherkey' => 234, 'one more' => $hi); +$short_keyed_test = ['reallyreallyreallyreallylongkey' => 1248, 'otherkey' => 234, 'one more' => $hi]; +$foo = $bar[1][2][3][4][5][6]; +$foo = $bar [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] ; +$foo = $bar [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] ; +$foo = $bar +[ +1 +] +[ +2 +] +[ +3 +] +[ +4 +] +[ +5 +] +[ +6 +] +; +$foo = $bar + +[ + +1 + +] + +[ + +2 + +] + +[ + +3 + +] + +[ + +4 + +] + +[ + +5 + +] + +[ + +6 + +] + +; +$array = array( + 1 => "a", + "1" => "b", + 1.5 => "c", + true => "d", +); +$array = array( + "a", + "b", + 6 => "c", + "d", +); +$array = array( + "foo" => "bar", + 42 => 24, + "multi" => array( + "dimensional" => array( + "array" => "foo" + ) + ) +); +$secondElement = getArray()[1]; +$arr[] = 56; +$arr[ ] = 56; +$arr[ ] = 56; +$arr +[ +] += +56 +; +$arr + +[ + +] + += + +56 + +; +echo $arr[somefunc($bar)]; +echo $arr [ somefunc ( $bar ) ] ; +echo $arr [ somefunc ( $bar ) ] ; +echo +$arr +[ +somefunc +( +$bar +) +] +; +echo + +$arr + +[ + +somefunc + +( + +$bar + +) + +] + +; +$a = array_fill_keys(array('foo', 5, 10, 'bar'), 'banana'); +$a = array_fill_keys(array('foo',5,10,'bar'),'banana'); +$a = array_fill_keys(['foo', 5, 10, 'bar'], 'banana') ; +$a = array_fill_keys( [ 'foo' , 5 , 10 , 'bar' ] , 'banana' ) ; +$secondElement = getArray()[1]; +unset($arr[5]); +$arr["x"] = 42; +echo $arr[somefunc($bar)]; +$test = $array[foo]; + +$this->long->expression->before->array->statesArray[ + $state->getCirculationStateId() +] = $state->getName(); +$arr[ ] = 1; +$arr{"x"} = 42; +[ $a, $b ] = [ 1, 2 ]; +$helpers = [ + 'Lazy', + 'Form' => + [ + 'templates' => 'app_form', + 'widgets' => + [ + 'select' => ['App\\View\\Widget\\SelectBoxWidget'], + 'nestingLabel' => ['App\\View\\Widget\\NestingLabelWidget'] + ] + ], + 'MagicMenu.MagicMenu' +]; + +$data = [ + + + 'value', + 'value', + + + // a comment + 'value', + 'value' + + +]; + +$arr = [ + 'niveisFederativos' => + app(NiveisFederativosRepository::class) + ->allOrderBy('nome') + ->pluck('nome', 'id'), + + 'tiposLeis' => + app(TiposLeisRepository::class) + ->allOrderBy('nome') + ->pluck('nome', 'id') +]; +[[$id1, $name1]] = $data; +[[$id1], [$id2], [$id]] = $data; +[[$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongOtherValue]] = $data; +["id" => $id1, "name" => $name1] = $data; +[["id" => $id1, "name" => $name1]] = $data; +[["veryVeryVeryVeryLongKey" => $veryVeryVeryVeryLongValue, "veryVeryVeryVeryLongOtherKey" => $veryVeryVeryVeryLongValue]] = $data; +$arr = [ + 'niveisFederativos' => + function () { + return "value"; + }, + + 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongKey' => + function () { + return "other-value"; + } +]; + +$singleLine = [ 'do' => [ 'collapse' => 'this' ]]; +$singleLine = array('do' => array('collapse' => 'this')); + +$multiline = [ + 'do' => [ + 'not' => 'collapse' + ] +]; +$multiline = ['do' => 'collapse' +]; +$multiline = array('do' => 'collapse' +); + +$mixed = [ + 'only' => [ 'partly' => 'collapsed' ] +]; +$mixed = [ 'only' => [ + 'partly' => ['coll', 'apsed'] +]]; + +$arr = array($var +); +$arr = array( +$var); +$arr = [$var +]; +$arr = [ +$var]; +$arr = [$foo => $bar]; +$arr = [$foo => +$bar]; + +$collapse = [ + "not", + "associative" +]; +$collapse = ["not", "associative" +]; + +$array = [ + 'key-one' => true ? 1 : 2, + 'key-two' => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' ? 1 : 2, + 'key-two' => true ? 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' : 2, + 'key-two' => true ? 1 : 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', + 'key-two' => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . + 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' + ? 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . + 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' + : 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . + 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', +]; + +$array = [ + 'key' => 1, + 'key' => 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111, + 'key' => 'string', + 'key' => __LINE__, + 'key' => "string \${var} {$var}", + 'key' => 'string +string + string', + 'key' => 'string' . 'other-string', + 'key' => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . + 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', +]; + +$array = [ +'string +string +string' +]; + +$array = [ +'string +string +string', +'string +string +string' +]; + +$array = [ + 'key' => 'string +string +string', + 'other-key' => 'string +string +string' +]; + +$array = [ + 'string +string +string' => 'value', + 'string +string +string +other' => 'other-value' +]; + +$array = [ + 'string +string +string' => 'string +string +string', + 'string +string +string +other' => 'string +string +string' +]; + +$wp_admin_bar->add_menu(array( + 'id' => 'menu-toggle', + 'title' => + '' . + __('Menu') . + '', + 'href' => '#' +)); + +$k = [ + "blablah" => "aldkfkladfskladklsfkladklfkaldfadfkdaf" + + "adlfasdklfkldsklfakldsfkladsfkadsfladsfa" + + "dflkadfkladsfklkadlfkladlfkadklfjadlfdfdaf" +]; + +$o = [ + "somethingThatsAReallyLongPropName" => + $obj->props->cardType === $AwesomizerCardEnum->SEEFIRST, +]; + +// spread +$var = ['banana', 'orange', ...$parts, 'watermelon']; +$var = [...$arr1]; +$var = [0, ...$arr1]; +$var = array(...$arr1, ...$arr2, 111); +$var = [...$arr1, ...$arr1]; +$var = [...getArr(), 'c']; +$var = [...new ArrayIterator(['a', 'b', 'c'])]; + +=====================================output===================================== + 123, "two" => $other); +$keyed_test = array("one" => 123, "two" => $other); +$keyed_test = array("one" => 123, "two" => $other); +$keyed_test = array( + "one" => 123, + "two" => $other, +); +$keyed_test = array( + "one" => 123, + "two" => $other, +); +$keyed_test = array( + "one" => 123, + "two" => $other, +); +$keyed_test = array( + "one" => 123, + + "two" => $other, +); +$keyed_test = array("one" => 123, "two" => $other); +$keyed_test = array("one" => 123, "two" => $other); +$keyed_test = array("one" => 123, "two" => $other); +$keyed_test = array( + "one" => 123, + "two" => $other, +); +$keyed_test = array( + "one" => 123, + "two" => $other, +); +$keyed_test = array( + "one" => 123, + "two" => $other, +); +$keyed_test = array( + "one" => 123, + + "two" => $other, +); +$short_keyed_test = array( + "reallyreallyreallyreallylongkey" => 1248, + "otherkey" => 234, + "one more" => $hi, +); +$short_keyed_test = array( + "reallyreallyreallyreallylongkey" => 1248, + "otherkey" => 234, + "one more" => $hi, +); +$foo = $bar[1][2][3][4][5][6]; +$foo = $bar[1][2][3][4][5][6]; +$foo = $bar[1][2][3][4][5][6]; +$foo = $bar[1][2][3][4][5][6]; +$foo = $bar[1][2][3][4][5][6]; +$array = array( + 1 => "a", + "1" => "b", + 1.5 => "c", + true => "d", +); +$array = array("a", "b", 6 => "c", "d"); +$array = array( + "foo" => "bar", + 42 => 24, + "multi" => array( + "dimensional" => array( + "array" => "foo", + ), + ), +); +$secondElement = getArray()[1]; +$arr[] = 56; +$arr[] = 56; +$arr[] = 56; +$arr[] = 56; +$arr[] = 56; +echo $arr[somefunc($bar)]; +echo $arr[somefunc($bar)]; +echo $arr[somefunc($bar)]; +echo $arr[somefunc($bar)]; +echo $arr[somefunc($bar)]; +$a = array_fill_keys(array("foo", 5, 10, "bar"), "banana"); +$a = array_fill_keys(array("foo", 5, 10, "bar"), "banana"); +$a = array_fill_keys(array("foo", 5, 10, "bar"), "banana"); +$a = array_fill_keys(array("foo", 5, 10, "bar"), "banana"); +$secondElement = getArray()[1]; +unset($arr[5]); +$arr["x"] = 42; +echo $arr[somefunc($bar)]; +$test = $array[foo]; + +$this->long->expression->before->array->statesArray[ + $state->getCirculationStateId() +] = $state->getName(); +$arr[] = 1; +$arr["x"] = 42; +[$a, $b] = array(1, 2); +$helpers = array( + "Lazy", + "Form" => array( + "templates" => "app_form", + "widgets" => array( + "select" => array("App\\View\\Widget\\SelectBoxWidget"), + "nestingLabel" => array("App\\View\\Widget\\NestingLabelWidget"), + ), + ), + "MagicMenu.MagicMenu", +); + +$data = array( + "value", + "value", + + // a comment + "value", + "value", +); + +$arr = array( + "niveisFederativos" => app(NiveisFederativosRepository::class) + ->allOrderBy("nome") + ->pluck("nome", "id"), + + "tiposLeis" => app(TiposLeisRepository::class) + ->allOrderBy("nome") + ->pluck("nome", "id"), +); +[[$id1, $name1]] = $data; +[[$id1], [$id2], [$id]] = $data; +[ + [ + $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, + $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongOtherValue, + ], +] = $data; +["id" => $id1, "name" => $name1] = $data; +[["id" => $id1, "name" => $name1]] = $data; +[ + [ + "veryVeryVeryVeryLongKey" => $veryVeryVeryVeryLongValue, + "veryVeryVeryVeryLongOtherKey" => $veryVeryVeryVeryLongValue, + ], +] = $data; +$arr = array( + "niveisFederativos" => function () { + return "value"; + }, + + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => function () { + return "other-value"; + }, +); + +$singleLine = array("do" => array("collapse" => "this")); +$singleLine = array("do" => array("collapse" => "this")); + +$multiline = array( + "do" => array( + "not" => "collapse", + ), +); +$multiline = array("do" => "collapse"); +$multiline = array("do" => "collapse"); + +$mixed = array( + "only" => array("partly" => "collapsed"), +); +$mixed = array( + "only" => array( + "partly" => array("coll", "apsed"), + ), +); + +$arr = array($var); +$arr = array($var); +$arr = array($var); +$arr = array($var); +$arr = array($foo => $bar); +$arr = array($foo => $bar); + +$collapse = array("not", "associative"); +$collapse = array("not", "associative"); + +$array = array( + "key-one" => true ? 1 : 2, + "key-two" => "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + ? 1 + : 2, + "key-two" => true + ? "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + : 2, + "key-two" => true + ? 1 + : "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString", + "key-two" => + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + ? "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + : "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString", +); + +$array = array( + "key" => 1, + "key" => 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111, + "key" => "string", + "key" => __LINE__, + "key" => "string \${var} {$var}", + "key" => 'string +string + string', + "key" => "string" . "other-string", + "key" => + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString", +); + +$array = array( + 'string +string +string', +); + +$array = array( + 'string +string +string', + 'string +string +string', +); + +$array = array( + "key" => 'string +string +string', + "other-key" => 'string +string +string', +); + +$array = array( + 'string +string +string' => "value", + 'string +string +string +other' => "other-value", +); + +$array = array( + 'string +string +string' => 'string +string +string', + 'string +string +string +other' => 'string +string +string', +); + +$wp_admin_bar->add_menu(array( + "id" => "menu-toggle", + "title" => + '' . + __("Menu") . + "", + "href" => "#", +)); + +$k = array( + "blablah" => + "aldkfkladfskladklsfkladklfkaldfadfkdaf" + + "adlfasdklfkldsklfakldsfkladsfkadsfladsfa" + + "dflkadfkladsfklkadlfkladlfkadklfjadlfdfdaf", +); + +$o = array( + "somethingThatsAReallyLongPropName" => + $obj->props->cardType === $AwesomizerCardEnum->SEEFIRST, +); + +// spread +$var = array("banana", "orange", ...$parts, "watermelon"); +$var = array(...$arr1); +$var = array(0, ...$arr1); +$var = array(...$arr1, ...$arr2, 111); +$var = array(...$arr1, ...$arr1); +$var = array(...getArr(), "c"); +$var = array(...new ArrayIterator(array("a", "b", "c"))); + +================================================================================ +`; + +exports[`single.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + [ + 'templates' => 'app_form', + 'widgets' => + [ + 'select' => ['App\View\Widget\SelectBoxWidget'], + 'nestingLabel' => ['App\View\Widget\NestingLabelWidget'] + ] + ], + 'MagicMenu.MagicMenu' +]; + +$data = [ + + + 'value', + 'value', + + + // a comment + 'value', + 'value' + + +]; + +$arr = [ + 'niveisFederativos' => + app(NiveisFederativosRepository::class) + ->allOrderBy('nome') + ->pluck('nome', 'id'), + + 'tiposLeis' => + app(TiposLeisRepository::class) + ->allOrderBy('nome') + ->pluck('nome', 'id') +]; +[[$id1, $name1]] = $data; +[[$id1], [$id2], [$id]] = $data; +[[$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongOtherValue]] = $data; +["id" => $id1, "name" => $name1] = $data; +[["id" => $id1, "name" => $name1]] = $data; +[["veryVeryVeryVeryLongKey" => $veryVeryVeryVeryLongValue, "veryVeryVeryVeryLongOtherKey" => $veryVeryVeryVeryLongValue]] = $data; +$arr = [ + 'niveisFederativos' => + function () { + return "value"; + }, + + 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongKey' => + function () { + return "other-value"; + } +]; + +$singleLine = [ 'do' => [ 'collapse' => 'this' ]]; +$singleLine = array('do' => array('collapse' => 'this')); + +$multiline = [ + 'do' => [ + 'not' => 'collapse' + ] +]; +$multiline = ['do' => 'collapse' +]; +$multiline = array('do' => 'collapse' +); + +$mixed = [ + 'only' => [ 'partly' => 'collapsed' ] +]; +$mixed = [ 'only' => [ + 'partly' => ['coll', 'apsed'] +]]; + +$arr = array($var +); +$arr = array( +$var); +$arr = [$var +]; +$arr = [ +$var]; +$arr = [$foo => $bar]; +$arr = [$foo => +$bar]; + +$collapse = [ + "not", + "associative" +]; +$collapse = ["not", "associative" +]; + +$array = [ + 'key-one' => true ? 1 : 2, + 'key-two' => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' ? 1 : 2, + 'key-two' => true ? 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' : 2, + 'key-two' => true ? 1 : 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', + 'key-two' => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . + 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' + ? 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . + 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' + : 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . + 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', +]; + +$array = [ + 'key' => 1, + 'key' => 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111, + 'key' => 'string', + 'key' => __LINE__, + 'key' => "string ${var} {$var}", + 'key' => 'string +string + string', + 'key' => 'string' . 'other-string', + 'key' => 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . + 'VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString', +]; + +$array = [ +'string +string +string' +]; + +$array = [ +'string +string +string', +'string +string +string' +]; + +$array = [ + 'key' => 'string +string +string', + 'other-key' => 'string +string +string' +]; + +$array = [ + 'string +string +string' => 'value', + 'string +string +string +other' => 'other-value' +]; + +$array = [ + 'string +string +string' => 'string +string +string', + 'string +string +string +other' => 'string +string +string' +]; + +$wp_admin_bar->add_menu(array( + 'id' => 'menu-toggle', + 'title' => + '' . + __('Menu') . + '', + 'href' => '#' +)); + +$k = [ + "blablah" => "aldkfkladfskladklsfkladklfkaldfadfkdaf" + + "adlfasdklfkldsklfakldsfkladsfkadsfladsfa" + + "dflkadfkladsfklkadlfkladlfkadklfjadlfdfdaf" +]; + +$o = [ + "somethingThatsAReallyLongPropName" => + $obj->props->cardType === $AwesomizerCardEnum->SEEFIRST, +]; + +// spread +$var = ['banana', 'orange', ...$parts, 'watermelon']; +$var = [...$arr1]; +$var = [0, ...$arr1]; +$var = array(...$arr1, ...$arr2, 111); +$var = [...$arr1, ...$arr1]; +$var = [...getArr(), 'c']; +$var = [...new ArrayIterator(['a', 'b', 'c'])]; diff --git a/tests/array/jsfmt.spec.js b/tests/array/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/array/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/array/jsfmt.spec.mjs b/tests/array/jsfmt.spec.mjs new file mode 100644 index 000000000..d43490aab --- /dev/null +++ b/tests/array/jsfmt.spec.mjs @@ -0,0 +1,2 @@ +run_spec(import.meta, ["php"]); +run_spec(import.meta, ["php"], { phpVersion: "5.3" }); diff --git a/tests/array/single-short.php b/tests/array/single-short.php new file mode 100644 index 000000000..f292d14ca --- /dev/null +++ b/tests/array/single-short.php @@ -0,0 +1,3 @@ + "something"; +$var = fn($arg) => "something"; +$var = fn(&$arg) => "something"; +$var = fn($arg, $arg, $arg) => "something"; +$var = fn($arg, $arg, $arg): string => "something"; +$var = fn($arg, $arg, $arg): ?string => "something"; +$var = static fn($arg, $arg, $arg) => "something"; +// $var = fn(): ?string => "something"; + +call(fn($arg) => $arg); + +=====================================output===================================== + "something"; +$var = fn($arg) => "something"; +$var = fn(&$arg) => "something"; +$var = fn($arg, $arg, $arg) => "something"; +$var = fn($arg, $arg, $arg): string => "something"; +$var = fn($arg, $arg, $arg): ?string => "something"; +$var = static fn($arg, $arg, $arg) => "something"; +// $var = fn(): ?string => "something"; + +call(fn($arg) => $arg); + +================================================================================ +`; diff --git a/tests/arrowfunc/arrowfunc.php b/tests/arrowfunc/arrowfunc.php new file mode 100644 index 000000000..4a0250631 --- /dev/null +++ b/tests/arrowfunc/arrowfunc.php @@ -0,0 +1,11 @@ + "something"; +$var = fn($arg) => "something"; +$var = fn(&$arg) => "something"; +$var = fn($arg, $arg, $arg) => "something"; +$var = fn($arg, $arg, $arg): string => "something"; +$var = fn($arg, $arg, $arg): ?string => "something"; +$var = static fn($arg, $arg, $arg) => "something"; +// $var = fn(): ?string => "something"; + +call(fn($arg) => $arg); diff --git a/tests/arrowfunc/jsfmt.spec.mjs b/tests/arrowfunc/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/arrowfunc/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/assign/__snapshots__/jsfmt.spec.mjs.snap b/tests/assign/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..78d9bd542 --- /dev/null +++ b/tests/assign/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,294 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`assign.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 'value']; +$var = [ + 'key' => 'value' +]; +$var = [ + 'key' => 'value', + 'oneKey' => 'value', + 'twoKey' => 'value', + 'threeKey' => 'value', + 'fourKey' => 'value', + 'fiveKey' => 'value', + 'sixKey' => 'value' +]; +$var = $veryVeryVeryVeryVeryVeryVeryLongVariable ? $veryVeryVeryVeryVeryVeryVeryLongTrueExpr : $veryVeryVeryVeryVeryVeryVeryLongFalseExpr; +$var = $var . 'string' ? $trueExpr : $falseExpr; +$var = $var . 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . $otherVar ? $trueExpr : $falseExpr; +$var = $var . 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . $otherVar === $veryVeryVeryVeryVeryVeryVeryLongVariable ? $trueExpr : $falseExpr; +$var = VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_CONSTANT; +$var = $arr['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString']; +$var = $arr['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString']; +$variable['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString'] = $variable->registered[1]; + +$computedDescriptionLines = ($showConfirm && + $descriptionLinesConfirming) || + ($focused && !$loading && $descriptionLinesFocused) || + $descriptionLines; + +$computedDescriptionLines = ($focused && + !$loading && + $descriptionLinesFocused) || + $descriptionLines; + +[$bottom, $left, $right, $top] = $arr; +[$oneVeryVeryVeryVeryVeryVeryVeryLongVariable, $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, $fourVeryVeryVeryVeryVeryVeryVeryLongVariable] = $arr; +[$oneVeryVeryVeryVeryVeryVeryVeryLongVariable, $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, $fourVeryVeryVeryVeryVeryVeryVeryLongVariable] = $test ? $trueExpr : $falseExpr; +[$oneVeryVeryVeryVeryVeryVeryVeryLongVariable, $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, $fourVeryVeryVeryVeryVeryVeryVeryLongVariable] = $veryVeryVeryVeryVeryVeryVeryLongVariable ? $veryVeryVeryVeryVeryVeryVeryLongVariable : $veryVeryVeryVeryVeryVeryVeryLongVariable; +[$oneVeryVeryVeryVeryVeryVeryVeryLongVariable, $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, $fourVeryVeryVeryVeryVeryVeryVeryLongVariable] = $test . 'string' ? $trueExpr : $falseExpr; +[$oneVeryVeryVeryVeryVeryVeryVeryLongVariable, $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, $fourVeryVeryVeryVeryVeryVeryVeryLongVariable] = $arr || []; +[$oneVeryVeryVeryVeryVeryVeryVeryLongVariable, $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, $fourVeryVeryVeryVeryVeryVeryVeryLongVariable] = $arr || [ + 'key' => 'value', + 'otherKey' => 'otherValue' +]; + +for (($i = 0), ($len = $arr->length); $i < $len; $i++) { + call($arr[$i]); +} + +for ($i = 0, $len = $arr->length; $i < $len; $i++) { + call($arr[$i]); +} + +$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable = $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable; + +$obj->property = $obj->oneProperty = $obj->twoPeroperty = 0; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = 0; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = (new MyClass())->call($arg); +$obj->loooooooooooong->lookup = $this->getRequest()->getParam('instance-resource-id'); +$obj->loooooooooooong->lookup = (int) $this->getRequest()->getParam('instance-resource-id'); + +$component = $var->insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = $var->insertReallyReallyReally{$ReallyReallyReallyReallyReallyLongName}; +$component = Foo::$insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = $a::$insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = (new Foo())->insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = (clone $a)->insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; + +$component = $var->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = $var->insertReallyReallyReallyReallyReallyReallyReallyReallyReally{$ReallyReallyReallyReallyReallyReallyLongName}; +$component = Foo::$insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = $a::$insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = (new Foo())->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = (clone $a)->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; + +$component = $var->insertReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$component = Foo::$insertReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$component = $var->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$component = Foo::$insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; + +$blablah = + "aldkfkladfskladklsfkladklfkaldfadfkdaf" . + "adlfasdklfkldsklfakldsfkladsfkadsfladsfa" . + "dflkadfkladsfklkadlfkladlfkadklfjadlfdfdaf"; + +$somethingThatsAReallyLongPropName = + $obj->props->cardType === $AwesomizerCardEnum->SEEFIRST; + +=====================================output===================================== + "value"]; +$var = [ + "key" => "value", +]; +$var = [ + "key" => "value", + "oneKey" => "value", + "twoKey" => "value", + "threeKey" => "value", + "fourKey" => "value", + "fiveKey" => "value", + "sixKey" => "value", +]; +$var = $veryVeryVeryVeryVeryVeryVeryLongVariable + ? $veryVeryVeryVeryVeryVeryVeryLongTrueExpr + : $veryVeryVeryVeryVeryVeryVeryLongFalseExpr; +$var = $var . "string" ? $trueExpr : $falseExpr; +$var = + $var . + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + $otherVar + ? $trueExpr + : $falseExpr; +$var = + $var . + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" . + $otherVar === + $veryVeryVeryVeryVeryVeryVeryLongVariable + ? $trueExpr + : $falseExpr; +$var = VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_CONSTANT; +$var = + $arr[ + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" + ]; +$var = + $arr["veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"]; +$variable[ + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" +] = $variable->registered[1]; + +$computedDescriptionLines = + ($showConfirm && $descriptionLinesConfirming) || + ($focused && !$loading && $descriptionLinesFocused) || + $descriptionLines; + +$computedDescriptionLines = + ($focused && !$loading && $descriptionLinesFocused) || $descriptionLines; + +[$bottom, $left, $right, $top] = $arr; +[ + $oneVeryVeryVeryVeryVeryVeryVeryLongVariable, + $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, + $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, + $fourVeryVeryVeryVeryVeryVeryVeryLongVariable, +] = $arr; +[ + $oneVeryVeryVeryVeryVeryVeryVeryLongVariable, + $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, + $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, + $fourVeryVeryVeryVeryVeryVeryVeryLongVariable, +] = $test ? $trueExpr : $falseExpr; +[ + $oneVeryVeryVeryVeryVeryVeryVeryLongVariable, + $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, + $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, + $fourVeryVeryVeryVeryVeryVeryVeryLongVariable, +] = $veryVeryVeryVeryVeryVeryVeryLongVariable + ? $veryVeryVeryVeryVeryVeryVeryLongVariable + : $veryVeryVeryVeryVeryVeryVeryLongVariable; +[ + $oneVeryVeryVeryVeryVeryVeryVeryLongVariable, + $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, + $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, + $fourVeryVeryVeryVeryVeryVeryVeryLongVariable, +] = $test . "string" ? $trueExpr : $falseExpr; +[ + $oneVeryVeryVeryVeryVeryVeryVeryLongVariable, + $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, + $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, + $fourVeryVeryVeryVeryVeryVeryVeryLongVariable, +] = $arr || []; +[ + $oneVeryVeryVeryVeryVeryVeryVeryLongVariable, + $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, + $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, + $fourVeryVeryVeryVeryVeryVeryVeryLongVariable, +] = $arr || [ + "key" => "value", + "otherKey" => "otherValue", +]; + +for ($i = 0, $len = $arr->length; $i < $len; $i++) { + call($arr[$i]); +} + +for ($i = 0, $len = $arr->length; $i < $len; $i++) { + call($arr[$i]); +} + +$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable = $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable; + +$obj->property = $obj->oneProperty = $obj->twoPeroperty = 0; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = 0; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = new MyClass()->call( + $arg, +); +$obj->loooooooooooong->lookup = $this->getRequest()->getParam( + "instance-resource-id", +); +$obj->loooooooooooong->lookup = (int) $this->getRequest()->getParam( + "instance-resource-id", +); + +$component = + $var->insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = + $var->insertReallyReallyReally[$ReallyReallyReallyReallyReallyLongName]; +$component = + Foo::$insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = + $a::$insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = new Foo() + ->insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = (clone $a) + ->insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; + +$component = + $var->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = + $var->insertReallyReallyReallyReallyReallyReallyReallyReallyReally[ + $ReallyReallyReallyReallyReallyReallyLongName + ]; +$component = + Foo::$insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = + $a::$insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = new Foo() + ->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = (clone $a) + ->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; + +$component = + $var->insertReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$component = + Foo::$insertReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$component = + $var + ->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$component = + Foo + ::$insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; + +$blablah = + "aldkfkladfskladklsfkladklfkaldfadfkdaf" . + "adlfasdklfkldsklfakldsfkladsfkadsfladsfa" . + "dflkadfkladsfklkadlfkladlfkadklfjadlfdfdaf"; + +$somethingThatsAReallyLongPropName = + $obj->props->cardType === $AwesomizerCardEnum->SEEFIRST; + +================================================================================ +`; diff --git a/tests/assign/assign.php b/tests/assign/assign.php new file mode 100644 index 000000000..067ee5506 --- /dev/null +++ b/tests/assign/assign.php @@ -0,0 +1,101 @@ + 'value']; +$var = [ + 'key' => 'value' +]; +$var = [ + 'key' => 'value', + 'oneKey' => 'value', + 'twoKey' => 'value', + 'threeKey' => 'value', + 'fourKey' => 'value', + 'fiveKey' => 'value', + 'sixKey' => 'value' +]; +$var = $veryVeryVeryVeryVeryVeryVeryLongVariable ? $veryVeryVeryVeryVeryVeryVeryLongTrueExpr : $veryVeryVeryVeryVeryVeryVeryLongFalseExpr; +$var = $var . 'string' ? $trueExpr : $falseExpr; +$var = $var . 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . $otherVar ? $trueExpr : $falseExpr; +$var = $var . 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString' . $otherVar === $veryVeryVeryVeryVeryVeryVeryLongVariable ? $trueExpr : $falseExpr; +$var = VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_CONSTANT; +$var = $arr['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString']; +$var = $arr['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString']; +$variable['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString'] = $variable->registered[1]; + +$computedDescriptionLines = ($showConfirm && + $descriptionLinesConfirming) || + ($focused && !$loading && $descriptionLinesFocused) || + $descriptionLines; + +$computedDescriptionLines = ($focused && + !$loading && + $descriptionLinesFocused) || + $descriptionLines; + +[$bottom, $left, $right, $top] = $arr; +[$oneVeryVeryVeryVeryVeryVeryVeryLongVariable, $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, $fourVeryVeryVeryVeryVeryVeryVeryLongVariable] = $arr; +[$oneVeryVeryVeryVeryVeryVeryVeryLongVariable, $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, $fourVeryVeryVeryVeryVeryVeryVeryLongVariable] = $test ? $trueExpr : $falseExpr; +[$oneVeryVeryVeryVeryVeryVeryVeryLongVariable, $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, $fourVeryVeryVeryVeryVeryVeryVeryLongVariable] = $veryVeryVeryVeryVeryVeryVeryLongVariable ? $veryVeryVeryVeryVeryVeryVeryLongVariable : $veryVeryVeryVeryVeryVeryVeryLongVariable; +[$oneVeryVeryVeryVeryVeryVeryVeryLongVariable, $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, $fourVeryVeryVeryVeryVeryVeryVeryLongVariable] = $test . 'string' ? $trueExpr : $falseExpr; +[$oneVeryVeryVeryVeryVeryVeryVeryLongVariable, $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, $fourVeryVeryVeryVeryVeryVeryVeryLongVariable] = $arr || []; +[$oneVeryVeryVeryVeryVeryVeryVeryLongVariable, $twoVeryVeryVeryVeryVeryVeryVeryLongVariable, $threeVeryVeryVeryVeryVeryVeryVeryLongVariable, $fourVeryVeryVeryVeryVeryVeryVeryLongVariable] = $arr || [ + 'key' => 'value', + 'otherKey' => 'otherValue' +]; + +for (($i = 0), ($len = $arr->length); $i < $len; $i++) { + call($arr[$i]); +} + +for ($i = 0, $len = $arr->length; $i < $len; $i++) { + call($arr[$i]); +} + +$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable = $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable; + +$obj->property = $obj->oneProperty = $obj->twoPeroperty = 0; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = 0; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = (new MyClass())->call($arg); +$obj->loooooooooooong->lookup = $this->getRequest()->getParam('instance-resource-id'); +$obj->loooooooooooong->lookup = (int) $this->getRequest()->getParam('instance-resource-id'); + +$component = $var->insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = $var->insertReallyReallyReally{$ReallyReallyReallyReallyReallyLongName}; +$component = Foo::$insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = $a::$insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = (new Foo())->insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = (clone $a)->insertReallyReallyReallyReallyReallyReallyReallyReallyLongName; + +$component = $var->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = $var->insertReallyReallyReallyReallyReallyReallyReallyReallyReally{$ReallyReallyReallyReallyReallyReallyLongName}; +$component = Foo::$insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = $a::$insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = (new Foo())->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; +$component = (clone $a)->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName; + +$component = $var->insertReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$component = Foo::$insertReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$component = $var->insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; +$component = Foo::$insertReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLongName[0]; + +$blablah = + "aldkfkladfskladklsfkladklfkaldfadfkdaf" . + "adlfasdklfkldsklfakldsfkladsfkadsfladsfa" . + "dflkadfkladsfklkadlfkladlfkadklfjadlfdfdaf"; + +$somethingThatsAReallyLongPropName = + $obj->props->cardType === $AwesomizerCardEnum->SEEFIRST; diff --git a/tests/assign/jsfmt.spec.mjs b/tests/assign/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/assign/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/assignref/__snapshots__/jsfmt.spec.mjs.snap b/tests/assignref/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..a25b1c2d5 --- /dev/null +++ b/tests/assignref/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`assignref.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +registered[1]; +$variable['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString'] = &$variable->registered[1]; + +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = &$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue; + +$test = + $superSupersuperSupersuperSupersuperSupersuperSuperLong + ->exampleOfOrderOfGetterAndSetterReordered; +$test = + &$superSupersuperSupersuperSupersuperSupersuperSuperLong + ->exampleOfOrderOfGetterAndSetterReordered; + +$this->long->expression->before->array->statesArray[$state->getCirculationStateId()] = $state->getName(); +$this->long->expression->before->array->statesArray[$state->getCirculationStateId()] = &$state->getName(); + +$cached_var = &drupal_static(__FUNCTION__); + +$test = ['key' => &$value]; +$test = ['key' => &$value['something']]; + +=====================================output===================================== +registered[1]; +$variable[ + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString" +] = &$variable->registered[1]; + +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = &$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue; + +$test = + $superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered; +$test = + &$superSupersuperSupersuperSupersuperSupersuperSuperLong->exampleOfOrderOfGetterAndSetterReordered; + +$this->long->expression->before->array->statesArray[ + $state->getCirculationStateId() +] = $state->getName(); +$this->long->expression->before->array->statesArray[ + $state->getCirculationStateId() +] = &$state->getName(); + +$cached_var = &drupal_static(__FUNCTION__); + +$test = ["key" => &$value]; +$test = ["key" => &$value["something"]]; + +================================================================================ +`; diff --git a/tests/assignref/assignref.php b/tests/assignref/assignref.php new file mode 100644 index 000000000..d215d415e --- /dev/null +++ b/tests/assignref/assignref.php @@ -0,0 +1,36 @@ +registered[1]; +$variable['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString'] = &$variable->registered[1]; + +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue; +$obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = $obj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty = &$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongValue; + +$test = + $superSupersuperSupersuperSupersuperSupersuperSuperLong + ->exampleOfOrderOfGetterAndSetterReordered; +$test = + &$superSupersuperSupersuperSupersuperSupersuperSuperLong + ->exampleOfOrderOfGetterAndSetterReordered; + +$this->long->expression->before->array->statesArray[$state->getCirculationStateId()] = $state->getName(); +$this->long->expression->before->array->statesArray[$state->getCirculationStateId()] = &$state->getName(); + +$cached_var = &drupal_static(__FUNCTION__); + +$test = ['key' => &$value]; +$test = ['key' => &$value['something']]; diff --git a/tests/assignref/jsfmt.spec.mjs b/tests/assignref/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/assignref/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/attributes-trail-comma/__snapshots__/jsfmt.spec.mjs.snap b/tests/attributes-trail-comma/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..89c78ae16 --- /dev/null +++ b/tests/attributes-trail-comma/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,55 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`attributes-trail-comma.php 1`] = ` +====================================options===================================== +parsers: ["php"] +phpVersion: "8.0" +printWidth: 80 +trailingCommaPHP: true + | printWidth +=====================================input====================================== + $r * 2; + } + + // Testing S + #[S] +//Testing S-T +#[T] //Testing T + + private function u() { + return #[V] function() { return null; }; + } + +} + +#[W('a', null, 'looooong','paraaaams','list','aaaaaaaaaaaaa','vvvvvvvvvvvv','cccccccccc','eeeeeeeeeee'), X()] function Y(#[ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ(12345678, 1234578)] string $_):string {return new #[NON, Anon()] class {};} + +#[IA('interface'),\\Looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong\\Namespace\\WithStuff\\IB] +interface IC { + #[ID] const IE = 123; + + #[IG, IH('abc'),IJ()] public function ik(); +} + +// issue #1820 +final class DomainEventMessage +{ + #[Some(type: "some_type")] + public function getPayload(): string + { + return "444"; + } + + public function getPayload1(): string + { + return "555"; + } +} + +#[ + Attr1(Attr1::FOO | Attr1::BAR), + Attr2(-20 * 5 + 10) +] +class A {} + +class ValueModel +{ + #[ + Assert\\NotBlank(allowNull: false, groups: ['foo']), + Assert\\Length(max: 255, groups: ['foo']), + ] + public ?string $value = null; +} + +class Test +{ + /** + * Method with an attribute. + * @param string $foo + * @return string + */ + #[Pure] + public function withAttribute(string $foo): string + { + return $foo; + } + +} + +class ParamCommentFunctionAnnotation { + + #[Foo] + function bar( + int $a, // parameter comment + int $b, + ) { + return $a + $b; + } + + #[Foo] + function bar2( + int $a, + int $middle, // parameter comment + int $b, + ) { + return $a + $middle + $b; + } + +} + +=====================================output===================================== + $r * 2; + } //Testing T + + // Testing S + //Testing S-T + #[S] + #[T] + private function u() + { + return #[V] function () { + return null; + }; + } +} + +#[ + W( + "a", + null, + "looooong", + "paraaaams", + "list", + "aaaaaaaaaaaaa", + "vvvvvvvvvvvv", + "cccccccccc", + "eeeeeeeeeee", + ), + X, +] +function Y( + #[ + ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ( + 12345678, + 1234578, + ), + ] + string $_, +): string { + return new #[NON, Anon] class {}; +} + +#[ + IA("interface"), + \\Looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong\\Namespace\\WithStuff\\IB, +] +interface IC +{ + #[ID] + const IE = 123; + + #[IG, IH("abc"), IJ] + public function ik(); +} + +// issue #1820 +final class DomainEventMessage +{ + #[Some(type: "some_type")] + public function getPayload(): string + { + return "444"; + } + + public function getPayload1(): string + { + return "555"; + } +} + +#[Attr1(Attr1::FOO | Attr1::BAR), Attr2(-20 * 5 + 10)] +class A {} + +class ValueModel +{ + #[ + Assert\\NotBlank(allowNull: false, groups: ["foo"]), + Assert\\Length(max: 255, groups: ["foo"]), + ] + public ?string $value = null; +} + +class Test +{ + /** + * Method with an attribute. + * @param string $foo + * @return string + */ + #[Pure] + public function withAttribute(string $foo): string + { + return $foo; + } +} + +class ParamCommentFunctionAnnotation +{ + #[Foo] + function bar( + int $a, // parameter comment + int $b, + ) { + return $a + $b; + } + + #[Foo] + function bar2( + int $a, + int $middle, // parameter comment + int $b, + ) { + return $a + $middle + $b; + } +} + +================================================================================ +`; diff --git a/tests/attributes/attributes.php b/tests/attributes/attributes.php new file mode 100644 index 000000000..bb93d757a --- /dev/null +++ b/tests/attributes/attributes.php @@ -0,0 +1,105 @@ + $r * 2; + } + + // Testing S + #[S] +//Testing S-T +#[T] //Testing T + + private function u() { + return #[V] function() { return null; }; + } + +} + +#[W('a', null, 'looooong','paraaaams','list','aaaaaaaaaaaaa','vvvvvvvvvvvv','cccccccccc','eeeeeeeeeee'), X()] function Y(#[ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ(12345678, 1234578)] string $_):string {return new #[NON, Anon()] class {};} + +#[IA('interface'),\Looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong\Namespace\WithStuff\IB] +interface IC { + #[ID] const IE = 123; + + #[IG, IH('abc'),IJ()] public function ik(); +} + +// issue #1820 +final class DomainEventMessage +{ + #[Some(type: "some_type")] + public function getPayload(): string + { + return "444"; + } + + public function getPayload1(): string + { + return "555"; + } +} + +#[ + Attr1(Attr1::FOO | Attr1::BAR), + Attr2(-20 * 5 + 10) +] +class A {} + +class ValueModel +{ + #[ + Assert\NotBlank(allowNull: false, groups: ['foo']), + Assert\Length(max: 255, groups: ['foo']), + ] + public ?string $value = null; +} + +class Test +{ + /** + * Method with an attribute. + * @param string $foo + * @return string + */ + #[Pure] + public function withAttribute(string $foo): string + { + return $foo; + } + +} + +class ParamCommentFunctionAnnotation { + + #[Foo] + function bar( + int $a, // parameter comment + int $b, + ) { + return $a + $b; + } + + #[Foo] + function bar2( + int $a, + int $middle, // parameter comment + int $b, + ) { + return $a + $middle + $b; + } + +} diff --git a/tests/attributes/jsfmt.spec.mjs b/tests/attributes/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/attributes/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/bin/__snapshots__/jsfmt.spec.mjs.snap b/tests/bin/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..787a4f6d2 --- /dev/null +++ b/tests/bin/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,871 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`bin.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +> $b; +$a >>= $b; + +$a == $b; +$a === $b; +$a != $b; +$a <> $b; +$a !== $b; +$a < $b; +$a > $b; +$a <= $b; +$a >= $b; +$a <=> $b; + +$a and $b; +$a or $b; +$a xor $b; +!$a; +$a && $b; +$a || $b; + +$a . $b; +$a .= $b; + +$a instanceof stdClass; + +$output = \`ls -al\`; +$a = (bool) "test"; + +$b = &$a; + +$a ?? $b; + +$this->reallyLong->testPropertyName = 'a' . $someOtherTest . 'n' . $oneLastOneToMakeLineLong; + +'tesssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssst' . 'test'; + +$someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable; +$someReallyReallyReallyLongBooleanVariable . $someReallyReallyReallyLongBooleanVariable; +$someReallyReallyReallyLongBooleanVariable .= $someReallyReallyReallyLongBooleanVariable; +++$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName; +--$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName; +$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName++; +$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName--; +$someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable - $someReallyReallyReallyLongBooleanVariable; + +$value = isset($_POST['menu-item-dropdown']) && +isset($_POST['menu-item-dropdown'][$menuItemDbId]) + ? 'enabled' + : 'disabled'; + +($var && $var && $var)->call(); +-($var && $var && $var); +-($veryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryLongVariable); +($veryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryLongVariable)->call(); +($veryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryLongVariable)['key']; + +if ( + get_option('woocommerce_product_cart_actions_notification_more_cart') === 'yes' && + count($cartItems) > 0 +) { + $a = 1; +} + +function f() +{ + if ( + get_option('woocommerce_product_cart_actions_notification_more_cart') === 'yes' + && count($cartItems) > 0 + ) { + $a = 1; + } +} + +$accelerator = + (extension_loaded('eaccelerator') && ini_get('eaccelerator.enable')) || + (extension_loaded('apc') && ini_get('apc.enabled')) || + (extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.enable')) || + (extension_loaded('Zend OPcache') && ini_get('opcache.enable')) || + (extension_loaded('xcache') && ini_get('xcache.cacher')) || + (extension_loaded('wincache') && ini_get('wincache.ocenabled')); + +while ($a < 10) $a + 1; + +$a = 'string' . 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVery' ? 1 : 2; +return 'string' . 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVery' ? 1 : 2; +call('string' . 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVery' ? 1 : 2, 'arg'); + +$var = $someReallyReallyReallyLongBooleanVariable * $someReallyReallyReallyLongBooleanVariable / 100; +$var = ($someReallyReallyReallyLongBooleanVariable * $someReallyReallyReallyLongBooleanVariable) / 100; +$var = $someReallyReallyReallyLongBooleanVariable * ($someReallyReallyReallyLongBooleanVariable / 100); +$var = $someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable % 100; +$var = $someReallyReallyReallyLongBooleanVariable * $someReallyReallyReallyLongBooleanVariable % 100; +$var = $someReallyReallyReallyLongBooleanVariable << $someReallyReallyReallyLongBooleanVariable << 100; +$var = $someReallyReallyReallyLongBooleanVariable ** $someReallyReallyReallyLongBooleanVariable ** 100; +$var = $someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable * 100; +$var = ($someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable) * 100; +$var = $someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable % 100; +$var = $someReallyReallyReallyLongBooleanVariable % $someReallyReallyReallyLongBooleanVariable + 100; + +if ($someReallyReallyReallyLongBooleanVariable * $someReallyReallyReallyLongBooleanVariable / 100) {} +if (($someReallyReallyReallyLongBooleanVariable * $someReallyReallyReallyLongBooleanVariable) / 100) {} +if ($someReallyReallyReallyLongBooleanVariable * ($someReallyReallyReallyLongBooleanVariable / 100)) {} +if ($someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable % 100) {} +if ($someReallyReallyReallyLongBooleanVariable * $someReallyReallyReallyLongBooleanVariable % 100) {} +if ($someReallyReallyReallyLongBooleanVariable << $someReallyReallyReallyLongBooleanVariable << 100) {} +if ($someReallyReallyReallyLongBooleanVariable ** $someReallyReallyReallyLongBooleanVariable ** 100) {} +if ($someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable * 100) {} +if (($someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable) * 100) {} +if ($someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable % 100) {} +if ($someReallyReallyReallyLongBooleanVariable % $someReallyReallyReallyLongBooleanVariable + 100) {} + +echo 'This ' . + 'string' . + 'string' . + ('string') . + 'string' . + (100 + 100) . + 'string ' . + (100 - 100) . + 'was ' . + (100 * 100) . + 'made ' . + (100 / 100) . + 'with concatenation.'; + +if ($someReallyReallyReallyLongBooleanVariableWithRddllyReallyLongName || []) {} +if ($someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName || []) {} + +$accelerator = + ( + extension_loaded('eaccelerator') && ini_get('eaccelerator.enable') + ) || + ( + extension_loaded('apc') && + ini_get('apc.enabled') + ) || + ( + extension_loaded('Zend Optimizer+') + && ini_get('zend_optimizerplus.enable') + ) || + ( + extension_loaded('Zend OPcache') + && + ini_get('opcache.enable') + ) || + (extension_loaded('xcache') && ini_get('xcache.cacher')) || + ( + extension_loaded( + + 'wincache' + + ) + + && + + ini_get( + + 'wincache.ocenabled' + + ) + ); + +~($a || $b); +~($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable); + +($a || $b).foo; +($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable)->foo; + +($a || $b).foo(); +($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable)->foo(); + +($a || $b)::foo(); +($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable)::foo(); + +($a || $b)['string']; +($someReallyReallyReallyLongBooleanVariable || $someReallyReallyReallyLongBooleanVariable)['string']; + +$var = call($var > $var ? true : false); +$var = call($someOtherReallyReallyLongVariable > $var ? true : false); +$var = call($var > $someOtherReallyReallyLongVariable ? true : false); +$var = call($someOtherReallyReallyLongVariable > $someOtherReallyReallyLongVariable ? true : false); +$var = call($someOtherReallyReallyReallyReallyReallyReallyLongVariable > $someOtherReallyReallyReallyReallyReallyReallyLongVariable ? true : false); + +return $var > $var ? true : false; +return $someOtherReallyReallyLongVariable > $var ? true : false; +return $var > $someOtherReallyReallyLongVariable ? true : false; +return $someOtherReallyReallyLongVariable > $someOtherReallyReallyLongVariable ? true : false; +return $someOtherReallyReallyReallyReallyReallyReallyLongVariable > $someOtherReallyReallyReallyReallyReallyReallyLongVariable ? true : false; + +func( + $bifornCringerMoshedPerplexSawder, + $askTrovenaBeenaDependsRowans, + $glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl && + $anodyneCondosMalateOverateRetinol + ? $annularCooeedSplicesWalksWayWay + : $kochabCooieGameOnOboleUnweave +); + +$var = $a ?? $b; +$var = $a ?? $b ?? $c; +$var = $a ?? $b ?? $c ?? $d; +$var = $a ?? $b ?? $c ?? $d ?? call($a, $b, $c); +$var = $a ?? $b ?? $c ?? $d ?? $var ? 1 : 2; +$var = $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable; +$var = $someOtherReallyReallyReallyLongVariable ?? $someOtherReallyReallyReallyLongVariable; +$var = $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable; +$var = $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable; +$var = $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? call($someOtherReallyReallyLongVariable, $someOtherReallyReallyLongVariable, $someOtherReallyReallyLongVariable); +$var = $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +$var = $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable; + +$var = $var instanceof Arrayable ? $var : $var; +$var = $someOtherReallyReallyReallyLongVariable instanceof Arrayable ? $var : $var; +$var = $someOtherReallyReallyReallyReallyLongVariable instanceof Arrayable ? $var : $var; +$var = $var instanceof Arrayable ? $someOtherReallyReallyReallyLongVariable : $var; +$var = $var instanceof Arrayable ? $someOtherReallyReallyReallyReallyLongVariable : $var; +$var = $var instanceof Arrayable ? $var : $someOtherReallyReallyReallyLongVariable; +$var = $var instanceof Arrayable ? $var : $someOtherReallyReallyReallyReallyLongVariable; +$var = $someOtherReallyReallyReallyLongVariable instanceof Arrayable ? $someOtherReallyReallyReallyLongVariable : $someOtherReallyReallyReallyLongVariable; + +$callback = + $var ?? + function () { + return true; + }; +$callback = + $var ?? + function () { + return true; + } ?? + function () { + return true; + }; +$regex = + '/ + (\\\\\\\\)? # escaped with a backslash? + \\$ + (?!\\() # no opening parenthesis + (\\{)? # optional brace + (' . + self::VARNAME_REGEX . + ') # var name + (\\})? # optional closing brace +/x'; +$var = ' +string +string +string +' . ' +string +string +string +'; + +$var = $var . ' +string +'; + +$var = ' +string +' . $var; + +$var = ' +string\\n +string\\n +string\\n +' . ' +string\\r\\n +string\\r\\n +string\\r\\n +'; + +$var = ' +string\\\\n +string\\\\n +string\\\\n +' . ' +string\\\\r\\\\n +string\\\\r\\\\n +string\\\\r\\\\n +'; + +$var = __DIR__ instanceof \\Exception; +$var = 'string' instanceof \\Exception; +$var = "string" instanceof \\Exception; +$var = 2244 instanceof \\Exception; +$var = true instanceof \\Exception; +$var = 100 + 1 instanceof \\Exception; + +// Fetches the value of $_GET['user'] and returns 'nobody' +// if it does not exist. +$username = $_GET['user'] ?? 'nobody'; +// This is equivalent to: +$username = isset($_GET['user']) ? $_GET['user'] : 'nobody'; + +// Coalescing can be chained: this will return the first +// defined value out of $_GET['user'], $_POST['user'], and +// 'nobody'. +$username = $_GET['user'] ?? $_POST['user'] ?? 'nobody'; + +// The following lines are doing the same +$this->request->data['comments']['user_id'] = $this->request->data['comments']['user_id'] ?? 'value'; +// Instead of repeating variables with long names, the equal coalesce operator is used +$this->request->data['comments']['user_id'] ??= 'value'; + +=====================================output===================================== +> $b; +$a >>= $b; + +$a == $b; +$a === $b; +$a != $b; +$a != $b; +$a !== $b; +$a < $b; +$a > $b; +$a <= $b; +$a >= $b; +$a <=> $b; + +$a and $b; +$a or $b; +$a xor $b; +!$a; +$a && $b; +$a || $b; + +$a . $b; +$a .= $b; + +$a instanceof stdClass; + +$output = \`ls -al\`; +$a = (bool) "test"; + +$b = &$a; + +$a ?? $b; + +$this->reallyLong->testPropertyName = + "a" . $someOtherTest . "n" . $oneLastOneToMakeLineLong; + +"tesssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssst" . + "test"; + +$someReallyReallyReallyLongBooleanVariable + + $someReallyReallyReallyLongBooleanVariable; +$someReallyReallyReallyLongBooleanVariable . + $someReallyReallyReallyLongBooleanVariable; +$someReallyReallyReallyLongBooleanVariable .= $someReallyReallyReallyLongBooleanVariable; +++$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName; +--$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName; +$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName++; +$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName--; +$someReallyReallyReallyLongBooleanVariable + + $someReallyReallyReallyLongBooleanVariable - + $someReallyReallyReallyLongBooleanVariable; + +$value = + isset($_POST["menu-item-dropdown"]) && + isset($_POST["menu-item-dropdown"][$menuItemDbId]) + ? "enabled" + : "disabled"; + +($var && $var && $var)->call(); +-($var && $var && $var); +-( + $veryVeryVeryVeryVeryLongVariable && + $veryVeryVeryVeryVeryLongVariable && + $veryVeryVeryVeryVeryLongVariable +); +( + $veryVeryVeryVeryVeryLongVariable && + $veryVeryVeryVeryVeryLongVariable && + $veryVeryVeryVeryVeryLongVariable +)->call(); +($veryVeryVeryVeryVeryLongVariable && + $veryVeryVeryVeryVeryLongVariable && + $veryVeryVeryVeryVeryLongVariable)["key"]; + +if ( + get_option("woocommerce_product_cart_actions_notification_more_cart") === + "yes" && + count($cartItems) > 0 +) { + $a = 1; +} + +function f() +{ + if ( + get_option( + "woocommerce_product_cart_actions_notification_more_cart", + ) === "yes" && + count($cartItems) > 0 + ) { + $a = 1; + } +} + +$accelerator = + (extension_loaded("eaccelerator") && ini_get("eaccelerator.enable")) || + (extension_loaded("apc") && ini_get("apc.enabled")) || + (extension_loaded("Zend Optimizer+") && + ini_get("zend_optimizerplus.enable")) || + (extension_loaded("Zend OPcache") && ini_get("opcache.enable")) || + (extension_loaded("xcache") && ini_get("xcache.cacher")) || + (extension_loaded("wincache") && ini_get("wincache.ocenabled")); + +while ($a < 10) { + $a + 1; +} + +$a = + "string" . + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVery" + ? 1 + : 2; +return "string" . + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVery" + ? 1 + : 2; +call( + "string" . + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVery" + ? 1 + : 2, + "arg", +); + +$var = + ($someReallyReallyReallyLongBooleanVariable * + $someReallyReallyReallyLongBooleanVariable) / + 100; +$var = + ($someReallyReallyReallyLongBooleanVariable * + $someReallyReallyReallyLongBooleanVariable) / + 100; +$var = + $someReallyReallyReallyLongBooleanVariable * + ($someReallyReallyReallyLongBooleanVariable / 100); +$var = + $someReallyReallyReallyLongBooleanVariable + + ($someReallyReallyReallyLongBooleanVariable % 100); +$var = + ($someReallyReallyReallyLongBooleanVariable * + $someReallyReallyReallyLongBooleanVariable) % + 100; +$var = + ($someReallyReallyReallyLongBooleanVariable << + $someReallyReallyReallyLongBooleanVariable) << + 100; +$var = + $someReallyReallyReallyLongBooleanVariable ** + ($someReallyReallyReallyLongBooleanVariable ** 100); +$var = + $someReallyReallyReallyLongBooleanVariable + + $someReallyReallyReallyLongBooleanVariable * 100; +$var = + ($someReallyReallyReallyLongBooleanVariable + + $someReallyReallyReallyLongBooleanVariable) * + 100; +$var = + $someReallyReallyReallyLongBooleanVariable + + ($someReallyReallyReallyLongBooleanVariable % 100); +$var = + ($someReallyReallyReallyLongBooleanVariable % + $someReallyReallyReallyLongBooleanVariable) + + 100; + +if ( + ($someReallyReallyReallyLongBooleanVariable * + $someReallyReallyReallyLongBooleanVariable) / + 100 +) { +} +if ( + ($someReallyReallyReallyLongBooleanVariable * + $someReallyReallyReallyLongBooleanVariable) / + 100 +) { +} +if ( + $someReallyReallyReallyLongBooleanVariable * + ($someReallyReallyReallyLongBooleanVariable / 100) +) { +} +if ( + $someReallyReallyReallyLongBooleanVariable + + ($someReallyReallyReallyLongBooleanVariable % 100) +) { +} +if ( + ($someReallyReallyReallyLongBooleanVariable * + $someReallyReallyReallyLongBooleanVariable) % + 100 +) { +} +if ( + ($someReallyReallyReallyLongBooleanVariable << + $someReallyReallyReallyLongBooleanVariable) << + 100 +) { +} +if ( + $someReallyReallyReallyLongBooleanVariable ** + ($someReallyReallyReallyLongBooleanVariable ** 100) +) { +} +if ( + $someReallyReallyReallyLongBooleanVariable + + $someReallyReallyReallyLongBooleanVariable * 100 +) { +} +if ( + ($someReallyReallyReallyLongBooleanVariable + + $someReallyReallyReallyLongBooleanVariable) * + 100 +) { +} +if ( + $someReallyReallyReallyLongBooleanVariable + + ($someReallyReallyReallyLongBooleanVariable % 100) +) { +} +if ( + ($someReallyReallyReallyLongBooleanVariable % + $someReallyReallyReallyLongBooleanVariable) + + 100 +) { +} + +echo "This " . + "string" . + "string" . + "string" . + "string" . + (100 + 100) . + "string " . + (100 - 100) . + "was " . + 100 * 100 . + "made " . + 100 / 100 . + "with concatenation."; + +if ($someReallyReallyReallyLongBooleanVariableWithRddllyReallyLongName || []) { +} +if ( + $someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName || + [] +) { +} + +$accelerator = + (extension_loaded("eaccelerator") && ini_get("eaccelerator.enable")) || + (extension_loaded("apc") && ini_get("apc.enabled")) || + (extension_loaded("Zend Optimizer+") && + ini_get("zend_optimizerplus.enable")) || + (extension_loaded("Zend OPcache") && ini_get("opcache.enable")) || + (extension_loaded("xcache") && ini_get("xcache.cacher")) || + (extension_loaded("wincache") && ini_get("wincache.ocenabled")); + +~($a || $b); +~( + $someReallyReallyReallyLongBooleanVariable || + $someOtherReallyReallyReallyLongBooleanVariable +); + +($a || $b) . foo; +( + $someReallyReallyReallyLongBooleanVariable || + $someOtherReallyReallyReallyLongBooleanVariable +)->foo; + +($a || $b) . foo(); +( + $someReallyReallyReallyLongBooleanVariable || + $someOtherReallyReallyReallyLongBooleanVariable +)->foo(); + +($a || $b)::foo(); +( + $someReallyReallyReallyLongBooleanVariable || + $someOtherReallyReallyReallyLongBooleanVariable +)::foo(); + +($a || $b)["string"]; +($someReallyReallyReallyLongBooleanVariable || + $someReallyReallyReallyLongBooleanVariable)["string"]; + +$var = call($var > $var ? true : false); +$var = call($someOtherReallyReallyLongVariable > $var ? true : false); +$var = call($var > $someOtherReallyReallyLongVariable ? true : false); +$var = call( + $someOtherReallyReallyLongVariable > $someOtherReallyReallyLongVariable + ? true + : false, +); +$var = call( + $someOtherReallyReallyReallyReallyReallyReallyLongVariable > + $someOtherReallyReallyReallyReallyReallyReallyLongVariable + ? true + : false, +); + +return $var > $var ? true : false; +return $someOtherReallyReallyLongVariable > $var ? true : false; +return $var > $someOtherReallyReallyLongVariable ? true : false; +return $someOtherReallyReallyLongVariable > $someOtherReallyReallyLongVariable + ? true + : false; +return $someOtherReallyReallyReallyReallyReallyReallyLongVariable > + $someOtherReallyReallyReallyReallyReallyReallyLongVariable + ? true + : false; + +func( + $bifornCringerMoshedPerplexSawder, + $askTrovenaBeenaDependsRowans, + $glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl && + $anodyneCondosMalateOverateRetinol + ? $annularCooeedSplicesWalksWayWay + : $kochabCooieGameOnOboleUnweave, +); + +$var = $a ?? $b; +$var = $a ?? ($b ?? $c); +$var = $a ?? ($b ?? ($c ?? $d)); +$var = $a ?? ($b ?? ($c ?? ($d ?? call($a, $b, $c)))); +$var = $a ?? ($b ?? ($c ?? ($d ?? $var))) ? 1 : 2; +$var = $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable; +$var = + $someOtherReallyReallyReallyLongVariable ?? + $someOtherReallyReallyReallyLongVariable; +$var = + $someOtherReallyReallyLongVariable ?? + ($someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable); +$var = + $someOtherReallyReallyLongVariable ?? + ($someOtherReallyReallyLongVariable ?? + ($someOtherReallyReallyLongVariable ?? + $someOtherReallyReallyLongVariable)); +$var = + $someOtherReallyReallyLongVariable ?? + ($someOtherReallyReallyLongVariable ?? + ($someOtherReallyReallyLongVariable ?? + ($someOtherReallyReallyLongVariable ?? + call( + $someOtherReallyReallyLongVariable, + $someOtherReallyReallyLongVariable, + $someOtherReallyReallyLongVariable, + )))); +$var = + $someOtherReallyReallyLongVariable ?? + ($someOtherReallyReallyLongVariable ?? + ($someOtherReallyReallyLongVariable ?? + ($someOtherReallyReallyLongVariable ?? + $someOtherReallyReallyLongVariable))) + ? $someOtherReallyReallyLongVariable + : $someOtherReallyReallyLongVariable; +$var = + $someOtherReallyReallyLongVariable ?? + ($someOtherReallyReallyLongVariable ?? + ($someOtherReallyReallyLongVariable ?? + ($someOtherReallyReallyLongVariable ?? + $someOtherReallyReallyLongVariable))) ?: + $someOtherReallyReallyLongVariable; + +$var = $var instanceof Arrayable ? $var : $var; +$var = + $someOtherReallyReallyReallyLongVariable instanceof Arrayable ? $var : $var; +$var = + $someOtherReallyReallyReallyReallyLongVariable instanceof Arrayable + ? $var + : $var; +$var = + $var instanceof Arrayable ? $someOtherReallyReallyReallyLongVariable : $var; +$var = + $var instanceof Arrayable + ? $someOtherReallyReallyReallyReallyLongVariable + : $var; +$var = + $var instanceof Arrayable ? $var : $someOtherReallyReallyReallyLongVariable; +$var = + $var instanceof Arrayable + ? $var + : $someOtherReallyReallyReallyReallyLongVariable; +$var = + $someOtherReallyReallyReallyLongVariable instanceof Arrayable + ? $someOtherReallyReallyReallyLongVariable + : $someOtherReallyReallyReallyLongVariable; + +$callback = + $var ?? + function () { + return true; + }; +$callback = + $var ?? + (function () { + return true; + } ?? + function () { + return true; + }); +$regex = + '/ + (\\\\\\\\)? # escaped with a backslash? + \\$ + (?!\\() # no opening parenthesis + (\\{)? # optional brace + (' . + self::VARNAME_REGEX . + ') # var name + (\\})? # optional closing brace +/x'; +$var = + ' +string +string +string +' . + ' +string +string +string +'; + +$var = + $var . + ' +string +'; + +$var = + ' +string +' . $var; + +$var = + ' +string\\n +string\\n +string\\n +' . + ' +string\\r\\n +string\\r\\n +string\\r\\n +'; + +$var = + ' +string\\\\n +string\\\\n +string\\\\n +' . + ' +string\\\\r\\\\n +string\\\\r\\\\n +string\\\\r\\\\n +'; + +$var = __DIR__ instanceof \\Exception; +$var = "string" instanceof \\Exception; +$var = "string" instanceof \\Exception; +$var = 2244 instanceof \\Exception; +$var = true instanceof \\Exception; +$var = 100 + 1 instanceof \\Exception; + +// Fetches the value of $_GET['user'] and returns 'nobody' +// if it does not exist. +$username = $_GET["user"] ?? "nobody"; +// This is equivalent to: +$username = isset($_GET["user"]) ? $_GET["user"] : "nobody"; + +// Coalescing can be chained: this will return the first +// defined value out of $_GET['user'], $_POST['user'], and +// 'nobody'. +$username = $_GET["user"] ?? ($_POST["user"] ?? "nobody"); + +// The following lines are doing the same +$this->request->data["comments"]["user_id"] = + $this->request->data["comments"]["user_id"] ?? "value"; +// Instead of repeating variables with long names, the equal coalesce operator is used +$this->request->data["comments"]["user_id"] ??= "value"; + +================================================================================ +`; + +exports[`single.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +> $b; +$a >>= $b; + +$a == $b; +$a === $b; +$a != $b; +$a <> $b; +$a !== $b; +$a < $b; +$a > $b; +$a <= $b; +$a >= $b; +$a <=> $b; + +$a and $b; +$a or $b; +$a xor $b; +!$a; +$a && $b; +$a || $b; + +$a . $b; +$a .= $b; + +$a instanceof stdClass; + +$output = `ls -al`; +$a = (bool) "test"; + +$b = &$a; + +$a ?? $b; + +$this->reallyLong->testPropertyName = 'a' . $someOtherTest . 'n' . $oneLastOneToMakeLineLong; + +'tesssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssst' . 'test'; + +$someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable; +$someReallyReallyReallyLongBooleanVariable . $someReallyReallyReallyLongBooleanVariable; +$someReallyReallyReallyLongBooleanVariable .= $someReallyReallyReallyLongBooleanVariable; +++$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName; +--$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName; +$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName++; +$someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName--; +$someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable - $someReallyReallyReallyLongBooleanVariable; + +$value = isset($_POST['menu-item-dropdown']) && +isset($_POST['menu-item-dropdown'][$menuItemDbId]) + ? 'enabled' + : 'disabled'; + +($var && $var && $var)->call(); +-($var && $var && $var); +-($veryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryLongVariable); +($veryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryLongVariable)->call(); +($veryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryLongVariable && $veryVeryVeryVeryVeryLongVariable)['key']; + +if ( + get_option('woocommerce_product_cart_actions_notification_more_cart') === 'yes' && + count($cartItems) > 0 +) { + $a = 1; +} + +function f() +{ + if ( + get_option('woocommerce_product_cart_actions_notification_more_cart') === 'yes' + && count($cartItems) > 0 + ) { + $a = 1; + } +} + +$accelerator = + (extension_loaded('eaccelerator') && ini_get('eaccelerator.enable')) || + (extension_loaded('apc') && ini_get('apc.enabled')) || + (extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.enable')) || + (extension_loaded('Zend OPcache') && ini_get('opcache.enable')) || + (extension_loaded('xcache') && ini_get('xcache.cacher')) || + (extension_loaded('wincache') && ini_get('wincache.ocenabled')); + +while ($a < 10) $a + 1; + +$a = 'string' . 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVery' ? 1 : 2; +return 'string' . 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVery' ? 1 : 2; +call('string' . 'veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVery' ? 1 : 2, 'arg'); + +$var = $someReallyReallyReallyLongBooleanVariable * $someReallyReallyReallyLongBooleanVariable / 100; +$var = ($someReallyReallyReallyLongBooleanVariable * $someReallyReallyReallyLongBooleanVariable) / 100; +$var = $someReallyReallyReallyLongBooleanVariable * ($someReallyReallyReallyLongBooleanVariable / 100); +$var = $someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable % 100; +$var = $someReallyReallyReallyLongBooleanVariable * $someReallyReallyReallyLongBooleanVariable % 100; +$var = $someReallyReallyReallyLongBooleanVariable << $someReallyReallyReallyLongBooleanVariable << 100; +$var = $someReallyReallyReallyLongBooleanVariable ** $someReallyReallyReallyLongBooleanVariable ** 100; +$var = $someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable * 100; +$var = ($someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable) * 100; +$var = $someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable % 100; +$var = $someReallyReallyReallyLongBooleanVariable % $someReallyReallyReallyLongBooleanVariable + 100; + +if ($someReallyReallyReallyLongBooleanVariable * $someReallyReallyReallyLongBooleanVariable / 100) {} +if (($someReallyReallyReallyLongBooleanVariable * $someReallyReallyReallyLongBooleanVariable) / 100) {} +if ($someReallyReallyReallyLongBooleanVariable * ($someReallyReallyReallyLongBooleanVariable / 100)) {} +if ($someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable % 100) {} +if ($someReallyReallyReallyLongBooleanVariable * $someReallyReallyReallyLongBooleanVariable % 100) {} +if ($someReallyReallyReallyLongBooleanVariable << $someReallyReallyReallyLongBooleanVariable << 100) {} +if ($someReallyReallyReallyLongBooleanVariable ** $someReallyReallyReallyLongBooleanVariable ** 100) {} +if ($someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable * 100) {} +if (($someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable) * 100) {} +if ($someReallyReallyReallyLongBooleanVariable + $someReallyReallyReallyLongBooleanVariable % 100) {} +if ($someReallyReallyReallyLongBooleanVariable % $someReallyReallyReallyLongBooleanVariable + 100) {} + +echo 'This ' . + 'string' . + 'string' . + ('string') . + 'string' . + (100 + 100) . + 'string ' . + (100 - 100) . + 'was ' . + (100 * 100) . + 'made ' . + (100 / 100) . + 'with concatenation.'; + +if ($someReallyReallyReallyLongBooleanVariableWithRddllyReallyLongName || []) {} +if ($someReallyReallyReallyLongBooleanVariableWithReallyReallyReallyReallyReallyReallyLongName || []) {} + +$accelerator = + ( + extension_loaded('eaccelerator') && ini_get('eaccelerator.enable') + ) || + ( + extension_loaded('apc') && + ini_get('apc.enabled') + ) || + ( + extension_loaded('Zend Optimizer+') + && ini_get('zend_optimizerplus.enable') + ) || + ( + extension_loaded('Zend OPcache') + && + ini_get('opcache.enable') + ) || + (extension_loaded('xcache') && ini_get('xcache.cacher')) || + ( + extension_loaded( + + 'wincache' + + ) + + && + + ini_get( + + 'wincache.ocenabled' + + ) + ); + +~($a || $b); +~($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable); + +($a || $b).foo; +($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable)->foo; + +($a || $b).foo(); +($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable)->foo(); + +($a || $b)::foo(); +($someReallyReallyReallyLongBooleanVariable || $someOtherReallyReallyReallyLongBooleanVariable)::foo(); + +($a || $b)['string']; +($someReallyReallyReallyLongBooleanVariable || $someReallyReallyReallyLongBooleanVariable)['string']; + +$var = call($var > $var ? true : false); +$var = call($someOtherReallyReallyLongVariable > $var ? true : false); +$var = call($var > $someOtherReallyReallyLongVariable ? true : false); +$var = call($someOtherReallyReallyLongVariable > $someOtherReallyReallyLongVariable ? true : false); +$var = call($someOtherReallyReallyReallyReallyReallyReallyLongVariable > $someOtherReallyReallyReallyReallyReallyReallyLongVariable ? true : false); + +return $var > $var ? true : false; +return $someOtherReallyReallyLongVariable > $var ? true : false; +return $var > $someOtherReallyReallyLongVariable ? true : false; +return $someOtherReallyReallyLongVariable > $someOtherReallyReallyLongVariable ? true : false; +return $someOtherReallyReallyReallyReallyReallyReallyLongVariable > $someOtherReallyReallyReallyReallyReallyReallyLongVariable ? true : false; + +func( + $bifornCringerMoshedPerplexSawder, + $askTrovenaBeenaDependsRowans, + $glimseGlyphsHazardNoopsTieTie === averredBathersBoxroomBuggyNurl && + $anodyneCondosMalateOverateRetinol + ? $annularCooeedSplicesWalksWayWay + : $kochabCooieGameOnOboleUnweave +); + +$var = $a ?? $b; +$var = $a ?? $b ?? $c; +$var = $a ?? $b ?? $c ?? $d; +$var = $a ?? $b ?? $c ?? $d ?? call($a, $b, $c); +$var = $a ?? $b ?? $c ?? $d ?? $var ? 1 : 2; +$var = $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable; +$var = $someOtherReallyReallyReallyLongVariable ?? $someOtherReallyReallyReallyLongVariable; +$var = $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable; +$var = $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable; +$var = $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? call($someOtherReallyReallyLongVariable, $someOtherReallyReallyLongVariable, $someOtherReallyReallyLongVariable); +$var = $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ? $someOtherReallyReallyLongVariable : $someOtherReallyReallyLongVariable; +$var = $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?? $someOtherReallyReallyLongVariable ?: $someOtherReallyReallyLongVariable; + +$var = $var instanceof Arrayable ? $var : $var; +$var = $someOtherReallyReallyReallyLongVariable instanceof Arrayable ? $var : $var; +$var = $someOtherReallyReallyReallyReallyLongVariable instanceof Arrayable ? $var : $var; +$var = $var instanceof Arrayable ? $someOtherReallyReallyReallyLongVariable : $var; +$var = $var instanceof Arrayable ? $someOtherReallyReallyReallyReallyLongVariable : $var; +$var = $var instanceof Arrayable ? $var : $someOtherReallyReallyReallyLongVariable; +$var = $var instanceof Arrayable ? $var : $someOtherReallyReallyReallyReallyLongVariable; +$var = $someOtherReallyReallyReallyLongVariable instanceof Arrayable ? $someOtherReallyReallyReallyLongVariable : $someOtherReallyReallyReallyLongVariable; + +$callback = + $var ?? + function () { + return true; + }; +$callback = + $var ?? + function () { + return true; + } ?? + function () { + return true; + }; +$regex = + '/ + (\\\\)? # escaped with a backslash? + \$ + (?!\() # no opening parenthesis + (\{)? # optional brace + (' . + self::VARNAME_REGEX . + ') # var name + (\})? # optional closing brace +/x'; +$var = ' +string +string +string +' . ' +string +string +string +'; + +$var = $var . ' +string +'; + +$var = ' +string +' . $var; + +$var = ' +string\n +string\n +string\n +' . ' +string\r\n +string\r\n +string\r\n +'; + +$var = ' +string\\n +string\\n +string\\n +' . ' +string\\r\\n +string\\r\\n +string\\r\\n +'; + +$var = __DIR__ instanceof \Exception; +$var = 'string' instanceof \Exception; +$var = "string" instanceof \Exception; +$var = 2244 instanceof \Exception; +$var = true instanceof \Exception; +$var = 100 + 1 instanceof \Exception; + +// Fetches the value of $_GET['user'] and returns 'nobody' +// if it does not exist. +$username = $_GET['user'] ?? 'nobody'; +// This is equivalent to: +$username = isset($_GET['user']) ? $_GET['user'] : 'nobody'; + +// Coalescing can be chained: this will return the first +// defined value out of $_GET['user'], $_POST['user'], and +// 'nobody'. +$username = $_GET['user'] ?? $_POST['user'] ?? 'nobody'; + +// The following lines are doing the same +$this->request->data['comments']['user_id'] = $this->request->data['comments']['user_id'] ?? 'value'; +// Instead of repeating variables with long names, the equal coalesce operator is used +$this->request->data['comments']['user_id'] ??= 'value'; diff --git a/tests/bin/jsfmt.spec.mjs b/tests/bin/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/bin/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/bin/single.php b/tests/bin/single.php new file mode 100644 index 000000000..a064c8e55 --- /dev/null +++ b/tests/bin/single.php @@ -0,0 +1,2 @@ +getValue() . "\\n"; + } +} + +class Foo +{ + function hello() + { + return "hello"; + } + + function hello_1($arg) + { + return "hello"; + } + + function bar($arg = '') + { + echo "In bar(); argument was '$arg'.
\\n"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() + { + return "hello"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName(): ?string + { + return "hello"; + } + + function reeeeeeeeeeaaaaaaaallllllllyyyyyy_llloooooooonnnnnnggggg($soooooooooooo_looooooooonnnng, $eeeeeeeeevvveeeeeeeennnn_loooooonnngggeeeerrrr) { + return $soooooooooooo_looooooooonnnng; + } + + function type_hinting_test(array $array_test, callable $callable_test, bool $bool_test, float $float_test, iterable $iterable_test, int $int_test, string $string_test = '') { + return $int_test; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongNameOther( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = ' … ', // the spaces are non-breaking spaces + &$flag = null + ) { + return "hello"; + } + + static function staticmethod() {} + + public static function ellipsizeMiddle( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = ' … ', // the spaces are non-breaking spaces + &$flag = null + ) { + $string = trim($string); + } + + public static function hello_2() {} + + public static function hello_3($var = 1) {} + + public static function hello_4($var = 1, $other_var = 2, $other_other_other_var = 3) {} + + public static function hello_5($var = 1, $other_var = 2, $other_other_other_var = 3): ?string {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1, $other_var = 2, $other_other_other_var = 3) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1, $other_var = 2, $other_other_other_var = 3) : ?string {} + + public static function newlines( + $var = 1, + + $other_var = 2 + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + + $other_var = 2 + ) {} +} + +=====================================output===================================== +getValue() . "\\n"; + } +} + +class Foo +{ + function hello() + { + return "hello"; + } + + function hello_1($arg) + { + return "hello"; + } + + function bar($arg = "") + { + echo "In bar(); argument was '$arg'.
\\n"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() + { + return "hello"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName(): ?string + { + return "hello"; + } + + function reeeeeeeeeeaaaaaaaallllllllyyyyyy_llloooooooonnnnnnggggg( + $soooooooooooo_looooooooonnnng, + $eeeeeeeeevvveeeeeeeennnn_loooooonnngggeeeerrrr, + ) { + return $soooooooooooo_looooooooonnnng; + } + + function type_hinting_test( + array $array_test, + callable $callable_test, + bool $bool_test, + float $float_test, + iterable $iterable_test, + int $int_test, + string $string_test = "", + ) { + return $int_test; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongNameOther( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = " … ", // the spaces are non-breaking spaces + &$flag = null, + ) { + return "hello"; + } + + static function staticmethod() {} + + public static function ellipsizeMiddle( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = " … ", // the spaces are non-breaking spaces + &$flag = null, + ) { + $string = trim($string); + } + + public static function hello_2() {} + + public static function hello_3($var = 1) {} + + public static function hello_4( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ) {} + + public static function hello_5( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ): ?string {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ): ?string {} + + public static function newlines( + $var = 1, + + $other_var = 2, + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + + $other_var = 2, + ) {} +} + +================================================================================ +`; + +exports[`methods.php 2`] = ` +====================================options===================================== +braceStyle: "psr-2" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +getValue() . "\\n"; + } +} + +class Foo +{ + function hello() + { + return "hello"; + } + + function hello_1($arg) + { + return "hello"; + } + + function bar($arg = '') + { + echo "In bar(); argument was '$arg'.
\\n"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() + { + return "hello"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName(): ?string + { + return "hello"; + } + + function reeeeeeeeeeaaaaaaaallllllllyyyyyy_llloooooooonnnnnnggggg($soooooooooooo_looooooooonnnng, $eeeeeeeeevvveeeeeeeennnn_loooooonnngggeeeerrrr) { + return $soooooooooooo_looooooooonnnng; + } + + function type_hinting_test(array $array_test, callable $callable_test, bool $bool_test, float $float_test, iterable $iterable_test, int $int_test, string $string_test = '') { + return $int_test; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongNameOther( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = ' … ', // the spaces are non-breaking spaces + &$flag = null + ) { + return "hello"; + } + + static function staticmethod() {} + + public static function ellipsizeMiddle( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = ' … ', // the spaces are non-breaking spaces + &$flag = null + ) { + $string = trim($string); + } + + public static function hello_2() {} + + public static function hello_3($var = 1) {} + + public static function hello_4($var = 1, $other_var = 2, $other_other_other_var = 3) {} + + public static function hello_5($var = 1, $other_var = 2, $other_other_other_var = 3): ?string {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1, $other_var = 2, $other_other_other_var = 3) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1, $other_var = 2, $other_other_other_var = 3) : ?string {} + + public static function newlines( + $var = 1, + + $other_var = 2 + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + + $other_var = 2 + ) {} +} + +=====================================output===================================== +getValue() . "\\n"; + } +} + +class Foo +{ + function hello() + { + return "hello"; + } + + function hello_1($arg) + { + return "hello"; + } + + function bar($arg = "") + { + echo "In bar(); argument was '$arg'.
\\n"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() + { + return "hello"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName(): ?string + { + return "hello"; + } + + function reeeeeeeeeeaaaaaaaallllllllyyyyyy_llloooooooonnnnnnggggg( + $soooooooooooo_looooooooonnnng, + $eeeeeeeeevvveeeeeeeennnn_loooooonnngggeeeerrrr, + ) { + return $soooooooooooo_looooooooonnnng; + } + + function type_hinting_test( + array $array_test, + callable $callable_test, + bool $bool_test, + float $float_test, + iterable $iterable_test, + int $int_test, + string $string_test = "", + ) { + return $int_test; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongNameOther( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = " … ", // the spaces are non-breaking spaces + &$flag = null, + ) { + return "hello"; + } + + static function staticmethod() {} + + public static function ellipsizeMiddle( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = " … ", // the spaces are non-breaking spaces + &$flag = null, + ) { + $string = trim($string); + } + + public static function hello_2() {} + + public static function hello_3($var = 1) {} + + public static function hello_4( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ) {} + + public static function hello_5( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ): ?string {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ): ?string {} + + public static function newlines( + $var = 1, + + $other_var = 2, + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + + $other_var = 2, + ) {} +} + +================================================================================ +`; + +exports[`methods.php 3`] = ` +====================================options===================================== +braceStyle: "per-cs" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +getValue() . "\\n"; + } +} + +class Foo +{ + function hello() + { + return "hello"; + } + + function hello_1($arg) + { + return "hello"; + } + + function bar($arg = '') + { + echo "In bar(); argument was '$arg'.
\\n"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() + { + return "hello"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName(): ?string + { + return "hello"; + } + + function reeeeeeeeeeaaaaaaaallllllllyyyyyy_llloooooooonnnnnnggggg($soooooooooooo_looooooooonnnng, $eeeeeeeeevvveeeeeeeennnn_loooooonnngggeeeerrrr) { + return $soooooooooooo_looooooooonnnng; + } + + function type_hinting_test(array $array_test, callable $callable_test, bool $bool_test, float $float_test, iterable $iterable_test, int $int_test, string $string_test = '') { + return $int_test; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongNameOther( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = ' … ', // the spaces are non-breaking spaces + &$flag = null + ) { + return "hello"; + } + + static function staticmethod() {} + + public static function ellipsizeMiddle( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = ' … ', // the spaces are non-breaking spaces + &$flag = null + ) { + $string = trim($string); + } + + public static function hello_2() {} + + public static function hello_3($var = 1) {} + + public static function hello_4($var = 1, $other_var = 2, $other_other_other_var = 3) {} + + public static function hello_5($var = 1, $other_var = 2, $other_other_other_var = 3): ?string {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1, $other_var = 2, $other_other_other_var = 3) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1, $other_var = 2, $other_other_other_var = 3) : ?string {} + + public static function newlines( + $var = 1, + + $other_var = 2 + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + + $other_var = 2 + ) {} +} + +=====================================output===================================== +getValue() . "\\n"; + } +} + +class Foo +{ + function hello() + { + return "hello"; + } + + function hello_1($arg) + { + return "hello"; + } + + function bar($arg = "") + { + echo "In bar(); argument was '$arg'.
\\n"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() + { + return "hello"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName(): ?string + { + return "hello"; + } + + function reeeeeeeeeeaaaaaaaallllllllyyyyyy_llloooooooonnnnnnggggg( + $soooooooooooo_looooooooonnnng, + $eeeeeeeeevvveeeeeeeennnn_loooooonnngggeeeerrrr, + ) { + return $soooooooooooo_looooooooonnnng; + } + + function type_hinting_test( + array $array_test, + callable $callable_test, + bool $bool_test, + float $float_test, + iterable $iterable_test, + int $int_test, + string $string_test = "", + ) { + return $int_test; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongNameOther( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = " … ", // the spaces are non-breaking spaces + &$flag = null, + ) { + return "hello"; + } + + static function staticmethod() {} + + public static function ellipsizeMiddle( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = " … ", // the spaces are non-breaking spaces + &$flag = null, + ) { + $string = trim($string); + } + + public static function hello_2() {} + + public static function hello_3($var = 1) {} + + public static function hello_4( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ) {} + + public static function hello_5( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ): ?string {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ): ?string {} + + public static function newlines( + $var = 1, + + $other_var = 2, + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + + $other_var = 2, + ) {} +} + +================================================================================ +`; + +exports[`methods.php 4`] = ` +====================================options===================================== +braceStyle: "1tbs" +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +getValue() . "\\n"; + } +} + +class Foo +{ + function hello() + { + return "hello"; + } + + function hello_1($arg) + { + return "hello"; + } + + function bar($arg = '') + { + echo "In bar(); argument was '$arg'.
\\n"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() + { + return "hello"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName(): ?string + { + return "hello"; + } + + function reeeeeeeeeeaaaaaaaallllllllyyyyyy_llloooooooonnnnnnggggg($soooooooooooo_looooooooonnnng, $eeeeeeeeevvveeeeeeeennnn_loooooonnngggeeeerrrr) { + return $soooooooooooo_looooooooonnnng; + } + + function type_hinting_test(array $array_test, callable $callable_test, bool $bool_test, float $float_test, iterable $iterable_test, int $int_test, string $string_test = '') { + return $int_test; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongNameOther( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = ' … ', // the spaces are non-breaking spaces + &$flag = null + ) { + return "hello"; + } + + static function staticmethod() {} + + public static function ellipsizeMiddle( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = ' … ', // the spaces are non-breaking spaces + &$flag = null + ) { + $string = trim($string); + } + + public static function hello_2() {} + + public static function hello_3($var = 1) {} + + public static function hello_4($var = 1, $other_var = 2, $other_other_other_var = 3) {} + + public static function hello_5($var = 1, $other_var = 2, $other_other_other_var = 3): ?string {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1, $other_var = 2, $other_other_other_var = 3) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1, $other_var = 2, $other_other_other_var = 3) : ?string {} + + public static function newlines( + $var = 1, + + $other_var = 2 + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + + $other_var = 2 + ) {} +} + +=====================================output===================================== +getValue() . "\\n"; + } +} + +class Foo { + function hello() { + return "hello"; + } + + function hello_1($arg) { + return "hello"; + } + + function bar($arg = "") { + echo "In bar(); argument was '$arg'.
\\n"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() { + return "hello"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName(): ?string { + return "hello"; + } + + function reeeeeeeeeeaaaaaaaallllllllyyyyyy_llloooooooonnnnnnggggg( + $soooooooooooo_looooooooonnnng, + $eeeeeeeeevvveeeeeeeennnn_loooooonnngggeeeerrrr, + ) { + return $soooooooooooo_looooooooonnnng; + } + + function type_hinting_test( + array $array_test, + callable $callable_test, + bool $bool_test, + float $float_test, + iterable $iterable_test, + int $int_test, + string $string_test = "", + ) { + return $int_test; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongNameOther( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = " … ", // the spaces are non-breaking spaces + &$flag = null, + ) { + return "hello"; + } + + static function staticmethod() {} + + public static function ellipsizeMiddle( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = " … ", // the spaces are non-breaking spaces + &$flag = null, + ) { + $string = trim($string); + } + + public static function hello_2() {} + + public static function hello_3($var = 1) {} + + public static function hello_4( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ) {} + + public static function hello_5( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ): ?string {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + $other_var = 2, + $other_other_other_var = 3, + ): ?string {} + + public static function newlines( + $var = 1, + + $other_var = 2, + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + + $other_var = 2, + ) {} +} + +================================================================================ +`; diff --git a/tests/brace-style/classes.php b/tests/brace-style/classes.php new file mode 100644 index 000000000..9748e5e80 --- /dev/null +++ b/tests/brace-style/classes.php @@ -0,0 +1,33 @@ +getValue() . "\n"; + } +} + +class Foo +{ + function hello() + { + return "hello"; + } + + function hello_1($arg) + { + return "hello"; + } + + function bar($arg = '') + { + echo "In bar(); argument was '$arg'.
\n"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() + { + return "hello"; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName(): ?string + { + return "hello"; + } + + function reeeeeeeeeeaaaaaaaallllllllyyyyyy_llloooooooonnnnnnggggg($soooooooooooo_looooooooonnnng, $eeeeeeeeevvveeeeeeeennnn_loooooonnngggeeeerrrr) { + return $soooooooooooo_looooooooonnnng; + } + + function type_hinting_test(array $array_test, callable $callable_test, bool $bool_test, float $float_test, iterable $iterable_test, int $int_test, string $string_test = '') { + return $int_test; + } + + function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongNameOther( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = ' … ', // the spaces are non-breaking spaces + &$flag = null + ) { + return "hello"; + } + + static function staticmethod() {} + + public static function ellipsizeMiddle( + $string, + $max_length, + // @codingStandardsIgnoreLine + $ellipses = ' … ', // the spaces are non-breaking spaces + &$flag = null + ) { + $string = trim($string); + } + + public static function hello_2() {} + + public static function hello_3($var = 1) {} + + public static function hello_4($var = 1, $other_var = 2, $other_other_other_var = 3) {} + + public static function hello_5($var = 1, $other_var = 2, $other_other_other_var = 3): ?string {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName() {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1, $other_var = 2, $other_other_other_var = 3) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName($var = 1, $other_var = 2, $other_other_other_var = 3) : ?string {} + + public static function newlines( + $var = 1, + + $other_var = 2 + ) {} + + public static function veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongName( + $var = 1, + + $other_var = 2 + ) {} +} diff --git a/tests/break/__snapshots__/jsfmt.spec.js.snap b/tests/break/__snapshots__/jsfmt.spec.mjs.snap similarity index 62% rename from tests/break/__snapshots__/jsfmt.spec.js.snap rename to tests/break/__snapshots__/jsfmt.spec.mjs.snap index 8572e1de8..dfb59106b 100644 --- a/tests/break/__snapshots__/jsfmt.spec.js.snap +++ b/tests/break/__snapshots__/jsfmt.spec.mjs.snap @@ -1,6 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`break.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== func(); -func( $arg1,$arg2 ,$arg3, $arg4 , $arg5 ); -$foo -> bar ( $arg1,$arg2 ,$arg3, $arg4 , $arg5 ) ; -Foo :: bar( $arg1,$arg2 ,$arg3, $arg4 , $arg5 ) ; - -$db->Execute($sql, [ - $foo, - $bar, - $foobar, - $somewhatLongParameter, - $somewhatLongParameterX, - $somewhatLongParameterXYZ -]); - -$db->Execute([ - $foo, - $bar, - $foobar, - $somewhatLongParameter, - $somewhatLongParameterX, - $somewhatLongParameterXYZ -], $sql); - -$app->get('/hello/{name}', function ($name) use ($app) { - return 'Hello ' . $app->escape($name); -}); - -$this->something->method($argument, $this->more->stuff( - $this->even->more->things->complicatedMethod() -)); - -$this->something->method( - $this->more->stuff($this->even->more->things->complicatedMethod()), - $argument -); - -$this->something->method( - $argument, - $otherArgument, - array("foo" => "bar", "baz" => "buzz"), - $this->even->more->things->complicatedMethod() -); - -$this->files->put( - $path, $this->expiration($minutes).serialize($value), true -); - -tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) { - $this->put($key, $newValue, $raw['time']); -}); - -$expire = substr( - $contents = $this->files->get($path, true), 0, 10 -); -$this->app->singleton('session', function ($app) { - return new SessionManager($app); -}); - -$this->filter([ - new MergeValue(['First', 'Second']), - 'Taylor', - 'Mohamed', - $this->mergeWhen(false, ['Adam', 'Matt']), - 'Jeffrey', - new MergeValue(['Abigail', 'Lydia']), -]); - -$this->assertEquals([ - 'First', 'Second', 'Taylor', 'Mohamed', 'Jeffrey', 'Abigail', 'Lydia', -], $results); - -$this->assertEquals(['First'], $results); - -$some->other->thing(array( - 'foo' => 'bar', - 'buzz' => $this->is->nested(array( - 'complex' => 'stuff', - 'foo' => 'bar', - 'buzz' => 'bazz' - )) -)); - -$some->other->thing(array( - 'foo' => 'bar', - 'buzz' => $this->is->nested(array(12, 34, 45, 67, 89)) -), array( - 11323123, - 1231, 13231233243, 324234234 -)); - -$foo->bar( - $arg1, - function ($arg2) use ($var1) { - // body - }, - $arg3 -); - -$packages = array_merge( - idx($composer, 'require', []), - idx($composer, 'require-dev', []) -); - -if ($parity != array_reduce($r,function ($acc, $tmp) {return $acc ^ $tmp;},0)) { - return []; -} - -implode( - ', ', - array_map( - function ($f) { - return $f; - }, - array_merge($arr1, $arr2, $arr3) - ) -); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -func(); -func($arg1, $arg2, $arg3, $arg4, $arg5); -$foo->bar($arg1, $arg2, $arg3, $arg4, $arg5); -Foo::bar($arg1, $arg2, $arg3, $arg4, $arg5); - -$db->Execute($sql, [ - $foo, - $bar, - $foobar, - $somewhatLongParameter, - $somewhatLongParameterX, - $somewhatLongParameterXYZ -]); - -$db->Execute( - [ - $foo, - $bar, - $foobar, - $somewhatLongParameter, - $somewhatLongParameterX, - $somewhatLongParameterXYZ - ], - $sql -); - -$app->get('/hello/{name}', function ($name) use ($app) { - return 'Hello ' . $app->escape($name); -}); - -$this->something->method( - $argument, - $this->more->stuff($this->even->more->things->complicatedMethod()) -); - -$this->something->method( - $this->more->stuff($this->even->more->things->complicatedMethod()), - $argument -); - -$this->something->method( - $argument, - $otherArgument, - array("foo" => "bar", "baz" => "buzz"), - $this->even->more->things->complicatedMethod() -); - -$this->files->put($path, $this->expiration($minutes) . serialize($value), true); - -tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) { - $this->put($key, $newValue, $raw['time']); -}); - -$expire = substr($contents = $this->files->get($path, true), 0, 10); -$this->app->singleton('session', function ($app) { - return new SessionManager($app); -}); - -$this->filter([ - new MergeValue(['First', 'Second']), - 'Taylor', - 'Mohamed', - $this->mergeWhen(false, ['Adam', 'Matt']), - 'Jeffrey', - new MergeValue(['Abigail', 'Lydia']) -]); - -$this->assertEquals( - ['First', 'Second', 'Taylor', 'Mohamed', 'Jeffrey', 'Abigail', 'Lydia'], - $results -); - -$this->assertEquals(['First'], $results); - -$some->other->thing(array( - 'foo' => 'bar', - 'buzz' => - $this->is->nested(array( - 'complex' => 'stuff', - 'foo' => 'bar', - 'buzz' => 'bazz' - )) -)); - -$some->other->thing( - array( - 'foo' => 'bar', - 'buzz' => $this->is->nested(array(12, 34, 45, 67, 89)) - ), - array(11323123, 1231, 13231233243, 324234234) -); - -$foo->bar( - $arg1, - function ($arg2) use ($var1) { - // body - }, - $arg3 -); - -$packages = array_merge( - idx($composer, 'require', []), - idx($composer, 'require-dev', []) -); - -if ( - $parity != - array_reduce( - $r, - function ($acc, $tmp) { - return $acc ^ $tmp; - }, - 0 - ) -) { - return []; -} - -implode( - ', ', - array_map(function ($f) { - return $f; - }, array_merge($arr1, $arr2, $arr3)) -); - -`; diff --git a/tests/call/__snapshots__/jsfmt.spec.mjs.snap b/tests/call/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..be49c6300 --- /dev/null +++ b/tests/call/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,764 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`call.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +func(); +func( $arg1,$arg2 ,$arg3, $arg4 , $arg5 ); +$foo -> bar ( $arg1,$arg2 ,$arg3, $arg4 , $arg5 ) ; +Foo :: bar( $arg1,$arg2 ,$arg3, $arg4 , $arg5 ) ; + +$db->Execute($sql, [ + $foo, + $bar, + $foobar, + $somewhatLongParameter, + $somewhatLongParameterX, + $somewhatLongParameterXYZ +]); + +$db->Execute([ + $foo, + $bar, + $foobar, + $somewhatLongParameter, + $somewhatLongParameterX, + $somewhatLongParameterXYZ +], $sql); + +$app->get('/hello/{name}', function ($name) use ($app) { + return 'Hello ' . $app->escape($name); +}); + +$this->something->method($argument, $this->more->stuff( + $this->even->more->things->complicatedMethod() +)); + +$this->something->method( + $this->more->stuff($this->even->more->things->complicatedMethod()), + $argument +); + +$this->something->method( + $argument, + $otherArgument, + array("foo" => "bar", "baz" => "buzz"), + $this->even->more->things->complicatedMethod() +); + +$this->files->put( + $path, $this->expiration($minutes).serialize($value), true +); + +tap(((int) $raw['data']) + $value, function ($newValue) use ($key, $raw) { + $this->put($key, $newValue, $raw['time']); +}); + +$expire = substr( + $contents = $this->files->get($path, true), 0, 10 +); +$this->app->singleton('session', function ($app) { + return new SessionManager($app); +}); + +$this->filter([ + new MergeValue(['First', 'Second']), + 'Taylor', + 'Mohamed', + $this->mergeWhen(false, ['Adam', 'Matt']), + 'Jeffrey', + new MergeValue(['Abigail', 'Lydia']), +]); + +$this->assertEquals([ + 'First', 'Second', 'Taylor', 'Mohamed', 'Jeffrey', 'Abigail', 'Lydia', +], $results); + +$this->assertEquals(['First'], $results); + +$some->other->thing(array( + 'foo' => 'bar', + 'buzz' => $this->is->nested(array( + 'complex' => 'stuff', + 'foo' => 'bar', + 'buzz' => 'bazz' + )) +)); + +$some->other->thing(array( + 'foo' => 'bar', + 'buzz' => $this->is->nested(array(12, 34, 45, 67, 89)) +), array( + 11323123, + 1231, 13231233243, 324234234 +)); + +$foo->bar( + $arg1, + function ($arg2) use ($var1) { + // body + }, + $arg3 +); + +$packages = array_merge( + idx($composer, 'require', []), + idx($composer, 'require-dev', []) +); + +if ($parity != array_reduce($r,function ($acc, $tmp) {return $acc ^ $tmp;},0)) { + return []; +} + +implode( + ', ', + array_map( + function ($f) { + return $f; + }, + array_merge($arr1, $arr2, $arr3) + ) +); + +call(function() { + return thing(); +}, 1 ? 2 : 3); + +call(function() { + return thing(); +}, something() ? someOtherThing() : somethingElse(true, 0)); + +call(function() { + return thing(); +}, something($longArgumentName, $anotherLongArgumentName) ? someOtherThing() : somethingElse(true, 0)); + +call(function() { + return thing(); +}, something($longArgumentName, $anotherLongArgumentName, $anotherLongArgumentName, $anotherLongArgumentName) ? someOtherThing() : somethingElse(true, 0)); + +array_map(function ($aligment) { + return 'row-' . $aligment . '-xs'; +}, is_array($attributes['alignment']) + ? $attributes['alignment'] + : explode(' ', $attributes['alignment']) +); + +call(' +string +string +string'); + +call( + ' +string +string +string'); + +call(' +string +string +string', $a); + +call($a, ' +string +string +string'); + +call(" +string +string +string"); + +call( + " +string +string +string"); + +call(" +string +string +string", $a); + +call($a, " +string +string +string"); + +$a->call(' +string +string +string'); + +$a->bar->call( + ' +string +string +string' +); + +$a->call(' +string +string +string')->call(' +string +string +string' +); + +$a->call($a, ' +string +string +string', $c)->call($a, ' +string +string +string', $c +); + +call("string $var string"); +call( + "string $var string" +); + +call("string +string +string +$var"); +call( +"string +string +string +$var" +); + +call(\`string $var string\`); +call( + \`string $var string\` +); + +call(\`string +string +string +$var\`); +call( +\`string +string +string +$var\` +); + +call(<<foo)(); +$var = ($this->foo())(); +$var = ($this->foo->bar)(); +$var = ($this->foo->bar())(); +$var = ($this->foo->bar->baz->foo->bar->baz)(); +$var = ($this->foo()->bar()->baz()->foo()->bar()->baz())(); +$var = ($this->foo()->bar()->baz()->foo()->bar()->baz)(); +$var = ($this['foo'])(); +$var = ($this['foo']['bar'])(); +$var = ($this::$foo)(); +$var = $var::foo()(); +$var = ($var::foo())(); +$var = ('test')(); +$var = (('test')()); +$var = (('test')())(); +$var = (('test')())->bar(); +$var = ((('test')())->bar)(); +$var = (['Foo', 'bar'])(); +$var = (['Foo', 'bar'])->bar(); +$var = ((['Foo', 'bar'])->bar)(); +$var = ($var->foo)()(); +$var = (($var->foo)())(); +$var = (($var->foo)()->bar)(); +$var = ((($var->foo)()->bar)()->baz)(); + +$obj = call('return new class($value) +{ + private $foo; + + public function __construct($foo) + { + $this->foo = $foo; + } + + /** + * @return mixed + */ + public function getFoo() + { + return $this->foo; + } + + /** + * @param mixed $foo + */ + public function setFoo($foo) + { + $this->foo = $foo; + } +};'); + +$callable = strlen(...); +$callable = $item->doSomething(...); +$callable = $item::doSomething(...); +$callable = Foo::doSomething(...); + +=====================================output===================================== +func(); +func($arg1, $arg2, $arg3, $arg4, $arg5); +$foo->bar($arg1, $arg2, $arg3, $arg4, $arg5); +Foo::bar($arg1, $arg2, $arg3, $arg4, $arg5); + +$db->Execute($sql, [ + $foo, + $bar, + $foobar, + $somewhatLongParameter, + $somewhatLongParameterX, + $somewhatLongParameterXYZ, +]); + +$db->Execute( + [ + $foo, + $bar, + $foobar, + $somewhatLongParameter, + $somewhatLongParameterX, + $somewhatLongParameterXYZ, + ], + $sql, +); + +$app->get("/hello/{name}", function ($name) use ($app) { + return "Hello " . $app->escape($name); +}); + +$this->something->method( + $argument, + $this->more->stuff($this->even->more->things->complicatedMethod()), +); + +$this->something->method( + $this->more->stuff($this->even->more->things->complicatedMethod()), + $argument, +); + +$this->something->method( + $argument, + $otherArgument, + ["foo" => "bar", "baz" => "buzz"], + $this->even->more->things->complicatedMethod(), +); + +$this->files->put($path, $this->expiration($minutes) . serialize($value), true); + +tap(((int) $raw["data"]) + $value, function ($newValue) use ($key, $raw) { + $this->put($key, $newValue, $raw["time"]); +}); + +$expire = substr($contents = $this->files->get($path, true), 0, 10); +$this->app->singleton("session", function ($app) { + return new SessionManager($app); +}); + +$this->filter([ + new MergeValue(["First", "Second"]), + "Taylor", + "Mohamed", + $this->mergeWhen(false, ["Adam", "Matt"]), + "Jeffrey", + new MergeValue(["Abigail", "Lydia"]), +]); + +$this->assertEquals( + ["First", "Second", "Taylor", "Mohamed", "Jeffrey", "Abigail", "Lydia"], + $results, +); + +$this->assertEquals(["First"], $results); + +$some->other->thing([ + "foo" => "bar", + "buzz" => $this->is->nested([ + "complex" => "stuff", + "foo" => "bar", + "buzz" => "bazz", + ]), +]); + +$some->other->thing( + [ + "foo" => "bar", + "buzz" => $this->is->nested([12, 34, 45, 67, 89]), + ], + [11323123, 1231, 13231233243, 324234234], +); + +$foo->bar( + $arg1, + function ($arg2) use ($var1) { + // body + }, + $arg3, +); + +$packages = array_merge( + idx($composer, "require", []), + idx($composer, "require-dev", []), +); + +if ( + $parity != + array_reduce( + $r, + function ($acc, $tmp) { + return $acc ^ $tmp; + }, + 0, + ) +) { + return []; +} + +implode( + ", ", + array_map(function ($f) { + return $f; + }, array_merge($arr1, $arr2, $arr3)), +); + +call( + function () { + return thing(); + }, + 1 ? 2 : 3, +); + +call( + function () { + return thing(); + }, + something() ? someOtherThing() : somethingElse(true, 0), +); + +call( + function () { + return thing(); + }, + something($longArgumentName, $anotherLongArgumentName) + ? someOtherThing() + : somethingElse(true, 0), +); + +call( + function () { + return thing(); + }, + something( + $longArgumentName, + $anotherLongArgumentName, + $anotherLongArgumentName, + $anotherLongArgumentName, + ) + ? someOtherThing() + : somethingElse(true, 0), +); + +array_map( + function ($aligment) { + return "row-" . $aligment . "-xs"; + }, + is_array($attributes["alignment"]) + ? $attributes["alignment"] + : explode(" ", $attributes["alignment"]), +); + +call(' +string +string +string'); + +call( + ' +string +string +string', +); + +call( + ' +string +string +string', + $a, +); + +call( + $a, + ' +string +string +string', +); + +call(" +string +string +string"); + +call( + " +string +string +string", +); + +call( + " +string +string +string", + $a, +); + +call( + $a, + " +string +string +string", +); + +$a->call(' +string +string +string'); + +$a->bar->call( + ' +string +string +string', +); + +$a->call(' +string +string +string')->call(' +string +string +string'); + +$a->call( + $a, + ' +string +string +string', + $c, +)->call( + $a, + ' +string +string +string', + $c, +); + +call("string $var string"); +call("string $var string"); + +call("string +string +string +$var"); +call( + "string +string +string +$var", +); + +call(\`string $var string\`); +call(\`string $var string\`); + +call(\`string +string +string +$var\`); +call( + \`string +string +string +$var\`, +); + +call( + <<foo)(); +$var = $this->foo()(); +$var = ($this->foo->bar)(); +$var = $this->foo->bar()(); +$var = ($this->foo->bar->baz->foo->bar->baz)(); +$var = $this->foo()->bar()->baz()->foo()->bar()->baz()(); +$var = ($this->foo()->bar()->baz()->foo()->bar()->baz)(); +$var = $this["foo"](); +$var = $this["foo"]["bar"](); +$var = ($this::$foo)(); +$var = $var::foo()(); +$var = $var::foo()(); +$var = ("test")(); +$var = ("test")(); +$var = ("test")()(); +$var = ("test")()->bar(); +$var = (("test")()->bar)(); +$var = (["Foo", "bar"])(); +$var = (["Foo", "bar"])->bar(); +$var = ((["Foo", "bar"])->bar)(); +$var = ($var->foo)()(); +$var = ($var->foo)()(); +$var = (($var->foo)()->bar)(); +$var = ((($var->foo)()->bar)()->baz)(); + +$obj = call('return new class($value) +{ + private $foo; + + public function __construct($foo) + { + $this->foo = $foo; + } + + /** + * @return mixed + */ + public function getFoo() + { + return $this->foo; + } + + /** + * @param mixed $foo + */ + public function setFoo($foo) + { + $this->foo = $foo; + } +};'); + +$callable = strlen(...); +$callable = $item->doSomething(...); +$callable = $item::doSomething(...); +$callable = Foo::doSomething(...); + +================================================================================ +`; diff --git a/tests/call/call.php b/tests/call/call.php index 4fc87b619..6e2f5a11d 100644 --- a/tests/call/call.php +++ b/tests/call/call.php @@ -3,6 +3,7 @@ func($a, $b, $c); func(...$a); func($a, ...$b); +func(...$a, ...$b); $foo->func(); func( $arg1,$arg2 ,$arg3, $arg4 , $arg5 ); $foo -> bar ( $arg1,$arg2 ,$arg3, $arg4 , $arg5 ) ; @@ -119,3 +120,230 @@ function ($f) { array_merge($arr1, $arr2, $arr3) ) ); + +call(function() { + return thing(); +}, 1 ? 2 : 3); + +call(function() { + return thing(); +}, something() ? someOtherThing() : somethingElse(true, 0)); + +call(function() { + return thing(); +}, something($longArgumentName, $anotherLongArgumentName) ? someOtherThing() : somethingElse(true, 0)); + +call(function() { + return thing(); +}, something($longArgumentName, $anotherLongArgumentName, $anotherLongArgumentName, $anotherLongArgumentName) ? someOtherThing() : somethingElse(true, 0)); + +array_map(function ($aligment) { + return 'row-' . $aligment . '-xs'; +}, is_array($attributes['alignment']) + ? $attributes['alignment'] + : explode(' ', $attributes['alignment']) +); + +call(' +string +string +string'); + +call( + ' +string +string +string'); + +call(' +string +string +string', $a); + +call($a, ' +string +string +string'); + +call(" +string +string +string"); + +call( + " +string +string +string"); + +call(" +string +string +string", $a); + +call($a, " +string +string +string"); + +$a->call(' +string +string +string'); + +$a->bar->call( + ' +string +string +string' +); + +$a->call(' +string +string +string')->call(' +string +string +string' +); + +$a->call($a, ' +string +string +string', $c)->call($a, ' +string +string +string', $c +); + +call("string $var string"); +call( + "string $var string" +); + +call("string +string +string +$var"); +call( +"string +string +string +$var" +); + +call(`string $var string`); +call( + `string $var string` +); + +call(`string +string +string +$var`); +call( +`string +string +string +$var` +); + +call(<<foo)(); +$var = ($this->foo())(); +$var = ($this->foo->bar)(); +$var = ($this->foo->bar())(); +$var = ($this->foo->bar->baz->foo->bar->baz)(); +$var = ($this->foo()->bar()->baz()->foo()->bar()->baz())(); +$var = ($this->foo()->bar()->baz()->foo()->bar()->baz)(); +$var = ($this['foo'])(); +$var = ($this['foo']['bar'])(); +$var = ($this::$foo)(); +$var = $var::foo()(); +$var = ($var::foo())(); +$var = ('test')(); +$var = (('test')()); +$var = (('test')())(); +$var = (('test')())->bar(); +$var = ((('test')())->bar)(); +$var = (['Foo', 'bar'])(); +$var = (['Foo', 'bar'])->bar(); +$var = ((['Foo', 'bar'])->bar)(); +$var = ($var->foo)()(); +$var = (($var->foo)())(); +$var = (($var->foo)()->bar)(); +$var = ((($var->foo)()->bar)()->baz)(); + +$obj = call('return new class($value) +{ + private $foo; + + public function __construct($foo) + { + $this->foo = $foo; + } + + /** + * @return mixed + */ + public function getFoo() + { + return $this->foo; + } + + /** + * @param mixed $foo + */ + public function setFoo($foo) + { + $this->foo = $foo; + } +};'); + +$callable = strlen(...); +$callable = $item->doSomething(...); +$callable = $item::doSomething(...); +$callable = Foo::doSomething(...); diff --git a/tests/call/jsfmt.spec.js b/tests/call/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/call/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/call/jsfmt.spec.mjs b/tests/call/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/call/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/case/__snapshots__/jsfmt.spec.js.snap b/tests/case/__snapshots__/jsfmt.spec.mjs.snap similarity index 67% rename from tests/case/__snapshots__/jsfmt.spec.js.snap rename to tests/case/__snapshots__/jsfmt.spec.mjs.snap index c35374cba..8b25cbdaf 100644 --- a/tests/case/__snapshots__/jsfmt.spec.js.snap +++ b/tests/case/__snapshots__/jsfmt.spec.mjs.snap @@ -1,6 +1,11 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`case.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; +$var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = (int) $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; + +$this->reallyLong->testPropertyName = (bool) 'a' . + $someOtherTest . + 'n' . + $oneLastOneToMakeLineLong; + +$var = (array) ["test"] + ["test"]; +$var = (array) ["very-very-very-very-very-very-very-long-value-1", "very-very-very-very-very-very-very-long-value-2"] + ["test"]; +$var = (int) $veryVeryVeryVeryVeryVeryVeryVeryLongVariable + (int) $veryVeryVeryVeryVeryVeryVeryVeryLongVariable + (int) $veryVeryVeryVeryVeryVeryVeryVeryLongVariable; +$var = (int) ($veryVeryVeryVeryVeryVeryVeryVeryLongVariable + $veryVeryVeryVeryVeryVeryVeryVeryLongVariable + $veryVeryVeryVeryVeryVeryVeryVeryLongVariable); + +$category_color = (int) get_field(Category_Meta::COLOR, 'category_' . $term_id) ?: + 'gold'; + +$var = (int) $veryVeryVeryVeryVeryVeryVeryVeryLongVariable ? $veryVeryVeryVeryVeryVeryVeryVeryLongVariable : $veryVeryVeryVeryVeryVeryVeryVeryLongVariable; +$var = (int) ($veryVeryVeryVeryVeryVeryVeryVeryLongVariable ? $veryVeryVeryVeryVeryVeryVeryVeryLongVariable : $veryVeryVeryVeryVeryVeryVeryVeryLongVariable); + +$str = (bool) << (bool) $var, + 'bar' => (bool) $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable +]; + +$var = + $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; + +$var = (int) + $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; + +((object) ($var ? $var : $var))->call(); +((bool) $veryVeryVeryVeryVeryLongVariable ? $veryVeryVeryVeryVeryLongVariable : $veryVeryVeryVeryVeryLongVariable)->call(); +((object) ($veryVeryVeryVeryVeryLongVariable ? $veryVeryVeryVeryVeryLongVariable : $veryVeryVeryVeryVeryLongVariable))->call(); + + +((bool) $veryVeryVeryVeryVeryLongVariable ?: $veryVeryVeryVeryVeryLongVariable ?: $veryVeryVeryVeryVeryLongVariable)->call(); +((object) ($veryVeryVeryVeryVeryLongVariable ?: $veryVeryVeryVeryVeryLongVariable ?: $veryVeryVeryVeryVeryLongVariable))->call(); + +function foo() +{ + return (int) $var ?: $var ?: $var; +} + +function bar() +{ + return (int) $veryVeryVeryVeryVeryLongVariable ?: $veryVeryVeryVeryVeryLongVariable ?: $veryVeryVeryVeryVeryLongVariable; +} + + +$var = (string) $this->databasePath ?: $this->basePath . DIRECTORY_SEPARATOR . 'database'; +$var = $this->databasePath ?: (string) $this->basePath . DIRECTORY_SEPARATOR . 'database'; +$var = (string) ($this->databasePath ?: $this->basePath . DIRECTORY_SEPARATOR . 'database'); + +print (bool) $someOtherReallyReallyLongVariable ?: + (bool) $someOtherReallyReallyLongVariable ?: + (bool) $someOtherReallyReallyLongVariable ?: + 'string'; + +=====================================output===================================== +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; +$var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = + (int) $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; + +$this->reallyLong->testPropertyName = + (bool) "a" . $someOtherTest . "n" . $oneLastOneToMakeLineLong; + +$var = (array) ["test"] + ["test"]; +$var = (array) [ + "very-very-very-very-very-very-very-long-value-1", + "very-very-very-very-very-very-very-long-value-2", +] + ["test"]; +$var = + (int) $veryVeryVeryVeryVeryVeryVeryVeryLongVariable + + (int) $veryVeryVeryVeryVeryVeryVeryVeryLongVariable + + (int) $veryVeryVeryVeryVeryVeryVeryVeryLongVariable; +$var = + (int) ($veryVeryVeryVeryVeryVeryVeryVeryLongVariable + + $veryVeryVeryVeryVeryVeryVeryVeryLongVariable + + $veryVeryVeryVeryVeryVeryVeryVeryLongVariable); + +$category_color = + (int) get_field(Category_Meta::COLOR, "category_" . $term_id) ?: "gold"; + +$var = (int) $veryVeryVeryVeryVeryVeryVeryVeryLongVariable + ? $veryVeryVeryVeryVeryVeryVeryVeryLongVariable + : $veryVeryVeryVeryVeryVeryVeryVeryLongVariable; +$var = (int) ($veryVeryVeryVeryVeryVeryVeryVeryLongVariable + ? $veryVeryVeryVeryVeryVeryVeryVeryLongVariable + : $veryVeryVeryVeryVeryVeryVeryVeryLongVariable); + +$str = (bool) << (bool) $var, + "bar" => (bool) $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable, +]; + +$var = + $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; + +$var = + (int) $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; + +((object) ($var ? $var : $var))->call(); +((bool) $veryVeryVeryVeryVeryLongVariable + ? $veryVeryVeryVeryVeryLongVariable + : $veryVeryVeryVeryVeryLongVariable +)->call(); +((object) ($veryVeryVeryVeryVeryLongVariable + ? $veryVeryVeryVeryVeryLongVariable + : $veryVeryVeryVeryVeryLongVariable +))->call(); + +( + (bool) $veryVeryVeryVeryVeryLongVariable ?: + $veryVeryVeryVeryVeryLongVariable ?: + $veryVeryVeryVeryVeryLongVariable +)->call(); +((object) ( + $veryVeryVeryVeryVeryLongVariable ?: + $veryVeryVeryVeryVeryLongVariable ?: + $veryVeryVeryVeryVeryLongVariable +))->call(); + +function foo() +{ + return (int) $var ?: $var ?: $var; +} + +function bar() +{ + return (int) $veryVeryVeryVeryVeryLongVariable ?: + $veryVeryVeryVeryVeryLongVariable ?: + $veryVeryVeryVeryVeryLongVariable; +} + +$var = + (string) $this->databasePath ?: + $this->basePath . DIRECTORY_SEPARATOR . "database"; +$var = + $this->databasePath ?: + (string) $this->basePath . DIRECTORY_SEPARATOR . "database"; +$var = + (string) ($this->databasePath ?: + $this->basePath . DIRECTORY_SEPARATOR . "database"); + +print (bool) $someOtherReallyReallyLongVariable ?: + (bool) $someOtherReallyReallyLongVariable ?: + (bool) $someOtherReallyReallyLongVariable ?: + "string"; + +================================================================================ +`; + +exports[`singe.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; +$var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = (int) $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; + +$this->reallyLong->testPropertyName = (bool) 'a' . + $someOtherTest . + 'n' . + $oneLastOneToMakeLineLong; + +$var = (array) ["test"] + ["test"]; +$var = (array) ["very-very-very-very-very-very-very-long-value-1", "very-very-very-very-very-very-very-long-value-2"] + ["test"]; +$var = (int) $veryVeryVeryVeryVeryVeryVeryVeryLongVariable + (int) $veryVeryVeryVeryVeryVeryVeryVeryLongVariable + (int) $veryVeryVeryVeryVeryVeryVeryVeryLongVariable; +$var = (int) ($veryVeryVeryVeryVeryVeryVeryVeryLongVariable + $veryVeryVeryVeryVeryVeryVeryVeryLongVariable + $veryVeryVeryVeryVeryVeryVeryVeryLongVariable); + +$category_color = (int) get_field(Category_Meta::COLOR, 'category_' . $term_id) ?: + 'gold'; + +$var = (int) $veryVeryVeryVeryVeryVeryVeryVeryLongVariable ? $veryVeryVeryVeryVeryVeryVeryVeryLongVariable : $veryVeryVeryVeryVeryVeryVeryVeryLongVariable; +$var = (int) ($veryVeryVeryVeryVeryVeryVeryVeryLongVariable ? $veryVeryVeryVeryVeryVeryVeryVeryLongVariable : $veryVeryVeryVeryVeryVeryVeryVeryLongVariable); + +$str = (bool) << (bool) $var, + 'bar' => (bool) $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable +]; + +$var = + $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; + +$var = (int) + $var->aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; + +((object) ($var ? $var : $var))->call(); +((bool) $veryVeryVeryVeryVeryLongVariable ? $veryVeryVeryVeryVeryLongVariable : $veryVeryVeryVeryVeryLongVariable)->call(); +((object) ($veryVeryVeryVeryVeryLongVariable ? $veryVeryVeryVeryVeryLongVariable : $veryVeryVeryVeryVeryLongVariable))->call(); + + +((bool) $veryVeryVeryVeryVeryLongVariable ?: $veryVeryVeryVeryVeryLongVariable ?: $veryVeryVeryVeryVeryLongVariable)->call(); +((object) ($veryVeryVeryVeryVeryLongVariable ?: $veryVeryVeryVeryVeryLongVariable ?: $veryVeryVeryVeryVeryLongVariable))->call(); + +function foo() +{ + return (int) $var ?: $var ?: $var; +} + +function bar() +{ + return (int) $veryVeryVeryVeryVeryLongVariable ?: $veryVeryVeryVeryVeryLongVariable ?: $veryVeryVeryVeryVeryLongVariable; +} + + +$var = (string) $this->databasePath ?: $this->basePath . DIRECTORY_SEPARATOR . 'database'; +$var = $this->databasePath ?: (string) $this->basePath . DIRECTORY_SEPARATOR . 'database'; +$var = (string) ($this->databasePath ?: $this->basePath . DIRECTORY_SEPARATOR . 'database'); + +print (bool) $someOtherReallyReallyLongVariable ?: + (bool) $someOtherReallyReallyLongVariable ?: + (bool) $someOtherReallyReallyLongVariable ?: + 'string'; diff --git a/tests/cast/jsfmt.spec.js b/tests/cast/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/cast/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/cast/jsfmt.spec.mjs b/tests/cast/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/cast/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/cast/singe.php b/tests/cast/singe.php new file mode 100644 index 000000000..0de6068fa --- /dev/null +++ b/tests/cast/singe.php @@ -0,0 +1,3 @@ +logger; - } - - public function setLogger(Logger $logger) { - $this->logger = $logger; - } -} - -$app = new Application; -$app->setLogger(new class implements Logger { - public function log(string $msg) { - echo $msg; - } -}); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -logger; - } - - public function setLogger(Logger $logger) - { - $this->logger = $logger; - } -} - -$app = new Application(); -$app->setLogger( - new class implements Logger - { - public function log(string $msg) - { - echo $msg; - } - } -); - -`; - -exports[`class.php 1`] = ` -other = $test_string; - $this->current_version = $current_version ?: new Content_Version_Model(); - self::$staticTest = $test_int; - } - - public static function test_static_constructor($test, $test_int, $test_string) { - $model = new self($test, $test_int, $test_string); - $model = new self($really_really_really_really_really_really_really_really_long_array, $test_int, $test_string); - return $model; - } - - public function test_pass_by_reference(&$test) - { - $test + 1; - } - - /** - * This is a function - */ - private function hi($input) { - $test = 1; - - //testing line spacing - $other_test = 2; - - - $one_more_test = 3; - return $input . $this->test; - - } - - public function reallyReallyReallyReallyReallyReallyReallyLongMethodName($input, $otherInput = 1) { - return true; - } - - // doc test - public static function testStaticFunction($input) { - return self::$staticTest[0]; - } - - public function returnTypeTest() : string - { - return 'hi'; - } - - final public static function bar() - { - // Nothing - } - - abstract protected function zim(); - - public function method(iterable $iterable): array { - // Parameter broadened and return type narrowed. - } - - public function method1() { return 'hi'; } - - public function method2() { - return 'hi'; } - - public function method3() - { return 'hi'; } - - public function testReturn(?string $name): ?string - { - return $name; - } - - public function swap(&$left, &$right): void - { - if ($left === $right) { - return; - } - - $tmp = $left; - $left = $right; - $right = $tmp; - } - - public function test(object $obj): object - { - return new SplQueue(); - } - - public function longLongAnotherFunction( - string $foo, - string $bar, - int $baz - ): string { - return 'foo'; - } - - public function longLongAnotherFunctionOther( - string $foo, - string $bar, - int $baz - ) { - return 'foo'; - } - - public function testReturnTypeDeclaration() : object - { - return new SplQueue(); - } - - public function testReturnTypeDeclarationOther() - : - object - { - return new SplQueue(); - } -} - -$this->something->method($argument, $this->more->stuff($this->even->more->things->complicatedMethod())); - -class A {} - -$someVar = new ReaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalyLongClassName(); - -class ClassName - -extends ParentClass - -implements \\ArrayAccess, \\Countable - -{ - - // constants, properties, methods - -} - -class FooBar { public $property; public $property2; public function method() {} public function method2() {} } - -class FooBarFoo -{ - public function fooBarBaz ( $x,$y ,$z, $foo , $bar ) { /* Comment */ } -} - -class ClassName extends ParentClass implements InterfaceClass {} - -class ClassName extends ParentClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {} - -class ClassName extends ParentClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {} - -class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements InterfaceClass {} - -class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements InterfaceClass {} - -class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {} - -class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {} - -class ClassName extends ParentClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1,VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 {} - -class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1,VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 {} - -class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1,VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 {} - -class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 extends ParentClass implements InterfaceClass {} - -class Custom_Plugin_NotificationPlaceholderSource extends Notification_Manager_DefaultPlaceholderSource {} - -class field extends \\models\\base -{ - protected function pre_save( $input, $fields ) { - $input['configs'] = json_encode( array_merge( $configs, $field_type->process_field_config_from_user( $input['definition'] ) ) ); - unset( $input['definition'] ); - } -} - -class test { - public function test_method() { - $customer = (object) [ 'name' => 'Bob' ]; - $job = (object) [ 'customer' => $customer ]; - - return "The customer for that job, {$job->customer->name} has an error that shows up after the line gets waaaaay toooo long."; - } -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -other = $test_string; - $this->current_version = $current_version - ?: new Content_Version_Model(); - self::$staticTest = $test_int; - } - - public static function test_static_constructor( - $test, - $test_int, - $test_string - ) { - $model = new self($test, $test_int, $test_string); - $model = new self( - $really_really_really_really_really_really_really_really_long_array, - $test_int, - $test_string - ); - return $model; - } - - public function test_pass_by_reference(&$test) - { - $test + 1; - } - - /** - * This is a function - */ - private function hi($input) - { - $test = 1; - - //testing line spacing - $other_test = 2; - - $one_more_test = 3; - return $input . $this->test; - } - - public function reallyReallyReallyReallyReallyReallyReallyLongMethodName( - $input, - $otherInput = 1 - ) { - return true; - } - - // doc test - public static function testStaticFunction($input) - { - return self::$staticTest[0]; - } - - public function returnTypeTest(): string - { - return 'hi'; - } - - final public static function bar() - { - // Nothing - } - - abstract protected function zim(); - - public function method(iterable $iterable): array - { - // Parameter broadened and return type narrowed. - } - - public function method1() - { - return 'hi'; - } - - public function method2() - { - return 'hi'; - } - - public function method3() - { - return 'hi'; - } - - public function testReturn(?string $name): ?string - { - return $name; - } - - public function swap(&$left, &$right): void - { - if ($left === $right) { - return; - } - - $tmp = $left; - $left = $right; - $right = $tmp; - } - - public function test(object $obj): object - { - return new SplQueue(); - } - - public function longLongAnotherFunction( - string $foo, - string $bar, - int $baz - ): string { - return 'foo'; - } - - public function longLongAnotherFunctionOther( - string $foo, - string $bar, - int $baz - ) { - return 'foo'; - } - - public function testReturnTypeDeclaration(): object - { - return new SplQueue(); - } - - public function testReturnTypeDeclarationOther(): object - { - return new SplQueue(); - } -} - -$this->something->method( - $argument, - $this->more->stuff($this->even->more->things->complicatedMethod()) -); - -class A -{ - -} - -$someVar = new ReaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalyLongClassName(); - -class ClassName extends ParentClass implements \\ArrayAccess, \\Countable -{ - // constants, properties, methods -} - -class FooBar -{ - public $property; - public $property2; - public function method() - { - - } - public function method2() - { - - } -} - -class FooBarFoo -{ - public function fooBarBaz($x, $y, $z, $foo, $bar) - { - /* Comment */ - } -} - -class ClassName extends ParentClass implements InterfaceClass -{ - -} - -class ClassName extends ParentClass - implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 -{ - -} - -class ClassName extends ParentClass - implements - VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 -{ - -} - -class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 - implements InterfaceClass -{ - -} - -class ClassName - extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 - implements InterfaceClass -{ - -} - -class ClassName - extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 - implements VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 -{ - -} - -class ClassName - extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 - implements - VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 -{ - -} - -class ClassName extends ParentClass - implements - VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1, - VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, - VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 -{ - -} - -class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 - implements - VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1, - VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, - VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 -{ - -} - -class ClassName - extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 - implements - VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1, - VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, - VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 -{ - -} - -class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 - extends ParentClass - implements InterfaceClass -{ - -} - -class Custom_Plugin_NotificationPlaceholderSource - extends Notification_Manager_DefaultPlaceholderSource -{ - -} - -class field extends \\models\\base -{ - protected function pre_save($input, $fields) - { - $input['configs'] = json_encode( - array_merge( - $configs, - $field_type->process_field_config_from_user( - $input['definition'] - ) - ) - ); - unset($input['definition']); - } -} - -class test -{ - public function test_method() - { - $customer = (object) ['name' => 'Bob']; - $job = (object) ['customer' => $customer]; - - return "The customer for that job, {$job->customer->name} has an error that shows up after the line gets waaaaay toooo long."; - } -} - -`; diff --git a/tests/class/__snapshots__/jsfmt.spec.mjs.snap b/tests/class/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..6fff7326e --- /dev/null +++ b/tests/class/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,1427 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`anonymous.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +logger; + } + + public function setLogger(Logger $logger) { + $this->logger = $logger; + } +} + +$app = new Application; +$app->setLogger(new class implements Logger { + public function log(string $msg) { + echo $msg; + } +}); +$app->setLogger(new class { + public function log($msg) + { + echo $msg; + } +}); + +var_dump(new class(10) extends SomeClass implements SomeInterface { + private $num; + + public function __construct($num) + { + $this->num = $num; + } + + use SomeTrait; +}); + +class Outer +{ + private $prop = 1; + protected $prop2 = 2; + + protected function func1() + { + return 3; + } + + public function func2() + { + return new class($this->prop) extends Outer { + private $prop3; + + public function __construct($prop) + { + $this->prop3 = $prop; + } + + public function func3() + { + return $this->prop2 + $this->prop3 + $this->func1(); + } + }; + } +} + +echo get_class(new class {}); +$class = new class {}; +$class = new class extends Outer {}; +// Parenthesis on the same line +$instance = new class extends \\Foo implements \\HandleableInterface { + // Class content +}; + +// Parenthesis on the next line +$instance = new class extends \\Foo implements + \\ArrayAccess, + \\Countable, + \\Serializable +{ + // Class content +}; + +$class = new class {}; + +$class = new class implements MyOtherClass {}; + +$class = new class implements MyOtherClass, MyOtherClass1, MyOtherClass2 {}; + +$class = new class implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyOtherClass {}; + +$class = new class implements MyOtherClass, MyOtherClass, MyOtherOtherOtherClass, MyOtherOtherOtherOtherClass {}; + +$class = new class extends MyOtherClass {}; + +$class = new class extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class extends MyOtherClass implements MyI {}; + +$class = new class extends MyOtherClass implements MyI, MyII, MyIII {}; + +$class = new class extends MyOtherClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class extends MyOtherClass implements MyInterface, MyOtherInterface, MyOtherOtherInterface {}; + +$class = new class extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI {}; + +$class = new class extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI, MyII, MyIII {}; + +$class = new class extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) implements MyOtherClass {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) implements MyOtherClass, MyOtherClass1, MyOtherClass2 {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyOtherClass {} ; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) implements MyOtherClass, MyOtherClass, MyOtherOtherOtherClass, MyOtherOtherOtherOtherClass {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends MyOtherClass {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends MyOtherClass implements MyI {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends MyOtherClass implements MyI, MyII, MyIII {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends MyOtherClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends MyOtherClass implements MyInterface, MyOtherInterface, MyOtherOtherInterface {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI, MyII, MyIII {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +=====================================output===================================== +logger; + } + + public function setLogger(Logger $logger) + { + $this->logger = $logger; + } +} + +$app = new Application(); +$app->setLogger( + new class implements Logger { + public function log(string $msg) + { + echo $msg; + } + }, +); +$app->setLogger( + new class { + public function log($msg) + { + echo $msg; + } + }, +); + +var_dump( + new class (10) extends SomeClass implements SomeInterface { + private $num; + + public function __construct($num) + { + $this->num = $num; + } + + use SomeTrait; + }, +); + +class Outer +{ + private $prop = 1; + protected $prop2 = 2; + + protected function func1() + { + return 3; + } + + public function func2() + { + return new class ($this->prop) extends Outer { + private $prop3; + + public function __construct($prop) + { + $this->prop3 = $prop; + } + + public function func3() + { + return $this->prop2 + $this->prop3 + $this->func1(); + } + }; + } +} + +echo get_class(new class {}); +$class = new class {}; +$class = new class extends Outer {}; +// Parenthesis on the same line +$instance = new class extends \\Foo implements \\HandleableInterface { + // Class content +}; + +// Parenthesis on the next line +$instance = new class extends \\Foo implements + \\ArrayAccess, + \\Countable, + \\Serializable +{ + // Class content +}; + +$class = new class {}; + +$class = new class implements MyOtherClass {}; + +$class = new class implements MyOtherClass, MyOtherClass1, MyOtherClass2 {}; + +$class = new class implements + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyOtherClass {}; + +$class = new class implements + MyOtherClass, + MyOtherClass, + MyOtherOtherOtherClass, + MyOtherOtherOtherOtherClass {}; + +$class = new class extends MyOtherClass {}; + +$class = new class extends + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class extends MyOtherClass implements MyI {}; + +$class = new class extends MyOtherClass implements MyI, MyII, MyIII {}; + +$class = new class extends MyOtherClass implements + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class extends MyOtherClass implements + MyInterface, + MyOtherInterface, + MyOtherOtherInterface {}; + +$class = new class + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + implements MyI {}; + +$class = new class + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + implements + MyI, + MyII, + MyIII {}; + +$class = new class + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class ( + $arg, + "string", + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + }, +) {}; + +$class = new class ( + $arg, + "string", + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + }, +) implements MyOtherClass {}; + +$class = new class ( + $arg, + "string", + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + }, +) implements MyOtherClass, MyOtherClass1, MyOtherClass2 {}; + +$class = new class ( + $arg, + "string", + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + }, +) implements + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyOtherClass {}; + +$class = new class ( + $arg, + "string", + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + }, +) implements + MyOtherClass, + MyOtherClass, + MyOtherOtherOtherClass, + MyOtherOtherOtherOtherClass {}; + +$class = new class ( + $arg, + "string", + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + }, +) extends MyOtherClass {}; + +$class = new class ( + $arg, + "string", + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + }, +) extends + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class ( + $arg, + "string", + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + }, +) extends MyOtherClass implements MyI {}; + +$class = new class ( + $arg, + "string", + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + }, +) extends MyOtherClass implements MyI, MyII, MyIII {}; + +$class = new class ( + $arg, + "string", + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + }, +) extends MyOtherClass implements + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class ( + $arg, + "string", + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + }, +) extends MyOtherClass implements + MyInterface, + MyOtherInterface, + MyOtherOtherInterface {}; + +$class = new class ( + $arg, + "string", + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + }, +) + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + implements MyI {}; + +$class = new class ( + $arg, + "string", + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + }, +) + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + implements + MyI, + MyII, + MyIII {}; + +$class = new class ( + $arg, + "string", + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + }, +) + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +================================================================================ +`; + +exports[`class.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +other = $test_string; + $this->current_version = $current_version ?: new Content_Version_Model(); + self::$staticTest = $test_int; + } + + public static function test_static_constructor($test, $test_int, $test_string) { + $model = new self($test, $test_int, $test_string); + $model = new self($really_really_really_really_really_really_really_really_long_array, $test_int, $test_string); + return $model; + } + + public function test_pass_by_reference(&$test) + { + $test + 1; + } + + /** + * This is a function + */ + private function hi($input) { + $test = 1; + + //testing line spacing + $other_test = 2; + + + $one_more_test = 3; + return $input . $this->test; + + } + + public function reallyReallyReallyReallyReallyReallyReallyLongMethodName($input, $otherInput = 1) { + return true; + } + + // doc test + public static function testStaticFunction($input) { + return self::$staticTest[0]; + } + + public function returnTypeTest() : string + { + return 'hi'; + } + + final public static function bar() + { + // Nothing + } + + abstract protected function zim(); + + public function method(iterable $iterable): array { + // Parameter broadened and return type narrowed. + } + + public function method1() { return 'hi'; } + + public function method2() { + return 'hi'; } + + public function method3() + { return 'hi'; } + + public function testReturn(?string $name): ?string + { + return $name; + } + + public function swap(&$left, &$right): void + { + if ($left === $right) { + return; + } + + $tmp = $left; + $left = $right; + $right = $tmp; + } + + public function test(object $obj): object + { + return new SplQueue(); + } + + public function longLongAnotherFunction( + string $foo, + string $bar, + int $baz + ): string { + return 'foo'; + } + + public function longLongAnotherFunctionOther( + string $foo, + string $bar, + int $baz + ) { + return 'foo'; + } + + public function testReturnTypeDeclaration() : object + { + return new SplQueue(); + } + + public function testReturnTypeDeclarationOther() + : + object + { + return new SplQueue(); + } +} + +$this->something->method($argument, $this->more->stuff($this->even->more->things->complicatedMethod())); + +class A {} + +$someVar = new ReaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalyLongClassName(); + +class ClassName + +extends ParentClass + +implements \\ArrayAccess, \\Countable + +{ + + // constants, properties, methods + +} + +class FooBar { public $property; public $property2; public function method() {} public function method2() {} } + +class FooBarFoo +{ + public function fooBarBaz ( $x,$y ,$z, $foo , $bar ) { /* Comment */ } +} + +class ClassName extends ParentClass implements InterfaceClass {} + +class ClassName extends ParentClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {} + +class ClassName extends ParentClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {} + +class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements InterfaceClass {} + +class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements InterfaceClass {} + +class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {} + +class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {} + +class ClassName extends ParentClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1,VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 {} + +class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1,VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 {} + +class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1,VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 extends ParentClass implements InterfaceClass {} + +class Custom_Plugin_NotificationPlaceholderSource extends Notification_Manager_DefaultPlaceholderSource {} + +class field extends \\models\\base +{ + protected function pre_save( $input, $fields ) { + $input['configs'] = json_encode( array_merge( $configs, $field_type->process_field_config_from_user( $input['definition'] ) ) ); + unset( $input['definition'] ); + } +} + +class test { + public function test_method() { + $customer = (object) [ 'name' => 'Bob' ]; + $job = (object) [ 'customer' => $customer ]; + + return "The customer for that job, {$job->customer->name} has an error that shows up after the line gets waaaaay toooo long."; + } +} + +class EmptyClass {} + +class EmptyClassWithComments { /* Comment */ } + +class MyClass implements MyOtherClass {} + +class MyClass implements MyOtherClass, MyOtherClass1, MyOtherClass2 {} + +class MyClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyOtherClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyOtherClass {} + +class MyClass implements MyOtherClass, MyOtherClass, MyOtherOtherOtherClass, MyOtherOtherOtherOtherClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyOtherClass, MyOtherClass, MyOtherOtherOtherClass, MyOtherOtherOtherOtherClass {} + +class EmptyClass extends MyOtherClass {} + +class EmptyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass extends EmptyClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class MyClass extends MyOtherClass implements MyI {} + +class MyClass extends MyOtherClass implements MyI, MyII, MyIII {} + +class MyClass extends MyOtherClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class MyClass extends MyOtherClass implements MyInterface, MyOtherInterface, MyOtherOtherInterface {} + +class MyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI {} + +class MyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI, MyII, MyIII {} + +class MyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class MyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI, MyII, MyIII {} + +final class BaseClass {} + +abstract class BaseClass {} + +final readonly class BaseClass {} + +readonly final class BaseClass {} + +final class BaseClass extends MyOtherClass {} + +abstract class BaseClass extends MyOtherClass {} + +final readonly class BaseClass extends MyOtherClass {} + +readonly final class BaseClass extends MyOtherClass {} + +final class BaseClass extends MyOtherVeryVeryVeryVeVeryVeryVeryVeryVeryLongClass {} + +abstract class BaseClass extends MyOtherVeryVeryVeryVeVeryVeryVeryVVeryLongClass {} + +final class BaseClass extends MyOtherVeryVeryVeryVeVeryVeryVeryVeryVeryLongClass1 {} + +abstract class BaseClass extends MyOtherVeryVeryVeryVeVeryVeryVeryVVeryLongClass1 {} + +final class BaseClass extends MyOtherClass implements MyInterface, MyOtherInterface, MyOtherOtherInterface {} + +abstract class BaseClass extends MyOtherClass implements MyInterface, MyOtherInterface, MyOtherOtherInterface {} + +class User { + public int $id; + public string $name; + public ?string $b = 'foo'; + private Foo $prop; + protected static string $static = 'default'; + + public function __construct(int $id, string $name) { + $this->id = $id; + $this->name = $name; + } +} + +class Promoted { + public function __construct( public int $a, private float $b, protected string $d ){ + + } +} + +readonly class ReadOnlyCls { + public string $myValue; +} + +class FinalCost { final public const FOO = 'foo'; } + +// PHP 8.3 typed class constants +enum E { + const string TEST = "Test1"; // E::TEST is a string +} + +trait T { + const string TEST = E::TEST; // T::TEST is a string too +} + +interface I { + const string TEST = E::TEST; // I::TEST is a string as well +} + +class Foo implements I { + use T; + + const string TEST = E::TEST; // Foo::TEST must also be a string +} + +class Bar extends Foo { + const string TEST = "Test2"; // Bar::TEST must also be a string, but the value can change + public const int|null I = null; + public const ?int J = null; +} + +=====================================output===================================== +other = $test_string; + $this->current_version = + $current_version ?: new Content_Version_Model(); + self::$staticTest = $test_int; + } + + public static function test_static_constructor( + $test, + $test_int, + $test_string, + ) { + $model = new self($test, $test_int, $test_string); + $model = new self( + $really_really_really_really_really_really_really_really_long_array, + $test_int, + $test_string, + ); + return $model; + } + + public function test_pass_by_reference(&$test) + { + $test + 1; + } + + /** + * This is a function + */ + private function hi($input) + { + $test = 1; + + //testing line spacing + $other_test = 2; + + $one_more_test = 3; + return $input . $this->test; + } + + public function reallyReallyReallyReallyReallyReallyReallyLongMethodName( + $input, + $otherInput = 1, + ) { + return true; + } + + // doc test + public static function testStaticFunction($input) + { + return self::$staticTest[0]; + } + + public function returnTypeTest(): string + { + return "hi"; + } + + final public static function bar() + { + // Nothing + } + + abstract protected function zim(); + + public function method(iterable $iterable): array + { + // Parameter broadened and return type narrowed. + } + + public function method1() + { + return "hi"; + } + + public function method2() + { + return "hi"; + } + + public function method3() + { + return "hi"; + } + + public function testReturn(?string $name): ?string + { + return $name; + } + + public function swap(&$left, &$right): void + { + if ($left === $right) { + return; + } + + $tmp = $left; + $left = $right; + $right = $tmp; + } + + public function test(object $obj): object + { + return new SplQueue(); + } + + public function longLongAnotherFunction( + string $foo, + string $bar, + int $baz, + ): string { + return "foo"; + } + + public function longLongAnotherFunctionOther( + string $foo, + string $bar, + int $baz, + ) { + return "foo"; + } + + public function testReturnTypeDeclaration(): object + { + return new SplQueue(); + } + + public function testReturnTypeDeclarationOther(): object + { + return new SplQueue(); + } +} + +$this->something->method( + $argument, + $this->more->stuff($this->even->more->things->complicatedMethod()), +); + +class A {} + +$someVar = new ReaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalyLongClassName(); + +class ClassName extends ParentClass implements \\ArrayAccess, \\Countable +{ + // constants, properties, methods +} + +class FooBar +{ + public $property; + public $property2; + public function method() {} + public function method2() {} +} + +class FooBarFoo +{ + public function fooBarBaz($x, $y, $z, $foo, $bar) + { + /* Comment */ + } +} + +class ClassName extends ParentClass implements InterfaceClass {} + +class ClassName extends ParentClass implements + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {} + +class ClassName extends ParentClass implements + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {} + +class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements + InterfaceClass {} + +class ClassName + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 + implements InterfaceClass {} + +class ClassName + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 + implements VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {} + +class ClassName + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 + implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 {} + +class ClassName extends ParentClass implements + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1, + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 {} + +class ClassName extends VeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 implements + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1, + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 {} + +class ClassName + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 + implements + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1, + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName2, + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName3 {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFileName1 + extends ParentClass + implements InterfaceClass {} + +class Custom_Plugin_NotificationPlaceholderSource extends + Notification_Manager_DefaultPlaceholderSource {} + +class field extends \\models\\base +{ + protected function pre_save($input, $fields) + { + $input["configs"] = json_encode( + array_merge( + $configs, + $field_type->process_field_config_from_user( + $input["definition"], + ), + ), + ); + unset($input["definition"]); + } +} + +class test +{ + public function test_method() + { + $customer = (object) ["name" => "Bob"]; + $job = (object) ["customer" => $customer]; + + return "The customer for that job, {$job->customer->name} has an error that shows up after the line gets waaaaay toooo long."; + } +} + +class EmptyClass {} + +class EmptyClassWithComments +{ + /* Comment */ +} + +class MyClass implements MyOtherClass {} + +class MyClass implements MyOtherClass, MyOtherClass1, MyOtherClass2 {} + +class MyClass implements + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyOtherClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + implements MyOtherClass {} + +class MyClass implements + MyOtherClass, + MyOtherClass, + MyOtherOtherOtherClass, + MyOtherOtherOtherOtherClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + implements + MyOtherClass, + MyOtherClass, + MyOtherOtherOtherClass, + MyOtherOtherOtherOtherClass {} + +class EmptyClass extends MyOtherClass {} + +class EmptyClass extends + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + extends EmptyClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class MyClass extends MyOtherClass implements MyI {} + +class MyClass extends MyOtherClass implements MyI, MyII, MyIII {} + +class MyClass extends MyOtherClass implements + VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class MyClass extends MyOtherClass implements + MyInterface, + MyOtherInterface, + MyOtherOtherInterface {} + +class MyClass + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + implements MyI {} + +class MyClass + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + implements + MyI, + MyII, + MyIII {} + +class MyClass + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class MyClass + extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass + implements + MyI, + MyII, + MyIII {} + +final class BaseClass {} + +abstract class BaseClass {} + +final readonly class BaseClass {} + +final readonly class BaseClass {} + +final class BaseClass extends MyOtherClass {} + +abstract class BaseClass extends MyOtherClass {} + +final readonly class BaseClass extends MyOtherClass {} + +final readonly class BaseClass extends MyOtherClass {} + +final class BaseClass extends + MyOtherVeryVeryVeryVeVeryVeryVeryVeryVeryLongClass {} + +abstract class BaseClass extends + MyOtherVeryVeryVeryVeVeryVeryVeryVVeryLongClass {} + +final class BaseClass extends + MyOtherVeryVeryVeryVeVeryVeryVeryVeryVeryLongClass1 {} + +abstract class BaseClass extends + MyOtherVeryVeryVeryVeVeryVeryVeryVVeryLongClass1 {} + +final class BaseClass extends MyOtherClass implements + MyInterface, + MyOtherInterface, + MyOtherOtherInterface {} + +abstract class BaseClass extends MyOtherClass implements + MyInterface, + MyOtherInterface, + MyOtherOtherInterface {} + +class User +{ + public int $id; + public string $name; + public ?string $b = "foo"; + private Foo $prop; + protected static string $static = "default"; + + public function __construct(int $id, string $name) + { + $this->id = $id; + $this->name = $name; + } +} + +class Promoted +{ + public function __construct( + public int $a, + private float $b, + protected string $d, + ) {} +} + +readonly class ReadOnlyCls +{ + public string $myValue; +} + +class FinalCost +{ + final public const FOO = "foo"; +} + +// PHP 8.3 typed class constants +enum E +{ + const string TEST = "Test1"; // E::TEST is a string +} + +trait T +{ + const string TEST = E::TEST; // T::TEST is a string too +} + +interface I +{ + const string TEST = E::TEST; // I::TEST is a string as well +} + +class Foo implements I +{ + use T; + + const string TEST = E::TEST; // Foo::TEST must also be a string +} + +class Bar extends Foo +{ + const string TEST = "Test2"; // Bar::TEST must also be a string, but the value can change + public const int|null I = null; + public const ?int J = null; +} + +================================================================================ +`; diff --git a/tests/class/anonymous.php b/tests/class/anonymous.php index 8c03ce0c4..63c145a77 100644 --- a/tests/class/anonymous.php +++ b/tests/class/anonymous.php @@ -21,3 +21,247 @@ public function log(string $msg) { echo $msg; } }); +$app->setLogger(new class { + public function log($msg) + { + echo $msg; + } +}); + +var_dump(new class(10) extends SomeClass implements SomeInterface { + private $num; + + public function __construct($num) + { + $this->num = $num; + } + + use SomeTrait; +}); + +class Outer +{ + private $prop = 1; + protected $prop2 = 2; + + protected function func1() + { + return 3; + } + + public function func2() + { + return new class($this->prop) extends Outer { + private $prop3; + + public function __construct($prop) + { + $this->prop3 = $prop; + } + + public function func3() + { + return $this->prop2 + $this->prop3 + $this->func1(); + } + }; + } +} + +echo get_class(new class {}); +$class = new class {}; +$class = new class extends Outer {}; +// Parenthesis on the same line +$instance = new class extends \Foo implements \HandleableInterface { + // Class content +}; + +// Parenthesis on the next line +$instance = new class extends \Foo implements + \ArrayAccess, + \Countable, + \Serializable +{ + // Class content +}; + +$class = new class {}; + +$class = new class implements MyOtherClass {}; + +$class = new class implements MyOtherClass, MyOtherClass1, MyOtherClass2 {}; + +$class = new class implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyOtherClass {}; + +$class = new class implements MyOtherClass, MyOtherClass, MyOtherOtherOtherClass, MyOtherOtherOtherOtherClass {}; + +$class = new class extends MyOtherClass {}; + +$class = new class extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class extends MyOtherClass implements MyI {}; + +$class = new class extends MyOtherClass implements MyI, MyII, MyIII {}; + +$class = new class extends MyOtherClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class extends MyOtherClass implements MyInterface, MyOtherInterface, MyOtherOtherInterface {}; + +$class = new class extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI {}; + +$class = new class extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI, MyII, MyIII {}; + +$class = new class extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) implements MyOtherClass {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) implements MyOtherClass, MyOtherClass1, MyOtherClass2 {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyOtherClass {} ; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) implements MyOtherClass, MyOtherClass, MyOtherOtherOtherClass, MyOtherOtherOtherOtherClass {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends MyOtherClass {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends MyOtherClass implements MyI {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends MyOtherClass implements MyI, MyII, MyIII {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends MyOtherClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends MyOtherClass implements MyInterface, MyOtherInterface, MyOtherOtherInterface {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI, MyII, MyIII {}; + +$class = new class( + $arg, + 'string', + 2100, + $var ? true : false, + $other_arg, + function () { + return 1; + } +) extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {}; diff --git a/tests/class/class.php b/tests/class/class.php index 47e091be6..626133292 100644 --- a/tests/class/class.php +++ b/tests/class/class.php @@ -20,6 +20,7 @@ abstract class ReallyReallyReallyLongClassName extends AbstractModelFactoryResou public $test; public $other = 1; public static $staticTest = ['hi']; + public readonly int $readonlytype; static $cache; protected static $_instance; protected $fillable = ['title', 'requester_id', 'type', 'summary', 'proof']; @@ -37,7 +38,7 @@ abstract class ReallyReallyReallyLongClassName extends AbstractModelFactoryResou * * @return \Some\Test */ - public function __construct($test, $test_int = null, $test_string = 'hi') { + public function __construct($test, $test_int = null, $test_string = 'hi', readonly int $test_readonly, public readonly string $test_promoted_readonly) { parent::__construct($test_int ?: 1); $this->other = $test_string; $this->current_version = $current_version ?: new Content_Version_Model(); @@ -218,3 +219,123 @@ public function test_method() { return "The customer for that job, {$job->customer->name} has an error that shows up after the line gets waaaaay toooo long."; } } + +class EmptyClass {} + +class EmptyClassWithComments { /* Comment */ } + +class MyClass implements MyOtherClass {} + +class MyClass implements MyOtherClass, MyOtherClass1, MyOtherClass2 {} + +class MyClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyOtherClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyOtherClass {} + +class MyClass implements MyOtherClass, MyOtherClass, MyOtherOtherOtherClass, MyOtherOtherOtherOtherClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyOtherClass, MyOtherClass, MyOtherOtherOtherClass, MyOtherOtherOtherOtherClass {} + +class EmptyClass extends MyOtherClass {} + +class EmptyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass extends EmptyClass {} + +class VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class MyClass extends MyOtherClass implements MyI {} + +class MyClass extends MyOtherClass implements MyI, MyII, MyIII {} + +class MyClass extends MyOtherClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class MyClass extends MyOtherClass implements MyInterface, MyOtherInterface, MyOtherOtherInterface {} + +class MyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI {} + +class MyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI, MyII, MyIII {} + +class MyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass {} + +class MyClass extends VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongMyClass implements MyI, MyII, MyIII {} + +final class BaseClass {} + +abstract class BaseClass {} + +final readonly class BaseClass {} + +readonly final class BaseClass {} + +final class BaseClass extends MyOtherClass {} + +abstract class BaseClass extends MyOtherClass {} + +final readonly class BaseClass extends MyOtherClass {} + +readonly final class BaseClass extends MyOtherClass {} + +final class BaseClass extends MyOtherVeryVeryVeryVeVeryVeryVeryVeryVeryLongClass {} + +abstract class BaseClass extends MyOtherVeryVeryVeryVeVeryVeryVeryVVeryLongClass {} + +final class BaseClass extends MyOtherVeryVeryVeryVeVeryVeryVeryVeryVeryLongClass1 {} + +abstract class BaseClass extends MyOtherVeryVeryVeryVeVeryVeryVeryVVeryLongClass1 {} + +final class BaseClass extends MyOtherClass implements MyInterface, MyOtherInterface, MyOtherOtherInterface {} + +abstract class BaseClass extends MyOtherClass implements MyInterface, MyOtherInterface, MyOtherOtherInterface {} + +class User { + public int $id; + public string $name; + public ?string $b = 'foo'; + private Foo $prop; + protected static string $static = 'default'; + + public function __construct(int $id, string $name) { + $this->id = $id; + $this->name = $name; + } +} + +class Promoted { + public function __construct( public int $a, private float $b, protected string $d ){ + + } +} + +readonly class ReadOnlyCls { + public string $myValue; +} + +class FinalCost { final public const FOO = 'foo'; } + +// PHP 8.3 typed class constants +enum E { + const string TEST = "Test1"; // E::TEST is a string +} + +trait T { + const string TEST = E::TEST; // T::TEST is a string too +} + +interface I { + const string TEST = E::TEST; // I::TEST is a string as well +} + +class Foo implements I { + use T; + + const string TEST = E::TEST; // Foo::TEST must also be a string +} + +class Bar extends Foo { + const string TEST = "Test2"; // Bar::TEST must also be a string, but the value can change + public const int|null I = null; + public const ?int J = null; +} diff --git a/tests/class/jsfmt.spec.js b/tests/class/jsfmt.spec.js deleted file mode 100644 index 5378de169..000000000 --- a/tests/class/jsfmt.spec.js +++ /dev/null @@ -1,3 +0,0 @@ -run_spec(__dirname, ["php"]); -// see https://github.com/prettier/plugin-php/issues/107 -// run_spec(__dirname, ["php"], { openingBraceNewLine: false }); diff --git a/tests/class/jsfmt.spec.mjs b/tests/class/jsfmt.spec.mjs new file mode 100644 index 000000000..4d43d0cbd --- /dev/null +++ b/tests/class/jsfmt.spec.mjs @@ -0,0 +1,3 @@ +run_spec(import.meta, ["php"]); +// see https://github.com/prettier/plugin-php/issues/107 +// run_spec(import.meta, ["php"], { openingBraceNewLine: false }); diff --git a/tests/classconstant/__snapshots__/jsfmt.spec.mjs.snap b/tests/classconstant/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..9a66f8297 --- /dev/null +++ b/tests/classconstant/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,191 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`classconstant.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 'value', 'other-key' => 'other-value']; + const CONST_14 = ['key' => 'value', 'other-key' => 'other-value', 'other-other-key' => 'other-other-value']; + + const FIRST = "Hello", SECOND = "world", THIRD = "!"; + const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST = "Hello", SECOND_1 = "world", THIRD_1 = "!"; + const FIRST_1 = "Hello", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND = "world", THIRD_2 = "!"; + const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_FIRST = "Hello", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND_1 = "world", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_THIRD = "!"; + const CONST_15 = ['key' => 'value', 'other-key' => 'other-value', 'other-other-key' => 'other-other-value'], FOO_BAR = "test", BAR_FOOR = ['value', 'other-value']; + + const ARRAY_1 = ['value', 'other-value'], ARRAY_2 = ['value', 'other-value']; + const STRING = + 'string' . + 'string' . + 'string' . + 'string' . + 'string' . + 'string' . + 'string' . + 'string'; + const FOOF = 'string +string +string', BAAR = 'string +string +string'; +} + +=====================================output===================================== + "value", "other-key" => "other-value"]; + const CONST_14 = [ + "key" => "value", + "other-key" => "other-value", + "other-other-key" => "other-other-value", + ]; + + const FIRST = "Hello", + SECOND = "world", + THIRD = "!"; + const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST = "Hello", + SECOND_1 = "world", + THIRD_1 = "!"; + const FIRST_1 = "Hello", + VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND = "world", + THIRD_2 = "!"; + const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_FIRST = "Hello", + VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND_1 = "world", + VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_THIRD = "!"; + const CONST_15 = [ + "key" => "value", + "other-key" => "other-value", + "other-other-key" => "other-other-value", + ], + FOO_BAR = "test", + BAR_FOOR = ["value", "other-value"]; + + const ARRAY_1 = ["value", "other-value"], + ARRAY_2 = ["value", "other-value"]; + const STRING = + "string" . + "string" . + "string" . + "string" . + "string" . + "string" . + "string" . + "string"; + const FOOF = 'string +string +string', + BAAR = 'string +string +string'; +} + +================================================================================ +`; diff --git a/tests/classconstant/classconstant.php b/tests/classconstant/classconstant.php new file mode 100644 index 000000000..90e785fc6 --- /dev/null +++ b/tests/classconstant/classconstant.php @@ -0,0 +1,65 @@ + 'value', 'other-key' => 'other-value']; + const CONST_14 = ['key' => 'value', 'other-key' => 'other-value', 'other-other-key' => 'other-other-value']; + + const FIRST = "Hello", SECOND = "world", THIRD = "!"; + const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST = "Hello", SECOND_1 = "world", THIRD_1 = "!"; + const FIRST_1 = "Hello", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND = "world", THIRD_2 = "!"; + const VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_FIRST = "Hello", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_SECOND_1 = "world", VERY_VERY_VERY_VERY_VERY_VERY_VERY_LONG_FIRST_THIRD = "!"; + const CONST_15 = ['key' => 'value', 'other-key' => 'other-value', 'other-other-key' => 'other-other-value'], FOO_BAR = "test", BAR_FOOR = ['value', 'other-value']; + + const ARRAY_1 = ['value', 'other-value'], ARRAY_2 = ['value', 'other-value']; + const STRING = + 'string' . + 'string' . + 'string' . + 'string' . + 'string' . + 'string' . + 'string' . + 'string'; + const FOOF = 'string +string +string', BAAR = 'string +string +string'; +} diff --git a/tests/classconstant/jsfmt.spec.mjs b/tests/classconstant/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/classconstant/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/clone/__snapshots__/jsfmt.spec.js.snap b/tests/clone/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index d9312f481..000000000 --- a/tests/clone/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,23 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`clone.php 1`] = ` -veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLeadDeveloper; -$OneSecAgo = (clone $Now)->veryVeryVeryVeryVeryVeryVeryVeryLongMethod(new \\DateInterval("PT1S")); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLeadDeveloper; -$OneSecAgo = (clone $Now)->veryVeryVeryVeryVeryVeryVeryVeryLongMethod( - new \\DateInterval("PT1S") -); - -`; diff --git a/tests/clone/__snapshots__/jsfmt.spec.mjs.snap b/tests/clone/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..92712af2f --- /dev/null +++ b/tests/clone/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,48 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`clone.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLeadDeveloper; +$OneSecAgo = (clone $Now)->veryVeryVeryVeryVeryVeryVeryVeryLongMethod(new \\DateInterval("PT1S")); + +=====================================output===================================== +veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLeadDeveloper; +$OneSecAgo = (clone $Now)->veryVeryVeryVeryVeryVeryVeryVeryLongMethod( + new \\DateInterval("PT1S"), +); + +================================================================================ +`; + +exports[`single.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +bar( - $longLongLongLongLongLongLongLongLongLongArg1, - function ($arg2) use ($var1) { - // body - }, - $longLongLongLongLongLongLongLongLongLongArg3 -); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -bar( - $longLongLongLongLongLongLongLongLongLongArg1, - function ($arg2) use ($var1) { - // body - }, - $longLongLongLongLongLongLongLongLongLongArg3 -); - -`; diff --git a/tests/closure/__snapshots__/jsfmt.spec.mjs.snap b/tests/closure/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..f9e4e1129 --- /dev/null +++ b/tests/closure/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,288 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`closure.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +bar( + $longLongLongLongLongLongLongLongLongLongArg1, + function ($arg2) use ($var1) { + // body + }, + $longLongLongLongLongLongLongLongLongLongArg3 +); + +$emptyFunc = function(){}; + +$emptyFuncWithComment = function(){ /* Comment */ }; + +$longArgs_noVars = function ( + $longArgument, + $longerArgument, + $muchLongerArgument +) { + // body +}; + +$noArgs_longVars = function () use ( + $longVar1, + $longerVar2, + $muchLongerVar3 +) { + // body +}; + +$longArgs_longVars = function ( + $longArgument, + $longerArgument, + $muchLongerArgument +) use ( + $longVar1, + $longerVar2, + $muchLongerVar3 +) { + // body +}; + +$longArgs_shortVars = function ( + $longArgument, + $longerArgument, + $muchLongerArgument +) use ($var1) { + // body +}; + +$shortArgs_longVars = function ($arg) use ( + $longVar1, + $longerVar2, + $muchLongerVar3 +) { + // body +}; + +$rTD = function(array $array): int { + return array_sum($array); +}; + +$rNTD = function(array $array): ?int { + return array_sum($array); +}; + +$rTDWU = function(array $array) use ($var1, $var2): int { + return array_sum($array); +}; + +$rTDWLU = function(array $array) use ($longLongLongLongLongLongLongVar1, $longerLongerLongerLongerVar2, $muchLongerVar3): int { + return array_sum($array); +}; + +$var = function &() { + static $collection = array(); + + return $collection; +}; + +$func = static function() {}; +$fn = function &() use (&$value) { return $value; }; + +$var = function () {}; + +$a = (fn() => 0)(); +=====================================output===================================== +bar( + $longLongLongLongLongLongLongLongLongLongArg1, + function ($arg2) use ($var1) { + // body + }, + $longLongLongLongLongLongLongLongLongLongArg3, +); + +$emptyFunc = function () {}; + +$emptyFuncWithComment = function () { + /* Comment */ +}; + +$longArgs_noVars = function ( + $longArgument, + $longerArgument, + $muchLongerArgument, +) { + // body +}; + +$noArgs_longVars = function () use ($longVar1, $longerVar2, $muchLongerVar3) { + // body +}; + +$longArgs_longVars = function ( + $longArgument, + $longerArgument, + $muchLongerArgument, +) use ($longVar1, $longerVar2, $muchLongerVar3) { + // body +}; + +$longArgs_shortVars = function ( + $longArgument, + $longerArgument, + $muchLongerArgument, +) use ($var1) { + // body +}; + +$shortArgs_longVars = function ($arg) use ( + $longVar1, + $longerVar2, + $muchLongerVar3, +) { + // body +}; + +$rTD = function (array $array): int { + return array_sum($array); +}; + +$rNTD = function (array $array): ?int { + return array_sum($array); +}; + +$rTDWU = function (array $array) use ($var1, $var2): int { + return array_sum($array); +}; + +$rTDWLU = function (array $array) use ( + $longLongLongLongLongLongLongVar1, + $longerLongerLongerLongerVar2, + $muchLongerVar3, +): int { + return array_sum($array); +}; + +$var = function &() { + static $collection = []; + + return $collection; +}; + +$func = static function () {}; +$fn = function &() use (&$value) { + return $value; +}; + +$var = function () {}; + +$a = (fn() => 0)(); + +================================================================================ +`; diff --git a/tests/closure/closure.php b/tests/closure/closure.php index 87ed72dd5..57e58c863 100644 --- a/tests/closure/closure.php +++ b/tests/closure/closure.php @@ -59,3 +59,80 @@ function ($arg2) use ($var1) { }, $longLongLongLongLongLongLongLongLongLongArg3 ); + +$emptyFunc = function(){}; + +$emptyFuncWithComment = function(){ /* Comment */ }; + +$longArgs_noVars = function ( + $longArgument, + $longerArgument, + $muchLongerArgument +) { + // body +}; + +$noArgs_longVars = function () use ( + $longVar1, + $longerVar2, + $muchLongerVar3 +) { + // body +}; + +$longArgs_longVars = function ( + $longArgument, + $longerArgument, + $muchLongerArgument +) use ( + $longVar1, + $longerVar2, + $muchLongerVar3 +) { + // body +}; + +$longArgs_shortVars = function ( + $longArgument, + $longerArgument, + $muchLongerArgument +) use ($var1) { + // body +}; + +$shortArgs_longVars = function ($arg) use ( + $longVar1, + $longerVar2, + $muchLongerVar3 +) { + // body +}; + +$rTD = function(array $array): int { + return array_sum($array); +}; + +$rNTD = function(array $array): ?int { + return array_sum($array); +}; + +$rTDWU = function(array $array) use ($var1, $var2): int { + return array_sum($array); +}; + +$rTDWLU = function(array $array) use ($longLongLongLongLongLongLongVar1, $longerLongerLongerLongerVar2, $muchLongerVar3): int { + return array_sum($array); +}; + +$var = function &() { + static $collection = array(); + + return $collection; +}; + +$func = static function() {}; +$fn = function &() use (&$value) { return $value; }; + +$var = function () {}; + +$a = (fn() => 0)(); \ No newline at end of file diff --git a/tests/closure/jsfmt.spec.js b/tests/closure/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/closure/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/closure/jsfmt.spec.mjs b/tests/closure/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/closure/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/comments/__snapshots__/jsfmt.spec.js.snap b/tests/comments/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 21535bf66..000000000 --- a/tests/comments/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,1593 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`array.php 1`] = ` - /* comment */ "bar", /* comment */ - /* comment */ "bar" /* comment */ => /* comment */ "foo" /* comment */ - /* comment */ - /* comment */ ]; -$array = [ // test - 1, 2, 3, 4, 5, 6 -]; -$array = [ - 1, 2, 3, 4, 5, 6 // test -]; -const FOO = [ - //testing - 1 -]; - -return [ - // foo - "bar" -]; - -$array = [ - 'type' => [], - 'config' => [ - // comments in nested arrays break things - 'key' => 1, - ], - 'accepted' => [], -]; - -// Comment -$array = []; // Comment -// Comment - -/* Comment */ -$array /* Comment */ = /* Comment */ []; /* Comment */ -/* Comment */ -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - /* comment */ "bar" /* comment */, - /* comment */ "bar" /* comment */ => /* comment */ "foo" /* comment */ - /* comment */ - /* comment */ -]; -$array = [ - // test - 1, - 2, - 3, - 4, - 5, - 6 -]; -$array = [ - 1, - 2, - 3, - 4, - 5, - 6 // test -]; -const FOO = [ - //testing - 1 -]; - -return [ - // foo - "bar" -]; - -$array = [ - 'type' => [], - 'config' => - [ - // comments in nested arrays break things - 'key' => 1 - ], - 'accepted' => [] -]; - -// Comment -$array = []; // Comment -// Comment - -/* Comment */ -$array /* Comment */ = /* Comment */ []; /* Comment */ -/* Comment */ - -`; - -exports[`bin.php 1`] = ` -modelData) || - // arrays, countables - ((is_array($this->modelData) || $this->modelData instanceof \\Countable) && 0 === count($this->modelData)) || - // traversables that are not countable - ($this->modelData instanceof \\Traversable && 0 === iterator_count($this->modelData)); - -if (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) { - mb_internal_encoding('ASCII'); -} - -$bool = /*Comment */ true /*Comment */ || /*Comment */ false /*Comment */; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -modelData) || - ( - ( - is_array($this->modelData) || $this->modelData instanceof \\Countable - ) && - 0 === count($this->modelData) - ) || - // traversables that are not countable - ( - $this->modelData instanceof \\Traversable && - 0 === iterator_count($this->modelData) - ); - -if (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) { - mb_internal_encoding('ASCII'); -} - -$bool = /*Comment */ true /*Comment */ || /*Comment */ false; /*Comment */ - -`; - -exports[`break.php 1`] = ` -taxonomy, $this->post_types ) extends Taxonomy_Config { - // body of anonymous class - public function get_args() { - // body of member function of anonymous class - return []; // after return in member function of anonymous class - } // after member function on anonymous class - -}; - -$test = new class($arg1) extends Test { - // some comment -}; - -$test = new class { - //some comment -}; - - -namespace Tribe\\Project\\Twig; - -interface Template_Interface { - /** - * Build the data that will be available to the template - * - * @return array - */ - public function get_data(): array; - - /** - * Render the template and return it as a string - * - * @return string The rendered template - */ - public function render(): string; -} - - -class Foo {/* Comment */} -interface FooI {/* Comment */} -trait FooT {/* Comment */} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -taxonomy, $this->post_types) extends Taxonomy_Config -{ - // body of anonymous class - public function get_args() - { - // body of member function of anonymous class - return []; // after return in member function of anonymous class - } // after member function on anonymous class -}; - -$test = new class($arg1) extends Test -{ - // some comment -}; - -$test = new class -{ - //some comment -}; - -namespace Tribe\\Project\\Twig; - -interface Template_Interface -{ - /** - * Build the data that will be available to the template - * - * @return array - */ - public function get_data(): array; - - /** - * Render the template and return it as a string - * - * @return string The rendered template - */ - public function render(): string; -} - -class Foo -{ - /* Comment */ -} -interface FooI -{ - /* Comment */ -} -trait FooT -{ - /* Comment */ -} - -`; - -exports[`clone.php 1`] = ` -title = $title; - } -} - -/********************* - * Some long comment * - *********************/ - -// This is a one-line c++ style comment - -/* This is a multi line comment - yet another line of comment */ - -/* -This is a multiple-lines comment block -that spans over multiple -lines -*/ - -# This is a one-line shell-style comment - - -for ($i = 0; $i < 10; $i++) { - // some comment - $a = 1; - $b = 2; - - while (true) { - // Some comment - $test = 1; - } -} - -while (true) { - // some comment -} - -do { - // some comment -} while (true); - -$test = foo ?: bar(function () { - $foo = "bar"; - // test -}); - -$test = foo ? true : bar(function () { - $foo = "bar"; - // test -}); - -$constraint = new UniqueEntity(array( - 'message' => 'myMessage' - // no "em" option set -)); - -return ( - // parens test - // some comment - $test -); - -/*** - * Configures the tasks tabs (sub_menu) - */ - -class Test { - /****************************************** - * ORIGINAL SHIPPING DATA - *****************************************/ - public $test; -} - -/* - some test - - */ - - /* -
- Modal - - - Options: data-render - contact-form, render, template-part - */ - -/** - * See http://example.com - * - * Some example code - * \`\`\`php - * $hello = 'world'; // This is a comment in a comment - * \`\`\` - */ -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -title = $title; - } -} - -/********************* - * Some long comment * - *********************/ - -// This is a one-line c++ style comment - -/* This is a multi line comment - yet another line of comment */ - -/* -This is a multiple-lines comment block -that spans over multiple -lines -*/ - -# This is a one-line shell-style comment - -for ($i = 0; $i < 10; $i++) { - // some comment - $a = 1; - $b = 2; - - while (true) { - // Some comment - $test = 1; - } -} - -while (true) { - // some comment -} - -do { - // some comment -} while (true); - -$test = foo - ?: bar(function () { - $foo = "bar"; - // test - }); - -$test = foo - ? true - : bar(function () { - $foo = "bar"; - // test - }); - -$constraint = new UniqueEntity(array( - 'message' => 'myMessage' - // no "em" option set -)); - -return ( - // parens test - // some comment - $test -); - -/*** - * Configures the tasks tabs (sub_menu) - */ - -class Test -{ - /****************************************** - * ORIGINAL SHIPPING DATA - *****************************************/ - public $test; -} - -/* - some test - - */ - -/* - - Modal - - - Options: data-render - contact-form, render, template-part - */ - -/** - * See http://example.com - * - * Some example code - * \`\`\`php - * $hello = 'world'; // This is a comment in a comment - * \`\`\` - */ - -`; - -exports[`continue.php 1`] = ` - 0); // Comment - -do { -} while (/* Comments */ true /* Comments */); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 0); // Comment - -do { -} while (/* Comments */ true /* Comments */); - -`; - -exports[`echo.php 1`] = ` - /* Comments */ $value /* Comments */) {} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - $value) {/* Comments */ - /* Comments */ - /* Comments */ - /* Comments */ - /* Comments */ - /* Comments */ -} - -`; - -exports[`functions.php 1`] = ` -setVendorAddress( - $vendor->address_1, // address 1 - $vendor->address_2, // address 2 - '', // address 3 mike testing - '', // address 4 - '', // address 5 - $vendor->city, // city - $vendor->state, // state - $vendor->zip // state - ); - } -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -setVendorAddress( - $vendor->address_1, // address 1 - $vendor->address_2, // address 2 - '', // address 3 mike testing - '', // address 4 - '', // address 5 - $vendor->city, // city - $vendor->state, // state - $vendor->zip // state - ); - } -} - -`; - -exports[`no_code.php 1`] = ` - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/*Comment*/bar(); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -bar(); - -`; - -exports[`silent.php 1`] = ` - /* Comment */ $fields /* Comment */; -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - /* Comment */ $fields; /* Comment */ -} - -`; - -exports[`yieldfrom.php 1`] = ` - /* comment */ "bar", /* comment */ + /* comment */ "bar" /* comment */ => /* comment */ "foo" /* comment */ + /* comment */ + /* comment */ ]; +$array = [ // test + 1, 2, 3, 4, 5, 6 +]; +$array = [ + 1, 2, 3, 4, 5, 6 // test +]; +const FOO = [ + //testing + 1 +]; + +return [ + // foo + "bar" +]; + +$array = [ + 'type' => [], + 'config' => [ + // comments in nested arrays break things + 'key' => 1, + ], + 'accepted' => [], +]; + +// Comment +$array = []; // Comment +// Comment + +/* Comment */ +$array /* Comment */ = /* Comment */ []; /* Comment */ +/* Comment */ + +$array = [ + 'key' => + // Comment A + // Comment B + 'string' +]; + +$array = [ + 'key' => // Comment A + // Comment B + 'string' +]; + +$array = [ + 'key' => // Comment A + 'string' +]; + +array // Comment +(); + +$array = array // Comment +(); + +$array = array // Comment +('string', 'other-string'); + +call( + array // Comment + () +); + +call( + array // Comment + ('string', 'other-string') +); + +=====================================output===================================== + /* comment */ "bar" /* comment */, + /* comment */ "bar" /* comment */ => /* comment */ "foo" /* comment */, + /* comment */ + /* comment */ +]; +$array = [ + // test + 1, + 2, + 3, + 4, + 5, + 6, +]; +$array = [ + 1, + 2, + 3, + 4, + 5, + 6, // test +]; +const FOO = [ + //testing + 1, +]; + +return [ + // foo + "bar", +]; + +$array = [ + "type" => [], + "config" => [ + // comments in nested arrays break things + "key" => 1, + ], + "accepted" => [], +]; + +// Comment +$array = []; // Comment +// Comment + +/* Comment */ +$array /* Comment */ = /* Comment */ []; /* Comment */ +/* Comment */ + +$array = [ + "key" => + // Comment A + // Comment B + "string", +]; + +$array = [ + // Comment A + "key" => + // Comment B + "string", +]; + +$array = [ + // Comment A + "key" => "string", +]; + +[]; // Comment + +$array = []; // Comment + +$array = [ + // Comment + "string", + "other-string", +]; + +call( + [], // Comment +); + +call([ + // Comment + "string", + "other-string", +]); + +================================================================================ +`; + +exports[`assign.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +modelData) || + // arrays, countables + ((is_array($this->modelData) || $this->modelData instanceof \\Countable) && 0 === count($this->modelData)) || + // traversables that are not countable + ($this->modelData instanceof \\Traversable && 0 === iterator_count($this->modelData)); + +if (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) { + mb_internal_encoding('ASCII'); +} + +$bool = /*Comment */ true /*Comment */ || /*Comment */ false /*Comment */; + +$a = 1 + * // A + 2 + * // B + 3; + +//check if the offer applies to this site +//state mismatch +if ( + !$this->pricingQueryOfferResult->offer || + !$this->pricingQueryOfferResult->offer->offerGroup || + //!$this->pricingQuerySite->postcode || + ( // offer has a state but we don't + $this->pricingQueryOfferResult->offer->offerGroup->state_id + && !$this->pricingQuerySite->postcode->state_id + ) || + ( // if we have a state and the offer has a state and they don't match, reject + $this->pricingQuerySite->postcode + && $this->pricingQuerySite->postcode->state_id + && $this->pricingQueryOfferResult->offer->offerGroup->state_id + && $this->pricingQuerySite->postcode->state_id != $this->pricingQueryOfferResult->offer->offerGroup->state_id + ) +) { + $this->hasResult = false; + $this->removedReason = 'State Mismatch'; +} + +if ($bool0 + || $bool1 // if condition 1 + || $bool2 // if condition 2 +) { + $ok = true; +} +=====================================output===================================== +modelData) || + // arrays, countables + ((is_array($this->modelData) || $this->modelData instanceof \\Countable) && + 0 === count($this->modelData)) || + // traversables that are not countable + ($this->modelData instanceof \\Traversable && + 0 === iterator_count($this->modelData)); + +if (2 /* MB_OVERLOAD_STRING */ & (int) ini_get("mbstring.func_overload")) { + mb_internal_encoding("ASCII"); +} + +$bool = /*Comment */ true /*Comment */ || /*Comment */ false /*Comment */; + +$a = + 1 * // A + 2 * // B + 3; + +//check if the offer applies to this site +//state mismatch +if ( + !$this->pricingQueryOfferResult->offer || + !$this->pricingQueryOfferResult->offer->offerGroup || // offer has a state but we don't + //!$this->pricingQuerySite->postcode || + ($this->pricingQueryOfferResult->offer->offerGroup->state_id && + !$this->pricingQuerySite->postcode->state_id) || // if we have a state and the offer has a state and they don't match, reject + ($this->pricingQuerySite->postcode && + $this->pricingQuerySite->postcode->state_id && + $this->pricingQueryOfferResult->offer->offerGroup->state_id && + $this->pricingQuerySite->postcode->state_id != + $this->pricingQueryOfferResult->offer->offerGroup->state_id) +) { + $this->hasResult = false; + $this->removedReason = "State Mismatch"; +} + +if ( + $bool0 || + $bool1 || // if condition 1 + $bool2 // if condition 2 +) { + $ok = true; +} + +================================================================================ +`; + +exports[`blank_lines.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +bar(/* B */); + +render( // Comment + 'string', + $container +); + +$var->render( // Comment + 'string', + $var +); + +render( + 'string', + $container + // Comment +); + +$var->render( + 'string', + $var + // Comment +); + +$var->render( + // Comment + 'string', + // Comment + $var + // Comment +); + +=====================================output===================================== +bar(/* B */); + +render( + // Comment + "string", + $container, +); + +$var->render( + // Comment + "string", + $var, +); + +render( + "string", + $container, + // Comment +); + +$var->render( + "string", + $var, + // Comment +); + +$var->render( + // Comment + "string", + // Comment + $var, + // Comment +); + +================================================================================ +`; + +exports[`cast.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +each() // Comment + // Comment + ->map() // Comment + // Comment + ->first() // Comment + // Comment + ->dump(); + +$var = $a /* Comment*/->/*Comment*/ bar; +$var = $a/* Comment */['test']; +$var = $a /* Comment */->/* Comment */ bar(); +$var = $a /* Comment */::/* Comment */ bar(); + +$a /* Comment*/->/*Comment*/ bar/* Comment */; +$a/* Comment */['test']; +$a /* Comment */->/* Comment */ bar(); +$a /* Comment */::/* Comment */ bar(); + +=====================================output===================================== +each() // Comment + // Comment + ->map() // Comment + // Comment + ->first() // Comment + // Comment + ->dump(); + +$var = $a /* Comment*/->/*Comment*/ bar; +$var = $a /* Comment */["test"]; +$var = $a /* Comment */ + ->/* Comment */ bar(); +$var = $a /* Comment */ + ::/* Comment */ bar(); + +$a /* Comment*/->/*Comment*/ bar /* Comment */; +$a /* Comment */["test"]; +$a /* Comment */->/* Comment */ bar(); +$a /* Comment */::/* Comment */ bar(); + +================================================================================ +`; + +exports[`class.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +taxonomy, $this->post_types ) extends Taxonomy_Config { + // body of anonymous class + public function get_args() { + // body of member function of anonymous class + return []; // after return in member function of anonymous class + } // after member function on anonymous class + +}; + +$test = new class($arg1) extends Test { + // some comment +}; + +$test = new class { + //some comment +}; + + +namespace Tribe\\Project\\Twig; + +interface Template_Interface { + /** + * Build the data that will be available to the template + * + * @return array + */ + public function get_data(): array; + + /** + * Render the template and return it as a string + * + * @return string The rendered template + */ + public function render(): string; +} + + +class Foo {/* Comment */} +interface FooI {/* Comment */} +trait FooT {/* Comment */} + +// 424 : Method failure +class ResponseMethodFailure + // behaves as an error + extends ResponseNotAcceptable + implements + // Some comment + FooBar, + // Another comment + BarBaz +{ + +} + +// 424 : Method failure +class ResponseMethodFailure + extends // behaves as an error + ResponseNotAcceptable + implements + // Some comment + FooBar, + // Another comment + BarBaz +{ + +} + + +// 424 : Method failure +class ResponseMethodFailure + extends + // behaves as an error + ResponseNotAcceptable + implements + // Some comment + FooBar, + // Another comment + BarBaz +{ + +} + +// 424 : Method failure +class ResponseMethodFailure extends ResponseNotAcceptable implements + // Some comment + FooBar, + // Another comment + BarBaz +{ + +} + +class MyClass +{ +} + +// Comment +class MyClass +{ + +} + +class MyClass +{ + // Comment +} + +$var = new class {}; + +// Comment +$var = new class {}; + +$var = new class { + // Comment +}; + +$foo = /*a*/ new /* b */ class {}; + +=====================================output===================================== +taxonomy, $this->post_types) extends Taxonomy_Config { + // body of anonymous class + public function get_args() + { + // body of member function of anonymous class + return []; // after return in member function of anonymous class + } // after member function on anonymous class +}; + +$test = new class ($arg1) extends Test { + // some comment +}; + +$test = new class { + //some comment +}; + +namespace Tribe\\Project\\Twig; + +interface Template_Interface +{ + /** + * Build the data that will be available to the template + * + * @return array + */ + public function get_data(): array; + + /** + * Render the template and return it as a string + * + * @return string The rendered template + */ + public function render(): string; +} + +class Foo +{ + /* Comment */ +} +interface FooI +{ + /* Comment */ +} +trait FooT +{ + /* Comment */ +} + +// 424 : Method failure +class ResponseMethodFailure + // behaves as an error + extends ResponseNotAcceptable + implements + // Some comment + FooBar, + // Another comment + BarBaz {} + +// 424 : Method failure +class ResponseMethodFailure + // behaves as an error + extends ResponseNotAcceptable + implements + // Some comment + FooBar, + // Another comment + BarBaz {} + +// 424 : Method failure +class ResponseMethodFailure + // behaves as an error + extends ResponseNotAcceptable + implements + // Some comment + FooBar, + // Another comment + BarBaz {} + +// 424 : Method failure +class ResponseMethodFailure extends ResponseNotAcceptable implements + // Some comment + FooBar, + // Another comment + BarBaz {} + +class MyClass {} + +// Comment +class MyClass {} + +class MyClass +{ + // Comment +} + +$var = new class {}; + +// Comment +$var = new class {}; + +$var = new class { + // Comment +}; + +$foo = /*a*/ new /* b */ class {}; + +================================================================================ +`; + +exports[`classconstant.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +map(function ($protocol) { + // Comment + + return $protocol; + }) + // Comment + -> + // Comment + call(function ($arg) { + // Comment + + return $arg; + }); + + +$foo = /** +* @param array{a: int, b: string} $bar +*/ +static fn (array $bar) => $bar; + +=====================================output===================================== +map(function ($protocol) { + // Comment + + return $protocol; + }) + // Comment + // Comment + ->call(function ($arg) { + // Comment + + return $arg; + }); + +$foo = + /** + * @param array{a: int, b: string} $bar + */ + static fn(array $bar) => $bar; + +================================================================================ +`; + +exports[`comments.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +title = $title; + } +} + +/********************* + * Some long comment * + *********************/ + +// This is a one-line c++ style comment + +/* This is a multi line comment + yet another line of comment */ + +/* +This is a multiple-lines comment block +that spans over multiple +lines +*/ + +# This is a one-line shell-style comment + + +for ($i = 0; $i < 10; $i++) { + // some comment + $a = 1; + $b = 2; + + while (true) { + // Some comment + $test = 1; + } +} + +while (true) { + // some comment +} + +do { + // some comment +} while (true); + +$test = foo ?: bar(function () { + $foo = "bar"; + // test +}); + +$test = foo ? true : bar(function () { + $foo = "bar"; + // test +}); + +$constraint = new UniqueEntity(array( + 'message' => 'myMessage' + // no "em" option set +)); + +return ( + // parens test + // some comment + $test +); + +/*** + * Configures the tasks tabs (sub_menu) + */ + +class Test { + /****************************************** + * ORIGINAL SHIPPING DATA + *****************************************/ + public $test; +} + +/* + some test + + */ + + /* + + Modal + + + Options: data-render - contact-form, render, template-part + */ + +/** + * See http://example.com + * + * Some example code + * \`\`\`php + * $hello = 'world'; // This is a comment in a comment + * \`\`\` + */ + +=====================================output===================================== +title = $title; + } +} + +/********************* + * Some long comment * + *********************/ + +// This is a one-line c++ style comment + +/* This is a multi line comment + yet another line of comment */ + +/* +This is a multiple-lines comment block +that spans over multiple +lines +*/ + +# This is a one-line shell-style comment + +for ($i = 0; $i < 10; $i++) { + // some comment + $a = 1; + $b = 2; + + while (true) { + // Some comment + $test = 1; + } +} + +while (true) { + // some comment +} + +do { + // some comment +} while (true); + +$test = + foo ?: + bar(function () { + $foo = "bar"; + // test + }); + +$test = foo + ? true + : bar(function () { + $foo = "bar"; + // test + }); + +$constraint = new UniqueEntity([ + "message" => "myMessage", + // no "em" option set +]); + +return // parens test + // some comment + $test; + +/*** + * Configures the tasks tabs (sub_menu) + */ + +class Test +{ + /****************************************** + * ORIGINAL SHIPPING DATA + *****************************************/ + public $test; +} + +/* + some test + + */ + +/* + + Modal + + + Options: data-render - contact-form, render, template-part + */ + +/** + * See http://example.com + * + * Some example code + * \`\`\`php + * $hello = 'world'; // This is a comment in a comment + * \`\`\` + */ + +================================================================================ +`; + +exports[`continue.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +=2014 Marc Morera + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * Feel free to edit as you please, and have fun. + * + * @author Marc Morera + */ + +declare(strict_types=1); + +namespace Mmoreram\\PHPFormatter\\Tests\\Fixer; + +use PHPUnit_Framework_TestCase; + +=====================================output===================================== +=2014 Marc Morera + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * Feel free to edit as you please, and have fun. + * + * @author Marc Morera + */ + +declare(strict_types=1); + +namespace Mmoreram\\PHPFormatter\\Tests\\Fixer; + +use PHPUnit_Framework_TestCase; + +================================================================================ +`; + +exports[`declare-2.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +=2014 Marc Morera + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * Feel free to edit as you please, and have fun. + * + * @author Marc Morera + */ +declare(strict_types=1); +namespace Mmoreram\\PHPFormatter\\Tests\\Fixer; +use PHPUnit_Framework_TestCase; + +=====================================output===================================== +=2014 Marc Morera + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * Feel free to edit as you please, and have fun. + * + * @author Marc Morera + */ +declare(strict_types=1); +namespace Mmoreram\\PHPFormatter\\Tests\\Fixer; +use PHPUnit_Framework_TestCase; + +================================================================================ +`; + +exports[`declare-3.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +=2014 Marc Morera + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * Feel free to edit as you please, and have fun. + * + * @author Marc Morera + */ + + +declare(strict_types=1); + + +namespace Mmoreram\\PHPFormatter\\Tests\\Fixer; + + +use PHPUnit_Framework_TestCase; + +=====================================output===================================== +=2014 Marc Morera + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * Feel free to edit as you please, and have fun. + * + * @author Marc Morera + */ + +declare(strict_types=1); + +namespace Mmoreram\\PHPFormatter\\Tests\\Fixer; + +use PHPUnit_Framework_TestCase; + +================================================================================ +`; + +exports[`declare-4.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +. + */ +declare(strict_types=1); + +=====================================output===================================== +. + */ +declare(strict_types=1); + +================================================================================ +`; + +exports[`declare-10.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +. + */ + +declare(strict_types=1); + +=====================================output===================================== +. + */ + +declare(strict_types=1); + +================================================================================ +`; + +exports[`do.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 0); // Comment + +do { +} while (/* Comments */ true /* Comments */); + +=====================================output===================================== + 0); // Comment + +do { +} while (/* Comments */ true /* Comments */); + +================================================================================ +`; + +exports[`doc.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + * @author Another Author + * @copyright 1997-2005 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @version SVN: $Id$ + * @link http://pear.php.net/package/PackageName + * @see NetOther, Net_Sample::Net_Sample() + * @since File available since Release 1.2.0 + * @deprecated File deprecated in Release 2.0.0 + */ + +/** + * This is a "Docblock Comment," also known as a "docblock." The class' + * docblock, below, contains a complete description of how to write these. + */ +require_once 'PEAR.php'; + +// {{{ constants + +/** + * Methods return this if they succeed + */ +define('NET_SAMPLE_OK', 1); + +// }}} +// {{{ GLOBALS + +/** + * The number of objects created + * @global int $GLOBALS['_NET_SAMPLE_Count'] + */ +$GLOBALS['_NET_SAMPLE_Count'] = 0; + +// }}} +// {{{ Net_Sample + +/** + * An example of how to write code to PEAR's standards + * + * Docblock comments start with "/**" at the top. Notice how the "/" + * lines up with the normal indenting and the asterisks on subsequent rows + * are in line with the first asterisk. The last line of comment text + * should be immediately followed on the next line by the closing asterisk + * and slash and then the item you are commenting on should be on the next + * line below that. Don't add extra lines. Please put a blank line + * between paragraphs as well as between the end of the description and + * the start of the @tags. Wrap comments before 80 columns in order to + * ease readability for a wide variety of users. + * + * Docblocks can only be used for programming constructs which allow them + * (classes, properties, methods, defines, includes, globals). See the + * phpDocumentor documentation for more information. + * http://phpdoc.org/docs/HTMLSmartyConverter/default/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html + * + * The Javadoc Style Guide is an excellent resource for figuring out + * how to say what needs to be said in docblock comments. Much of what is + * written here is a summary of what is found there, though there are some + * cases where what's said here overrides what is said there. + * http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#styleguide + * + * The first line of any docblock is the summary. Make them one short + * sentence, without a period at the end. Summaries for classes, properties + * and constants should omit the subject and simply state the object, + * because they are describing things rather than actions or behaviors. + * + * Below are the tags commonly used for classes. @category through @version + * are required. The remainder should only be used when necessary. + * Please use them in the order they appear here. phpDocumentor has + * several other tags available, feel free to use them. + * + * @category CategoryName + * @package PackageName + * @author Original Author + * @author Another Author + * @copyright 1997-2005 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @version Release: @package_version@ + * @link http://pear.php.net/package/PackageName + * @see NetOther, Net_Sample::Net_Sample() + * @since Class available since Release 1.2.0 + * @deprecated Class deprecated in Release 2.0.0 + */ +class Net_Sample +{ + // {{{ properties + + /** + * The status of foo's universe + * + * Potential values are 'good', 'fair', 'poor' and 'unknown'. + * + * @var string + */ + var $foo = 'unknown'; + + /** + * The status of life + * + * Note that names of private properties or methods must be + * preceeded by an underscore. + * + * @var bool + * @access private + */ + var $_good = true; + + // }}} + // {{{ setFoo() + + /** + * Registers the status of foo's universe + * + * Summaries for methods should use 3rd person declarative rather + * than 2nd person imperative, beginning with a verb phrase. + * + * Summaries should add description beyond the method's name. The + * best method names are "self-documenting", meaning they tell you + * basically what the method does. If the summary merely repeats + * the method name in sentence form, it is not providing more + * information. + * + * Summary Examples: + * + Sets the label (preferred) + * + Set the label (avoid) + * + This method sets the label (avoid) + * + * Below are the tags commonly used for methods. A @param tag is + * required for each parameter the method has. The @return + * and @access tags are mandatory. The @throws tag is required if + * the method uses exceptions. @static is required if the method can + * be called statically. The remainder should only be used when + * necessary. Please use them in the order they appear here. + * phpDocumentor has several other tags available, feel free to use + * them. + * + * The @param tag contains the data type, then the parameter's + * name, followed by a description. By convention, the first noun in + * the description is the data type of the parameter. Articles like + * "a", "an", and "the" can precede the noun. The descriptions + * should start with a phrase. If further description is necessary, + * follow with sentences. Having two spaces between the name and the + * description aids readability. + * + * When writing a phrase, do not capitalize and do not end with a + * period: + * + the string to be tested + * + * When writing a phrase followed by a sentence, do not capitalize the + * phrase, but end it with a period to distinguish it from the start + * of the next sentence: + * + the string to be tested. Must use UTF-8 encoding. + * + * Return tags should contain the data type then a description of + * the data returned. The data type can be any of PHP's data types + * (int, float, bool, string, array, object, resource, mixed) + * and should contain the type primarily returned. For example, if + * a method returns an object when things work correctly but false + * when an error happens, say 'object' rather than 'mixed.' Use + * 'void' if nothing is returned. + * + * Here's an example of how to format examples: + * + * require_once 'Net/Sample.php'; + * + * $s = new Net_Sample(); + * if (PEAR::isError($s)) { + * echo $s->getMessage() . "\\n"; + * } + * + * + * Here is an example for non-php example or sample: + * + * pear install net_sample + * + * + * @param string $arg1 the string to quote + * @param int $arg2 an integer of how many problems happened. + * Indent to the description's starting point + * for long ones. + * + * @return int the integer of the set mode used. FALSE if foo + * foo could not be set. + * @throws exceptionclass [description] + * + * @access public + * @static + * @see Net_Sample::$foo, Net_Other::someMethod() + * @since Method available since Release 1.2.0 + * @deprecated Method deprecated in Release 2.0.0 + */ + function setFoo($arg1, $arg2 = 0) + { + /* + * This is a "Block Comment." The format is the same as + * Docblock Comments except there is only one asterisk at the + * top. phpDocumentor doesn't parse these. + */ + if ($arg1 == 'good' || $arg1 == 'fair') { + $this->foo = $arg1; + return 1; + } elseif ($arg1 == 'poor' && $arg2 > 1) { + $this->foo = 'poor'; + return 2; + } else { + return false; + } + } + + // }}} +} + +// }}} + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * c-hanging-comment-ender-p: nil + * End: + */ + +?> + +=====================================output===================================== + + * @author Another Author + * @copyright 1997-2005 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @version SVN: $Id$ + * @link http://pear.php.net/package/PackageName + * @see NetOther, Net_Sample::Net_Sample() + * @since File available since Release 1.2.0 + * @deprecated File deprecated in Release 2.0.0 + */ + +/** + * This is a "Docblock Comment," also known as a "docblock." The class' + * docblock, below, contains a complete description of how to write these. + */ +require_once "PEAR.php"; + +// {{{ constants + +/** + * Methods return this if they succeed + */ +define("NET_SAMPLE_OK", 1); + +// }}} +// {{{ GLOBALS + +/** + * The number of objects created + * @global int $GLOBALS['_NET_SAMPLE_Count'] + */ +$GLOBALS["_NET_SAMPLE_Count"] = 0; + +// }}} +// {{{ Net_Sample + +/** + * An example of how to write code to PEAR's standards + * + * Docblock comments start with "/**" at the top. Notice how the "/" + * lines up with the normal indenting and the asterisks on subsequent rows + * are in line with the first asterisk. The last line of comment text + * should be immediately followed on the next line by the closing asterisk + * and slash and then the item you are commenting on should be on the next + * line below that. Don't add extra lines. Please put a blank line + * between paragraphs as well as between the end of the description and + * the start of the @tags. Wrap comments before 80 columns in order to + * ease readability for a wide variety of users. + * + * Docblocks can only be used for programming constructs which allow them + * (classes, properties, methods, defines, includes, globals). See the + * phpDocumentor documentation for more information. + * http://phpdoc.org/docs/HTMLSmartyConverter/default/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html + * + * The Javadoc Style Guide is an excellent resource for figuring out + * how to say what needs to be said in docblock comments. Much of what is + * written here is a summary of what is found there, though there are some + * cases where what's said here overrides what is said there. + * http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#styleguide + * + * The first line of any docblock is the summary. Make them one short + * sentence, without a period at the end. Summaries for classes, properties + * and constants should omit the subject and simply state the object, + * because they are describing things rather than actions or behaviors. + * + * Below are the tags commonly used for classes. @category through @version + * are required. The remainder should only be used when necessary. + * Please use them in the order they appear here. phpDocumentor has + * several other tags available, feel free to use them. + * + * @category CategoryName + * @package PackageName + * @author Original Author + * @author Another Author + * @copyright 1997-2005 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @version Release: @package_version@ + * @link http://pear.php.net/package/PackageName + * @see NetOther, Net_Sample::Net_Sample() + * @since Class available since Release 1.2.0 + * @deprecated Class deprecated in Release 2.0.0 + */ +class Net_Sample +{ + // {{{ properties + + /** + * The status of foo's universe + * + * Potential values are 'good', 'fair', 'poor' and 'unknown'. + * + * @var string + */ + var $foo = "unknown"; + + /** + * The status of life + * + * Note that names of private properties or methods must be + * preceeded by an underscore. + * + * @var bool + * @access private + */ + var $_good = true; + + // }}} + // {{{ setFoo() + + /** + * Registers the status of foo's universe + * + * Summaries for methods should use 3rd person declarative rather + * than 2nd person imperative, beginning with a verb phrase. + * + * Summaries should add description beyond the method's name. The + * best method names are "self-documenting", meaning they tell you + * basically what the method does. If the summary merely repeats + * the method name in sentence form, it is not providing more + * information. + * + * Summary Examples: + * + Sets the label (preferred) + * + Set the label (avoid) + * + This method sets the label (avoid) + * + * Below are the tags commonly used for methods. A @param tag is + * required for each parameter the method has. The @return + * and @access tags are mandatory. The @throws tag is required if + * the method uses exceptions. @static is required if the method can + * be called statically. The remainder should only be used when + * necessary. Please use them in the order they appear here. + * phpDocumentor has several other tags available, feel free to use + * them. + * + * The @param tag contains the data type, then the parameter's + * name, followed by a description. By convention, the first noun in + * the description is the data type of the parameter. Articles like + * "a", "an", and "the" can precede the noun. The descriptions + * should start with a phrase. If further description is necessary, + * follow with sentences. Having two spaces between the name and the + * description aids readability. + * + * When writing a phrase, do not capitalize and do not end with a + * period: + * + the string to be tested + * + * When writing a phrase followed by a sentence, do not capitalize the + * phrase, but end it with a period to distinguish it from the start + * of the next sentence: + * + the string to be tested. Must use UTF-8 encoding. + * + * Return tags should contain the data type then a description of + * the data returned. The data type can be any of PHP's data types + * (int, float, bool, string, array, object, resource, mixed) + * and should contain the type primarily returned. For example, if + * a method returns an object when things work correctly but false + * when an error happens, say 'object' rather than 'mixed.' Use + * 'void' if nothing is returned. + * + * Here's an example of how to format examples: + * + * require_once 'Net/Sample.php'; + * + * $s = new Net_Sample(); + * if (PEAR::isError($s)) { + * echo $s->getMessage() . "\\n"; + * } + * + * + * Here is an example for non-php example or sample: + * + * pear install net_sample + * + * + * @param string $arg1 the string to quote + * @param int $arg2 an integer of how many problems happened. + * Indent to the description's starting point + * for long ones. + * + * @return int the integer of the set mode used. FALSE if foo + * foo could not be set. + * @throws exceptionclass [description] + * + * @access public + * @static + * @see Net_Sample::$foo, Net_Other::someMethod() + * @since Method available since Release 1.2.0 + * @deprecated Method deprecated in Release 2.0.0 + */ + function setFoo($arg1, $arg2 = 0) + { + /* + * This is a "Block Comment." The format is the same as + * Docblock Comments except there is only one asterisk at the + * top. phpDocumentor doesn't parse these. + */ + if ($arg1 == "good" || $arg1 == "fair") { + $this->foo = $arg1; + return 1; + } elseif ($arg1 == "poor" && $arg2 > 1) { + $this->foo = "poor"; + return 2; + } else { + return false; + } + } + + // }}} +} + +// }}} + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * c-hanging-comment-ender-p: nil + * End: + */ + +?> + +================================================================================ +`; + +exports[`doc-1.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +title = $title; + } +} + +/** @var \\Sqlite3 $sqlite */ +foreach($connections as $sqlite) { + // there should be no docblock here + $sqlite->open('/my/database/path'); +} + +/** + * This is a Summary. + * + * This is a Description. It may span multiple lines + * or contain 'code' examples using the _Markdown_ markup + * language. + * + * @see Markdown + * + * @param int $parameter1 A parameter description. + * @param \\Exception $e Another parameter description. + * + * @\\Doctrine\\Orm\\Mapper\\Entity() + * + * @return string + */ +function test($parameter1, $e) +{ +} + +=====================================output===================================== +title = $title; + } +} + +/** @var \\Sqlite3 $sqlite */ +foreach ($connections as $sqlite) { + // there should be no docblock here + $sqlite->open("/my/database/path"); +} + +/** + * This is a Summary. + * + * This is a Description. It may span multiple lines + * or contain 'code' examples using the _Markdown_ markup + * language. + * + * @see Markdown + * + * @param int $parameter1 A parameter description. + * @param \\Exception $e Another parameter description. + * + * @\\Doctrine\\Orm\\Mapper\\Entity() + * + * @return string + */ +function test($parameter1, $e) {} + +================================================================================ +`; + +exports[`echo.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + /* Comments */ $value /* Comments */) {} + +foreach ($x +/*a*/ +as //b +$y) //c +{}; + +foreach ($x as /*a*/ //b +$y) {}; //c + +foreach ($x /*a*/ as $y) {}; //b //c + +foreach ($x +//a +as $y) {}; + +foreach($x as +//a +$y) {}; + +foreach ( + // Comment + $arr as &$value +) { +} + +foreach ( + $arr + as $key => + // Comment + $value +) { +} + +=====================================output===================================== + + /* Comments */ $value /* Comments */ +) { +} + +foreach ( + $x //b + as /*a*/ + $y //c +) { +} + +foreach ( + $x /*a*/ //b + as $y +) { +} //c + +foreach ($x /*a*/ as $y) { +} //b //c + +foreach ( + $x + as //a + $y +) { +} + +foreach ( + $x + as //a + $y +) { +} + +foreach ( + // Comment + $arr + as &$value +) { +} + +foreach ( + $arr + as $key => + // Comment + $value +) { +} + +================================================================================ +`; + +exports[`full.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + $b) { + $foo->bar($arg1); + } else { + BazClass::bar($arg2, $arg3); + } + // Comment + } + + // Comment + final public static function bar() + { + // method body + } +} +// Comment + +=====================================output===================================== + $b) { + $foo->bar($arg1); + } else { + BazClass::bar($arg2, $arg3); + } + // Comment + } + + // Comment + final public static function bar() + { + // method body + } +} +// Comment + +================================================================================ +`; + +exports[`functions.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +addAll($args); + $shouldAmend = true; + } else if ($untrackedChoice === 2) /* Allow Untracked */ { + $allowUntracked = true; + } +} + +function f() { + if ($untrackedChoice === 0) /* Cancel */ + null; + else if ($untrackedChoice === 1) /* Add */ + $shouldAmend = true; + else if ($untrackedChoice === 2) /* Allow Untracked */ + $allowUntracked = true; +} + +function f() { + if ($untrackedChoice === 0) /* Cancel */ // Cancel + null; + else if ($untrackedChoice === 1) /* Add */ // Add + $shouldAmend = true; + else if ($untrackedChoice === 2) /* Allow Untracked */ // Allow Untracked + $allowUntracked = true; +} + +function f() { + if ($untrackedChoice === 0) + /* Cancel */ { + return null; + } + else if ($untrackedChoice === 1) + /* Add */ { + yield $repository->addAll($args); + $shouldAmend = true; + } + else if ($untrackedChoice === 2) + /* Allow Untracked */ { + $allowUntracked = true; + } +} + +function f() { + if ($untrackedChoice === 0) { + /* Cancel */ return null; + } else if ($untrackedChoice === 1) { + /* Add */ yield $repository->addAll($args); + $shouldAmend = true; + } else if ($untrackedChoice === 2) { + /* Allow Untracked */ $allowUntracked = true; + } +} + +if (true) + // Comment + echo 'foo'; +else if (false) + // Comment + echo 'bar'; +else + // Comment + echo 'baz'; + +if (true) // Comment + echo 'foo'; +else if (false) // Comment + echo 'bar'; +else // Comment + echo 'baz'; + +// If the values implements the Arrayable interface we can just call this +// toArray method on the instances which will convert both models and +// collections to their proper array form and we'll set the values. +if ($value instanceof Arrayable) { + $relation = $value->toArray(); +} +// If the value is null, we'll still go ahead and set it in this list of +// attributes since null is used to represent empty relationships if +// if it a has one or belongs to type relationships on the models. +elseif (is_null($value)) { + $relation = $value; +} + +// Comment +if (true) { + call(); +} +// Comment +elseif (false) { + call(); +} + +// Comment +if (true) { + call(); +} + +// Comment +elseif (false) { + call(); +} + +// Comment +if (true) { + call(); +} +// Comment +elseif (false) { + call(); +} +// Comment +else { + call(); +} + +// Comment +if (true) { + call(); +} + +// Comment +elseif (false) { + call(); +} + +// Comment +else { + call(); +} + + +// Comment +if (true) { + call(); +} + + + +// Comment +elseif (false) { + call(); +} + + + +// Comment +else { + call(); +} + + +if (true) { + echo 'test'; +} /* comment */ else if (false) { + echo 'test'; +} +// comment +else { + echo 'test'; +} + +if (true) echo 'test'; +// comment +else echo 'test'; + +if ($code === 92 /* '\\' */) {} +if ($code === 92 /* '\\' */ /* '\\' */) {} + +if ($code === 92) /* '\\' */ {} +if ($code === 92) { /* '\\' */ } + +if ( +1 + // Comment +) { + $a; +} + +if ($var)// Comment +{ + $a = 1; +} + +if ( // Comment + $var +) { + $a = 1; +} + +if ($var) // Comment + $a = 1; +else if ($var) // Comment + $a = 2; +else // Comment + $a = 3; + +if (/* Comment*/ $var /* Comment*/) /* Comment*/ {} + +=====================================output===================================== +addAll($args); + $shouldAmend = true; + } elseif ($untrackedChoice === 2) { + /* Allow Untracked */ $allowUntracked = true; + } +} + +function f() +{ + if ($untrackedChoice === 0) { + /* Cancel */ + null; + } elseif ($untrackedChoice === 1) { + /* Add */ + $shouldAmend = true; + } elseif ($untrackedChoice === 2) { + /* Allow Untracked */ + $allowUntracked = true; + } +} + +function f() +{ + if ($untrackedChoice === 0) { + /* Cancel */ // Cancel + null; + } elseif ($untrackedChoice === 1) { + /* Add */ // Add + $shouldAmend = true; + } elseif ($untrackedChoice === 2) { + /* Allow Untracked */ // Allow Untracked + $allowUntracked = true; + } +} + +function f() +{ + if ($untrackedChoice === 0) { + /* Cancel */ return null; + } elseif ($untrackedChoice === 1) { + /* Add */ yield $repository->addAll($args); + $shouldAmend = true; + } elseif ($untrackedChoice === 2) { + /* Allow Untracked */ $allowUntracked = true; + } +} + +function f() +{ + if ($untrackedChoice === 0) { + /* Cancel */ return null; + } elseif ($untrackedChoice === 1) { + /* Add */ yield $repository->addAll($args); + $shouldAmend = true; + } elseif ($untrackedChoice === 2) { + /* Allow Untracked */ $allowUntracked = true; + } +} + +if (true) { + // Comment + echo "foo"; +} elseif (false) { + // Comment + echo "bar"; +} +// Comment +else { + echo "baz"; +} + +if (true) { + // Comment + echo "foo"; +} elseif (false) { + // Comment + echo "bar"; +} +// Comment +else { + echo "baz"; +} + +// If the values implements the Arrayable interface we can just call this +// toArray method on the instances which will convert both models and +// collections to their proper array form and we'll set the values. +if ($value instanceof Arrayable) { + $relation = $value->toArray(); +} +// If the value is null, we'll still go ahead and set it in this list of +// attributes since null is used to represent empty relationships if +// if it a has one or belongs to type relationships on the models. +elseif (is_null($value)) { + $relation = $value; +} + +// Comment +if (true) { + call(); +} +// Comment +elseif (false) { + call(); +} + +// Comment +if (true) { + call(); +} + +// Comment +elseif (false) { + call(); +} + +// Comment +if (true) { + call(); +} +// Comment +elseif (false) { + call(); +} +// Comment +else { + call(); +} + +// Comment +if (true) { + call(); +} + +// Comment +elseif (false) { + call(); +} + +// Comment +else { + call(); +} + +// Comment +if (true) { + call(); +} + +// Comment +elseif (false) { + call(); +} + +// Comment +else { + call(); +} + +if (true) { + echo "test"; +} /* comment */ elseif (false) { + echo "test"; +} +// comment +else { + echo "test"; +} + +if (true) { + echo "test"; +} +// comment +else { + echo "test"; +} + +if ($code === 92 /* '\\' */) { +} +if ($code === 92 /* '\\' */ /* '\\' */) { +} + +if ($code === 92) { + /* '\\' */ +} +if ($code === 92) { + /* '\\' */ +} + +if ( + 1 + // Comment +) { + $a; +} + +if ($var) { + // Comment + $a = 1; +} + +if ( + // Comment + $var +) { + $a = 1; +} + +if ($var) { + // Comment + $a = 1; +} elseif ($var) { + // Comment + $a = 2; +} +// Comment +else { + $a = 3; +} + +if (/* Comment*/ $var /* Comment*/) { + /* Comment*/ +} + +================================================================================ +`; + +exports[`include.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +

Test

+ +=====================================output===================================== + +

Test

+ +================================================================================ +`; + +exports[`inline3.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +

Test

+ + +=====================================output===================================== +

Test

+ +================================================================================ +`; + +exports[`inline4.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +

Test

+ +=====================================output===================================== + +

Test

+ +================================================================================ +`; + +exports[`inline5.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +

Test

+ +

Test

+ +=====================================output===================================== +

Test

+ +

Test

+ +================================================================================ +`; + +exports[`inline6.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +

Test

+ +

Test

+ +=====================================output===================================== +

Test

+ +

Test

+ +================================================================================ +`; + +exports[`inline7.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`inline8.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +

>

+ +

>

+ + + + + +
+ +
+ + + + + +
+ + + + + + +=====================================output===================================== +

>

+ +

>

+ + + + + +
+ +
+ + + + + +
+ + + + + + +================================================================================ +`; + +exports[`inline9.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + +=====================================output===================================== + + + + +================================================================================ +`; + +exports[`interface.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 1, + + + + /* + * second comment + */ + + + + 'b' => 2, + // leading comment ... + 'c' => 3, /* ... and trailing comment */ + 'd' // fourth comment + => 4, + default => null // final comment +}; + +=====================================output===================================== + 1, + + /* + * second comment + */ + "b" => 2, + // leading comment ... + "c" => 3, /* ... and trailing comment */ + "d" // fourth comment + => 4, + default => null, // final comment +}; + +================================================================================ +`; + +exports[`method.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +setVendorAddress( + $vendor->address_1, // address 1 + $vendor->address_2, // address 2 + '', // address 3 mike testing + '', // address 4 + '', // address 5 + $vendor->city, // city + $vendor->state, // state + $vendor->zip // state + ); + } +} + +class Foo { + function foo() + // this is a function + { + return 42; + } + + function foo() // this is a function + { + return 42; + } + + function foo() { // this is a function + return 42; + } + + function foo() { + // this is a function + return 42; + } + + function foo // this is a function + () { + return 42; + } +} + +=====================================output===================================== +setVendorAddress( + $vendor->address_1, // address 1 + $vendor->address_2, // address 2 + "", // address 3 mike testing + "", // address 4 + "", // address 5 + $vendor->city, // city + $vendor->state, // state + $vendor->zip, // state + ); + } +} + +class Foo +{ + function foo() + { + // this is a function + return 42; + } + + function foo() + { + // this is a function + return 42; + } + + function foo() + { + // this is a function + return 42; + } + + function foo() + { + // this is a function + return 42; + } + + function foo() + { + // this is a function + return 42; + } +} + +================================================================================ +`; + +exports[`namespace.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Acme; + +class Foo +{ +} + +=====================================output===================================== + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Acme; + +class Foo {} + +================================================================================ +`; + +exports[`namespace-5.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Acme; + +class Foo +{ +} + +=====================================output===================================== + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Acme; + +class Foo {} + +================================================================================ +`; + +exports[`namespace-6.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\\Formatter; + +use Monolog\\Logger; + +=====================================output===================================== + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\\Formatter; + +use Monolog\\Logger; + +================================================================================ +`; + +exports[`namespace-7.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace Monolog\\Formatter; +use Monolog\\Logger; + +=====================================output===================================== + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace Monolog\\Formatter; +use Monolog\\Logger; + +================================================================================ +`; + +exports[`namespace-8.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\\Handler; + +/** + * Base Handler class providing basic close() support as well as handleBatch + * + * @author Jordi Boggiano + */ + +=====================================output===================================== + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\\Handler; + +/** + * Base Handler class providing basic close() support as well as handleBatch + * + * @author Jordi Boggiano + */ + +================================================================================ +`; + +exports[`namespace-9.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace Monolog\\Handler; +/** + * Base Handler class providing basic close() support as well as handleBatch + * + * @author Jordi Boggiano + */ + +=====================================output===================================== + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace Monolog\\Handler; +/** + * Base Handler class providing basic close() support as well as handleBatch + * + * @author Jordi Boggiano + */ + +================================================================================ +`; + +exports[`namespace-10.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + */ +class FlowdockFormatter +{ +} + +=====================================output===================================== + + */ +class FlowdockFormatter {} + +================================================================================ +`; + +exports[`namespace-11.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + */ +class FlowdockFormatter +{ +} + +=====================================output===================================== + + */ +class FlowdockFormatter {} + +================================================================================ +`; + +exports[`namespace-12.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + */ +class FlowdockFormatter +{ +} + +=====================================output===================================== + + */ +class FlowdockFormatter {} + +================================================================================ +`; + +exports[`namespace-13.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + */ +class FlowdockFormatter +{ +} + +=====================================output===================================== + + */ +class FlowdockFormatter {} + +================================================================================ +`; + +exports[`namespace-14.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + */ +class FlowdockFormatter +{ +} + +=====================================output===================================== + + */ +class FlowdockFormatter {} + +================================================================================ +`; + +exports[`namespace-15.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + */ +class FlowdockFormatter +{ +} + +=====================================output===================================== + + */ +class FlowdockFormatter {} + +================================================================================ +`; + +exports[`namespace-16.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + */ +class FlowdockFormatter +{ +} + +=====================================output===================================== + + */ +class FlowdockFormatter {} + +================================================================================ +`; + +exports[`namespace-17.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + */ +class FlowdockFormatter +{ +} + +=====================================output===================================== + + */ +class FlowdockFormatter {} + +================================================================================ +`; + +exports[`namespace-18.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + */ +class FlowdockFormatter +{ +} + +=====================================output===================================== + + */ +class FlowdockFormatter {} + +================================================================================ +`; + +exports[`namespace-19.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + * require_once 'Net/Sample.php'; + * + * $s = new Net_Sample(); + * if (PEAR::isError($s)) { + * echo $s->getMessage() . "\\n"; + * } + * + * + * Here is an example for non-php example or sample: + * + * pear install net_sample + * + * + * @param string $arg1 the string to quote + * @param int $arg2 an integer of how many problems happened. + * Indent to the description's starting point + * for long ones. + * + * @return int the integer of the set mode used. FALSE if foo + * foo could not be set. + * @throws exceptionclass [description] + * + * @access public + * @static + * @see Net_Sample::$foo, Net_Other::someMethod() + * @since Method available since Release 1.2.0 + * @deprecated Method deprecated in Release 2.0.0 + */ + function setFoo($arg1, $arg2 = 0) + { + /* + * This is a "Block Comment." The format is the same as + * Docblock Comments except there is only one asterisk at the + * top. phpDocumentor doesn't parse these. + */ + if ($arg1 == 'good' || $arg1 == 'fair') { + $this->foo = $arg1; + return 1; + } elseif ($arg1 == 'poor' && $arg2 > 1) { + $this->foo = 'poor'; + return 2; + } else { + return false; + } + } + + // }}} +}; + +$a = new // Comment +Foo(); +$a = new class // Comment +{ +}; +$a = new // Comment + Foo(); +$a = new class // Comment +{ +}; +=====================================output===================================== + + * require_once 'Net/Sample.php'; + * + * $s = new Net_Sample(); + * if (PEAR::isError($s)) { + * echo $s->getMessage() . "\\n"; + * } + * + * + * Here is an example for non-php example or sample: + * + * pear install net_sample + * + * + * @param string $arg1 the string to quote + * @param int $arg2 an integer of how many problems happened. + * Indent to the description's starting point + * for long ones. + * + * @return int the integer of the set mode used. FALSE if foo + * foo could not be set. + * @throws exceptionclass [description] + * + * @access public + * @static + * @see Net_Sample::$foo, Net_Other::someMethod() + * @since Method available since Release 1.2.0 + * @deprecated Method deprecated in Release 2.0.0 + */ + function setFoo($arg1, $arg2 = 0) + { + /* + * This is a "Block Comment." The format is the same as + * Docblock Comments except there is only one asterisk at the + * top. phpDocumentor doesn't parse these. + */ + if ($arg1 == "good" || $arg1 == "fair") { + $this->foo = $arg1; + return 1; + } elseif ($arg1 == "poor" && $arg2 > 1) { + $this->foo = "poor"; + return 2; + } else { + return false; + } + } + + // }}} +}; + +$a = new // Comment + Foo(); +$a = new class { + // Comment +}; +$a = new // Comment + Foo(); +$a = new class { + // Comment +}; + +================================================================================ +`; + +exports[`no_code.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`no_code-1.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`nowdoc.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +/*Comment*/bar(); + +=====================================output===================================== +/*Comment*/ bar(); + +================================================================================ +`; + +exports[`retif.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +inspect($v, 0, 0, $colors); + } + : // node > 0.8.x + function($v, $colors) { + return $util->inspect($v, [ 'colors' => colors ]); + }; + +$extractTextPluginOptions = $shouldUseRelativeAssetPaths + // Making sure that the publicPath goes back to to build folder. + ? [ 'publicPath' => (new Foo($cssFilename->split('/')->length))->join('../') ] : + []; + +$extractTextPluginOptions = $shouldUseRelativeAssetPaths + ? // Making sure that the publicPath goes back to to build folder. + [ 'publicPath' => (new Foo($cssFilename->split("/")->length))->join("../") ] + : []; + +$extractTextPluginOptions = $shouldUseRelativeAssetPaths // Making sure that the publicPath goes back to to build folder. + ? [ 'publicPath' => (new Foo($cssFilename->split("/")->length))->join("../") ] + : []; + +$var = $process->env->NODE_ENV === "production" + ? call("./configureProdStore") // a + : call("./configureDevStore"); // b + +$var = $a + // Comment + ? $b + // Comment + : $c; + +$var = $a + ? // Comment + $b + : // Comment + $c; + +$var = $a + ? $b + // Comment + : $c + // Comment + ; + +$var = $a + ? $b // Comment + : $c // Comment +; + +$var = $a + ? $b // Comment + : $c; // Comment + +=====================================output===================================== +inspect($v, 0, 0, $colors); + } + : // node > 0.8.x + function ($v, $colors) { + return $util->inspect($v, ["colors" => colors]); + }; + +$extractTextPluginOptions = $shouldUseRelativeAssetPaths + ? // Making sure that the publicPath goes back to to build folder. + ["publicPath" => new Foo($cssFilename->split("/")->length)->join("../")] + : []; + +$extractTextPluginOptions = $shouldUseRelativeAssetPaths + ? // Making sure that the publicPath goes back to to build folder. + ["publicPath" => new Foo($cssFilename->split("/")->length)->join("../")] + : []; + +$extractTextPluginOptions = $shouldUseRelativeAssetPaths // Making sure that the publicPath goes back to to build folder. + ? ["publicPath" => new Foo($cssFilename->split("/")->length)->join("../")] + : []; + +$var = + $process->env->NODE_ENV === "production" + ? call("./configureProdStore") // a + : call("./configureDevStore"); // b + +$var = $a + ? // Comment + $b + : // Comment + $c; + +$var = $a + ? // Comment + $b + : // Comment + $c; + +$var = $a + ? $b + : // Comment + $c; +// Comment + +$var = $a + ? $b // Comment + : $c; // Comment + +$var = $a + ? $b // Comment + : $c; // Comment + +================================================================================ +`; + +exports[`return.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + 'val' +]; + +$obj // Comment 2 += [ +'key' => 'val' +]; + +$obj = [ // Comment 3 +'key' => 'val' +]; + +$obj = [ +// Comment 4 +'key' => 'val' +]; + +$obj = // Comment 5 +[ +'val' +]; + +$obj // Comment 6 += [ +'val' +]; + +$obj = [ // Comment 7 +'val' +]; + +$obj = [ +// Comment 8 +'val' +]; + +$obj = // Comment 9 +'val'; + +$obj = // Comment +' +val +val +'; + +$obj = // Comment + ' + val + val + '; + +$obj = // Comment + "val"; + +$obj = // Comment +" +val +val +"; + +$obj = // Comment + " + val + val + "; + +$obj = // Comment + "val \${$var}"; + +$obj = // Comment +" +val +\${$var} +"; + +$obj = // Comment + " + val + \${$var} + "; + +=====================================output===================================== + "val", + ]; + +$obj = [ // Comment 2 + "key" => "val", +]; + +$obj = [ + // Comment 3 + "key" => "val", +]; + +$obj = [ + // Comment 4 + "key" => "val", +]; + +$obj = + // Comment 5 + ["val"]; + +$obj = ["val"]; // Comment 6 + +$obj = [ + // Comment 7 + "val", +]; + +$obj = [ + // Comment 8 + "val", +]; + +$obj = + // Comment 9 + "val"; + +$obj = + // Comment + ' +val +val +'; + +$obj = + // Comment + ' + val + val + '; + +$obj = + // Comment + "val"; + +$obj = + // Comment + " +val +val +"; + +$obj = + // Comment + " + val + val + "; + +$obj = + // Comment + "val \${$var}"; + +$obj = + // Comment + " +val +\${$var} +"; + +$obj = + // Comment + " + val + \${$var} + "; + +================================================================================ +`; + +exports[`variadic.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + /* Comment */ $fields /* Comment */; + yield // Comment + $i; + yield + // Comment + $i + // Comment + => + // Comment + $var + ; +} + +=====================================output===================================== + /* Comment */ $fields /* Comment */; + yield // Comment + $i; + yield // Comment + $i => // Comment + // Comment + $var; +} + +================================================================================ +`; + +exports[`yieldfrom.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + // Comment A + // Comment B + 'string' +]; + +$array = [ + 'key' => // Comment A + // Comment B + 'string' +]; + +$array = [ + 'key' => // Comment A + 'string' +]; + +array // Comment +(); + +$array = array // Comment +(); + +$array = array // Comment +('string', 'other-string'); + +call( + array // Comment + () +); + +call( + array // Comment + ('string', 'other-string') +); diff --git a/tests/comments/assign.php b/tests/comments/assign.php new file mode 100644 index 000000000..a2ac7643b --- /dev/null +++ b/tests/comments/assign.php @@ -0,0 +1,66 @@ +pricingQueryOfferResult->offer || + !$this->pricingQueryOfferResult->offer->offerGroup || + //!$this->pricingQuerySite->postcode || + ( // offer has a state but we don't + $this->pricingQueryOfferResult->offer->offerGroup->state_id + && !$this->pricingQuerySite->postcode->state_id + ) || + ( // if we have a state and the offer has a state and they don't match, reject + $this->pricingQuerySite->postcode + && $this->pricingQuerySite->postcode->state_id + && $this->pricingQueryOfferResult->offer->offerGroup->state_id + && $this->pricingQuerySite->postcode->state_id != $this->pricingQueryOfferResult->offer->offerGroup->state_id + ) +) { + $this->hasResult = false; + $this->removedReason = 'State Mismatch'; +} + +if ($bool0 + || $bool1 // if condition 1 + || $bool2 // if condition 2 +) { + $ok = true; +} \ No newline at end of file diff --git a/tests/comments/blank_lines.php b/tests/comments/blank_lines.php new file mode 100644 index 000000000..ad66a3d05 --- /dev/null +++ b/tests/comments/blank_lines.php @@ -0,0 +1,9 @@ +bar(/* B */); + +render( // Comment + 'string', + $container +); + +$var->render( // Comment + 'string', + $var +); + +render( + 'string', + $container + // Comment +); + +$var->render( + 'string', + $var + // Comment +); + +$var->render( + // Comment + 'string', + // Comment + $var + // Comment +); diff --git a/tests/comments/cast.php b/tests/comments/cast.php index 24c8f16cc..76a3f6cde 100644 --- a/tests/comments/cast.php +++ b/tests/comments/cast.php @@ -1,3 +1,10 @@ each() // Comment + // Comment + ->map() // Comment + // Comment + ->first() // Comment + // Comment + ->dump(); + +$var = $a /* Comment*/->/*Comment*/ bar; +$var = $a/* Comment */['test']; +$var = $a /* Comment */->/* Comment */ bar(); +$var = $a /* Comment */::/* Comment */ bar(); + +$a /* Comment*/->/*Comment*/ bar/* Comment */; +$a/* Comment */['test']; +$a /* Comment */->/* Comment */ bar(); +$a /* Comment */::/* Comment */ bar(); diff --git a/tests/comments/class.php b/tests/comments/class.php index ee803b8e8..c195da91f 100644 --- a/tests/comments/class.php +++ b/tests/comments/class.php @@ -59,3 +59,80 @@ public function render(): string; class Foo {/* Comment */} interface FooI {/* Comment */} trait FooT {/* Comment */} + +// 424 : Method failure +class ResponseMethodFailure + // behaves as an error + extends ResponseNotAcceptable + implements + // Some comment + FooBar, + // Another comment + BarBaz +{ + +} + +// 424 : Method failure +class ResponseMethodFailure + extends // behaves as an error + ResponseNotAcceptable + implements + // Some comment + FooBar, + // Another comment + BarBaz +{ + +} + + +// 424 : Method failure +class ResponseMethodFailure + extends + // behaves as an error + ResponseNotAcceptable + implements + // Some comment + FooBar, + // Another comment + BarBaz +{ + +} + +// 424 : Method failure +class ResponseMethodFailure extends ResponseNotAcceptable implements + // Some comment + FooBar, + // Another comment + BarBaz +{ + +} + +class MyClass +{ +} + +// Comment +class MyClass +{ + +} + +class MyClass +{ + // Comment +} + +$var = new class {}; + +// Comment +$var = new class {}; + +$var = new class { + // Comment +}; + +$foo = /*a*/ new /* b */ class {}; diff --git a/tests/comments/classconstant.php b/tests/comments/classconstant.php new file mode 100644 index 000000000..23c2113f9 --- /dev/null +++ b/tests/comments/classconstant.php @@ -0,0 +1,36 @@ +map(function ($protocol) { + // Comment + + return $protocol; + }) + // Comment + -> + // Comment + call(function ($arg) { + // Comment + + return $arg; + }); + + +$foo = /** +* @param array{a: int, b: string} $bar +*/ +static fn (array $bar) => $bar; diff --git a/tests/comments/declare-1.php b/tests/comments/declare-1.php new file mode 100644 index 000000000..4ca7422e1 --- /dev/null +++ b/tests/comments/declare-1.php @@ -0,0 +1,20 @@ +=2014 Marc Morera + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * Feel free to edit as you please, and have fun. + * + * @author Marc Morera + */ + +declare(strict_types=1); + +namespace Mmoreram\PHPFormatter\Tests\Fixer; + +use PHPUnit_Framework_TestCase; diff --git a/tests/comments/declare-10.php b/tests/comments/declare-10.php new file mode 100644 index 000000000..c4fb4346f --- /dev/null +++ b/tests/comments/declare-10.php @@ -0,0 +1,18 @@ +. + */ + +declare(strict_types=1); diff --git a/tests/comments/declare-2.php b/tests/comments/declare-2.php new file mode 100644 index 000000000..674be238e --- /dev/null +++ b/tests/comments/declare-2.php @@ -0,0 +1,16 @@ +=2014 Marc Morera + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * Feel free to edit as you please, and have fun. + * + * @author Marc Morera + */ +declare(strict_types=1); +namespace Mmoreram\PHPFormatter\Tests\Fixer; +use PHPUnit_Framework_TestCase; diff --git a/tests/comments/declare-3.php b/tests/comments/declare-3.php new file mode 100644 index 000000000..c4f36b49b --- /dev/null +++ b/tests/comments/declare-3.php @@ -0,0 +1,24 @@ +=2014 Marc Morera + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * Feel free to edit as you please, and have fun. + * + * @author Marc Morera + */ + + +declare(strict_types=1); + + +namespace Mmoreram\PHPFormatter\Tests\Fixer; + + +use PHPUnit_Framework_TestCase; diff --git a/tests/comments/declare-4.php b/tests/comments/declare-4.php new file mode 100644 index 000000000..451a5eb97 --- /dev/null +++ b/tests/comments/declare-4.php @@ -0,0 +1,9 @@ +. + */ +declare(strict_types=1); diff --git a/tests/comments/declare.php b/tests/comments/declare.php new file mode 100644 index 000000000..c71dd335f --- /dev/null +++ b/tests/comments/declare.php @@ -0,0 +1,50 @@ +title = $title; + } +} + +/** @var \Sqlite3 $sqlite */ +foreach($connections as $sqlite) { + // there should be no docblock here + $sqlite->open('/my/database/path'); +} + +/** + * This is a Summary. + * + * This is a Description. It may span multiple lines + * or contain 'code' examples using the _Markdown_ markup + * language. + * + * @see Markdown + * + * @param int $parameter1 A parameter description. + * @param \Exception $e Another parameter description. + * + * @\Doctrine\Orm\Mapper\Entity() + * + * @return string + */ +function test($parameter1, $e) +{ +} diff --git a/tests/comments/doc.php b/tests/comments/doc.php new file mode 100644 index 000000000..1f07e4e28 --- /dev/null +++ b/tests/comments/doc.php @@ -0,0 +1,241 @@ + + * @author Another Author + * @copyright 1997-2005 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @version SVN: $Id$ + * @link http://pear.php.net/package/PackageName + * @see NetOther, Net_Sample::Net_Sample() + * @since File available since Release 1.2.0 + * @deprecated File deprecated in Release 2.0.0 + */ + +/** + * This is a "Docblock Comment," also known as a "docblock." The class' + * docblock, below, contains a complete description of how to write these. + */ +require_once 'PEAR.php'; + +// {{{ constants + +/** + * Methods return this if they succeed + */ +define('NET_SAMPLE_OK', 1); + +// }}} +// {{{ GLOBALS + +/** + * The number of objects created + * @global int $GLOBALS['_NET_SAMPLE_Count'] + */ +$GLOBALS['_NET_SAMPLE_Count'] = 0; + +// }}} +// {{{ Net_Sample + +/** + * An example of how to write code to PEAR's standards + * + * Docblock comments start with "/**" at the top. Notice how the "/" + * lines up with the normal indenting and the asterisks on subsequent rows + * are in line with the first asterisk. The last line of comment text + * should be immediately followed on the next line by the closing asterisk + * and slash and then the item you are commenting on should be on the next + * line below that. Don't add extra lines. Please put a blank line + * between paragraphs as well as between the end of the description and + * the start of the @tags. Wrap comments before 80 columns in order to + * ease readability for a wide variety of users. + * + * Docblocks can only be used for programming constructs which allow them + * (classes, properties, methods, defines, includes, globals). See the + * phpDocumentor documentation for more information. + * http://phpdoc.org/docs/HTMLSmartyConverter/default/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html + * + * The Javadoc Style Guide is an excellent resource for figuring out + * how to say what needs to be said in docblock comments. Much of what is + * written here is a summary of what is found there, though there are some + * cases where what's said here overrides what is said there. + * http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#styleguide + * + * The first line of any docblock is the summary. Make them one short + * sentence, without a period at the end. Summaries for classes, properties + * and constants should omit the subject and simply state the object, + * because they are describing things rather than actions or behaviors. + * + * Below are the tags commonly used for classes. @category through @version + * are required. The remainder should only be used when necessary. + * Please use them in the order they appear here. phpDocumentor has + * several other tags available, feel free to use them. + * + * @category CategoryName + * @package PackageName + * @author Original Author + * @author Another Author + * @copyright 1997-2005 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @version Release: @package_version@ + * @link http://pear.php.net/package/PackageName + * @see NetOther, Net_Sample::Net_Sample() + * @since Class available since Release 1.2.0 + * @deprecated Class deprecated in Release 2.0.0 + */ +class Net_Sample +{ + // {{{ properties + + /** + * The status of foo's universe + * + * Potential values are 'good', 'fair', 'poor' and 'unknown'. + * + * @var string + */ + var $foo = 'unknown'; + + /** + * The status of life + * + * Note that names of private properties or methods must be + * preceeded by an underscore. + * + * @var bool + * @access private + */ + var $_good = true; + + // }}} + // {{{ setFoo() + + /** + * Registers the status of foo's universe + * + * Summaries for methods should use 3rd person declarative rather + * than 2nd person imperative, beginning with a verb phrase. + * + * Summaries should add description beyond the method's name. The + * best method names are "self-documenting", meaning they tell you + * basically what the method does. If the summary merely repeats + * the method name in sentence form, it is not providing more + * information. + * + * Summary Examples: + * + Sets the label (preferred) + * + Set the label (avoid) + * + This method sets the label (avoid) + * + * Below are the tags commonly used for methods. A @param tag is + * required for each parameter the method has. The @return + * and @access tags are mandatory. The @throws tag is required if + * the method uses exceptions. @static is required if the method can + * be called statically. The remainder should only be used when + * necessary. Please use them in the order they appear here. + * phpDocumentor has several other tags available, feel free to use + * them. + * + * The @param tag contains the data type, then the parameter's + * name, followed by a description. By convention, the first noun in + * the description is the data type of the parameter. Articles like + * "a", "an", and "the" can precede the noun. The descriptions + * should start with a phrase. If further description is necessary, + * follow with sentences. Having two spaces between the name and the + * description aids readability. + * + * When writing a phrase, do not capitalize and do not end with a + * period: + * + the string to be tested + * + * When writing a phrase followed by a sentence, do not capitalize the + * phrase, but end it with a period to distinguish it from the start + * of the next sentence: + * + the string to be tested. Must use UTF-8 encoding. + * + * Return tags should contain the data type then a description of + * the data returned. The data type can be any of PHP's data types + * (int, float, bool, string, array, object, resource, mixed) + * and should contain the type primarily returned. For example, if + * a method returns an object when things work correctly but false + * when an error happens, say 'object' rather than 'mixed.' Use + * 'void' if nothing is returned. + * + * Here's an example of how to format examples: + * + * require_once 'Net/Sample.php'; + * + * $s = new Net_Sample(); + * if (PEAR::isError($s)) { + * echo $s->getMessage() . "\n"; + * } + * + * + * Here is an example for non-php example or sample: + * + * pear install net_sample + * + * + * @param string $arg1 the string to quote + * @param int $arg2 an integer of how many problems happened. + * Indent to the description's starting point + * for long ones. + * + * @return int the integer of the set mode used. FALSE if foo + * foo could not be set. + * @throws exceptionclass [description] + * + * @access public + * @static + * @see Net_Sample::$foo, Net_Other::someMethod() + * @since Method available since Release 1.2.0 + * @deprecated Method deprecated in Release 2.0.0 + */ + function setFoo($arg1, $arg2 = 0) + { + /* + * This is a "Block Comment." The format is the same as + * Docblock Comments except there is only one asterisk at the + * top. phpDocumentor doesn't parse these. + */ + if ($arg1 == 'good' || $arg1 == 'fair') { + $this->foo = $arg1; + return 1; + } elseif ($arg1 == 'poor' && $arg2 > 1) { + $this->foo = 'poor'; + return 2; + } else { + return false; + } + } + + // }}} +} + +// }}} + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * c-hanging-comment-ender-p: nil + * End: + */ + +?> diff --git a/tests/comments/echo.php b/tests/comments/echo.php index 4220cdde5..5741cb178 100644 --- a/tests/comments/echo.php +++ b/tests/comments/echo.php @@ -6,4 +6,29 @@ $bar // Comment ; // Comment -/* Comment */echo/* Comment */$foo/* Comment */,/* Comment */$bar/* Comment */;/* Comment */ \ No newline at end of file +/* Comment */echo/* Comment */$foo/* Comment */,/* Comment */$bar/* Comment */;/* Comment */ + +echo // Comment + $a; + +echo // Comment + call(); + +echo // Comment + call($veryVeryVeryVeryVeryVeryVeryLongArg, $veryVeryVeryVeryVeryVeryVeryLongArg, $veryVeryVeryVeryVeryVeryVeryLongArg); + +echo // Comment +<< /* Comments */ $value /* Comments */) {} + +foreach ($x +/*a*/ +as //b +$y) //c +{}; + +foreach ($x as /*a*/ //b +$y) {}; //c + +foreach ($x /*a*/ as $y) {}; //b //c + +foreach ($x +//a +as $y) {}; + +foreach($x as +//a +$y) {}; + +foreach ( + // Comment + $arr as &$value +) { +} + +foreach ( + $arr + as $key => + // Comment + $value +) { +} diff --git a/tests/comments/full.php b/tests/comments/full.php new file mode 100644 index 000000000..bb046b1b9 --- /dev/null +++ b/tests/comments/full.php @@ -0,0 +1,50 @@ + $b) { + $foo->bar($arg1); + } else { + BazClass::bar($arg2, $arg3); + } + // Comment + } + + // Comment + final public static function bar() + { + // method body + } +} +// Comment diff --git a/tests/comments/functions.php b/tests/comments/functions.php index edd4e740c..4360fc1f1 100644 --- a/tests/comments/functions.php +++ b/tests/comments/functions.php @@ -4,3 +4,37 @@ function foo(/* 1 */ $a /* 2 */ = /* 3 */ 1 /* 4 */) {} function foo($a): /* 5 */ ?string /* 6 */ {} function foo(/* 1 */ $a /* 2 */ = /* 3 */ 1 /* 4 */): /* 5 */ ?string /* 6 */ {} function emptyFn(/*Comment */) {} +function func( // Comment +) {} +function func( + // Comment +) {} +function foo( + // Comment + int $a, + // Comment + string $b, + bool // Comment + $c +) {} + +function foo() +// this is a function +{ + return 42; +} +function foo() // this is a function +{ + return 42; +} +function foo() { // this is a function + return 42; +} +function foo() { + // this is a function + return 42; +} +function foo // this is a function +() { + return 42; +} diff --git a/tests/comments/global.php b/tests/comments/global.php index 6bce0c3ad..e673642ca 100644 --- a/tests/comments/global.php +++ b/tests/comments/global.php @@ -1,3 +1,11 @@ addAll($args); + $shouldAmend = true; + } else if ($untrackedChoice === 2) /* Allow Untracked */ { + $allowUntracked = true; + } +} + +function f() { + if ($untrackedChoice === 0) /* Cancel */ + null; + else if ($untrackedChoice === 1) /* Add */ + $shouldAmend = true; + else if ($untrackedChoice === 2) /* Allow Untracked */ + $allowUntracked = true; +} + +function f() { + if ($untrackedChoice === 0) /* Cancel */ // Cancel + null; + else if ($untrackedChoice === 1) /* Add */ // Add + $shouldAmend = true; + else if ($untrackedChoice === 2) /* Allow Untracked */ // Allow Untracked + $allowUntracked = true; +} + +function f() { + if ($untrackedChoice === 0) + /* Cancel */ { + return null; + } + else if ($untrackedChoice === 1) + /* Add */ { + yield $repository->addAll($args); + $shouldAmend = true; + } + else if ($untrackedChoice === 2) + /* Allow Untracked */ { + $allowUntracked = true; + } +} + +function f() { + if ($untrackedChoice === 0) { + /* Cancel */ return null; + } else if ($untrackedChoice === 1) { + /* Add */ yield $repository->addAll($args); + $shouldAmend = true; + } else if ($untrackedChoice === 2) { + /* Allow Untracked */ $allowUntracked = true; + } +} + +if (true) + // Comment + echo 'foo'; +else if (false) + // Comment + echo 'bar'; +else + // Comment + echo 'baz'; + +if (true) // Comment + echo 'foo'; +else if (false) // Comment + echo 'bar'; +else // Comment + echo 'baz'; + +// If the values implements the Arrayable interface we can just call this +// toArray method on the instances which will convert both models and +// collections to their proper array form and we'll set the values. +if ($value instanceof Arrayable) { + $relation = $value->toArray(); +} +// If the value is null, we'll still go ahead and set it in this list of +// attributes since null is used to represent empty relationships if +// if it a has one or belongs to type relationships on the models. +elseif (is_null($value)) { + $relation = $value; +} + +// Comment +if (true) { + call(); +} +// Comment +elseif (false) { + call(); +} + +// Comment +if (true) { + call(); +} + +// Comment +elseif (false) { + call(); +} + +// Comment +if (true) { + call(); +} +// Comment +elseif (false) { + call(); +} +// Comment +else { + call(); +} + +// Comment +if (true) { + call(); +} + +// Comment +elseif (false) { + call(); +} + +// Comment +else { + call(); +} + + +// Comment +if (true) { + call(); +} + + + +// Comment +elseif (false) { + call(); +} + + + +// Comment +else { + call(); +} + + +if (true) { + echo 'test'; +} /* comment */ else if (false) { + echo 'test'; +} +// comment +else { + echo 'test'; +} + +if (true) echo 'test'; +// comment +else echo 'test'; + +if ($code === 92 /* '\' */) {} +if ($code === 92 /* '\' */ /* '\' */) {} + +if ($code === 92) /* '\' */ {} +if ($code === 92) { /* '\' */ } + +if ( +1 + // Comment +) { + $a; +} + +if ($var)// Comment +{ + $a = 1; +} + +if ( // Comment + $var +) { + $a = 1; +} + +if ($var) // Comment + $a = 1; +else if ($var) // Comment + $a = 2; +else // Comment + $a = 3; + +if (/* Comment*/ $var /* Comment*/) /* Comment*/ {} diff --git a/tests/comments/include.php b/tests/comments/include.php index 8aef7d19c..3bd5cf45c 100644 --- a/tests/comments/include.php +++ b/tests/comments/include.php @@ -12,3 +12,6 @@ "test.php" // Comment // Comment ); // Comment + +include /* Comment */ $a /* Comment */; +include /* Comment */ 'string' /* Comment */; diff --git a/tests/comments/inline.php b/tests/comments/inline.php new file mode 100644 index 000000000..22b40673d --- /dev/null +++ b/tests/comments/inline.php @@ -0,0 +1,6 @@ +some text +/** +* A comment +*/ + +

Test

diff --git a/tests/comments/inline3.php b/tests/comments/inline3.php new file mode 100644 index 000000000..bc867518c --- /dev/null +++ b/tests/comments/inline3.php @@ -0,0 +1,4 @@ +

Test

+ diff --git a/tests/comments/inline4.php b/tests/comments/inline4.php new file mode 100644 index 000000000..7061fd938 --- /dev/null +++ b/tests/comments/inline4.php @@ -0,0 +1,12 @@ + +

Test

diff --git a/tests/comments/inline5.php b/tests/comments/inline5.php new file mode 100644 index 000000000..466ec2e67 --- /dev/null +++ b/tests/comments/inline5.php @@ -0,0 +1,5 @@ +

Test

+ +

Test

diff --git a/tests/comments/inline6.php b/tests/comments/inline6.php new file mode 100644 index 000000000..446cd5a91 --- /dev/null +++ b/tests/comments/inline6.php @@ -0,0 +1,9 @@ +

Test

+ +

Test

diff --git a/tests/comments/inline7.php b/tests/comments/inline7.php new file mode 100644 index 000000000..71b568f11 --- /dev/null +++ b/tests/comments/inline7.php @@ -0,0 +1 @@ + diff --git a/tests/comments/inline8.php b/tests/comments/inline8.php new file mode 100644 index 000000000..7522dae21 --- /dev/null +++ b/tests/comments/inline8.php @@ -0,0 +1,31 @@ +

>

+ +

>

+ + + + + +
+ +
+ + + + + +
+ + + + + diff --git a/tests/comments/inline9.php b/tests/comments/inline9.php new file mode 100644 index 000000000..24cc64ca6 --- /dev/null +++ b/tests/comments/inline9.php @@ -0,0 +1,5 @@ + + + diff --git a/tests/comments/interface.php b/tests/comments/interface.php new file mode 100644 index 000000000..cae4e4f29 --- /dev/null +++ b/tests/comments/interface.php @@ -0,0 +1,35 @@ + 1, + + + + /* + * second comment + */ + + + + 'b' => 2, + // leading comment ... + 'c' => 3, /* ... and trailing comment */ + 'd' // fourth comment + => 4, + default => null // final comment +}; diff --git a/tests/comments/method.php b/tests/comments/method.php index 9f57988c5..30fa0c766 100644 --- a/tests/comments/method.php +++ b/tests/comments/method.php @@ -5,7 +5,23 @@ public function foo(/* 1 */ $a /* 2 */ = /* 3 */ 1 /* 4 */): /* 5 */ ?string /* public function emptyMethod(/* comments */) {} + abstract public function sortByName(/* bool $useNaturalSort = false */); + /* comment */ protected /* comment */ static /* comment */ $foo /* comment */; + + public function foo( // Comment + ) {} + + public function foo( + // Comment + ) {} + + abstract public function foo( // Comment + ); + + abstract public function foo( + // Comment + ); } @@ -23,3 +39,30 @@ protected function request(){ ); } } + +class Foo { + function foo() + // this is a function + { + return 42; + } + + function foo() // this is a function + { + return 42; + } + + function foo() { // this is a function + return 42; + } + + function foo() { + // this is a function + return 42; + } + + function foo // this is a function + () { + return 42; + } +} diff --git a/tests/comments/namespace-1.php b/tests/comments/namespace-1.php new file mode 100644 index 000000000..3e66bacfb --- /dev/null +++ b/tests/comments/namespace-1.php @@ -0,0 +1,3 @@ + + */ +class FlowdockFormatter +{ +} diff --git a/tests/comments/namespace-11.php b/tests/comments/namespace-11.php new file mode 100644 index 000000000..bb392fdf2 --- /dev/null +++ b/tests/comments/namespace-11.php @@ -0,0 +1,11 @@ + + */ +class FlowdockFormatter +{ +} diff --git a/tests/comments/namespace-12.php b/tests/comments/namespace-12.php new file mode 100644 index 000000000..352ef6535 --- /dev/null +++ b/tests/comments/namespace-12.php @@ -0,0 +1,14 @@ + + */ +class FlowdockFormatter +{ +} diff --git a/tests/comments/namespace-13.php b/tests/comments/namespace-13.php new file mode 100644 index 000000000..02f447f3d --- /dev/null +++ b/tests/comments/namespace-13.php @@ -0,0 +1,12 @@ + + */ +class FlowdockFormatter +{ +} diff --git a/tests/comments/namespace-14.php b/tests/comments/namespace-14.php new file mode 100644 index 000000000..d5be8cdc5 --- /dev/null +++ b/tests/comments/namespace-14.php @@ -0,0 +1,12 @@ + + */ +class FlowdockFormatter +{ +} diff --git a/tests/comments/namespace-15.php b/tests/comments/namespace-15.php new file mode 100644 index 000000000..4d06c59c1 --- /dev/null +++ b/tests/comments/namespace-15.php @@ -0,0 +1,10 @@ + + */ +class FlowdockFormatter +{ +} diff --git a/tests/comments/namespace-16.php b/tests/comments/namespace-16.php new file mode 100644 index 000000000..e1ef43b3a --- /dev/null +++ b/tests/comments/namespace-16.php @@ -0,0 +1,10 @@ + + */ +class FlowdockFormatter +{ +} diff --git a/tests/comments/namespace-17.php b/tests/comments/namespace-17.php new file mode 100644 index 000000000..94a2667e9 --- /dev/null +++ b/tests/comments/namespace-17.php @@ -0,0 +1,12 @@ + + */ +class FlowdockFormatter +{ +} diff --git a/tests/comments/namespace-18.php b/tests/comments/namespace-18.php new file mode 100644 index 000000000..beb7364ca --- /dev/null +++ b/tests/comments/namespace-18.php @@ -0,0 +1,12 @@ + + */ +class FlowdockFormatter +{ +} diff --git a/tests/comments/namespace-19.php b/tests/comments/namespace-19.php new file mode 100644 index 000000000..19c482703 --- /dev/null +++ b/tests/comments/namespace-19.php @@ -0,0 +1,2 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Acme; + +class Foo +{ +} diff --git a/tests/comments/namespace-5.php b/tests/comments/namespace-5.php new file mode 100644 index 000000000..d2c1b553c --- /dev/null +++ b/tests/comments/namespace-5.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Acme; + +class Foo +{ +} diff --git a/tests/comments/namespace-6.php b/tests/comments/namespace-6.php new file mode 100644 index 000000000..04fa56b99 --- /dev/null +++ b/tests/comments/namespace-6.php @@ -0,0 +1,14 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +use Monolog\Logger; diff --git a/tests/comments/namespace-7.php b/tests/comments/namespace-7.php new file mode 100644 index 000000000..76125d663 --- /dev/null +++ b/tests/comments/namespace-7.php @@ -0,0 +1,11 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace Monolog\Formatter; +use Monolog\Logger; diff --git a/tests/comments/namespace-8.php b/tests/comments/namespace-8.php new file mode 100644 index 000000000..c03e84296 --- /dev/null +++ b/tests/comments/namespace-8.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +/** + * Base Handler class providing basic close() support as well as handleBatch + * + * @author Jordi Boggiano + */ diff --git a/tests/comments/namespace-9.php b/tests/comments/namespace-9.php new file mode 100644 index 000000000..bcafd0fea --- /dev/null +++ b/tests/comments/namespace-9.php @@ -0,0 +1,15 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace Monolog\Handler; +/** + * Base Handler class providing basic close() support as well as handleBatch + * + * @author Jordi Boggiano + */ diff --git a/tests/comments/namespace.php b/tests/comments/namespace.php new file mode 100644 index 000000000..5cfd76e89 --- /dev/null +++ b/tests/comments/namespace.php @@ -0,0 +1,12 @@ + + * require_once 'Net/Sample.php'; + * + * $s = new Net_Sample(); + * if (PEAR::isError($s)) { + * echo $s->getMessage() . "\n"; + * } + * + * + * Here is an example for non-php example or sample: + * + * pear install net_sample + * + * + * @param string $arg1 the string to quote + * @param int $arg2 an integer of how many problems happened. + * Indent to the description's starting point + * for long ones. + * + * @return int the integer of the set mode used. FALSE if foo + * foo could not be set. + * @throws exceptionclass [description] + * + * @access public + * @static + * @see Net_Sample::$foo, Net_Other::someMethod() + * @since Method available since Release 1.2.0 + * @deprecated Method deprecated in Release 2.0.0 + */ + function setFoo($arg1, $arg2 = 0) + { + /* + * This is a "Block Comment." The format is the same as + * Docblock Comments except there is only one asterisk at the + * top. phpDocumentor doesn't parse these. + */ + if ($arg1 == 'good' || $arg1 == 'fair') { + $this->foo = $arg1; + return 1; + } elseif ($arg1 == 'poor' && $arg2 > 1) { + $this->foo = 'poor'; + return 2; + } else { + return false; + } + } + + // }}} +}; + +$a = new // Comment +Foo(); +$a = new class // Comment +{ +}; +$a = new // Comment + Foo(); +$a = new class // Comment +{ +}; \ No newline at end of file diff --git a/tests/comments/no_code-1.php b/tests/comments/no_code-1.php new file mode 100644 index 000000000..56defa3a8 --- /dev/null +++ b/tests/comments/no_code-1.php @@ -0,0 +1,10 @@ + diff --git a/tests/comments/nowdoc.php b/tests/comments/nowdoc.php index 57d0490d7..4fa26efc7 100644 --- a/tests/comments/nowdoc.php +++ b/tests/comments/nowdoc.php @@ -7,3 +7,9 @@ /* Comment */ echo $str; + +// Comment +$var = <<<'NOW' +string +NOW; +// Comment diff --git a/tests/comments/offsetlookup.php b/tests/comments/offsetlookup.php index 5d4d70915..4af6939cd 100644 --- a/tests/comments/offsetlookup.php +++ b/tests/comments/offsetlookup.php @@ -1,3 +1,13 @@ inspect($v, 0, 0, $colors); + } + : // node > 0.8.x + function($v, $colors) { + return $util->inspect($v, [ 'colors' => colors ]); + }; + +$extractTextPluginOptions = $shouldUseRelativeAssetPaths + // Making sure that the publicPath goes back to to build folder. + ? [ 'publicPath' => (new Foo($cssFilename->split('/')->length))->join('../') ] : + []; + +$extractTextPluginOptions = $shouldUseRelativeAssetPaths + ? // Making sure that the publicPath goes back to to build folder. + [ 'publicPath' => (new Foo($cssFilename->split("/")->length))->join("../") ] + : []; + +$extractTextPluginOptions = $shouldUseRelativeAssetPaths // Making sure that the publicPath goes back to to build folder. + ? [ 'publicPath' => (new Foo($cssFilename->split("/")->length))->join("../") ] + : []; + +$var = $process->env->NODE_ENV === "production" + ? call("./configureProdStore") // a + : call("./configureDevStore"); // b + +$var = $a + // Comment + ? $b + // Comment + : $c; + +$var = $a + ? // Comment + $b + : // Comment + $c; + +$var = $a + ? $b + // Comment + : $c + // Comment + ; + +$var = $a + ? $b // Comment + : $c // Comment +; + +$var = $a + ? $b // Comment + : $c; // Comment diff --git a/tests/comments/return.php b/tests/comments/return.php new file mode 100644 index 000000000..7d0ddad78 --- /dev/null +++ b/tests/comments/return.php @@ -0,0 +1,27 @@ + 'val' +]; + +$obj // Comment 2 += [ +'key' => 'val' +]; + +$obj = [ // Comment 3 +'key' => 'val' +]; + +$obj = [ +// Comment 4 +'key' => 'val' +]; + +$obj = // Comment 5 +[ +'val' +]; + +$obj // Comment 6 += [ +'val' +]; + +$obj = [ // Comment 7 +'val' +]; + +$obj = [ +// Comment 8 +'val' +]; + +$obj = // Comment 9 +'val'; + +$obj = // Comment +' +val +val +'; + +$obj = // Comment + ' + val + val + '; + +$obj = // Comment + "val"; + +$obj = // Comment +" +val +val +"; + +$obj = // Comment + " + val + val + "; + +$obj = // Comment + "val ${$var}"; + +$obj = // Comment +" +val +${$var} +"; + +$obj = // Comment + " + val + ${$var} + "; diff --git a/tests/comments/while.php b/tests/comments/while.php index eea7ce0e7..74857865b 100644 --- a/tests/comments/while.php +++ b/tests/comments/while.php @@ -7,3 +7,28 @@ } // Comment while (/* Comments */ true /* Comments */) {} + +while( +true + // Comment +) {} + +while(true)// Comment +{} + +while(true){}// Comment + +while(true)/*Comment*/{} + +while( + true // Comment + && true // Comment +){} + +while(true) {} // comment + +while(true) /* comment */ ++$x; + +while (true) { + // Comment +} diff --git a/tests/comments/yield.php b/tests/comments/yield.php index 819153a45..674226549 100644 --- a/tests/comments/yield.php +++ b/tests/comments/yield.php @@ -3,4 +3,14 @@ function gen_one_to_three() { yield /* Comment */ $i /* Comment */; yield /* Comment */ $id /* Comment */ => /* Comment */ $fields /* Comment */; + yield // Comment + $i; + yield + // Comment + $i + // Comment + => + // Comment + $var + ; } diff --git a/tests/comments/yieldfrom.php b/tests/comments/yieldfrom.php index 0ce171d0d..e17a431fc 100644 --- a/tests/comments/yieldfrom.php +++ b/tests/comments/yieldfrom.php @@ -3,5 +3,8 @@ function gen() { yield 0; yield from /* Comment */ from(); + yield from from() /* Comment */; + yield from // Comment2 + from(); // Comment 3 yield 4; } diff --git a/tests/composer-version/composer-version.spec.mjs b/tests/composer-version/composer-version.spec.mjs new file mode 100644 index 000000000..30e6afd69 --- /dev/null +++ b/tests/composer-version/composer-version.spec.mjs @@ -0,0 +1,215 @@ +import { getComposerPhpVersion, resolvePhpVersion } from "../../src/options.mjs"; +import fs from "fs"; +import path from "path"; +import os from "os"; + +describe("getComposerPhpVer", () => { + // Create a unique temporary directory for our tests + const tempDir = path.join(os.tmpdir(), `composer-version-test-${Date.now()}`); + const tempComposerPath = path.join(tempDir, "composer.json"); + const originalCwd = process.cwd(); + + beforeEach(() => { + // Create temp directory if it doesn't exist + if (!fs.existsSync(tempDir)) { + fs.mkdirSync(tempDir, { recursive: true }); + } + }); + + afterEach(() => { + process.chdir(originalCwd); + + // Clean up temp files and directories + if (fs.existsSync(tempComposerPath)) { + fs.unlinkSync(tempComposerPath); + } + + // Remove any nested directories we created + if (fs.existsSync(tempDir)) { + const deleteFolderRecursive = function(dirPath) { + if (fs.existsSync(dirPath)) { + fs.readdirSync(dirPath).forEach((file) => { + const curPath = path.join(dirPath, file); + if (fs.lstatSync(curPath).isDirectory()) { + deleteFolderRecursive(curPath); + } else { + fs.unlinkSync(curPath); + } + }); + fs.rmdirSync(dirPath); + } + }; + + deleteFolderRecursive(tempDir); + } + }); + + test("returns null when no composer.json is found", () => { + // Create a directory with no composer.json + const emptyDir = path.join(tempDir, "empty-dir"); + fs.mkdirSync(emptyDir, { recursive: true }); + + process.chdir(emptyDir); + + expect(getComposerPhpVersion()).toBe(null); + }); + + test.each([ + {ver:">=7.1.0",expected: 7.1}, + {ver:"^8.0",expected: 8.0}, + {ver:"~7.4",expected: 7.4}, + {ver:">=5.6.0 <8.0.0",expected: 5.6}, + {ver:"7.3.*",expected: 7.3}, + {ver:"7.* || 8.*",expected: 7.0} + ])("extracts correct version from $ver ba changing cwd", ({ver, expected}) => { + const composerContent = JSON.stringify( + { + require: { + php: ver, + }, + }, + null, + 2 + ); + + process.chdir(tempDir); + fs.writeFileSync(tempComposerPath, composerContent); + + + expect(getComposerPhpVersion()).toBe(expected); + }); + + test("phpVersion=composer reads composer.json", () => { + + const composerContent = JSON.stringify( + { + require: { + php: ">=5.4", + }, + }, + null, + 2 + ); + + process.chdir(tempDir); + fs.writeFileSync(tempComposerPath, composerContent); + + + const options = { phpVersion: "composer" }; + resolvePhpVersion(options); + expect(options.phpVersion).toBe(5.4); + }) + + test("returns null when composer.json has no PHP requirement", () => { + const composerContent = JSON.stringify( + { + require: { + // No PHP requirement + "some/package": "^1.0" + }, + }, + null, + 2 + ); + + fs.writeFileSync(tempComposerPath, composerContent); + + process.chdir(tempDir); + + expect(getComposerPhpVersion()).toBe(null); + }); + + + test("returns error when no composer.json and phpVersion set to composer", () => { + + process.chdir(tempDir); + + expect(() =>resolvePhpVersion({phpVersion:"composer"})).toThrow(); + }); + + test("returns null when composer.json has invalid PHP requirement", () => { + const composerContent = JSON.stringify( + { + require: { + php: "invalid-version" + }, + }, + null, + 2 + ); + + fs.writeFileSync(tempComposerPath, composerContent); + + process.chdir(tempDir); + + expect(getComposerPhpVersion()).toBe(null); + }); + + test("finds composer.json in parent directory when in nested child folder", () => { + // Create a nested directory structure + const nestedDir1 = path.join(tempDir, "level1"); + const nestedDir2 = path.join(nestedDir1, "level2"); + const nestedDir3 = path.join(nestedDir2, "level3"); + + fs.mkdirSync(nestedDir1, { recursive: true }); + fs.mkdirSync(nestedDir2, { recursive: true }); + fs.mkdirSync(nestedDir3, { recursive: true }); + + // Create composer.json in the root temp directory + const composerContent = JSON.stringify( + { + require: { + php: "^8.1" + }, + }, + null, + 2 + ); + + fs.writeFileSync(tempComposerPath, composerContent); + + process.chdir(nestedDir3); + + expect(getComposerPhpVersion()).toBe(8.1); + }); + + test("finds composer.json in intermediate parent directory", () => { + // Create a nested directory structure + const nestedDir1 = path.join(tempDir, "folder1"); + const nestedDir2 = path.join(nestedDir1, "folder2"); + const nestedDir3 = path.join(nestedDir2, "folder3"); + + fs.mkdirSync(nestedDir1, { recursive: true }); + fs.mkdirSync(nestedDir2, { recursive: true }); + fs.mkdirSync(nestedDir3, { recursive: true }); + + // Create composer.json in the middle level directory + const intermediateComposerPath = path.join(nestedDir2, "composer.json"); + const composerContent = JSON.stringify( + { + require: { + php: "~7.2" + }, + }, + null, + 2 + ); + + fs.writeFileSync(intermediateComposerPath, composerContent); + + process.chdir(nestedDir3); + + expect(getComposerPhpVersion()).toBe(7.2); + }); + + test("returns null when composer.json is malformed", () => { + // Create a malformed JSON file (invalid syntax) + const malformedContent = `{This is not JSON}`; + + fs.writeFileSync(tempComposerPath, malformedContent); + + process.chdir(tempDir); + + expect(getComposerPhpVersion()).toBe(null); + }); +}); diff --git a/tests/constant/__snapshots__/jsfmt.spec.mjs.snap b/tests/constant/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..fe4aacc34 --- /dev/null +++ b/tests/constant/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,87 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`constants.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; + +=====================================output===================================== + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; + +================================================================================ +`; + +exports[`declare-on-next-line-after-open-php-tag.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; diff --git a/tests/declare/declare-on-next-line-after-open-php-tag.php b/tests/declare/declare-on-next-line-after-open-php-tag.php new file mode 100644 index 000000000..d67fba4b4 --- /dev/null +++ b/tests/declare/declare-on-next-line-after-open-php-tag.php @@ -0,0 +1,2 @@ +property, $object->method(), method(), ($foo ? true : false); -echo (1000000000 . 'String'), $object->property + $object->method(), method((method('string'))), ($foo ? ($bar . 'foo') + 'test' : false); - -echo $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->veryVeryVeryVeryVeryVeryLongProperty; - -echo(1); -echo (1); -echo (((1))); -echo (((1))), (((1))); - -echo "The sum is " . 1 | 2; // output: "2". Parentheses needed. -echo "The sum is ", 1 | 2; // output: "The sum is 3". Fine. - -echo "Foo" . f("bar") . "Foo"; -echo "\\n\\n"; -echo "Foo", f("bar"), "Foo"; - -echo "Loop start!\\n", sleep(1); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -property, - $object->method(), - method(), - $foo ? true : false; -echo 1000000000 . 'String', - $object->property + $object->method(), - method((method('string'))), - $foo ? ($bar . 'foo') + 'test' : false; - -echo $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->veryVeryVeryVeryVeryVeryLongProperty; - -echo 1; -echo 1; -echo 1; -echo 1, 1; - -echo "The sum is " . 1 | 2; // output: "2". Parentheses needed. -echo "The sum is ", 1 | 2; // output: "The sum is 3". Fine. - -echo "Foo" . f("bar") . "Foo"; -echo "\\n\\n"; -echo "Foo", f("bar"), "Foo"; - -echo "Loop start!\\n", sleep(1); - -`; diff --git a/tests/echo/__snapshots__/jsfmt.spec.mjs.snap b/tests/echo/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..455ac56e9 --- /dev/null +++ b/tests/echo/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,450 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`echo.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +property, $object->method(), method(), ($foo ? true : false); +echo (1000000000 . 'String'), $object->property + $object->method(), method((method('string'))), ($foo ? ($bar . 'foo') . 'test' : false); + +echo $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->veryVeryVeryVeryVeryVeryLongProperty; + +echo(1); +echo (1); +echo (((1))); +echo (((1))), (((1))); + +echo "The sum is " . 1 | 2; // output: "2". Parentheses needed. +echo "The sum is ", 1 | 2; // output: "The sum is 3". Fine. + +echo "Foo" . f("bar") . "Foo"; +echo "\\n\\n"; +echo "Foo", f("bar"), "Foo"; + +echo "Loop start!\\n", sleep(1); + +echo esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) +); +echo esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) +) . "\\n\\n"; +echo esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) +) . "\\n\\n", "string"; +echo esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) + ) . "\\n\\n", "string" . "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; +echo esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) + ), "string", "string"; +echo esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) +), + esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) + ); +echo esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) + ), + "string", + esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) + ); + +echo <<property, + $object->method(), + method(), + $foo ? true : false; +echo 1000000000 . "String", + $object->property + $object->method(), + method(method("string")), + $foo ? $bar . "foo" . "test" : false; + +echo $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->veryVeryVeryVeryVeryVeryLongProperty; + +echo 1; +echo 1; +echo 1; +echo 1, 1; + +echo ("The sum is " . 1) | 2; // output: "2". Parentheses needed. +echo "The sum is ", 1 | 2; // output: "The sum is 3". Fine. + +echo "Foo" . f("bar") . "Foo"; +echo "\\n\\n"; +echo "Foo", f("bar"), "Foo"; + +echo "Loop start!\\n", sleep(1); + +echo esc_html( + sprintf( + __( + "Hi there. Your recent order on %s has been completed. " . + "Your order details are shown below for your reference:", + "woocommerce", + ), + get_option("blogname"), + ), +); +echo esc_html( + sprintf( + __( + "Hi there. Your recent order on %s has been completed. " . + "Your order details are shown below for your reference:", + "woocommerce", + ), + get_option("blogname"), + ), +) . "\\n\\n"; +echo esc_html( + sprintf( + __( + "Hi there. Your recent order on %s has been completed. " . + "Your order details are shown below for your reference:", + "woocommerce", + ), + get_option("blogname"), + ), +) . "\\n\\n", + "string"; +echo esc_html( + sprintf( + __( + "Hi there. Your recent order on %s has been completed. " . + "Your order details are shown below for your reference:", + "woocommerce", + ), + get_option("blogname"), + ), +) . "\\n\\n", + "string" . + "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; +echo esc_html( + sprintf( + __( + "Hi there. Your recent order on %s has been completed. " . + "Your order details are shown below for your reference:", + "woocommerce", + ), + get_option("blogname"), + ), +), + "string", + "string"; +echo esc_html( + sprintf( + __( + "Hi there. Your recent order on %s has been completed. " . + "Your order details are shown below for your reference:", + "woocommerce", + ), + get_option("blogname"), + ), +), + esc_html( + sprintf( + __( + "Hi there. Your recent order on %s has been completed. " . + "Your order details are shown below for your reference:", + "woocommerce", + ), + get_option("blogname"), + ), + ); +echo esc_html( + sprintf( + __( + "Hi there. Your recent order on %s has been completed. " . + "Your order details are shown below for your reference:", + "woocommerce", + ), + get_option("blogname"), + ), +), + "string", + esc_html( + sprintf( + __( + "Hi there. Your recent order on %s has been completed. " . + "Your order details are shown below for your reference:", + "woocommerce", + ), + get_option("blogname"), + ), + ); + +echo <<property, $object->method(), method(), ($foo ? true : false); -echo (1000000000 . 'String'), $object->property + $object->method(), method((method('string'))), ($foo ? ($bar . 'foo') + 'test' : false); +echo (1000000000 . 'String'), $object->property + $object->method(), method((method('string'))), ($foo ? ($bar . 'foo') . 'test' : false); echo $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->veryVeryVeryVeryVeryVeryLongProperty; @@ -61,3 +61,130 @@ echo "Foo", f("bar"), "Foo"; echo "Loop start!\n", sleep(1); + +echo esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) +); +echo esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) +) . "\n\n"; +echo esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) +) . "\n\n", "string"; +echo esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) + ) . "\n\n", "string" . "veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongString"; +echo esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) + ), "string", "string"; +echo esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) +), + esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) + ); +echo esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) + ), + "string", + esc_html( + sprintf( + __( + 'Hi there. Your recent order on %s has been completed. ' . + 'Your order details are shown below for your reference:', + 'woocommerce' + ), + get_option('blogname') + ) + ); + +echo <<notExisting); +empty($registry->notExisting->foo); +empty($this->_items[$key]); + +if (empty($var)) { + echo '$var is either 0, empty, or not set at all'; +} + +function is_blank($value) { + return empty($value) && !is_numeric($value); +} + +if(is_empty(NULL)) { +} + + + +=====================================output===================================== +notExisting); +empty($registry->notExisting->foo); +empty($this->_items[$key]); + +if (empty($var)) { + echo '$var is either 0, empty, or not set at all'; +} + +function is_blank($value) +{ + return empty($value) && !is_numeric($value); +} + +if (is_empty(null)) { +} + +================================================================================ +`; diff --git a/tests/empty/empty.php b/tests/empty/empty.php new file mode 100644 index 000000000..1efccb48a --- /dev/null +++ b/tests/empty/empty.php @@ -0,0 +1,25 @@ +notExisting); +empty($registry->notExisting->foo); +empty($this->_items[$key]); + +if (empty($var)) { + echo '$var is either 0, empty, or not set at all'; +} + +function is_blank($value) { + return empty($value) && !is_numeric($value); +} + +if(is_empty(NULL)) { +} + + diff --git a/tests/empty/jsfmt.spec.mjs b/tests/empty/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/empty/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/encapsed/__snapshots__/jsfmt.spec.js.snap b/tests/encapsed/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 1e64b15f2..000000000 --- a/tests/encapsed/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,159 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`encapsed.php 1`] = ` -bzr_{1}; +$var = $foo->bzr_{'string'}; +$var = $foo->bzr_{$baz}; +$var = $foo->bzr_{$baz->foo}; +$var = $foo->bzr_{$var ? 'one' : 'two'}; +$var = $foo->bzr_{$veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar ? $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar : $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar}; +$var = $foo->bzr_{(function () { return 1; })($var)}; + +$var = "{$this->target->resource->binary}"; +$var = "{$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVar()}"; +$var = "{$this->target->resource->binary['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVertyVeryLongString']}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()}"; +$var = "{$this->target->resource->binary} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} {$this->target->resource->binary}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()}"; +$var = "My name is {\${getName($arg, 'string', 1024, $var ? true : false, ['foo' => 'bar', 'bar' => 'foo'])}}"; +$var = "My name is {\${getName($veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar, $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar, $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar)}}"; + +$encapsHereDoc = <<target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} + Hello World {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()} +STR; + + +$var = $this->swift->{'set'}($address, $name); +$var = $this->swift->{'set' . 'Offset'}($address, $name); +$var = $this->swift->{"set"}($address, $name); +$var = $this->swift->{"set{$type}"}($address, $name); + +$var = "string \${$var} string"; +$var = "string $var string"; +$var = "string {$var} string"; +$var = "string $var->foo string"; +$var = "string {$var->foo} string"; +$var = "string $var->foo->baz string"; +$var = "string {$var->foo->bar} string"; +$var = "string {$var->call()} string"; +$var = "string {$var::$foo} string"; +$var = "string {$var::call()} string"; +$var = "string $var[0] string"; +$var = "string {$var[0]} string"; +$var = "string $var[0][0] string"; +$var = "string {$var[0][0]} string"; +$var = "string $var[0]->bar string"; +$var = "string {$var[0]->bar} string"; +$var = "string {\${$var}} string"; +$var = "string {\${call()}} string"; +$var = "string {\${$var->foo}} string"; +$var = "string {\${$var->call()}} string"; +$var = "string {\${$var::$var}} string"; +$var = "string {\${$var::call()}} string"; +$var = "string $foo->{$baz[1]} string"; +$var = "string {$foo->{$baz[1]}} string"; +$var = "string {$var->foo->bar/* Comment */} string"; +$var = "string {$var->foo->bar /* Comment */ } string"; +$var = "string {$var->foo->bar +} string"; + +$expected = array( + 'test' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'foo' => 'bar' +); +$expected = array( + 'foo' => 'bar', + 'test' => <<<'EOT' +foo +# bar +baz + +EOT +); +$expected = array( + 'foo' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'baz' => <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'test' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'collection' => array( + array( + 'one' => <<<'EOT' +foo +# bar +baz + +EOT + ), + array( + 'two' => <<<'EOT' +foo +# bar +baz +EOT + ) + ) +); + +$var = <<bar text."; + +// T_DOLLAR_OPEN_CURLY_BRACES expr '}' +echo "text \${$test} text."; +echo "text \${$$$test} text."; +echo "text \${call()} text."; +echo "text \${true || false} text."; +echo "text \${$var ? 'foo' : 'bar'} text."; +echo "text \${'test' + 'test'} text."; +echo "text \${'test'} text."; + +// T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' +echo "text \${foo} text"; + +// T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' +echo "text \${foo['foo']} text"; +echo "text \${foo[foo]} text"; +echo "text \${foo[call()]} text"; +echo "text \${foo[$var ? 'foo' : 'bar']} text"; + +// T_CURLY_OPEN variable '}' +echo "text {$var} text"; +echo "text {$var['test']} text"; +echo "text {$var->test} text"; +echo "text {$var::$test} text"; + +echo <<< END + a + b +c +END; + +echo <<< END + a + b +c +END; + +echo <<< 'END' + a + b +c +END; + +echo <<< 'END' + a + b +c +END; + +$php73FlexibleHeredoc = <<bzr_[1]; +$var = $foo->bzr_["string"]; +$var = $foo->bzr_[$baz]; +$var = $foo->bzr_[$baz->foo]; +$var = $foo->bzr_[$var ? "one" : "two"]; +$var = + $foo->bzr_[ + $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar + ? $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar + : $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar + ]; +$var = + $foo->bzr_[ + (function () { + return 1; + })($var) + ]; + +$var = "{$this->target->resource->binary}"; +$var = "{$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVar()}"; +$var = "{$this->target->resource->binary["veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVertyVeryLongString"]}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()}"; +$var = "{$this->target->resource->binary} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} {$this->target->resource->binary}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()}"; +$var = "My name is {\${getName($arg, "string", 1024, $var ? true : false, [ + "foo" => "bar", + "bar" => "foo", +])}}"; +$var = "My name is {\${getName( + $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar, + $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar, + $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar +)}}"; + +$encapsHereDoc = <<target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} + Hello World {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()} +STR; + +$var = $this->swift->{'set'}($address, $name); +$var = $this->swift->{"set" . "Offset"}($address, $name); +$var = $this->swift->{"set"}($address, $name); +$var = $this->swift->{"set{$type}"}($address, $name); + +$var = "string \${$var} string"; +$var = "string $var string"; +$var = "string {$var} string"; +$var = "string $var->foo string"; +$var = "string {$var->foo} string"; +$var = "string $var->foo->baz string"; +$var = "string {$var->foo->bar} string"; +$var = "string {$var->call()} string"; +$var = "string {$var::$foo} string"; +$var = "string {$var::call()} string"; +$var = "string $var[0] string"; +$var = "string {$var[0]} string"; +$var = "string $var[0][0] string"; +$var = "string {$var[0][0]} string"; +$var = "string $var[0]->bar string"; +$var = "string {$var[0]->bar} string"; +$var = "string {\${$var}} string"; +$var = "string {\${call()}} string"; +$var = "string {\${$var->foo}} string"; +$var = "string {\${$var->call()}} string"; +$var = "string {\${$var::$var}} string"; +$var = "string {\${$var::call()}} string"; +$var = "string $foo->{$baz[1]} string"; +$var = "string {$foo->{$baz[1]}} string"; +$var = "string {$var->foo->bar /* Comment */} string"; +$var = "string {$var->foo->bar /* Comment */} string"; +$var = "string {$var->foo->bar} string"; + +$expected = [ + "test" => <<<'EOT' +foo +# bar +baz + +EOT + , + "foo" => "bar", +]; +$expected = [ + "foo" => "bar", + "test" => <<<'EOT' +foo +# bar +baz + +EOT +, +]; +$expected = [ + "foo" => <<<'EOT' +foo +# bar +baz + +EOT + , + "bar" => <<<'EOT' +foo +# bar +baz + +EOT + , + "baz" => <<<'EOT' +foo +# bar +baz + +EOT +, +]; +$expected = [ + "test" => <<<'EOT' +foo +# bar +baz + +EOT + , + "collection" => [ + [ + "one" => <<<'EOT' +foo +# bar +baz + +EOT + , + ], + [ + "two" => <<<'EOT' +foo +# bar +baz +EOT + , + ], + ], +]; + +$var = + <<veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall["offset"]} string"; +$var = "String {$veryVeryVeryVeryVeryVeryVeryVeryVaryVaryVaryVaryVaryLongNameObj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall()["offset"]->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall()["offset"]} string"; + +echo "This is my array value: $anArray[key]"; +echo "This is my array value: $anArray[$key]"; +echo "This is my array value: {$anArray[key]}"; +echo "This is my array value: {$anArray[$var]}"; + +$message = "Unresolvable dependency resolving [$parameter] in class {$parameter->getDeclaringClass()->getName()}"; + +$var = "string \${juices["FOO"]} string"; + +// T_VARIABLE +echo "text $foo text."; + +// T_VARIABLE '[' encaps_var_offset ']' +echo "text $foo[name] text."; +echo "text $foo[1] text."; +// echo "text $foo[-1] text."; +echo "text $foo[$var] text."; +echo "text $foo[koolaid1] text."; + +// T_VARIABLE T_OBJECT_OPERATOR T_STRING +echo "text $foo->bar text."; + +// T_DOLLAR_OPEN_CURLY_BRACES expr '}' +echo "text \${$test} text."; +echo "text \${$$$test} text."; +echo "text \${call()} text."; +echo "text \${true || false} text."; +echo "text \${$var ? "foo" : "bar"} text."; +echo "text \${"test" + "test"} text."; +echo "text \${"test"} text."; + +// T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' +echo "text \${foo} text"; + +// T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' +echo "text \${foo["foo"]} text"; +echo "text \${foo[foo]} text"; +echo "text \${foo[call()]} text"; +echo "text \${foo[$var ? "foo" : "bar"]} text"; + +// T_CURLY_OPEN variable '}' +echo "text {$var} text"; +echo "text {$var["test"]} text"; +echo "text {$var->test} text"; +echo "text {$var::$test} text"; + +echo <<bzr_{1}; +$var = $foo->bzr_{'string'}; +$var = $foo->bzr_{$baz}; +$var = $foo->bzr_{$baz->foo}; +$var = $foo->bzr_{$var ? 'one' : 'two'}; +$var = $foo->bzr_{$veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar ? $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar : $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar}; +$var = $foo->bzr_{(function () { return 1; })($var)}; + +$var = "{$this->target->resource->binary}"; +$var = "{$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVar()}"; +$var = "{$this->target->resource->binary['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVertyVeryLongString']}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()}"; +$var = "{$this->target->resource->binary} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} {$this->target->resource->binary}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()}"; +$var = "My name is {\${getName($arg, 'string', 1024, $var ? true : false, ['foo' => 'bar', 'bar' => 'foo'])}}"; +$var = "My name is {\${getName($veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar, $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar, $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar)}}"; + +$encapsHereDoc = <<target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} + Hello World {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()} +STR; + + +$var = $this->swift->{'set'}($address, $name); +$var = $this->swift->{'set' . 'Offset'}($address, $name); +$var = $this->swift->{"set"}($address, $name); +$var = $this->swift->{"set{$type}"}($address, $name); + +$var = "string \${$var} string"; +$var = "string $var string"; +$var = "string {$var} string"; +$var = "string $var->foo string"; +$var = "string {$var->foo} string"; +$var = "string $var->foo->baz string"; +$var = "string {$var->foo->bar} string"; +$var = "string {$var->call()} string"; +$var = "string {$var::$foo} string"; +$var = "string {$var::call()} string"; +$var = "string $var[0] string"; +$var = "string {$var[0]} string"; +$var = "string $var[0][0] string"; +$var = "string {$var[0][0]} string"; +$var = "string $var[0]->bar string"; +$var = "string {$var[0]->bar} string"; +$var = "string {\${$var}} string"; +$var = "string {\${call()}} string"; +$var = "string {\${$var->foo}} string"; +$var = "string {\${$var->call()}} string"; +$var = "string {\${$var::$var}} string"; +$var = "string {\${$var::call()}} string"; +$var = "string $foo->{$baz[1]} string"; +$var = "string {$foo->{$baz[1]}} string"; +$var = "string {$var->foo->bar/* Comment */} string"; +$var = "string {$var->foo->bar /* Comment */ } string"; +$var = "string {$var->foo->bar +} string"; + +$expected = array( + 'test' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'foo' => 'bar' +); +$expected = array( + 'foo' => 'bar', + 'test' => <<<'EOT' +foo +# bar +baz + +EOT +); +$expected = array( + 'foo' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'baz' => <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'test' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'collection' => array( + array( + 'one' => <<<'EOT' +foo +# bar +baz + +EOT + ), + array( + 'two' => <<<'EOT' +foo +# bar +baz +EOT + ) + ) +); + +$var = <<bar text."; + +// T_DOLLAR_OPEN_CURLY_BRACES expr '}' +echo "text \${$test} text."; +echo "text \${$$$test} text."; +echo "text \${call()} text."; +echo "text \${true || false} text."; +echo "text \${$var ? 'foo' : 'bar'} text."; +echo "text \${'test' + 'test'} text."; +echo "text \${'test'} text."; + +// T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' +echo "text \${foo} text"; + +// T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' +echo "text \${foo['foo']} text"; +echo "text \${foo[foo]} text"; +echo "text \${foo[call()]} text"; +echo "text \${foo[$var ? 'foo' : 'bar']} text"; + +// T_CURLY_OPEN variable '}' +echo "text {$var} text"; +echo "text {$var['test']} text"; +echo "text {$var->test} text"; +echo "text {$var::$test} text"; + +echo <<< END + a + b +c +END; + +echo <<< END + a + b +c +END; + +echo <<< 'END' + a + b +c +END; + +echo <<< 'END' + a + b +c +END; + +$php73FlexibleHeredoc = <<bzr_[1]; +$var = $foo->bzr_["string"]; +$var = $foo->bzr_[$baz]; +$var = $foo->bzr_[$baz->foo]; +$var = $foo->bzr_[$var ? "one" : "two"]; +$var = + $foo->bzr_[ + $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar + ? $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar + : $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar + ]; +$var = + $foo->bzr_[ + (function () { + return 1; + })($var) + ]; + +$var = "{$this->target->resource->binary}"; +$var = "{$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVar()}"; +$var = "{$this->target->resource->binary["veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVertyVeryLongString"]}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()}"; +$var = "{$this->target->resource->binary} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} {$this->target->resource->binary}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()}"; +$var = "My name is {\${getName($arg, "string", 1024, $var ? true : false, [ + "foo" => "bar", + "bar" => "foo", +])}}"; +$var = "My name is {\${getName( + $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar, + $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar, + $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar, +)}}"; + +$encapsHereDoc = <<target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} + Hello World {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()} +STR; + +$var = $this->swift->{'set'}($address, $name); +$var = $this->swift->{"set" . "Offset"}($address, $name); +$var = $this->swift->{"set"}($address, $name); +$var = $this->swift->{"set{$type}"}($address, $name); + +$var = "string \${$var} string"; +$var = "string $var string"; +$var = "string {$var} string"; +$var = "string $var->foo string"; +$var = "string {$var->foo} string"; +$var = "string $var->foo->baz string"; +$var = "string {$var->foo->bar} string"; +$var = "string {$var->call()} string"; +$var = "string {$var::$foo} string"; +$var = "string {$var::call()} string"; +$var = "string $var[0] string"; +$var = "string {$var[0]} string"; +$var = "string $var[0][0] string"; +$var = "string {$var[0][0]} string"; +$var = "string $var[0]->bar string"; +$var = "string {$var[0]->bar} string"; +$var = "string {\${$var}} string"; +$var = "string {\${call()}} string"; +$var = "string {\${$var->foo}} string"; +$var = "string {\${$var->call()}} string"; +$var = "string {\${$var::$var}} string"; +$var = "string {\${$var::call()}} string"; +$var = "string $foo->{$baz[1]} string"; +$var = "string {$foo->{$baz[1]}} string"; +$var = "string {$var->foo->bar /* Comment */} string"; +$var = "string {$var->foo->bar /* Comment */} string"; +$var = "string {$var->foo->bar} string"; + +$expected = [ + "test" => <<<'EOT' + foo + # bar + baz + + EOT + , + "foo" => "bar", +]; +$expected = [ + "foo" => "bar", + "test" => <<<'EOT' + foo + # bar + baz + + EOT +, +]; +$expected = [ + "foo" => <<<'EOT' + foo + # bar + baz + + EOT + , + "bar" => <<<'EOT' + foo + # bar + baz + + EOT + , + "baz" => <<<'EOT' + foo + # bar + baz + + EOT +, +]; +$expected = [ + "test" => <<<'EOT' + foo + # bar + baz + + EOT + , + "collection" => [ + [ + "one" => <<<'EOT' + foo + # bar + baz + + EOT + , + ], + [ + "two" => <<<'EOT' + foo + # bar + baz + EOT + , + ], + ], +]; + +$var = + <<veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall["offset"]} string"; +$var = "String {$veryVeryVeryVeryVeryVeryVeryVeryVaryVaryVaryVaryVaryLongNameObj->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall()["offset"]->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongCall()["offset"]} string"; + +echo "This is my array value: $anArray[key]"; +echo "This is my array value: $anArray[$key]"; +echo "This is my array value: {$anArray[key]}"; +echo "This is my array value: {$anArray[$var]}"; + +$message = "Unresolvable dependency resolving [$parameter] in class {$parameter->getDeclaringClass()->getName()}"; + +$var = "string \${juices["FOO"]} string"; + +// T_VARIABLE +echo "text $foo text."; + +// T_VARIABLE '[' encaps_var_offset ']' +echo "text $foo[name] text."; +echo "text $foo[1] text."; +// echo "text $foo[-1] text."; +echo "text $foo[$var] text."; +echo "text $foo[koolaid1] text."; + +// T_VARIABLE T_OBJECT_OPERATOR T_STRING +echo "text $foo->bar text."; + +// T_DOLLAR_OPEN_CURLY_BRACES expr '}' +echo "text \${$test} text."; +echo "text \${$$$test} text."; +echo "text \${call()} text."; +echo "text \${true || false} text."; +echo "text \${$var ? "foo" : "bar"} text."; +echo "text \${"test" + "test"} text."; +echo "text \${"test"} text."; + +// T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' +echo "text \${foo} text"; + +// T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' +echo "text \${foo["foo"]} text"; +echo "text \${foo[foo]} text"; +echo "text \${foo[call()]} text"; +echo "text \${foo[$var ? "foo" : "bar"]} text"; + +// T_CURLY_OPEN variable '}' +echo "text {$var} text"; +echo "text {$var["test"]} text"; +echo "text {$var->test} text"; +echo "text {$var::$test} text"; + +echo <<bzr_{1}; +$var = $foo->bzr_{'string'}; +$var = $foo->bzr_{$baz}; +$var = $foo->bzr_{$baz->foo}; +$var = $foo->bzr_{$var ? 'one' : 'two'}; +$var = $foo->bzr_{$veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar ? $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar : $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar}; +$var = $foo->bzr_{(function () { return 1; })($var)}; + +$var = "{$this->target->resource->binary}"; +$var = "{$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVar()}"; +$var = "{$this->target->resource->binary['veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVertyVeryLongString']}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()}"; +$var = "{$this->target->resource->binary} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} {$this->target->resource->binary}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo}"; +$var = "{$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()} {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()}"; +$var = "My name is {${getName($arg, 'string', 1024, $var ? true : false, ['foo' => 'bar', 'bar' => 'foo'])}}"; +$var = "My name is {${getName($veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar, $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar, $veryVeryVeryVeryVeryVeryVeryVeryVeryLongVar)}}"; + +$encapsHereDoc = <<target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo} + Hello World {$this->target->resource->binary->foo->bar->foobar->bar->foo->foobar->bar->foo()} +STR; + + +$var = $this->swift->{'set'}($address, $name); +$var = $this->swift->{'set' . 'Offset'}($address, $name); +$var = $this->swift->{"set"}($address, $name); +$var = $this->swift->{"set{$type}"}($address, $name); + +$var = "string ${$var} string"; +$var = "string $var string"; +$var = "string {$var} string"; +$var = "string $var->foo string"; +$var = "string {$var->foo} string"; +$var = "string $var->foo->baz string"; +$var = "string {$var->foo->bar} string"; +$var = "string {$var->call()} string"; +$var = "string {$var::$foo} string"; +$var = "string {$var::call()} string"; +$var = "string $var[0] string"; +$var = "string {$var[0]} string"; +$var = "string $var[0][0] string"; +$var = "string {$var[0][0]} string"; +$var = "string $var[0]->bar string"; +$var = "string {$var[0]->bar} string"; +$var = "string {${$var}} string"; +$var = "string {${call()}} string"; +$var = "string {${$var->foo}} string"; +$var = "string {${$var->call()}} string"; +$var = "string {${$var::$var}} string"; +$var = "string {${$var::call()}} string"; +$var = "string $foo->{$baz[1]} string"; +$var = "string {$foo->{$baz[1]}} string"; +$var = "string {$var->foo->bar/* Comment */} string"; +$var = "string {$var->foo->bar /* Comment */ } string"; +$var = "string {$var->foo->bar +} string"; + +$expected = array( + 'test' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'foo' => 'bar' +); +$expected = array( + 'foo' => 'bar', + 'test' => <<<'EOT' +foo +# bar +baz + +EOT +); +$expected = array( + 'foo' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'bar' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'baz' => <<<'EOT' +foo +# bar +baz + +EOT +, +); +$expected = array( + 'test' => <<<'EOT' +foo +# bar +baz + +EOT +, + 'collection' => array( + array( + 'one' => <<<'EOT' +foo +# bar +baz + +EOT + ), + array( + 'two' => <<<'EOT' +foo +# bar +baz +EOT + ) + ) +); + +$var = <<bar text."; + +// T_DOLLAR_OPEN_CURLY_BRACES expr '}' +echo "text ${$test} text."; +echo "text ${$$$test} text."; +echo "text ${call()} text."; +echo "text ${true || false} text."; +echo "text ${$var ? 'foo' : 'bar'} text."; +echo "text ${'test' + 'test'} text."; +echo "text ${'test'} text."; + +// T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' +echo "text ${foo} text"; + +// T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' +echo "text ${foo['foo']} text"; +echo "text ${foo[foo]} text"; +echo "text ${foo[call()]} text"; +echo "text ${foo[$var ? 'foo' : 'bar']} text"; + +// T_CURLY_OPEN variable '}' +echo "text {$var} text"; +echo "text {$var['test']} text"; +echo "text {$var->test} text"; +echo "text {$var::$test} text"; + +echo <<< END + a + b +c +END; + +echo <<< END + a + b +c +END; + +echo <<< 'END' + a + b +c +END; + +echo <<< 'END' + a + b +c +END; + +$php73FlexibleHeredoc = << 'Red', + Suit::Clubs, + Suit::Spades => 'Black', + }; + } + + // Not part of an interface; that's fine. + public function shape(): string + { + return "Rectangle"; + } + + public static function staticMethod(){ + return self::Clubs; + } +} + +function paint(Colorful $c) { } + +paint(Suit::Clubs); // Works + +print Suit::Diamonds->shape(); // prints "Rectangle" + + +class Foo +{ + const Bar = Suit::Hearts; // https://www.php.net/manual/en/language.enumerations.expressions.php +} + + +enum BackedSuit: string +{ + case Spades = 5; +} + +class Enum {} +class Enum extends Foo {} + +=====================================output===================================== + "Red", + Suit::Clubs, Suit::Spades => "Black", + }; + } + + // Not part of an interface; that's fine. + public function shape(): string + { + return "Rectangle"; + } + + public static function staticMethod() + { + return self::Clubs; + } +} + +function paint(Colorful $c) {} + +paint(Suit::Clubs); // Works + +print Suit::Diamonds->shape(); // prints "Rectangle" + +class Foo +{ + const Bar = Suit::Hearts; // https://www.php.net/manual/en/language.enumerations.expressions.php +} + +enum BackedSuit: string +{ + case Spades = 5; +} + +class Enum {} +class Enum extends Foo {} + +================================================================================ +`; diff --git a/tests/enum/enum.php b/tests/enum/enum.php new file mode 100644 index 000000000..136e203d7 --- /dev/null +++ b/tests/enum/enum.php @@ -0,0 +1,67 @@ + 'Red', + Suit::Clubs, + Suit::Spades => 'Black', + }; + } + + // Not part of an interface; that's fine. + public function shape(): string + { + return "Rectangle"; + } + + public static function staticMethod(){ + return self::Clubs; + } +} + +function paint(Colorful $c) { } + +paint(Suit::Clubs); // Works + +print Suit::Diamonds->shape(); // prints "Rectangle" + + +class Foo +{ + const Bar = Suit::Hearts; // https://www.php.net/manual/en/language.enumerations.expressions.php +} + + +enum BackedSuit: string +{ + case Spades = 5; +} + +class Enum {} +class Enum extends Foo {} diff --git a/tests/enum/jsfmt.spec.mjs b/tests/enum/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/enum/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/errors/__snapshots__/jsfmt.spec.js.snap b/tests/errors/__snapshots__/jsfmt.spec.mjs.snap similarity index 50% rename from tests/errors/__snapshots__/jsfmt.spec.js.snap rename to tests/errors/__snapshots__/jsfmt.spec.mjs.snap index cac01be45..a4818b7ce 100644 --- a/tests/errors/__snapshots__/jsfmt.spec.js.snap +++ b/tests/errors/__snapshots__/jsfmt.spec.mjs.snap @@ -1,6 +1,11 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`errors.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== getMessage(); + echo "Caught exception: ", $e->getMessage(); } catch (OtherException $i) { - echo 'Caugh other'; + echo "Caugh other"; } finally { echo "First finally"; } @@ -60,9 +97,41 @@ try { } throw new VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClassException( - 'exception' + "exception", ); throw $e; -throw new \\Exception('Bad logic in order cancel'); +throw new \\Exception("Bad logic in order cancel"); + +try { +} catch (Exception $e) { +} finally { +} + +try { +} catch (Exception $e) { +} finally { +} + +try { + // Comment +} catch (Exception $e) { + // Comment +} finally { + // Comment +} + +// PHP 8.0 non-capturing exception catch +try { + // Something +} catch (\\Exception) { + // Nothing +} + +try { + // Something +} catch (MyException | OtherException) { + // Nothing +} +================================================================================ `; diff --git a/tests/errors/errors.php b/tests/errors/errors.php index 91a2a9fb3..e6a9ab14f 100644 --- a/tests/errors/errors.php +++ b/tests/errors/errors.php @@ -28,3 +28,34 @@ throw new VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongClassException('exception'); throw $e; throw new \Exception('Bad logic in order cancel'); + +try {} catch (Exception $e) {} finally {} + +try { + +} catch (Exception $e) { + +} finally { + +} + +try { + // Comment +} catch (Exception $e) { + // Comment +} finally { + // Comment +} + +// PHP 8.0 non-capturing exception catch +try { + // Something +} catch (\Exception) { + // Nothing +} + +try { + // Something +} catch (MyException | OtherException) { + // Nothing +} diff --git a/tests/errors/jsfmt.spec.js b/tests/errors/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/errors/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/errors/jsfmt.spec.mjs b/tests/errors/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/errors/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/eval/__snapshots__/jsfmt.spec.js.snap b/tests/eval/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 3dc3cab58..000000000 --- a/tests/eval/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,22 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`eval.php 1`] = ` -foo = $foo; + } + + /** + * @return mixed + */ + public function getFoo() + { + return $this->foo; + } + + /** + * @param mixed $foo + */ + public function setFoo($foo) + { + $this->foo = $foo; + } +};'); + +=====================================output===================================== +foo = $foo; + } + + /** + * @return mixed + */ + public function getFoo() + { + return $this->foo; + } + + /** + * @param mixed $foo + */ + public function setFoo($foo) + { + $this->foo = $foo; + } +};'); + +================================================================================ +`; diff --git a/tests/eval/eval.php b/tests/eval/eval.php index ca68a2de9..5d1e7ab90 100644 --- a/tests/eval/eval.php +++ b/tests/eval/eval.php @@ -3,3 +3,70 @@ eval("return $a;"); eval("$veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariableName = $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariableValue;"); eval("VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongText" . "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongText" . "VeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongText"); +eval('string +string +string'); +eval( + 'string +string +string' +); +eval("string +string +string +$var"); +eval( + "string +string +string +$var" +); +eval(`string +string +string +$var`); +eval( +`string +string +string +$var` +); +eval(<<foo = $foo; + } + + /** + * @return mixed + */ + public function getFoo() + { + return $this->foo; + } + + /** + * @param mixed $foo + */ + public function setFoo($foo) + { + $this->foo = $foo; + } +};'); diff --git a/tests/eval/jsfmt.spec.js b/tests/eval/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/eval/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/eval/jsfmt.spec.mjs b/tests/eval/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/eval/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/exit/__snapshots__/jsfmt.spec.js.snap b/tests/exit/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 700c16f80..000000000 --- a/tests/exit/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,29 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`exit.php 1`] = ` - +=====================================output===================================== + +================================================================================ +`; + +exports[`extension.phtml 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +=====================================output===================================== + +================================================================================ +`; diff --git a/tests/extensions/extension.php b/tests/extensions/extension.php new file mode 100644 index 000000000..503da4aa0 --- /dev/null +++ b/tests/extensions/extension.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tests/extensions/extension.phtml b/tests/extensions/extension.phtml new file mode 100644 index 000000000..503da4aa0 --- /dev/null +++ b/tests/extensions/extension.phtml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tests/extensions/jsfmt.spec.mjs b/tests/extensions/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/extensions/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/for/__snapshots__/jsfmt.spec.js.snap b/tests/for/__snapshots__/jsfmt.spec.mjs.snap similarity index 82% rename from tests/for/__snapshots__/jsfmt.spec.js.snap rename to tests/for/__snapshots__/jsfmt.spec.mjs.snap index c94f239a4..a670bd44f 100644 --- a/tests/for/__snapshots__/jsfmt.spec.js.snap +++ b/tests/for/__snapshots__/jsfmt.spec.mjs.snap @@ -1,6 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`for.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== $really_really_really_long_value) { - $test3 = $really_really_really_long_value; -} - -foreach ($test as $i): - $test2 = $i; -endforeach; - -foreach ( $test as $i ) { - $test2 = $i; -} - -foreach ($test as $i) - $test2 = $i; - -foreach (['foo' => ['very-very-very-long-value'], 'bar' => ['very-very-very-long-value']] as $veryVeryVeryVeryVeryVeryVeryVeryLongKey) {} -foreach (['foo' => ['very-very-very-long-value'], 'bar' => ['very-very-very-long-value']] as $veryVeryVeryVeryVeryVeryVeryVeryLongKey => $veryVeryVeryVeryVeryVeryVeryVeryLongValue) {} - -foreach ($test as $i); - -foreach ($test as $i): -endforeach; - -foreach ($test as $i) { -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - $really_really_really_long_value -) { - $test3 = $really_really_really_long_value; -} - -foreach ($test as $i): - $test2 = $i; -endforeach; - -foreach ($test as $i) { - $test2 = $i; -} - -foreach ($test as $i) { - $test2 = $i; -} - -foreach ( - [ - 'foo' => ['very-very-very-long-value'], - 'bar' => ['very-very-very-long-value'] - ] - as $veryVeryVeryVeryVeryVeryVeryVeryLongKey -) { -} -foreach ( - [ - 'foo' => ['very-very-very-long-value'], - 'bar' => ['very-very-very-long-value'] - ] - as $veryVeryVeryVeryVeryVeryVeryVeryLongKey => - $veryVeryVeryVeryVeryVeryVeryVeryLongValue -) { -} - -foreach ($test as $i); - -foreach ($test as $i): -endforeach; - -foreach ($test as $i) { -} - -`; diff --git a/tests/foreach/__snapshots__/jsfmt.spec.mjs.snap b/tests/foreach/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..3df99bad4 --- /dev/null +++ b/tests/foreach/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,174 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`foreach.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + $really_really_really_long_value) { + $test3 = $really_really_really_long_value; +} + +foreach ($test as $i): + $test2 = $i; +endforeach; + +foreach ( $test as $i ) { + $test2 = $i; +} + +foreach ($test as $i) + $test2 = $i; + +foreach (['foo' => ['very-very-very-long-value'], 'bar' => ['very-very-very-long-value']] as $veryVeryVeryVeryVeryVeryVeryVeryLongKey) {} +foreach (['foo' => ['very-very-very-long-value'], 'bar' => ['very-very-very-long-value']] as $veryVeryVeryVeryVeryVeryVeryVeryLongKey => $veryVeryVeryVeryVeryVeryVeryVeryLongValue) {} + +foreach ($test as $i); + +foreach ($test as $i): +endforeach; + +foreach ($test as $i) { +} + +foreach ($points as ["x" => $x, "y" => $y]) { + var_dump($x, $y); +} + +foreach ($points as ["veryVeryVeryVeryVeryVeryVeryLongKey" => $x, "veryVeryVeryVeryVeryVeryVeryLongKey" => $y]) { + var_dump($x, $y); +} + +foreach ($points as ["x" => $veryVeryVeryVeryVeryVeryVeryVeryLongValue, "y" => $veryVeryVeryVeryVeryVeryVeryVeryLongValue]) { + var_dump($x, $y); +} + +foreach ($points as ["veryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryLongX, "veryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryLongY]) { + var_dump($x, $y); +} + +foreach ( + [ + 'one' => [ + 'string', + 'other-string' + ], + 'two' => [ + 'string', + 'other-string' + ], + ] + as $key => $aliases +) { +} + +foreach ($test as &$i) { + $test2 = $i; +} + +=====================================output===================================== + $really_really_really_long_value +) { + $test3 = $really_really_really_long_value; +} + +foreach ($test as $i): + $test2 = $i; +endforeach; + +foreach ($test as $i) { + $test2 = $i; +} + +foreach ($test as $i) { + $test2 = $i; +} + +foreach ( + [ + "foo" => ["very-very-very-long-value"], + "bar" => ["very-very-very-long-value"], + ] + as $veryVeryVeryVeryVeryVeryVeryVeryLongKey +) { +} +foreach ( + [ + "foo" => ["very-very-very-long-value"], + "bar" => ["very-very-very-long-value"], + ] + as $veryVeryVeryVeryVeryVeryVeryVeryLongKey => + $veryVeryVeryVeryVeryVeryVeryVeryLongValue +) { +} + +foreach ($test as $i); + +foreach ($test as $i): +endforeach; + +foreach ($test as $i) { +} + +foreach ($points as ["x" => $x, "y" => $y]) { + var_dump($x, $y); +} + +foreach ( + $points + as [ + "veryVeryVeryVeryVeryVeryVeryLongKey" => $x, + "veryVeryVeryVeryVeryVeryVeryLongKey" => $y, + ] +) { + var_dump($x, $y); +} + +foreach ( + $points + as [ + "x" => $veryVeryVeryVeryVeryVeryVeryVeryLongValue, + "y" => $veryVeryVeryVeryVeryVeryVeryVeryLongValue, + ] +) { + var_dump($x, $y); +} + +foreach ( + $points + as [ + "veryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryLongX, + "veryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryLongY, + ] +) { + var_dump($x, $y); +} + +foreach ( + [ + "one" => ["string", "other-string"], + "two" => ["string", "other-string"], + ] + as $key => $aliases +) { +} + +foreach ($test as &$i) { + $test2 = $i; +} + +================================================================================ +`; diff --git a/tests/foreach/foreach.php b/tests/foreach/foreach.php index 555e8b462..f6ffdfc94 100644 --- a/tests/foreach/foreach.php +++ b/tests/foreach/foreach.php @@ -28,3 +28,38 @@ foreach ($test as $i) { } + +foreach ($points as ["x" => $x, "y" => $y]) { + var_dump($x, $y); +} + +foreach ($points as ["veryVeryVeryVeryVeryVeryVeryLongKey" => $x, "veryVeryVeryVeryVeryVeryVeryLongKey" => $y]) { + var_dump($x, $y); +} + +foreach ($points as ["x" => $veryVeryVeryVeryVeryVeryVeryVeryLongValue, "y" => $veryVeryVeryVeryVeryVeryVeryVeryLongValue]) { + var_dump($x, $y); +} + +foreach ($points as ["veryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryLongX, "veryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryLongY]) { + var_dump($x, $y); +} + +foreach ( + [ + 'one' => [ + 'string', + 'other-string' + ], + 'two' => [ + 'string', + 'other-string' + ], + ] + as $key => $aliases +) { +} + +foreach ($test as &$i) { + $test2 = $i; +} diff --git a/tests/foreach/jsfmt.spec.js b/tests/foreach/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/foreach/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/foreach/jsfmt.spec.mjs b/tests/foreach/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/foreach/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/formatting/__snapshots__/jsfmt.spec.js.snap b/tests/formatting/__snapshots__/jsfmt.spec.mjs.snap similarity index 73% rename from tests/formatting/__snapshots__/jsfmt.spec.js.snap rename to tests/formatting/__snapshots__/jsfmt.spec.mjs.snap index bb18a7dd4..a5aaa40ae 100644 --- a/tests/formatting/__snapshots__/jsfmt.spec.js.snap +++ b/tests/formatting/__snapshots__/jsfmt.spec.mjs.snap @@ -1,6 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`formatting.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +Foo + +Foo + +Foo + null]; +$var = ['foo' => NULL]; + +// Should don't change + +$var = $array[int]; +$var = $array[iNt]; + +$var = $array->{int}; +$var = $array->{iNt}; + +self(); +sElF(); +parent(); +pArEnT(); + +int(); +iNt(); +$foo->int; +$foo->iNt; +$foo::int; +$foo::iNt; +$foo::$int; +$foo::$iNt; +$foo->int(); +$foo->iNt(); +$foo::int(); +$foo::iNt(); + +null(); +nUlL(); +$foo->null; +$foo->nUlL; +$foo::null; +$foo::nUlL; +$foo::$null; +$foo::$nUlL; +$foo->null(); +$foo->nUlL(); +$foo::null(); +$foo::nUlL(); + +$var->self(); +$var->sElF(); +$var->parent(); +$var->pArEnT(); + +$var->self; +$var->sElF; +$var->parent; +$var->pArEnT; + +$var::self(); +$var::sElF(); +$var::parent(); +$var::pArEnT(); + +Foo::self(); +Foo::sElF(); +Foo::parent(); +Foo::pArEnT(); + +Foo::$self; +Foo::$sElF; +Foo::$parent; +Foo::$pArEnT; + +=====================================output===================================== + null]; +$var = ["foo" => null]; + +// Should don't change + +$var = $array[int]; +$var = $array[iNt]; + +$var = $array->{int}; +$var = $array->{iNt}; + +self(); +sElF(); +parent(); +pArEnT(); + +int(); +iNt(); +$foo->int; +$foo->iNt; +$foo::int; +$foo::iNt; +$foo::$int; +$foo::$iNt; +$foo->int(); +$foo->iNt(); +$foo::int(); +$foo::iNt(); + +null(); +nUlL(); +$foo->null; +$foo->nUlL; +$foo::null; +$foo::nUlL; +$foo::$null; +$foo::$nUlL; +$foo->null(); +$foo->nUlL(); +$foo::null(); +$foo::nUlL(); + +$var->self(); +$var->sElF(); +$var->parent(); +$var->pArEnT(); + +$var->self; +$var->sElF; +$var->parent; +$var->pArEnT; + +$var::self(); +$var::sElF(); +$var::parent(); +$var::pArEnT(); + +Foo::self(); +Foo::sElF(); +Foo::parent(); +Foo::pArEnT(); + +Foo::$self; +Foo::$sElF; +Foo::$parent; +Foo::$pArEnT; + +================================================================================ +`; diff --git a/tests/identifier-and-reference/identifier.php b/tests/identifier-and-reference/identifier.php new file mode 100644 index 000000000..5d1331eb6 --- /dev/null +++ b/tests/identifier-and-reference/identifier.php @@ -0,0 +1,226 @@ + null]; +$var = ['foo' => NULL]; + +// Should don't change + +$var = $array[int]; +$var = $array[iNt]; + +$var = $array->{int}; +$var = $array->{iNt}; + +self(); +sElF(); +parent(); +pArEnT(); + +int(); +iNt(); +$foo->int; +$foo->iNt; +$foo::int; +$foo::iNt; +$foo::$int; +$foo::$iNt; +$foo->int(); +$foo->iNt(); +$foo::int(); +$foo::iNt(); + +null(); +nUlL(); +$foo->null; +$foo->nUlL; +$foo::null; +$foo::nUlL; +$foo::$null; +$foo::$nUlL; +$foo->null(); +$foo->nUlL(); +$foo::null(); +$foo::nUlL(); + +$var->self(); +$var->sElF(); +$var->parent(); +$var->pArEnT(); + +$var->self; +$var->sElF; +$var->parent; +$var->pArEnT; + +$var::self(); +$var::sElF(); +$var::parent(); +$var::pArEnT(); + +Foo::self(); +Foo::sElF(); +Foo::parent(); +Foo::pArEnT(); + +Foo::$self; +Foo::$sElF; +Foo::$parent; +Foo::$pArEnT; diff --git a/tests/identifier-and-reference/jsfmt.spec.mjs b/tests/identifier-and-reference/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/identifier-and-reference/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/if/__snapshots__/jsfmt.spec.js.snap b/tests/if/__snapshots__/jsfmt.spec.mjs.snap similarity index 79% rename from tests/if/__snapshots__/jsfmt.spec.js.snap rename to tests/if/__snapshots__/jsfmt.spec.mjs.snap index 40a5fefc9..e975389ae 100644 --- a/tests/if/__snapshots__/jsfmt.spec.js.snap +++ b/tests/if/__snapshots__/jsfmt.spec.mjs.snap @@ -1,6 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`if.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== getServiceId() === $activation->getServiceId() ) { @@ -220,7 +235,7 @@ if ( } if ( - $showNoticeValue === '1' && + $showNoticeValue === "1" && !is_null($currentService) && $currentService->getServiceIdWithReallyReallyReallyLongName() === $activation->getServiceId() @@ -234,4 +249,17 @@ if (true) { return 3; } +if ( + $a === + 'string +string +string' +) { + $var = 'string + string + string + other'; +} + +================================================================================ `; diff --git a/tests/if/if.php b/tests/if/if.php index 11886ebe3..9a2b21a75 100644 --- a/tests/if/if.php +++ b/tests/if/if.php @@ -97,3 +97,12 @@ return 1; }} else return 3; + +if ($a === 'string +string +string') { + $var = 'string + string + string + other'; +} diff --git a/tests/if/jsfmt.spec.js b/tests/if/jsfmt.spec.js deleted file mode 100644 index e395434ee..000000000 --- a/tests/if/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname, ["php"]); diff --git a/tests/if/jsfmt.spec.mjs b/tests/if/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/if/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/ignore/__snapshots__/jsfmt.spec.mjs.snap b/tests/ignore/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..f7a165bbf --- /dev/null +++ b/tests/ignore/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,140 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ignore.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + "array", + "in" => function($all) { return "history"; }, + "of" => [ + "php" + ] +];} + + +// prettier-ignore-start +$info = "prettier-ignore-start and -end is currently not supported" ; +// prettier-ignore-end + +class ExampleClass { + // prettier-ignore + const SOME_CONST = 1; + const ANOTHER_CONST = 2; + + // prettier-ignore + const CONST_ARRAY = [ + 'test' => 0, + 'another_key' => 1 + ]; +} + +class FuncVisibility { + + // prettier-ignore + static function a() { + return [ + 'services' => [ '_type' => 'prototype', '_required' => FALSE, '_prototype' => [ + '_type' => 'partial', '_required' => TRUE, '_partial' => 'service', + ]] + ]; + } + + // prettier-ignore + private function b(){ } + +} + +=====================================output===================================== + + "array", + "in" => function($all) { return "history"; }, + "of" => [ + "php" + ] +];} + +// prettier-ignore-start +$info = "prettier-ignore-start and -end is currently not supported"; +// prettier-ignore-end + +class ExampleClass +{ + // prettier-ignore + const SOME_CONST = 1; + const ANOTHER_CONST = 2; + + // prettier-ignore + const CONST_ARRAY = [ + 'test' => 0, + 'another_key' => 1 + ]; +} + +class FuncVisibility +{ + // prettier-ignore + static function a() { + return [ + 'services' => [ '_type' => 'prototype', '_required' => FALSE, '_prototype' => [ + '_type' => 'partial', '_required' => TRUE, '_partial' => 'service', + ]] + ]; + } + + // prettier-ignore + private function b(){ } +} + +================================================================================ +`; diff --git a/tests/ignore/ignore.php b/tests/ignore/ignore.php new file mode 100644 index 000000000..eeeb9010c --- /dev/null +++ b/tests/ignore/ignore.php @@ -0,0 +1,64 @@ + + "array", + "in" => function($all) { return "history"; }, + "of" => [ + "php" + ] +];} + + +// prettier-ignore-start +$info = "prettier-ignore-start and -end is currently not supported" ; +// prettier-ignore-end + +class ExampleClass { + // prettier-ignore + const SOME_CONST = 1; + const ANOTHER_CONST = 2; + + // prettier-ignore + const CONST_ARRAY = [ + 'test' => 0, + 'another_key' => 1 + ]; +} + +class FuncVisibility { + + // prettier-ignore + static function a() { + return [ + 'services' => [ '_type' => 'prototype', '_required' => FALSE, '_prototype' => [ + '_type' => 'partial', '_required' => TRUE, '_partial' => 'service', + ]] + ]; + } + + // prettier-ignore + private function b(){ } + +} diff --git a/tests/ignore/jsfmt.spec.mjs b/tests/ignore/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/ignore/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/include/__snapshots__/jsfmt.spec.js.snap b/tests/include/__snapshots__/jsfmt.spec.mjs.snap similarity index 53% rename from tests/include/__snapshots__/jsfmt.spec.js.snap rename to tests/include/__snapshots__/jsfmt.spec.mjs.snap index 1905d93e8..763cd21dc 100644 --- a/tests/include/__snapshots__/jsfmt.spec.js.snap +++ b/tests/include/__snapshots__/jsfmt.spec.mjs.snap @@ -1,6 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`include.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== - - - - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - - - - - -`; - -exports[`inline.php 1`] = ` - - Hello World! - Hello World! - - Hello World!Hello World! -
- Hello World! -
-
- Hello World! -
- Hello World! - - Hello World! - - Hello World! - Hello World! - - Hello World!Hello World! -
- Hello World! -
-
- Hello World! -
- Hello World! - - Hello World! - Test.

- -

Test.

- -

Test.

- -

Test.

- -'; ?> -
- -
-
-

- -

-
-
- - fetchAll(PDO::FETCH_ASSOC); ?> - - - - - - - -
-
-
- - fetchAll(PDO::FETCH_ASSOC) as $row): ?> - - - - - - -
-
-
- -
Newspage
- - -
Forum
- - -
-
    - -
  • Menu Item
  • - -
- - Text - -

Head

- - -

Test.

- -

Test.

- - -
- - - - -
-
- $b): ?> - ".$b;?> - - - - - -
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -

Test.

- -

Test.

- -

Test.

- -

Test.

-'; -?> -
- -
-
-

- -

-
-
- - fetchAll(PDO::FETCH_ASSOC); ?> - - - - - - - -
-
-
- - fetchAll(PDO::FETCH_ASSOC) as $row): ?> - - - - - - -
-
-
- -
Newspage
- - -
Forum
- - -
-
    - -
  • Menu Item
  • - -
- - Text - -

Head

- -

Test.

- -

Test.

- -
- - - - -
-
- $b): ?> - " . $b; ?> - - - - - -
- -`; - -exports[`mixed-1.php 1`] = ` - -
Foo
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -
Foo
- -`; - -exports[`mixed-2.php 1`] = ` -
Foo
- -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -
Foo
- -

Test.

- -

Test.

- -
Hello world
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -

Test.

- -

Test.

- -
Hello world
- -`; - -exports[`mixed-4.php 1`] = ` -
Hello world
- -

Test.

- -

Test.

- -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -
Hello world
- -

Test.

- -

Test.

- - - -

My First Heading

-

My first paragraph.

- - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - -

My First Heading

-

My first paragraph.

- - - -`; diff --git a/tests/inline/__snapshots__/jsfmt.spec.mjs.snap b/tests/inline/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..21bf1ebde --- /dev/null +++ b/tests/inline/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,2534 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`declare.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + + + + +=====================================output===================================== + + + + + + + +================================================================================ +`; + +exports[`declare-1.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + + + + +=====================================output===================================== + + + + + + + +================================================================================ +`; + +exports[`inline.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + Hello World! + Hello World! + + Hello World!Hello World! +
+ Hello World! +
+
+ Hello World! +
+ Hello World! + + Hello World! + + Hello World! + +
+
+
+ +
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
foo
+ +
+
+
+ +
+
+
+ +
+
+
+
+ +
FooBar
+ +
+
+
+
+ + Hello World! + Hello World! + + Hello World!Hello World! +
+ Hello World! +
+
+ Hello World! +
+ Hello World! + + Hello World! + + Hello World! + +
+
+
+ +
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
foo
+ +
+
+
+ +
+
+
+ +
+
+
+
+ +
FooBar
+ +
+
+
+
+ Test.

+ +

Test.

+ +

Test.

+ +

Test.

+ +'; ?> +
+ +
+
+

+ +

+
+
+ + fetchAll(PDO::FETCH_ASSOC); ?> + + + + + + + +
+
+
+ + fetchAll(PDO::FETCH_ASSOC) as $row): ?> + + + + + + +
+
+
+ +
Newspage
+ + +
Forum
+ + +
+
    + +
  • Menu Item
  • + +
+ + Text + +

Head

+ + +

Test.

+ +

Test.

+ + +
+ + + + +
+
+ $b): ?> + ".$b;?> + + + + + +
+ +=====================================output===================================== +

Test.

+ +

Test.

+ +

Test.

+ +

Test.

+ +'; ?> +
+ +
+
+

+ +

+
+
+ + fetchAll(PDO::FETCH_ASSOC); ?> + + + + + + + +
+
+
+ + fetchAll(PDO::FETCH_ASSOC) as $row): ?> + + + + + + +
+
+
+ +
Newspage
+ + +
Forum
+ + +
+
    + +
  • Menu Item
  • + +
+ + Text + +

Head

+ + +

Test.

+ +

Test.

+ + +
+ + + + +
+
+ $b): ?> + " . $b; ?> + + + + + +
+ +================================================================================ +`; + +exports[`mixed-1.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
Foo
+ +=====================================output===================================== + +
Foo
+ +================================================================================ +`; + +exports[`mixed-2.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +
Foo
+ + +=====================================output===================================== +
Foo
+ + +================================================================================ +`; + +exports[`mixed-3.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +

Test.

+ +

Test.

+ +
Hello world
+ +=====================================output===================================== + +

Test.

+ +

Test.

+ +
Hello world
+ +================================================================================ +`; + +exports[`mixed-4.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +
Hello world
+ +

Test.

+ +

Test.

+ + +=====================================output===================================== +
Hello world
+ +

Test.

+ +

Test.

+ + +================================================================================ +`; + +exports[`mixed-5.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +text + $value) { + if ((!is_string($value) && !is_numeric($value)) || !is_string($key)) { + continue; + } + if (get_magic_quotes_gpc()) { + $value = htmlspecialchars(stripslashes((string) $value)); + } else { + $value = htmlspecialchars((string) $value); + } + } +} +?> +text +=====================================output===================================== +text + $value) { + if ((!is_string($value) && !is_numeric($value)) || !is_string($key)) { + continue; + } + if (get_magic_quotes_gpc()) { + $value = htmlspecialchars(stripslashes((string) $value)); + } else { + $value = htmlspecialchars((string) $value); + } + } +} ?> +text +================================================================================ +`; + +exports[`mixed-6.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+
+ element('collection/item-title', [ + 'class' => $itemTitleClass, + 'small_title' => $item->small_title, + 'title' => $item->title, + 'url' => $url, + 'color' => $item->title_color ?: 'primary', + ]); + ?> +
+
+ +
+
+ element('collection/item-title', [ + 'class' => $itemTitleClass, + 'small_title' => $item->small_title, + 'title' => $item->title, + 'url' => $url, + 'color' => $item->title_color ?: 'primary', + ]); + ?> +
element('collection/item-title', [ + 'class' => $itemTitleClass, + 'small_title' => $item->small_title, + 'title' => $item->title, + 'url' => $url, + 'color' => $item->title_color ?: 'primary', + ]); ?> +
+ +=====================================output===================================== +
+
+ element("collection/item-title", [ + "class" => $itemTitleClass, + "small_title" => $item->small_title, + "title" => $item->title, + "url" => $url, + "color" => $item->title_color ?: "primary", + ]); ?> +
+
+ +
+
+ element("collection/item-title", [ + "class" => $itemTitleClass, + "small_title" => $item->small_title, + "title" => $item->title, + "url" => $url, + "color" => $item->title_color ?: "primary", + ]); ?> +
element("collection/item-title", [ + "class" => $itemTitleClass, + "small_title" => $item->small_title, + "title" => $item->title, + "url" => $url, + "color" => $item->title_color ?: "primary", + ]) ?> +
+ +================================================================================ +`; + +exports[`mixed-7.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +There are examples + +There are examples + +=====================================output===================================== +There are examples + +There are examples + +================================================================================ +`; + +exports[`mixed-8.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+ +=====================================output===================================== +
+ +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+ +================================================================================ +`; + +exports[`mixed-9.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`mixed-10.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + +=====================================output===================================== + + + +================================================================================ +`; + +exports[`mixed-12.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + + + +=====================================output===================================== + + + + +================================================================================ +`; + +exports[`mixed-14.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + +"> +
+ element('collection/item-title', [ + 'class' => $itemTitleClass, + 'small_title' => $item->small_title, + 'title' => $item->title, + 'url' => $url, + 'color' => $item->title_color ?: 'primary', + ], [ + 'foo' => 'bar', + 'bar' => 'foo', + 'barfoo' => 'foobar', + 'foobar' => 'barfoo' + ]); ?> +
+
element('collection/item-title', [ + 'class' => $itemTitleClass, + 'small_title' => $item->small_title, + 'title' => $item->title, + 'url' => $url, + 'color' => $item->title_color ?: 'primary', + ], [ + 'foo' => 'bar', + 'bar' => 'foo', + 'barfoo' => 'foobar', + 'foobar' => 'barfoo' + ]); ?> +
+ + +=====================================output===================================== +
+
+ element( + "collection/item-title", + [ + "class" => $itemTitleClass, + "small_title" => $item->small_title, + "title" => $item->title, + "url" => $url, + "color" => $item->title_color ?: "primary", + ], + [ + "foo" => "bar", + "bar" => "foo", + "barfoo" => "foobar", + "foobar" => "barfoo", + ], + ); ?> +
+
element( + "collection/item-title", + [ + "class" => $itemTitleClass, + "small_title" => $item->small_title, + "title" => $item->title, + "url" => $url, + "color" => $item->title_color ?: "primary", + ], + [ + "foo" => "bar", + "bar" => "foo", + "barfoo" => "foobar", + "foobar" => "barfoo", + ], + ); ?> +
+
+ +================================================================================ +`; + +exports[`mixed-17.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ +
Newspage
+ + +
Forum
+ + +
+ +=====================================output===================================== +
+ +
Newspage
+ + +
Forum
+ + +
+ +================================================================================ +`; + +exports[`mixed-18.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ +
+ +=====================================output===================================== +
+ +
+ +================================================================================ +`; + +exports[`mixed-19.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + FooBar + + FooBar + + Foo bar + + Foo bar + + Foo bar + + Foo bar + + Foo bar + + Foo bar + + Foo Bar + + Foo Bar + +

Test.

+ +

Test.

+ + +=====================================output===================================== + +

Test.

+ +

Test.

+ + +================================================================================ +`; + +exports[`mixed-23.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +
Foo
+ +
+ +
+ +
Bar
+ +=====================================output===================================== +
Foo
+ +
+ +
+ +
Bar
+ +================================================================================ +`; + +exports[`mixed-24.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
FooBar
+ +=====================================output===================================== + +
FooBar
+ +================================================================================ +`; + +exports[`mixed-25.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
Test
+ +=====================================output===================================== + +
Test
+ +================================================================================ +`; + +exports[`mixed-27.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
Test
+ +=====================================output===================================== + +
Test
+ +================================================================================ +`; + +exports[`mixed-28.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`mixed-29.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`mixed-30.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
Foo Bar
+ + +=====================================output===================================== + +
Foo Bar
+ + +================================================================================ +`; + +exports[`mixed-31.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + + +=====================================output===================================== + + + + + +================================================================================ +`; + +exports[`mixed-32.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ + +
+
+ + +
+ +=====================================output===================================== +
+ + +
+
+ + +
+ +================================================================================ +`; + +exports[`mixed-33.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ +
+ +=====================================output===================================== +
+ +
+ +================================================================================ +`; + +exports[`mixed-34.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ +
+ +=====================================output===================================== +
+ +
+ +================================================================================ +`; + +exports[`mixed-35.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ chosen, true); ?> + data-text="order_button_text); ?>" +
+
+
+ + +=====================================output===================================== +
+
+
+
+ chosen, true); ?> + data-text="order_button_text, + ); ?>" +
+
+
+
+ +================================================================================ +`; + +exports[`mixed-37.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +=====================================output===================================== +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +================================================================================ +`; + +exports[`mixed-38.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
+ +=====================================output===================================== + +
+ +================================================================================ +`; + +exports[`mixed-39.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
+ +=====================================output===================================== + +
+ +================================================================================ +`; + +exports[`mixed-40.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
+ +=====================================output===================================== + +
+ +================================================================================ +`; + +exports[`mixed-41.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`mixed-43.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; + +exports[`mixed-44.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
+ +=====================================output===================================== + +
+ +================================================================================ +`; + +exports[`mixed-45.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
+ +=====================================output===================================== + +
+ +================================================================================ +`; + +exports[`mixed-46.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
+ +=====================================output===================================== + +
+ +================================================================================ +`; + +exports[`mixed-47.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
+ +=====================================output===================================== + +
+ +================================================================================ +`; + +exports[`mixed-48.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
+ +=====================================output===================================== + +
+ +================================================================================ +`; + +exports[`mixed-49.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
+ +=====================================output===================================== + +
+ +================================================================================ +`; + +exports[`mixed-50.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
+ +=====================================output===================================== + +
+ +================================================================================ +`; + +exports[`mixed-51.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
+ +=====================================output===================================== + +
+ +================================================================================ +`; + +exports[`mixed-52.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +
+ +=====================================output===================================== + +
+ +================================================================================ +`; + +exports[`mixed-53.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + Foo bar + + Foo bar + + Foo bar + + Foo bar + + Foo bar + + Foo bar + + + + +=====================================output===================================== + + + + +================================================================================ +`; + +exports[`mixed-55.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + +=====================================output===================================== + + + + +================================================================================ +`; + +exports[`mixed-56.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + +=====================================output===================================== + + + +================================================================================ +`; + +exports[`namespace-1.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + +=====================================output===================================== + + + +================================================================================ +`; + +exports[`namespace-2.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + +=====================================output===================================== + + + + +================================================================================ +`; + +exports[`namespace-3.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + + +=====================================output===================================== + + + + +================================================================================ +`; + +exports[`only-html.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + + +

My First Heading

+

My first paragraph.

+ + + +=====================================output===================================== + + + +

My First Heading

+

My first paragraph.

+ + + +================================================================================ +`; + +exports[`semicolon.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +
+
+
+
+ +=====================================output===================================== +
+
+
+
+ +================================================================================ +`; + +exports[`shorthand-1.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +=====================================output===================================== + + +================================================================================ +`; diff --git a/tests/inline/declare-1.php b/tests/inline/declare-1.php new file mode 100644 index 000000000..7fdf52a9e --- /dev/null +++ b/tests/inline/declare-1.php @@ -0,0 +1,8 @@ + + + + + + diff --git a/tests/inline/inline.php b/tests/inline/inline.php index 78bcc6c73..4b4e2ae06 100644 --- a/tests/inline/inline.php +++ b/tests/inline/inline.php @@ -45,3 +45,133 @@ function inlineMultipleStatements() { + Hello World! + +
+
+
+ +
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
foo
+ +
+
+
+ +
+
+
+ +
+
+
+
+ +
FooBar
+ +
+
+
+
+ + diff --git a/tests/inline/mixed-12.php b/tests/inline/mixed-12.php new file mode 100644 index 000000000..4e1a1520f --- /dev/null +++ b/tests/inline/mixed-12.php @@ -0,0 +1,2 @@ + + + + diff --git a/tests/inline/mixed-14.php b/tests/inline/mixed-14.php new file mode 100644 index 000000000..485e4a16d --- /dev/null +++ b/tests/inline/mixed-14.php @@ -0,0 +1,3 @@ + + +"> +
+ element('collection/item-title', [ + 'class' => $itemTitleClass, + 'small_title' => $item->small_title, + 'title' => $item->title, + 'url' => $url, + 'color' => $item->title_color ?: 'primary', + ], [ + 'foo' => 'bar', + 'bar' => 'foo', + 'barfoo' => 'foobar', + 'foobar' => 'barfoo' + ]); ?> +
+
element('collection/item-title', [ + 'class' => $itemTitleClass, + 'small_title' => $item->small_title, + 'title' => $item->title, + 'url' => $url, + 'color' => $item->title_color ?: 'primary', + ], [ + 'foo' => 'bar', + 'bar' => 'foo', + 'barfoo' => 'foobar', + 'foobar' => 'barfoo' + ]); ?> +
+ diff --git a/tests/inline/mixed-17.php b/tests/inline/mixed-17.php new file mode 100644 index 000000000..6b0b78999 --- /dev/null +++ b/tests/inline/mixed-17.php @@ -0,0 +1,10 @@ +
+ +
Newspage
+ + +
Forum
+ + +
diff --git a/tests/inline/mixed-18.php b/tests/inline/mixed-18.php new file mode 100644 index 000000000..01778c8c4 --- /dev/null +++ b/tests/inline/mixed-18.php @@ -0,0 +1,8 @@ +
+ +
diff --git a/tests/inline/mixed-19.php b/tests/inline/mixed-19.php new file mode 100644 index 000000000..d86d976fe --- /dev/null +++ b/tests/inline/mixed-19.php @@ -0,0 +1,6 @@ + + FooBar + + Foo bar + + Foo bar + + Foo bar + + Foo Bar + +

Test.

+ +

Test.

+ diff --git a/tests/inline/mixed-23.php b/tests/inline/mixed-23.php new file mode 100644 index 000000000..4d1cb31dc --- /dev/null +++ b/tests/inline/mixed-23.php @@ -0,0 +1,7 @@ +
Foo
+ +
+ +
+ +
Bar
diff --git a/tests/inline/mixed-24.php b/tests/inline/mixed-24.php new file mode 100644 index 000000000..f3b4de03c --- /dev/null +++ b/tests/inline/mixed-24.php @@ -0,0 +1,6 @@ + +
FooBar
diff --git a/tests/inline/mixed-25.php b/tests/inline/mixed-25.php new file mode 100644 index 000000000..574370eb4 --- /dev/null +++ b/tests/inline/mixed-25.php @@ -0,0 +1,3 @@ + +
Test
diff --git a/tests/inline/mixed-27.php b/tests/inline/mixed-27.php new file mode 100644 index 000000000..e6595d12b --- /dev/null +++ b/tests/inline/mixed-27.php @@ -0,0 +1,9 @@ + +
Test
diff --git a/tests/inline/mixed-28.php b/tests/inline/mixed-28.php new file mode 100644 index 000000000..6094931b7 --- /dev/null +++ b/tests/inline/mixed-28.php @@ -0,0 +1,3 @@ + diff --git a/tests/inline/mixed-29.php b/tests/inline/mixed-29.php new file mode 100644 index 000000000..84999177c --- /dev/null +++ b/tests/inline/mixed-29.php @@ -0,0 +1 @@ + diff --git a/tests/inline/mixed-30.php b/tests/inline/mixed-30.php new file mode 100644 index 000000000..287b3e097 --- /dev/null +++ b/tests/inline/mixed-30.php @@ -0,0 +1,6 @@ + +
Foo Bar
+ diff --git a/tests/inline/mixed-31.php b/tests/inline/mixed-31.php new file mode 100644 index 000000000..685602e94 --- /dev/null +++ b/tests/inline/mixed-31.php @@ -0,0 +1,4 @@ + + + + diff --git a/tests/inline/mixed-32.php b/tests/inline/mixed-32.php new file mode 100644 index 000000000..8e2a549ef --- /dev/null +++ b/tests/inline/mixed-32.php @@ -0,0 +1,8 @@ +
+ + +
+
+ + +
diff --git a/tests/inline/mixed-33.php b/tests/inline/mixed-33.php new file mode 100644 index 000000000..6d331b389 --- /dev/null +++ b/tests/inline/mixed-33.php @@ -0,0 +1,6 @@ +
+ +
diff --git a/tests/inline/mixed-34.php b/tests/inline/mixed-34.php new file mode 100644 index 000000000..1cf5792e7 --- /dev/null +++ b/tests/inline/mixed-34.php @@ -0,0 +1,3 @@ +
+ +
diff --git a/tests/inline/mixed-35.php b/tests/inline/mixed-35.php new file mode 100644 index 000000000..4f4219471 --- /dev/null +++ b/tests/inline/mixed-35.php @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ chosen, true); ?> + data-text="order_button_text); ?>" +
+
+
+ diff --git a/tests/inline/mixed-37.php b/tests/inline/mixed-37.php new file mode 100644 index 000000000..b7e813d33 --- /dev/null +++ b/tests/inline/mixed-37.php @@ -0,0 +1,49 @@ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
diff --git a/tests/inline/mixed-38.php b/tests/inline/mixed-38.php new file mode 100644 index 000000000..182b36709 --- /dev/null +++ b/tests/inline/mixed-38.php @@ -0,0 +1,5 @@ + +
diff --git a/tests/inline/mixed-39.php b/tests/inline/mixed-39.php new file mode 100644 index 000000000..84aed9499 --- /dev/null +++ b/tests/inline/mixed-39.php @@ -0,0 +1,6 @@ + +
diff --git a/tests/inline/mixed-40.php b/tests/inline/mixed-40.php new file mode 100644 index 000000000..a5f3b2a1e --- /dev/null +++ b/tests/inline/mixed-40.php @@ -0,0 +1,7 @@ + +
diff --git a/tests/inline/mixed-41.php b/tests/inline/mixed-41.php new file mode 100644 index 000000000..b3d9bbc7f --- /dev/null +++ b/tests/inline/mixed-41.php @@ -0,0 +1 @@ + diff --git a/tests/inline/mixed-43.php b/tests/inline/mixed-43.php new file mode 100644 index 000000000..62a2de0c8 --- /dev/null +++ b/tests/inline/mixed-43.php @@ -0,0 +1,3 @@ + diff --git a/tests/inline/mixed-44.php b/tests/inline/mixed-44.php new file mode 100644 index 000000000..13a55c1f2 --- /dev/null +++ b/tests/inline/mixed-44.php @@ -0,0 +1,6 @@ + +
diff --git a/tests/inline/mixed-45.php b/tests/inline/mixed-45.php new file mode 100644 index 000000000..39e7cf457 --- /dev/null +++ b/tests/inline/mixed-45.php @@ -0,0 +1,8 @@ + +
diff --git a/tests/inline/mixed-46.php b/tests/inline/mixed-46.php new file mode 100644 index 000000000..a3c387363 --- /dev/null +++ b/tests/inline/mixed-46.php @@ -0,0 +1,10 @@ + +
diff --git a/tests/inline/mixed-47.php b/tests/inline/mixed-47.php new file mode 100644 index 000000000..c7e48f6cc --- /dev/null +++ b/tests/inline/mixed-47.php @@ -0,0 +1,6 @@ + +
diff --git a/tests/inline/mixed-48.php b/tests/inline/mixed-48.php new file mode 100644 index 000000000..5f4834b9d --- /dev/null +++ b/tests/inline/mixed-48.php @@ -0,0 +1,8 @@ + +
diff --git a/tests/inline/mixed-49.php b/tests/inline/mixed-49.php new file mode 100644 index 000000000..7fbc1e5f5 --- /dev/null +++ b/tests/inline/mixed-49.php @@ -0,0 +1,10 @@ + +
diff --git a/tests/inline/mixed-5.php b/tests/inline/mixed-5.php new file mode 100644 index 000000000..51d66fb8c --- /dev/null +++ b/tests/inline/mixed-5.php @@ -0,0 +1,16 @@ +text + $value) { + if ((!is_string($value) && !is_numeric($value)) || !is_string($key)) { + continue; + } + if (get_magic_quotes_gpc()) { + $value = htmlspecialchars(stripslashes((string) $value)); + } else { + $value = htmlspecialchars((string) $value); + } + } +} +?> +text \ No newline at end of file diff --git a/tests/inline/mixed-50.php b/tests/inline/mixed-50.php new file mode 100644 index 000000000..8b278131f --- /dev/null +++ b/tests/inline/mixed-50.php @@ -0,0 +1,7 @@ + +
diff --git a/tests/inline/mixed-51.php b/tests/inline/mixed-51.php new file mode 100644 index 000000000..cd44fbb96 --- /dev/null +++ b/tests/inline/mixed-51.php @@ -0,0 +1,10 @@ + +
diff --git a/tests/inline/mixed-52.php b/tests/inline/mixed-52.php new file mode 100644 index 000000000..666e3119b --- /dev/null +++ b/tests/inline/mixed-52.php @@ -0,0 +1,13 @@ + +
diff --git a/tests/inline/mixed-53.php b/tests/inline/mixed-53.php new file mode 100644 index 000000000..c088549a0 --- /dev/null +++ b/tests/inline/mixed-53.php @@ -0,0 +1,15 @@ + + Foo bar + + Foo bar + + Foo bar + + + diff --git a/tests/inline/mixed-55.php b/tests/inline/mixed-55.php new file mode 100644 index 000000000..a46e4d794 --- /dev/null +++ b/tests/inline/mixed-55.php @@ -0,0 +1,7 @@ + + + diff --git a/tests/inline/mixed-56.php b/tests/inline/mixed-56.php new file mode 100644 index 000000000..40a6a0371 --- /dev/null +++ b/tests/inline/mixed-56.php @@ -0,0 +1,2 @@ + + diff --git a/tests/inline/mixed-6.php b/tests/inline/mixed-6.php new file mode 100644 index 000000000..ed60daf31 --- /dev/null +++ b/tests/inline/mixed-6.php @@ -0,0 +1,33 @@ +
+
+ element('collection/item-title', [ + 'class' => $itemTitleClass, + 'small_title' => $item->small_title, + 'title' => $item->title, + 'url' => $url, + 'color' => $item->title_color ?: 'primary', + ]); + ?> +
+
+ +
+
+ element('collection/item-title', [ + 'class' => $itemTitleClass, + 'small_title' => $item->small_title, + 'title' => $item->title, + 'url' => $url, + 'color' => $item->title_color ?: 'primary', + ]); + ?> +
element('collection/item-title', [ + 'class' => $itemTitleClass, + 'small_title' => $item->small_title, + 'title' => $item->title, + 'url' => $url, + 'color' => $item->title_color ?: 'primary', + ]); ?> +
diff --git a/tests/inline/mixed-7.php b/tests/inline/mixed-7.php new file mode 100644 index 000000000..92f000298 --- /dev/null +++ b/tests/inline/mixed-7.php @@ -0,0 +1,3 @@ +There are examples + +There are examples diff --git a/tests/inline/mixed-8.php b/tests/inline/mixed-8.php new file mode 100644 index 000000000..0ce3232b1 --- /dev/null +++ b/tests/inline/mixed-8.php @@ -0,0 +1,85 @@ +
+ +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
diff --git a/tests/inline/mixed-9.php b/tests/inline/mixed-9.php new file mode 100644 index 000000000..84999177c --- /dev/null +++ b/tests/inline/mixed-9.php @@ -0,0 +1 @@ + diff --git a/tests/inline/namespace-1.php b/tests/inline/namespace-1.php new file mode 100644 index 000000000..e31ab0b7a --- /dev/null +++ b/tests/inline/namespace-1.php @@ -0,0 +1,2 @@ + + diff --git a/tests/inline/namespace-2.php b/tests/inline/namespace-2.php new file mode 100644 index 000000000..a24ce33ed --- /dev/null +++ b/tests/inline/namespace-2.php @@ -0,0 +1,3 @@ + + + diff --git a/tests/inline/namespace-3.php b/tests/inline/namespace-3.php new file mode 100644 index 000000000..a9c956454 --- /dev/null +++ b/tests/inline/namespace-3.php @@ -0,0 +1,6 @@ + + + diff --git a/tests/inline/semicolon.php b/tests/inline/semicolon.php new file mode 100644 index 000000000..62335ef8e --- /dev/null +++ b/tests/inline/semicolon.php @@ -0,0 +1,4 @@ +
+
+
+
diff --git a/tests/inline/shorthand-1.php b/tests/inline/shorthand-1.php new file mode 100644 index 000000000..bc70cb62c --- /dev/null +++ b/tests/inline/shorthand-1.php @@ -0,0 +1 @@ + diff --git a/tests/insert-pragma/__snapshots__/jsfmt.spec.mjs.snap b/tests/insert-pragma/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..1c95a3803 --- /dev/null +++ b/tests/insert-pragma/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,1156 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`pragma-alreadyinserted-CRLF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This already has the pragma, it shouldn't get another. + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This already has the pragma, it shouldn't get another. + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-alreadyinserted-CRLF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This already has the pragma, it shouldn't get another. + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This already has the pragma, it shouldn't get another. + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-alreadyinserted-CRLF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This already has the pragma, it shouldn't get another. + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This already has the pragma, it shouldn't get another. + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-alreadyinserted-LF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This already has the pragma, it shouldn't get another. + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This already has the pragma, it shouldn't get another. + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-alreadyinserted-LF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This already has the pragma, it shouldn't get another. + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This already has the pragma, it shouldn't get another. + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-alreadyinserted-LF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This already has the pragma, it shouldn't get another. + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This already has the pragma, it shouldn't get another. + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-firstdocblockmidfile.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +class Something +{ + function whatever () + { + /** + * Some mid-file docblock + */ + $variable = 3; + } +} + +=====================================output===================================== + +/** + * @format + */ + +class Something +{ + function whatever() + { + /** + * Some mid-file docblock + */ + $variable = 3; + } +} + +================================================================================ +`; + +exports[`pragma-firstdocblockmidfile.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +class Something +{ + function whatever () + { + /** + * Some mid-file docblock + */ + $variable = 3; + } +} + +=====================================output===================================== + +/** + * @format + */ + +class Something +{ + function whatever() + { + /** + * Some mid-file docblock + */ + $variable = 3; + } +} + +================================================================================ +`; + +exports[`pragma-firstdocblockmidfile.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +class Something +{ + function whatever () + { + /** + * Some mid-file docblock + */ + $variable = 3; + } +} + +=====================================output===================================== + +/** + * @format + */ + +class Something +{ + function whatever() + { + /** + * Some mid-file docblock + */ + $variable = 3; + } +} + +================================================================================ +`; + +exports[`pragma-nodocblock-CRLF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +echo "Hello World"; + +// non-docblock comment + +=====================================output===================================== + +/** + * @format + */ +echo "Hello World"; + +echo "Hello World"; + +// non-docblock comment + +================================================================================ +`; + +exports[`pragma-nodocblock-CRLF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +echo "Hello World"; + +// non-docblock comment + +=====================================output===================================== + +/** + * @format + */ +echo "Hello World"; + +echo "Hello World"; + +// non-docblock comment + +================================================================================ +`; + +exports[`pragma-nodocblock-CRLF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +echo "Hello World"; + +// non-docblock comment + +=====================================output===================================== + +/** + * @format + */ +echo "Hello World"; + +echo "Hello World"; + +// non-docblock comment + +================================================================================ +`; + +exports[`pragma-nodocblock-LF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +echo "Hello World"; + +// non-docblock comment + +=====================================output===================================== + +/** + * @format + */ +echo "Hello World"; + +echo "Hello World"; + +// non-docblock comment + +================================================================================ +`; + +exports[`pragma-nodocblock-LF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +echo "Hello World"; + +// non-docblock comment + +=====================================output===================================== + +/** + * @format + */ +echo "Hello World"; + +echo "Hello World"; + +// non-docblock comment + +================================================================================ +`; + +exports[`pragma-nodocblock-LF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + + +echo "Hello World"; + +// non-docblock comment + +=====================================output===================================== + +/** + * @format + */ +echo "Hello World"; + +echo "Hello World"; + +// non-docblock comment + +================================================================================ +`; + +exports[`pragma-sparsedocblock-CRLF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This docblock doesn't have any pragma in it yet. + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This docblock doesn't have any pragma in it yet. + * @format + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-sparsedocblock-CRLF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This docblock doesn't have any pragma in it yet. + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This docblock doesn't have any pragma in it yet. + * @format + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-sparsedocblock-CRLF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This docblock doesn't have any pragma in it yet. + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This docblock doesn't have any pragma in it yet. + * @format + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-sparsedocblock-LF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This docblock doesn't have any pragma in it yet. + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This docblock doesn't have any pragma in it yet. + * @format + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-sparsedocblock-LF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This docblock doesn't have any pragma in it yet. + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This docblock doesn't have any pragma in it yet. + * @format + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-sparsedocblock-LF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This docblock doesn't have any pragma in it yet. + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This docblock doesn't have any pragma in it yet. + * @format + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-weirddocblock-CRLF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** edge case docblock */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * edge case docblock + * @format + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-weirddocblock-CRLF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** edge case docblock */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * edge case docblock + * @format + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-weirddocblock-CRLF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** edge case docblock */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * edge case docblock + * @format + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-weirddocblock-LF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** edge case docblock */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * edge case docblock + * @format + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-weirddocblock-LF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** edge case docblock */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * edge case docblock + * @format + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-weirddocblock-LF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** edge case docblock */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * edge case docblock + * @format + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-weirddocblock-alt-CRLF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** @edge + * case */ + +echo "Hello World"; + +=====================================output===================================== + +/** @edge + * @format + * case */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-weirddocblock-alt-CRLF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** @edge + * case */ + +echo "Hello World"; + +=====================================output===================================== + +/** @edge + * @format + * case */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-weirddocblock-alt-CRLF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** @edge + * case */ + +echo "Hello World"; + +=====================================output===================================== + +/** @edge + * @format + * case */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-weirddocblock-alt-LF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** @edge + * case */ + +echo "Hello World"; + +=====================================output===================================== + +/** @edge + * @format + * case */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-weirddocblock-alt-LF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** @edge + * case */ + +echo "Hello World"; + +=====================================output===================================== + +/** @edge + * @format + * case */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-weirddocblock-alt-LF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** @edge + * case */ + +echo "Hello World"; + +=====================================output===================================== + +/** @edge + * @format + * case */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-withdocblock-CRLF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This is a preexisting docblock which will receive a "format" pragma + * + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This is a preexisting docblock which will receive a "format" pragma + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-withdocblock-CRLF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This is a preexisting docblock which will receive a "format" pragma + * + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This is a preexisting docblock which will receive a "format" pragma + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-withdocblock-CRLF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This is a preexisting docblock which will receive a "format" pragma + * + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This is a preexisting docblock which will receive a "format" pragma + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-withdocblock-LF.php 1`] = ` +====================================options===================================== +endOfLine: "cr" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This is a preexisting docblock which will receive a "format" pragma + * + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This is a preexisting docblock which will receive a "format" pragma + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-withdocblock-LF.php 2`] = ` +====================================options===================================== +endOfLine: "crlf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This is a preexisting docblock which will receive a "format" pragma + * + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This is a preexisting docblock which will receive a "format" pragma + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +================================================================================ +`; + +exports[`pragma-withdocblock-LF.php 3`] = ` +====================================options===================================== +endOfLine: "lf" +insertPragma: true +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== + +/** + * This is a preexisting docblock which will receive a "format" pragma + * + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +=====================================output===================================== + +/** + * This is a preexisting docblock which will receive a "format" pragma + * + * @format + * @author Bob Bobberson + * @copyright Doge Inc. 2018 - All Rights Reserved + */ + +echo "Hello World"; + +================================================================================ +`; diff --git a/tests/insert-pragma/jsfmt.spec.mjs b/tests/insert-pragma/jsfmt.spec.mjs new file mode 100644 index 000000000..c1683e70b --- /dev/null +++ b/tests/insert-pragma/jsfmt.spec.mjs @@ -0,0 +1,3 @@ +run_spec(import.meta, ["php"], { insertPragma: true, endOfLine: "cr" }); +run_spec(import.meta, ["php"], { insertPragma: true, endOfLine: "crlf" }); +run_spec(import.meta, ["php"], { insertPragma: true, endOfLine: "lf" }); diff --git a/tests/insert-pragma/pragma-alreadyinserted-CRLF.php b/tests/insert-pragma/pragma-alreadyinserted-CRLF.php new file mode 100644 index 000000000..65f8815dc --- /dev/null +++ b/tests/insert-pragma/pragma-alreadyinserted-CRLF.php @@ -0,0 +1,10 @@ +getTitle()) . $post->getId(); +} + +function test(foo|bar &$input) {} + +=====================================output===================================== +getTitle()) . $post->getId(); +} + +function test(foo|bar &$input) {} + +================================================================================ +`; diff --git a/tests/intersection-types/intersection.php b/tests/intersection-types/intersection.php new file mode 100644 index 000000000..c9bcb6ba9 --- /dev/null +++ b/tests/intersection-types/intersection.php @@ -0,0 +1,6 @@ +getTitle()) . $post->getId(); +} + +function test(foo|bar &$input) {} diff --git a/tests/intersection-types/jsfmt.spec.mjs b/tests/intersection-types/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/intersection-types/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/isset/__snapshots__/jsfmt.spec.mjs.snap b/tests/isset/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..88f261c05 --- /dev/null +++ b/tests/isset/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,122 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`isset.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +a); +isset($a->a->b); +isset($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty); + +if (isset($var)) { + echo "This var is set so I will print."; +} + +if ( isset( $var['val1'], $var['val2'] ) && $var['val2'] === 'on' ) { + unset( $var['val1'] ); +} + +$a = isset($a['pie']['a']); +$a = isset($a['pie']['a']['b']); + +var_dump(isset($expected_array_got_string['some_key'])); +var_dump(isset($expected_array_got_string[0])); +var_dump(isset($expected_array_got_string['0'])); +var_dump(isset($expected_array_got_string[0.5])); +var_dump(isset($expected_array_got_string['0.5'])); +var_dump(isset($expected_array_got_string['0 Mostel'])); + +$username = isset($_GET['user']) ? $_GET['user'] : 'nobody'; + +function foo() +{ + return isset($array['foo']) || array_key_exists('foo', $array); +} + +echo isset($foo)?'yes ':'no ', isset($foo['aaaa'])?'yes ':'no '; +echo isset($veryVeryVeryVeryLongVariable)?'yes ':'no ', isset($veryVeryVeryVeryLongVariable['aaaa'])?'yes ':'no '; + +class T +{ + function __isset($att) + { + $props = get_object_vars($this); + + return array_key_exists($att, $props); + } +} + +=====================================output===================================== +a); +isset($a->a->b); +isset( + $veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable + ->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty + ->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty, +); + +if (isset($var)) { + echo "This var is set so I will print."; +} + +if (isset($var["val1"], $var["val2"]) && $var["val2"] === "on") { + unset($var["val1"]); +} + +$a = isset($a["pie"]["a"]); +$a = isset($a["pie"]["a"]["b"]); + +var_dump(isset($expected_array_got_string["some_key"])); +var_dump(isset($expected_array_got_string[0])); +var_dump(isset($expected_array_got_string["0"])); +var_dump(isset($expected_array_got_string[0.5])); +var_dump(isset($expected_array_got_string["0.5"])); +var_dump(isset($expected_array_got_string["0 Mostel"])); + +$username = isset($_GET["user"]) ? $_GET["user"] : "nobody"; + +function foo() +{ + return isset($array["foo"]) || array_key_exists("foo", $array); +} + +echo isset($foo) ? "yes " : "no ", isset($foo["aaaa"]) ? "yes " : "no "; +echo isset($veryVeryVeryVeryLongVariable) ? "yes " : "no ", + isset($veryVeryVeryVeryLongVariable["aaaa"]) ? "yes " : "no "; + +class T +{ + function __isset($att) + { + $props = get_object_vars($this); + + return array_key_exists($att, $props); + } +} + +================================================================================ +`; diff --git a/tests/isset/isset.php b/tests/isset/isset.php new file mode 100644 index 000000000..56023e626 --- /dev/null +++ b/tests/isset/isset.php @@ -0,0 +1,49 @@ +a); +isset($a->a->b); +isset($veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongVariable->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty->veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongProperty); + +if (isset($var)) { + echo "This var is set so I will print."; +} + +if ( isset( $var['val1'], $var['val2'] ) && $var['val2'] === 'on' ) { + unset( $var['val1'] ); +} + +$a = isset($a['pie']['a']); +$a = isset($a['pie']['a']['b']); + +var_dump(isset($expected_array_got_string['some_key'])); +var_dump(isset($expected_array_got_string[0])); +var_dump(isset($expected_array_got_string['0'])); +var_dump(isset($expected_array_got_string[0.5])); +var_dump(isset($expected_array_got_string['0.5'])); +var_dump(isset($expected_array_got_string['0 Mostel'])); + +$username = isset($_GET['user']) ? $_GET['user'] : 'nobody'; + +function foo() +{ + return isset($array['foo']) || array_key_exists('foo', $array); +} + +echo isset($foo)?'yes ':'no ', isset($foo['aaaa'])?'yes ':'no '; +echo isset($veryVeryVeryVeryLongVariable)?'yes ':'no ', isset($veryVeryVeryVeryLongVariable['aaaa'])?'yes ':'no '; + +class T +{ + function __isset($att) + { + $props = get_object_vars($this); + + return array_key_exists($att, $props); + } +} diff --git a/tests/isset/jsfmt.spec.mjs b/tests/isset/jsfmt.spec.mjs new file mode 100644 index 000000000..8829c872f --- /dev/null +++ b/tests/isset/jsfmt.spec.mjs @@ -0,0 +1 @@ +run_spec(import.meta, ["php"]); diff --git a/tests/kitchen_sink/__snapshots__/jsfmt.spec.js.snap b/tests/kitchen_sink/__snapshots__/jsfmt.spec.mjs.snap similarity index 75% rename from tests/kitchen_sink/__snapshots__/jsfmt.spec.js.snap rename to tests/kitchen_sink/__snapshots__/jsfmt.spec.mjs.snap index a2faccf4f..b468e90a5 100644 --- a/tests/kitchen_sink/__snapshots__/jsfmt.spec.js.snap +++ b/tests/kitchen_sink/__snapshots__/jsfmt.spec.mjs.snap @@ -1,6 +1,11 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`kitchen_sink.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== test(function ($a, $b) { } } }); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +=====================================output===================================== test(function ($a, $b) { } }); +================================================================================ `; diff --git a/tests/kitchen_sink/jsfmt.spec.js b/tests/kitchen_sink/jsfmt.spec.js deleted file mode 100644 index 2e1965334..000000000 --- a/tests/kitchen_sink/jsfmt.spec.js +++ /dev/null @@ -1,2 +0,0 @@ -run_spec(__dirname, ["php"]); -// run_spec(__dirname, ["php"], { openingBraceNewLine: false }); diff --git a/tests/kitchen_sink/jsfmt.spec.mjs b/tests/kitchen_sink/jsfmt.spec.mjs new file mode 100644 index 000000000..efafecaf4 --- /dev/null +++ b/tests/kitchen_sink/jsfmt.spec.mjs @@ -0,0 +1,2 @@ +run_spec(import.meta, ["php"]); +// run_spec(import.meta, ["php"], { openingBraceNewLine: false }); diff --git a/tests/list/__snapshots__/jsfmt.spec.js.snap b/tests/list/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 61fbc9d2a..000000000 --- a/tests/list/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,120 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`list.php 1`] = ` -fetch(PDO::FETCH_NUM)) {} - -list($a, list($b, $c)) = array(1, array(2, 3)); - -$info = array('coffee', 'brown', 'caffeine'); -list($a[0], $a[1], $a[2]) = $info; - -list("id" => $id1, "name" => $name1) = $data[0]; -list("veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue) = $data[0]; -list("veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue) = $data[0]; - -foreach ($data as list("id" => $id, "name" => $name)) { - // logic here with $id and $name -} - -foreach ($data as list("veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue)) { - // logic here with $id and $name -} - -foreach ($data as list("veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue)) { - // logic here with $id and $name -} - -list(, $b) = ['a', 'b']; -list(, , $c) = ['a', 'b', 'c']; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -fetch(PDO::FETCH_NUM)) { -} - -list($a, list($b, $c)) = array(1, array(2, 3)); - -$info = array('coffee', 'brown', 'caffeine'); -list($a[0], $a[1], $a[2]) = $info; - -list("id" => $id1, "name" => $name1) = $data[0]; -list( - "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, - "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue -) = $data[0]; -list( - "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => - $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, - "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => - $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue -) = $data[0]; - -foreach ($data as list("id" => $id, "name" => $name)) { - // logic here with $id and $name -} - -foreach ( - $data - as list( - "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, - "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue - ) -) { - // logic here with $id and $name -} - -foreach ( - $data - as list( - "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => - $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, - "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => - $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue - ) -) { - // logic here with $id and $name -} - -list(, $b) = ['a', 'b']; -list(, , $c) = ['a', 'b', 'c']; - -`; diff --git a/tests/list/__snapshots__/jsfmt.spec.mjs.snap b/tests/list/__snapshots__/jsfmt.spec.mjs.snap new file mode 100644 index 000000000..c21e367f4 --- /dev/null +++ b/tests/list/__snapshots__/jsfmt.spec.mjs.snap @@ -0,0 +1,796 @@ +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing + +exports[`list.php 1`] = ` +====================================options===================================== +parsers: ["php"] +printWidth: 80 + | printWidth +=====================================input====================================== +fetch(PDO::FETCH_NUM)) {} + +list($a, list($b, $c)) = array(1, array(2, 3)); + +$info = array('coffee', 'brown', 'caffeine'); +list($a[0], $a[1], $a[2]) = $info; + +list("id" => $id1, "name" => $name1) = $data[0]; +list("veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue) = $data[0]; +list("veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue) = $data[0]; + +foreach ($data as list("id" => $id, "name" => $name)) { + // logic here with $id and $name +} + +foreach ($data as list("veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue, "veryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryLongValue)) { + // logic here with $id and $name +} + +foreach ($data as list("veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue, "veryVeryVeryVeryVeryVeryVeryVeryVeryLongKey" => $veryVeryVeryVeryVeryVeryVeryVeryVeryLongValue)) { + // logic here with $id and $name +} + +list(, $b) = ['a', 'b']; +list(, , $c) = ['a', 'b', 'c']; + +while (list($id, $name, $salary) = $result->fetch(PDO::FETCH_NUM)) { + echo "
$name$salary
$name$salary
$name$salary
$name$salary
$name$salary