Skip to content

Commit

Permalink
Bump symfony/http-foundation and fix incompabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
christeredvartsen committed Jan 28, 2023
1 parent 0d5041c commit 5bd1f7d
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 106 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"guzzlehttp/psr7": "^2.0",
"ramsey/uuid": "^4.2",
"symfony/console": "^6.2",
"symfony/http-foundation": "^5.3"
"symfony/http-foundation": "^6.2"
},
"require-dev": {
"christeredvartsen/testfs": "^0.4.0",
Expand Down
194 changes: 98 additions & 96 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions src/Http/Request/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Imbo\Http\Response\Response;
use Imbo\Model\Image;
use Imbo\Router\Route;
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;

/**
Expand Down Expand Up @@ -72,10 +73,8 @@ public function getPublicKey()

/**
* Get the user found in the request
*
* @return string
*/
public function getUser()
public function getUser(): ?string
{
return $this->route ? $this->route->get('user') : null;
}
Expand Down Expand Up @@ -111,9 +110,9 @@ public function getTransformations()
if ($this->transformations === null) {
$this->transformations = [];

$transformations = $this->query->get('t', []);

if (!is_array($transformations)) {
try {
$transformations = $this->query->all('t');
} catch (BadRequestException $e) {
throw new InvalidArgumentException('Transformations must be specifed as an array', Response::HTTP_BAD_REQUEST);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Http/Response/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function setModel(ModelInterface $model = null): self
return $this;
}

public function setNotModified(): self
public function setNotModified(): static
{
parent::setNotModified();
$this->setModel(null);
Expand Down
2 changes: 1 addition & 1 deletion src/Image/Transformation/SmartSize.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function transform(array $params): void
{
$params = $this->validateParameters($params);

$this->event->getResponse()->headers->set('X-Imbo-POIs-Used', $params['poi'] ? 1 : 0);
$this->event->getResponse()->headers->set('X-Imbo-POIs-Used', $params['poi'] ? '1' : '0');

if (!$params['poi']) {
$this->simpleCrop($params['width'], $params['height']);
Expand Down
2 changes: 1 addition & 1 deletion src/Resource/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function addImage(EventInterface $event): void
$e->setImboErrorCode(ImageException::IMAGE_IDENTIFIER_GENERATION_FAILED);

// Tell the client it's OK to retry later
$event->getResponse()->headers->set('Retry-After', 1);
$event->getResponse()->headers->set('Retry-After', '1');
throw $e;
}

Expand Down

0 comments on commit 5bd1f7d

Please sign in to comment.