{"id":15525089,"url":"https://github.com/staabm/rector-view-scope","last_synced_at":"2025-04-23T08:42:48.301Z","repository":{"id":39641319,"uuid":"356653779","full_name":"staabm/rector-view-scope","owner":"staabm","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-11T02:45:29.000Z","size":77,"stargazers_count":2,"open_issues_count":8,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T23:11:19.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/staabm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["staabm"]}},"created_at":"2021-04-10T17:41:54.000Z","updated_at":"2022-01-14T16:26:47.000Z","dependencies_parsed_at":"2025-03-05T10:34:15.888Z","dependency_job_id":"60ce0cf4-a78f-4c40-9248-c1ebe5a1429d","html_url":"https://github.com/staabm/rector-view-scope","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staabm%2Frector-view-scope","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staabm%2Frector-view-scope/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staabm%2Frector-view-scope/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/staabm%2Frector-view-scope/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/staabm","download_url":"https://codeload.github.com/staabm/rector-view-scope/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250400866,"owners_count":21424465,"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-10-02T10:54:36.120Z","updated_at":"2025-04-23T08:42:48.281Z","avatar_url":"https://github.com/staabm.png","language":"PHP","funding_links":["https://github.com/sponsors/staabm"],"categories":[],"sub_categories":[],"readme":"# Problemspace\n\n`ViewScopeRector` is your helper to make static analysis tools aware of variable-types within view-scripts infered from a external context. \n\n## Summary\n\nThis rector includes the mechanics of scanning procedural php files (e.g. views) and calling a given [ContextInferer](https://github.com/staabm/rector-view-scope/blob/main/lib/ContextInferer.php). It afterwards updates the view-files global `@var` phpdocs to reflect the types, the ContextInferer determinded beforehand.\n\nA example implementation is shipped with [ViewContextInferer](https://github.com/staabm/rector-view-scope/blob/main/lib/inferer/rocket/ViewContextInferer.php), which implements Ruby'on Rails like view \u003c–\u003e controller type inference.\n\n## example big picture\n\nthis rector is meant to introduce `@var` phpdocs into analyzed view files, e.g. based on declared public properties of a corresponding controller.\n\nexample Controller:\n```php\nclass Controller {\n   /**\n    * @var string\n    */\n   public $hello;\n}\n```\n\nexample view:\n```php\necho $hello;\n```\n\nthe rector should lookup the controller-class via static reflection, [infer the type of its properties](https://github.com/staabm/rector-view-scope/blob/main/lib/ContextInferer.php) and with this knowledge adjust/create a `@var` phpdoc in the view file.\n\nso in the end the rector will change the example view to\n```php\n/**\n * @var string\n */\necho $hello;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstaabm%2Frector-view-scope","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstaabm%2Frector-view-scope","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstaabm%2Frector-view-scope/lists"}