{"id":19095115,"url":"https://github.com/shopsys/coding-standards","last_synced_at":"2025-04-09T06:12:45.585Z","repository":{"id":45642969,"uuid":"55764487","full_name":"shopsys/coding-standards","owner":"shopsys","description":"[READ-ONLY] Tools for automated checks of coding standards in PHP projects. Predefined rulesets included.","archived":false,"fork":false,"pushed_at":"2025-03-13T10:02:44.000Z","size":481,"stargazers_count":20,"open_issues_count":0,"forks_count":7,"subscribers_count":10,"default_branch":"17.0","last_synced_at":"2025-04-02T02:40:20.670Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shopsys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-08T08:48:24.000Z","updated_at":"2025-03-13T10:02:48.000Z","dependencies_parsed_at":"2024-02-19T19:52:39.896Z","dependency_job_id":"69455ab7-951e-4871-88bd-c0a3c75fac37","html_url":"https://github.com/shopsys/coding-standards","commit_stats":null,"previous_names":[],"tags_count":68,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shopsys%2Fcoding-standards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shopsys%2Fcoding-standards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shopsys%2Fcoding-standards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shopsys%2Fcoding-standards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shopsys","download_url":"https://codeload.github.com/shopsys/coding-standards/tar.gz/refs/heads/17.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987285,"owners_count":21028895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T03:32:49.882Z","updated_at":"2025-04-09T06:12:45.569Z","avatar_url":"https://github.com/shopsys.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shopsys Coding Standards\n\n[![Downloads](https://img.shields.io/packagist/dt/shopsys/coding-standards.svg)](https://packagist.org/packages/shopsys/coding-standards)\n\nShopsys Coding Standards are based on [PSR-2](http://www.php-fig.org/psr/psr-2/).\n\nThis project bundles tools along with predefined rulesets for automated checks of Shopsys Coding Standards that we use in many Shopsys projects.\nThe repository also contains [few custom rules](#custom-rules).\n\nThis repository is maintained by [shopsys/shopsys] monorepo, information about changes is in [monorepo CHANGELOG.md](https://github.com/shopsys/shopsys/blob/master/CHANGELOG.md).\n\nProvided tools:\n\n- [PHP-Parallel-Lint](https://github.com/JakubOnderka/PHP-Parallel-Lint)\n- [EasyCodingStandard](https://github.com/Symplify/EasyCodingStandard) that combines [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) and [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)\n\nFor further information see official documentation of those tools.\n\n## Installation\n\n```bash\nphp composer require shopsys/coding-standards\n```\n\n## Usage\n\nCreate `easy-coding-standard.yml` config file in your project which includes predefined ruleset.\nYou can also [customize the rules](https://github.com/shopsys/shopsys/blob/master/UPGRADE.md#shopsyscoding-standards)\nand even add your own sniffs and fixers in the config.\n\n```yaml\n#easy-coding-standard.yml\nimports:\n    - { resource: '%vendor_dir%/shopsys/coding-standards/easy-coding-standard.yml' }\n```\n\nIn terminal, run following commands:\n\n```bash\nphp vendor/bin/parallel-lint /path/to/project\nphp vendor/bin/ecs check /path/to/project --config=/path/to/project/custom-coding-standard.yml\n```\n\n## Custom rules\n\n### Rules for [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer)\n\n#### `Shopsys/missing_button_type`\n\nAll `\u003cbutton\u003e` HTML tags in `.html` and `.html.twig` files must have explicit `type` attribute.\n\nIf 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 (`\u003cbutton\u003e` inside `\u003cform\u003e` element submits the form).\n\n#### `Shopsys/orm_join_column_require_nullable`\n\nDoctrine annotations `@ORM\\ManyToOne` and `@ORM\\OneToOne` must have `nullable` option defined explicitly in `@ORM\\JoinColumn`.\n\nIf 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.\nThis makes it consistent.\n\n### Rules for [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)\n\n#### `ForbiddenExitSniff`\n\nFunction `exit()` is not allowed.\n\n#### `ForbiddenSuperGlobalSniff`\n\nUsage of superglobals (`$_COOKIE`, `$_GET`, `$_FILES`, `$_POST`, `$_REQUEST`, `$_SERVER`) is not allowed.\n\n#### `ObjectIsCreatedByFactorySniff`\n\nInstantiation of objects that can be created by their factories is not allowed outside of the factory.\n\n#### `ValidVariableNameSniff`\n\nDefault `\\PHP_CodeSniffer\\Standards\\Squiz\\Sniffs\\NamingConventions\\ValidVariableNameSniff`\ndoes not report method parameters in `$_var` format as an violation but it should.\nIt also skips checking of private members when `PrivateNoUnderscore` property is disabled.\n\nThis sniff provides the missing functionality and is intended to be used as an addition to the default `ValidVariableNameSniff`.\n\n## Contributing\n\nThank you for your contributions to Shopsys Coding Standards package.\nTogether we are making Shopsys Platform better.\n\nThis repository is READ-ONLY.\nIf you want to [report issues](https://github.com/shopsys/shopsys/issues/new) and/or send [pull requests](https://github.com/shopsys/shopsys/compare),\nplease use the main [Shopsys repository](https://github.com/shopsys/shopsys).\n\nPlease, check our [Contribution Guide](https://github.com/shopsys/shopsys/blob/master/CONTRIBUTING.md) before contributing.\n\n## Support\n\nWhat to do when you are in troubles or need some help?\nThe best way is to join our [Slack](https://join.slack.com/t/shopsysframework/shared_invite/zt-11wx9au4g-e5pXei73UJydHRQ7nVApAQ).\n\nIf you want to [report issues](https://github.com/shopsys/shopsys/issues/new), please use the main [Shopsys repository](https://github.com/shopsys/shopsys).\n\n[shopsys/shopsys]: (https://github.com/shopsys/shopsys)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshopsys%2Fcoding-standards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshopsys%2Fcoding-standards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshopsys%2Fcoding-standards/lists"}