Skip to content

Commit da91e4b

Browse files
committed
pint
1 parent 61448e8 commit da91e4b

File tree

4 files changed

+86
-16
lines changed

4 files changed

+86
-16
lines changed

pint.json

+73-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,80 @@
11
{
2+
"exclude": [
3+
"nova"
4+
],
25
"preset": "psr12",
3-
"exclude": [],
46
"rules": {
7+
"array_syntax": {
8+
"syntax": "short"
9+
},
10+
"binary_operator_spaces": true,
11+
"blank_line_before_statement": {
12+
"statements": [
13+
"break",
14+
"continue",
15+
"declare",
16+
"exit",
17+
"foreach",
18+
"if",
19+
"return",
20+
"switch",
21+
"throw",
22+
"try",
23+
"while",
24+
"yield"
25+
]
26+
},
27+
"combine_consecutive_issets": true,
28+
"combine_consecutive_unsets": true,
29+
"concat_space": {
30+
"spacing": "none"
31+
},
32+
"explicit_indirect_variable": true,
33+
"explicit_string_variable": true,
34+
"global_namespace_import": true,
35+
"method_argument_space": {
36+
"keep_multiple_spaces_after_comma": false,
37+
"on_multiline": "ensure_fully_multiline"
38+
},
539
"no_superfluous_phpdoc_tags": true,
40+
"no_unused_imports": true,
41+
"not_operator_with_successor_space": true,
42+
"nullable_type_declaration_for_default_null_value": true,
43+
"ordered_imports": {
44+
"imports_order": [
45+
"class",
46+
"const",
47+
"function"
48+
],
49+
"sort_algorithm": "alpha"
50+
},
51+
"ordered_interfaces": {
52+
"case_sensitive": false,
53+
"direction": "ascend",
54+
"order": "alpha"
55+
},
56+
"ordered_types": {
57+
"case_sensitive": false,
58+
"null_adjustment": "always_last",
59+
"sort_algorithm": "alpha"
60+
},
661
"phpdoc_annotation_without_dot": true,
762
"phpdoc_no_useless_inheritdoc": true,
8-
"phpdoc_trim": true
63+
"phpdoc_scalar": true,
64+
"phpdoc_single_line_var_spacing": true,
65+
"phpdoc_trim": true,
66+
"phpdoc_var_without_name": true,
67+
"single_trait_insert_per_statement": true,
68+
"single_quote": true,
69+
"trailing_comma_in_multiline": {
70+
"elements": [
71+
"arguments",
72+
"arrays",
73+
"match",
74+
"parameters"
75+
]
76+
},
77+
"type_declaration_spaces": true,
78+
"unary_operator_spaces": true
979
}
10-
}
80+
}

src/Dispatcher/FakeDispatcher.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ class FakeDispatcher extends ActualDispatcher implements Fake
2222
/**
2323
* List of actions to fake
2424
*
25-
* @var array<class-string<Actionable>|(Closure(Actionable $action): bool)>
25+
* @var array<class-string<Actionable>|(Closure(Actionable): bool)>
2626
*/
2727
protected array $actionsToFake = [];
2828

2929
/**
3030
* List of actions to dispatch
3131
*
32-
* @var array<class-string<Actionable>|(Closure(Actionable $action): bool)>
32+
* @var array<class-string<Actionable>|(Closure(Actionable): bool)>
3333
*/
3434
protected array $actionsToDispatch = [];
3535

@@ -49,7 +49,7 @@ class FakeDispatcher extends ActualDispatcher implements Fake
4949
* @param class-string<Actionable>|array<class-string<Actionable>|(Closure(Actionable $action): bool)>|(Closure(Actionable $action): bool) $actionsToFake
5050
*/
5151
public function __construct(
52-
array|string|Closure $actionsToFake,
52+
array|Closure|string $actionsToFake,
5353
Container $container,
5454
EventDispatcher $events,
5555
DatabaseManager $db,
@@ -63,7 +63,7 @@ public function __construct(
6363
*
6464
* @param class-string<Actionable>|array<class-string<Actionable>|(Closure(Actionable $action): bool)>|(Closure(Actionable $action): bool) $actionsToFake
6565
*/
66-
public function addFake(array|string|Closure $actionsToFake): static
66+
public function addFake(array|Closure|string $actionsToFake): static
6767
{
6868
return $this->with($actionsToFake);
6969
}
@@ -73,7 +73,7 @@ public function addFake(array|string|Closure $actionsToFake): static
7373
*
7474
* @param class-string<Actionable>|array<class-string<Actionable>|(Closure(Actionable $action): bool)>|(Closure(Actionable $action): bool) $actionsToFake
7575
*/
76-
public function with(array|string|Closure $actionsToFake): static
76+
public function with(array|Closure|string $actionsToFake): static
7777
{
7878
$this->actionsToFake = array_merge($this->actionsToFake, Arr::wrap($actionsToFake));
7979

@@ -85,7 +85,7 @@ public function with(array|string|Closure $actionsToFake): static
8585
*
8686
* @param class-string<Actionable>|array<class-string<Actionable>|(Closure(Actionable $action): bool)>|(Closure(Actionable $action): bool) $actionsToDispatch
8787
*/
88-
public function removeFake(array|string|Closure $actionsToDispatch): static
88+
public function removeFake(array|Closure|string $actionsToDispatch): static
8989
{
9090
return $this->except($actionsToDispatch);
9191
}
@@ -95,7 +95,7 @@ public function removeFake(array|string|Closure $actionsToDispatch): static
9595
*
9696
* @param class-string<Actionable>|array<class-string<Actionable>|(Closure(Actionable $action): bool)>|(Closure(Actionable $action): bool) $actionsToDispatch
9797
*/
98-
public function except(array|string|Closure $actionsToDispatch): static
98+
public function except(array|Closure|string $actionsToDispatch): static
9999
{
100100
$this->actionsToDispatch = array_merge($this->actionsToDispatch, Arr::wrap($actionsToDispatch));
101101

@@ -185,7 +185,7 @@ protected function shouldDispatchCommand(Actionable $action): bool
185185
/**
186186
* Assert if a job was dispatched based on a truth-test callback.
187187
*/
188-
public function assertDispatched(string|Closure $command, Closure|int|null $callback = null): static
188+
public function assertDispatched(Closure|string $command, Closure|int|null $callback = null): static
189189
{
190190
if ($command instanceof Closure) {
191191
[$command, $callback] = [$this->firstClosureParameterType($command), $command];
@@ -208,7 +208,7 @@ public function assertDispatched(string|Closure $command, Closure|int|null $call
208208
/**
209209
* Assert if a job was pushed a number of times.
210210
*/
211-
public function assertDispatchedTimes(string|Closure $command, int $times = 1): static
211+
public function assertDispatchedTimes(Closure|string $command, int $times = 1): static
212212
{
213213
$callback = null;
214214

@@ -232,7 +232,7 @@ public function assertDispatchedTimes(string|Closure $command, int $times = 1):
232232
/**
233233
* Determine if a job was dispatched based on a truth-test callback.
234234
*/
235-
public function assertNotDispatched(string|Closure $command, Closure $callback = null): static
235+
public function assertNotDispatched(Closure|string $command, ?Closure $callback = null): static
236236
{
237237
if ($command instanceof Closure) {
238238
[$command, $callback] = [$this->firstClosureParameterType($command), $command];

src/Duration.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public function toString(): string
6666

6767
$format = '';
6868

69-
$format .= $hours > 0 ? sprintf('%02d', $hours) . ':' : '';
70-
$format .= sprintf('%02d', $minutes) . ':';
69+
$format .= $hours > 0 ? sprintf('%02d', $hours).':' : '';
70+
$format .= sprintf('%02d', $minutes).':';
7171
$format .= sprintf('%02d', $seconds);
7272

7373
return $format;

src/Facades/Action.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Action extends Facade
3535
*
3636
* @param class-string<Actionable>|array<class-string<Actionable>|(Closure(Actionable $action): bool)>|(Closure(Actionable $action): bool) $actionsToFake
3737
*/
38-
public static function fake(array|string|Closure $actionsToFake = []): FakeDispatcher
38+
public static function fake(array|Closure|string $actionsToFake = []): FakeDispatcher
3939
{
4040
/** @var Application $app */
4141
$app = app();

0 commit comments

Comments
 (0)