Skip to content

Commit c985301

Browse files
committed
Fix PHP-CS lint
1 parent d1ca5cb commit c985301

7 files changed

+14
-15
lines changed

Diff for: src/DefaultImageOptimizer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class DefaultImageOptimizer implements ImageOptimizerInterface
1010
{
11-
public function optimizeImage(string $pathToImage, string $pathToOutput = null) : bool
11+
public function optimizeImage(string $pathToImage, string $pathToOutput = null): bool
1212
{
1313
if (empty($pathToOutput)) {
1414
$pathToOutput = $pathToImage;
@@ -20,7 +20,7 @@ public function optimizeImage(string $pathToImage, string $pathToOutput = null)
2020
return $this->convert($pathToOutput, $pathToOutput);
2121
}
2222

23-
private function convert(string $pathToImage, string $pathToOutput) : bool
23+
private function convert(string $pathToImage, string $pathToOutput): bool
2424
{
2525
$command = sprintf('convert %s -sampling-factor 4:2:0 -strip -quality 65 %s', $pathToImage, $pathToOutput);
2626

Diff for: src/ImageOptimizerInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66

77
interface ImageOptimizerInterface
88
{
9-
public function optimizeImage(string $pathToImage, string $pathToOutput = null) : bool;
9+
public function optimizeImage(string $pathToImage, string $pathToOutput = null): bool;
1010
}

Diff for: src/VerifiesCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
trait VerifiesCommand
88
{
9-
private function commandExists($command) : bool
9+
private function commandExists($command): bool
1010
{
1111
$return = shell_exec(sprintf('which %s', escapeshellarg($command)));
1212

Diff for: src/WebpOptimizer.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99

1010
class WebpOptimizer implements ImageOptimizerInterface
1111
{
12-
const WEBP_EXT = 'webp';
13-
const CONVERTER_CMD = 'cwebp';
14-
1512
use VerifiesCommand;
13+
public const WEBP_EXT = 'webp';
14+
public const CONVERTER_CMD = 'cwebp';
1615

1716
public function __construct()
1817
{
@@ -21,7 +20,7 @@ public function __construct()
2120
}
2221
}
2322

24-
public function optimizeImage(string $pathToImage, string $pathToOutput = null) : bool
23+
public function optimizeImage(string $pathToImage, string $pathToOutput = null): bool
2524
{
2625
try {
2726
$pathToOutput ??= $this->getWebpPath($pathToImage);
@@ -55,7 +54,7 @@ public function optimizeImage(string $pathToImage, string $pathToOutput = null)
5554
return true;
5655
}
5756

58-
private function getWebpPath(string $file) : string
57+
private function getWebpPath(string $file): string
5958
{
6059
$fileParts = pathinfo($file);
6160

Diff for: tests/DefaultImageOptimizerTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class DefaultImageOptimizerTest extends TestCase
1616
/**
1717
* @dataProvider inputAndOutputImageProvider
1818
*/
19-
public function testOptimizeImageWithValidData($pathToImage, $pathToOutput, $expectedPathToOutput) : void
19+
public function testOptimizeImageWithValidData($pathToImage, $pathToOutput, $expectedPathToOutput): void
2020
{
2121
$optimizerChainMock = Mockery::mock(OptimizerChain::class);
2222
$optimizerChainMock->shouldReceive('optimize')
@@ -47,7 +47,7 @@ public function testOptimizeImageWithValidData($pathToImage, $pathToOutput, $exp
4747
Mockery::close();
4848
}
4949

50-
public function inputAndOutputImageProvider() : array
50+
public function inputAndOutputImageProvider(): array
5151
{
5252
return [
5353
['original/img.jpg', null, 'original/img.jpg'],

Diff for: tests/MissingLibraryExceptionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class MissingLibraryExceptionTest extends TestCase
1111
{
12-
public function testGeneratesMessage() : void
12+
public function testGeneratesMessage(): void
1313
{
1414
$library = 'cwebp';
1515

Diff for: tests/WebpOptimizerTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class WebpOptimizerTest extends TestCase
1515
/**
1616
* @dataProvider inputAndOutputImageProvider
1717
*/
18-
public function testOptimizeImageWithValidData($pathToImage, $pathToOutput, $expectedPathToOutput) : void
18+
public function testOptimizeImageWithValidData($pathToImage, $pathToOutput, $expectedPathToOutput): void
1919
{
2020
$options = [
2121
'converters' => [
@@ -49,15 +49,15 @@ public function testOptimizeImageWithValidData($pathToImage, $pathToOutput, $exp
4949
Mockery::close();
5050
}
5151

52-
public function inputAndOutputImageProvider() : array
52+
public function inputAndOutputImageProvider(): array
5353
{
5454
return [
5555
['/tmp/my-directory/image.png', '/tmp/my-directory/image.webp', '/tmp/my-directory/image.webp'],
5656
['/tmp/my-directory/image.png', null, '/tmp/my-directory/image.webp'],
5757
];
5858
}
5959

60-
public function testVerifiesLibraryInstallation() : void
60+
public function testVerifiesLibraryInstallation(): void
6161
{
6262
$this->expectException(MissingLibraryException::class);
6363

0 commit comments

Comments
 (0)