From dc75d28b309d5202d4c4ba192df2694cf08b6b98 Mon Sep 17 00:00:00 2001 From: George Steel Date: Thu, 8 Feb 2024 16:20:05 +0000 Subject: [PATCH] Fix `RiskyTruthyFalsyComparison` issues Signed-off-by: George Steel --- src/ProblemDetailsResponseFactory.php | 2 +- test/ProblemDetailsResponseFactoryTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ProblemDetailsResponseFactory.php b/src/ProblemDetailsResponseFactory.php index 1a940ae..5e193c6 100644 --- a/src/ProblemDetailsResponseFactory.php +++ b/src/ProblemDetailsResponseFactory.php @@ -220,7 +220,7 @@ public function __construct( } // Ensures type safety of the composed factory $this->responseFactory = $responseFactory; - if (! $jsonFlags) { + if ($jsonFlags === null) { $jsonFlags = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION diff --git a/test/ProblemDetailsResponseFactoryTest.php b/test/ProblemDetailsResponseFactoryTest.php index 552462a..ac7ad67 100644 --- a/test/ProblemDetailsResponseFactoryTest.php +++ b/test/ProblemDetailsResponseFactoryTest.php @@ -144,7 +144,7 @@ public function testCreateResponseRemovesInvalidCharactersFromXmlKeys(string $he ], ]; - if (stripos($expectedType, 'xml')) { + if (stripos($expectedType, 'xml') !== false) { $expectedKeyNames = [ 'A_-', '_A-',