Skip to content

Commit 27c68da

Browse files
committed
run mago linting
1 parent 9c5ed85 commit 27c68da

97 files changed

Lines changed: 467 additions & 465 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

mago.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ single-class-per-file = { enabled = false }
7070
no-isset = { enabled = false }
7171
instanceof-stringable = { enabled = false }
7272
prefer-static-closure = { enabled = false }
73+
sensitive-parameter = { enabled = false }

packages/auth/src/AccessControl/PolicyDiscovery.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Tempest\Auth\AccessControl;
44

5-
use Tempest\Auth\AccessControl\Policy;
65
use Tempest\Auth\AuthConfig;
76
use Tempest\Discovery\Discovery;
87
use Tempest\Discovery\DiscoveryLocation;

packages/auth/tests/OAuthTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function oauth_user_creation(): void
185185
avatar: 'https://example.com/avatar.jpg',
186186
provider: 'github',
187187
raw: [
188-
'id' => 123456,
188+
'id' => 123_456,
189189
'login' => 'frieren',
190190
'name' => 'Frieren the Mage',
191191
'email' => 'frieren@elven-mage.magic',

packages/command-bus/src/MonitorAsyncCommands.php

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,35 @@ public function __invoke(): void
3535

3636
while (true) { // @phpstan-ignore-line
3737
foreach ($processes as $uuid => $process) {
38-
if ($process->isTerminated()) {
39-
if ($process->isSuccessful()) {
40-
$this->console->keyValue(
41-
key: "<style='fg-gray'>{$uuid}</style>",
42-
value: "<style='fg-green bold'>SUCCESS</style>",
43-
);
44-
} else {
45-
$this->console->keyValue(
46-
key: "<style='fg-gray'>{$uuid}</style>",
47-
value: "<style='fg-red bold'>FAILED</style>",
48-
);
49-
}
50-
51-
$output = trim($process->getOutput());
52-
53-
if ($output !== '' && $output !== '0') {
54-
$this->writeln($output);
55-
}
56-
57-
$errorOutput = trim($process->getErrorOutput());
58-
59-
if ($errorOutput !== '' && $errorOutput !== '0') {
60-
$this->writeln($errorOutput);
61-
}
62-
63-
unset($processes[$uuid]);
38+
if (! $process->isTerminated()) {
39+
continue;
6440
}
41+
42+
if ($process->isSuccessful()) {
43+
$this->console->keyValue(
44+
key: "<style='fg-gray'>{$uuid}</style>",
45+
value: "<style='fg-green bold'>SUCCESS</style>",
46+
);
47+
} else {
48+
$this->console->keyValue(
49+
key: "<style='fg-gray'>{$uuid}</style>",
50+
value: "<style='fg-red bold'>FAILED</style>",
51+
);
52+
}
53+
54+
$output = trim($process->getOutput());
55+
56+
if ($output !== '' && $output !== '0') {
57+
$this->writeln($output);
58+
}
59+
60+
$errorOutput = trim($process->getErrorOutput());
61+
62+
if ($errorOutput !== '' && $errorOutput !== '0') {
63+
$this->writeln($errorOutput);
64+
}
65+
66+
unset($processes[$uuid]);
6567
}
6668

6769
$availableCommands = arr($this->repository->getPendingCommands())

packages/command-bus/src/functions.php

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

55
namespace Tempest\CommandBus;
66

7-
use Tempest\CommandBus\CommandBus;
87
use Tempest\Container;
98

109
/**

packages/console/src/Completion/CompletionEngine.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,11 @@ private function selectCompletionValue(CompletionFlag $flag, string $current): ?
135135
$candidates[] = $flag->flag;
136136

137137
foreach ($flag->aliases as $alias) {
138-
if (str_starts_with($alias, '--')) {
139-
$candidates[] = $alias;
138+
if (! str_starts_with($alias, '--')) {
139+
continue;
140140
}
141+
142+
$candidates[] = $alias;
141143
}
142144
} elseif (str_starts_with($current, '-')) {
143145
foreach ($flag->aliases as $alias) {

packages/console/src/Components/Interactive/TaskComponent.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,11 @@ private function renderTask(Terminal $terminal, ?string $line = null): string
139139
private function cleanupSockets(): void
140140
{
141141
foreach ($this->sockets as $socket) {
142-
if (is_resource($socket)) {
143-
@fclose($socket);
142+
if (! is_resource($socket)) {
143+
continue;
144144
}
145+
146+
@fclose($socket);
145147
}
146148

147149
$this->sockets = [];

packages/console/src/Input/ConsoleArgumentBag.php

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ public function findArrayFor(ConsoleArgumentDefinition $argumentDefinition): Con
117117
$values = [];
118118

119119
foreach ($this->arguments as $argument) {
120-
if ($argumentDefinition->matchesArgument($argument)) {
121-
$values[] = $argument->value;
120+
if (! $argumentDefinition->matchesArgument($argument)) {
121+
continue;
122122
}
123+
124+
$values[] = $argument->value;
123125
}
124126

125127
return new ConsoleInputArgument(
@@ -137,13 +139,15 @@ public function findForVariadicArgument(ConsoleArgumentDefinition $argumentDefin
137139
$arguments = [];
138140

139141
foreach ($this->arguments as $argument) {
140-
if ($argument->position >= $argumentDefinition->position) {
141-
$arguments[] = new ConsoleInputArgument(
142-
name: $argumentDefinition->name,
143-
position: $argument->position,
144-
value: $this->resolveArgumentValue($argumentDefinition, $argument)->value,
145-
);
142+
if ($argument->position < $argumentDefinition->position) {
143+
continue;
146144
}
145+
146+
$arguments[] = new ConsoleInputArgument(
147+
name: $argumentDefinition->name,
148+
position: $argument->position,
149+
value: $this->resolveArgumentValue($argumentDefinition, $argument)->value,
150+
);
147151
}
148152

149153
return $arguments;
@@ -173,16 +177,18 @@ public function addMany(array $arguments): self
173177

174178
// Otherwise, $arguments is an array of flags or positional argument.
175179
foreach ($arguments as $key => $argument) {
176-
if (str_starts_with($argument, '-') && ! str_starts_with($argument, '--')) {
177-
$flags = str_split($argument);
178-
unset($flags[0]);
180+
if (! (str_starts_with($argument, '-') && ! str_starts_with($argument, '--'))) {
181+
continue;
182+
}
179183

180-
foreach ($flags as $flag) {
181-
$arguments[] = "-{$flag}";
182-
}
184+
$flags = str_split($argument);
185+
unset($flags[0]);
183186

184-
unset($arguments[$key]);
187+
foreach ($flags as $flag) {
188+
$arguments[] = "-{$flag}";
185189
}
190+
191+
unset($arguments[$key]);
186192
}
187193

188194
$position = count($this->arguments);

packages/console/tests/OptionCollectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function test_filter(): void
3131

3232
$options->filter('ergljherkigjerg');
3333
$this->assertCount(0, $options->getOptions());
34-
$this->assertSame(null, $options->getActive());
34+
$this->assertNull($options->getActive());
3535
}
3636

3737
public function test_keeps_active_on_filter(): void
@@ -50,7 +50,7 @@ public function test_keeps_active_on_filter(): void
5050
$this->assertSame('baz', $options->getActive()->value);
5151

5252
$options->filter('bazz');
53-
$this->assertSame(null, $options->getActive());
53+
$this->assertNull($options->getActive());
5454
}
5555

5656
public function test_navigate(): void

packages/container/src/functions.php

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

55
namespace Tempest\Container;
66

7-
use Tempest\Container\GenericContainer;
87
use Tempest\Reflection\FunctionReflector;
98
use Tempest\Reflection\MethodReflector;
109

0 commit comments

Comments
 (0)