mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Optionally allow trait static calls and property access
This commit is contained in:
parent
2f58c6afc8
commit
e878eeb6d0
@ -37,6 +37,8 @@
|
||||
<xs:attribute name="allowFileIncludes" type="xs:boolean" default="true" />
|
||||
<xs:attribute name="allowPhpStormGenerics" type="xs:boolean" default="false" />
|
||||
<xs:attribute name="allowStringToStandInForClass" type="xs:boolean" default="false" />
|
||||
<xs:attribute name="allowTraitStaticCall" type="xs:boolean" default="false" />
|
||||
<xs:attribute name="allowTraitStaticPropertyAccess" type="xs:boolean" default="false" />
|
||||
<xs:attribute name="checkForThrowsDocblock" type="xs:boolean" default="false" />
|
||||
<xs:attribute name="checkForThrowsInGlobalScope" type="xs:boolean" default="false" />
|
||||
<xs:attribute name="ensureArrayIntOffsetsExist" type="xs:boolean" default="false" />
|
||||
|
@ -474,6 +474,15 @@ class Config
|
||||
*/
|
||||
public $allow_named_arg_calls = true;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $allow_trait_static_call = false;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $allow_trait_static_property_access = false;
|
||||
|
||||
/** @var array<string, mixed> */
|
||||
private $predefined_constants = [];
|
||||
|
||||
@ -754,6 +763,8 @@ class Config
|
||||
'reportInfo' => 'report_info',
|
||||
'restrictReturnTypes' => 'restrict_return_types',
|
||||
'limitMethodComplexity' => 'limit_method_complexity',
|
||||
'allowTraitStaticCall' => 'allow_trait_static_call',
|
||||
'allowTraitStaticPropertyAccess' => 'allow_trait_static_property_access',
|
||||
];
|
||||
|
||||
foreach ($booleanAttributes as $xmlName => $internalName) {
|
||||
|
@ -148,7 +148,7 @@ class StaticCallAnalyzer extends CallAnalyzer
|
||||
: null,
|
||||
$statements_analyzer->getSuppressedIssues(),
|
||||
false,
|
||||
false,
|
||||
$codebase->config->allow_trait_static_call,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
@ -91,7 +91,8 @@ class StaticPropertyFetchAnalyzer
|
||||
$context->self,
|
||||
$context->calling_method_id,
|
||||
$statements_analyzer->getSuppressedIssues(),
|
||||
false
|
||||
false,
|
||||
$codebase->config->allow_trait_static_property_access
|
||||
) !== true) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user