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 Jan 9, 2023
2 parents f3f6b54 + 577f7af commit 1124c66
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 34 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
dependencies: [highest]
allowed-to-fail: [false]
symfony-require: ['']
Expand Down Expand Up @@ -68,6 +69,11 @@ jobs:
allowed-to-fail: false
symfony-require: 6.1.*
variant: symfony/symfony:"6.1.*"
- php-version: '8.1'
dependencies: highest
allowed-to-fail: false
symfony-require: 6.2.*
variant: symfony/symfony:"6.2.*"

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"phpunit/phpunit": "^9.5",
"psalm/plugin-phpunit": "^0.17",
"psalm/plugin-symfony": "^3.0",
"rector/rector": "^0.14",
"rector/rector": "^0.15",
"sonata-project/admin-bundle": "^4.9",
"sonata-project/block-bundle": "^4.11",
"sonata-project/classification-bundle": "^4.0",
Expand Down
7 changes: 7 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# DO NOT EDIT THIS FILE!
#
# It's auto-generated by sonata-project/dev-kit package.

includes:
- phpstan-baseline.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon

parameters:
level: 8
Expand All @@ -8,6 +13,8 @@ parameters:
paths:
- src
- tests
scanFiles:
- vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php
treatPhpDocTypesAsCertain: false
checkGenericClassInNonGenericObjectType: true
checkInternalClassCaseSensitivity: true
Expand Down
8 changes: 0 additions & 8 deletions psalm-baseline.xml

This file was deleted.

8 changes: 7 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<psalm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" errorLevel="2" findUnusedPsalmSuppress="true" resolveFromConfigFile="true" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" errorBaseline="psalm-baseline.xml">
<psalm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" errorLevel="2" findUnusedPsalmSuppress="true" resolveFromConfigFile="true" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd">
<projectFiles>
<directory name="src"/>
<directory name="tests"/>
Expand All @@ -15,5 +15,11 @@
<!-- Psalm equivalent of PHPStan config `treatPhpDocTypesAsCertain: false` -->
<DocblockTypeContradiction errorLevel="suppress"/>
<RedundantConditionGivenDocblockType errorLevel="suppress"/>
<UndefinedInterfaceMethod>
<errorLevel type="suppress">
<!-- https://github.com/psalm/psalm-plugin-symfony/issues/287 -->
<referencedMethod name="Symfony\Component\Console\Helper\HelperInterface::ask"/>
</errorLevel>
</UndefinedInterfaceMethod>
</issueHandlers>
</psalm>
10 changes: 2 additions & 8 deletions src/Command/RefreshMetadataCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Sonata\MediaBundle\Provider\Pool;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -135,7 +134,7 @@ private function getProvider(InputInterface $input, OutputInterface $output): Me
$providerName = $input->getArgument('providerName');

if (null === $providerName) {
$providerName = $this->getQuestionHelper()->ask(
$providerName = $this->getHelper('question')->ask(
$input,
$output,
new ChoiceQuestion('Please select the provider', array_keys($this->mediaPool->getProviders()))
Expand All @@ -150,7 +149,7 @@ private function getContext(InputInterface $input, OutputInterface $output): str
$context = $input->getArgument('context');

if (null === $context) {
$context = $this->getQuestionHelper()->ask(
$context = $this->getHelper('question')->ask(
$input,
$output,
new ChoiceQuestion('Please select the context', array_keys($this->mediaPool->getContexts()))
Expand All @@ -159,9 +158,4 @@ private function getContext(InputInterface $input, OutputInterface $output): str

return $context;
}

private function getQuestionHelper(): QuestionHelper
{
return $this->getHelper('question');
}
}
12 changes: 3 additions & 9 deletions src/Command/RemoveThumbsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Sonata\MediaBundle\Provider\Pool;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -144,7 +143,7 @@ private function getProvider(InputInterface $input, OutputInterface $output): Me
$providerName = $input->getArgument('providerName');

if (null === $providerName) {
$providerName = $this->getQuestionHelper()->ask(
$providerName = $this->getHelper('question')->ask(
$input,
$output,
new ChoiceQuestion('Please select the provider', array_keys($this->mediaPool->getProviders()))
Expand All @@ -159,7 +158,7 @@ private function getContext(InputInterface $input, OutputInterface $output): str
$context = $input->getArgument('context');

if (null === $context) {
$context = $this->getQuestionHelper()->ask(
$context = $this->getHelper('question')->ask(
$input,
$output,
new ChoiceQuestion('Please select the context', array_keys($this->mediaPool->getContexts()))
Expand All @@ -177,7 +176,7 @@ private function getFormat(InputInterface $input, OutputInterface $output, Media
$formats = array_keys($provider->getFormats());
$formats[] = '<ALL THUMBNAILS>';

$format = $this->getQuestionHelper()->ask(
$format = $this->getHelper('question')->ask(
$input,
$output,
new ChoiceQuestion('Please select the format', $formats)
Expand Down Expand Up @@ -229,9 +228,4 @@ private function log(OutputInterface $output, string $message): void
$output->writeln($message);
}
}

private function getQuestionHelper(): QuestionHelper
{
return $this->getHelper('question');
}
}
2 changes: 2 additions & 0 deletions src/Messenger/GenerateThumbnailsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

/**
* @author Jordi Sala Morales <jordism91@gmail.com>
*
* @psalm-suppress DeprecatedInterface
*/
final class GenerateThumbnailsHandler implements MessageHandlerInterface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/BaseVideoProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ protected function getMetadata(MediaInterface $media, string $url)
} catch (\RuntimeException $exception) {
throw new \RuntimeException(
sprintf('Unable to retrieve the video information for: %s', $url),
$exception->getCode(),
(int) $exception->getCode(),
$exception
);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Messenger/GenerateThumbnailsHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ final class GenerateThumbnailsHandlerTest extends TestCase
/**
* @var MockObject&GenerableThumbnailInterface
*/
private $thumbnail;
private GenerableThumbnailInterface $thumbnail;

/**
* @var MockObject&MediaManagerInterface
*/
private $mediaManager;
private MediaManagerInterface $mediaManager;

private Pool $pool;

Expand Down
2 changes: 1 addition & 1 deletion tests/Thumbnail/MessengerThumbnailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class MessengerThumbnailTest extends TestCase
/**
* @var MockObject&MessageBusInterface
*/
private $bus;
private MessageBusInterface $bus;

private MessengerThumbnail $thumbnail;

Expand Down
6 changes: 3 additions & 3 deletions tests/Twig/MediaRuntimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ class MediaRuntimeTest extends TestCase
/**
* @var MockObject&MediaManagerInterface
*/
private $mediaManager;
private MediaManagerInterface $mediaManager;

/**
* @var MockObject&Environment
*/
private $twig;
private Environment $twig;

/**
* @var MockObject&MediaProviderInterface
*/
private $provider;
private MediaProviderInterface $provider;

private MediaRuntime $mediaRuntime;

Expand Down

0 comments on commit 1124c66

Please sign in to comment.