Skip to content

Commit

Permalink
Merge branch 'release/v0.18.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
betterthanclay committed Nov 18, 2023
2 parents 43b164a + 09fbf25 commit 012208f
Show file tree
Hide file tree
Showing 16 changed files with 565 additions and 336 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"
php-version: "8.1"
extensions: "${{ env.PHP_EXTENSIONS }}"
ini-values: "post_max_size=256M"

Expand Down Expand Up @@ -60,9 +60,9 @@ jobs:
strategy:
matrix:
php-version:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
steps:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.0"
php-version: "8.1"
extensions: "${{ env.PHP_EXTENSIONS }}"
ini-values: "post_max_size=256M"

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v0.18.10 (2023-11-18)
* Improved DateTimeInterface support
* Added enum dump support
* Added Fiber dump support
* Made PHP8.1 minimum version

## v0.18.9 (2023-10-30)
* Read unkeyed meta from glitchDump as list

Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"name": "decodelabs/glitch",
"description": "Better tools for when things go wrong",
"type": "library",
"keywords": ["dump", "dumper", "exception", "debug"],
"keywords": [ "dump", "dumper", "exception", "debug" ],
"license": "MIT",
"authors": [{
"name": "Tom Wright",
"email": "[email protected]"
}],
"authors": [ {
"name": "Tom Wright",
"email": "[email protected]"
} ],
"require": {
"php": "^8.0",
"php": "^8.1",
"symfony/polyfill-mbstring": "^1.7",

"decodelabs/coercion": "^0.2",
Expand Down
77 changes: 46 additions & 31 deletions src/Glitch/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

class Context implements LoggerAwareInterface
{
public const VERSION = 'v0.18.9';
public const VERSION = 'v0.18.10';

protected float $startTime;
protected string $runMode = 'development';
Expand Down Expand Up @@ -97,8 +97,9 @@ public function __construct()
*
* @return $this
*/
public function setRunMode(string $mode): static
{
public function setRunMode(
string $mode
): static {
switch ($mode) {
case 'production':
case 'testing':
Expand Down Expand Up @@ -151,8 +152,9 @@ public function isProduction(): bool
/**
* Set PSR logger
*/
public function setLogger(LoggerInterface $logger): void
{
public function setLogger(
LoggerInterface $logger
): void {
$this->logger = $logger;
}

Expand All @@ -170,8 +172,9 @@ public function getLogger(): ?LoggerInterface
*
* @return $this
*/
public function setLogListener(?callable $listener): static
{
public function setLogListener(
?callable $listener
): static {
$this->logListener = $listener;
return $this;
}
Expand All @@ -188,8 +191,9 @@ public function getLogListener(): ?callable
/**
* Create a new stack trace
*/
public function stackTrace(int $rewind = 0): Trace
{
public function stackTrace(
int $rewind = 0
): Trace {
return Trace::create($rewind + 1);
}

Expand Down Expand Up @@ -334,8 +338,9 @@ public function dumpException(
*
* @return $this
*/
public function setStartTime(float $time): static
{
public function setStartTime(
float $time
): static {
$this->startTime = $time;
return $this;
}
Expand Down Expand Up @@ -414,8 +419,9 @@ public function handleError(
/**
* Last-ditch catch-all for exceptions
*/
public function handleException(Throwable $exception): void
{
public function handleException(
Throwable $exception
): void {
try {
$this->logException($exception);

Expand All @@ -442,8 +448,9 @@ public function handleException(Throwable $exception): void
/**
* Log an exception... somewhere :)
*/
public function logException(Throwable $exception): void
{
public function logException(
Throwable $exception
): void {
if ($this->logger) {
try {
$this->logger->critical($exception->getMessage(), [
Expand Down Expand Up @@ -483,8 +490,9 @@ public function handleShutdown(): void
/**
* Is this error code fatal?
*/
protected static function isErrorLevelFatal(int $level): bool
{
protected static function isErrorLevelFatal(
int $level
): bool {
$errors = E_ERROR;
$errors |= E_PARSE;
$errors |= E_CORE_ERROR;
Expand All @@ -501,8 +509,9 @@ protected static function isErrorLevelFatal(int $level): bool
*
* @return $this
*/
public function setHeaderBufferSender(?callable $sender): static
{
public function setHeaderBufferSender(
?callable $sender
): static {
$this->headerBufferSender = $sender;
return $this;
}
Expand All @@ -522,8 +531,9 @@ public function getHeaderBufferSender(): ?callable
*
* @return $this
*/
public function setErrorPageRenderer(?callable $renderer): static
{
public function setErrorPageRenderer(
?callable $renderer
): static {
$this->errorPageRenderer = $renderer;
return $this;
}
Expand Down Expand Up @@ -571,8 +581,9 @@ public function registerPathAlias(
* @param array<string, string> $aliases
* @return $this
*/
public function registerPathAliases(array $aliases): static
{
public function registerPathAliases(
array $aliases
): static {
foreach ($aliases as $name => $path) {
$path = rtrim($path, '/') . '/';
$this->pathAliases[$name] = $path;
Expand Down Expand Up @@ -605,8 +616,9 @@ public function getPathAliases(): array
/**
* Lookup and replace path prefix
*/
public function normalizePath(?string $path): ?string
{
public function normalizePath(
?string $path
): ?string {
if ($path === null) {
return null;
}
Expand Down Expand Up @@ -695,8 +707,9 @@ public function gatherDefaultStats(
/**
* Format filesize bytes as human readable
*/
public static function formatFilesize(int $bytes): string
{
public static function formatFilesize(
int $bytes
): string {
$units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'];

for ($i = 0; $bytes > 1024; $i++) {
Expand Down Expand Up @@ -784,8 +797,9 @@ public function getVendorPath(): string
*
* @return $this
*/
public function setRenderer(Renderer $renderer): static
{
public function setRenderer(
Renderer $renderer
): static {
$this->dumpRenderer = $renderer;
return $this;
}
Expand Down Expand Up @@ -842,8 +856,9 @@ public function getActiveRenderer(): Renderer
*
* @return $this
*/
public function setTransport(Transport $transport): static
{
public function setTransport(
Transport $transport
): static {
$this->transport = $transport;
return $this;
}
Expand Down
25 changes: 15 additions & 10 deletions src/Glitch/Dumper/Dump.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ class Dump implements
/**
* Construct with stack trace of invoking call
*/
public function __construct(Trace $trace)
{
public function __construct(
Trace $trace
) {
$this->trace = $trace;
}

Expand All @@ -51,8 +52,9 @@ public function __construct(Trace $trace)
*
* @return $this
*/
public function addStats(Stat ...$stats): static
{
public function addStats(
Stat ...$stats
): static {
foreach ($stats as $stat) {
$this->stats[$stat->getKey()] = $stat;
}
Expand All @@ -63,8 +65,9 @@ public function addStats(Stat ...$stats): static
/**
* Get named statistic
*/
public function getStat(string $key): ?Stat
{
public function getStat(
string $key
): ?Stat {
return $this->stats[$key] ?? null;
}

Expand All @@ -73,8 +76,9 @@ public function getStat(string $key): ?Stat
*
* @return $this
*/
public function removeStat(string $key): static
{
public function removeStat(
string $key
): static {
unset($this->stats[$key]);
return $this;
}
Expand Down Expand Up @@ -115,8 +119,9 @@ public function getTrace(): Trace
*
* @return $this
*/
public function addEntity(mixed $entity): static
{
public function addEntity(
mixed $entity
): static {
$this->entities[] = $entity;
return $this;
}
Expand Down
Loading

0 comments on commit 012208f

Please sign in to comment.