https://github.com/hexlet/phpstan-functional-programming
https://github.com/hexlet/phpstan-functional-programming
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hexlet/phpstan-functional-programming
- Owner: Hexlet
- License: mit
- Created: 2020-10-01T22:54:51.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-07-05T18:17:43.000Z (almost 3 years ago)
- Last Synced: 2024-04-23T13:17:47.330Z (about 2 years ago)
- Language: PHP
- Size: 50.8 KB
- Stars: 7
- Watchers: 4
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# phpstan-functional-programming
[](https://github.com/Hexlet/phpstan-functional-programming/actions)
[PHPStan](https://phpstan.org) rules for functional programming
## Install
To use this extension, require it in [Composer](https://getcomposer.org):
```sh
$ composer require --dev hexlet/phpstan-fp
```
## 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`:
```neon
includes:
- vendor/hexlet/phpstan-fp/extension.neon
```
## 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
If you don't want to start using some of the available rules at once, you can.
```neon
parameters:
phpstanFunctionalProgramming:
disallowClasses: false
disallowLoops: false
disallowThrow: false
disallowUnusedExpression: false
disallowVariablesMutation: false
disallowMutatingFunctions: false
```
[](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/).