*/ public static function getClassLikeNames() : array { return ['Ns\Foo']; } public static function doesMethodExist(MethodExistenceProviderEvent $event): ?bool { $method_name_lowercase = $event->getMethodNameLowercase(); if ($method_name_lowercase === 'magicmethod' || $method_name_lowercase === 'magicmethod2') { return true; } return null; } /** * @return ?array */ public static function getMethodParams(MethodParamsProviderEvent $event): ?array { $method_name_lowercase = $event->getMethodNameLowercase(); if ($method_name_lowercase === 'magicmethod' || $method_name_lowercase === 'magicmethod2') { return [new \Psalm\Storage\FunctionLikeParameter('first', false, Type::getString())]; } return null; } public static function getMethodReturnType(MethodReturnTypeProviderEvent $event): ?Type\Union { $method_name_lowercase = $event->getMethodNameLowercase(); if ($method_name_lowercase === 'magicmethod') { return Type::getString(); } else { return new \Psalm\Type\Union([new \Psalm\Type\Atomic\TNamedObject('NS\\Foo2')]); } } }