mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
parent
3c9ec90919
commit
4f07a8fc5d
@ -85,6 +85,7 @@ class MethodComparator
|
|||||||
$implementer_method_storage,
|
$implementer_method_storage,
|
||||||
$guide_method_storage->signature_return_type,
|
$guide_method_storage->signature_return_type,
|
||||||
$cased_guide_method_id,
|
$cased_guide_method_id,
|
||||||
|
$implementer_called_class_name,
|
||||||
$cased_implementer_method_id,
|
$cased_implementer_method_id,
|
||||||
$code_location,
|
$code_location,
|
||||||
$suppressed_issues
|
$suppressed_issues
|
||||||
@ -658,6 +659,7 @@ class MethodComparator
|
|||||||
MethodStorage $implementer_method_storage,
|
MethodStorage $implementer_method_storage,
|
||||||
Type\Union $guide_signature_return_type,
|
Type\Union $guide_signature_return_type,
|
||||||
string $cased_guide_method_id,
|
string $cased_guide_method_id,
|
||||||
|
string $implementer_called_class_name,
|
||||||
string $cased_implementer_method_id,
|
string $cased_implementer_method_id,
|
||||||
CodeLocation $code_location,
|
CodeLocation $code_location,
|
||||||
array $suppressed_issues
|
array $suppressed_issues
|
||||||
@ -684,8 +686,12 @@ class MethodComparator
|
|||||||
? ExpressionAnalyzer::fleshOutType(
|
? ExpressionAnalyzer::fleshOutType(
|
||||||
$codebase,
|
$codebase,
|
||||||
$implementer_method_storage->signature_return_type,
|
$implementer_method_storage->signature_return_type,
|
||||||
$implementer_classlike_storage->name,
|
$implementer_classlike_storage->is_trait
|
||||||
$implementer_classlike_storage->name,
|
? $implementer_called_class_name
|
||||||
|
: $implementer_classlike_storage->name,
|
||||||
|
$implementer_classlike_storage->is_trait
|
||||||
|
? $implementer_called_class_name
|
||||||
|
: $implementer_classlike_storage->name,
|
||||||
$implementer_classlike_storage->parent_class
|
$implementer_classlike_storage->parent_class
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
|
@ -748,6 +748,31 @@ class MethodSignatureTest extends TestCase
|
|||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
],
|
],
|
||||||
|
'allowMatchIn74' => [
|
||||||
|
'<?php
|
||||||
|
trait FooTrait {
|
||||||
|
/**
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function bar(): self {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface FooInterface {
|
||||||
|
/**
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function bar(): self;
|
||||||
|
}
|
||||||
|
|
||||||
|
class FooClass implements FooInterface {
|
||||||
|
use FooTrait;
|
||||||
|
}',
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
'7.4'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1250,6 +1275,32 @@ class MethodSignatureTest extends TestCase
|
|||||||
}',
|
}',
|
||||||
'error_message' => 'MethodSignatureMismatch',
|
'error_message' => 'MethodSignatureMismatch',
|
||||||
],
|
],
|
||||||
|
'preventTraitMatchIn73' => [
|
||||||
|
'<?php
|
||||||
|
trait FooTrait {
|
||||||
|
/**
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function bar(): self {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface FooInterface {
|
||||||
|
/**
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function bar(): self;
|
||||||
|
}
|
||||||
|
|
||||||
|
class FooClass implements FooInterface {
|
||||||
|
use FooTrait;
|
||||||
|
}',
|
||||||
|
'error_message' => 'MethodSignatureMismatch',
|
||||||
|
[],
|
||||||
|
false,
|
||||||
|
'7.3'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user