Skip to content

Commit

Permalink
fix psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDev committed Apr 22, 2022
1 parent a0dd1ac commit c21fe66
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/extractor/src/CanonicalExtractor.php
Expand Up @@ -31,8 +31,9 @@ public function isCanonicalCorrect(): bool
return true;
}

$pregMatch = preg_match('/^.+?[^\/:](?=[?\/]|$)/', $this->urlRequested->__toString(), $match);
// check for http://example.tld or http://example.tld/
return false !== preg_match('/^.+?[^\/:](?=[?\/]|$)/', $this->urlRequested->__toString(), $match)
return false !== $pregMatch
&& $match[0] === ltrim($this->urlRequested->__toString(), '/')
&& ($match[0] == $canonical || $match[0].'/' == $canonical);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/extractor/src/Url.php
Expand Up @@ -69,7 +69,7 @@ public function getDocumentUrl(): Http
public function getAbsoluteUri(): string
{
// return substr($this->get(), \strlen($this->getOrigin()));
return substr($this->http->withFragment(''), \strlen($this->getOrigin()));
return substr($this->http->withFragment('')->__toString(), \strlen($this->getOrigin()));
}

public function get(): string
Expand Down
5 changes: 5 additions & 0 deletions packages/google/src/Helper/Puphpeteer.php
Expand Up @@ -57,6 +57,8 @@ class Puphpeteer

/**
* @param array<string, mixed> $emulateOptions array{ viewport: mixed, userAgent: string }
*
* @psalm-suppress UndefinedMagicMethod
*/
public function instantiate(array $emulateOptions = [], string $language = ''): self
{
Expand All @@ -83,6 +85,9 @@ public function getBrowserPage(): Page
return self::$browserPage;
}

/**
* @psalm-suppress UndefinedMagicMethod
*/
public function close(): void
{
if (null === self::$browser) {
Expand Down

0 comments on commit c21fe66

Please sign in to comment.