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

PHP 8.1: properly fix the requirement checker #585

Closed
wants to merge 1 commit into from

Conversation

andypost
Copy link

@andypost andypost commented Jan 4, 2022

When box packaging it prefixes attribute class with HumbugBox release version

This was broken after efdf63b see

use HumbugBox3140\ReturnTypeWillChange;

PS: follow-up to #578

When box packaging it prefixes attribute class with HumbugBox release version
@andypost andypost mentioned this pull request Jan 4, 2022
@andypost
Copy link
Author

andypost commented Jan 4, 2022

I'm getting following error after packaging with 3.14.0 (as there's no .phar in 3.14.1 release assets)

PHP Deprecated:  Return type of HumbugBox3130\KevinGH\RequirementChecker\RequirementCollection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/bin/drush/.box/src/RequirementCollection.php on line 12

Deprecated: Return type of HumbugBox3130\KevinGH\RequirementChecker\RequirementCollection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/bin/drush/.box/src/RequirementCollection.php on line 12
PHP Deprecated:  Return type of HumbugBox3130\KevinGH\RequirementChecker\RequirementCollection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/bin/drush/.box/src/RequirementCollection.php on line 16

Deprecated: Return type of HumbugBox3130\KevinGH\RequirementChecker\RequirementCollection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/bin/drush/.box/src/RequirementCollection.php on line 16

@jrfnl
Copy link
Contributor

jrfnl commented Jan 4, 2022

This sounds like something which should be fixed in PHP_Scoper, not here.

@andypost
Copy link
Author

andypost commented Jan 6, 2022

@jrfnl please point which issue to follow? I guess humbug/php-scoper#530

OTOH why the attribut should be in "use"? I find it much more predictable to grep it via #[\ReturnTypeWillChange] as PHP mentions it in error message

@jrfnl
Copy link
Contributor

jrfnl commented Jan 7, 2022

@jrfnl please point which issue to follow? I guess humbug/php-scoper#530

Issue humbug/php-scoper#539 is specifically about this issue.

OTOH why the attribut should be in "use"?
I find it much more predictable to grep it via #[\ReturnTypeWillChange] as PHP mentions it in error message

Well, ReturnTypeWillChange is a class and most projects have (code-style/clean code) rules in place to use import use statements for all classes.
Every project can make their own decisions on how to handle it, of course.

Regarding the error message, yeah, I'm happy that that was changed (multiple times) after the original PR for this RFC went into PHP to include the attribute and the \.
The original error message from PHP was very unhelpful.

@andypost
Copy link
Author

andypost commented Jan 7, 2022

Thank you for explanation! Closing it in favour of php-scoper

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