mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Revert countable checks
This commit is contained in:
parent
66227f9b7f
commit
adbe44d7bb
@ -2327,14 +2327,7 @@ class AssertionReconciler extends \Psalm\Type\Reconciler
|
||||
) {
|
||||
$did_remove_type = true;
|
||||
|
||||
if ($type instanceof TNamedObject
|
||||
&& $codebase->classlikes->classExists($type->value)
|
||||
&& $codebase->classlikes->classImplements($type->value, 'Countable')
|
||||
) {
|
||||
// do nothing
|
||||
} else {
|
||||
$existing_var_type->removeType($type_key);
|
||||
}
|
||||
$existing_var_type->removeType($type_key);
|
||||
}
|
||||
|
||||
if ($type instanceof TTemplateParam) {
|
||||
|
@ -890,41 +890,6 @@ class AssertAnnotationTest extends TestCase
|
||||
return $value;
|
||||
}'
|
||||
],
|
||||
'allowEmptyAssertionOnCountableObject' => [
|
||||
'<?php
|
||||
class Foo implements \Countable
|
||||
{
|
||||
/** @var array */
|
||||
protected $data;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->data = [];
|
||||
}
|
||||
|
||||
public function count() : int
|
||||
{
|
||||
return count($this->data);
|
||||
}
|
||||
}
|
||||
|
||||
class Test
|
||||
{
|
||||
/**
|
||||
* @param mixed $actual
|
||||
*
|
||||
* @psalm-assert empty $actual
|
||||
*/
|
||||
public static function assertEmpty($actual): void {}
|
||||
|
||||
public function test() : void
|
||||
{
|
||||
$foo = new Foo();
|
||||
|
||||
$this->assertEmpty($foo);
|
||||
}
|
||||
}',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user