Skip to content

Commit 0e7f24a

Browse files
committed
Lint
1 parent ce6b473 commit 0e7f24a

13 files changed

Lines changed: 27 additions & 24 deletions

File tree

src/Matcher/ConfigValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ public function validate(array $config): Result
5858
$result = new FieldSet(
5959
'args',
6060
new BeforeSet(new RequiredFields('submatchers')),
61-
new Collection('submatchers', new BeforeSet(new Count(1)))
61+
new Collection('submatchers', new BeforeSet(new Count(1))),
6262
)->process(new FieldName('submatchers'), $config['args']);
6363

64-
foreach ((array)$config['args'] as $subMatcher) {
64+
foreach ((array) $config['args'] as $subMatcher) {
6565
$result->merge($this->validate($subMatcher));
6666
}
6767

src/Matcher/MatcherFactory/Array/Contains.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function create(array $config): Matcher
2626
throw InvalidConfig::fromResult($result);
2727
}
2828

29-
assert ($result->value instanceof Matcher\Array\Contains);
29+
assert($result->value instanceof Matcher\Array\Contains);
3030
return $result->value;
3131
}
3232
}

src/Matcher/MatcherFactory/Equals.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function create(array $config): Matcher
2828
throw InvalidConfig::fromResult($result);
2929
}
3030

31-
assert ($result->value instanceof Matcher\Equals);
31+
assert($result->value instanceof Matcher\Equals);
3232
return $result->value;
3333
}
3434
}

src/Matcher/MatcherFactory/Exists.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function create(array $config): Matcher
2727
throw InvalidConfig::fromResult($result);
2828
}
2929

30-
assert ($result->value instanceof Matcher\Exists);
30+
assert($result->value instanceof Matcher\Exists);
3131
return $result->value;
3232
}
3333
}

src/Matcher/MatcherFactory/GreaterThan.php

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

55
namespace Membrane\MockServer\Matcher\MatcherFactory;
66

7-
use Membrane\Attribute\Builder;use Membrane\Attribute\ClassWithAttributes;use Membrane\Membrane;use Membrane\MockServer\Exception\InvalidConfig;use Membrane\MockServer\Matcher\Matcher;
7+
use Membrane\Attribute\Builder;
8+
use Membrane\Attribute\ClassWithAttributes;
9+
use Membrane\Membrane;
10+
use Membrane\MockServer\Exception\InvalidConfig;
11+
use Membrane\MockServer\Matcher\Matcher;
812

913
/**
1014
* @phpstan-type Config array{
@@ -25,7 +29,7 @@ public function create(array $config): Matcher
2529
throw InvalidConfig::fromResult($result);
2630
}
2731

28-
assert ($result->value instanceof Matcher\GreaterThan);
32+
assert($result->value instanceof Matcher\GreaterThan);
2933
return $result->value;
3034
}
3135
}

src/Matcher/MatcherFactory/LessThan.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function create(array $config): Matcher
2929
throw InvalidConfig::fromResult($result);
3030
}
3131

32-
assert ($result->value instanceof Matcher\LessThan);
32+
assert($result->value instanceof Matcher\LessThan);
3333
return $result->value;
3434
}
3535
}

src/Matcher/MatcherFactory/String/Regex.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function create(array $config): Matcher
2828
throw InvalidConfig::fromResult($result);
2929
}
3030

31-
assert ($result->value instanceof Matcher\String\Regex);
31+
assert($result->value instanceof Matcher\String\Regex);
3232
return $result->value;
3333
}
3434
}

src/Mocking/ConfigLocator/FromDatabase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public function getOperationConfig(string $operationId): ?array
3131
return array_merge(
3232
$operation->jsonSerialize(),
3333
['matchers' => array_values(array_map(
34-
fn($m) => $m->jsonSerialize(),
35-
$matchers,
34+
fn($m) => $m->jsonSerialize(),
35+
$matchers,
3636
))],
3737
);
3838
}

tests/e2e/ApiTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function youCanDeleteDefinedOperation(): void
8080
$addListPets = $this->callApi(
8181
'post',
8282
'/operation/listPets',
83-
['default' => ['response' => ['code' => 200]]]
83+
['default' => ['response' => ['code' => 200]]],
8484
);
8585

8686
$deleteListPets = $this->callApi('delete', '/operation/listPets');
@@ -115,13 +115,13 @@ public function youMayMatchDefinedMatcher(): void
115115
'args' => ['field' => ['path', 'petId'], 'value' => 6],
116116
],
117117
'response' => $expected,
118-
]
118+
],
119119
);
120120
self::assertSame(201, $addMatcherForId6->getStatusCode());
121121

122122
$showPetById6 = $this->callMocking('get', '/pets/6');
123123
self::assertSame($expected['code'], $showPetById6->getStatusCode());
124-
self::assertSame($expected['body'], (string)$showPetById6->getBody());
124+
self::assertSame($expected['body'], (string) $showPetById6->getBody());
125125
}
126126

127127
#[Test]
@@ -205,7 +205,7 @@ public function youMayMatchMultipleDefinedMatchers(): void
205205

206206
$showPetById6 = $this->callMocking('get', '/pets/6');
207207
self::assertSame($matchId6['response']['code'], $showPetById6->getStatusCode());
208-
self::assertSame($matchId6['response']['body'], (string)$showPetById6->getBody());
208+
self::assertSame($matchId6['response']['body'], (string) $showPetById6->getBody());
209209

210210
$showPetByIdMinus1 = $this->callMocking('get', '/pets/-1');
211211
self::assertSame($matchNegativeIds['response']['code'], $showPetByIdMinus1->getStatusCode());
@@ -280,12 +280,12 @@ public function youWontDeleteOperationWhenDeletingMatcher(): void
280280
],
281281
);
282282

283-
$matcherForId6 = json_decode((string)$addMatcherForId6->getBody());
283+
$matcherForId6 = json_decode((string) $addMatcherForId6->getBody());
284284

285285

286286
$deleteMatcherForId6 = $this->callApi(
287287
'delete',
288-
"/operation/showPetById/matcher/$matcherForId6->id"
288+
"/operation/showPetById/matcher/$matcherForId6->id",
289289
);
290290

291291
self::assertSame(204, $deleteMatcherForId6->getStatusCode());
@@ -298,7 +298,7 @@ public function youWontDeleteOperationWhenDeletingMatcher(): void
298298
public function youWillDeleteMatchersWhenDeletingOperation(): void
299299
{
300300
$default = ['response' => ['code' => 404]];
301-
$addShowPetById = fn () => $this->callApi(
301+
$addShowPetById = fn() => $this->callApi(
302302
'post',
303303
'/operation/showPetById',
304304
['default' => $default],

tests/unit/Matcher/ConfigValidatorTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#[\PHPUnit\Framework\Attributes\CoversClass(ConfigValidator::class)]
2828
final class ConfigValidatorTest extends \PHPUnit\Framework\TestCase
2929
{
30-
3130
/**
3231
* @param AliasesConfig $aliases
3332
* @param MatcherFactoryConfig $config
@@ -38,7 +37,7 @@ public function itValidatesConfig(
3837
Result $expected,
3938
array $aliases,
4039
array $config,
41-
): void{
40+
): void {
4241
$sut = new ConfigValidator(
4342
new Membrane(new Builder()),
4443
$aliases,

0 commit comments

Comments
 (0)