Skip to content

Commit 111848c

Browse files
committed
Fix CS
1 parent f4ce3c1 commit 111848c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/Action/Action.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use CaptainHook\App\Hook\Action as ActionInterface;
1313
use SebastianFeldmann\Git\Repository;
1414

15+
use function sprintf;
16+
1517
abstract class Action implements ActionInterface
1618
{
1719
protected const ERROR_MESSAGE = "I'm sorry, Dave. I'm afraid I can't do that. Please check your commit for errors";
@@ -31,7 +33,7 @@ protected function throwError(ActionConfig $config, IO $io): void
3133
{
3234
$errorMessage = $this->getErrorMessage($config->getOptions());
3335

34-
$io->writeError("<error>{$errorMessage}</error>");
36+
$io->writeError(sprintf('<error>%s</error>', $errorMessage));
3537

3638
throw new ActionFailed($errorMessage);
3739
}

src/Action/CheckAssetsAction.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use function count;
1212
use function in_array;
13+
use function str_contains;
1314

1415
/**
1516
* @deprecated Will be removed in 3.0, since assets are not committed to the repository any more.
@@ -83,8 +84,6 @@ private function checkAssetsConfigFiles(Repository $repository): bool
8384

8485
if (str_contains($jsonFile, 'build/manifest.json')) {
8586
$manifestFound = true;
86-
87-
continue;
8887
}
8988
}
9089

@@ -97,7 +96,7 @@ private function checkAssetsConfigFiles(Repository $repository): bool
9796
*/
9897
private function checkCssBuildFiles(array $changedSassFiles, array $changedCssFiles): bool
9998
{
100-
$cssBuildFound = count($changedSassFiles) > 0 ? false : true;
99+
$cssBuildFound = count($changedSassFiles) === 0;
101100

102101
foreach ($changedCssFiles as $cssFile) {
103102
if (str_contains($cssFile, 'build')) {
@@ -115,7 +114,7 @@ private function checkCssBuildFiles(array $changedSassFiles, array $changedCssFi
115114
*/
116115
private function checkJsBuildFiles(array $changedJSFiles): bool
117116
{
118-
$jsBuildFound = count($changedJSFiles) > 0 ? false : true;
117+
$jsBuildFound = count($changedJSFiles) === 0;
119118
foreach ($changedJSFiles as $changedJSFile) {
120119
if (str_contains($changedJSFile, 'build')) {
121120
$jsBuildFound = true;

0 commit comments

Comments
 (0)