PHPackages                             mhujer/phpstan-rules - 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. mhujer/phpstan-rules

ActiveLibrary[Testing &amp; Quality](/categories/testing)

mhujer/phpstan-rules
====================

Custom rules for phpstan

1.0(4y ago)627.0k1MITPHPPHP ~8.0 || ~8.1CI failing

Since Jul 21Pushed 4y ago2 watchersCompare

[ Source](https://github.com/mhujer/phpstan-rules)[ Packagist](https://packagist.org/packages/mhujer/phpstan-rules)[ RSS](/packages/mhujer-phpstan-rules/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (4)Versions (11)Used By (1)

Custom PHPStan Rules
====================

[](#custom-phpstan-rules)

[![Build Status](https://camo.githubusercontent.com/2fb22a3922ec09d75dcbe1797460e54063553e15d95f37bdc45a2df5510a1b30/68747470733a2f2f7472617669732d63692e6f72672f6d68756a65722f7068707374616e2d72756c65732e737667)](https://travis-ci.org/mhujer/phpstan-rules)[![Coverage Status](https://camo.githubusercontent.com/1d2ef1863f3eb1c6e260d3bac385d23bd1039d9e432e3709d94652f4e121355d/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d68756a65722f7068707374616e2d72756c65732f62616467652e737667)](https://coveralls.io/github/mhujer/phpstan-rules)[![Latest Stable Version](https://camo.githubusercontent.com/48e225ed7f9277eee230ad534ee71649b094e49a1df6eecad8cdaf3f6f1d413b/68747470733a2f2f706f7365722e707567782e6f72672f6d68756a65722f7068707374616e2d72756c65732f762f737461626c65)](https://packagist.org/packages/mhujer/phpstan-rules)[![License](https://camo.githubusercontent.com/e48ace591ad5220e8469b7c807a3ada6d44fe5d11f42cfe2cac6470a75545cb8/68747470733a2f2f706f7365722e707567782e6f72672f6d68756a65722f7068707374616e2d72756c65732f6c6963656e7365)](https://packagist.org/packages/mhujer/phpstan-rules)

This repository provides following custom rules for [PHPStan](https://github.com/phpstan/phpstan):

- Check that the `__construct()` is the first method in the class.
- If the `__construct` contains `Doctrine\ORM\EntityManagerInterface` as a parameter, it must be sorted as the last one.

Usage
-----

[](#usage)

To use those rules, require them in [Composer](https://getcomposer.org/):

```
composer require --dev mhujer/phpstan-rules
```

And include them in your project's PHPStan config:

```
includes:
    - vendor/mhujer/phpstan-rules/rules.neon
```

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity78

Established project with proven stability

 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

Every ~235 days

Recently: every ~293 days

Total

7

Last Release

1701d ago

Major Versions

0.6 → 1.02021-11-05

PHP version history (4 changes)0.1PHP &gt;=7.1

0.5PHP ^7.2

0.6PHP ~7.4 || ~8.0

1.0PHP ~8.0 || ~8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/b232da7cbc1f54c8230ffac0c734a0e685743790ababfc00bf5913bc0bc723db?d=identicon)[mhujer](/maintainers/mhujer)

---

Top Contributors

[![mhujer](https://avatars.githubusercontent.com/u/353372?v=4)](https://github.com/mhujer "mhujer (25 commits)")

---

Tags

phpphpstanphpstan-extensionphpstan-rulesstatic-analysis

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mhujer-phpstan-rules/health.svg)

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

###  Alternatives

[larastan/larastan

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

6.5k55.4M8.4k](/packages/larastan-larastan)[phpstan/phpstan-symfony

Symfony Framework extensions and rules for PHPStan

79475.7M2.2k](/packages/phpstan-phpstan-symfony)[phpstan/phpstan-doctrine

Doctrine extensions for PHPStan

67272.8M1.4k](/packages/phpstan-phpstan-doctrine)[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.

4853.5M91](/packages/shipmonk-dead-code-detector)[spaze/phpstan-disallowed-calls

PHPStan rules to detect disallowed method &amp; function calls, constant, namespace, attribute, property &amp; superglobal usages, with powerful rules to re-allow a call or a usage in places where it should be allowed.

33422.6M551](/packages/spaze-phpstan-disallowed-calls)[tomasvotruba/cognitive-complexity

PHPStan rules to measure cognitive complexity of your classes and methods

1635.6M289](/packages/tomasvotruba-cognitive-complexity)

PHPackages © 2026

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