Added nullsafe operator to simplify conditions

This commit is contained in:
Alejandro Celaya
2021-05-23 12:31:10 +02:00
parent e0f0bb5523
commit c01121d61a
64 changed files with 95 additions and 113 deletions

View File

@@ -6,12 +6,12 @@ namespace ShlinkioApiTest\Shlink\Rest\Action;
use Cake\Chronos\Chronos;
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
use GuzzleHttp\Psr7\Query;
use GuzzleHttp\RequestOptions;
use Laminas\Diactoros\Uri;
use Shlinkio\Shlink\TestUtils\ApiTest\ApiTestCase;
use ShlinkioApiTest\Shlink\Rest\Utils\NotFoundUrlHelpersTrait;
use function GuzzleHttp\Psr7\build_query;
use function sprintf;
class EditShortUrlTest extends ApiTestCase
@@ -105,7 +105,7 @@ class EditShortUrlTest extends ApiTestCase
string $shortCode,
?string $domain,
string $expectedDetail,
string $apiKey
string $apiKey,
): void {
$url = $this->buildShortUrlPath($shortCode, $domain);
$resp = $this->callApiWithKey(self::METHOD_PATCH, $url, [RequestOptions::JSON => []], $apiKey);
@@ -147,7 +147,7 @@ class EditShortUrlTest extends ApiTestCase
$url = new Uri(sprintf('/short-urls/%s', $shortCode));
if ($domain !== null) {
$url = $url->withQuery(build_query(['domain' => $domain]));
$url = $url->withQuery(Query::build(['domain' => $domain]));
}
$editResp = $this->callApiWithKey(self::METHOD_PATCH, (string) $url, [RequestOptions::JSON => [