Download the PHP package isaac/php-code-sniffer-standard without Composer

On this page you can find all versions of the php package isaac/php-code-sniffer-standard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-code-sniffer-standard

This package is moved to the iO namespace

This repository has been archived and renamed, moved to iO PHP_CodeSniffer Standard. Feature sniffs and changes will be processed in the iO repository.

To replace isaac/php-code-sniffer-standard by iodigital-com/php-code-sniffer-standard, execute the following steps:

  1. Remove isaac/php-code-sniffer-standard from composer.json:

  2. Install iodigital-com/php-code-sniffer-standard:

    Note: if you are not on the latest version, you might want to include a version constraint while requiring the new package.

  3. In your project's phpcs.xml, replace <rule ref="ISAAC"/> by <rule ref="IO"/>.

  4. Replace any references to specific ISAAC sniffs in phpcs.xml and PHP files by references to the IO sniffs. This can be done by searching for the sniff names in the entire project and replace them with the new sniff names:

    Search for Replace by
    ISAAC.Classes.MethodPerClassLimit IO.Classes.MethodPerClassLimit
    ISAAC.Classes.PropertyPerClassLimit IO.Classes.PropertyPerClassLimit
    ISAAC.ControlStructures.DisallowGotoOperator IO.ControlStructures.DisallowGotoOperator
    ISAAC.ControlStructures.DisallowNullCoalesceOperator IO.ControlStructures.DisallowNullCoalesceOperator
    ISAAC.Namespaces.MultipleLinesPerUse IO.Namespaces.MultipleLinesPerUse

Verify that PHP_CodeSniffer still works correctly by executing:

ISAAC PHP_CodeSniffer Standard

Extending the default PHP_CodeSniffer with ISAAC rules

Note: Adding new phpcs-rules to this package must result in a major version update!

Installation

Require the package:

Setup

Create a phpcs.xml-file in the root of your project, and include the default ISAAC ruleset:

Change the name of the ruleset, modify the excluded paths and/or include custom rulesets for your project.

PHPCompatibility

To get the most out of the PHPCompatibility standard, you should specify a testVersion to check against. That will enable the checks for both deprecated/removed PHP features as well as the detection of code using new PHP features. Include the testVersion by adding a config rule in your phpcs.xml. Examples:

Look here for more information: https://github.com/PHPCompatibility/PHPCompatibility#using-a-custom-ruleset

Usage

Since you now have a phpcs.xml file in the root of your project, you can run the default phpcs-command: vendor/bin/phpcs.

Ignoring sniff violations

Sometimes a violation of a sniff cannot be resolved. In this case, the violation should be ignored using the phpcs:ignore and phpcs:disable / phpcs:enable annotations.

In order to do this, please take the following approach:

  1. Ignore only the parts of the file that cause the violation, not the file itself. If it is really the case the file should be ignored, you can use the phpcs:ignoreFile annotation or, better, add an <exclude-pattern> to the ruleset.xml of the project.
  2. Prefer phpcs:ignore over phpcs:disable and phpcs:enable, i.e. use phpcs:ignore when this is possible and when the placement of the phpcs:ignore does not introduce any other sniff violations, use phpcs:disable and phpcs:enable otherwise. Rationale: using phpcs:disable and phpcs:enable might disable more code than initially intended when adding new code or moving existing code, for instance when refactoring code.
  3. Always indicate the exact sniff or sniffs that are going to be ignored, use the complete sniff name, not only the sniff group. So for instance use phpcs:ignore Squiz.WhiteSpace.FunctionSpacing.BeforeFirst, Squiz.WhiteSpace.FunctionSpacing.AfterLast instead of phpcs:ignore Squiz.WhiteSpace.FunctionSpacing or phpcs:ignore without any arguments.
  4. Prefer placing the phpcs:ignore annotation on a separate line before the violation over placing it on the line of the violation itself. Rationale: when ignoring multiple sniffs, the phpcs:ignore annotation can quickly exceed the line length limit; this is not checked when the phpcs:ignore annotation is placed on a separate line before the violation, but it is checked when the phpcs:ignore annotation is placed on the line of the violation itself.
  5. Add an explanation why the sniff is ignored using -- followed by a short explanation.

Example:

Contributing

If you want to to contribute, create a merge request with one sniff per merge request. Please provide an example in the description of what the sniff is about with a good and bad code snippet.


All versions of php-code-sniffer-standard with dependencies

PHP Build Version
Package Version
Requires php Version ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0
dealerdirect/phpcodesniffer-composer-installer Version ^0.7
slevomat/coding-standard Version ^7.0.19 || ^8.0
squizlabs/php_codesniffer Version ^3.6.0
phpcompatibility/php-compatibility Version ^9.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package isaac/php-code-sniffer-standard contains the following files

Loading the files please wait ....