https://github.com/bocmah/psalm-reactphp-promise-plugin
A Psalm plugin for ReactPHP Promise package.
https://github.com/bocmah/psalm-reactphp-promise-plugin
promise psalm reactphp
Last synced: 6 months ago
JSON representation
A Psalm plugin for ReactPHP Promise package.
- Host: GitHub
- URL: https://github.com/bocmah/psalm-reactphp-promise-plugin
- Owner: Bocmah
- License: mit
- Created: 2021-01-20T18:49:34.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-27T20:43:30.000Z (over 4 years ago)
- Last Synced: 2025-03-01T08:53:43.143Z (7 months ago)
- Topics: promise, psalm, reactphp
- Language: PHP
- Homepage:
- Size: 29.3 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Psalm plugin for ReactPHP Promise package
A [Psalm](https://github.com/vimeo/psalm) plugin for [reactphp/promise](https://github.com/reactphp/promise).
## Overview
This package brings support for template parameters in `PromiseInterface`. So you can type-hint resolution template
parameter, e.g. `PromiseInterface` instead of plain `PromiseInterface`.It also adds an `otherwise()` method to `PromiseInterface` as a stub, which allows Psalm to recognize constructs like
```php
$promise
->then(
function () {
echo 'Success' . PHP_EOL;
}
)
->otherwise(
function (\Throwable $error) {
echo 'Failure: ' . $error->getMessage() . PHP_EOL
}
);
```## Prerequisites
You should have [Psalm](https://github.com/vimeo/psalm) installed.## Installation
Install plugin as a dev dependency via composer:`composer require --dev bocmah/psalm-reactphp-promise-plugin`
Then enable the plugin:
`./vendor/bin/psalm-plugin enable bocmah/psalm-reactphp-promise-plugin`