Skip to content

Commit f731d03

Browse files
Merge pull request #96 from robbieaverill/do-not-set-missing-properties
Unknown properties from the Packagist API are no longer set on AbstractResult
2 parents d808503 + 255265e commit f731d03

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

spec/Packagist/Api/Result/PackageSpec.php

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public function let(Maintainer $maintainer, Version $version, Downloads $downloa
2929
'dependents' => 42,
3030
'github_stars' => 3086,
3131
'github_forks' => 1124,
32+
// A dynamic property, causes deprecation warnings in PHP 8.2+ and is now ignored in AbstractResult
33+
'supports_cheese' => true,
3234
]);
3335
}
3436

src/Packagist/Api/Result/AbstractResult.php

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public function fromArray(array $data): void
1616
if (null === $value && !$this->isNullable($property)) {
1717
continue;
1818
}
19+
if (!property_exists($this, $property)) {
20+
continue;
21+
}
1922
$this->$property = $value;
2023
}
2124
}

0 commit comments

Comments
 (0)