pipedrive / client-php

Pipedrive API client for PHP
MIT License
49 stars 57 forks source link

PHP8.1 deprecation notices #61

Closed iget-master closed 1 year ago

iget-master commented 2 years ago

Using this package with PHP8.1 thows a lot of deprecation notices:

PHP Deprecated:  Return type of Pipedrive\Models\PostNote::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vendor/pipedrive/pipedrive/src/Models/PostNote.php on line 46
PHP Deprecated:  Return type of Pipedrive\Models\BaseNote::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vendor/pipedrive/pipedrive/src/Models/BaseNote.php on line 195
PHP Deprecated:  Return type of Pipedrive\Models\Person::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vendor/pipedrive/pipedrive/src/Models/Person.php on line 38
PHP Deprecated:  Return type of Pipedrive\Models\NoteCreatorUser::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vendor/pipedrive/pipedrive/src/Models/NoteCreatorUser.php on line 64
elenakondrateva commented 2 years ago

Voting this up

teemurautiainen commented 2 years ago

Any plans to fix these?

adantart commented 1 year ago

Tons of annoying lines each request and each time I use the API:


[2023-01-09 09:45:05] production.WARNING: Return type of Pipedrive\Utils\JsonSerializer::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vendor/pipedrive/pipedrive/src/Utils/JsonSerializer.php on line 19  
[2023-01-09 09:45:08] production.WARNING: Return type of Pipedrive\Models\GetAddedDeal::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vendor/pipedrive/pipedrive/src/Models/GetAddedDeal.php on line 64  
[2023-01-09 09:45:08] production.WARNING: Return type of Pipedrive\Models\Data1::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vendor/pipedrive/pipedrive/src/Models/Data1.php on line 544  
[2023-01-09 09:45:08] production.WARNING: Return type of Pipedrive\Models\CreatorUserId::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vendor/pipedrive/pipedrive/src/Models/CreatorUserId.php on line 89  
[2023-01-09 09:45:08] production.WARNING: Return type of Pipedrive\Models\UserId::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vendor/pipedrive/pipedrive/src/Models/UserId.php on line 89  
[2023-01-09 09:45:08] production.WARNING: Return type of Pipedrive\Models\PersonId::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vendor/pipedrive/pipedrive/src/Models/PersonId.php on line 71  
[2023-01-09 09:45:08] production.WARNING: Return type of Pipedrive\Models\Email::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vendor/pipedrive/pipedrive/src/Models/Email.php on line 54  
[2023-01-09 09:45:08] production.WARNING: Return type of Pipedrive\Models\Phone::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vendor/pipedrive/pipedrive/src/Models/Phone.php on line 54  
[2023-01-09 09:45:08] production.WARNING: Return type of Pipedrive\Models\OrgId::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vendor/pipedrive/pipedrive/src/Models/OrgId.php on line 90  
[2023-01-09 09:45:08] production.WARNING: Return type of Pipedrive\Models\RelatedObjects::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vendor/pipedrive/pipedrive/src/Models/RelatedObjects.php on line 54  
[2023-01-09 09:45:08] production.WARNING: Return type of Pipedrive\Models\DealUserData::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vendor/pipedrive/pipedrive/src/Models/DealUserData.php on line 81  
[2023-01-09 09:45:08] production.WARNING: Return type of Pipedrive\Models\DealOrganizationData::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vendor/pipedrive/pipedrive/src/Models/DealOrganizationData.php on line 82  
[2023-01-09 09:45:08] production.WARNING: Return type of Pipedrive\Models\DealPersonData::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/vendor/pipedrive/pipedrive/src/Models/DealPersonData.php on line 63  

PLEASE!

adantart commented 1 year ago

In PHP 8.1, most of the PHP internal classes are updated with tentative return types. A tentative return types means that the return types are added merely to inform the classes that extend them, and they will be enforced since PHP 9.0.

Solution 1

Add this line just before the "public function jsonSerialize()" of all these files:

#[\ReturnTypeWillChange]

Solution 2 (I hate this one)

Disabled E_DEPRECATED in your php.ini (or htaccess or wherever)

$ cat /etc/php/8.1/cli/php.ini | grep 'error_reporting =' error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

Solution 3 (the desirable)

To wait for somebody in PipeDrive team to understand that we (the developers) are the ones promoting their tools and SaaS using their API's (and therefore, making more money for THEM)... That's why I prefer to use Hubspot for integrations, they act quicker.

bilAlid commented 1 year ago

up

visitek commented 1 year ago

up!!! we must fork to fix, cannot wait years

Naberal commented 1 year ago

up

SpaceOven commented 1 year ago

Hi! I tried here with the latest version (6) and I can't see these warnings anymore, so I would recommend to switch to it.