-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Convert file_info resources to objects #5987
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
Conversation
// cc @frankdejonge Not sure if this affects you? |
If there are BC concerns, please say so! :) |
@GrahamCampbell If I see this correctly, this is only the function-style interface, the |
Indeed, the OOP interface is completely unaffected. The procedural interface now handles objects, so both could be mixed (which might provide a smoother upgrade path). |
Off-topic: if the fopen will become something other than |
The recommended way is to not check for an instanceof an object or use a |
While that would work for the code that is opening a file-handle, it is not suitable for accepting one. For Flysystem, for example, the method accepts a resource opened elsewhere, so we need to have a way to check if it's the right input to prevent weird errors. |
As the object does not yet exists (and won't before the conversion is done) the only way would to do a double condition, mind linking to the relevant code? |
@Girgias it's this kind of an assertion: https://github.com/thephpleague/flysystem/blob/2.x/src/Filesystem.php#L141 |
You can add |
@kocsismate that is correct, however, that was deemed not the best practice by @Girgias. Hence the further discussion. Perhaps we should take this discussion elsewhere since it's derailing the conversation (or preventing it even) about the current PR. |
I can't imagine that we switch stream resources to objects before PHP 9, so probably no need to discuss right now. :) |
If there are no objections, I'll merge this in a week. |
Nope, to late for this change for PHP 8.0. |
Oh. Gonna be a shame to delay a lot of these changes till 8.1 when not strictly necessary. It will make things harder for library authors to make their code work on both PHP 8.0 and 8.1. |
Well, we're more than 2 weeks after feature freeze, and so such changes would make the upgrade to PHP 8.0 harder for users who already have started that process. |
I suppose this has already been discussed and decided upon. ;) |
Yeah, the release management decision here was to not do further resource -> object conversions past feature freeze. We don't stand a realistic chance of converting all resources to objects in PHP 8.0, some will necessarily happen later, so there's no strong motivation to allow them past feature freeze (unlike the warning -> Error conversions). |
853d9c5
to
5976120
Compare
Besides our general desire to get rid of the legacy resource types, this is particularly appealing for fileinfo, because there are already respective objects.
5976120
to
31164d2
Compare
Any objections to merging this? |
Besides our general desire to get rid of the legacy resource types,
this is particularly appealing for fileinfo, because there are already
respective objects.
Should probably inline
php_fileinfo
infinfo_object
right away. Also, I wonder about serialization and cloning of finfo objects – is that properly supported?