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. [Testing &amp; Quality](/categories/testing)
4. /
5. symplify/phpstan-extensions

Abandoned → [symplify/phpstan-rules](/?search=symplify%2Fphpstan-rules)Phpstan-extension[Testing &amp; Quality](/categories/testing)

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

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

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

Since Sep 15Pushed 9mo 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 2w 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

63

—

FairBetter than 99% of packages

Maintenance58

Moderate activity, may be stable

Popularity57

Moderate usage in the ecosystem

Community34

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor1

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

279d 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)")[![rector-bot](https://avatars.githubusercontent.com/u/291251500?v=4)](https://github.com/rector-bot "rector-bot (3 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.5k60.6M10.5k](/packages/larastan-larastan)[phpstan/phpstan-doctrine

Doctrine extensions for PHPStan

67475.0M1.6k](/packages/phpstan-phpstan-doctrine)[phpstan/phpstan-symfony

Symfony Framework extensions and rules for PHPStan

79378.2M2.5k](/packages/phpstan-phpstan-symfony)[shipmonk/dead-code-detector

Dead code detector to find unused PHP code via PHPStan extension. Can automatically remove dead PHP code. Supports libraries like Symfony, Doctrine, PHPUnit etc. Detects dead cycles. Can detect dead code that is tested.

5014.2M111](/packages/shipmonk-dead-code-detector)[tomasvotruba/type-coverage

Measure type coverage of your project

21711.9M450](/packages/tomasvotruba-type-coverage)[phpstan/phpstan-strict-rules

Extra strict and opinionated rules for PHPStan

70473.1M6.1k](/packages/phpstan-phpstan-strict-rules)

PHPackages © 2026

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