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)925.9k4[1 issues](https://github.com/Hexlet/phpstan-functional-programming/issues)2MITPHPPHP &gt;=8.2CI passing

Since Oct 24Pushed 6mo 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 1mo ago

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

49

—

FairBetter than 95% of packages

Maintenance55

Moderate activity, may be stable

Popularity34

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

405d 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.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)[phpat/phpat

PHP Architecture Tester

1.2k3.5M32](/packages/phpat-phpat)[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.

33320.0M375](/packages/spaze-phpstan-disallowed-calls)[mglaman/phpstan-drupal

Drupal extension and rules for PHPStan

20829.0M124](/packages/mglaman-phpstan-drupal)

PHPackages © 2026

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