Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migration symfony 7 #2425

Closed
wants to merge 2 commits into from
Closed
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
5 changes: 5 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ jobs:
allowed-to-fail: false
symfony-require: 6.3.*
variant: symfony/symfony:"6.3.*"
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
symfony-require: 7.0.*
variant: symfony/symfony:"7.0.*"

steps:
- name: Checkout
Expand Down
58 changes: 32 additions & 26 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,30 @@
"psr/http-message": "^1.0",
"psr/log": "^2.0 || ^3.0",
"sonata-project/doctrine-extensions": "^1.13 || ^2.0",
"sonata-project/form-extensions": "^1.4 || ^2.0",
"sonata-project/form-extensions": "^1.4 || ^2.0 || dev-migration-symfony7",
"sonata-project/twig-extensions": "^1.3 || ^2.0",
"symfony/asset": "^5.4 || ^6.2",
"symfony/config": "^5.4 || ^6.2",
"symfony/console": "^5.4 || ^6.2",
"symfony/dependency-injection": "^5.4 || ^6.2",
"symfony/event-dispatcher": "^5.4 || ^6.2",
"symfony/filesystem": "^5.4 || ^6.2",
"symfony/finder": "^5.4 || ^6.2",
"symfony/form": "^5.4 || ^6.2",
"symfony/framework-bundle": "^5.4 || ^6.2",
"symfony/http-client": "^5.4 || ^6.2",
"symfony/http-foundation": "^5.4 || ^6.2",
"symfony/http-kernel": "^5.4 || ^6.2",
"symfony/mime": "^5.4 || ^6.2",
"symfony/options-resolver": "^5.4 || ^6.2",
"symfony/routing": "^5.4 || ^6.2",
"symfony/security-bundle": "^5.4 || ^6.2",
"symfony/security-core": "^5.4 || ^6.2",
"symfony/translation": "^5.4 || ^6.2",
"symfony/asset": "^5.4 || ^6.2 || ^7.0",
"symfony/config": "^5.4 || ^6.2 || ^7.0",
"symfony/console": "^5.4 || ^6.2 || ^7.0",
"symfony/dependency-injection": "^5.4 || ^6.2 || ^7.0",
"symfony/event-dispatcher": "^5.4 || ^6.2 || ^7.0",
"symfony/filesystem": "^5.4 || ^6.2 || ^7.0",
"symfony/finder": "^5.4 || ^6.2 || ^7.0",
"symfony/form": "^5.4 || ^6.2 || ^7.0",
"symfony/framework-bundle": "^5.4 || ^6.2 || ^7.0",
"symfony/http-client": "^5.4 || ^6.2 || ^7.0",
"symfony/http-foundation": "^5.4 || ^6.2 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.2 || ^7.0",
"symfony/mime": "^5.4 || ^6.2 || ^7.0",
"symfony/options-resolver": "^5.4 || ^6.2 || ^7.0",
"symfony/routing": "^5.4 || ^6.2 || ^7.0",
"symfony/security-bundle": "^5.4 || ^6.2 || ^7.0",
"symfony/security-core": "^5.4 || ^6.2 || ^7.0",
"symfony/translation": "^5.4 || ^6.2 || ^7.0",
"symfony/translation-contracts": "^2.0 || ^3.0",
"symfony/twig-bridge": "^5.4 || ^6.2",
"symfony/twig-bundle": "^5.4 || ^6.2",
"symfony/validator": "^5.4 || ^6.2",
"symfony/twig-bridge": "^5.4 || ^6.2 || ^7.0",
"symfony/twig-bundle": "^5.4 || ^6.2 || ^7.0",
"symfony/validator": "^5.4 || ^6.2 || ^7.0",
"twig/string-extra": "^3.0",
"twig/twig": "^3.0"
},
Expand Down Expand Up @@ -89,10 +89,10 @@
"sonata-project/block-bundle": "^4.11 || ^5.0",
"sonata-project/classification-bundle": "^4.0",
"sonata-project/doctrine-orm-admin-bundle": "^4.0",
"symfony/browser-kit": "^5.4 || ^6.2",
"symfony/messenger": "^5.4 || ^6.2",
"symfony/browser-kit": "^5.4 || ^6.2 || ^7.0",
"symfony/messenger": "^5.4 || ^6.2 || ^7.0",
"symfony/phpunit-bridge": "^6.2",
"symfony/security-csrf": "^5.4 || ^6.2",
"symfony/security-csrf": "^5.4 || ^6.2 || ^7.0",
"vimeo/psalm": "^5.0"
},
"conflict": {
Expand Down Expand Up @@ -134,5 +134,11 @@
"phpstan/extension-installer": true
},
"sort-packages": true
}
},
"repositories": [
{
"type": "git",
"url": "https://github.com/sonata-project/form-extensions"
}
]
}
8 changes: 4 additions & 4 deletions src/Filesystem/Replicate.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
*
* @return int|bool
*/
public function mtime($key)
public function mtime($key): int|bool
{
return $this->primary->mtime($key);
}
Expand All @@ -87,7 +87,7 @@
*
* @return int|bool
*/
public function write($key, $content)
public function write($key, $content): int|bool

Check failure on line 90 in src/Filesystem/Replicate.php

View workflow job for this annotation

GitHub Actions / PHPStan

Method Sonata\MediaBundle\Filesystem\Replicate::write() never returns int so it can be removed from the return type.
{
$ok = true;
$return = false;
Expand Down Expand Up @@ -116,7 +116,7 @@
*
* @return string|bool
*/
public function read($key)
public function read($key): string|bool
{
return $this->primary->read($key);
}
Expand Down Expand Up @@ -172,7 +172,7 @@
*
* @return mixed[]
*/
public function getMetadata($key)
public function getMetadata($key): array
{
if ($this->primary instanceof MetadataSupporter) {
return $this->primary->getMetadata($key);
Expand Down
6 changes: 3 additions & 3 deletions src/Form/DataTransformer/ProviderDataTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function __construct(
* @phpstan-return MediaInterface|null
*/
#[\ReturnTypeWillChange]
public function transform($value)
public function transform($value): mixed
{
if (null === $value) {
return new $this->class();
Expand All @@ -76,7 +76,7 @@ public function transform($value)
* @phpstan-return MediaInterface|null
*/
#[\ReturnTypeWillChange]
public function reverseTransform($value)
public function reverseTransform($value): mixed
{
if (!$value instanceof MediaInterface) {
return null;
Expand Down Expand Up @@ -141,7 +141,7 @@ public function reverseTransform($value)
*
* @return array<string, mixed>
*/
private function getOptions(array $options)
private function getOptions(array $options): array
{
return array_merge([
'provider' => false,
Expand Down
2 changes: 1 addition & 1 deletion src/Model/NoDriverGalleryManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $
*
* @return GalleryInterface<GalleryItemInterface>|null
*/
public function findOneBy(array $criteria, ?array $orderBy = null): ?object
public function findOneBy(array $criteria, ?array $orderBy = null): ?GalleryInterface
{
throw new NoDriverException();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/NoDriverMediaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $
*
* @return MediaInterface|null
*/
public function findOneBy(array $criteria, ?array $orderBy = null): ?object
public function findOneBy(array $criteria, ?array $orderBy = null): ?MediaInterface
{
throw new NoDriverException();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/BaseProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ final public function addFormat(string $name, array $settings): void
$this->formats[$name] = $settings;
}

final public function getFormat(string $name)
final public function getFormat(string $name): array|false
{
return $this->formats[$name] ?? false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/Metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
return $this->description;
}

public function getImage(): ?string

Check failure on line 43 in src/Provider/Metadata.php

View workflow job for this annotation

GitHub Actions / PHPStan

Method Sonata\MediaBundle\Provider\Metadata::getImage() never returns null so it can be removed from the return type.
{
return $this->image;
}
Expand All @@ -55,7 +55,7 @@
return $this->options;
}

public function getOption(string $name, $default = null)
public function getOption(string $name, $default = null): mixed
{
return \array_key_exists($name, $this->options) ? $this->options[$name] : $default;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/Constraints/ValidMediaFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
/**
* @return string|string[]
*/
#[\ReturnTypeWillChange]

Check failure on line 33 in src/Validator/Constraints/ValidMediaFormat.php

View workflow job for this annotation

GitHub Actions / PHPStan

Method Sonata\MediaBundle\Validator\Constraints\ValidMediaFormat::getTargets() never returns array<string> so it can be removed from the return type.
public function getTargets()
public function getTargets(): string|array
{
return self::CLASS_CONSTRAINT;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Document/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function setId(int|string|null $id): void
$this->id = $id;
}

public function getId()
public function getId(): int|string|null
{
return $this->id;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Entity/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function setId(int|string|null $id): void
$this->id = $id;
}

public function getId()
public function getId(): int|string|null
{
return $this->id;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Provider/BaseProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BaseProviderTest extends AbstractProviderTest
/**
* @return TestProvider
*/
public function getProvider(): MediaProviderInterface
public function getProvider(): TestProvider
{
$adapter = $this->createMock(Adapter::class);

Expand Down
2 changes: 1 addition & 1 deletion tests/Provider/FileProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ private function createErrorElement(ExecutionContextInterface $executionContext)
/**
* @return MockObject&ConstraintViolationBuilderInterface
*/
private function createConstraintBuilder(): object
private function createConstraintBuilder(): MockObject&ConstraintViolationBuilderInterface
{
$constraintBuilder = $this->createMock(ConstraintViolationBuilderInterface::class);
$constraintBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected function createValidator(): ConstraintValidatorInterface
/**
* @return Stub&ImageInterface
*/
private function mockImage(int $width, int $height): object
private function mockImage(int $width, int $height): Stub&ImageInterface
{
$box = $this->createStub(BoxInterface::class);
$box->method('getWidth')->willReturn($width);
Expand All @@ -145,7 +145,7 @@ private function mockImage(int $width, int $height): object
/**
* @return Stub&MediaInterface
*/
private function mockMedia(): Stub
private function mockMedia(): Stub&MediaInterface
{
$binaryContent = $this->createStub(UploadedFile::class);
$binaryContent->method('getPathname')->willReturn('pathname');
Expand Down
Loading