Skip to content

Commit

Permalink
Merge 4.x into 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed Sep 13, 2024
2 parents 855e406 + a76aec8 commit 56dd044
Show file tree
Hide file tree
Showing 45 changed files with 54 additions and 51 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [4.14.1](https://github.com/sonata-project/SonataMediaBundle/compare/4.14.0...4.14.1) - 2024-09-12
### Fixed
- [[#2460](https://github.com/sonata-project/SonataMediaBundle/pull/2460)] Fixed the callback transformers of media/gallery block services. ([@lemorragia](https://github.com/lemorragia))

## [4.14.0](https://github.com/sonata-project/SonataMediaBundle/compare/4.13.0...4.14.0) - 2024-08-27
### Added
- [[#2461](https://github.com/sonata-project/SonataMediaBundle/pull/2461)] Support for psr/http-message 2 ([@VincentLanglet](https://github.com/VincentLanglet))
Expand Down
2 changes: 1 addition & 1 deletion src/Action/MediaDownloadAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class MediaDownloadAction
{
public function __construct(
private MediaManagerInterface $mediaManager,
private Pool $pool
private Pool $pool,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Admin/BaseMediaAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct(
$contextManager = null,
?Pool $deprecatedPool = null,
?CategoryManagerInterface $deprecatedCategoryManager = null,
?ContextManagerInterface $deprecatedContextManager = null
?ContextManagerInterface $deprecatedContextManager = null,
) {
// NEXT_MAJOR: Keep the if part.
if ($pool instanceof Pool) {
Expand Down
2 changes: 1 addition & 1 deletion src/Block/FeatureMediaBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct(
Environment $twig,
private Pool $pool,
private ?AdminInterface $mediaAdmin,
private MediaManagerInterface $mediaManager
private MediaManagerInterface $mediaManager,
) {
parent::__construct($twig);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Block/GalleryBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(
Environment $twig,
private Pool $pool,
private ?AdminInterface $galleryAdmin,
private GalleryManagerInterface $galleryManager
private GalleryManagerInterface $galleryManager,
) {
parent::__construct($twig);
}
Expand Down Expand Up @@ -212,8 +212,8 @@ private function getGalleryBuilder(AdminFormMapper $form): FormBuilderInterface
]);

$formBuilder->addModelTransformer(new CallbackTransformer(
static fn (?MediaInterface $value): ?MediaInterface => $value,
static fn (?MediaInterface $value) => $value instanceof MediaInterface ? $value->getId() : $value
static fn (?GalleryInterface $value): ?GalleryInterface => $value,
static fn (?GalleryInterface $value) => $value instanceof GalleryInterface ? $value->getId() : $value
));

return $formBuilder;
Expand Down
2 changes: 1 addition & 1 deletion src/Block/GalleryListBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class GalleryListBlockService extends AbstractBlockService implements Edit
public function __construct(
Environment $twig,
private GalleryManagerInterface $galleryManager,
private Pool $pool
private Pool $pool,
) {
parent::__construct($twig);
}
Expand Down
7 changes: 3 additions & 4 deletions src/Block/MediaBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
use Sonata\BlockBundle\Model\BlockInterface;
use Sonata\Form\Type\ImmutableArrayType;
use Sonata\Form\Validator\ErrorElement;
use Sonata\MediaBundle\Model\GalleryInterface;
use Sonata\MediaBundle\Model\MediaInterface;
use Sonata\MediaBundle\Model\MediaManagerInterface;
use Sonata\MediaBundle\Provider\Pool;
Expand All @@ -49,7 +48,7 @@ public function __construct(
Environment $twig,
private Pool $pool,
private ?AdminInterface $mediaAdmin,
private MediaManagerInterface $mediaManager
private MediaManagerInterface $mediaManager,
) {
parent::__construct($twig);
}
Expand Down Expand Up @@ -224,8 +223,8 @@ private function getMediaBuilder(AdminFormMapper $form): FormBuilderInterface
]);

$formBuilder->addModelTransformer(new CallbackTransformer(
static fn (?GalleryInterface $value): ?GalleryInterface => $value,
static fn (?GalleryInterface $value) => $value instanceof GalleryInterface ? $value->getId() : $value
static fn (?MediaInterface $value): ?MediaInterface => $value,
static fn (?MediaInterface $value) => $value instanceof MediaInterface ? $value->getId() : $value
));

return $formBuilder;
Expand Down
2 changes: 1 addition & 1 deletion src/CDN/CloudFrontVersion3.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ final class CloudFrontVersion3 implements CDNInterface
public function __construct(
private CloudFrontClient $client,
private string $distributionId,
string $path
string $path,
) {
$this->path = rtrim($path, '/');
}
Expand Down
2 changes: 1 addition & 1 deletion src/CDN/Fallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class Fallback implements CDNInterface
{
public function __construct(
private CDNInterface $cdn,
private CDNInterface $fallback
private CDNInterface $fallback,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Command/CleanMediaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class CleanMediaCommand extends Command
public function __construct(
private Local $filesystemLocal,
private Pool $mediaPool,
private MediaManagerInterface $mediaManager
private MediaManagerInterface $mediaManager,
) {
parent::__construct();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/FixMediaContextCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class FixMediaContextCommand extends Command
public function __construct(
private Pool $mediaPool,
private ?CategoryManagerInterface $categoryManager = null,
private ?ContextManagerInterface $contextManager = null
private ?ContextManagerInterface $contextManager = null,
) {
parent::__construct();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/RefreshMetadataCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class RefreshMetadataCommand extends Command
*/
public function __construct(
private Pool $mediaPool,
private MediaManagerInterface $mediaManager
private MediaManagerInterface $mediaManager,
) {
parent::__construct();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/RemoveThumbsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class RemoveThumbsCommand extends Command
*/
public function __construct(
private Pool $mediaPool,
private MediaManagerInterface $mediaManager
private MediaManagerInterface $mediaManager,
) {
parent::__construct();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SyncThumbsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class SyncThumbsCommand extends Command
*/
public function __construct(
private Pool $mediaPool,
private MediaManagerInterface $mediaManager
private MediaManagerInterface $mediaManager,
) {
parent::__construct();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/UpdateCdnStatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class UpdateCdnStatusCommand extends Command
*/
public function __construct(
private Pool $mediaPool,
private MediaManagerInterface $mediaManager
private MediaManagerInterface $mediaManager,
) {
parent::__construct();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Filesystem/Replicate.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class Replicate implements Adapter, FileFactory, StreamFactory, MetadataSu
public function __construct(
private Adapter $primary,
private Adapter $secondary,
?LoggerInterface $logger = null
?LoggerInterface $logger = null,
) {
$this->logger = $logger ?? new NullLogger();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Form/DataTransformer/ProviderDataTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class ProviderDataTransformer implements DataTransformerInterface, LoggerA
public function __construct(
private Pool $pool,
private string $class,
array $options = []
array $options = [],
) {
$this->options = $this->getOptions($options);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Type/MediaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class MediaType extends AbstractType implements LoggerAwareInterface
*/
public function __construct(
private Pool $pool,
private string $class
private string $class,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Generator/IdGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class IdGenerator implements GeneratorInterface
{
public function __construct(
private int $firstLevel = 100000,
private int $secondLevel = 1000
private int $secondLevel = 1000,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Listener/ORM/MediaEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final class MediaEventSubscriber extends BaseMediaEventSubscriber

public function __construct(
Pool $pool,
private ?CategoryManagerInterface $categoryManager = null
private ?CategoryManagerInterface $categoryManager = null,
) {
parent::__construct($pool);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Messenger/GenerateThumbnailsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class GenerateThumbnailsHandler implements BackwardCompatibleMessageHandle
public function __construct(
private GenerableThumbnailInterface $thumbnail,
private MediaManagerInterface $mediaManager,
private Pool $pool
private Pool $pool,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Metadata/AmazonMetadataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ final class AmazonMetadataBuilder implements MetadataBuilderInterface
*/
public function __construct(
private array $settings,
?MimeTypesInterface $mimeTypes = null
?MimeTypesInterface $mimeTypes = null,
) {
$this->mimeTypes = $mimeTypes ?? new MimeTypes();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Metadata/ProxyMetadataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class ProxyMetadataBuilder implements MetadataBuilderInterface
public function __construct(
private Pool $pool,
private ?MetadataBuilderInterface $noopMetadataBuilder = null,
private ?MetadataBuilderInterface $amazonMetadataBuilder = null
private ?MetadataBuilderInterface $amazonMetadataBuilder = null,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Model/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ abstract class Media implements MediaInterface, \Stringable
protected Collection $galleryItems;

/**
* @var CategoryInterface|null
* @phpstan-var CategoryInterface|null
*/
protected ?object $category = null;

Expand Down
4 changes: 2 additions & 2 deletions src/Model/MediaInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ public function setSize(?int $size): void;
public function getSize(): ?int;

/**
* @return CategoryInterface|null
* @phpstan-return CategoryInterface|null
*/
public function getCategory(): ?object;

/**
* @param CategoryInterface|null $category
* @phpstan-param CategoryInterface|null $category
*/
public function setCategory(?object $category = null): void;

Expand Down
2 changes: 1 addition & 1 deletion src/Provider/BaseProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct(
protected Filesystem $filesystem,
protected CDNInterface $cdn,
protected GeneratorInterface $pathGenerator,
protected ThumbnailInterface $thumbnail
protected ThumbnailInterface $thumbnail,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Provider/BaseVideoProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(
ThumbnailInterface $thumbnail,
private ClientInterface $client,
private RequestFactoryInterface $requestFactory,
protected ?MetadataBuilderInterface $metadata = null
protected ?MetadataBuilderInterface $metadata = null,
) {
parent::__construct($name, $filesystem, $cdn, $pathGenerator, $thumbnail);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/FileProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(
ThumbnailInterface $thumbnail,
protected array $allowedExtensions = [],
protected array $allowedMimeTypes = [],
protected ?MetadataBuilderInterface $metadata = null
protected ?MetadataBuilderInterface $metadata = null,
) {
parent::__construct($name, $filesystem, $cdn, $pathGenerator, $thumbnail);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/ImageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(
array $allowedExtensions,
array $allowedMimeTypes,
private ImagineInterface $imagineAdapter,
?MetadataBuilderInterface $metadata = null
?MetadataBuilderInterface $metadata = null,
) {
parent::__construct($name, $filesystem, $cdn, $pathGenerator, $thumbnail, $allowedExtensions, $allowedMimeTypes, $metadata);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/Metadata.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Provider/YouTubeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(
ClientInterface $client,
RequestFactoryInterface $requestFactory,
?MetadataBuilderInterface $metadata = null,
private bool $html5 = false
private bool $html5 = false,
) {
parent::__construct($name, $filesystem, $cdn, $pathGenerator, $thumbnail, $client, $requestFactory, $metadata);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Resizer/CropResizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class CropResizer implements ResizerInterface
{
public function __construct(
private ImagineInterface $adapter,
private MetadataBuilderInterface $metadata
private MetadataBuilderInterface $metadata,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Resizer/SimpleResizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class SimpleResizer implements ResizerInterface
public function __construct(
private ImagineInterface $adapter,
private int $mode,
private MetadataBuilderInterface $metadata
private MetadataBuilderInterface $metadata,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Resizer/SquareResizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class SquareResizer implements ResizerInterface
public function __construct(
private ImagineInterface $adapter,
private int $mode,
private MetadataBuilderInterface $metadata
private MetadataBuilderInterface $metadata,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Security/RolesDownloadStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class RolesDownloadStrategy implements DownloadStrategyInterface
public function __construct(
private TranslatorInterface $translator,
private AuthorizationCheckerInterface $security,
private array $roles = []
private array $roles = [],
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Security/SessionDownloadStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class SessionDownloadStrategy implements DownloadStrategyInterface
public function __construct(
private TranslatorInterface $translator,
private RequestStack $requestStack,
private int $times
private int $times,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Thumbnail/MessengerThumbnail.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class MessengerThumbnail implements ThumbnailInterface, GenerableThumbnail
{
public function __construct(
private ThumbnailInterface $thumbnail,
private MessageBusInterface $bus
private MessageBusInterface $bus,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Twig/MediaRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class MediaRuntime implements RuntimeExtensionInterface
public function __construct(
private Pool $pool,
private MediaManagerInterface $mediaManager,
private Environment $twig
private Environment $twig,
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class ImageUploadDimensionValidator extends ConstraintValidator
{
public function __construct(
private ImagineInterface $imagineAdapter,
private ImageProviderInterface $imageProvider
private ImageProviderInterface $imageProvider,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Action/MediaDownloadActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function testDownloadActionBinaryFile(): void
private function configureDownloadSecurity(
Media $media,
Request $request,
bool $isGranted
bool $isGranted,
): void {
$strategy = $this->createMock(DownloadStrategyInterface::class);
$strategy->method('isGranted')->with($media, $request)->willReturn($isGranted);
Expand Down
2 changes: 1 addition & 1 deletion tests/CDN/CloudFrontVersion3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testCloudFront(
string $relativePath,
string $invalidationId,
int $expectedStatus,
string $invalidationStatus
string $invalidationStatus,
): void {
$client = $this->getMockBuilder(CloudFrontClient::class)
->addMethods(['createInvalidation', 'getInvalidation'])
Expand Down
Loading

0 comments on commit 56dd044

Please sign in to comment.