Download the PHP package asispts/ptscs without Composer
On this page you can find all versions of the php package asispts/ptscs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download asispts/ptscs
More information about asispts/ptscs
Files in asispts/ptscs
Package ptscs
Short Description PSR-12 coding standard with additional strict rules
License MIT
Homepage https://github.com/asispts/ptscs
Informations about the package ptscs
ptscs
» PSR-12 coding standard with additional strict rules «
[![Build](https://github.com/asispts/ptscs/actions/workflows/ci.yml/badge.svg)](https://github.com/asispts/ptscs/actions/workflows/ci.yml) [![](https://img.shields.io/github/license/asispts/ptscs)](./LICENSE) [![](https://img.shields.io/packagist/php-v/asispts/ptscs/dev-main)](https://github.com/asispts/ptscs) [![](https://img.shields.io/packagist/dt/asispts/ptscs)](https://packagist.org/packages/asispts/ptscs) [Installation](#installation) ✦ [Usage](#usage) ✦ [Notable coding standard](#notable-coding-standard) ✦ [Contributing](#contributing) ✦ [License](#license)ptscs
is a coding standard for PHP_CodeSniffer that follows the PSR-12 with additional strict rules. It is intended to help developers maintain consistency and readability in their codebase, and to encourage best practices.
Installation
You can install with composer
Usage
Once installed, you can create a phpcs.xml.dist
file to define your PHPCS configuration and then configure your text editor or workflow to lint or fix the codebase based on this configuration. Here is an example phpcs.xml.dist file:
You can use phpcs
to validate your source code against this standard or phpcbf
to automatically fix any violations.
To run phpcs
, execute the following command:
To automatically fix any coding standard violations, execute the following command:
Excluding Some Rules
You can exclude some rules by modifying the phpcs.xml.dist
file. For example, if you want to exclude the rule that requires classes to be declared as either final
or abstract
in the src/Entity
directory of a Symfony project, you can add the following to your phpcs.xml.dist
file:
This will exclude the RequireAbstractOrFinal
rule for the src/Entity
directory. You can customize the rule and the directory as per your needs. By excluding some rules, you can customize the coding standard to better suit your project's requirements.
Notable coding standard
As mentioned, this coding standard use PSR-12 with some exceptions and additional strict rules. Here are some notable additional strict rules.
-
We exclude some PSR-12 rules to allow
declare(strict_types=1)
on the same line as PHP open tag. declare(strict_types=1)
is required in all PHP files.-
snake_case
is allowed in test method names -
All classes should be declared as either
final
orabstract
- Filenames must match the class names.
The complete set of rules can be seen in RULES.md file. These rules are intended to promote cleaner, more readable, and more maintainable code.
Contributing
We welcome contributions from the community in all forms. You can report issues, suggest improvements or submit pull requests.
For major changes, it is highly recommended to open an issue first to discuss the proposed changes with the project maintainers.
License
Released under MIT License.
All versions of ptscs with dependencies
dealerdirect/phpcodesniffer-composer-installer Version ^1.0
slevomat/coding-standard Version ^8.14
squizlabs/php_codesniffer Version ^3.7