1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Finish documenting Mixed* issues

This commit is contained in:
Matthew Brown 2017-12-24 01:11:08 +01:00
parent e2e1094ec6
commit 392faecebc

View File

@ -510,7 +510,7 @@ Emitted when Psalm cannot determine the type of an argument
```php ```php
function takesInt(int $i) : void {} function takesInt(int $i) : void {}
takesInt($_COOKIE['foo']); takesInt($_GET['foo']);
``` ```
### MixedArrayAccess ### MixedArrayAccess
@ -518,7 +518,7 @@ takesInt($_COOKIE['foo']);
Emitted when trying to access an array offset on a value whose type Psalm cannot determine Emitted when trying to access an array offset on a value whose type Psalm cannot determine
```php ```php
echo $_COOKIE['foo'][0]; echo $_GET['foo'][0];
``` ```
### MixedArrayAssignment ### MixedArrayAssignment
@ -526,7 +526,7 @@ echo $_COOKIE['foo'][0];
Emitted when trying to assign a value to an array offset on a value whose type Psalm cannot determine Emitted when trying to assign a value to an array offset on a value whose type Psalm cannot determine
```php ```php
$_COOKIE['foo'][0] = "5"; $_GET['foo'][0] = "5";
``` ```
### MixedArrayOffset ### MixedArrayOffset
@ -534,7 +534,7 @@ $_COOKIE['foo'][0] = "5";
Emitted when attempting to access an array offset where Psalm cannot determine the offset type Emitted when attempting to access an array offset where Psalm cannot determine the offset type
```php ```php
echo [1, 2, 3][$_COOKIE['foo']]; echo [1, 2, 3][$_GET['foo']];
``` ```
### MixedAssignment ### MixedAssignment
@ -542,63 +542,79 @@ echo [1, 2, 3][$_COOKIE['foo']];
Emitted when Emitted when
```php ```php
$a = $_COOKIE['foo']; $a = $_GET['foo'];
``` ```
### MixedInferredReturnType ### MixedInferredReturnType
Emitted when Emitted when Psalm cannot determine a function's return type
```php ```php
function foo() : int {
return $_GET['foo'];
}
``` ```
### MixedMethodCall ### MixedMethodCall
Emitted when Emitted when calling a method on a value that Psalm cannot infer a type for
```php ```php
/** @param mixed $a */
function foo($a) : void {
$a->foo();
}
``` ```
### MixedOperand ### MixedOperand
Emitted when Emitted when Psalm cannot infer a type for an operand in any calculated expression
```php ```php
echo $_GET['foo'] + "hello";
``` ```
### MixedPropertyAssignment ### MixedPropertyAssignment
Emitted when Emitted when assigning a property to a value that Psalm cannot infer a type for
```php ```php
/** @param mixed $a */
function foo($a) : void {
$a->foo = "bar";
}
``` ```
### MixedPropertyFetch ### MixedPropertyFetch
Emitted when Emitted when retrieving a property on a value that Psalm cannot infer a type for
```php ```php
/** @param mixed $a */
function foo($a) : void {
echo $a->foo;
}
``` ```
### MixedStringOffsetAssignment ### MixedStringOffsetAssignment
Emitted when Emitted when assigning a value on a string using a value for which Psalm cannot infer a type
```php ```php
"hello"[$_GET['foo']] = "h";
``` ```
### MixedTypeCoercion ### MixedTypeCoercion
Emitted when Emitted when Psalm cannot be sure that part of an array/iterabble argument's type constraints can be fulfilled
```php ```php
function foo(array $a) : void {
takesStringArray($a);
}
/** @param string[] $a */
function takesStringArray(array $a) : void {}
``` ```
### MoreSpecificImplementedReturnType ### MoreSpecificImplementedReturnType