{"id":13828128,"url":"https://github.com/ekino/phpstan-banned-code","last_synced_at":"2025-05-16T10:07:38.890Z","repository":{"id":41186732,"uuid":"163860487","full_name":"ekino/phpstan-banned-code","owner":"ekino","description":"Detect banned code through PHPStan","archived":false,"fork":false,"pushed_at":"2024-12-04T10:53:30.000Z","size":112,"stargazers_count":263,"open_issues_count":8,"forks_count":20,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-05-11T00:41:51.243Z","etag":null,"topics":["php","phpstan-extension","quality"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"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/ekino.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-01-02T15:50:21.000Z","updated_at":"2025-05-06T06:29:28.000Z","dependencies_parsed_at":"2023-12-04T06:34:12.862Z","dependency_job_id":"50278993-17dd-44e8-818b-bf060a2a6d01","html_url":"https://github.com/ekino/phpstan-banned-code","commit_stats":{"total_commits":52,"total_committers":22,"mean_commits":"2.3636363636363638","dds":0.6730769230769231,"last_synced_commit":"65a575214a2f3a7991b6e6bbf7af0064217f089b"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekino%2Fphpstan-banned-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekino%2Fphpstan-banned-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekino%2Fphpstan-banned-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekino%2Fphpstan-banned-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ekino","download_url":"https://codeload.github.com/ekino/phpstan-banned-code/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253672761,"owners_count":21945484,"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":["php","phpstan-extension","quality"],"created_at":"2024-08-04T09:02:33.381Z","updated_at":"2025-05-16T10:07:33.882Z","avatar_url":"https://github.com/ekino.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# PHPStan Banned Code\n\n[![Latest Stable Version](https://poser.pugx.org/ekino/phpstan-banned-code/v/stable)](https://packagist.org/packages/ekino/phpstan-banned-code)\n[![Build Status](https://travis-ci.org/ekino/phpstan-banned-code.svg?branch=master)](https://travis-ci.org/ekino/phpstan-banned-code)\n[![Coverage Status](https://coveralls.io/repos/ekino/phpstan-banned-code/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/ekino/phpstan-banned-code?branch=master)\n[![Total Downloads](https://poser.pugx.org/ekino/phpstan-banned-code/downloads)](https://packagist.org/packages/ekino/phpstan-banned-code)\n\nThis library is based on [PHPStan](https://phpstan.org/) to detect calls to specific functions you don't want in your project.\nFor instance, you can add it in your CI process to make sure there is no debug/non standard code (like [var_dump](https://www.php.net/manual/en/function.var-dump.php), [exit](https://www.php.net/manual/en/function.exit.php), ...).\n\n## Basic usage\n\nTo use this extension, require it using [Composer](https://getcomposer.org/):\n\n```bash\ncomposer require --dev ekino/phpstan-banned-code\n```\n\nWhen you use https://github.com/phpstan/extension-installer you are done.\n\nIf not, include `extension.neon` in your project's PHPStan config:\n\n```\nincludes:\n\t- vendor/ekino/phpstan-banned-code/extension.neon\n```\n\n## Advanced usage\n\nYou can configure this library with parameters:\n\n```\nparameters:\n\tbanned_code:\n\t\tnodes:\n\t\t\t# enable detection of echo\n\t\t\t-\n\t\t\t\ttype: Stmt_Echo\n\t\t\t\tfunctions: null\n\n\t\t\t# enable detection of eval\n\t\t\t-\n\t\t\t\ttype: Expr_Eval\n\t\t\t\tfunctions: null\n\n\t\t\t# enable detection of die/exit\n\t\t\t-\n\t\t\t\ttype: Expr_Exit\n\t\t\t\tfunctions: null\n\n\t\t\t# enable detection of a set of functions\n\t\t\t-\n\t\t\t\ttype: Expr_FuncCall\n\t\t\t\tfunctions:\n\t\t\t\t\t- dd\n\t\t\t\t\t- debug_backtrace\n\t\t\t\t\t- dump\n\t\t\t\t\t- exec\n\t\t\t\t\t- passthru\n\t\t\t\t\t- phpinfo\n\t\t\t\t\t- print_r\n\t\t\t\t\t- proc_open\n\t\t\t\t\t- shell_exec\n\t\t\t\t\t- system\n\t\t\t\t\t- var_dump\n\n\t\t\t# enable detection of print statements\n\t\t\t-\n\t\t\t\ttype: Expr_Print\n\t\t\t\tfunctions: null\n\n\t\t\t# enable detection of shell execution by backticks\n\t\t\t-\n\t\t\t\ttype: Expr_ShellExec\n\t\t\t\tfunctions: null\n\n\t\t# enable detection of `use Tests\\Foo\\Bar` in a non-test file\n\t\tuse_from_tests: true\n\n\t\t# errors emitted by the extension are non-ignorable by default, so they cannot accidentally be put into the baseline.\n\t\tnon_ignorable: false # default is true\n```\n\n`type` is the returned value of a node, see the method `getType()`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekino%2Fphpstan-banned-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fekino%2Fphpstan-banned-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekino%2Fphpstan-banned-code/lists"}