lesstif / php-jira-rest-client

PHP classes interact Jira with the REST API.
Other
510 stars 263 forks source link

Fix return type JsonSerializable implementations #401

Closed arnested closed 2 years ago

arnested commented 2 years ago

To be compatible with PHP 8.1.

Deprecated: Return type of JiraRestApi\Issue\IssueField::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in vendor/lesstif/php-jira-rest-client/src/Issue/IssueField.php on line 141

The mixed return type was introduced in PHP 8.0. This pull request makes the code incompatible with PHP 7.x.

LordSimal commented 2 years ago

To be fair, most of these functions will return an array since they are all using array_filter so this could be improved to just an array return type instead of the more confusing mixed return type

LordSimal commented 2 years ago

Ah but then its not compatible with the JsonSerializable::jsonSerialize(): mixed, never mind my last comment

arnested commented 2 years ago

To retain backwards compatibility with 7.x all the methods could be annotated with #[\ReturnTypeWillChange] instead.

Let me know if I should prepare another pull request with that change.

lesstif commented 2 years ago

@arnested sorry for lately reply and thanks your PR!

LordSimal commented 2 years ago

@lesstif Merry Christmas and just a a friendly reminder: would love to see a release marked so composer updates the package automatically 😉

lesstif commented 2 years ago

hi @LordSimal happy new year! i was released now version 3.0.0.

lesstif commented 2 years ago

@arnested Hi!. happy new year and could you to prepare another PR with ReturnTypeWiilChange annotation please?

arnested commented 2 years ago

@lesstif see #404