diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 24bf72e5..fb368d35 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: true matrix: - php-versions: ['8.0', '8.1', '8.2', '8.3'] + php-versions: ['8.0', '8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout @@ -41,7 +41,7 @@ jobs: strategy: fail-fast: true matrix: - php-versions: ['8.0', '8.1', '8.2', '8.3'] + php-versions: ['8.0', '8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout diff --git a/lib/Http/Response.php b/lib/Http/Response.php index 57651fe3..db93db2c 100644 --- a/lib/Http/Response.php +++ b/lib/Http/Response.php @@ -298,7 +298,11 @@ public static function fromString($responseStr) throw new Exception('Failed to parse HTTP response status line.'); } - // Process the rest of the header lines + /** + * Process the rest of the header lines + * + * @var array> + */ $headers = []; foreach ($headerLines as $line) { if (preg_match("|^([\w-]+):\s+(.+)$|", $line, $m)) { @@ -306,7 +310,7 @@ public static function fromString($responseStr) $hValue = $m[2]; if (isset($headers[$hName])) { - if (!\is_array($headers[$hName])) { + if (false === \is_array($headers[$hName])) { $headers[$hName] = [$headers[$hName]]; } $headers[$hName][] = $hValue; diff --git a/lib/ParsedUri.php b/lib/ParsedUri.php index a9f9efe2..4cdfdc41 100644 --- a/lib/ParsedUri.php +++ b/lib/ParsedUri.php @@ -69,6 +69,17 @@ public function __construct($uri = null) { if (\is_string($uri)) { if (preg_match(self::URI_REGEX, $uri, $matches)) { + /** + * Without the following "hack", PHPStan would throw the following errors (PHP 8.4): + * + * 74 Offset 2 on array{0: string, 1: string, 2: string, ...} in isset() always exists and is not nullable. + * 80 Offset 4 on array{0: string, 1: string, 2: string, ...} in isset() always exists and is not nullable. + * 86 Offset 5 on array{0: string, 1: string, 2: string, ...} in isset() always exists and is not nullable. + * + * @var array + */ + $matches = $matches; + if (!empty($matches[1])) { $this->scheme = isset($matches[2]) ? $matches[2] : ''; } diff --git a/lib/Parser/RdfXml.php b/lib/Parser/RdfXml.php index b5822500..e8f3422c 100644 --- a/lib/Parser/RdfXml.php +++ b/lib/Parser/RdfXml.php @@ -94,7 +94,6 @@ protected function initXMLParser() xml_set_element_handler($parser, [$this, 'startElementHandler'], [$this, 'endElementHandler']); xml_set_character_data_handler($parser, [$this, 'cdataHandler']); xml_set_start_namespace_decl_handler($parser, [$this, 'newNamespaceHandler']); - xml_set_object($parser, $this); $this->xmlParser = $parser; } }