Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0']
php: ['7.4', '8.0', '8.1']
dependencies: [highest]
symfony: ['*']
stability: ['stable']
include:
# Minimum supported dependencies with the oldest supported PHP version
- php: '7.1'
- php: '7.4'
dependencies: lowest
symfony: '*'
stability: 'stable'
Expand All @@ -32,12 +32,12 @@ jobs:
stability: 'stable'

# Test each supported Symfony version with lowest supported PHP version
- php: '7.1'
- php: '7.4'
dependencies: highest
symfony: '4.4.*'
stability: 'stable'

- php: '7.2'
- php: '7.4'
dependencies: highest
symfony: '5.3.*'
stability: 'stable'
Expand All @@ -47,6 +47,12 @@ jobs:
dependencies: highest
symfony: '5.4.*'
stability: 'dev'

# Test Symfony 6.0 dev version
- php: '8.0'
dependencies: highest
symfony: '6.0.*'
stability: 'dev'
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
38 changes: 0 additions & 38 deletions .phpstan/stubs/Event.stub

This file was deleted.

31 changes: 0 additions & 31 deletions .phpstan/stubs/ExtensionGuesserInterface.stub

This file was deleted.

38 changes: 0 additions & 38 deletions .phpstan/stubs/MimeTypeGuesserInterface.stub

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ This file contains a complete enumeration of all [pull requests](https://github.
for a given releases. Unreleased, upcoming changes will be updated here periodically; reference the next release on our
[milestones](https://github.com/liip/LiipImagineBundle/milestones) page for the latest changes.


## [2.7.2](https://github.com/liip/LiipImagineBundle/tree/2.7.2)

- Address PHP 8.1 deprecations [\#1427](https://github.com/liip/LiipImagineBundle/pull/1427) ([franmomu](https://github.com/franmomu))

## [2.7.1](https://github.com/liip/LiipImagineBundle/tree/2.7.1)

- Bugfix: Don't resolve to webp in the controller if webp generation is disabled [\#1410](https://github.com/liip/LiipImagineBundle/pull/1410) ([mynameisbogdan](https://github.com/mynameisbogdan) / [dbu](https://github.com/dbu))
Expand Down
2 changes: 2 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ been removed.

- __[BC BREAK]__ Argument 4 of `ImagineController` is a mandatory instance of `ControllerConfig`

- __[BC BREAK]__ Argument 2 of `AbstractDoctrineLoader` is mandatory now, you MUST pass the model class name.

## 2.3.0 - 2.7.0

- __[Deprecated]__ As `doctrine/cache` has been deprecated, the `Liip\ImagineBundle\Imagine\Resolver\CacheResolver`
Expand Down
32 changes: 16 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
}
},
"require": {
"php": "^7.1|^8.0",
"php": "^7.4|^8.0",
"ext-mbstring": "*",
"imagine/imagine": "^1.2.4",
"symfony/filesystem": "^4.4|^5.3",
"symfony/finder": "^4.4|^5.3",
"symfony/framework-bundle": "^3.4.23|^4.4|^5.3",
"symfony/mime": "^4.4|^5.3",
"symfony/options-resolver": "^4.4|^5.3",
"symfony/process": "^4.4|^5.3",
"symfony/filesystem": "^4.4|^5.3|^6.0",
"symfony/finder": "^4.4|^5.3|^6.0",
"symfony/framework-bundle": "^3.4.23|^4.4|^5.3|^6.0",
"symfony/mime": "^4.4|^5.3|^6.0",
"symfony/options-resolver": "^4.4|^5.3|^6.0",
"symfony/process": "^4.4|^5.3|^6.0",
"twig/twig": "^1.44|^2.9|^3.0"
},
"require-dev": {
Expand All @@ -42,16 +42,16 @@
"phpstan/phpstan": "^0.12.64",
"psr/cache": "^1.0|^2.0|^3.0",
"psr/log": "^1.0",
"symfony/browser-kit": "^4.4|^5.3",
"symfony/cache": "^4.4|^5.3",
"symfony/console": "^4.4|^5.3",
"symfony/dependency-injection": "^4.4|^5.3",
"symfony/form": "^4.4|^5.3",
"symfony/messenger": "^4.4|^5.3",
"symfony/browser-kit": "^4.4|^5.3|^6.0",
"symfony/cache": "^4.4|^5.3|^6.0",
"symfony/console": "^4.4|^5.3|^6.0",
"symfony/dependency-injection": "^4.4|^5.3|^6.0",
"symfony/form": "^4.4|^5.3|^6.0",
"symfony/messenger": "^4.4|^5.3|^6.0",
"symfony/phpunit-bridge": "^5.3",
"symfony/templating": "^4.4|^5.3",
"symfony/validator": "^4.4|^5.3",
"symfony/yaml": "^4.4|^5.3"
"symfony/templating": "^4.4|^5.3|^6.0",
"symfony/validator": "^4.4|^5.3|^6.0",
"symfony/yaml": "^4.4|^5.3|^6.0"
},
"suggest": {
"ext-exif": "required to read EXIF metadata from images",
Expand Down
3 changes: 0 additions & 3 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ parameters:
- src
scanFiles:
- .phpstan/stubs/AdapterInterface.stub
- .phpstan/stubs/Event.stub
- .phpstan/stubs/ExtensionGuesserInterface.stub
- .phpstan/stubs/FilesystemInterface.stub
- .phpstan/stubs/MimeTypeGuesserInterface.stub
- .phpstan/stubs/ReadInterface.stub
15 changes: 3 additions & 12 deletions src/Binary/BinaryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,9 @@

interface BinaryInterface
{
/**
* @return string
*/
public function getContent();
public function getContent(): string;

/**
* @return string
*/
public function getMimeType();
public function getMimeType(): ?string;

/**
* @return string
*/
public function getFormat();
public function getFormat(): ?string;
}
5 changes: 1 addition & 4 deletions src/Binary/FileBinaryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,5 @@

interface FileBinaryInterface extends BinaryInterface
{
/**
* @return string
*/
public function getPath();
public function getPath(): string;
}
33 changes: 9 additions & 24 deletions src/Binary/Loader/AbstractDoctrineLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,34 @@

namespace Liip\ImagineBundle\Binary\Loader;

use Doctrine\Common\Persistence\ObjectManager as LegacyObjectManager;
use Doctrine\Persistence\ObjectManager;
use Liip\ImagineBundle\Exception\Binary\Loader\NotLoadableException;

abstract class AbstractDoctrineLoader implements LoaderInterface
{
/**
* @var ObjectManager|LegacyObjectManager
*/
protected $manager;
protected ObjectManager $manager;

/**
* @var string
*/
protected $class;
protected string $modelClass;

/**
* @param ObjectManager|LegacyObjectManager $manager
* @param string $class
*/
public function __construct($manager, $class = null)
public function __construct(ObjectManager $manager, string $modelClass)
{
$this->manager = $manager;
$this->class = $class;
$this->modelClass = $modelClass;
}

/**
* {@inheritdoc}
*/
public function find($path)
{
$image = $this->manager->find($this->class, $this->mapPathToId($path));
$image = $this->manager->find($this->modelClass, $this->mapPathToId($path));

if (!$image) {
// try to find the image without extension
$info = pathinfo($path);
$name = $info['dirname'].'/'.$info['filename'];

$image = $this->manager->find($this->class, $this->mapPathToId($name));
$image = $this->manager->find($this->modelClass, $this->mapPathToId($name));
}

if (!$image) {
Expand All @@ -62,18 +51,14 @@ public function find($path)
/**
* Map the requested path (ie. subpath in the URL) to an id that can be used to lookup the image in the Doctrine store.
*
* @param string $path
*
* @return string
* @return string|int
*/
abstract protected function mapPathToId($path);
abstract protected function mapPathToId(string $path);

/**
* Return a stream resource from the Doctrine entity/document with the image content.
*
* @param object $image
*
* @return resource
*/
abstract protected function getStreamFromImage($image);
abstract protected function getStreamFromImage(object $image);
}
2 changes: 1 addition & 1 deletion src/Binary/Loader/ChainLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ChainLoader implements LoaderInterface
/**
* @var LoaderInterface[]
*/
private $loaders;
private array $loaders;

/**
* @param LoaderInterface[] $loaders
Expand Down
15 changes: 3 additions & 12 deletions src/Binary/Loader/FileSystemLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,11 @@

class FileSystemLoader implements LoaderInterface
{
/**
* @var MimeTypeGuesserInterface
*/
protected $mimeTypeGuesser;
protected MimeTypeGuesserInterface $mimeTypeGuesser;

/**
* @var MimeTypesInterface
*/
protected $extensionGuesser;
protected MimeTypesInterface $extensionGuesser;

/**
* @var LocatorInterface
*/
protected $locator;
protected LocatorInterface $locator;

public function __construct(
MimeTypeGuesserInterface $mimeGuesser,
Expand Down
10 changes: 2 additions & 8 deletions src/Binary/Loader/FlysystemLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,9 @@

class FlysystemLoader implements LoaderInterface
{
/**
* @var FilesystemInterface
*/
protected $filesystem;
protected FilesystemInterface $filesystem;

/**
* @var MimeTypesInterface
*/
protected $extensionGuesser;
protected MimeTypesInterface $extensionGuesser;

public function __construct(
MimeTypesInterface $extensionGuesser,
Expand Down
Loading