{"id":13828331,"url":"https://github.com/unleashedtech/php-coding-standard","last_synced_at":"2025-07-09T06:31:38.908Z","repository":{"id":44390572,"uuid":"174363551","full_name":"unleashedtech/php-coding-standard","owner":"unleashedtech","description":"Opinionated, strict PHP CodeSniffer ruleset used by Unleashed Technologies","archived":false,"fork":false,"pushed_at":"2024-01-26T15:30:57.000Z","size":219,"stargazers_count":9,"open_issues_count":6,"forks_count":4,"subscribers_count":10,"default_branch":"4.0.x","last_synced_at":"2024-10-29T01:19:14.029Z","etag":null,"topics":["hacktoberfest","php","phpcs","phpcs-standard"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unleashedtech.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":"2019-03-07T14:46:25.000Z","updated_at":"2023-01-30T21:28:02.000Z","dependencies_parsed_at":"2024-01-18T05:22:52.940Z","dependency_job_id":"3c5df127-b9b3-4e8e-8ad1-280dd6c2cd15","html_url":"https://github.com/unleashedtech/php-coding-standard","commit_stats":{"total_commits":95,"total_committers":3,"mean_commits":"31.666666666666668","dds":"0.26315789473684215","last_synced_commit":"d5edcddde3bf7e9ddc55d82a59fce1ff9915d77c"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unleashedtech%2Fphp-coding-standard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unleashedtech%2Fphp-coding-standard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unleashedtech%2Fphp-coding-standard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unleashedtech%2Fphp-coding-standard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unleashedtech","download_url":"https://codeload.github.com/unleashedtech/php-coding-standard/tar.gz/refs/heads/4.0.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225492420,"owners_count":17482869,"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":["hacktoberfest","php","phpcs","phpcs-standard"],"created_at":"2024-08-04T09:02:41.742Z","updated_at":"2024-11-20T08:30:25.714Z","avatar_url":"https://github.com/unleashedtech.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Unleashed Technologies PHP_CodeSniffer Coding Standard\n\n[![Latest Version](https://img.shields.io/packagist/v/unleashedtech/php-coding-standard.svg?style=flat-square)](https://packagist.org/packages/unleashedtech/php-coding-standard)\n[![Total Downloads](https://img.shields.io/packagist/dt/unleashedtech/php-coding-standard.svg?style=flat-square)](https://packagist.org/packages/unleashedtech/php-coding-standard)\n[![Build Status](https://img.shields.io/travis/unleashedtech/php-coding-standard/master.svg?style=flat-square)](https://travis-ci.org/unleashedtech/php-coding-standard)\n[![Software License](https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square)](LICENSE)\n\nA PHP coding standard for Unleashed Technologies, originally based on [doctrine/coding-standard](https://github.com/doctrine/coding-standard).\n\n## Overview\n\nThis coding standard is based on [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) and [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md),\nwith some noticeable exceptions/differences/extensions based on best-practices adopted by Symfony, Doctrine, and the wider community:\n\n- Keep the nesting of control structures per method as small as possible\n- Add spaces around a concatenation operator ``$foo = 'Hello ' . 'World!';``\n- Add spaces between assignment, control and return statements\n- Add spaces after the colon in return type declaration ``function (): void {}``\n- Add spaces after a type cast ``$foo = (int) '12345';``\n- Use single-quotes for enclosing strings\n- Always use strict comparisons\n- Always add ``declare(strict_types=1)`` at the beginning of a file\n- Always add native types where possible\n- Omit phpDoc for parameters/returns with native types, unless adding description\n- Don't use ``@author``, ``@since`` and similar annotations that duplicate Git information\n- Use parentheses when creating new instances that do not require arguments ``$foo = new Foo()``\n- Use Null Coalesce Operator ``$foo = $bar ?? $baz``\n- Use Null Safe Object Operator ``$foo = $object?-\u003eproperty``\n- Prefer early exit over nesting conditions or using else\n- Always use fully-qualified global functions (without needing `use function` statements)\n- Forbids the use of `\\DateTime`\n\nFor full reference of enforcements, go through ``src/Unleashed/ruleset.xml`` where each sniff is briefly described.\n\n## Installation\n\nYou can install the Unleashed Coding Standard as a [Composer](https://getcomposer.org/) dependency in your project:\n\n```sh\ncomposer require --dev unleashedtech/php-coding-standard\n```\n\nThen you can use it like this:\n\n```sh\nvendor/bin/phpcs --standard=Unleashed /path/to/some/files.php\n```\n\nYou can also use `phpcbp` to automatically find and fix any violations:\n\n```sh\nvendor/bin/phpcbf --standard=Unleashed /path/to/some/files.php\n```\n\n### Project-Level Ruleset\n\nTo enable the Unleashed Coding Standard for your project, create a `phpcs.xml.dist` file with the following content:\n\n```xml\n\u003c?xml version=\"1.0\"?\u003e\n\u003cruleset\u003e\n    \u003carg name=\"basepath\" value=\".\"/\u003e\n    \u003carg name=\"extensions\" value=\"php\"/\u003e\n    \u003carg name=\"parallel\" value=\"80\"/\u003e\n    \u003carg name=\"cache\" value=\".phpcs-cache\"/\u003e\n    \u003carg name=\"colors\"/\u003e\n\n    \u003c!-- Ignore warnings, show progress of the run and show sniff names --\u003e\n    \u003carg value=\"nps\"/\u003e\n\n    \u003c!-- Directories to be checked --\u003e\n    \u003cfile\u003esrc\u003c/file\u003e\n    \u003cfile\u003etests\u003c/file\u003e\n\n    \u003c!-- Include full Unleashed Coding Standard --\u003e\n    \u003crule ref=\"Unleashed\"/\u003e\n\u003c/ruleset\u003e\n```\n\n\nThis will enable the full Unleashed Coding Standard with all rules included with their defaults.\nFrom now on you can just run `vendor/bin/phpcs` and `vendor/bin/phpcbf` without any arguments.\n\nDon't forget to add `.phpcs-cache` and `phpcs.xml` (without `.dist` suffix) to your `.gitignore`.\nThe first ignored file is a cache used by PHP CodeSniffer to speed things up,\nthe second one allows any developer to adjust configuration locally without touching the versioned file.\n\nFor further reading about the CodeSniffer configuration, please refer to\n[the configuration format overview](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset)\nand [the list of configuration options](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funleashedtech%2Fphp-coding-standard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funleashedtech%2Fphp-coding-standard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funleashedtech%2Fphp-coding-standard/lists"}