Skip to content

Commit 255265e

Browse files
committed
Unknown properties from the Packagist API are no longer set on AbstractResult
If you find a property is missing, please file a bug report on GitHub and we can get it added.
1 parent 31d67ac commit 255265e

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)