Skip to content

Add "base64" as key for stream_get_meta_data#369

Merged
ondrejmirtes merged 2 commits intophpstan:masterfrom
SvenRtbg:patch-1
Nov 7, 2020
Merged

Add "base64" as key for stream_get_meta_data#369
ondrejmirtes merged 2 commits intophpstan:masterfrom
SvenRtbg:patch-1

Conversation

@SvenRtbg
Copy link
Contributor

@SvenRtbg SvenRtbg commented Nov 4, 2020

Given the right "data" url, PHP will add a boolean "base64" key to stream_get_meta_data.

See some example code in action: https://3v4l.org/G65j4

Given the right "data" url, PHP will add a boolean "base64" key to `stream_get_meta_data`.

See some example code in action: https://3v4l.org/G65j4
@ondrejmirtes
Copy link
Member

Hi, the key should be marked as optional.

@SvenRtbg
Copy link
Contributor Author

SvenRtbg commented Nov 5, 2020

I'd like to if I knew how to. I am using the same format as "mediatype", which has been added years ago when this file was at a different location, and it also isn't marked as optional.

I found that arguments can be marked as optional using = as a suffix, but we are talking about the return value here.

@ondrejmirtes
Copy link
Member

https://phpstan.org/writing-php-code/phpdoc-types#array-shapes

See for example unserialize.

@ondrejmirtes ondrejmirtes merged commit c4231eb into phpstan:master Nov 7, 2020
@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

Development

Successfully merging this pull request may close these issues.

2 participants