[ 'code' => ' [ 'code' => ' [], 'ignored_issues' => [], 'php_version' => '8.0', ]; yield 'Iterating over \DatePeriod (#5954) PHP7 Traversable' => [ 'code' => 'format("Y-m-d"); }', 'assertions' => [ '$period' => 'DatePeriod', '$dt' => 'DateTimeInterface|null', ], 'ignored_issues' => [], 'php_version' => '7.3', ]; yield 'Iterating over \DatePeriod (#5954) PHP8 IteratorAggregate' => [ 'code' => 'format("Y-m-d"); }', 'assertions' => [ '$period' => 'DatePeriod', '$dt' => 'DateTimeImmutable|null', ], 'ignored_issues' => [], 'php_version' => '8.0', ]; yield 'Iterating over \DatePeriod (#5954), ISO string' => [ 'code' => 'format("Y-m-d"); }', 'assertions' => [ '$period' => 'DatePeriod', '$dt' => 'DateTime|null', ], 'ignored_issues' => [], 'php_version' => '8.0', ]; yield 'DatePeriod implements only Traversable on PHP 7' => [ 'code' => ' [], 'ignored_issues' => [], 'php_version' => '7.3', ]; yield 'DatePeriod implements IteratorAggregate on PHP 8' => [ 'code' => ' [], 'ignored_issues' => ['RedundantCondition'], 'php_version' => '8.0', ]; yield 'sprintf yields a non-empty-string for non-empty-string value' => [ 'code' => ' [ 'code' => ' [ '$a===' => 'string', ], ]; yield 'json_encode returns a non-empty-string provided JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE' => [ 'code' => ' [ '$a===' => 'non-empty-string', ], ]; yield 'json_encode returns a non-empty-string with JSON_THROW_ON_ERROR' => [ 'code' => ' [ '$a===' => 'non-empty-string', '$b===' => 'non-empty-string', '$c===' => 'non-empty-string', '$d===' => 'non-empty-string', '$e===' => 'false|non-empty-string', '$f===' => 'false|non-empty-string', ], ]; yield 'str_starts_with/str_ends_with/str_contains redundant condition detection' => [ 'code' => ' [ '$a1===' => 'true', '$b1===' => 'false', '$c1===' => 'bool', '$a2===' => 'true', '$b2===' => 'false', '$c2===' => 'bool', '$a3===' => 'true', '$b3===' => 'false', '$c3===' => 'bool', ], ]; yield 'PHP8 str_* function assert non-empty-string' => [ 'code' => ' [ '$a===' => 'non-empty-string', '$b===' => 'non-empty-string', '$c===' => 'non-empty-string', '$d===' => 'non-empty-string', '$e===' => 'non-empty-string', ], ]; yield "PHP8 str_* function doesn't subtract string after assertion" => [ 'code' => ' [ '$a===' => 'false|string', '$b===' => 'false|string', '$c===' => 'false|string', ], ]; yield "str_contains doesn't yield InvalidLiteralArgument for __DIR__" => [ 'code' => ' [ 'code' => <<<'PHP' */ $maybeNocheckFlag = 0; /** @var int-mask */ $maybeOnlydirFlag = 0; /** @var string */ $string = ''; $emptyPatternNoFlags = glob( '' ); $emptyPatternWithoutNocheckFlag1 = glob( '', GLOB_MARK ); $emptyPatternWithoutNocheckFlag2 = glob( '' , GLOB_NOSORT | GLOB_NOESCAPE); $emptyPatternWithoutNocheckFlag3 = glob( '' , GLOB_MARK | GLOB_NOSORT | GLOB_NOESCAPE | GLOB_BRACE | GLOB_ONLYDIR | GLOB_ERR); $emptyPatternWithNocheckFlag1 = glob( '' , GLOB_NOCHECK); $emptyPatternWithNocheckFlag2 = glob( '' , GLOB_NOCHECK | GLOB_MARK); $emptyPatternWithNocheckFlag3 = glob( '' , GLOB_NOCHECK | GLOB_MARK | GLOB_NOSORT | GLOB_NOESCAPE | GLOB_BRACE | GLOB_ERR); $emptyPatternWithNocheckAndOnlydirFlag1 = glob( '' , GLOB_NOCHECK | GLOB_ONLYDIR); $emptyPatternWithNocheckAndOnlydirFlag2 = glob( '' , GLOB_NOCHECK | GLOB_ONLYDIR | GLOB_MARK); $emptyPatternWithNocheckAndOnlydirFlag3 = glob( '' , GLOB_NOCHECK | GLOB_ONLYDIR | GLOB_MARK | GLOB_NOSORT | GLOB_NOESCAPE | GLOB_BRACE | GLOB_ERR); $emptyPatternWithNocheckFlagAndMaybeOnlydir = glob( '' , GLOB_NOCHECK | $maybeOnlydirFlag); $emptyPatternMaybeWithNocheckFlag = glob( '' , $maybeNocheckFlag); $emptyPatternMaybeWithNocheckFlagAndOnlydir = glob( '' , $maybeNocheckFlag | GLOB_ONLYDIR); $emptyPatternMaybeWithNocheckFlagAndMaybeOnlydir = glob( '' , $maybeNocheckFlag | $maybeOnlydirFlag); $nonEmptyPatternNoFlags = glob( 'pattern' ); $nonEmptyPatternWithoutNocheckFlag1 = glob( 'pattern', GLOB_MARK ); $nonEmptyPatternWithoutNocheckFlag2 = glob( 'pattern' , GLOB_NOSORT | GLOB_NOESCAPE); $nonEmptyPatternWithoutNocheckFlag3 = glob( 'pattern' , GLOB_MARK | GLOB_NOSORT | GLOB_NOESCAPE | GLOB_BRACE | GLOB_ONLYDIR | GLOB_ERR); $nonEmptyPatternWithNocheckFlag1 = glob( 'pattern' , GLOB_NOCHECK); $nonEmptyPatternWithNocheckFlag2 = glob( 'pattern' , GLOB_NOCHECK | GLOB_MARK); $nonEmptyPatternWithNocheckFlag3 = glob( 'pattern' , GLOB_NOCHECK | GLOB_MARK | GLOB_NOSORT | GLOB_NOESCAPE | GLOB_BRACE | GLOB_ERR); $nonEmptyPatternWithNocheckAndOnlydirFlag1 = glob( 'pattern' , GLOB_NOCHECK | GLOB_ONLYDIR); $nonEmptyPatternWithNocheckAndOnlydirFlag2 = glob( 'pattern' , GLOB_NOCHECK | GLOB_ONLYDIR | GLOB_MARK); $nonEmptyPatternWithNocheckAndOnlydirFlag3 = glob( 'pattern' , GLOB_NOCHECK | GLOB_ONLYDIR | GLOB_MARK | GLOB_NOSORT | GLOB_NOESCAPE | GLOB_BRACE | GLOB_ERR); $nonEmptyPatternWithNocheckFlagAndMaybeOnlydir = glob( 'pattern' , GLOB_NOCHECK | $maybeOnlydirFlag); $nonEmptyPatternMaybeWithNocheckFlag = glob( 'pattern' , $maybeNocheckFlag); $nonEmptyPatternMaybeWithNocheckFlagAndOnlydir = glob( 'pattern' , $maybeNocheckFlag | GLOB_ONLYDIR); $nonEmptyPatternMaybeWithNocheckFlagAndMaybeOnlydir = glob( 'pattern' , $maybeNocheckFlag | $maybeOnlydirFlag); $stringPatternNoFlags = glob( $string ); $stringPatternWithoutNocheckFlag1 = glob( $string, GLOB_MARK ); $stringPatternWithoutNocheckFlag2 = glob( $string , GLOB_NOSORT | GLOB_NOESCAPE); $stringPatternWithoutNocheckFlag3 = glob( $string , GLOB_MARK | GLOB_NOSORT | GLOB_NOESCAPE | GLOB_BRACE | GLOB_ONLYDIR | GLOB_ERR); $stringPatternWithNocheckFlag1 = glob( $string , GLOB_NOCHECK); $stringPatternWithNocheckFlag2 = glob( $string , GLOB_NOCHECK | GLOB_MARK); $stringPatternWithNocheckFlag3 = glob( $string , GLOB_NOCHECK | GLOB_MARK | GLOB_NOSORT | GLOB_NOESCAPE | GLOB_BRACE | GLOB_ERR); $stringPatternWithNocheckAndOnlydirFlag1 = glob( $string , GLOB_NOCHECK | GLOB_ONLYDIR); $stringPatternWithNocheckAndOnlydirFlag2 = glob( $string , GLOB_NOCHECK | GLOB_ONLYDIR | GLOB_MARK); $stringPatternWithNocheckAndOnlydirFlag3 = glob( $string , GLOB_NOCHECK | GLOB_ONLYDIR | GLOB_MARK | GLOB_NOSORT | GLOB_NOESCAPE | GLOB_BRACE | GLOB_ERR); $stringPatternWithNocheckFlagAndMaybeOnlydir = glob( $string , GLOB_NOCHECK | $maybeOnlydirFlag); $stringPatternMaybeWithNocheckFlag = glob( $string , $maybeNocheckFlag); $stringPatternMaybeWithNocheckFlagAndOnlydir = glob( $string , $maybeNocheckFlag | GLOB_ONLYDIR); $stringPatternMaybeWithNocheckFlagAndMaybeOnlydir = glob( $string , $maybeNocheckFlag | $maybeOnlydirFlag); PHP, 'assertions' => [ '$emptyPatternNoFlags===' => 'false|list', '$emptyPatternWithoutNocheckFlag1===' => 'false|list', '$emptyPatternWithoutNocheckFlag2===' => 'false|list', '$emptyPatternWithoutNocheckFlag3===' => 'false|list', '$emptyPatternWithNocheckFlag1===' => 'false|list{\'\'}', '$emptyPatternWithNocheckFlag2===' => 'false|list{\'\'}', '$emptyPatternWithNocheckFlag3===' => 'false|list{\'\'}', '$emptyPatternWithNocheckAndOnlydirFlag1===' => 'false|list', '$emptyPatternWithNocheckAndOnlydirFlag2===' => 'false|list', '$emptyPatternWithNocheckAndOnlydirFlag3===' => 'false|list', '$emptyPatternWithNocheckFlagAndMaybeOnlydir===' => 'false|list{0?: \'\', ...}', '$emptyPatternMaybeWithNocheckFlag===' => 'false|list{0?: \'\', ...}', '$emptyPatternMaybeWithNocheckFlagAndOnlydir===' => 'false|list', '$emptyPatternMaybeWithNocheckFlagAndMaybeOnlydir===' => 'false|list{0?: \'\', ...}', '$nonEmptyPatternNoFlags===' => 'false|list', '$nonEmptyPatternWithoutNocheckFlag1===' => 'false|list', '$nonEmptyPatternWithoutNocheckFlag2===' => 'false|list', '$nonEmptyPatternWithoutNocheckFlag3===' => 'false|list', '$nonEmptyPatternWithNocheckFlag1===' => 'false|non-empty-list', '$nonEmptyPatternWithNocheckFlag2===' => 'false|non-empty-list', '$nonEmptyPatternWithNocheckFlag3===' => 'false|non-empty-list', '$nonEmptyPatternWithNocheckAndOnlydirFlag1===' => 'false|list', '$nonEmptyPatternWithNocheckAndOnlydirFlag2===' => 'false|list', '$nonEmptyPatternWithNocheckAndOnlydirFlag3===' => 'false|list', '$nonEmptyPatternWithNocheckFlagAndMaybeOnlydir===' => 'false|list', '$nonEmptyPatternMaybeWithNocheckFlag===' => 'false|list', '$nonEmptyPatternMaybeWithNocheckFlagAndOnlydir===' => 'false|list', '$nonEmptyPatternMaybeWithNocheckFlagAndMaybeOnlydir===' => 'false|list', '$stringPatternNoFlags===' => 'false|list', '$stringPatternWithoutNocheckFlag1===' => 'false|list', '$stringPatternWithoutNocheckFlag2===' => 'false|list', '$stringPatternWithoutNocheckFlag3===' => 'false|list', '$stringPatternWithNocheckFlag1===' => 'false|list{string, ...}', '$stringPatternWithNocheckFlag2===' => 'false|list{string, ...}', '$stringPatternWithNocheckFlag3===' => 'false|list{string, ...}', '$stringPatternWithNocheckAndOnlydirFlag1===' => 'false|list', '$stringPatternWithNocheckAndOnlydirFlag2===' => 'false|list', '$stringPatternWithNocheckAndOnlydirFlag3===' => 'false|list', '$stringPatternWithNocheckFlagAndMaybeOnlydir===' => 'false|list{0?: string, ...}', '$stringPatternMaybeWithNocheckFlag===' => 'false|list{0?: string, ...}', '$stringPatternMaybeWithNocheckFlagAndOnlydir===' => 'false|list', '$stringPatternMaybeWithNocheckFlagAndMaybeOnlydir===' => 'false|list{0?: string, ...}', ], ]; yield 'glob return ignores false' => [ 'code' => <<<'PHP' [ 'code' => <<<'PHP' [ 'code' => ' 'InvalidArgument', ]; yield 'json_encode invalid depth' => [ 'code' => ' 'InvalidArgument', ]; yield 'str_contains literal haystack' => [ 'code' => ' 'InvalidLiteralArgument', ]; yield 'str_starts_with literal haystack' => [ 'code' => ' 'InvalidLiteralArgument', ]; yield 'str_ends_with literal haystack' => [ 'code' => ' 'InvalidLiteralArgument', ]; } }