According to Sebastian, it is not possible, I have to use the @requires annotation instead of that.
note: The @requires annotation works well, but I always got parse error because of the usage of yield
and ::class
in the lower versions... So I ended up not to care about this, however I'll keep the annotations. Maybe later I'll write a project which can automatically comment out test code depending on the annotation and the php version.
For the case the code is not parsable by older php versions, yo have to move it to separate files, give them appropriate suffixes and set a configuration xml file like this:
<testsuite name="unit tests">
<directory suffix="Test.php" phpVersion="5.3.0" phpVersionOperator=">=">test/unit</directory>
<directory suffix="Test54.php" phpVersion="5.4.0" phpVersionOperator=">=">test/unit</directory>
<directory suffix="Test55.php" phpVersion="5.5.0" phpVersionOperator=">=">test/unit</directory>
</testsuite>