Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing parameter & return types #331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tacocode-dev
Copy link

Gets rid of all the PHP Deprecated: Return type ... should either be compatible with ... messages in error log

Gets rid of all the 'PHP Deprecated:  Return type ...' messages in error log
@ROMzombie
Copy link
Contributor

ROMzombie commented Jul 24, 2024

While these are certainly the changes that the deprecation warnings indicate, the changes don't appear to resolve the warnings? It's entirely possible that this is some quirk of PHP at work that I'm not familiar with, but I'd expect that the tests wouldn't show them on the branch.

romzombie@TOMSCOTTWL2:~/git/infusionsoft-php-maksidaindie$ git remote -v
origin  [email protected]:maksidaindie/infusionsoft-php.git (fetch)
origin  [email protected]:maksidaindie/infusionsoft-php.git (push)
romzombie@TOMSCOTTWL2:~/git/infusionsoft-php-maksidaindie$ git status
On branch feature/return-types
Your branch is up to date with 'origin/feature/return-types'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   .env

no changes added to commit (use "git add" and/or "git commit -a")
romzombie@TOMSCOTTWL2:~/git/infusionsoft-php-maksidaindie$ docker exec -it infusionsoft-php /var/www/html/vendor/bin/phpunit tests
PHPUnit 9.6.17 by Sebastian Bergmann and contributors.

....................
Deprecated: Return type of Infusionsoft\Api\Rest\RestModel::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/src/Infusionsoft/Api/Rest/RestModel.php on line 985

Deprecated: Return type of Infusionsoft\Api\Rest\RestModel::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/src/Infusionsoft/Api/Rest/RestModel.php on line 997

Deprecated: Return type of Infusionsoft\Api\Rest\RestModel::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/src/Infusionsoft/Api/Rest/RestModel.php on line 1010

Deprecated: Return type of Infusionsoft\Api\Rest\RestModel::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/src/Infusionsoft/Api/Rest/RestModel.php on line 1022

Deprecated: Return type of Infusionsoft\Api\Rest\RestModel::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/src/Infusionsoft/Api/Rest/RestModel.php on line 574

Deprecated: Return type of Infusionsoft\InfusionsoftCollection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/src/Infusionsoft/InfusionsoftCollection.php on line 147

Deprecated: Return type of Infusionsoft\InfusionsoftCollection::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/src/Infusionsoft/InfusionsoftCollection.php on line 158

Deprecated: Return type of Infusionsoft\InfusionsoftCollection::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/src/Infusionsoft/InfusionsoftCollection.php on line 170

Deprecated: Return type of Infusionsoft\InfusionsoftCollection::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/src/Infusionsoft/InfusionsoftCollection.php on line 185

Deprecated: Return type of Infusionsoft\InfusionsoftCollection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/src/Infusionsoft/InfusionsoftCollection.php on line 136

Deprecated: Return type of Infusionsoft\InfusionsoftCollection::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/src/Infusionsoft/InfusionsoftCollection.php on line 115
..                                            22 / 22 (100%)

Time: 00:01.109, Memory: 8.00 MB

OK (22 tests, 30 assertions)
romzombie@TOMSCOTTWL2:~/git/infusionsoft-php-maksidaindie$

@tacocode-dev
Copy link
Author

tacocode-dev commented Jul 25, 2024

While these are certainly the changes that the deprecation warnings indicate, the changes don't appear to resolve the warnings? It's entirely possible that this is some quirk of PHP at work that I'm not familiar with, but I'd expect that the tests wouldn't show them on the branch.

Hey Tom. The warnings are completely resolved on my end after applying these changes. PHP 8.1 trough 8.3:

➜  infusionsoft-php git:(feature/return-types) git rev-parse --short HEAD
5ea3398
➜  infusionsoft-php git:(feature/return-types) php8.1 vendor/bin/phpunit tests
PHPUnit 9.6.17 by Sebastian Bergmann and contributors.

......................                                            22 / 22 (100%)

Time: 00:00.010, Memory: 8.00 MB

OK (22 tests, 30 assertions)
➜  infusionsoft-php git:(feature/return-types) php8.2 vendor/bin/phpunit tests
PHPUnit 9.6.17 by Sebastian Bergmann and contributors.

......................                                            22 / 22 (100%)

Time: 00:00.010, Memory: 8.00 MB

OK (22 tests, 30 assertions)
➜  infusionsoft-php git:(feature/return-types) php8.3 vendor/bin/phpunit tests
PHPUnit 9.6.17 by Sebastian Bergmann and contributors.

......................                                            22 / 22 (100%)

Time: 00:00.009, Memory: 8.00 MB

OK (22 tests, 30 assertions)
➜  infusionsoft-php git:(feature/return-types)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants