phpro / grumphp

A PHP code-quality tool
MIT License
4.15k stars 431 forks source link

Drop PHP 5.5 support #222

Closed veewee closed 7 years ago

veewee commented 8 years ago
Q A
Branch master
Bug? no
New feature? no
Question? no
Documentation? no
Related tickets

Since PHP 5.5 isn't supported anymore, we'll also stop supporting this version. Fixes in the code:

No dependencies have to be updated: All support 5.6

phptek commented 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.

veewee commented 7 years ago

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.

phptek commented 7 years ago

@veewee Thanks for the detailed explanation. All good :-)