Skip to content

Commit 8d13075

Browse files
committed
Fixed phpstan issues
1 parent ff3b089 commit 8d13075

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

packages/doctools/src/Docgen/FrontmatterStripper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function stripContent(string $content): string
7878
}
7979

8080
// Find closing ---
81-
$withoutLeading = preg_replace('/\A\s*/', '', $content);
81+
$withoutLeading = preg_replace('/\A\s*/', '', $content) ?? $content;
8282
$endPos = strpos($withoutLeading, "\n---", 3);
8383
if ($endPos === false) {
8484
return $content;

packages/doctools/src/Quality/Services/DriftDetector.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,11 @@ private function loadTierMap(string $repoRoot): array
218218
return [];
219219
}
220220

221-
$json = json_decode(file_get_contents($path), true);
221+
$contents = file_get_contents($path);
222+
if ($contents === false) {
223+
return [];
224+
}
225+
$json = json_decode($contents, true);
222226
if (!is_array($json) || !isset($json['packages'])) {
223227
return [];
224228
}

packages/events/src/Dispatchers/EventDispatcher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class EventDispatcher implements CanHandleEvents
2929
/** @var array<string, string[]> Cached class hierarchy per event class */
3030
private static array $typeCache = [];
3131

32-
/** @var callable[]|null Pre-sorted tap listeners, null = needs rebuild */
32+
/** @var array<callable(object): void>|null Pre-sorted tap listeners, null = needs rebuild */
3333
private ?array $sortedTaps = null;
3434

3535
public function __construct(
@@ -194,7 +194,7 @@ private function classListeners(object $event): iterable
194194
/**
195195
* Returns pre-sorted tap listener callables (cached between addListener calls).
196196
*
197-
* @return callable[]
197+
* @return array<callable(object): void>
198198
*/
199199
private function resolvedTapListeners(): array
200200
{

0 commit comments

Comments
 (0)