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

ActivePhpstan-extension[Testing &amp; Quality](/categories/testing)

guanguans/phpstan-rules
=======================

A set of additional rules for phpstan/phpstan. - 一套针对 `phpstan/phpstan` 的附加规则。

1.1.1(3mo ago)15.3k13MITPHPPHP &gt;=7.4CI passing

Since Jan 15Pushed 3w agoCompare

[ Source](https://github.com/guanguans/phpstan-rules)[ Packagist](https://packagist.org/packages/guanguans/phpstan-rules)[ Docs](https://github.com/guanguans/phpstan-rules)[ Fund](https://guanguans.github.io/sponsors)[ RSS](/packages/guanguans-phpstan-rules/feed)WikiDiscussions main Synced yesterday

READMEChangelog (6)Dependencies (95)Versions (9)Used By (13)

phpstan-rules
=============

[](#phpstan-rules)

Note

A set of additional rules for phpstan/phpstan. - 一套针对 `phpstan/phpstan` 的附加规则。

[![tests](https://github.com/guanguans/phpstan-rules/actions/workflows/tests.yml/badge.svg)](https://github.com/guanguans/phpstan-rules/actions/workflows/tests.yml)[![php-cs-fixer](https://github.com/guanguans/phpstan-rules/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/guanguans/phpstan-rules/actions/workflows/php-cs-fixer.yml)[![codecov](https://camo.githubusercontent.com/f1f30e5fa555232e8f00f52cffe8e3776832083d36921e7fe3a2f1a9c636ac2d/68747470733a2f2f636f6465636f762e696f2f67682f6775616e6775616e732f7068707374616e2d72756c65732f67726170682f62616467652e7376673f746f6b656e3d3052746753476f6d344b)](https://codecov.io/gh/guanguans/phpstan-rules)[![Latest Stable Version](https://camo.githubusercontent.com/996a6238b6870c5dbcc249f92620444de0a476849db1fe4decbb74a7212f056a/68747470733a2f2f706f7365722e707567782e6f72672f6775616e6775616e732f7068707374616e2d72756c65732f76)](https://packagist.org/packages/guanguans/phpstan-rules)[![GitHub release (with filter)](https://camo.githubusercontent.com/dad5e302c3c43be6d7d9af23332e36cd7109a6d0a91bf46169e505f29085c7ca/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6775616e6775616e732f7068707374616e2d72756c6573)](https://github.com/guanguans/phpstan-rules/releases)[![Total Downloads](https://camo.githubusercontent.com/edd495f811531bc93d52d59ac2d34615fec1192fbfce0589aa1dafc83ac46ed3/68747470733a2f2f706f7365722e707567782e6f72672f6775616e6775616e732f7068707374616e2d72756c65732f646f776e6c6f616473)](https://packagist.org/packages/guanguans/phpstan-rules)[![License](https://camo.githubusercontent.com/88f889d13d7a93cba8fe0753866dd0a489ed462a1c642f42f25d969b2682cd45/68747470733a2f2f706f7365722e707567782e6f72672f6775616e6775616e732f7068707374616e2d72756c65732f6c6963656e7365)](https://packagist.org/packages/guanguans/phpstan-rules)

Requirement
-----------

[](#requirement)

- PHP &gt;= 7.4

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

[](#installation)

```
composer require guanguans/phpstan-rules --dev --ansi -v
```

If you also install [phpstan/extension-installer](https://github.com/phpstan/extension-installer) then you're all set!

Manual installationIf you don't want to use `phpstan/extension-installer`, include rules.neon in your project's PHPStan config:

```
includes:
    - vendor/guanguans/phpstan-rules/config/rules.neon
```

Usage
-----

[](#usage)

Parameter configuration refer to the parameter section the configuration file \[[`config/rules.neon`](config/rules.neon)\].

You can also refer to the configuration file \[`tests/Rule/.../.../config/configured_rule.neon`\] in the tests directory.

Composer scripts
----------------

[](#composer-scripts)

```
composer app:fix-neon
composer checks:required
composer php-cs-fixer:fix
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [guanguans](https://github.com/guanguans)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance89

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.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 ~13 days

Total

6

Last Release

100d ago

### Community

Maintainers

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

---

Top Contributors

[![guanguans](https://avatars.githubusercontent.com/u/22309277?v=4)](https://github.com/guanguans "guanguans (33 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")

---

Tags

lintlinterphpstanrulestandardstatic-analysistestingPHPStandevstatic analysisstandardlinterlintrule

###  Code Quality

TestsPest

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[larastan/larastan

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

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

Symfony Framework extensions and rules for PHPStan

79475.7M2.2k](/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.

4853.5M91](/packages/shipmonk-dead-code-detector)[phpstan/phpstan-doctrine

Doctrine extensions for PHPStan

67272.8M1.4k](/packages/phpstan-phpstan-doctrine)[staabm/phpstan-dba

2942.6M2](/packages/staabm-phpstan-dba)[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)
