Skip to content

Commit

Permalink
FIx PhpStan error.
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek committed Mar 12, 2022
1 parent 9c5cd26 commit 181176a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private function isExternalLink(string $url): bool

private function loadUrl(string $url): HttpResponse
{
if ($this->config->getSleepBetweenRequests()) {
if ($this->config->getSleepBetweenRequests() > 0) {
usleep($this->config->getSleepBetweenRequests() * 1_000);
}

Expand Down
6 changes: 3 additions & 3 deletions src/RelativeUrlToAbsoluteUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ private static function splitUrl(string $url, bool $decode = true): ?array
$parts['pass'] = rawurldecode((string) $parts['pass']);
}
if ($parts['path'] ?? false) {
$parts['path'] = rawurldecode((string) $parts['path']);
$parts['path'] = rawurldecode((string) ($parts['path'] ?? ''));
}
if (isset($h)) {
$parts['host'] = rawurldecode((string) $parts['host']);
$parts['host'] = rawurldecode((string) ($parts['host'] ?? ''));
}
if ($parts['query'] ?? false) {
$parts['query'] = rawurldecode((string) $parts['query']);
Expand All @@ -161,7 +161,7 @@ private static function splitUrl(string $url, bool $decode = true): ?array
private static function urlRemoveDotSegments(string $path): string
{
$outputSegments = [];
foreach ((array) (preg_split('!/!u', $path) ?? []) as $seg) {
foreach (((array) preg_split('!/!u', $path)) as $seg) {
if ($seg === '' || $seg === '.') {
continue;
}
Expand Down

0 comments on commit 181176a

Please sign in to comment.