File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ sfp-psalm-psr-log-plugin
2+ ========================
3+
4+ PSR-3 (psr/log) plugin for [ Psalm] ( https://github.com/vimeo/psalm )
5+
6+ Installation:
7+
8+ ``` console
9+ $ composer require --dev struggle-for-php/sfp-psalm-psr-log-plugin
10+ $ vendor/bin/psalm-plugin enable struggle-for-php/sfp-psalm-psr-log-plugin
11+ ```
12+
13+ ## Example
14+
15+ ``` php
16+ <?php
17+
18+ use Psr\Log\LoggerInterface;
19+
20+ class Foo
21+ {
22+ /** @var LoggerInterface */
23+ private $logger;
24+
25+ public function anyAction()
26+ {
27+ try {
28+ } catch (\Exception $e) {
29+ $this->logger->error('error happend.', ['exception' => $e->getMessage()]);
30+ }
31+ }
32+ }
33+ ```
34+
35+ would be ERROR output:
36+ ``` php
37+ ERROR: InvalidArgument - src/Foo.php:14:45 - Argument 2 of Psr\Log\LoggerInterface::error expects array{exception?: Exception}, array{exception: string} provided
38+ $this->logger->error('error happend.', ['exception' => $e->getMessage()]);
39+ ```
You can’t perform that action at this time.
0 commit comments