{"id":20528277,"url":"https://github.com/manticoresoftware/php-code-standard","last_synced_at":"2025-08-12T06:14:09.889Z","repository":{"id":65058388,"uuid":"549396948","full_name":"manticoresoftware/php-code-standard","owner":"manticoresoftware","description":"PHP code standard used in some Manticore projects","archived":false,"fork":false,"pushed_at":"2023-03-08T08:09:42.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-07-06T03:49:17.302Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manticoresoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-10-11T05:57:44.000Z","updated_at":"2022-11-22T06:59:37.000Z","dependencies_parsed_at":"2024-11-15T23:24:29.163Z","dependency_job_id":"279a3efc-8918-4c66-9216-8e9eb0f4f23b","html_url":"https://github.com/manticoresoftware/php-code-standard","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/manticoresoftware/php-code-standard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manticoresoftware%2Fphp-code-standard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manticoresoftware%2Fphp-code-standard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manticoresoftware%2Fphp-code-standard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manticoresoftware%2Fphp-code-standard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manticoresoftware","download_url":"https://codeload.github.com/manticoresoftware/php-code-standard/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manticoresoftware%2Fphp-code-standard/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270011192,"owners_count":24511902,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-15T23:24:20.406Z","updated_at":"2025-08-12T06:14:09.869Z","avatar_url":"https://github.com/manticoresoftware.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-code-standard\n\nRules:\n\n* We use tab `\\t` for indentation\n* No closing tag (`?\u003e`) at the end of the file\n* Each file has an empty new line at the end\n* Bracket `{` should follow the same line of definition\n* Bracket `[` should follow the same line of definition\n* Multiline array declaration should contain`,` at the end of the last line\n* Declaration of all functions should follow `underscore_style`\n* Declaration of all method names of classes should follow `camelCaseStyle`\n* **PHPStan** should run with the strictest level possible – `--level=9`\n* No blank lines with spaces\n* No spaces before or after function arguments (after `(` or before `)`)\n* Strict equals only (for example, === or !==)\n* We must use `'` over `\"` all the time when there is no variable inside\n* Always use the `\"` without concatenation operator when we need to interpolate variables\n* Each operator must be surrounded by spaces (for example, `$var = 'val'`)\n* The usage of the `list` function is forbidden; we should use pattern matching instead\n* The usage of `create_function` is prohibited\n* The usage of `print` is prohibited; we should use `echo` instead\n* There is only one single space before and after an operator\n* Line length should not exceed 120 symbols\n* We should not use space after cast, for example, `(int)$var`\n* We should not use space after not, for example, `!$foo`\n* The maximum cyclomatic complexity is 30\n* The maximum cognitive complexity is 14\n* We should use an early return approach to reduce the nesting\n* No magic method of direct calls at all\n* No unused arguments in the function signature\n* No dead code import with a use statement\n* No dead catches in try blocks\n* No unused variables are  allowed\n* No unused methods are allowed\n* You should not use type in variable or any property name that you define\n* `@` is forbidden to use in front of any function calls\n* Use type casting instead of calling functions `strval` or `intval`\n* Prefer the short ternary operator `?:` over the old one\n* There should be no nested ternary operators on a single statement, only one level of nesting is allowed\n* All variables should be named by using `camelCase` startingg with a non-capitalized letter\n* All variables should be named in declarative format and without type prefix/suffix\n* Repeated function calls in a cycle when unnecessary is prohibited\n* Variable that contains flag/boolean should start with `is` or `has` a prefix to be more readable and understandable\n\n## How to install git hooks\n\nYou should download and install [pre-commit](https://pre-commit.com/) first. Once it's done you can go to the project dir where you want to activate git hooks and run the command:\n\n```bash\npre-commit install\n```\n\nPlease, remember that you should do it all the time once something updates in code style and it was deployed to the project.\n\n## How to update the project's code style\n\nThere are two scripts: `bin/install` and `bin/install-all`. The second one uses calls to the first one by following the projects defined in `config/repo.yaml` config with all supported repositories.\n\nYou should simply run one of them after changes are made to the linter and style to update it via creating the GitHub pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanticoresoftware%2Fphp-code-standard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanticoresoftware%2Fphp-code-standard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanticoresoftware%2Fphp-code-standard/lists"}