Skip to content

Commit bc0e753

Browse files
authored
Apply fixes with regard to new PHPStan rules (#56)
1 parent c0d1ce4 commit bc0e753

File tree

13 files changed

+44
-37
lines changed

13 files changed

+44
-37
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ root = true
44
charset = utf-8
55
end_of_line = lf
66
insert_final_newline = false
7-
indent_style = tab
7+
indent_style = space
88
indent_size = 4
99
trim_trailing_whitespace = true
1010

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @category PHPExif
1515
* @package Reader
1616
*/
17-
abstract class AdapterAbstract implements AdapterInterface
17+
abstract class AbstractAdapter implements AdapterInterface
1818
{
1919
protected string $hydratorClass = '\\PHPExif\\Hydrator\\Mutator';
2020
protected ?MapperInterface $mapper = null;

lib/PHPExif/Adapter/Exiftool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* @category PHPExif
2121
* @package Reader
2222
*/
23-
class Exiftool extends AdapterAbstract
23+
class Exiftool extends AbstractAdapter
2424
{
2525
const TOOL_NAME = 'exiftool';
2626

lib/PHPExif/Adapter/FFprobe.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* @category PHPExif
3030
* @package Reader
3131
*/
32-
class FFprobe extends AdapterAbstract
32+
class FFprobe extends AbstractAdapter
3333
{
3434
public const TOOL_NAME = 'ffprobe';
3535

lib/PHPExif/Adapter/ImageMagick.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* @category PHPExif
1919
* @package Reader
2020
*/
21-
class ImageMagick extends AdapterAbstract
21+
class ImageMagick extends AbstractAdapter
2222
{
2323
const TOOL_NAME = 'imagick';
2424

lib/PHPExif/Adapter/Native.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* @category PHPExif
1919
* @package Reader
2020
*/
21-
class Native extends AdapterAbstract
21+
class Native extends AbstractAdapter
2222
{
2323
const INCLUDE_THUMBNAIL = true;
2424
const NO_THUMBNAIL = false;
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
* @category PHPExif
1111
* @package Mapper
1212
*/
13-
abstract class MapperAbstract implements MapperInterface
13+
abstract class AbstractMapper implements MapperInterface
1414
{
15+
public const ROUNDING_PRECISION = 12;
16+
1517
/**
1618
* Trim whitespaces recursively
1719
*

lib/PHPExif/Mapper/Exiftool.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* @category PHPExif
2626
* @package Mapper
2727
*/
28-
class Exiftool extends MapperAbstract
28+
class Exiftool extends AbstractMapper
2929
{
3030
public const APERTURE = 'Composite:Aperture';
3131
public const APPROXIMATEFOCUSDISTANCE = 'XMP-aux:ApproximateFocusDistance';
@@ -382,7 +382,8 @@ public function mapRawData(array $data): array
382382

383383
// add GPS coordinates, if available
384384
if ((isset($mappedData[Exif::LATITUDE])) && (isset($mappedData[Exif::LONGITUDE]))) {
385-
$mappedData[Exif::GPS] = sprintf('%s,%s', $mappedData[Exif::LATITUDE], $mappedData[Exif::LONGITUDE]);
385+
$mappedData[Exif::GPS] =
386+
sprintf('%s,%s', (string) $mappedData[Exif::LATITUDE], (string) $mappedData[Exif::LONGITUDE]);
386387
}
387388

388389
return $mappedData;

lib/PHPExif/Mapper/FFprobe.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* @category PHPExif
1616
* @package Mapper
1717
*/
18-
class FFprobe extends MapperAbstract
18+
class FFprobe extends AbstractMapper
1919
{
2020
const HEIGHT = 'height';
2121
const WIDTH = 'width';
@@ -171,7 +171,11 @@ public function mapRawData(array $data) : array
171171

172172
// add GPS coordinates, if available
173173
if ((isset($mappedData[Exif::LATITUDE])) && (isset($mappedData[Exif::LONGITUDE]))) {
174-
$mappedData[Exif::GPS] = sprintf('%s,%s', $mappedData[Exif::LATITUDE], $mappedData[Exif::LONGITUDE]);
174+
$mappedData[Exif::GPS] = sprintf(
175+
'%s,%s',
176+
(string) $mappedData[Exif::LATITUDE],
177+
(string) $mappedData[Exif::LONGITUDE]
178+
);
175179
}
176180

177181
// Swap width and height if needed

lib/PHPExif/Mapper/ImageMagick.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @category PHPExif
1818
* @package Mapper
1919
*/
20-
class ImageMagick extends MapperAbstract
20+
class ImageMagick extends AbstractMapper
2121
{
2222
const APERTURE = 'exif:FNumber';
2323
const ARTIST = 'exif:Artist';
@@ -264,7 +264,8 @@ public function mapRawData(array $data) : array
264264

265265
// add GPS coordinates, if available
266266
if ((isset($mappedData[Exif::LATITUDE])) && (isset($mappedData[Exif::LONGITUDE]))) {
267-
$mappedData[Exif::GPS] = sprintf('%s,%s', $mappedData[Exif::LATITUDE], $mappedData[Exif::LONGITUDE]);
267+
$mappedData[Exif::GPS] =
268+
sprintf('%s,%s', (string) $mappedData[Exif::LATITUDE], (string) $mappedData[Exif::LONGITUDE]);
268269
}
269270
return $mappedData;
270271
}

0 commit comments

Comments
 (0)