Commit c206e08
authored
Add generic type to the
Generic will allow the method to infer the type returned based on the
argument type. For example:
```php
/** @var array<string,string> $arr */
$arr = ['foo' => ''];
$val = Str::toSnakeCase($arr); // Type: string.
/** @var array<string,non-empty-string> $arr */
$arr = ['foo' => 'bar_123'];
$val = Str::toSnakeCase($arr); // Type: non-empty-string.
```Str utility methods (#62)1 parent 8c28930 commit c206e08
File tree
5 files changed
+235
-177
lines changed- .devcontainer
- .github/workflows
- app
- tests/app
5 files changed
+235
-177
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | | - | |
24 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 29 | | |
47 | 30 | | |
48 | 31 | | |
49 | 32 | | |
50 | 33 | | |
51 | | - | |
| 34 | + | |
52 | 35 | | |
53 | 36 | | |
54 | 37 | | |
| |||
73 | 56 | | |
74 | 57 | | |
75 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
76 | 66 | | |
77 | | - | |
78 | | - | |
79 | | - | |
| 67 | + | |
80 | 68 | | |
81 | 69 | | |
82 | 70 | | |
| |||
0 commit comments