Skip to content

Commit cf8fbf1

Browse files
committed
Update Type for Param, property, return etc.
1 parent d7efc4e commit cf8fbf1

20 files changed

+208
-209
lines changed

Action/ActionHandlerInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
interface ActionHandlerInterface
88
{
9-
public function setAppInstance(ApplicationInterface $instance): ActionHandlerInterface ;
9+
public function setAppInstance(ApplicationInterface $instance): ActionHandlerInterface;
1010

11-
public function setControllerNamespace(string $namespace): ActionHandlerInterface ;
11+
public function setControllerNamespace(string $namespace): ActionHandlerInterface;
1212

13-
public function add(string $name, $callback, int $priority = 10): void ;
13+
public function add(string $name, $callback, int $priority = 10): void;
1414
}

Api/ApiHandlerInterface.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@
1010
interface ApiHandlerInterface
1111
{
1212

13-
public function setAppInstance(ApplicationInterface $instance): ApiHandlerInterface;
13+
public function setAppInstance(ApplicationInterface $instance): self;
1414

15-
public function setNamespace(string $namespace): ApiHandlerInterface;
15+
public function setNamespace(string $namespace): self;
1616

17-
public function setMiddleware(array $list): ApiHandlerInterface;
17+
public function setMiddleware(array $list): self;
1818

19-
public function setControllerNamespace(string $namespace): ApiHandlerInterface;
19+
public function setControllerNamespace(string $namespace): self;
2020

21-
public function loadRoutes(string $routes): ApiHandlerInterface;
21+
public function loadRoutes(string $routes): self;
2222

23-
public function register(array $api, bool $dynamicRoute = false): void ;
23+
public function register(array $api, bool $dynamicRoute = false): void;
2424

25-
public function apiGenerate(): void ;
25+
public function apiGenerate(): void;
2626

2727
public function resolveDynamicCallback(WP_REST_Request $request);
2828

29-
public function check_permission(): bool ;
29+
public function check_permission(): bool;
3030

3131
}

Cache/CacheHandlerInterface.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
interface CacheHandlerInterface
66
{
77

8-
public function createFile(string $fileName, string $content, string $directory = '');
8+
public function createFile(string $fileName, string $content, string $directory = ''): int|false;
99

10-
public function cacheFilePath(string $fileName, string $directory = ''):string;
10+
public function cacheFilePath(string $fileName, string $directory = ''): string;
1111

12-
public function check(string $fileName, string $directory = ''): bool ;
12+
public function check(string $fileName, string $directory = ''): bool;
1313

14-
public function reset(string $fileName = ''): bool ;
14+
public function reset(string $fileName = ''): bool;
1515

16-
public function setAppVersion(string $instance): CacheHandlerInterface;
16+
public function setAppVersion(string $instance): self;
1717

18-
public function setCachePath(string $path): CacheHandlerInterface;
18+
public function setCachePath(string $path): self;
1919

20-
public function get(string $fileName, string $directory = ''): string ;
20+
public function get(string $fileName, string $directory = ''): string;
2121

2222
}

Config/ConfigHandlerInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
interface ConfigHandlerInterface
66
{
7-
public function setPath(string $path): string ;
7+
public function setPath(string $path): string;
88

9-
public function resolveData(string $key);
9+
public function resolveData(string $key): mixed;
1010

1111
}

Config/ConfigInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
interface ConfigInterface
66
{
7-
public static function get($key);
7+
public static function get($key): mixed;
88

99
public static function set($key);
1010

DB/DBInterface.php

Lines changed: 76 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,145 +4,152 @@
44
namespace PluginMaster\Contracts\DB;
55

66

7+
use Closure;
8+
79
interface DBInterface
810
{
911
/**
10-
* @param $name
11-
* @return mixed
12+
* @param string $name
13+
* @return self
1214
*/
13-
static public function table($name);
15+
static public function table(string $name): self;
1416

1517

1618
/**
17-
* @param $closer
18-
* @return mixed
19+
* @param Closure $closer
20+
* @return ?self
1921
*/
20-
static public function transaction($closer);
22+
static public function transaction(Closure $closer): ?self;
2123

2224
/**
23-
* @param $column
24-
* @param null $operator
25+
* @param string|Closure $column
26+
* @param string|null $operator
2527
* @param null $value
26-
* @return mixed
28+
* @return self
2729
*/
28-
public function where($column, $operator = null, $value = null);
30+
public function where(string|Closure $column, ?string $operator = null, mixed $value = null): self;
2931

3032
/**
31-
* @param $table
32-
* @param $first
33-
* @param null $operator
34-
* @param null $second
33+
* @param string $table
34+
* @param string|Closure $first
35+
* @param string|null $operator
36+
* @param string|null $second
3537
* @return mixed
3638
*/
37-
public function join($table, $first, $operator = null, $second = null);
39+
public function join(string $table, string|Closure $first, ?string $operator = null, ?string $second = null): self;
3840

3941
/**
40-
* @param $table
41-
* @param $first
42-
* @param null $operator
43-
* @param null $second
44-
* @return mixed
42+
* @param string $table
43+
* @param string|Closure $first
44+
* @param string|null $operator
45+
* @param string|null $second
46+
* @return self
4547
*/
46-
public function leftJoin($table, $first, $operator = null, $second = null);
48+
public function leftJoin(
49+
string $table,
50+
string|Closure $first,
51+
?string $operator = null,
52+
?string $second = null
53+
): self;
4754

4855
/**
49-
* @param $first
50-
* @param $operator
51-
* @param $second
52-
* @return mixed
56+
* @param string $first
57+
* @param string $operator
58+
* @param string $second
59+
* @return self
5360
*/
54-
public function on($first, $operator, $second);
61+
public function on(string $first, string $operator, string $second): self;
5562

5663
/**
57-
* @param $first
58-
* @param $operator
59-
* @param $second
60-
* @return mixed
64+
* @param string $first
65+
* @param string $operator
66+
* @param string $second
67+
* @return self
6168
*/
62-
public function orOn($first, $operator, $second);
69+
public function orOn(string $first, string $operator, string $second): self;
6370

6471
/**
65-
* @param $column
66-
* @param null $operator
72+
* @param string $column
73+
* @param string|null $operator
6774
* @param null $value
68-
* @return mixed
75+
* @return self
6976
*/
70-
public function onWhere($column, $operator = null, $value = null);
77+
public function onWhere(string $column, ?string $operator = null, mixed $value = null): self;
7178

7279
/**
73-
* @param $column
74-
* @param null $operator
80+
* @param string|Closure $column
81+
* @param string|null $operator
7582
* @param null $value
76-
* @return mixed
83+
* @return self
7784
*/
78-
public function orWhere($column, $operator = null, $value = null);
85+
public function orWhere(string|Closure $column, ?string $operator = null, mixed $value = null): self;
7986

8087
/**
81-
* @param $columns
82-
* @param $direction
83-
* @return mixed
88+
* @param string $columns
89+
* @param string $direction
90+
* @return self
8491
*/
85-
public function orderBy($columns, $direction);
92+
public function orderBy(string $columns, string $direction): self;
8693

8794

8895
/**
89-
* @param $number
90-
* @return mixed
96+
* @param string|int $number
97+
* @return self
9198
*/
92-
public function limit($number);
99+
public function limit(string|int $number): self;
93100

94101

95102
/**
96-
* @param $number
97-
* @return mixed
103+
* @param string|int $number
104+
* @return self
98105
*/
99-
public function offset($number);
106+
public function offset(string|int $number): self;
100107

101108

102109
/**
103-
* @param $number
104-
* @return mixed
110+
* @param string|int $column
111+
* @return self
105112
*/
106-
public function groupBy($number);
113+
public function groupBy(string|int $column): self;
107114

108115
/**
109-
* @param $fields
110-
* @return mixed
116+
* @param string $fields
117+
* @return self
111118
*/
112-
public function select($fields);
119+
public function select(string $fields): self;
113120

114121
/**
115-
* @param $data
116-
* @return mixed
122+
* @param array $data
123+
* @return int|null
117124
*/
118-
public function insert($data);
125+
public function insert(array $data): ?int;
119126

120127
/**
121-
* @param $data
122-
* @return mixed
128+
* @param array $data
129+
* @return bool|int|null
123130
*/
124-
public function update($data);
131+
public function update(array $data): bool|int|null;
125132

126133

127134
/**
128-
* @return mixed
135+
* @return bool|int|null
129136
*/
130-
public function delete();
137+
public function delete(): bool|int|null;
131138

132139
/**
133-
* @return mixed
140+
* @return object|null
134141
*/
135-
public function first();
142+
public function first(): object|null;
136143

137144
/**
138-
* @return mixed
145+
* @return array|object|null
139146
*/
140-
public function get();
147+
public function get(): array|object|null;
141148

142149
/**
143-
* @return mixed
150+
* @return string
144151
*/
145-
public function toSql();
152+
public function toSql(): string;
146153

147154
}
148155

Database/MigrationInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
interface MigrationInterface
66
{
77

8-
public static function handler();
8+
public static function handler(): void;
99

1010
}

Enqueue/EnqueueHandlerInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
interface EnqueueHandlerInterface
1010
{
1111

12-
public function setAppInstance(ApplicationInterface $app): EnqueueHandlerInterface;
12+
public function setAppInstance(ApplicationInterface $app): self;
1313

14-
public function loadEnqueueFile(string $enqueueFile);
14+
public function loadEnqueueFile(string $enqueueFile): void;
1515

1616
public function register(array $config): void;
1717

Enqueue/EnqueueInterface.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@
77
interface EnqueueInterface
88
{
99

10-
public static function front();
10+
public static function front(): self;
1111

12-
public static function on($hook);
12+
public static function on(string $hook): self;
1313

14-
public static function admin();
14+
public static function admin(): self;
1515

16-
public function headerScript($path, $options = []);
16+
public function headerScript(string $path, array $options = []): void;
1717

18-
public function headerScriptCdn($path, $options = []);
18+
public function headerScriptCdn(string $path, array $options = []): void;
1919

20-
public function footerScript($path, $options = []);
20+
public function footerScript(string $path, array $options = []): void;
2121

22-
public function footerScriptCdn($path, $options = []);
22+
public function footerScriptCdn(string $path, array $options = []): void;
2323

24-
public function style($path, $options = []);
24+
public function style(string $path, array $options = []): void;
2525

26-
public function styleCdn($path, $options = []);
26+
public function styleCdn(string $path, array $options = []): void;
2727

28-
public function localizeScript($handle, $objectName, $data);
28+
public function localizeScript(string $handle, string $objectName, mixed $data): void;
2929

30-
public function inlineScript($data, $option = []);
30+
public function inlineScript(string $data, array $option = []): void;
3131

32-
public function inlineStyle($data, $handle = '');
32+
public function inlineStyle(string $data, string $handle = ''): void;
3333

3434
}

Middleware/MiddlewareInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66

77
interface MiddlewareInterface
88
{
9-
public function handler(WP_REST_Request $request);
9+
public function handler(WP_REST_Request $request): bool;
1010
}

0 commit comments

Comments
 (0)