From 0bc5b80d1444cd5e3fc2068c5736cbc8517cda47 Mon Sep 17 00:00:00 2001 From: Danny van der Sluijs Date: Wed, 26 Feb 2025 21:14:40 +0100 Subject: [PATCH 1/3] refactor: cleanup redundant checks --- tests/ValidatorTest.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/ValidatorTest.php b/tests/ValidatorTest.php index 9f536384..44d31a28 100644 --- a/tests/ValidatorTest.php +++ b/tests/ValidatorTest.php @@ -4,6 +4,7 @@ use JsonSchema\Validator; use PHPUnit\Framework\TestCase; +use JsonSchema\Exception\InvalidArgumentException; class ValidatorTest extends TestCase { @@ -31,18 +32,12 @@ public function testValidateWithAssocSchemaWithRelativeRefs(): void public function testBadAssocSchemaInput(): void { - if (version_compare(phpversion(), '5.5.0', '<')) { - $this->markTestSkipped('PHP versions < 5.5.0 trigger an error on json_encode issues'); - } - if (defined('HHVM_VERSION')) { - $this->markTestSkipped('HHVM has no problem with encoding resources'); - } - $schema = ['propertyOne' => fopen('php://stdout', 'w')]; + $schema = ['propertyOne' => fopen('php://stdout', 'wb')]; $data = json_decode('{"propertyOne":[42]}', true); $validator = new Validator(); - $this->expectException('\JsonSchema\Exception\InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $validator->validate($data, $schema); } From cf4069d361e0629665c020d9876834904557fc4b Mon Sep 17 00:00:00 2001 From: Danny van der Sluijs Date: Wed, 26 Feb 2025 21:19:05 +0100 Subject: [PATCH 2/3] docs: add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e169991b..f043170c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Used PHPStan's int-mask-of type where applicable ([#779](https://github.com/jsonrainbow/json-schema/pull/779)) - Fixed some PHPStan errors ([#781](https://github.com/jsonrainbow/json-schema/pull/781)) +- Cleanup redundant checks ([#796](https://github.com/jsonrainbow/json-schema/pull/796)) ## [6.1.0] - 2025-02-04 ### Added From 3b92aa8e27529ce3a7c2c5da1700de08c3ecc1f3 Mon Sep 17 00:00:00 2001 From: Danny van der Sluijs Date: Wed, 26 Feb 2025 21:22:46 +0100 Subject: [PATCH 3/3] style: correct namespace ordering --- tests/ValidatorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ValidatorTest.php b/tests/ValidatorTest.php index 44d31a28..06eabc89 100644 --- a/tests/ValidatorTest.php +++ b/tests/ValidatorTest.php @@ -2,9 +2,9 @@ namespace JsonSchema\Tests; +use JsonSchema\Exception\InvalidArgumentException; use JsonSchema\Validator; use PHPUnit\Framework\TestCase; -use JsonSchema\Exception\InvalidArgumentException; class ValidatorTest extends TestCase {