Update PHPStan and Safe PHP, and review codebase for further type correctness

This commit is contained in:
Alex Cabal 2025-02-25 22:09:35 -06:00
parent e2e14a3551
commit 9d1b66d19e
35 changed files with 301 additions and 169 deletions

View file

@ -36,6 +36,9 @@ class Museum{
$parsedUrl['path'] = $parsedUrl['path'] ?? '';
// We've initialized `$parsedUrl`, formally define it for PHPStan.
/** @var array{'path': string, 'host': string, 'fragment'?: string, 'query'?: string} $parsedUrl */
// We can't match on TLD because extracting the TLD for double-barrel TLDs, like .gov.uk, requires a whitelist.
if(preg_match('/\brijksmuseum\.nl$/ius', $parsedUrl['host'])){
@ -112,10 +115,6 @@ class Museum{
throw new Exceptions\InvalidMuseumUrlException($url, $exampleUrl);
}
if($parsedUrl['path'] != '/eMP/eMuseumPlus'){
throw new Exceptions\InvalidMuseumUrlException($url, $exampleUrl);
}
parse_str($parsedUrl['query'] ?? '', $vars);
if(!isset($vars['objectId']) || is_array($vars['objectId'])){