diff --git a/psalm-baseline.xml b/psalm-baseline.xml index a2ddb0d7..12f4a335 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + Json @@ -8,66 +8,6 @@ $callable($json) - - - $size - - - - - $string - - - - - $style - - - - - $jsonEncodeOptions - - - - - $encoded - - - - - $string - - - - - $schemaUri - - - - - $schemaUri - - - - - $schemaUri - - - - - $schemaUri - - - - - $schemaUri - - - - - $schemaUri - - null === $this->format @@ -120,10 +60,6 @@ - - $packages - $packages - $value diff --git a/src/Exception/InvalidIndentSizeException.php b/src/Exception/InvalidIndentSizeException.php index e8ff1084..d9bf9884 100644 --- a/src/Exception/InvalidIndentSizeException.php +++ b/src/Exception/InvalidIndentSizeException.php @@ -18,12 +18,12 @@ final class InvalidIndentSizeException extends \InvalidArgumentException impleme /** * @var int */ - private $size; + private $size = 0; /** * @var int */ - private $minimumSize; + private $minimumSize = 0; public static function fromSizeAndMinimumSize(int $size, int $minimumSize): self { diff --git a/src/Exception/InvalidIndentStringException.php b/src/Exception/InvalidIndentStringException.php index 74179cf6..343350ee 100644 --- a/src/Exception/InvalidIndentStringException.php +++ b/src/Exception/InvalidIndentStringException.php @@ -18,7 +18,7 @@ final class InvalidIndentStringException extends \InvalidArgumentException imple /** * @var string */ - private $string; + private $string = ''; public static function fromString(string $string): self { diff --git a/src/Exception/InvalidIndentStyleException.php b/src/Exception/InvalidIndentStyleException.php index 70313bd3..12bab4a3 100644 --- a/src/Exception/InvalidIndentStyleException.php +++ b/src/Exception/InvalidIndentStyleException.php @@ -18,12 +18,12 @@ final class InvalidIndentStyleException extends \InvalidArgumentException implem /** * @var string */ - private $style; + private $style = ''; /** * @var string[] */ - private $allowedStyles; + private $allowedStyles = []; public static function fromStyleAndAllowedStyles(string $style, string ...$allowedStyles): self { diff --git a/src/Exception/InvalidJsonEncodeOptionsException.php b/src/Exception/InvalidJsonEncodeOptionsException.php index 6df55293..ed54cdf1 100644 --- a/src/Exception/InvalidJsonEncodeOptionsException.php +++ b/src/Exception/InvalidJsonEncodeOptionsException.php @@ -18,7 +18,7 @@ final class InvalidJsonEncodeOptionsException extends \InvalidArgumentException /** * @var int */ - private $jsonEncodeOptions; + private $jsonEncodeOptions = 0; public static function fromJsonEncodeOptions(int $jsonEncodeOptions): self { diff --git a/src/Exception/InvalidJsonEncodedException.php b/src/Exception/InvalidJsonEncodedException.php index 87e92017..b468d36d 100644 --- a/src/Exception/InvalidJsonEncodedException.php +++ b/src/Exception/InvalidJsonEncodedException.php @@ -18,7 +18,7 @@ final class InvalidJsonEncodedException extends \InvalidArgumentException implem /** * @var string */ - private $encoded; + private $encoded = ''; public static function fromEncoded(string $encoded): self { diff --git a/src/Exception/InvalidNewLineStringException.php b/src/Exception/InvalidNewLineStringException.php index 539a70c9..b7ee4c23 100644 --- a/src/Exception/InvalidNewLineStringException.php +++ b/src/Exception/InvalidNewLineStringException.php @@ -18,7 +18,7 @@ final class InvalidNewLineStringException extends \InvalidArgumentException impl /** * @var string */ - private $string; + private $string = ''; public static function fromString(string $string): self { diff --git a/src/Exception/NormalizedInvalidAccordingToSchemaException.php b/src/Exception/NormalizedInvalidAccordingToSchemaException.php index 18b385cd..ab741434 100644 --- a/src/Exception/NormalizedInvalidAccordingToSchemaException.php +++ b/src/Exception/NormalizedInvalidAccordingToSchemaException.php @@ -18,7 +18,7 @@ final class NormalizedInvalidAccordingToSchemaException extends \RuntimeExceptio /** * @var string */ - private $schemaUri; + private $schemaUri = ''; public static function fromSchemaUri(string $schemaUri): self { diff --git a/src/Exception/OriginalInvalidAccordingToSchemaException.php b/src/Exception/OriginalInvalidAccordingToSchemaException.php index 25e86432..224101a2 100644 --- a/src/Exception/OriginalInvalidAccordingToSchemaException.php +++ b/src/Exception/OriginalInvalidAccordingToSchemaException.php @@ -18,7 +18,7 @@ final class OriginalInvalidAccordingToSchemaException extends \RuntimeException /** * @var string */ - private $schemaUri; + private $schemaUri = ''; public static function fromSchemaUri(string $schemaUri): self { diff --git a/src/Exception/SchemaUriCouldNotBeReadException.php b/src/Exception/SchemaUriCouldNotBeReadException.php index 07a896f9..a637c4e4 100644 --- a/src/Exception/SchemaUriCouldNotBeReadException.php +++ b/src/Exception/SchemaUriCouldNotBeReadException.php @@ -18,7 +18,7 @@ final class SchemaUriCouldNotBeReadException extends \RuntimeException implement /** * @var string */ - private $schemaUri; + private $schemaUri = ''; public static function fromSchemaUri(string $schemaUri): self { diff --git a/src/Exception/SchemaUriCouldNotBeResolvedException.php b/src/Exception/SchemaUriCouldNotBeResolvedException.php index 3e1fb806..75328514 100644 --- a/src/Exception/SchemaUriCouldNotBeResolvedException.php +++ b/src/Exception/SchemaUriCouldNotBeResolvedException.php @@ -18,7 +18,7 @@ final class SchemaUriCouldNotBeResolvedException extends \RuntimeException imple /** * @var string */ - private $schemaUri; + private $schemaUri = ''; public static function fromSchemaUri(string $schemaUri): self { diff --git a/src/Exception/SchemaUriReferencesDocumentWithInvalidMediaTypeException.php b/src/Exception/SchemaUriReferencesDocumentWithInvalidMediaTypeException.php index 3d912454..8c30934e 100644 --- a/src/Exception/SchemaUriReferencesDocumentWithInvalidMediaTypeException.php +++ b/src/Exception/SchemaUriReferencesDocumentWithInvalidMediaTypeException.php @@ -18,7 +18,7 @@ final class SchemaUriReferencesDocumentWithInvalidMediaTypeException extends \Ru /** * @var string */ - private $schemaUri; + private $schemaUri = ''; public static function fromSchemaUri(string $schemaUri): self { diff --git a/src/Exception/SchemaUriReferencesInvalidJsonDocumentException.php b/src/Exception/SchemaUriReferencesInvalidJsonDocumentException.php index 5162a75c..c3b6d059 100644 --- a/src/Exception/SchemaUriReferencesInvalidJsonDocumentException.php +++ b/src/Exception/SchemaUriReferencesInvalidJsonDocumentException.php @@ -18,7 +18,7 @@ final class SchemaUriReferencesInvalidJsonDocumentException extends \RuntimeExce /** * @var string */ - private $schemaUri; + private $schemaUri = ''; public static function fromSchemaUri(string $schemaUri): self { diff --git a/test/Unit/Exception/InvalidIndentSizeExceptionTest.php b/test/Unit/Exception/InvalidIndentSizeExceptionTest.php index 6b044c31..de0fe1dc 100644 --- a/test/Unit/Exception/InvalidIndentSizeExceptionTest.php +++ b/test/Unit/Exception/InvalidIndentSizeExceptionTest.php @@ -22,6 +22,14 @@ */ final class InvalidIndentSizeExceptionTest extends AbstractExceptionTestCase { + public function testDefaults(): void + { + $exception = new InvalidIndentSizeException(); + + self::assertSame(0, $exception->minimumSize()); + self::assertSame(0, $exception->size()); + } + public function testFromSizeAndMinimumSizeReturnsInvalidIndentSizeException(): void { $faker = self::faker(); diff --git a/test/Unit/Exception/InvalidIndentStringExceptionTest.php b/test/Unit/Exception/InvalidIndentStringExceptionTest.php index d0c11b71..9430e21c 100644 --- a/test/Unit/Exception/InvalidIndentStringExceptionTest.php +++ b/test/Unit/Exception/InvalidIndentStringExceptionTest.php @@ -22,6 +22,13 @@ */ final class InvalidIndentStringExceptionTest extends AbstractExceptionTestCase { + public function testDefaults(): void + { + $exception = new InvalidIndentStringException(); + + self::assertSame('', $exception->string()); + } + public function testFromSizeAndMinimumSizeReturnsInvalidIndentStringException(): void { $string = self::faker()->word; diff --git a/test/Unit/Exception/InvalidIndentStyleExceptionTest.php b/test/Unit/Exception/InvalidIndentStyleExceptionTest.php index d929acfb..fe4687b2 100644 --- a/test/Unit/Exception/InvalidIndentStyleExceptionTest.php +++ b/test/Unit/Exception/InvalidIndentStyleExceptionTest.php @@ -22,6 +22,14 @@ */ final class InvalidIndentStyleExceptionTest extends AbstractExceptionTestCase { + public function testDefaults(): void + { + $exception = new InvalidIndentStyleException(); + + self::assertSame([], $exception->allowedStyles()); + self::assertSame('', $exception->style()); + } + public function testExtendsInvalidArgumentException(): void { self::assertClassExtends(\InvalidArgumentException::class, InvalidIndentStyleException::class); diff --git a/test/Unit/Exception/InvalidJsonEncodeOptionsExceptionTest.php b/test/Unit/Exception/InvalidJsonEncodeOptionsExceptionTest.php index 8e33a3ca..0c8d2970 100644 --- a/test/Unit/Exception/InvalidJsonEncodeOptionsExceptionTest.php +++ b/test/Unit/Exception/InvalidJsonEncodeOptionsExceptionTest.php @@ -22,6 +22,13 @@ */ final class InvalidJsonEncodeOptionsExceptionTest extends AbstractExceptionTestCase { + public function testDefaults(): void + { + $exception = new InvalidJsonEncodeOptionsException(); + + self::assertSame(0, $exception->jsonEncodeOptions()); + } + public function testFromJsonEncodeOptionsReturnsInvalidJsonEncodeOptionsException(): void { $jsonEncodeOptions = self::faker()->randomNumber(); diff --git a/test/Unit/Exception/InvalidJsonEncodedExceptionTest.php b/test/Unit/Exception/InvalidJsonEncodedExceptionTest.php index da90ea5c..272f17bd 100644 --- a/test/Unit/Exception/InvalidJsonEncodedExceptionTest.php +++ b/test/Unit/Exception/InvalidJsonEncodedExceptionTest.php @@ -22,6 +22,13 @@ */ final class InvalidJsonEncodedExceptionTest extends AbstractExceptionTestCase { + public function testDefaults(): void + { + $exception = new InvalidJsonEncodedException(); + + self::assertSame('', $exception->encoded()); + } + public function testFromEncodedReturnsInvalidJsonEncodedException(): void { $encoded = self::faker()->sentence; diff --git a/test/Unit/Exception/InvalidNewLineStringExceptionTest.php b/test/Unit/Exception/InvalidNewLineStringExceptionTest.php index 13a920e6..5609bd40 100644 --- a/test/Unit/Exception/InvalidNewLineStringExceptionTest.php +++ b/test/Unit/Exception/InvalidNewLineStringExceptionTest.php @@ -22,6 +22,13 @@ */ final class InvalidNewLineStringExceptionTest extends AbstractExceptionTestCase { + public function testDefaults(): void + { + $exception = new InvalidNewLineStringException(); + + self::assertSame('', $exception->string()); + } + public function testFromSizeAndMinimumSizeReturnsInvalidIndentStringException(): void { $string = self::faker()->word; diff --git a/test/Unit/Exception/NormalizedInvalidAccordingToSchemaExceptionTest.php b/test/Unit/Exception/NormalizedInvalidAccordingToSchemaExceptionTest.php index 9311f2df..2129dbf3 100644 --- a/test/Unit/Exception/NormalizedInvalidAccordingToSchemaExceptionTest.php +++ b/test/Unit/Exception/NormalizedInvalidAccordingToSchemaExceptionTest.php @@ -22,6 +22,13 @@ */ final class NormalizedInvalidAccordingToSchemaExceptionTest extends AbstractExceptionTestCase { + public function testDefaults(): void + { + $exception = new NormalizedInvalidAccordingToSchemaException(); + + self::assertSame('', $exception->schemaUri()); + } + public function testFromSchemaUriReturnsNormalizedInvalidAccordingToSchemaException(): void { $schemaUri = self::faker()->url; diff --git a/test/Unit/Exception/OriginalInvalidAccordingToSchemaExceptionTest.php b/test/Unit/Exception/OriginalInvalidAccordingToSchemaExceptionTest.php index b4d4ff64..a873fa0d 100644 --- a/test/Unit/Exception/OriginalInvalidAccordingToSchemaExceptionTest.php +++ b/test/Unit/Exception/OriginalInvalidAccordingToSchemaExceptionTest.php @@ -22,6 +22,13 @@ */ final class OriginalInvalidAccordingToSchemaExceptionTest extends AbstractExceptionTestCase { + public function testDefaults(): void + { + $exception = new OriginalInvalidAccordingToSchemaException(); + + self::assertSame('', $exception->schemaUri()); + } + public function testFromSchemaUriReturnsOriginalInvalidAccordingToSchemaException(): void { $schemaUri = self::faker()->url; diff --git a/test/Unit/Exception/SchemaUriCouldNotBeReadExceptionTest.php b/test/Unit/Exception/SchemaUriCouldNotBeReadExceptionTest.php index 967e5b58..23e4bf39 100644 --- a/test/Unit/Exception/SchemaUriCouldNotBeReadExceptionTest.php +++ b/test/Unit/Exception/SchemaUriCouldNotBeReadExceptionTest.php @@ -22,6 +22,13 @@ */ final class SchemaUriCouldNotBeReadExceptionTest extends AbstractExceptionTestCase { + public function testDefaults(): void + { + $exception = new SchemaUriCouldNotBeReadException(); + + self::assertSame('', $exception->schemaUri()); + } + public function testFromSchemaUriReturnsSchemaUriCouldNotBeReadException(): void { $schemaUri = self::faker()->url; diff --git a/test/Unit/Exception/SchemaUriCouldNotBeResolvedExceptionTest.php b/test/Unit/Exception/SchemaUriCouldNotBeResolvedExceptionTest.php index b47aaaaf..5872c500 100644 --- a/test/Unit/Exception/SchemaUriCouldNotBeResolvedExceptionTest.php +++ b/test/Unit/Exception/SchemaUriCouldNotBeResolvedExceptionTest.php @@ -22,6 +22,13 @@ */ final class SchemaUriCouldNotBeResolvedExceptionTest extends AbstractExceptionTestCase { + public function testDefaults(): void + { + $exception = new SchemaUriCouldNotBeResolvedException(); + + self::assertSame('', $exception->schemaUri()); + } + public function testFromSchemaUriReturnsSchemaUriCouldNotBeResolvedException(): void { $schemaUri = self::faker()->url; diff --git a/test/Unit/Exception/SchemaUriReferencesDocumentWithInvalidMediaTypeExceptionTest.php b/test/Unit/Exception/SchemaUriReferencesDocumentWithInvalidMediaTypeExceptionTest.php index 30e4eec3..eb3c2d64 100644 --- a/test/Unit/Exception/SchemaUriReferencesDocumentWithInvalidMediaTypeExceptionTest.php +++ b/test/Unit/Exception/SchemaUriReferencesDocumentWithInvalidMediaTypeExceptionTest.php @@ -22,6 +22,13 @@ */ final class SchemaUriReferencesDocumentWithInvalidMediaTypeExceptionTest extends AbstractExceptionTestCase { + public function testDefaults(): void + { + $exception = new SchemaUriReferencesDocumentWithInvalidMediaTypeException(); + + self::assertSame('', $exception->schemaUri()); + } + public function testFromSchemaUriReturnsSchemaUriReferencesDocumentWithInvalidMediaType(): void { $schemaUri = self::faker()->url; diff --git a/test/Unit/Exception/SchemaUriReferencesInvalidJsonDocumentExceptionTest.php b/test/Unit/Exception/SchemaUriReferencesInvalidJsonDocumentExceptionTest.php index e45059ae..5cfdd4c5 100644 --- a/test/Unit/Exception/SchemaUriReferencesInvalidJsonDocumentExceptionTest.php +++ b/test/Unit/Exception/SchemaUriReferencesInvalidJsonDocumentExceptionTest.php @@ -22,6 +22,13 @@ */ final class SchemaUriReferencesInvalidJsonDocumentExceptionTest extends AbstractExceptionTestCase { + public function testDefaults(): void + { + $exception = new SchemaUriReferencesInvalidJsonDocumentException(); + + self::assertSame('', $exception->schemaUri()); + } + public function testFromSchemaUriReturnsSchemaUriReferencesDocumentWithInvalidMediaType(): void { $schemaUri = self::faker()->url;