STR:
1) installed and enabled ds extension
2) any psalm config with error level 4 (see example below)
3) class which implements Ds\Hashable and declares hashable method like this: public function equals($obj): bool (just like in polyfill stubs [1] and in extension [2])
Expected: no error - parameter named just like in polyfill and extension
Actual:
ERROR: ParamNameMismatch
at .../test.php:9:28
Argument 1 of Issue::equals has wrong name $obj, expecting $object as defined by Ds\Hashable::equals (see https://psalm.dev/230)
public function equals($obj): bool
class
<?php
declare(strict_types=1);
use Ds\Hashable;
class Issue implements Hashable
{
public function equals($obj): bool
{
if (false === $obj instanceof static) {
return false;
}
return true;
}
public function hash(): string
{
return 'foobar';
}
}
https://psalm.dev/r/ac4b9d77f6 (cannot be reproduced in playground - no installed
ds
extension)STR: 1) installed and enabled
ds
extension 2) any psalm config with error level 4 (see example below) 3) class which implementsDs\Hashable
and declareshashable
method like this:public function equals($obj): bool
(just like in polyfill stubs [1] and in extension [2])Expected: no error - parameter named just like in polyfill and extension
Actual:
class
psalm config
Possible reason - parameter name declared in psalm's CallMap:
[1] https://github.com/php-ds/polyfill/blob/7b2c5f1843466d50769a0682ce6fa9ddaaa99cb4/src/Hashable.php#L25-L31 [2] https://github.com/php-ds/ext-ds/blob/5f8915dae22596ce468543b78591170a7da8736d/src/php/classes/php_hashable_ce.c#L8-L15