Since phpcs v3.10.0 the code generate false positive errors about unused constants. Seems it is caused by named arg (no error without it).
-------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------
7 | ERROR | [x] Type PREG_SPLIT_DELIM_CAPTURE is not used in this file.
8 | ERROR | [x] Type PREG_SPLIT_NO_EMPTY is not used in this file.
-------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------
Code sample
<?php declare(strict_types = 1);
namespace Bug;
use function preg_split;
use const PREG_SPLIT_DELIM_CAPTURE;
use const PREG_SPLIT_NO_EMPTY;
preg_split('/((.)\g{-1}*)/um', 'abc', flags: PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
Describe the bug
Since phpcs v3.10.0 the code generate false positive errors about unused constants. Seems it is caused by named arg (no error without it).
Code sample
Custom ruleset
Expected behavior
No errors.