From 8bea4e8661be24a42186d62474ad0c4fc683e798 Mon Sep 17 00:00:00 2001 From: Greg Sherwood Date: Wed, 7 Aug 2013 16:17:43 +1000 Subject: [PATCH] Fixed test on earlier PHP versions --- .../Tests/PHP/ForbiddenFunctionsUnitTest.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/CodeSniffer/Standards/Generic/Tests/PHP/ForbiddenFunctionsUnitTest.php b/CodeSniffer/Standards/Generic/Tests/PHP/ForbiddenFunctionsUnitTest.php index ec464993fa..bb4548bb77 100644 --- a/CodeSniffer/Standards/Generic/Tests/PHP/ForbiddenFunctionsUnitTest.php +++ b/CodeSniffer/Standards/Generic/Tests/PHP/ForbiddenFunctionsUnitTest.php @@ -42,10 +42,18 @@ class Generic_Tests_PHP_ForbiddenFunctionsUnitTest extends AbstractSniffUnitTest */ public function getErrorList() { - return array( - 2 => 1, - 4 => 1, - ); + $errors = array( + 2 => 1, + 4 => 1, + ); + + // The trait insteadof test will only work in PHP versions where traits exist + // and will throw errors in earlier versions. + if (version_compare(PHP_VERSION, '5.4.0') < 0) { + $errors[44] = 2; + } + + return $errors; }//end getErrorList()