Skip to content

Commit

Permalink
Fix PhpStan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek committed Dec 13, 2020
1 parent 5378cdd commit ddfceab
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


use Baraja\AssetsLoader\Minifier\Minifier;
use Nette\Utils\FileSystem;

final class Api
{
Expand Down Expand Up @@ -113,7 +114,7 @@ public function run(string $path): void
echo '/* Path "' . htmlspecialchars($parser[1]) . '" was automatically generated ' . date('Y-m-d H:i:s', $topModTime) . ' */' . "\n\n"; // 4.
foreach ($filePaths as $file => $filePath) {
echo '/* ' . $file . ' */' . "\n";
echo $this->minifier->minify(file_get_contents($filePath), $format);
echo $this->minifier->minify(FileSystem::read($filePath), $format);
echo "\n\n";
}
die;
Expand Down
4 changes: 2 additions & 2 deletions src/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function formatRoute(string $module, string $presenter = 'Homepage
}


public static function formatRouteToPath(string $route): ?string
public static function formatRouteToPath(string $route): string
{
if ($route === 'Error4xx:default') {
return 'error4xx-default';
Expand All @@ -57,7 +57,7 @@ public static function formatRouteToPath(string $route): ?string
return self::firstLower($parser['module']) . '-' . self::firstLower($parser['presenter']) . '-' . self::firstLower($parser['action']);
}

return null;
throw new \InvalidArgumentException('Can not parse route format, because haystack "' . $route . '" given.');
}


Expand Down
2 changes: 1 addition & 1 deletion src/Minifier/DefaultCssMinifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ final class DefaultCssMinifier implements AssetMinifier
{
public function minify(string $haystack): string
{
return preg_replace_callback(
return (string) preg_replace_callback(
'#[ \t\r\n]+|<(/)?(textarea|pre|script)(?=\W)#si',
static function ($m): string {
if (empty($m[2])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Minifier/DefaultJsMinifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ final class DefaultJsMinifier implements AssetMinifier
{
public function minify(string $haystack): string
{
return JShrinkMinifier::minify($haystack);
return (string) JShrinkMinifier::minify($haystack);
}
}

0 comments on commit ddfceab

Please sign in to comment.