mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
4.x - change/remove some default config values
This commit is contained in:
parent
819f2e2f27
commit
9bbb11599a
@ -57,21 +57,18 @@
|
|||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
</xs:attribute>
|
</xs:attribute>
|
||||||
<xs:attribute name="memoizeMethodCallResults" type="xs:boolean" default="false" />
|
<xs:attribute name="memoizeMethodCallResults" type="xs:boolean" default="false" />
|
||||||
<xs:attribute name="parseSql" type="xs:boolean" default="false" />
|
|
||||||
<xs:attribute name="rememberPropertyAssignmentsAfterCall" type="xs:boolean" default="true" />
|
<xs:attribute name="rememberPropertyAssignmentsAfterCall" type="xs:boolean" default="true" />
|
||||||
<xs:attribute name="requireVoidReturnType" type="xs:boolean" default="true" />
|
<xs:attribute name="resolveFromConfigFile" type="xs:boolean" default="true" />
|
||||||
<xs:attribute name="resolveFromConfigFile" type="xs:boolean" default="false" />
|
|
||||||
<xs:attribute name="strictBinaryOperands" type="xs:boolean" default="false" />
|
<xs:attribute name="strictBinaryOperands" type="xs:boolean" default="false" />
|
||||||
<xs:attribute name="throwExceptionOnError" type="xs:boolean" default="false" />
|
<xs:attribute name="throwExceptionOnError" type="xs:boolean" default="false" />
|
||||||
<xs:attribute name="totallyTyped" type="xs:boolean" default="false" />
|
<xs:attribute name="totallyTyped" type="xs:boolean" default="false" />
|
||||||
<xs:attribute name="errorLevel" type="xs:integer" default="1" />
|
<xs:attribute name="errorLevel" type="xs:integer" default="1" />
|
||||||
<xs:attribute name="reportMixedIssues" type="xs:boolean" default="true" />
|
<xs:attribute name="reportMixedIssues" type="xs:boolean" default="true" />
|
||||||
<xs:attribute name="useAssertForType" type="xs:boolean" default="true" />
|
|
||||||
<xs:attribute name="useDocblockTypes" 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="useDocblockPropertyTypes" type="xs:boolean" default="false" />
|
||||||
<xs:attribute name="usePhpDocMethodsWithoutMagicCall" type="xs:boolean" default="false" />
|
<xs:attribute name="usePhpDocMethodsWithoutMagicCall" type="xs:boolean" default="false" />
|
||||||
<xs:attribute name="usePhpDocPropertiesWithoutMagicCall" type="xs:boolean" default="false" />
|
<xs:attribute name="usePhpDocPropertiesWithoutMagicCall" type="xs:boolean" default="false" />
|
||||||
<xs:attribute name="skipChecksOnUnresolvableIncludes" type="xs:boolean" default="true" />
|
<xs:attribute name="skipChecksOnUnresolvableIncludes" type="xs:boolean" default="false" />
|
||||||
<xs:attribute name="sealAllMethods" type="xs:boolean" default="false" />
|
<xs:attribute name="sealAllMethods" type="xs:boolean" default="false" />
|
||||||
<xs:attribute name="runTaintAnalysis" type="xs:boolean" default="false" />
|
<xs:attribute name="runTaintAnalysis" type="xs:boolean" default="false" />
|
||||||
<xs:attribute name="usePhpStormMetaPath" type="xs:boolean" default="true" />
|
<xs:attribute name="usePhpStormMetaPath" type="xs:boolean" default="true" />
|
||||||
|
@ -267,16 +267,6 @@ class Config
|
|||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $strict_binary_operands = false;
|
public $strict_binary_operands = false;
|
||||||
|
|
||||||
/** @var bool */
|
|
||||||
public $add_void_docblocks = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If true, assert() calls can be used to check types of variables
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
public $use_assert_for_type = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
@ -419,12 +409,9 @@ class Config
|
|||||||
public $use_phpstorm_meta_path = true;
|
public $use_phpstorm_meta_path = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to resolve file and directory paths from the location of the config file,
|
|
||||||
* instead of the current working directory.
|
|
||||||
*
|
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
public $resolve_from_config_file = false;
|
public $resolve_from_config_file = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[]
|
* @var string[]
|
||||||
@ -588,11 +575,6 @@ class Config
|
|||||||
*/
|
*/
|
||||||
public $globals = [];
|
public $globals = [];
|
||||||
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
public $parse_sql = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
@ -807,8 +789,6 @@ class Config
|
|||||||
'resolveFromConfigFile' => 'resolve_from_config_file',
|
'resolveFromConfigFile' => 'resolve_from_config_file',
|
||||||
'allowFileIncludes' => 'allow_includes',
|
'allowFileIncludes' => 'allow_includes',
|
||||||
'strictBinaryOperands' => 'strict_binary_operands',
|
'strictBinaryOperands' => 'strict_binary_operands',
|
||||||
'requireVoidReturnType' => 'add_void_docblocks',
|
|
||||||
'useAssertForType' => 'use_assert_for_type',
|
|
||||||
'rememberPropertyAssignmentsAfterCall' => 'remember_property_assignments_after_call',
|
'rememberPropertyAssignmentsAfterCall' => 'remember_property_assignments_after_call',
|
||||||
'allowPhpStormGenerics' => 'allow_phpstorm_generics',
|
'allowPhpStormGenerics' => 'allow_phpstorm_generics',
|
||||||
'allowStringToStandInForClass' => 'allow_string_standin_for_class',
|
'allowStringToStandInForClass' => 'allow_string_standin_for_class',
|
||||||
@ -939,11 +919,6 @@ class Config
|
|||||||
$config->max_string_length = $attribute_text;
|
$config->max_string_length = $attribute_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($config_xml['parseSql'])) {
|
|
||||||
$attribute_text = (string) $config_xml['parseSql'];
|
|
||||||
$config->parse_sql = $attribute_text === 'true' || $attribute_text === '1';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($config_xml['inferPropertyTypesFromConstructor'])) {
|
if (isset($config_xml['inferPropertyTypesFromConstructor'])) {
|
||||||
$attribute_text = (string) $config_xml['inferPropertyTypesFromConstructor'];
|
$attribute_text = (string) $config_xml['inferPropertyTypesFromConstructor'];
|
||||||
$config->infer_property_types_from_constructor = $attribute_text === 'true' || $attribute_text === '1';
|
$config->infer_property_types_from_constructor = $attribute_text === 'true' || $attribute_text === '1';
|
||||||
|
@ -222,10 +222,6 @@ class ReturnTypeAnalyzer
|
|||||||
$inferred_return_type = $inferred_yield_type;
|
$inferred_return_type = $inferred_yield_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$return_type && !$codebase->config->add_void_docblocks && $inferred_return_type->isVoid()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$unsafe_return_type = false;
|
$unsafe_return_type = false;
|
||||||
|
|
||||||
// prevent any return types that do not return a value from being used in PHP typehints
|
// prevent any return types that do not return a value from being used in PHP typehints
|
||||||
|
@ -394,10 +394,9 @@ class FunctionCallAnalyzer extends CallAnalyzer
|
|||||||
$context->vars_possibly_in_scope[$var_id] = true;
|
$context->vars_possibly_in_scope[$var_id] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($config->use_assert_for_type &&
|
if ($function_name instanceof PhpParser\Node\Name
|
||||||
$function_name instanceof PhpParser\Node\Name &&
|
&& $function_name->parts === ['assert']
|
||||||
$function_name->parts === ['assert'] &&
|
&& isset($stmt->args[0])
|
||||||
isset($stmt->args[0])
|
|
||||||
) {
|
) {
|
||||||
self::processAssertFunctionEffects(
|
self::processAssertFunctionEffects(
|
||||||
$statements_analyzer,
|
$statements_analyzer,
|
||||||
|
@ -23,7 +23,6 @@ class ValueTest extends \Psalm\Tests\TestCase
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->project_analyzer->setPhpVersion('7.3');
|
$this->project_analyzer->setPhpVersion('7.3');
|
||||||
$this->project_analyzer->getCodebase()->config->parse_sql = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user