PHPackages                             symplify/phpstan-extensions - 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. symplify/phpstan-extensions

ActivePhpstan-extension

symplify/phpstan-extensions
===========================

Pre-escaped error messages in 'symplify' error format, container aware test case and other useful extensions for PHPStan

12.0.2(6mo ago)396.1M↓14.9%5[1 PRs](https://github.com/symplify/phpstan-extensions/pulls)20MITPHPPHP ^7.4 || ^8.0CI passing

Since Sep 15Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/symplify/phpstan-extensions)[ Packagist](https://packagist.org/packages/symplify/phpstan-extensions)[ Fund](https://www.paypal.me/rectorphp)[ GitHub Sponsors](https://github.com/tomasvotruba)[ RSS](/packages/symplify-phpstan-extensions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (515)Used By (20)

PHPStan Extensions
==================

[](#phpstan-extensions)

[![Downloads total](https://camo.githubusercontent.com/cc7d822b1dadb799ecc9d1cb27a6e6f7dcdc8d36363dca2c6ff2003995f49bc7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73796d706c6966792f7068707374616e2d657874656e73696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/symplify/phpstan-extensions/stats)

Install
-------

[](#install)

```
composer require symplify/phpstan-extensions --dev
```

**Symplify Error Formatter
------------------------

[](#symplify-error-formatter)** Update your `phpstan.neon` config:

```
parameters:
    errorFormat: symplify
```

- Do you want to **click the error and get right to the line in the file** it's reported at?
- Do you want to **copy-paste regex escaped error to your `ignoreErrors`**?

Works best with [anthraxx/intellij-awesome-console](https://github.com/anthraxx/intellij-awesome-console)

```
vendor/bin/phpstan analyse src
```

↓

```
------------------------------------------------------------------------------------------
src/Command/ReleaseCommand.php:51
------------------------------------------------------------------------------------------
- "Call to an undefined method Symplify\\Command\\ReleaseCommand\:\:nonExistingCall\(\)"
------------------------------------------------------------------------------------------
```

Improved Symfony Types
----------------------

[](#improved-symfony-types)

#### `ContainerGetTypeExtension`

[](#containergettypeextension)

With Symfony container and type as an argument, you always know **the same type is returned**:

```
use Symfony\Component\DependencyInjection\Container;

/** @var Container $container */
// PHPStan: object ❌
$container->get(Type::class);
// Reality: Type ✅
$container->get(Type::class);

// same for in-controller/container-aware context
$this->get(Type::class);
```

#### `KernelGetContainerAfterBootReturnTypeExtension`

[](#kernelgetcontainerafterbootreturntypeextension)

After Symfony Kernel boot, `getContainer()` always returns the container:

```
use Symfony\Component\HttpKernel\Kernel;

final class AppKernel extends Kernel
{
    // ...
}

$kernel = new AppKernel('prod', false);
$kernel->boot();

// PHPStan: null|ContainerInterface ❌
$kernel->getContainer();
// Reality: ContainerInterface ✅
$kernel->getContainer();
// Reality: ContainerInterface ✅
```

#### `SplFileInfoTolerantReturnTypeExtension`

[](#splfileinfotolerantreturntypeextension)

Symfony Finder finds only existing files (obviously), so the `getRealPath()` always return `string`:

```
use Symfony\Component\Finder\Finder;

$finder = new Finder();

foreach ($finder as $fileInfo) {
    // PHPStan: false|string ❌
    $fileInfo->getRealPath();
    // Reality: string ✅
    $fileInfo->getRealPath();
}
```

Happy coding!

###  Health Score

64

—

FairBetter than 99% of packages

Maintenance68

Regular maintenance activity

Popularity56

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 90.8% 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 ~5 days

Recently: every ~169 days

Total

514

Last Release

187d ago

Major Versions

v7.3.18 → v8.0.0-beta12020-05-16

8.3.48 → 9.0.0-BETA12020-11-14

9.4.70 → 10.0.0-beta12021-11-02

10.3.3 → 11.0.02022-06-13

11.4.3 → 12.0.02024-12-12

PHP version history (9 changes)v4.8.0PHP ^7.1

v7.0.0PHP ^7.2

8.2.17PHP ^7.2|^8.0

8.3.0PHP &gt;=7.2

9.0.0-rc1PHP &gt;=7.3

v9.3.27PHP &gt;=8.0

11.1.11PHP &gt;=8.1

11.4.0PHP ^7.2 || ^8.0

12.0.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/924196?v=4)[Tomas Votruba](/maintainers/TomasVotruba)[@TomasVotruba](https://github.com/TomasVotruba)

---

Top Contributors

[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (473 commits)")[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (31 commits)")[![samsonasik](https://avatars.githubusercontent.com/u/459648?v=4)](https://github.com/samsonasik "samsonasik (14 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (2 commits)")[![SanderMuller](https://avatars.githubusercontent.com/u/9074391?v=4)](https://github.com/SanderMuller "SanderMuller (1 commits)")

---

Tags

extensionsphpphpstanstatic analysisphpstan-extension

### Embed Badge

![Health badge](/badges/symplify-phpstan-extensions/health.svg)

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

###  Alternatives

[larastan/larastan

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

6.4k43.5M5.2k](/packages/larastan-larastan)[phpstan/phpstan-symfony

Symfony Framework extensions and rules for PHPStan

78768.9M1.5k](/packages/phpstan-phpstan-symfony)[phpstan/phpstan-doctrine

Doctrine extensions for PHPStan

66766.6M1.1k](/packages/phpstan-phpstan-doctrine)[deptrac/deptrac

Deptrac is a static code analysis tool that helps to enforce rules for dependencies between software layers.

2.9k6.3M68](/packages/deptrac-deptrac)[tomasvotruba/bladestan

PHPStan rule for static analysis of Blade templates

363584.5k4](/packages/tomasvotruba-bladestan)[phpstan/phpstan-strict-rules

Extra strict and opinionated rules for PHPStan

69661.6M3.9k](/packages/phpstan-phpstan-strict-rules)

PHPackages © 2026

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