Skip to content

Commit 181176a

Browse files
committed
FIx PhpStan error.
1 parent 9c5cd26 commit 181176a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Crawler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ private function isExternalLink(string $url): bool
224224

225225
private function loadUrl(string $url): HttpResponse
226226
{
227-
if ($this->config->getSleepBetweenRequests()) {
227+
if ($this->config->getSleepBetweenRequests() > 0) {
228228
usleep($this->config->getSleepBetweenRequests() * 1_000);
229229
}
230230

src/RelativeUrlToAbsoluteUrl.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ private static function splitUrl(string $url, bool $decode = true): ?array
142142
$parts['pass'] = rawurldecode((string) $parts['pass']);
143143
}
144144
if ($parts['path'] ?? false) {
145-
$parts['path'] = rawurldecode((string) $parts['path']);
145+
$parts['path'] = rawurldecode((string) ($parts['path'] ?? ''));
146146
}
147147
if (isset($h)) {
148-
$parts['host'] = rawurldecode((string) $parts['host']);
148+
$parts['host'] = rawurldecode((string) ($parts['host'] ?? ''));
149149
}
150150
if ($parts['query'] ?? false) {
151151
$parts['query'] = rawurldecode((string) $parts['query']);
@@ -161,7 +161,7 @@ private static function splitUrl(string $url, bool $decode = true): ?array
161161
private static function urlRemoveDotSegments(string $path): string
162162
{
163163
$outputSegments = [];
164-
foreach ((array) (preg_split('!/!u', $path) ?? []) as $seg) {
164+
foreach (((array) preg_split('!/!u', $path)) as $seg) {
165165
if ($seg === '' || $seg === '.') {
166166
continue;
167167
}

0 commit comments

Comments
 (0)