diff --git a/composer.json b/composer.json index faf06b3..cc79d52 100644 --- a/composer.json +++ b/composer.json @@ -44,8 +44,8 @@ } }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.64", - "phpstan/phpstan": "^1.12", + "friendsofphp/php-cs-fixer": "^3.65", + "phpstan/phpstan": "^2.0", "phpunit/phpunit" : "^9.6" }, "scripts": { diff --git a/lib/Serializer/functions.php b/lib/Serializer/functions.php index a6105a9..9b4bbb8 100644 --- a/lib/Serializer/functions.php +++ b/lib/Serializer/functions.php @@ -147,7 +147,7 @@ function repeatingElements(Writer $writer, array $items, string $childElementNam * * You can even mix the two array syntaxes. * - * @param string|int|float|bool|array|object $value + * @param string|int|float|bool|array|object|null $value */ function standardSerializer(Writer $writer, $value): void { @@ -181,7 +181,7 @@ function standardSerializer(Writer $writer, $value): void // This item has a numeric index. We just loop through the // array and throw it back in the writer. standardSerializer($writer, $item); - } elseif (is_string($name) && is_array($item) && isset($item['attributes'])) { + } elseif (is_array($item) && isset($item['attributes'])) { // The key is used for a name, but $item has 'attributes' and // possibly 'value' $writer->startElement($name); diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 364905f..ec0c143 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,2 +1,6 @@ parameters: - ignoreErrors: + ignoreErrors: + - + message: "#^Call to function is_null\\(\\) with null will always evaluate to true\\.$#" + path: lib/Serializer/functions.php + count: 1 diff --git a/tests/Sabre/Xml/ReaderTest.php b/tests/Sabre/Xml/ReaderTest.php index df2902f..7677ab2 100644 --- a/tests/Sabre/Xml/ReaderTest.php +++ b/tests/Sabre/Xml/ReaderTest.php @@ -339,7 +339,7 @@ public function testParseProblem(): void $output = $reader->parse(); $this->fail('We expected a ParseException to be thrown'); } catch (LibXMLException $e) { - self::assertIsArray($e->getErrors()); + self::assertNotEmpty($e->getErrors()); } } diff --git a/tests/Sabre/Xml/ServiceTest.php b/tests/Sabre/Xml/ServiceTest.php index 245366f..8559116 100644 --- a/tests/Sabre/Xml/ServiceTest.php +++ b/tests/Sabre/Xml/ServiceTest.php @@ -182,9 +182,6 @@ public function testEmptyPropfind(string $xml): void $util->namespaceMap = [ 'http://sabre.io/ns' => 'stdClass', ]; - /** - * @var PropFindTestAsset - */ $result = $util->expect('{DAV:}propfind', $xml); self::assertIsObject($result); self::assertInstanceOf(PropFindTestAsset::class, $result);