Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added more integer range vs. int constants tests
- Loading branch information
Showing
2 changed files
with
74 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
47 changes: 47 additions & 0 deletions
47
tests/PHPStan/Rules/Properties/data/int-ranges-and-constants.php
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,47 @@ | ||
<?php | ||
|
||
namespace IntegerRangesAndConstants; | ||
|
||
class HelloWorld | ||
{ | ||
/** @var 0|1|3 */ | ||
public $i = 0; | ||
/** @var 0|1|2|3|string */ | ||
public $j = 0; | ||
/** @var 0|1|bool|2|3 */ | ||
public $k = 0; | ||
/** @var 0|1|2|3|4|5 */ | ||
public $l; | ||
|
||
public function test(): void { | ||
$this->i = random_int(0, 3); | ||
$this->j = random_int(0, 3); | ||
$this->k = random_int(0, 3); | ||
$this->l = random_int(0, 3); | ||
} | ||
|
||
/** | ||
* @var int<0,3> | ||
*/ | ||
public $x = 0; | ||
|
||
/** | ||
* @param 0| $a | ||
* @param 0|1 $b | ||
* @param 0|1|3 $c | ||
* @param 0|1|2|3|string $j | ||
* @param 0|1|bool|2|3 $k | ||
* @param 0|1|bool|3 $l | ||
* @param 0|1|3|4 $m | ||
*/ | ||
public function test2($a, $b, $c, $j, $k, $l, $m): void { | ||
$this->x = $a; | ||
$this->x = $b; | ||
$this->x = $c; | ||
|
||
$this->x = $j; | ||
$this->x = $k; | ||
$this->x = $l; | ||
$this->x = $m; | ||
} | ||
} |