1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Add MissingParamType documentation

This commit is contained in:
Matthew Brown 2020-07-28 23:56:32 -04:00 committed by GitHub
parent 8fe1fbc085
commit 38f74815d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -222,6 +222,53 @@ class C {
C::foo("hello"); C::foo("hello");
``` ```
### MissingParamType
Running `vendor/bin/psalter --issues=MissingParamType` on
```php
<?php
class A {
public $foo;
public $bar;
public function __construct()
{
if (rand(0, 1)) {
$this->foo = 5;
} else {
$this->foo = "hello";
}
$this->bar = "baz";
}
}
```
gives
```php
<?php
class A {
/**
* @var string|int
*/
public $foo;
public string $bar;
public function __construct()
{
if (rand(0, 1)) {
$this->foo = 5;
} else {
$this->foo = "hello";
}
$this->bar = "baz";
}
}
```
### MismatchingDocblockParamType ### MismatchingDocblockParamType
Given Given