mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 22:01:48 +01:00
Merge pull request #9568 from iFixit/sealed-properties--add-config-for-assumption
@property annotations: allow *not* implying @psalm-seal-properties
This commit is contained in:
commit
49cf5d07cc
@ -62,6 +62,7 @@
|
||||
<xs:attribute name="reportMixedIssues" type="xs:boolean" default="true" />
|
||||
<xs:attribute name="useDocblockTypes" type="xs:boolean" default="true" />
|
||||
<xs:attribute name="useDocblockPropertyTypes" type="xs:boolean" default="false" />
|
||||
<xs:attribute name="docblockPropertyTypesSealProperties" type="xs:boolean" default="true" />
|
||||
<xs:attribute name="usePhpDocMethodsWithoutMagicCall" type="xs:boolean" default="false" />
|
||||
<xs:attribute name="usePhpDocPropertiesWithoutMagicCall" type="xs:boolean" default="false" />
|
||||
<xs:attribute name="skipChecksOnUnresolvableIncludes" type="xs:boolean" default="false" />
|
||||
|
@ -90,6 +90,15 @@ Whether or not to use types as defined in docblocks. Defaults to `true`.
|
||||
```
|
||||
If not using all docblock types, you can still use docblock property types. Defaults to `false` (though only relevant if `useDocblockTypes` is `false`).
|
||||
|
||||
#### docblockPropertyTypesSealProperties
|
||||
|
||||
```xml
|
||||
<psalm
|
||||
docblockPropertyTypesSealProperties="[bool]"
|
||||
>
|
||||
```
|
||||
Whether using @property in class docblocks should imply @psalm-seal-properties. Defaults to `true`.
|
||||
|
||||
#### usePhpDocMethodsWithoutMagicCall
|
||||
|
||||
```xml
|
||||
|
@ -194,6 +194,13 @@ class Config
|
||||
*/
|
||||
public $use_docblock_property_types = false;
|
||||
|
||||
/**
|
||||
* Whether using property annotations in docblocks should implicitly seal properties
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $docblock_property_types_seal_properties = true;
|
||||
|
||||
/**
|
||||
* Whether or not to throw an exception on first error
|
||||
*
|
||||
@ -1049,6 +1056,7 @@ class Config
|
||||
$booleanAttributes = [
|
||||
'useDocblockTypes' => 'use_docblock_types',
|
||||
'useDocblockPropertyTypes' => 'use_docblock_property_types',
|
||||
'docblockPropertyTypesSealProperties' => 'docblock_property_types_seal_properties',
|
||||
'throwExceptionOnError' => 'throw_exception',
|
||||
'hideExternalErrors' => 'hide_external_errors',
|
||||
'hideAllErrorsExceptPassedFiles' => 'hide_all_errors_except_passed_files',
|
||||
|
@ -568,7 +568,9 @@ class ClassLikeNodeScanner
|
||||
}
|
||||
}
|
||||
|
||||
$storage->sealed_properties = true;
|
||||
if ($this->config->docblock_property_types_seal_properties) {
|
||||
$storage->sealed_properties = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($docblock_info->methods as $method) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user