PaddleHQ / paddle-php-sdk

PHP SDK for working with the Paddle API in server-side apps.
https://developer.paddle.com/
Apache License 2.0
29 stars 5 forks source link

Status fields should be public: they are currently private #80

Open jonjbar opened 1 month ago

jonjbar commented 1 month ago

Describe the bug

The file paddle-php-sdk\src\Entities\Shared\Status.php has private "Active" and "Archived" fields when they should be public

Steps to reproduce

Try to list products by using the specific status const

Expected behavior

The fields should be accessible as public

Code snippets

No response

PHP version

PHP 8.2

SDK version

1.20

API version

Paddle Version 1

Additional context

No response

mikeymike commented 1 month ago

Hey @jonjbar 👋

This is actually expected behaviour and is inline with all enums we use in this package. The reason for this is because we chose to utilise the myclabs/php-enum package for enums. Each enum has public static methods behind each of the property definitions that provide the instance of the enum for that value.

Let me know if there's any other uncertainty here and I'll try to elaborate where I can 👍

jonjbar commented 1 month ago

Understood. Thanks. In that case, shouldn't the "Prices" const in paddle-php-sdk\src\Resources\Products\Operations\List\Includes.php be private then ?

mikeymike commented 1 month ago

Indeed those consts do look to have the incorrect visibility. It would not impact the functionality here with the static method still being the expected usage, however it's possible due to the array usage on the operation that a consumer would expect to pass in the string constant value instead of the enum instance. We'll use this issue to track ensuring the enums consts have the correct visibility throughout the package 👍

Thanks for spotting this.