Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Commit d501e9f

Browse files
author
Andrey Helldar
committed
Typing updated
1 parent fcc6c4d commit d501e9f

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

src/Support/Instance.php

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ public static function basename(Throwable $class): string
5252
return basename(str_replace('\\', '/', $class));
5353
}
5454

55-
public static function call($object, string $method)
55+
/**
56+
* @param Throwable $object
57+
* @param string $method
58+
*
59+
* @return bool
60+
*/
61+
public static function call(Throwable $object, string $method)
5662
{
5763
if (method_exists($object, $method)) {
5864
return call_user_func([$object, $method]);
@@ -61,7 +67,13 @@ public static function call($object, string $method)
6167
return null;
6268
}
6369

64-
public static function callsWhenNotEmpty($object, $methods)
70+
/**
71+
* @param Throwable $object
72+
* @param string|array $methods
73+
*
74+
* @return mixed|null
75+
*/
76+
public static function callsWhenNotEmpty(Throwable $object, $methods)
6577
{
6678
$methods = Arr::wrap($methods);
6779

@@ -74,34 +86,54 @@ public static function callsWhenNotEmpty($object, $methods)
7486
return null;
7587
}
7688

89+
/**
90+
* @param mixed $value
91+
*
92+
* @return bool
93+
*/
7794
protected static function isExistsObject($value): bool
7895
{
7996
return static::isObject($value) ?: static::isClassExists($value);
8097
}
8198

99+
/**
100+
* @param mixed $value
101+
*
102+
* @return bool
103+
*/
82104
protected static function isClassExists($class): bool
83105
{
84106
return is_string($class) && class_exists($class);
85107
}
86108

109+
/**
110+
* @param mixed $value
111+
*
112+
* @return bool
113+
*/
87114
protected static function isObject($value): bool
88115
{
89116
return is_object($value);
90117
}
91118

92119
/**
93-
* @param object|string $class
120+
* @param Throwable $class
94121
*
95122
* @throws \ReflectionException
96123
*
97124
* @return \ReflectionClass
98125
*/
99-
protected static function reflection($class)
126+
protected static function reflection(Throwable $class): ReflectionClass
100127
{
101128
return new ReflectionClass($class);
102129
}
103130

104-
protected static function make($class)
131+
/**
132+
* @param Throwable|string $class
133+
*
134+
* @return Throwable
135+
*/
136+
protected static function make($class): Throwable
105137
{
106138
$is_object = static::isObject($class);
107139

0 commit comments

Comments
 (0)