Closed veewee closed 7 years ago
@veewee You say 5.5 isn't supported anymore, but what does removing file_get_contents()
have to do with that? It's not deprecated in 5 or 7.
Hi @phptek,
In a very early version of GrumPHP, we used the SplFileObject::fread()
method instead of file_get_contents()
. This one is available from PHP >= 5.5.11. The problem with the file_get_contents()
method is that it is hard to test code that is using this method. You can either create a (temporary) file or overwrite this method in the namespace of the task.
This is why I wanted to use the SplFileObject::fread()
method again after dropping the support for 5.5. Since it is fully OO, it is easy to use a php://memory
stream and put some content in it. After some playing around with this method, it seemed to cause some other issues. That is why we ended up implementing it this way:
https://github.com/phpro/grumphp/blob/v0.11.0/src/GrumPHP/Util/Filesystem.php#L19
It doesn't have to do anything with deprecation since it is a perfectly useable method. It just makes it easier to test the code.
@veewee Thanks for the detailed explanation. All good :-)
Since PHP 5.5 isn't supported anymore, we'll also stop supporting this version. Fixes in the code:
SplFileInfo::openFile()->fread()
instead offile_get_contents()
.SplFileObject
containing aphp://memory
orphp://temp
stream.No dependencies have to be updated: All support 5.6