Skip to content

Commit

Permalink
Merge pull request #661 from ergebnis/fix/count
Browse files Browse the repository at this point in the history
Fix: Compare with empty array
  • Loading branch information
localheinz committed Jan 29, 2022
2 parents 1416ddc + dc0e6ea commit 68e6053
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Vendor/Composer/ConfigHashNormalizer.php
Expand Up @@ -46,7 +46,7 @@ public function normalize(Json $json): Json
\array_flip(self::PROPERTIES_THAT_SHOULD_BE_SORTED),
);

if (0 === \count($objectPropertiesThatShouldBeNormalized)) {
if ([] === $objectPropertiesThatShouldBeNormalized) {
return $json;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Vendor/Composer/PackageHashNormalizer.php
Expand Up @@ -44,15 +44,15 @@ public function normalize(Json $json): Json
\array_flip(self::PROPERTIES_THAT_SHOULD_BE_NORMALIZED),
);

if (0 === \count($objectPropertiesThatShouldBeNormalized)) {
if ([] === $objectPropertiesThatShouldBeNormalized) {
return $json;
}

foreach ($objectPropertiesThatShouldBeNormalized as $name => $value) {
/** @var array<string, string> $packages */
$packages = (array) $decoded->{$name};

if (0 === \count($packages)) {
if ([] === $packages) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Vendor/Composer/VersionConstraintNormalizer.php
Expand Up @@ -53,14 +53,14 @@ public function normalize(Json $json): Json
\array_flip(self::PROPERTIES_THAT_SHOULD_BE_NORMALIZED),
);

if (0 === \count($objectPropertiesThatShouldBeNormalized)) {
if ([] === $objectPropertiesThatShouldBeNormalized) {
return $json;
}

foreach ($objectPropertiesThatShouldBeNormalized as $name => $value) {
$packages = (array) $decoded->{$name};

if (0 === \count($packages)) {
if ([] === $packages) {
continue;
}

Expand Down

0 comments on commit 68e6053

Please sign in to comment.