mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Add more examples of added types
This commit is contained in:
parent
90a50be9f0
commit
855c62d256
@ -231,6 +231,7 @@ Running `vendor/bin/psalter --issues=MissingPropertyType` on
|
||||
class A {
|
||||
public $foo;
|
||||
public $bar;
|
||||
public $baz;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -242,6 +243,10 @@ class A {
|
||||
|
||||
$this->bar = "baz";
|
||||
}
|
||||
|
||||
public function setBaz() {
|
||||
$this->baz = [1, 2, 3];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -257,6 +262,12 @@ class A {
|
||||
|
||||
public string $bar;
|
||||
|
||||
/**
|
||||
* @var array<int, int>|null
|
||||
* @psalm-var non-empty-list<int>|null
|
||||
*/
|
||||
public $baz;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
if (rand(0, 1)) {
|
||||
@ -267,6 +278,10 @@ class A {
|
||||
|
||||
$this->bar = "baz";
|
||||
}
|
||||
|
||||
public function setBaz() {
|
||||
$this->baz = [1, 2, 3];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user