-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes phpstan/phpstan#5266 Closes phpstan/phpstan#6922 Closes phpstan/phpstan#9309 Closes phpstan/phpstan#9394
- Loading branch information
1 parent
a849f06
commit a4e2bfe
Showing
10 changed files
with
135 additions
and
0 deletions.
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,18 @@ | ||
<?php | ||
|
||
namespace Bug9394; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
class Order | ||
{ | ||
public bool $is_pre_order; | ||
} | ||
|
||
function (?Order $order): void { | ||
if ($order?->is_pre_order === false) { | ||
return; | ||
} | ||
|
||
assertType(Order::class . '|null', $order); | ||
}; |
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,26 @@ | ||
<?php | ||
|
||
namespace Bug6922b; | ||
|
||
final class Configuration | ||
{ | ||
public function isFirstOptionActive(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function isSecondOptionActive(): bool | ||
{ | ||
return true; | ||
} | ||
} | ||
|
||
function run(?Configuration $configuration): void | ||
{ | ||
if ( | ||
$configuration?->isFirstOptionActive() === false || | ||
$configuration?->isSecondOptionActive() === false) | ||
{ | ||
// .... | ||
} | ||
} |
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,9 @@ | ||
<?php | ||
|
||
namespace Bug9309; | ||
|
||
function a(): int { | ||
declare(ticks=1) { | ||
return 1; | ||
} | ||
} |
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,25 @@ | ||
<?php // lint >= 8.0 | ||
|
||
namespace Bug6922; | ||
|
||
class Person { | ||
|
||
public function __construct( | ||
public readonly string $name, | ||
public readonly bool $isDeveloper, | ||
public readonly bool $isAdmin | ||
) { | ||
|
||
} | ||
} | ||
|
||
class Proof | ||
{ | ||
public function test(?Person $person): void | ||
{ | ||
if ($person?->isDeveloper === FALSE || | ||
$person?->isAdmin === FALSE) { | ||
echo "Bug"; | ||
} | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
namespace Bug5266; | ||
|
||
class TestEnums | ||
{ | ||
const SORT_ASC = 'sort_asc'; | ||
const SORT_DESC = 'sort_desc'; | ||
|
||
/** | ||
* @param self::SORT_ASC|self::SORT_DESC $sortType | ||
*/ | ||
public function sort(string $sortType): void | ||
{ | ||
if ($sortType === self::SORT_ASC) { | ||
$message = 'Sorting ASC'; | ||
} elseif ($sortType === self::SORT_DESC) { | ||
$message = 'Sorting DESC'; | ||
} | ||
|
||
echo $message . '\n'; | ||
} | ||
} |