1
0
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:
Matthew Brown 2020-08-09 08:36:20 -04:00 committed by GitHub
parent 90a50be9f0
commit 855c62d256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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];
}
}
```