>
> try {
>   // do stuff
> } catch(Throwable $exception) {
>   $this->logger->error("failed to do stuff", compact('exception'));
>   throw $exception;
> }
>

I wonder why not just create an array with the key...

```php
try {
   // do stuff
} catch(Throwable $exception) {
   $this->logger->error("failed to do stuff", ['exception' => $exception]));
   throw $exception;
}
```

It's a few more characters of course, but I would pick the readability
and simplicity over the potential typos (which the IDE should point
out) and a few key presses it saves.I

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to