Skip to content

Commit

Permalink
Fix: Rename fields and variables
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Dec 30, 2020
1 parent fe3aea2 commit d29548f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/SchemaNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ private function normalizeObject(\stdClass $data, \stdClass $schema): \stdClass

$normalized = new \stdClass();

/** @var array<string, \stdClass> $objectProperties */
$objectProperties = \array_intersect_key(
/** @var array<string, \stdClass> $objectPropertiesThatAreDefinedBySchema */
$objectPropertiesThatAreDefinedBySchema = \array_intersect_key(
\get_object_vars($schema->properties),
\get_object_vars($data)
);

foreach ($objectProperties as $name => $valueSchema) {
foreach ($objectPropertiesThatAreDefinedBySchema as $name => $valueSchema) {
$value = $data->{$name};

$valueSchema = $this->resolveSchema(
Expand Down
10 changes: 5 additions & 5 deletions src/Vendor/Composer/ConfigHashNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class ConfigHashNormalizer implements NormalizerInterface
*
* @var array<int, string>
*/
private static $properties = [
private static $propertiesThatShouldBeSorted = [
'config',
'extra',
'scripts-descriptions',
Expand All @@ -48,16 +48,16 @@ public function normalize(Json $json): Json
return $json;
}

$objectProperties = \array_intersect_key(
$objectPropertiesThatShouldBeNormalized = \array_intersect_key(
\get_object_vars($decoded),
\array_flip(self::$properties)
\array_flip(self::$propertiesThatShouldBeSorted)
);

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

foreach ($objectProperties as $name => $value) {
foreach ($objectPropertiesThatShouldBeNormalized as $name => $value) {
$decoded->{$name} = self::sortByKey(
$name,
$value
Expand Down
10 changes: 5 additions & 5 deletions src/Vendor/Composer/PackageHashNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class PackageHashNormalizer implements NormalizerInterface
*
* @var array<int, string>
*/
private static $properties = [
private static $propertiesThatShouldBeNormalized = [
'conflict',
'provide',
'replace',
Expand All @@ -46,16 +46,16 @@ public function normalize(Json $json): Json
return $json;
}

$objectProperties = \array_intersect_key(
$objectPropertiesThatShouldBeNormalized = \array_intersect_key(
\get_object_vars($decoded),
\array_flip(self::$properties)
\array_flip(self::$propertiesThatShouldBeNormalized)
);

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

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

Expand Down
10 changes: 5 additions & 5 deletions src/Vendor/Composer/VersionConstraintNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class VersionConstraintNormalizer implements NormalizerInterface
*
* @var array<int, string>
*/
private static $properties = [
private static $propertiesThatShouldBeNormalized = [
'conflict',
'provide',
'replace',
Expand Down Expand Up @@ -58,16 +58,16 @@ public function normalize(Json $json): Json
return $json;
}

$objectProperties = \array_intersect_key(
$objectPropertiesThatShouldBeNormalized = \array_intersect_key(
\get_object_vars($decoded),
\array_flip(self::$properties)
\array_flip(self::$propertiesThatShouldBeNormalized)
);

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

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

if (0 === \count($packages)) {
Expand Down

0 comments on commit d29548f

Please sign in to comment.