mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Add documentation and schema entry for inferPropertyTypesFromConstructor
Fixes vimeo/psalm#5974
This commit is contained in:
parent
6d4d1668f6
commit
f24f361a95
@ -59,6 +59,7 @@
|
||||
<xs:attribute name="ignoreInternalFunctionFalseReturn" type="xs:boolean" default="true" />
|
||||
<xs:attribute name="ignoreInternalFunctionNullReturn" type="xs:boolean" default="true" />
|
||||
<xs:attribute name="includePhpVersionsInErrorBaseline" type="xs:boolean" default="false" />
|
||||
<xs:attribute name="inferPropertyTypesFromConstructor" type="xs:boolean" default="true" />
|
||||
<xs:attribute name="loadXdebugStub" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation xml:lang="en">
|
||||
|
@ -213,6 +213,15 @@ When `true`, Psalm ignores possibly-false issues stemming from return values of
|
||||
```
|
||||
When `true`, Psalm ignores possibly-null issues stemming from return values of internal array functions (like `current`) that may return null, but do so rarely. Defaults to `true`.
|
||||
|
||||
#### inferPropertyTypesFromConstructor
|
||||
|
||||
```xml
|
||||
<psalm
|
||||
inferPropertyTypesFromConstructor="[bool]"
|
||||
>
|
||||
```
|
||||
When `true`, Psalm infers property types from assignments seen in straightforward constructors. Defaults to `true`.
|
||||
|
||||
#### findUnusedVariablesAndParams
|
||||
```xml
|
||||
<psalm
|
||||
|
@ -1341,6 +1341,15 @@ class ConfigTest extends \Psalm\Tests\TestCase
|
||||
$this->assertContains('datetime', $this->project_analyzer->getConfig()->getUniversalObjectCrates());
|
||||
}
|
||||
|
||||
public function testInferPropertyTypesFromConstructorIsRead(): void
|
||||
{
|
||||
$cfg = Config::loadFromXML(
|
||||
dirname(__DIR__, 2),
|
||||
'<?xml version="1.0"?><psalm inferPropertyTypesFromConstructor="false"></psalm>'
|
||||
);
|
||||
$this->assertFalse($cfg->infer_property_types_from_constructor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array{0: int, 1: int|null}>
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user