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

encoding functions returns non-empty-string #1664

Merged
merged 3 commits into from Sep 1, 2022

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Aug 30, 2022

@staabm staabm marked this pull request as ready for review August 30, 2022 10:07
@staabm
Copy link
Contributor Author

staabm commented Aug 31, 2022

the error in composer is valid and it was there before this PR:

 ------ --------------------------------------------------------------------- 
  Line   src/Composer/Util/RemoteFilesystem.php                               
 ------ --------------------------------------------------------------------- 
  327    Parameter #1 $string of function base64_encode expects T of string,  
         string|false given.                                                  
 ------ --------------------------------------------------------------------- 

since the error message changed because generics are involved now, the already existing ignore-line no longer mutes it

https://github.com/ondrejmirtes/composer/blob/acef69614d5c54def3418d3964749b49923200b2/phpstan/baseline-8.1.neon#L278-L281

stubs/core.stub Outdated
/**
* @template T as string
* @param T $string
* @return (T is non-empty-string ? non-empty-string : string)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need generics for this, ($string is non-empty-string ? non-empty-string : string) should work just as well. Please edit all of these fuctions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, fixed.

@ondrejmirtes
Copy link
Member

Thank you!

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