client-php icon indicating copy to clipboard operation
client-php copied to clipboard

PHP8.1 deprecation notices

Open iget-master opened this issue 4 years ago • 2 comments

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

iget-master avatar Jan 21 '22 19:01 iget-master

Voting this up

elenakondrateva avatar Nov 02 '22 00:11 elenakondrateva

Any plans to fix these?

teemurautiainen avatar Nov 08 '22 08:11 teemurautiainen

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 avatar Jan 10 '23 13:01 adantart

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.

adantart avatar Jan 10 '23 13:01 adantart

up

bilAlid avatar Jan 17 '23 15:01 bilAlid

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

visitek avatar May 24 '23 13:05 visitek

up

Naberal avatar Jun 21 '23 12:06 Naberal

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.

SpaceOven avatar Oct 09 '23 06:10 SpaceOven