Skip to content

encoding functions returns non-empty-string#1664

Merged
ondrejmirtes merged 3 commits intophpstan:1.8.xfrom
staabm:non-empty-encode
Sep 1, 2022
Merged

encoding functions returns non-empty-string#1664
ondrejmirtes merged 3 commits intophpstan:1.8.xfrom
staabm:non-empty-encode

Conversation

@staabm
Copy link
Copy Markdown
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
Copy Markdown
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
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

3 participants