-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch refs/heads/1.12.x into 2.0.x
- Loading branch information
Showing
3 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php // lint >= 7.4 | ||
|
||
namespace Bug12173; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
class HelloWorld | ||
{ | ||
public function parse(string $string): void | ||
{ | ||
$regex = '#.*(?<fruit>(apple|orange)).*#'; | ||
|
||
if (preg_match($regex, $string, $matches) !== 1) { | ||
throw new \Exception('Invalid input'); | ||
} | ||
|
||
assertType("'apple'|'orange'", $matches['fruit']);; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php // lint >= 7.4 | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Bug12210; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
function bug12210a(string $text): void { | ||
assert(preg_match('(((sum|min|max)))', $text, $match) === 1); | ||
assertType("array{string, 'max'|'min'|'sum', 'max'|'min'|'sum'}", $match); | ||
} | ||
|
||
function bug12210b(string $text): void { | ||
assert(preg_match('(((sum|min|ma.)))', $text, $match) === 1); | ||
assertType("array{string, non-empty-string, non-falsy-string}", $match); | ||
} | ||
|
||
function bug12210c(string $text): void { | ||
assert(preg_match('(((su.|min|max)))', $text, $match) === 1); | ||
assertType("array{string, non-empty-string, non-falsy-string}", $match); | ||
} | ||
|
||
function bug12210d(string $text): void { | ||
assert(preg_match('(((sum|mi.|max)))', $text, $match) === 1); | ||
assertType("array{string, non-empty-string, non-falsy-string}", $match); | ||
} |