Skip to content

Commit

Permalink
test: fix backward compatibility breaking for php < 5.5
Browse files Browse the repository at this point in the history
PHP Parse error:  syntax error, unexpected 'class' (T_CLASS)

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class
```
::class
Since PHP 5.5, the class keyword is also used for class name resolution.
```
  • Loading branch information
Fishdrowned committed May 22, 2017
1 parent ce62039 commit 7cc477e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/Bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
$loader = include __DIR__ . '/../vendor/autoload.php';

use PHPUnit\Framework\TestCase;
$psr4TestCaseClass = 'PHPUnit\Framework\TestCase';
$psr0TestCaseClass = 'PHPUnit_Framework_TestCase';

if (!class_exists(PHPUnit_Framework_TestCase::class) && class_exists(TestCase::class)) {
class_alias(TestCase::class, PHPUnit_Framework_TestCase::class);
if (!class_exists($psr0TestCaseClass) && class_exists($psr4TestCaseClass)) {
class_alias($psr4TestCaseClass, $psr0TestCaseClass);
}

0 comments on commit 7cc477e

Please sign in to comment.