*/ public static function getClassLikeNames() : array { return ['Ns\Foo']; } public static function doesMethodExist( string $fq_classlike_name, string $method_name_lowercase, ?StatementsSource $source = null, ?CodeLocation $code_location = null ): ?bool { if ($method_name_lowercase === 'magicmethod' || $method_name_lowercase === 'magicmethod2') { return true; } return null; } /** * @param array $call_args * * @return ?array */ public static function getMethodParams( string $fq_classlike_name, string $method_name_lowercase, ?array $call_args = null, ?StatementsSource $statements_source = null, ?Context $context = null, ?CodeLocation $code_location = null ): ?array { if ($method_name_lowercase === 'magicmethod' || $method_name_lowercase === 'magicmethod2') { return [new \Psalm\Storage\FunctionLikeParameter('first', false, Type::getString())]; } return null; } /** * @param array $call_args * */ public static function getMethodReturnType( StatementsSource $source, string $fq_classlike_name, string $method_name_lowercase, array $call_args, Context $context, CodeLocation $code_location, ?array $template_type_parameters = null, ?string $called_fq_classlike_name = null, ?string $called_method_name_lowercase = null ): ?Type\Union { if ($method_name_lowercase === 'magicmethod') { return Type::getString(); } else { return new \Psalm\Type\Union([new \Psalm\Type\Atomic\TNamedObject('NS\\Foo2')]); } } }