"vendor/bin/phpcs" --config-set installed_paths ../../..
This script is used to configure PHP_CodeSniffer (phpcs). The command sets the installed_paths configuration option for PHP_CodeSniffer, which specifies the location of the coding standard directories. It does not have any known security vulnerabilities nor does it have the potential to cause direct harm. This operation seems to be purely configuration-based.
"vendor/bin/phpcs" --config-set installed_paths ../../..
This script changes the configuration settings for PHP CodeSniffer (phpcs) by setting the installed_paths setting value to ../../.. which refers to the parent directory. This is simply adjusting the tool's configuration and doesn't run or download any remote code, nor does it expose any sensitive information.
phpcompatibility/php-compatibility
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
squizlabs/php_codesniffer | 3.9.2 | - | BSD-3-Clause | prod |
The PHPCompatibility package is a set of sniffing codes designed to work with PHP_CodeSniffer, a popular tool to detect violations of coding standards in PHP. Its main role is to check for PHP cross-version compatibility, allowing you to analyze your web project for compatibility issues with lower and higher versions of PHP. With it, you can locate features that are either deprecated or removed in specific versions of PHP, as well as detect the use of new PHP features that may break compatibility with older servers. Hence, it's a vital tool for maintaining interoperability across varied hosting environments, which is crucial for wide-scale PHP applications or libraries.
To use PHPCompatibility inside your projects, you will need Composer, the standard dependency manager for PHP. You start by adding the package to your composer.json
file, in the require-dev
section:
{
"require-dev": {
"phpcompatibility/php-compatibility": "*"
},
"prefer-stable": true
}
Next, inform PHP CodeSniffer about the location of this package:
{
"scripts": {
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
"post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
}
}
Finally, install PHPCompatibility using Composer:
$ composer update --lock
You can then verify if this PHP standard is correctly registered by typing ./vendor/bin/phpcs -i
in your command-line interface. PHPCompatibility should appear in the list of available standards. Running the compatibility checks can be done by pointing PHP CodeSniffer to PHPCompatibility, like so:
$ ./vendor/bin/phpcs -p . --standard=PHPCompatibility
If you wish to target specific PHP versions or ranges, add the --runtime-set testVersion XX
flag, where XX represents the PHP versions you want to check compatibility with:
$ ./vendor/bin/phpcs -p . --standard=PHPCompatibility --runtime-set testVersion 5.6-
In the last example, the codebase will be analyzed for compatibility issues with PHP 5.6 and above.
Detailed documentation for the PHPCompatibility package can be found in the README.md of its official GitHub repository. This document contains extensive information on how to install and use the package, information about PHP version support, plus tips on reading the generated reports.