{{ site.description | default: site.github.project_tagline }}
- {% if site.github.is_project_page %} -Visit the Project on GitHub {{ site.github.repository_nwo }}
- {% endif %} -composer require {{ site.phpcsutils.packagist }}
Latest release: {{ site.github.latest_release.tag_name }}
+ {% endif %} + {% if site.show_downloads %}Visit the Project on GitHub {{ site.github.repository_nwo }}
-composer require {{ site.phpcsutils.packagist }}:"^1.0"
+composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
+composer require {{ site.phpcsutils.packagist }}:"^1.0"
No further action needed. You can start using all the utility functions, abstract sniff classes and other features of PHPCSUtils straight away.
-> :information_source: The PHPCSUtils package includes the [DealerDirect Composer PHPCS plugin](https://github.com/Dealerdirect/phpcodesniffer-composer-installer).
+> :information_source: The PHPCSUtils package includes the [Composer PHPCS plugin].
>
> This plugin will automatically register PHPCSUtils (and your own external standard) with PHP_CodeSniffer, so you and your users don't have to worry about this anymore.
>
> :warning: Note: if your end-user installation instructions include instructions on adding a Composer PHPCS plugin or on manually registering your standard with PHPCS using the `--config-set installed_paths` command, you can remove those instructions as they are no longer needed.
+>
+> :information_source: As of Composer 2.2, Composer will [ask for permission](https://blog.packagist.com/composer-2-2/#more-secure-plugin-execution) to allow the Composer PHPCS plugin to execute code. For the plugin to be functional, permission needs to be granted.
+> This can be done ahead of time by instructing your users to run the following command before installing your standard:
+>
+> composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
+>
#### Running your unit tests
@@ -94,104 +95,83 @@ If you have your own unit test suite to test your sniffs, make sure to load the
If you intend to use the test utilities provided in the `PHPCSUtils/TestUtils` directory, make sure you also load the `vendor/phpcsstandards/phpcsutils/phpcsutils-autoload.php` file in your PHPUnit bootstrap file.
-### Composer-based with a minimum PHPCS requirement of PHPCS 2.6.0
-
-Follow the above instructions for use with PHPCS 3.x.
-
-In addition to that, add the following to the `ruleset.xml` file of your standard(s):
-```xml
-
-
-```
-
-> :information_source: The `PHPCS23Utils` "standard" does not add any real sniffs, it only makes sure that the Utility functions will work in PHPCS 2.x as well.
-
-#### Running your unit tests
-
-If your standard supports both PHPCS 2.x as well as 3.x, you are bound to already have a PHPUnit `bootstrap.php` file in place.
-
-To allow the unit tests to find the relevant files for PHPCSUtils, make sure that the bootstrap loads both the Composer `vendor/autoload.php` file, as well as the `vendor/phpcsstandards/phpcsutils/phpcsutils-autoload.php` file.
-
-
-
-Frequently Asked Questions
--------
+## Frequently Asked Questions
-
+
-#### Q: How does this all work without an external standard needing to register an autoloader?
+### Q: How does this all work without an external standard needing to register an autoloader?
A: As PHPCSUtils is registered with PHPCS as an external standard and PHPCSUtils complies with the naming requirements of PHPCS, the PHPCS native autoloader will automatically take care of loading the classes used from PHPCSUtils.
-#### Q: What does the `PHPCS23Utils` standard do?
-
-A: All the `PHPCS23Utils` standard does is load the `phpcsutils-autoload.php` file.
-
-PHPCS 3.x uses namespaces, while PHPCS 2.x does not. The `phpcsutils-autoload.php` file creates `class_alias`-es for the most commonly used PHPCS classes, including all PHPCS classes used by PHPCSUtils. That way, both your external standard as well as PHPCSUtils can refer to the PHPCS 3.x class names and the code will still work in PHPCS 2.x.
-
-#### Q: Why is PHP_CodeSniffer 3.5.3 not supported?
-
-A: The backfill for PHP 7.4 numeric literals with underscores in PHP_CodeSniffer 3.5.3 is broken and there is no way to reliably provide support for anything to do with numbers or `T_STRING` tokens when using PHP_CodeSniffer 3.5.3 as the tokens returned by the tokenizer are unpredictable and unreliable.
-
-The backfill was fixed in PHP_CodeSniffer 3.5.4.
-
-#### Q: Any other problematic PHPCS versions?
-
-A: Well, the arrow function backfill which was added in PHPCS 3.5.3 is still causing problems. In a very limited set of circumstances, it will even hang the Tokenizer. A fix for [one particular such problem](https://github.com/squizlabs/php_codesniffer/issues/2926) has been committed to `master`, but is not (yet) in a released version. It is expected to be released in PHP_CodeSniffer 3.5.6.
-
-As the Tokenizer hanging is a problem unrelated to PHPCSUtils and not something which can be mitigated from within PHPCSUtils in any conceivable way, PHPCSUtils won't block installation in combination with PHPCS 3.5.4 and 3.5.5.
-
-There are several other issues which can not be worked around, like scope closers being set incorrectly and throwing the scope setting off for the rest of the file, so not withstanding that PHPCSUtils can work around a lot of issues, it is still highly recommended to advise your end-users to always use the latest version of PHPCS for the most reliable results.
-
-#### Q: Does using PHPCSUtils have any effect on the PHPCS native sniffs?
+### Q: Does using PHPCSUtils have any effect on the PHPCS native sniffs?
A: No. PHPCSUtils will only work for those sniffs which explicitly use the PHPCSUtils functionality.
If your standard includes both PHPCS native sniffs as well as your own sniffs, your own sniffs can benefit from the back-compat layer offered by PHPCSUtils, as well as from the additional utility functions. However, the PHPCS native sniffs will not receive those benefits, as PHPCS itself does not use PHPCSUtils.
-#### Q: Do the utilities work with javascript/CSS files?
+### Q: Do the utilities work with javascript/CSS files?
-A: JS/CSS support will be removed from PHP_CodeSniffer in PHPCS 4.x.
-While at this time, some of the utilies _may_ work with JS/CSS files, PHPCSUtils does not offer formal support for JS/CSS sniffing with PHP_CodeSniffer and will stop any existing support once PHPCS 4.x has been released.
+A: JS/CSS support will be removed from `PHP_CodeSniffer` in PHPCS 4.x.
+While at this time, some of the utilities _may_ work with JS/CSS files, PHPCSUtils does not offer formal support for JS/CSS sniffing with `PHP_CodeSniffer` and will stop any existing support once PHPCS 4.x has been released.
-#### Q: Are all file encodings supported?
+### Q: Are all file encodings supported?
A: No. The UTF-8 file encoding is the only officially supported encoding. Support for other encodings may incidentally work, but is not officially supported.
> **It is recommended to advise your users to save their files as UTF-8 encoded for the best results.**
-PHP_CodeSniffer 3.x will default to UTF-8 as the expected file encoding.
-If your standard supports PHP_CodeSniffer 2.x, it is recommended to set the expected encoding in the ruleset to `utf-8`, like so: ` ` or to advise users to use the CLI option `--encoding=utf-8`.
+Note: `PHP_CodeSniffer` 3.x defaults to UTF-8 as the expected file encoding.
+
+
+
+## Potential Support Questions from your End-Users
-Potential Support Questions from your End-Users
--------
+
-#### Q: A user reports a fatal "class not found" error for a class from PHPCSUtils.
+### Q: A user reports a fatal "class not found" error for a class from PHPCSUtils
1. Check that the version of PHPCSUtils the user has installed complies with the minimum version of PHPCSUtils your standard requires. If not, they will need to upgrade.
2. If the version is correct, this indicates that the end-user does not have PHPCSUtils installed and/or registered with PHP_CodeSniffer.
- Please review your standard's installation instructions to make sure that PHPCSUtils will be installed when those are followed.
- Inform the user to install PHPCSUtils and register it with PHP_CodeSniffer.
+---
+
> :bulb: **Pro-tip**: if you want to prevent the fatal error and show a _friendlier_ error message instead, add ` ` to your standard's `ruleset.xml` file.
>
-> With that in place, PHP_CodeSniffer will show a _"ERROR: the "PHPCSUtils" coding standard is not installed."_ message if PHPCSUtils is missing as soon as the ruleset loading is finished.
+> With that in place, `PHP_CodeSniffer` will show a _"ERROR: the "PHPCSUtils" coding standard is not installed."_ message if PHPCSUtils is missing as soon as the ruleset loading is finished.
+
+---
> :bulb: **Pro-tip**: provide upgrade instructions for your end-users. For Composer-based installs, those should look like this:
-> composer update your/cs-package --with-dependencies
+>
+> composer update your/cs-package --with-[all-]dependencies
>
+>
> That way, when the user updates your coding standards package, they will automatically also update PHPCSUtils.
+---
+
-Contributing
--------
+## Contributing
+
Contributions to this project are welcome. Clone the repo, branch off from `develop`, make your changes, commit them and send in a pull request.
If you are unsure whether the changes you are proposing would be welcome, please open an issue first to discuss your proposal.
-License
--------
-This code is released under the [GNU Lesser General Public License (LGPLv3)](http://www.gnu.org/copyleft/lesser.html).
+
+## License
+
+This code is released under the [GNU Lesser General Public License (LGPLv3)](https://www.gnu.org/copyleft/lesser.html).
+
+
+[PHP_CodeSniffer]: https://github.com/squizlabs/PHP_CodeSniffer
+[Composer PHPCS plugin]: https://github.com/PHPCSStandards/composer-installer
+[phpcsutils-repo]: https://github.com/PHPCSStandards/PHPCSUtils
+[phpcsutils-web]: https://phpcsutils.com/
+[phpcsutils-packagist]: https://packagist.org/packages/phpcsstandards/phpcsutils
+[phpcsutils-releases]: https://github.com/PHPCSStandards/PHPCSUtils/releases
+[phpcsutils-tests-gha]: https://github.com/PHPCSStandards/PHPCSUtils/actions/workflows/test.yml
diff --git a/docs/phpdoc/classes/PHPCSUtils-AbstractSniffs-AbstractArrayDeclarationSniff.html b/docs/phpdoc/classes/PHPCSUtils-AbstractSniffs-AbstractArrayDeclarationSniff.html
index d65c9501..33b518f7 100644
--- a/docs/phpdoc/classes/PHPCSUtils-AbstractSniffs-AbstractArrayDeclarationSniff.html
+++ b/docs/phpdoc/classes/PHPCSUtils-AbstractSniffs-AbstractArrayDeclarationSniff.html
@@ -2,71 +2,119 @@
- PHPCSUtils
+ PHPCSUtils
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
- PHPCSUtils
-
-
-
-
-
-