PHPackages                             staabm/rector-view-scope - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. staabm/rector-view-scope

ActiveLibrary

staabm/rector-view-scope
========================

1.1.0(4y ago)21.2k1[4 issues](https://github.com/staabm/rector-view-scope/issues)[4 PRs](https://github.com/staabm/rector-view-scope/pulls)MITPHPPHP ^7.4 || ^8.0

Since May 30Pushed 2y ago1 watchersCompare

[ Source](https://github.com/staabm/rector-view-scope)[ Packagist](https://packagist.org/packages/staabm/rector-view-scope)[ GitHub Sponsors](https://github.com/staabm)[ RSS](/packages/staabm-rector-view-scope/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (9)Used By (0)

Problemspace
============

[](#problemspace)

`ViewScopeRector` is your helper to make static analysis tools aware of variable-types within view-scripts infered from a external context.

Summary
-------

[](#summary)

This 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.

A 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 &lt;–&gt; controller type inference.

example big picture
-------------------

[](#example-big-picture)

this rector is meant to introduce `@var` phpdocs into analyzed view files, e.g. based on declared public properties of a corresponding controller.

example Controller:

```
class Controller {
   /**
    * @var string
    */
   public $hello;
}
```

example view:

```
echo $hello;
```

the 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.

so in the end the rector will change the example view to

```
/**
 * @var string
 */
echo $hello;
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 81.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~54 days

Total

4

Last Release

1641d ago

PHP version history (2 changes)1.0PHP &gt;=7.4

1.1.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/99d4e5e5fa8fb7d0782de39b43c558953d0a5881a7ba596b90ed9c312db8c4d9?d=identicon)[staabm](/maintainers/staabm)

---

Top Contributors

[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (43 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![clxmstaab](https://avatars.githubusercontent.com/u/47448731?v=4)](https://github.com/clxmstaab "clxmstaab (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/staabm-rector-view-scope/health.svg)

```
[![Health](https://phpackages.com/badges/staabm-rector-view-scope/health.svg)](https://phpackages.com/packages/staabm-rector-view-scope)
```

###  Alternatives

[driftingly/rector-laravel

Rector upgrades rules for Laravel Framework

1.2k12.0M460](/packages/driftingly-rector-laravel)[magento/magento-coding-standard

A set of Magento specific PHP CodeSniffer rules.

37113.4M298](/packages/magento-magento-coding-standard)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)[filament/upgrade

Upgrade Filament v4 code to Filament v5.

101.3M94](/packages/filament-upgrade)[mrpunyapal/rector-pest

Rector upgrade rules for Pest - refactoring and best practices for Pest testing framework

4717.6k17](/packages/mrpunyapal-rector-pest)[savinmikhail/add_named_arguments_rector

Rector rule to add names to arguments for functions'/methods' calls

1969.5k3](/packages/savinmikhail-add-named-arguments-rector)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
