mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Update to latest php-cs-fixer
This commit is contained in:
parent
5df10cfca6
commit
062d46c132
@ -32,8 +32,8 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.7.4",
|
||||
"friendsofphp/php-cs-fixer": "^2.3",
|
||||
"squizlabs/php_codesniffer": "^3.0"
|
||||
"squizlabs/php_codesniffer": "^3.0",
|
||||
"friendsofphp/php-cs-fixer": "^2.8"
|
||||
},
|
||||
"scripts": {
|
||||
"psalm": "./bin/psalm",
|
||||
|
582
composer.lock
generated
582
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -919,7 +919,8 @@ abstract class FunctionLikeChecker extends SourceChecker implements StatementsSo
|
||||
CodeLocation $secondary_return_type_location = null
|
||||
) {
|
||||
if (!$this->function->getStmts() &&
|
||||
($this->function instanceof ClassMethod &&
|
||||
(
|
||||
$this->function instanceof ClassMethod &&
|
||||
($this->getSource() instanceof InterfaceChecker || $this->function->isAbstract())
|
||||
)
|
||||
) {
|
||||
|
@ -423,7 +423,8 @@ class ProjectChecker
|
||||
$selection_length = $selection_bounds[1] - $selection_bounds[0];
|
||||
|
||||
echo $location->file_name . ':' . $location->getLineNumber() . PHP_EOL .
|
||||
($this->use_color
|
||||
(
|
||||
$this->use_color
|
||||
? substr($snippet, 0, $selection_start) .
|
||||
"\e[97;42m" . substr($snippet, $selection_start, $selection_length) .
|
||||
"\e[0m" . substr($snippet, $selection_length + $selection_start)
|
||||
@ -1792,7 +1793,8 @@ class ProjectChecker
|
||||
|| !$this->existing_classes_lc[$fq_class_name_lc]
|
||||
|| !$this->classlike_storage_provider->has($fq_class_name_lc)
|
||||
) {
|
||||
if ((!isset($this->existing_classes_lc[$fq_class_name_lc])
|
||||
if ((
|
||||
!isset($this->existing_classes_lc[$fq_class_name_lc])
|
||||
|| $this->existing_classes_lc[$fq_class_name_lc] === true
|
||||
)
|
||||
&& !$this->classlike_storage_provider->has($fq_class_name_lc)
|
||||
@ -1840,7 +1842,8 @@ class ProjectChecker
|
||||
|| !$this->existing_interfaces_lc[$fq_class_name_lc]
|
||||
|| !$this->classlike_storage_provider->has($fq_class_name_lc)
|
||||
) {
|
||||
if ((!isset($this->existing_classes_lc[$fq_class_name_lc])
|
||||
if ((
|
||||
!isset($this->existing_classes_lc[$fq_class_name_lc])
|
||||
|| $this->existing_classes_lc[$fq_class_name_lc] === true
|
||||
)
|
||||
&& !$this->classlike_storage_provider->has($fq_class_name_lc)
|
||||
|
@ -180,7 +180,8 @@ class ForeachChecker
|
||||
$iterator_type->value,
|
||||
'Iterator'
|
||||
) ||
|
||||
(InterfaceChecker::interfaceExists($project_checker, $iterator_type->value)
|
||||
(
|
||||
InterfaceChecker::interfaceExists($project_checker, $iterator_type->value)
|
||||
&& InterfaceChecker::interfaceExtends(
|
||||
$project_checker,
|
||||
$iterator_type->value,
|
||||
@ -212,7 +213,8 @@ class ForeachChecker
|
||||
$iterator_type->value,
|
||||
'Traversable'
|
||||
) ||
|
||||
(InterfaceChecker::interfaceExists($project_checker, $iterator_type->value)
|
||||
(
|
||||
InterfaceChecker::interfaceExists($project_checker, $iterator_type->value)
|
||||
&& InterfaceChecker::interfaceExtends(
|
||||
$project_checker,
|
||||
$iterator_type->value,
|
||||
|
@ -919,7 +919,8 @@ class AssertionFinder
|
||||
if ($conditional->right instanceof PhpParser\Node\Expr\FuncCall &&
|
||||
$conditional->right->name instanceof PhpParser\Node\Name &&
|
||||
strtolower($conditional->right->name->parts[0]) === 'get_class' &&
|
||||
($conditional->left instanceof PhpParser\Node\Scalar\String_
|
||||
(
|
||||
$conditional->left instanceof PhpParser\Node\Scalar\String_
|
||||
|| ($conditional->left instanceof PhpParser\Node\Expr\ClassConstFetch
|
||||
&& $conditional->left->class instanceof PhpParser\Node\Name
|
||||
&& is_string($conditional->left->name)
|
||||
@ -932,7 +933,8 @@ class AssertionFinder
|
||||
if ($conditional->left instanceof PhpParser\Node\Expr\FuncCall &&
|
||||
$conditional->left->name instanceof PhpParser\Node\Name &&
|
||||
strtolower($conditional->left->name->parts[0]) === 'get_class' &&
|
||||
($conditional->right instanceof PhpParser\Node\Scalar\String_
|
||||
(
|
||||
$conditional->right instanceof PhpParser\Node\Scalar\String_
|
||||
|| ($conditional->right instanceof PhpParser\Node\Expr\ClassConstFetch
|
||||
&& $conditional->right->class instanceof PhpParser\Node\Name
|
||||
&& is_string($conditional->right->name)
|
||||
|
@ -603,7 +603,8 @@ class AssignmentChecker
|
||||
// but we don't want to throw an error
|
||||
// Hack has a similar issue: https://github.com/facebook/hhvm/issues/5164
|
||||
if ($lhs_type_part instanceof TObject ||
|
||||
($lhs_type_part instanceof TNamedObject &&
|
||||
(
|
||||
$lhs_type_part instanceof TNamedObject &&
|
||||
in_array(
|
||||
strtolower($lhs_type_part->value),
|
||||
['stdclass', 'simplexmlelement', 'dateinterval', 'domdocument', 'domnode'],
|
||||
|
@ -1393,7 +1393,8 @@ class CallChecker
|
||||
|
||||
if ($stmt->class instanceof PhpParser\Node\Name
|
||||
&& ($stmt->class->parts[0] !== 'parent' || $statements_checker->isStatic())
|
||||
&& (!$context->self
|
||||
&& (
|
||||
!$context->self
|
||||
|| $statements_checker->isStatic()
|
||||
|| !ClassChecker::classExtends($project_checker, $context->self, $fq_class_name)
|
||||
)
|
||||
|
@ -192,7 +192,8 @@ class FetchChecker
|
||||
// but we don't want to throw an error
|
||||
// Hack has a similar issue: https://github.com/facebook/hhvm/issues/5164
|
||||
if ($lhs_type_part instanceof TObject ||
|
||||
($lhs_type_part instanceof TNamedObject &&
|
||||
(
|
||||
$lhs_type_part instanceof TNamedObject &&
|
||||
in_array(strtolower($lhs_type_part->value), ['stdclass', 'simplexmlelement'], true)
|
||||
)
|
||||
) {
|
||||
|
@ -559,7 +559,8 @@ class ExpressionChecker
|
||||
'_SESSION',
|
||||
'_REQUEST',
|
||||
'_ENV',
|
||||
], true
|
||||
],
|
||||
true
|
||||
)
|
||||
) {
|
||||
$stmt->inferredType = Type::getArray();
|
||||
|
@ -1038,8 +1038,10 @@ class TypeChecker
|
||||
strtolower($container_type_part->value) === 'iterable' &&
|
||||
(
|
||||
$input_type_part instanceof TArray ||
|
||||
($input_type_part instanceof TNamedObject &&
|
||||
(strtolower($input_type_part->value) === 'traversable' ||
|
||||
(
|
||||
$input_type_part instanceof TNamedObject &&
|
||||
(
|
||||
strtolower($input_type_part->value) === 'traversable' ||
|
||||
ClassChecker::classExtendsOrImplements(
|
||||
$project_checker,
|
||||
$input_type_part->value,
|
||||
@ -1077,9 +1079,11 @@ class TypeChecker
|
||||
}
|
||||
|
||||
if ($container_type_part instanceof TCallable &&
|
||||
($input_type_part instanceof TString ||
|
||||
(
|
||||
$input_type_part instanceof TString ||
|
||||
$input_type_part instanceof TArray ||
|
||||
($input_type_part instanceof TNamedObject &&
|
||||
(
|
||||
$input_type_part instanceof TNamedObject &&
|
||||
ClassChecker::classExists($project_checker, $input_type_part->value) &&
|
||||
MethodChecker::methodExists($project_checker, $input_type_part->value . '::__invoke')
|
||||
)
|
||||
@ -1090,9 +1094,11 @@ class TypeChecker
|
||||
}
|
||||
|
||||
if ($input_type_part instanceof TCallable &&
|
||||
($container_type_part instanceof TString ||
|
||||
(
|
||||
$container_type_part instanceof TString ||
|
||||
$container_type_part instanceof TArray ||
|
||||
($container_type_part instanceof TNamedObject &&
|
||||
(
|
||||
$container_type_part instanceof TNamedObject &&
|
||||
ClassChecker::classExists($project_checker, $container_type_part->value) &&
|
||||
MethodChecker::methodExists($project_checker, $container_type_part->value . '::__invoke')
|
||||
)
|
||||
@ -1122,7 +1128,8 @@ class TypeChecker
|
||||
} elseif ($container_type_part instanceof TNamedObject &&
|
||||
$input_type_part instanceof TNamedObject &&
|
||||
ClassChecker::classOrInterfaceExists($project_checker, $input_type_part->value) &&
|
||||
((
|
||||
(
|
||||
(
|
||||
ClassChecker::classExists($project_checker, $container_type_part->value) &&
|
||||
ClassChecker::classExtendsOrImplements(
|
||||
$project_checker,
|
||||
@ -1130,7 +1137,8 @@ class TypeChecker
|
||||
$input_type_part->value
|
||||
)
|
||||
) ||
|
||||
(InterfaceChecker::interfaceExists($project_checker, $container_type_part->value) &&
|
||||
(
|
||||
InterfaceChecker::interfaceExists($project_checker, $container_type_part->value) &&
|
||||
InterfaceChecker::interfaceExtends(
|
||||
$project_checker,
|
||||
$container_type_part->value,
|
||||
@ -1580,7 +1588,8 @@ class TypeChecker
|
||||
$string_input_part = (string)$type_part;
|
||||
|
||||
if ($type_part !== $container_type_part &&
|
||||
!($container_type_part instanceof TInt
|
||||
!(
|
||||
$container_type_part instanceof TInt
|
||||
|| $container_type_part instanceof TFloat
|
||||
|| $container_type_part instanceof TCallable
|
||||
|| ($container_type_part instanceof TString && $type_part instanceof TCallable)
|
||||
|
@ -46,10 +46,13 @@ class Pool
|
||||
) {
|
||||
$pool_size = count($process_task_data_iterator);
|
||||
|
||||
\assert($pool_size > 1,
|
||||
'The pool size must be >= 2 to use the fork pool.');
|
||||
\assert(
|
||||
$pool_size > 1,
|
||||
'The pool size must be >= 2 to use the fork pool.'
|
||||
);
|
||||
|
||||
\assert(extension_loaded('pcntl'),
|
||||
\assert(
|
||||
extension_loaded('pcntl'),
|
||||
'The pcntl extension must be loaded in order for Psalm to be able to fork.'
|
||||
);
|
||||
|
||||
|
@ -96,7 +96,7 @@ class MethodMutationTest extends TestCase
|
||||
|
||||
$this->assertSame('UserViewData', (string)$method_context->vars_in_scope['$this->user_viewdata']);
|
||||
$this->assertSame('string', (string)$method_context->vars_in_scope['$this->user_viewdata->name']);
|
||||
$this->assertSame(true, $method_context->vars_possibly_in_scope['$this->title']);
|
||||
$this->assertTrue($method_context->vars_possibly_in_scope['$this->title']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user