1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00

docs: provide some background as to what certain hooks are for (#3978)

This commit is contained in:
feek 2020-08-11 04:29:45 -07:00 committed by GitHub
parent e81593f359
commit 7fe7146dc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 0 deletions

View File

@ -11,6 +11,10 @@ interface FunctionExistenceProviderInterface
public static function getFunctionIds() : array; public static function getFunctionIds() : array;
/** /**
* Use this hook for informing whether or not a global function exists. If you know the function does
* not exist, return false. If you aren't sure if it exists or not, return null and the default analysis will continue
* to determine if the function actually exists.
*
* @return ?bool * @return ?bool
*/ */
public static function doesFunctionExist( public static function doesFunctionExist(

View File

@ -15,6 +15,10 @@ interface FunctionReturnTypeProviderInterface
public static function getFunctionIds() : array; public static function getFunctionIds() : array;
/** /**
* Use this hook for providing custom return type logic. If this plugin does not know what a function should return
* but another plugin may be able to determine the type, return null. Otherwise return a mixed union type if something
* should be returned, but can't be more specific.
*
* @param array<PhpParser\Node\Arg> $call_args * @param array<PhpParser\Node\Arg> $call_args
* *
* @return ?Type\Union * @return ?Type\Union

View File

@ -12,6 +12,10 @@ interface MethodExistenceProviderInterface
public static function getClassLikeNames() : array; public static function getClassLikeNames() : array;
/** /**
* Use this hook for informing whether or not a method exists on a given object. If you know the method does
* not exist, return false. If you aren't sure if it exists or not, return null and the default analysis will continue
* to determine if the method actually exists.
*
* @return ?bool * @return ?bool
*/ */
public static function doesMethodExist( public static function doesMethodExist(

View File

@ -15,6 +15,10 @@ interface MethodReturnTypeProviderInterface
public static function getClassLikeNames() : array; public static function getClassLikeNames() : array;
/** /**
* Use this hook for providing custom return type logic. If this plugin does not know what a method should return
* but another plugin may be able to determine the type, return null. Otherwise return a mixed union type if something
* should be returned, but can't be more specific.
*
* @param array<PhpParser\Node\Arg> $call_args * @param array<PhpParser\Node\Arg> $call_args
* @param ?array<Type\Union> $template_type_parameters * @param ?array<Type\Union> $template_type_parameters
* @param lowercase-string $method_name_lowercase * @param lowercase-string $method_name_lowercase

View File

@ -13,6 +13,10 @@ interface PropertyExistenceProviderInterface
public static function getClassLikeNames() : array; public static function getClassLikeNames() : array;
/** /**
* Use this hook for informing whether or not a property exists on a given object. If you know the property does
* not exist, return false. If you aren't sure if it exists or not, return null and the default analysis will continue
* to determine if the property actually exists.
*
* @return ?bool * @return ?bool
*/ */
public static function doesPropertyExist( public static function doesPropertyExist(