PHPackages                             aicrion/container-phpstan - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. aicrion/container-phpstan

ActivePhpstan-extension[PSR &amp; Standards](/categories/psr-standards)

aicrion/container-phpstan
=========================

PHPStan extension providing accurate type inference for Aicrion\\Container resolution methods.

v1.0.0(today)10MITPHPPHP &gt;=8.5CI failing

Since Jul 31Pushed todayCompare

[ Source](https://github.com/Aicrion/container-phpstan)[ Packagist](https://packagist.org/packages/aicrion/container-phpstan)[ Docs](https://github.com/aicrion/container-phpstan)[ RSS](/packages/aicrion-container-phpstan/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Aicrion Container - PHPStan Extension
=====================================

[](#aicrion-container---phpstan-extension)

PHPStan extension that teaches static analysis the real return type of `Aicrion\Container\Container::make()` and `::get()` calls, so tools like PHPStan can catch type errors in code that resolves services from the container.

Why this exists
---------------

[](#why-this-exists)

`Container::make()` and `Container::get()` are declared with a `mixed` return type, since the container can resolve *any* registered service id at runtime. Without this extension, PHPStan sees:

```
$logger = $container->make(LoggerInterface::class);
$logger->nonExistentMethod(); // PHPStan: no error, because $logger is `mixed`
```

With this extension installed, PHPStan instead infers the real class:

```
$logger = $container->make(LoggerInterface::class);
// PHPStan now knows $logger is LoggerInterface
$logger->nonExistentMethod(); // PHPStan: Call to undefined method LoggerInterface::nonExistentMethod()
```

Installation
------------

[](#installation)

```
composer require --dev aicrion/container-phpstan
```

If you use [phpstan/extension-installer](https://github.com/phpstan/extension-installer) (recommended), the extension is activated automatically. Otherwise, add it manually to your `phpstan.neon`:

```
includes:
    - vendor/aicrion/container-phpstan/extension.neon
```

Supported patterns
------------------

[](#supported-patterns)

```
// Class constant -- fully supported
$service = $container->make(PaymentService::class);

// String literal -- fully supported
$service = $container->make('App\PaymentService');

// Dynamic string (variable, concatenation, etc.) -- falls back to the
// declared `mixed` return type, since PHPStan cannot know the value
// at analysis time.
$id = $this->resolveServiceId();
$service = $container->make($id);
```

Requirements
------------

[](#requirements)

- PHP 8.5+
- `aicrion/container` ^1.0
- `phpstan/phpstan` ^2.0

License
-------

[](#license)

MIT

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance100

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12207627?v=4)[Hadi Akbarzadeh](/maintainers/nabeghe)[@nabeghe](https://github.com/nabeghe)

---

Top Contributors

[![nabeghe](https://avatars.githubusercontent.com/u/12207627?v=4)](https://github.com/nabeghe "nabeghe (1 commits)")

---

Tags

containerdependency-injectiondiphpphpstanstatic-analysisphpcontainerPHPStanstatic analysisdependency-injection

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aicrion-container-phpstan/health.svg)

```
[![Health](https://phpackages.com/badges/aicrion-container-phpstan/health.svg)](https://phpackages.com/packages/aicrion-container-phpstan)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.5k55.4M9.4k](/packages/larastan-larastan)[calebdw/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

15118.7k4](/packages/calebdw-larastan)

PHPackages © 2026

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