Skip to content

Commit e9eea3f

Browse files
committed
Use global namespace
1 parent fefb0f1 commit e9eea3f

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

src/AssertTrait.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function recorded(?callable $callback = null): array
3232
return $this->recorded;
3333
}
3434

35-
return array_filter($this->recorded, function ($record) use ($callback) {
35+
return \array_filter($this->recorded, function ($record) use ($callback) {
3636
return (bool) $callback(...$record);
3737
});
3838
}
@@ -48,13 +48,13 @@ protected function checkRequestWasSent($condition): bool
4848
return false;
4949
}
5050

51-
$callback = is_callable($condition)
51+
$callback = \is_callable($condition)
5252
? $condition
5353
: function (RequestInterface $request, ResponseInterface $response) use ($condition): bool {
5454
return Uri::matches((string) $condition, (string) $request->getUri());
5555
};
5656

57-
return count($this->recorded($callback)) > 0;
57+
return \count($this->recorded($callback)) > 0;
5858
}
5959

6060
/**

src/MockClient.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private function isSequential(): bool
4646
*/
4747
public function setResponse($response = null): void
4848
{
49-
if (is_null($response)) {
49+
if (\is_null($response)) {
5050
$response = Psr17FactoryDiscovery::findResponseFactory()->createResponse();
5151
}
5252

@@ -55,7 +55,7 @@ public function setResponse($response = null): void
5555
return;
5656
}
5757

58-
if (is_array($response)) {
58+
if (\is_array($response)) {
5959
$response = new \ArrayIterator($response);
6060
}
6161

@@ -82,7 +82,7 @@ public function sendRequest(RequestInterface $request): ResponseInterface
8282
}
8383

8484
$responseFactory = $this->responses->current();
85-
$response = is_callable($responseFactory) ? $responseFactory($method, $uri) : $responseFactory;
85+
$response = \is_callable($responseFactory) ? $responseFactory($method, $uri) : $responseFactory;
8686
$this->responses->next();
8787

8888
if (! $response instanceof ResponseInterface) {

src/MockResponse.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ public static function create($body, int $status = 200, array $headers = []): Re
3333
return $response->withBody($body);
3434
}
3535

36-
if (is_array($body)) {
37-
$body = json_encode($body) ?: '';
36+
if (\is_array($body)) {
37+
$body = \json_encode($body) ?: '';
3838

3939
if (! $response->hasHeader('Content-Type')) {
4040
$response = $response->withHeader('Content-Type', 'application/json');
4141
}
4242
}
4343

44-
if (! is_callable($body)) {
44+
if (! \is_callable($body)) {
4545
$body = function (StreamFactoryInterface $factory) use ($body) {
46-
return is_resource($body)
46+
return \is_resource($body)
4747
? $factory->createStreamFromResource($body)
4848
: $factory->createStream($body);
4949
};
@@ -61,7 +61,7 @@ public static function create($body, int $status = 200, array $headers = []): Re
6161
public static function fixture(string $filename, int $status = 200, array $headers = []): ResponseInterface
6262
{
6363
if (empty($headers['Content-Type'])) {
64-
$extension = pathinfo($filename, PATHINFO_EXTENSION);
64+
$extension = \pathinfo($filename, PATHINFO_EXTENSION);
6565

6666
switch ($extension) {
6767
case 'json':

src/ScopingMockClient.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(iterable $responses)
3838
public function setResponses(iterable $responses): void
3939
{
4040
foreach ($responses as $key => $response) {
41-
if (! is_string($key)) {
41+
if (! \is_string($key)) {
4242
continue;
4343
}
4444

@@ -79,7 +79,7 @@ public function sendRequest(RequestInterface $request): ResponseInterface
7979
*/
8080
private function sendAndRecord(RequestInterface $request, $responseFactory, ?string $scope = null): ResponseInterface
8181
{
82-
if (is_null($scope)) {
82+
if (\is_null($scope)) {
8383
$client = $this->createMockClient($responseFactory);
8484
} else {
8585
if (empty($this->cachedClients[$scope])) {

src/Uri.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ final class Uri
1313
*/
1414
public static function matches($pattern, string $value): bool
1515
{
16-
$quoted = preg_quote('*', '/');
16+
$quoted = \preg_quote('*', '/');
1717

18-
$pattern = '*'.preg_replace('/^(?:'.$quoted.')+/u', '', $pattern); // @phpstan-ignore-line
18+
$pattern = '*'.\preg_replace('/^(?:'.$quoted.')+/u', '', $pattern); // @phpstan-ignore-line
1919

20-
if (! is_iterable($pattern)) {
20+
if (! \is_iterable($pattern)) {
2121
$pattern = [$pattern];
2222
}
2323

@@ -31,14 +31,14 @@ public static function matches($pattern, string $value): bool
3131
return true;
3232
}
3333

34-
$pattern = preg_quote($pattern, '#');
34+
$pattern = \preg_quote($pattern, '#');
3535

3636
// Asterisks are translated into zero-or-more regular expression wildcards
3737
// to make it convenient to check if the strings starts with the given
3838
// pattern such as "library/*", making any string check convenient.
39-
$pattern = str_replace('\*', '.*', $pattern);
39+
$pattern = \str_replace('\*', '.*', $pattern);
4040

41-
if (preg_match('#^'.$pattern.'\z#u', $value) === 1) {
41+
if (\preg_match('#^'.$pattern.'\z#u', $value) === 1) {
4242
return true;
4343
}
4444
}

0 commit comments

Comments
 (0)