|
39 | 39 |
|
40 | 40 | /**
|
41 | 41 | * @param array<string, string> $where
|
42 |
| - * @param array<string, string> $with |
| 42 | + * @param array<string, mixed> $with |
43 | 43 | */
|
44 |
| - public static function get(string $path, mixed $callback, array $where = [], array $with = [], ?string $name = null): RouteElement |
45 |
| - { |
| 44 | + public static function get( |
| 45 | + string $path, |
| 46 | + mixed $callback, |
| 47 | + array $where = [], |
| 48 | + array $with = [], |
| 49 | + ?string $name = null |
| 50 | + ): RouteElement { |
46 | 51 | return new RouteElement(self::GET, $path, $callback, $where, $with, $name);
|
47 | 52 | }
|
48 | 53 |
|
49 | 54 | /**
|
50 | 55 | * @param array<string, string> $where
|
51 |
| - * @param array<string, string> $with |
| 56 | + * @param array<string, mixed> $with |
52 | 57 | */
|
53 |
| - public static function post(string $path, mixed $callback, array $where = [], array $with = [], ?string $name = null): RouteElement |
54 |
| - { |
| 58 | + public static function post( |
| 59 | + string $path, |
| 60 | + mixed $callback, |
| 61 | + array $where = [], |
| 62 | + array $with = [], |
| 63 | + ?string $name = null |
| 64 | + ): RouteElement { |
55 | 65 | return new RouteElement(self::POST, $path, $callback, $where, $with, $name);
|
56 | 66 | }
|
57 | 67 |
|
58 | 68 | /**
|
59 | 69 | * @param array<string, string> $where
|
60 |
| - * @param array<string, string> $with |
| 70 | + * @param array<string, mixed> $with |
61 | 71 | */
|
62 |
| - public static function put(string $path, mixed $callback, array $where = [], array $with = [], ?string $name = null): RouteElement |
63 |
| - { |
| 72 | + public static function put( |
| 73 | + string $path, |
| 74 | + mixed $callback, |
| 75 | + array $where = [], |
| 76 | + array $with = [], |
| 77 | + ?string $name = null |
| 78 | + ): RouteElement { |
64 | 79 | return new RouteElement(self::PUT, $path, $callback, $where, $with, $name);
|
65 | 80 | }
|
66 | 81 |
|
67 | 82 | /**
|
68 | 83 | * @param array<string, string> $where
|
69 |
| - * @param array<string, string> $with |
| 84 | + * @param array<string, mixed> $with |
70 | 85 | */
|
71 |
| - public static function patch(string $path, mixed $callback, array $where = [], array $with = [], ?string $name = null): RouteElement |
72 |
| - { |
| 86 | + public static function patch( |
| 87 | + string $path, |
| 88 | + mixed $callback, |
| 89 | + array $where = [], |
| 90 | + array $with = [], |
| 91 | + ?string $name = null |
| 92 | + ): RouteElement { |
73 | 93 | return new RouteElement(self::PATCH, $path, $callback, $where, $with, $name);
|
74 | 94 | }
|
75 | 95 |
|
76 | 96 | /**
|
77 | 97 | * @param array<string, string> $where
|
78 |
| - * @param array<string, string> $with |
| 98 | + * @param array<string, mixed> $with |
79 | 99 | */
|
80 |
| - public static function delete(string $path, mixed $callback, array $where = [], array $with = [], ?string $name = null): RouteElement |
81 |
| - { |
| 100 | + public static function delete( |
| 101 | + string $path, |
| 102 | + mixed $callback, |
| 103 | + array $where = [], |
| 104 | + array $with = [], |
| 105 | + ?string $name = null |
| 106 | + ): RouteElement { |
82 | 107 | return new RouteElement(self::DELETE, $path, $callback, $where, $with, $name);
|
83 | 108 | }
|
84 | 109 |
|
85 | 110 | /**
|
86 | 111 | * @param array<string, string> $where
|
87 |
| - * @param array<string, string> $with |
| 112 | + * @param array<string, mixed> $with |
88 | 113 | */
|
89 |
| - public static function head(string $path, mixed $callback, array $where = [], array $with = [], ?string $name = null): RouteElement |
90 |
| - { |
| 114 | + public static function head( |
| 115 | + string $path, |
| 116 | + mixed $callback, |
| 117 | + array $where = [], |
| 118 | + array $with = [], |
| 119 | + ?string $name = null |
| 120 | + ): RouteElement { |
91 | 121 | return new RouteElement(self::HEAD, $path, $callback, $where, $with, $name);
|
92 | 122 | }
|
93 | 123 |
|
94 | 124 | /**
|
95 | 125 | * @param array<string, string> $where
|
96 |
| - * @param array<string, string> $with |
| 126 | + * @param array<string, mixed> $with |
97 | 127 | */
|
98 |
| - public static function options(string $path, mixed $callback, array $where = [], array $with = [], ?string $name = null): RouteElement |
99 |
| - { |
| 128 | + public static function options( |
| 129 | + string $path, |
| 130 | + mixed $callback, |
| 131 | + array $where = [], |
| 132 | + array $with = [], |
| 133 | + ?string $name = null |
| 134 | + ): RouteElement { |
100 | 135 | return new RouteElement(self::OPTIONS, $path, $callback, $where, $with, $name);
|
101 | 136 | }
|
102 | 137 |
|
103 | 138 | /**
|
104 | 139 | * @param array<string, string> $where
|
105 |
| - * @param array<string, string> $with |
| 140 | + * @param array<string, mixed> $with |
106 | 141 | */
|
107 |
| - public static function any(string $path, mixed $callback, array $where = [], array $with = [], ?string $name = null): RouteElement |
108 |
| - { |
| 142 | + public static function any( |
| 143 | + string $path, |
| 144 | + mixed $callback, |
| 145 | + array $where = [], |
| 146 | + array $with = [], |
| 147 | + ?string $name = null |
| 148 | + ): RouteElement { |
109 | 149 | return new RouteElement(self::ANY, $path, $callback, $where, $with, $name);
|
110 | 150 | }
|
111 | 151 |
|
112 | 152 | /**
|
113 | 153 | * @param string[] $methods
|
114 | 154 | * @param array<string, string> $where
|
115 |
| - * @param array<string, string> $with |
| 155 | + * @param array<string, mixed> $with |
116 | 156 | */
|
117 |
| - public static function some(array $methods, string $path, mixed $callback, array $where = [], array $with = [], ?string $name = null): RouteElement |
118 |
| - { |
119 |
| - $method = array_reduce($methods, static fn($carry, $methodString): int => $carry | self::METHODS[strtoupper($methodString)], 0); |
| 157 | + public static function some( |
| 158 | + array $methods, |
| 159 | + string $path, |
| 160 | + mixed $callback, |
| 161 | + array $where = [], |
| 162 | + array $with = [], |
| 163 | + ?string $name = null |
| 164 | + ): RouteElement { |
| 165 | + $method = array_reduce( |
| 166 | + $methods, |
| 167 | + static fn($carry, $methodString): int => $carry | self::METHODS[strtoupper($methodString)], |
| 168 | + 0 |
| 169 | + ); |
120 | 170 |
|
121 | 171 | return new RouteElement($method, $path, $callback, $where, $with, $name);
|
122 | 172 | }
|
|
0 commit comments