-
-
Notifications
You must be signed in to change notification settings - Fork 111
Refactor Library #224
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
Refactor Library #224
Conversation
36c864c
to
395ece8
Compare
Pull Request Test Coverage Report for Build 3648952678
💛 - Coveralls |
d9b68c0
to
bf37720
Compare
@donatj I would also really like your input if you have some time :) I'm especially interested in your opinion on the stream handling question from the PR description. |
I opened a little PR against this, #232 - removes the need for deflate state from File - but I'm not entirely sure how to fix the phan complaint/php-cs-fixer complaint, I don't have PHP 8.2 to run against |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's kinda silly to release a library targeting a version of PHP that isn't even out yet.
There's still over 30% of users using 7.4 - I can't personally imagine targeting a library 8.2 that isn't even out yet.
https://packagist.org/packages/maennchen/zipstream-php/php-stats
I'm personally stuck professionally on 7.4 for at least a few months and then I suspect we're probably just going to kick up to 8.0 so it'll be like 4-5 years before I could even use this.
@donatj The idea was to rewrite it in a way that is more understandable for other people to contribute. This is not a call to abandon v2 which is compatible with PHP 8.0. I would fix bugs in v2 until 8.2 is the minimum supported version of PHP. The maintenance effort of the library is quite minimal, so I don’t see an issue in temporarily adressing bugs in two versions. PHP 8.1 support runs out in two years. |
@donatj Actually, the new features used were mostly PHP 8.0 / 8.1. With a tiny change 8.1 is supported as well. PHP 8.0 doesn't work because there are no enums. Given that active support for PHP 8.0 has already ended, that's not that big an issue for me for an upcoming release as long as there's an alternative still available. Therefore bugfixes need to be provided for v2 until Nov 23. |
I've added a commit to use a stream wrapper for the This seems to work fine and removes all required (non-dev) dependencies. I've added the psr dependencies to |
Co-authored-by: Jesse Donat <[email protected]>
Co-authored-by: Jesse Donat <[email protected]>
Co-authored-by: Jesse Donat <[email protected]>
released as |
Motivation
Refactor Library to make full use of new PHP features and remove outdated code like
DeflateStream
.TODO
README
README
Update PHP-CS-Fixer(blocked - incompatible to PHP8.2
) Lowered support to 8.1.Install PHP Documentor(blocked - incompatible to PHP8.2
/ Start building on php 8.2 phpDocumentor/phpDocumentor#3376)8.2
release in.tool-versions
Open Questions
Stream handling
Right now every file is converted into a
StreamInterface
.resources
are converted into aStreamInterface
viaResourceStream
. To improve performance this could also be inverted so thatStreamInterface
is converted into aresource
viastream_wrapper_register()
.This would improve performance for native resources.
Inspiration: https://github.com/guzzle/psr7/blob/master/src/StreamWrapper.php
Steps TODO
StreamWrapper
forStreamInterface
outputStream
into custom stream wrapperstream
ofaddFileFromPsr7Stream
into custom stream wrapperdata
ofaddFile
intophp://memory
streamfopen
ofpath
inaddFileFromPath
intoaddFileFromStream
resource
directly intoFile
inaddFileFromStream
File
to use resources exclusivelyRelated Issues
Closes #194
Closes #135
Closes #161
Closes #175
Closes #78