Skip to content

Commit

Permalink
Fix new PhpStan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
blankse authored and brusch committed Mar 3, 2022
1 parent 80573c2 commit ce5c01f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -169,8 +169,8 @@
"codeception/codeception": "^4.1.12",
"codeception/module-symfony": "^1.6.0",
"codeception/phpunit-wrapper": "^9",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-symfony": "^1.1",
"phpstan/phpstan": "^1.4.7",
"phpstan/phpstan-symfony": "^1.1.7",
"phpunit/phpunit": "^9.3",
"spiritix/php-chrome-html2pdf": "^1.6",
"elasticsearch/elasticsearch": "^7.11",
Expand Down
2 changes: 1 addition & 1 deletion lib/Image/Adapter/Imagick.php
Expand Up @@ -461,7 +461,7 @@ public static function getCMYKColorProfile()
$path = __DIR__ . '/../icc-profiles/ISOcoated_v2_eci.icc'; // default profile
}

if ($path && file_exists($path)) {
if (file_exists($path)) {
self::$CMYKColorProfile = file_get_contents($path);
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Tool/AssetsInstaller.php
Expand Up @@ -29,12 +29,12 @@
class AssetsInstaller
{
/**
* @var \Closure
* @var \Closure|null
*/
private $runCallback;

/**
* @var string
* @var string|null
*/
private $composerJsonSetting;

Expand Down Expand Up @@ -109,7 +109,7 @@ public function resolveOptions(array $options = [])
}

/**
* @param \Closure $runCallback
* @param \Closure|null $runCallback
*/
public function setRunCallback(\Closure $runCallback = null)
{
Expand Down
8 changes: 4 additions & 4 deletions models/Asset/Image.php
Expand Up @@ -125,10 +125,10 @@ public function detectFaces(): bool
list($x, $y, $width, $height) = explode(' ', $coordinates);

// percentages
$Px = $x / $imageWidth * 100;
$Py = $y / $imageHeight * 100;
$Pw = $width / $imageWidth * 100;
$Ph = $height / $imageHeight * 100;
$Px = (int) $x / $imageWidth * 100;
$Py = (int) $y / $imageHeight * 100;
$Pw = (int) $width / $imageWidth * 100;
$Ph = (int) $height / $imageHeight * 100;

$faceCoordinates[] = [
'x' => $Px,
Expand Down
6 changes: 3 additions & 3 deletions models/DataObject/ClassDefinition/Data/Time.php
Expand Up @@ -151,12 +151,12 @@ public function isEmpty($data)
*/
private function toTime($timestamp)
{
$time = @date('H:i', strtotime($timestamp));
if (!$time) {
$timestamp = strtotime($timestamp);
if (!$timestamp) {
return null;
}

return $time;
return date('H:i', $timestamp);
}

/**
Expand Down
5 changes: 5 additions & 0 deletions phpstan-baseline.neon
Expand Up @@ -70,6 +70,11 @@ parameters:
count: 1
path: bundles/EcommerceFrameworkBundle/IndexService/ProductList/DefaultFindologic.php

-
message: "#^Call to function is_array\\(\\) with mixed will always evaluate to false\\.$#"
count: 1
path: bundles/EcommerceFrameworkBundle/IndexService/Worker/DefaultFindologic.php

-
message: "#^Negated boolean expression is always false\\.$#"
count: 1
Expand Down

0 comments on commit ce5c01f

Please sign in to comment.