diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 480486b..8a88b43 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -11,6 +11,8 @@ src + tests + tests/**/data @@ -18,4 +20,4 @@ - \ No newline at end of file + diff --git a/src/Rules/UseSafeFunctionsRule.php b/src/Rules/UseSafeFunctionsRule.php index d649184..a137779 100644 --- a/src/Rules/UseSafeFunctionsRule.php +++ b/src/Rules/UseSafeFunctionsRule.php @@ -33,15 +33,13 @@ public function processNode(Node $node, Scope $scope): array $unsafeFunctions = FunctionListLoader::getFunctionList(); if (isset($unsafeFunctions[$functionName])) { - if ( - $functionName === "json_decode" + if ($functionName === "json_decode" && $this->argValueIncludeJSONTHROWONERROR($node->getArgs()[3] ?? null) ) { return []; } - if ( - $functionName === "json_encode" + if ($functionName === "json_encode" && $this->argValueIncludeJSONTHROWONERROR($node->getArgs()[1] ?? null) ) { return [];