1
0
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:
Brown 2020-01-31 15:24:44 -05:00
parent 66227f9b7f
commit adbe44d7bb
2 changed files with 1 additions and 43 deletions

View File

@ -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) {

View File

@ -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);
}
}',
]
];
}