An open API service indexing awesome lists of open source software.

https://github.com/struggle-for-php/sfp-psalm-psr-log-plugin

Stubs to let Psalm understand psr/log (Psr-3) strictly
https://github.com/struggle-for-php/sfp-psalm-psr-log-plugin

psalm psr psr-3

Last synced: 5 months ago
JSON representation

Stubs to let Psalm understand psr/log (Psr-3) strictly

Awesome Lists containing this project

README

          

sfp-psalm-psr-log-plugin
========================

PSR-3 (psr/log) plugin for [Psalm](https://github.com/vimeo/psalm)

Installation:

```console
$ composer require --dev struggle-for-php/sfp-psalm-psr-log-plugin
$ vendor/bin/psalm-plugin enable struggle-for-php/sfp-psalm-psr-log-plugin
```

## Example

```php
logger->error('error happened.', ['exception' => $e->getMessage()]);
}
}
}
```

would be ERROR output:
```php
ERROR: InvalidArgument - src/Foo.php:14:45 - Argument 2 of Psr\Log\LoggerInterface::error expects array{exception?: Exception}, array{exception: string} provided
$this->logger->error('error happened.', ['exception' => $e->getMessage()]);
```

## Configure

If you want to allow `Throwable` to pass logger context's `exception`.

```xml


1


```