{"id":13828207,"url":"https://github.com/phpstan/phpstan-deprecation-rules","last_synced_at":"2025-05-14T04:07:58.975Z","repository":{"id":32649462,"uuid":"138476287","full_name":"phpstan/phpstan-deprecation-rules","owner":"phpstan","description":"PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.","archived":false,"fork":false,"pushed_at":"2025-04-27T12:38:04.000Z","size":247,"stargazers_count":405,"open_issues_count":17,"forks_count":20,"subscribers_count":5,"default_branch":"2.0.x","last_synced_at":"2025-05-07T00:26:25.727Z","etag":null,"topics":["deprecations","php","php7","phpstan","static-analysis","static-code-analysis"],"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/phpstan.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-06-24T11:28:18.000Z","updated_at":"2025-05-06T14:00:37.000Z","dependencies_parsed_at":"2023-12-27T08:38:51.724Z","dependency_job_id":"e5f8ad60-d4a6-46f5-a594-3b6b84a5b4be","html_url":"https://github.com/phpstan/phpstan-deprecation-rules","commit_stats":{"total_commits":145,"total_committers":21,"mean_commits":6.904761904761905,"dds":0.5172413793103448,"last_synced_commit":"81833b5787e2e8f451b31218875e29e4ed600ab2"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpstan%2Fphpstan-deprecation-rules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpstan%2Fphpstan-deprecation-rules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpstan%2Fphpstan-deprecation-rules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpstan%2Fphpstan-deprecation-rules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpstan","download_url":"https://codeload.github.com/phpstan/phpstan-deprecation-rules/tar.gz/refs/heads/2.0.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254069515,"owners_count":22009558,"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":["deprecations","php","php7","phpstan","static-analysis","static-code-analysis"],"created_at":"2024-08-04T09:02:36.625Z","updated_at":"2025-05-14T04:07:58.927Z","avatar_url":"https://github.com/phpstan.png","language":"PHP","readme":"# Rules for detecting usage of deprecated classes, methods, properties, constants and traits.\n\n[![Build](https://github.com/phpstan/phpstan-deprecation-rules/workflows/Build/badge.svg)](https://github.com/phpstan/phpstan-deprecation-rules/actions)\n[![Latest Stable Version](https://poser.pugx.org/phpstan/phpstan-deprecation-rules/v/stable)](https://packagist.org/packages/phpstan/phpstan-deprecation-rules)\n[![License](https://poser.pugx.org/phpstan/phpstan-deprecation-rules/license)](https://packagist.org/packages/phpstan/phpstan-deprecation-rules)\n\n* [PHPStan](https://phpstan.org/)\n\n## Installation\n\nTo use this extension, require it in [Composer](https://getcomposer.org/):\n\n```\ncomposer require --dev phpstan/phpstan-deprecation-rules\n```\n\nIf you also install [phpstan/extension-installer](https://github.com/phpstan/extension-installer) then you're all set!\n\n\u003cdetails\u003e\n  \u003csummary\u003eManual installation\u003c/summary\u003e\n\nIf you don't want to use `phpstan/extension-installer`, include rules.neon in your project's PHPStan config:\n\n```\nincludes:\n    - vendor/phpstan/phpstan-deprecation-rules/rules.neon\n```\n\u003c/details\u003e\n\n## Deprecating code you don't own\n\nThis extension emits deprecation warnings on code, which uses properties/functions/methods/classes which are annotated as `@deprecated`.\n\nIn case you don't own the code which you want to be considered deprecated, use [PHPStan Stub Files](https://phpstan.org/user-guide/stub-files) to declare deprecations for vendor files like:\n```\n/** @deprecated */\nclass ThirdPartyClass {}\n```\n\n## Custom deprecation markers\n\nYou can implement extensions to support even e.g. custom `#[MyDeprecated]` attribute.  [Learn more](https://phpstan.org/developing-extensions/custom-deprecations).\n\n\n## Custom deprecated scopes\n\nUsage of deprecated code is not reported in code that is also deprecated:\n\n```php\n/** @deprecated */\nfunction doFoo(): void\n{\n    // not reported:\n    anotherDeprecatedFunction();\n}\n```\n\nIf you have [a different way](https://github.com/phpstan/phpstan-deprecation-rules/issues/64) of marking code that calls deprecated symbols on purpose and you don't want these calls to be reported either, you can write an extension by implementing the [`DeprecatedScopeResolver`](https://github.com/phpstan/phpstan-deprecation-rules/blob/1.1.x/src/Rules/Deprecations/DeprecatedScopeResolver.php) interface.\n\nFor example if you mark your PHPUnit tests that test deprecated code with `@group legacy`, you can implement the extension this way:\n\n```php\nclass GroupLegacyScopeResolver implements DeprecatedScopeResolver\n{\n\n\tpublic function isScopeDeprecated(Scope $scope): bool\n\t{\n\t\t$function = $scope-\u003egetFunction();\n\t\treturn $function !== null\n\t\t\t\u0026\u0026 $function-\u003egetDocComment() !== null\n\t\t\t\u0026\u0026 strpos($function-\u003egetDocComment(), '@group legacy') !== false;\n\t}\n\n}\n```\n\nAnd register it in your [configuration file](https://phpstan.org/config-reference):\n\n```neon\nservices:\n\t-\n\t\tclass: GroupLegacyScopeResolver\n\t\ttags:\n\t\t\t- phpstan.deprecations.deprecatedScopeResolver\n```\n\n[Learn more about Scope](https://phpstan.org/developing-extensions/scope), a core concept for implementing custom PHPStan extensions.\n","funding_links":[],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpstan%2Fphpstan-deprecation-rules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpstan%2Fphpstan-deprecation-rules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpstan%2Fphpstan-deprecation-rules/lists"}