webimpress/coding-standard

WebimpressCodingStandard.Namespaces.UnusedUseStatement.UnusedUse fails for constant

Closed this issue · 0 comments

It fails to detect usage of the JSON_PRETTY_PRINT constant.

use const JSON_PRETTY_PRINT;

class ProblemDetailsResponseFactory
{
    public function __construct(
        bool $isDebug = self::EXCLUDE_THROWABLE_DETAILS,
        ?int $jsonFlags = null
    ) {
        $this->isDebug         = $isDebug;
        if (! $jsonFlags) {
            $jsonFlags = JSON_UNESCAPED_SLASHES
                | JSON_UNESCAPED_UNICODE
                | JSON_PRESERVE_ZERO_FRACTION
                | JSON_PARTIAL_OUTPUT_ON_ERROR;
            if ($isDebug) {
                $jsonFlags = JSON_PRETTY_PRINT | $jsonFlags;        // <----- not detected
            }
        }
    }
}

https://github.com/mezzio/mezzio-problem-details/blob/68dad9213b2fd61743ebf27401511359da138508/src/ProblemDetailsResponseFactory.php#L236