jolicode / slack-php-api

:hash: PHP Slack Client based on the official OpenAPI specification
https://jolicode.github.io/slack-php-api/
MIT License
221 stars 54 forks source link

Incompatible with PHP 8 #99

Closed hco closed 3 years ago

hco commented 3 years ago

From what I understand, this is currently incompatible with PHP 8. This should probably be noted in the composer.json rather soonish right?

Example error:

PHP Fatal error:  Declaration of JoliCode\Slack\Api\Endpoint\ChatPostMessage::transformResponseBody(string $body, int $status, Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType) must be compatible with Jane\OpenApiRuntime\Client\EndpointTrait::transformResponseBody(string $body, int $status, Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) in …/vendor/jolicode/slack-php-api/generated/Endpoint/ChatPostMessage.php on line 119

From what I understand, the problem is that in one place it says string $contentType = null whereas in the other place it says ?string $contentType.

I looked a minute at how the code generation works but realized that I would need to dig into this in more detail in order to fix it, and probably it's an easy fix for you.

I will create a PR for an adjustment I made in the generated code. No hard feelings if you just decline it (because, who edits generated code, right?. But this way I can at least offer you a bit more than just a bug report.

I wish you a Merry Christmas! 🎄

hco commented 3 years ago

PS: This defect is visible by running the testsuite

Korbeil commented 3 years ago

Hey @hco,

I'm taking this issue since it's not related to this PHP client but related to Jane which is used here to generated the Slack client :wink: I've opened a PR to fix PHP 8 support: https://github.com/janephp/janephp/pull/483 and will try to tag a new version soon :ok_hand:

hco commented 3 years ago

Thank you!