Download the PHP package swivl/php-coding-standard without Composer
On this page you can find all versions of the php package swivl/php-coding-standard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download swivl/php-coding-standard
More information about swivl/php-coding-standard
Files in swivl/php-coding-standard
Package php-coding-standard
Short Description Swivl Coding Standard for PHP_CodeSniffer
License MIT
Homepage https://github.com/Swivl/php-coding-standard
Informations about the package php-coding-standard
Swivl Coding Standard for PHP_CodeSniffer
This coding standard is much more strict version of PSR-12.
Installation
Install coding standard using composer:
Configuration
Create file phpcs.xml.dist
in the root of your project with the content similar to:
Configure your IDE to use phpcs.xml.dist
as the default ruleset for PHP_CodeSniffer.
Checking code style in your project
Check the whole project:
Check a single file or directory:
Automatically fix errors:
Advanced configuration
Swivl.Commenting.DoctrineEntity
This sniff provides the following options:
concreteTypeToBaseTypeMap
- when column is mapped to concrete type FeedItemComment, but modification methods are type hinted with base class CommentInterfaceuseDynamicalCalculationForEnumColumnType
- when enum is mapped to some PHP type. For example,type="auth_enum_type"
is mapped to PHP AuthType.
Swivl.Commenting.FunctionComment
This sniff provides the option:
requiredPhpdoc
- configures when PHPDoc is required for a method. Possible values:always
- PHPDoc is required for all methods.map
- PHPDoc is required for a method if at least 1 type hint or return type is in the list which is defined in the sniff in FunctionCommentSniff::REQUIRED_PHPDOC_MAP. It is the default behavior.never
- PHPDoc isn't required for all methods.
Swivl.Functions.ConstructorPropertyPromotion
This sniff provides the following options:
Swivl.Commenting.UselessFunctionComment
This sniff provides the following options:
Swivl.Commenting.UselessClassComment
This sniff provides the following options:
Dependencies update
Some sniffs from Swivl Coding Standard override sniffs from libraries which are in dependencies list. The following sniffs should be synchronized with the original code during dependencies update:
- Swivl\Sniffs\Commenting\FunctionCommentSniff
- Swivl\Sniffs\Functions\MultiLineFunctionDeclarationSniff
- Swivl\Sniffs\Namespaces\NamespaceDeclarationSniff