Skip to content

Commit

Permalink
merge 2.x to 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Nov 7, 2022
1 parent 9ef9ac6 commit b00a939
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 20 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -24,7 +24,7 @@
"require": {
"php": "^8.0",
"ext-mbstring": "*",
"imagine/imagine": "^1.2.4",
"imagine/imagine": "^1.3.2",
"symfony/filesystem": "^5.3|^6.0",
"symfony/finder": "^5.3|^6.0",
"symfony/framework-bundle": "^5.3|^6.0",
Expand Down
3 changes: 1 addition & 2 deletions src/Component/Console/Style/ImagineStyle.php
Expand Up @@ -15,7 +15,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use ValueError;

/**
* @internal
Expand Down Expand Up @@ -144,7 +143,7 @@ private function compileString(string $format, array $replacements = []): string
if (false !== $compiled = @vsprintf($format, $replacements)) {
return $compiled;
}
} catch (ValueError $error) {
} catch (\ValueError $error) {
}

throw new InvalidArgumentException(sprintf('Invalid string format "%s" or replacements "%s".', $format, implode(', ', array_map(function ($replacement) { return var_export($replacement, true); }, $replacements))));
Expand Down
3 changes: 0 additions & 3 deletions src/Imagine/Cache/Resolver/PsrCacheResolver.php
Expand Up @@ -14,9 +14,6 @@
use Liip\ImagineBundle\Binary\BinaryInterface;
use Psr\Cache\CacheItemInterface;
use Psr\Cache\CacheItemPoolInterface;

use function str_replace;

use Symfony\Component\OptionsResolver\OptionsResolver;

final class PsrCacheResolver implements ResolverInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Imagine/Filter/Loader/ResampleFilterLoader.php
Expand Up @@ -111,7 +111,7 @@ private function resolveOptions(array $options): array
}
}

throw new InvalidArgumentException('Invalid value for "filter" option: must be a valid constant resolvable using one of formats '.'"\Imagine\Image\ImageInterface::FILTER_%s", "\Imagine\Image\ImageInterface::%s", or "%s".');
throw new InvalidArgumentException('Invalid value for "filter" option: must be a valid constant resolvable using one of formats "\Imagine\Image\ImageInterface::FILTER_%s", "\Imagine\Image\ImageInterface::%s", or "%s".');
});

try {
Expand Down
19 changes: 9 additions & 10 deletions tests/Component/Console/Style/ImagineStyleTest.php
Expand Up @@ -11,7 +11,6 @@

namespace Liip\ImagineBundle\Tests\Component\Console\IO;

use Generator;
use Liip\ImagineBundle\Component\Console\Style\ImagineStyle;
use Liip\ImagineBundle\Exception\InvalidArgumentException;
use Liip\ImagineBundle\Tests\AbstractTest;
Expand All @@ -35,7 +34,7 @@ public function testText(string $format, array $replacements): void
$this->assertStringContainsString(vsprintf($format, $replacements), $output->getBuffer());
}

public static function provideTextData(): Generator
public static function provideTextData(): \Generator
{
yield ['Text with <em>0</em> replacements.', []];
yield ['Text with a <comment>%s string</comment>.', ['replacement']];
Expand All @@ -54,7 +53,7 @@ public function testTextWithoutDecoration(string $format, array $replacements):
$this->assertStringContainsString(strip_tags(vsprintf($format, $replacements)), $output->getBuffer());
}

public static function provideTextWithoutDecorationData(): Generator
public static function provideTextWithoutDecorationData(): \Generator
{
return static::provideTextData();
}
Expand All @@ -70,7 +69,7 @@ public function testLine(string $format, array $replacements): void
$this->assertStringContainsString(vsprintf($format, $replacements).PHP_EOL, $output->getBuffer());
}

public static function provideLineData(): Generator
public static function provideLineData(): \Generator
{
return static::provideTextData();
}
Expand All @@ -88,7 +87,7 @@ public function testNewline(int $newlineCount, string $separator): void
$this->assertStringContainsString(sprintf('%1$s%2$s%1$s', $separator, str_repeat(PHP_EOL, $newlineCount)), $output->getBuffer());
}

public static function provideNewlineData(): Generator
public static function provideNewlineData(): \Generator
{
for ($i = 0; $i <= 200; $i += 50) {
yield [$i, sprintf('[abcdef0123-%d]', $i)];
Expand Down Expand Up @@ -120,7 +119,7 @@ public function testTitle(string $title, string $type = null, bool $decoration):
$this->assertStringContainsString($expected, $output->getBuffer());
}

public static function provideTitleData(): Generator
public static function provideTitleData(): \Generator
{
$titles = [
'A simple title',
Expand Down Expand Up @@ -151,7 +150,7 @@ public function testBlockTypes(string $type, string $expectedFormat, string $for
$this->assertStringContainsString(sprintf($expectedFormat, $compiled), $output->getBuffer());
}

public static function provideBlockTypesData(): Generator
public static function provideBlockTypesData(): \Generator
{
$types = [
'okay' => ['<fg=black;bg=green> - [OKAY] %s', '[OKAY] %s'],
Expand Down Expand Up @@ -185,7 +184,7 @@ public function testStatus(string $status, string $fg = null, string $bg = null)
$this->assertStringContainsString(sprintf('(%s)', $status), strip_tags($output->getBuffer()));
}

public static function provideStatusData(): Generator
public static function provideStatusData(): \Generator
{
$states = ['resolved', 'skipped', 'failed', 'cached', 'ignored'];

Expand All @@ -209,7 +208,7 @@ public function testGroup(string $item, string $group, string $fg = null, string
$this->assertStringContainsString(sprintf('%s[%s]', $item, $group), strip_tags($output->getBuffer()));
}

public static function provideGroupData(): Generator
public static function provideGroupData(): \Generator
{
foreach (static::getConsoleColors() as $color) {
for ($i = 1; $i < 10; $i += 3) {
Expand All @@ -232,7 +231,7 @@ public function testInvalidFormatAndReplacements(string $format, array $replacem
$style->text($format, $replacements);
}

public static function provideInvalidFormatAndReplacementsData(): Generator
public static function provideInvalidFormatAndReplacementsData(): \Generator
{
yield ['%s %s', ['bad-replacements-array']];
yield ['%s %s %s %s %s', ['not', 'enough', 'replacements']];
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Controller/ImagineControllerTest.php
Expand Up @@ -308,7 +308,7 @@ public function testShouldResolveWithCustomFiltersFromCache(): void

$this->assertInstanceOf(RedirectResponse::class, $response);
$this->assertSame(302, $response->getStatusCode());
$this->assertSame('http://localhost/media/cache'.'/'.$expectedCachePath, $response->getTargetUrl());
$this->assertSame('http://localhost/media/cache/'.$expectedCachePath, $response->getTargetUrl());

$this->assertFileExists($this->cacheRoot.'/'.$expectedCachePath);

Expand Down
3 changes: 1 addition & 2 deletions tests/Message/Handler/WarmupCacheHandlerTest.php
Expand Up @@ -19,7 +19,6 @@
use Liip\ImagineBundle\Message\WarmupCache;
use Liip\ImagineBundle\Service\FilterService;
use Liip\ImagineBundle\Tests\Functional\AbstractWebTestCase;
use ReflectionClass;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Messenger\MessageBusInterface;

Expand All @@ -37,7 +36,7 @@ protected function setUp(): void

public function testShouldImplementMessageHandlerInterface(): void
{
$rc = new ReflectionClass(WarmupCacheHandler::class);
$rc = new \ReflectionClass(WarmupCacheHandler::class);

$this->assertTrue($rc->implementsInterface(MessageHandlerInterface::class));
}
Expand Down

0 comments on commit b00a939

Please sign in to comment.