Revert weird way of doing dd() in favor of using PHP-FPM on dev.
This commit is contained in:
parent
c71cc858e4
commit
01dfadb351
|
@ -163,11 +163,6 @@
|
|||
"App\\": "src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"files": [
|
||||
"./config/functions.dev.php"
|
||||
]
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"bin": [
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @throws App\Exception\DumpException
|
||||
*/
|
||||
function dumpdie(mixed ...$vars): never
|
||||
{
|
||||
$env = App\Environment::getInstance();
|
||||
|
||||
if ($env->isCli()) {
|
||||
$dumper = new Symfony\Component\VarDumper\Dumper\CliDumper();
|
||||
$varCloner = new Symfony\Component\VarDumper\Cloner\VarCloner();
|
||||
|
||||
foreach ($vars as $var) {
|
||||
$dumper->dump($varCloner->cloneVar($var), true);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$dumper = new Symfony\Component\VarDumper\Dumper\HtmlDumper();
|
||||
$varCloner = new Symfony\Component\VarDumper\Cloner\VarCloner();
|
||||
|
||||
$dumps = [];
|
||||
foreach ($vars as $var) {
|
||||
$dumps[] = $dumper->dump($varCloner->cloneVar($var), true);
|
||||
}
|
||||
|
||||
throw new App\Exception\DumpException(dumps: $dumps);
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Exception;
|
||||
|
||||
use App\Exception;
|
||||
use Monolog\Level;
|
||||
use Throwable;
|
||||
|
||||
final class DumpException extends Exception
|
||||
{
|
||||
public function __construct(
|
||||
string $message = 'Debug app dump.',
|
||||
int $code = 200,
|
||||
Throwable $previous = null,
|
||||
Level $loggerLevel = Level::Debug,
|
||||
private readonly array $dumps = []
|
||||
) {
|
||||
parent::__construct($message, $code, $previous, $loggerLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getDumps(): array
|
||||
{
|
||||
return $this->dumps;
|
||||
}
|
||||
}
|
|
@ -116,15 +116,6 @@ final class ErrorHandler extends SlimErrorHandler
|
|||
$locale->register($this->environment);
|
||||
}
|
||||
|
||||
if ($this->exception instanceof Exception\DumpException) {
|
||||
$response = $this->responseFactory->createResponse($this->statusCode);
|
||||
$responseBody = $response->getBody();
|
||||
foreach ($this->exception->getDumps() as $dump) {
|
||||
$responseBody->write($dump);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
if (!($this->request instanceof ServerRequest)) {
|
||||
return parent::respond();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue