Download the PHP package shopsys/coding-standards without Composer
On this page you can find all versions of the php package shopsys/coding-standards. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shopsys/coding-standards
More information about shopsys/coding-standards
Files in shopsys/coding-standards
Package coding-standards
Short Description Coding standards definition compatible with PSR-2
License MIT
Informations about the package coding-standards
Shopsys Coding Standards
Shopsys Coding Standards are based on PSR-2.
This project bundles tools along with predefined rulesets for automated checks of Shopsys Coding Standards that we use in many Shopsys projects. The repository also contains few custom rules.
This repository is maintained by monorepo CHANGELOG.md.
Provided tools:
- PHP-Parallel-Lint
- EasyCodingStandard that combines PHP-CS-Fixer and PHP_CodeSniffer
For further information see official documentation of those tools.
Installation
Usage
Create easy-coding-standard.yml
config file in your project which includes predefined ruleset.
You can also customize the rules
and even add your own sniffs and fixers in the config.
In terminal, run following commands:
Custom rules
Rules for PHP-CS-Fixer
Shopsys/missing_button_type
All <button>
HTML tags in .html
and .html.twig
files must have explicit type
attribute.
If the type
is not specified it will be fixed to type="button""
because the implicit value is submit
which makes it behave differently based on the context (<button>
inside <form>
element submits the form).
Shopsys/orm_join_column_require_nullable
Doctrine annotations @ORM\ManyToOne
and @ORM\OneToOne
must have nullable
option defined explicitly in @ORM\JoinColumn
.
If the nullable
option is not specified it will be fixed to nullable=false
because the implicit value is true
but this is the opposite to the implicit value of nullable
for @Column
annotation.
This makes it consistent.
Rules for PHP_CodeSniffer
ForbiddenExitSniff
Function exit()
is not allowed.
ForbiddenSuperGlobalSniff
Usage of superglobals ($_COOKIE
, $_GET
, $_FILES
, $_POST
, $_REQUEST
, $_SERVER
) is not allowed.
ObjectIsCreatedByFactorySniff
Instantiation of objects that can be created by their factories is not allowed outside of the factory.
ValidVariableNameSniff
Default \PHP_CodeSniffer\Standards\Squiz\Sniffs\NamingConventions\ValidVariableNameSniff
does not report method parameters in $_var
format as an violation but it should.
It also skips checking of private members when PrivateNoUnderscore
property is disabled.
This sniff provides the missing functionality and is intended to be used as an addition to the default ValidVariableNameSniff
.
Contributing
Thank you for your contributions to Shopsys Coding Standards package. Together we are making Shopsys Platform better.
This repository is READ-ONLY. If you want to report issues and/or send pull requests, please use the main Shopsys repository.
Please, check our Contribution Guide before contributing.
Support
What to do when you are in troubles or need some help? The best way is to join our Slack.
If you want to report issues, please use the main Shopsys repository.
All versions of coding-standards with dependencies
ext-tokenizer Version *
friendsofphp/php-cs-fixer Version ^3.58.1
nette/utils Version ^3.1.3
php-parallel-lint/php-parallel-lint Version ^1.3.1
phpstan/phpstan Version ^1.11.7
slevomat/coding-standard Version ^8.13.1
squizlabs/php_codesniffer Version ^3.6.2
symfony/finder Version ^5.4
symplify/easy-coding-standard Version ^12.2.0