Skip to content

Commit de0b1ed

Browse files
authored
Fix reflection issue and CI (#32)
* Fix reflection issue * Add imagick to CI * Fix code style & static analysis * Fix imagemagick in CI * Install imagemagick manually * Fix changelog
1 parent d830ad5 commit de0b1ed

File tree

8 files changed

+19
-8
lines changed

8 files changed

+19
-8
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
coverage: pcov
3535
php-version: ${{ matrix.php-version }}
3636

37+
- name: Install Imagemagick
38+
run: sudo apt-get update && sudo apt-get install -y imagemagick
39+
3740
- name: Install Symfony Flex
3841
run: |
3942
composer config --global --no-plugins allow-plugins.symfony/flex true

CHANGELOG-5.x.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
5.1.1
2+
-----
3+
4+
* Fix reflection issue
5+
* Fix code style & static analysis
6+
* Fix CI
7+
18
5.1.0
29
-----
310

src/Command/ClearCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
3636

3737
$age = $input->getArgument('age');
3838
if ($age) {
39-
$output->writeln(sprintf('Clearing the IM cache older than %s days', $age));
39+
$output->writeln(\sprintf('Clearing the IM cache older than %s days', $age));
4040

4141
$finder = new Finder();
4242
foreach ($finder->in($cacheDir)->files()->date('until ' . $age . ' days ago') as $file) {

src/Controller/DefaultController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function index(Manager $im, Request $request, string $format, string $pat
2727
}
2828

2929
if (!$im->cacheExists($format, $path)) {
30-
throw new RuntimeException(sprintf('Caching of image failed for %s in %s format', $path, $format));
30+
throw new RuntimeException(\sprintf('Caching of image failed for %s in %s format', $path, $format));
3131
}
3232

3333
$extension = pathinfo($path, \PATHINFO_EXTENSION);

src/Listener/MogrifySubscriber.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ private function checkClassConfig(object $entity, EntityManagerInterface $entity
6767
foreach ($meta->getReflectionProperties() as $property) {
6868
if (null !== $property) {
6969
if ($meta->isMappedSuperclass && !$property->isPrivate()
70-
|| $meta->isInheritedField($property->name)
71-
|| isset($meta->associationMappings[$property->name]['inherited'])
70+
|| $meta->isInheritedField($property->getName())
71+
|| isset($meta->associationMappings[$property->getName()]['inherited'])
7272
) {
7373
continue;
7474
}

src/Manager.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private function convertFormat(mixed $format): array
167167
return ['thumbnail' => $format];
168168
}
169169

170-
throw new InvalidArgumentException(sprintf('Unknown IM format: %s', $format));
170+
throw new InvalidArgumentException(\sprintf('Unknown IM format: %s', $format));
171171
}
172172

173173
/**
@@ -176,11 +176,11 @@ private function convertFormat(mixed $format): array
176176
private function checkImage(string $path): void
177177
{
178178
if (!file_exists($this->getPublicDirectory() . '/' . $path) && !file_exists($path)) {
179-
throw new NotFoundException(sprintf('Unable to find the image "%s" to cache', $path));
179+
throw new NotFoundException(\sprintf('Unable to find the image "%s" to cache', $path));
180180
}
181181

182182
if (!is_file($this->getPublicDirectory() . '/' . $path) && !is_file($path)) {
183-
throw new HttpException(400, sprintf('[ImBundle] "%s" is no file', $path));
183+
throw new HttpException(400, \sprintf('[ImBundle] "%s" is no file', $path));
184184
}
185185
}
186186

src/Twig/Extension/ImExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public function convert(string $html): string
5858
if (!empty($width) || !empty($height)) {
5959
$format = $width . 'x' . $height;
6060
$updatedTagString = preg_replace("| src=[\"']" . $src . "[\"']|", ' src="' . $this->imResize($src, $format) . '"', $img);
61+
\assert(null !== $updatedTagString);
6162
$html = str_replace($img, $updatedTagString, $html);
6263
}
6364
}

src/Wrapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function checkDirectory(string $path): void
6666
{
6767
$dir = \dirname($path);
6868
if (!is_dir($dir) && !mkdir($dir, 0777, true) && !is_dir($dir)) {
69-
throw new RuntimeException(sprintf('Unable to create the "%s" directory', $dir));
69+
throw new RuntimeException(\sprintf('Unable to create the "%s" directory', $dir));
7070
}
7171
}
7272

0 commit comments

Comments
 (0)