Skip to content

Commit

Permalink
fix types (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabio-ivona authored Nov 30, 2022
1 parent 9a82185 commit 49717f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Actions/StyleToMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,10 @@ private static function sortStyles(array $styles): array
*/
private function applyMediaQuery(string $method): string
{
$matches = [];
preg_match(self::MEDIA_QUERIES_REGEX, $method, $matches);

if (count($matches ?? []) < 1) {
if (count($matches) < 1) {
return $method;
}

Expand Down
3 changes: 2 additions & 1 deletion src/ValueObjects/Styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,7 @@ private static function calcWidthFromFraction(string $fraction, array $styles, a
throw new InvalidStyle(sprintf('Style [%s] is invalid.', "w-$fraction"));
}

/** @@phpstan-ignore-next-line */
$width = (int) floor($width * $matches[1] / $matches[2]);
$width -= ($styles['ml'] ?? 0) + ($styles['mr'] ?? 0);

Expand Down Expand Up @@ -1029,7 +1030,7 @@ public static function getParentWidth(array $styles): int

$width = count($matches) !== 3
? (int) $parentWidth
: (int) floor($width * $matches[1] / $matches[2]);
: (int) floor($width * $matches[1] / $matches[2]); //@phpstan-ignore-line

if ($maxWidth > 0) {
$width = min($maxWidth, $width);
Expand Down

0 comments on commit 49717f9

Please # to comment.