PHPackages                             hexlet/phpstan-fp - 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. hexlet/phpstan-fp

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

hexlet/phpstan-fp
=================

PHPStan rules for functional programming

v3.1.1(1y ago)926.1k4[1 issues](https://github.com/Hexlet/phpstan-functional-programming/issues)2MITPHPPHP &gt;=8.2CI passing

Since Oct 24Pushed 8mo ago2 watchersCompare

[ Source](https://github.com/Hexlet/phpstan-functional-programming)[ Packagist](https://packagist.org/packages/hexlet/phpstan-fp)[ RSS](/packages/hexlet-phpstan-fp/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (4)Versions (9)Used By (2)

phpstan-functional-programming
==============================

[](#phpstan-functional-programming)

[![github action status](https://github.com/Hexlet/phpstan-functional-programming/workflows/PHP%20CI/badge.svg)](https://github.com/Hexlet/phpstan-functional-programming/actions)

[PHPStan](https://phpstan.org) rules for functional programming

Install
-------

[](#install)

To use this extension, require it in [Composer](https://getcomposer.org):

```
$ composer require --dev hexlet/phpstan-fp
```

Usage
-----

[](#usage)

All of the rules provided (and used) by this library are included in [`extension.neon`](extension.neon).

When you are using [phpstan/extension-installer](https://github.com/phpstan/extension-installer), `extension.neon` will be automatically included.

Otherwise you need to include `extension.neon` in your `phpstan.neon`:

```
includes:
  - vendor/hexlet/phpstan-fp/extension.neon
```

Rules
-----

[](#rules)

This package provides the following rules for use with *PHPStan*:

- [`DisallowClassesRule`](docs/rules/DisallowClassesRule.md) - Forbid the use of `class`.
- [`DisallowThrowRule`](docs/rules/DisallowThrowRule.md) - Forbid the use of `throw`.
- [`DisallowUnusedExpressionRule`](docs/rules/DisallowUnusedExpressionRule.md) - Enforce that an expression gets used.
- [`DisallowMutatingFunctionsRule`](docs/rules/DisallowMutatingFunctionsRule.md) - Forbid the use of mutating functions.
- [`DisallowLoopsRule`](docs/rules/DisallowLoopsRule.md) - Forbid the use of loops.
- [`DisallowMutationRule`](docs/rules/DisallowMutationRule.md) - Forbid the use of mutating operators.

Disabling rules
---------------

[](#disabling-rules)

If you don't want to start using some of the available rules at once, you can.

```
parameters:

  phpstanFunctionalProgramming:
    disallowClasses: false
    disallowLoops: false
    disallowThrow: false
    disallowUnusedExpression: false
    disallowVariablesMutation: false
    disallowMutatingFunctions: false
```

[![Hexlet Ltd. logo](https://raw.githubusercontent.com/Hexlet/assets/master/images/hexlet_logo128.png)](https://hexlet.io/?utm_source=github&utm_medium=link&utm_campaign=phpstan-functional-programming)

This repository is created and maintained by the team and the community of Hexlet, an educational project. [Read more about Hexlet](https://hexlet.io/?utm_source=github&utm_medium=link&utm_campaign=phpstan-functional-programming).

See most active contributors on [hexlet-friends](https://friends.hexlet.io/).

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance51

Moderate activity, may be stable

Popularity33

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~232 days

Recently: every ~252 days

Total

8

Last Release

452d ago

Major Versions

v1.1.2 → v2.0.02023-07-05

v2.0.0 → 3.0.02025-04-07

PHP version history (5 changes)v1.0.0PHP ^7.1

v1.1.0PHP &gt;=7.1

v1.1.2PHP &gt;=7.3

v2.0.0PHP &gt;=8.1

3.0.0PHP &gt;=8.2

### Community

Maintainers

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

---

Top Contributors

[![fey](https://avatars.githubusercontent.com/u/697178?v=4)](https://github.com/fey "fey (29 commits)")[![corsicanec82](https://avatars.githubusercontent.com/u/12639352?v=4)](https://github.com/corsicanec82 "corsicanec82 (26 commits)")[![mokevnin](https://avatars.githubusercontent.com/u/308430?v=4)](https://github.com/mokevnin "mokevnin (15 commits)")[![ashikov](https://avatars.githubusercontent.com/u/676554?v=4)](https://github.com/ashikov "ashikov (6 commits)")[![ssssank](https://avatars.githubusercontent.com/u/17835285?v=4)](https://github.com/ssssank "ssssank (2 commits)")[![amshkv](https://avatars.githubusercontent.com/u/23584933?v=4)](https://github.com/amshkv "amshkv (1 commits)")[![IDilettant](https://avatars.githubusercontent.com/u/59534588?v=4)](https://github.com/IDilettant "IDilettant (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/hexlet-phpstan-fp/health.svg)

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

###  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)[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[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)[tomasvotruba/cognitive-complexity

PHPStan rules to measure cognitive complexity of your classes and methods

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

PHPackages © 2026

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