Skip to content

Add StreamWrapperInterface #10506

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

Open
xepozz opened this issue Feb 4, 2023 · 19 comments
Open

Add StreamWrapperInterface #10506

xepozz opened this issue Feb 4, 2023 · 19 comments

Comments

@xepozz
Copy link
Contributor

xepozz commented Feb 4, 2023

Description

I had to deal with https://www.php.net/manual/en/class.streamwrapper.php and faced with a problem that it's not a real class/interface reportedly documentation quote This is NOT a real class, only a prototype of how a class defining its own protocol should be..
But if you try to implement your own wrapper you may face with lots of errors like the method % does not exist. That's sad and I understand the base, but what do you think about adding just a common interface like I have made in the core? I'm sure that not only me did the same in their projects and this structured interface may have people to implement their own wrappers.
I didn't deep into all possible usage combinations of the wrappers, but it would be great to separate the one onto a few interfaces by ISP principle.

I may create the PR, but show me all places I need to change.

@KapitanOczywisty
Copy link

Methods in StreamWrapper are not required until called function is using them, and interfaces would make them required.

@Girgias
Copy link
Member

Girgias commented Feb 5, 2023

This is a known issue with user streams (and streams in general).

Moreover, it would need to be split into a lot of smaller interfaces as not all streams need to seekable, castable, writeable, etc.

@github-actions
Copy link

github-actions bot commented May 7, 2023

There has not been any recent activity in this feature request. It will automatically be closed in 14 days if no further action is taken. Please see https://github.com/probot/stale#is-closing-stale-issues-really-a-good-idea to understand why we auto-close stale feature requests.

@github-actions github-actions bot added the Stale label May 7, 2023
@xepozz
Copy link
Contributor Author

xepozz commented May 7, 2023

Up

@bukka bukka removed the Stale label May 7, 2023
@github-actions
Copy link

github-actions bot commented Aug 6, 2023

There has not been any recent activity in this feature request. It will automatically be closed in 14 days if no further action is taken. Please see https://github.com/probot/stale#is-closing-stale-issues-really-a-good-idea to understand why we auto-close stale feature requests.

@github-actions github-actions bot added the Stale label Aug 6, 2023
@xepozz
Copy link
Contributor Author

xepozz commented Aug 6, 2023

up

@KapitanOczywisty
Copy link

up

@xepozz Unless you're working on RFC there is no point in keeping this issue open.

@xepozz
Copy link
Contributor Author

xepozz commented Aug 6, 2023

Could you help me with RFC?

@KapitanOczywisty
Copy link

I've never created RFC so I'm not the best person to ask. You can find more info here: https://wiki.php.net/rfc/howto As per that page, you should start by presenting your proposal on internals mailing list. Good luck!

@github-actions github-actions bot removed the Stale label Aug 7, 2023
Copy link

github-actions bot commented Nov 6, 2023

There has not been any recent activity in this feature request. It will automatically be closed in 14 days if no further action is taken. Please see https://github.com/probot/stale#is-closing-stale-issues-really-a-good-idea to understand why we auto-close stale feature requests.

@github-actions github-actions bot added the Stale label Nov 6, 2023
@bukka
Copy link
Member

bukka commented Nov 10, 2023

I think this is a valid request but it would so much easier if the default interface methods were introduced as almost all methods are optional. @morrisonlevi do you have any plans to propose this again?

@github-actions github-actions bot removed the Stale label Nov 11, 2023
Copy link

github-actions bot commented Feb 9, 2024

There has not been any recent activity in this feature request. It will automatically be closed in 14 days if no further action is taken. Please see https://github.com/probot/stale#is-closing-stale-issues-really-a-good-idea to understand why we auto-close stale feature requests.

@github-actions github-actions bot added the Stale label Feb 9, 2024
@xepozz
Copy link
Contributor Author

xepozz commented Feb 10, 2024

Still want :)

@github-actions github-actions bot removed the Stale label Feb 11, 2024
Copy link

There has not been any recent activity in this feature request. It will automatically be closed in 14 days if no further action is taken. Please see https://github.com/probot/stale#is-closing-stale-issues-really-a-good-idea to understand why we auto-close stale feature requests.

@github-actions github-actions bot added the Stale label May 12, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 26, 2024
@bukka
Copy link
Member

bukka commented Mar 14, 2025

I'm re-opening this as there is currently an RFC for optional interface in voting which is basically the main thing that is needed for this: https://wiki.php.net/rfc/optional-interfaces

@bukka bukka reopened this Mar 14, 2025
@bukka
Copy link
Member

bukka commented Mar 14, 2025

I got a bit confused by this RFC. What this needs are default interface methods so just optionally providing all methods. Optional interface is about something else. I will keep this open for a little bit hoping that someone will propose it - not sure if I find time to do it myself but if someone is looking for some feature, this would be really cool from the stream PoV.

@iluuu1994
Copy link
Member

iluuu1994 commented Mar 14, 2025

@bukka Can you clarify how the RFC helps with this issue? It implements optional interfaces (i.e. the interface is allowed to not exist), rather than optional interface methods (you may choose not to implement all methods of an interface).

Edit: Ah, you just sent a follow-up 🙂

@bukka
Copy link
Member

bukka commented Mar 14, 2025

Yeah I just saw optional and interface together and got too excited 😄

@iluuu1994
Copy link
Member

iluuu1994 commented Mar 14, 2025

I mentioned in the thread it confused me at first as well, as I was already familiar with optional interface methods from Swift Objective-C. ^^

@github-actions github-actions bot removed the Stale label Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants