Permalink
Browse files

fixes compatibility with PHP 5.3

  • Loading branch information...
1 parent 44e9216 commit 948de4bf8cfdc1cf0269a96069c40dca9f37ee62 @schmittjoh committed Nov 7, 2012
Showing with 12 additions and 0 deletions.
  1. +1 −0 composer.json
  2. +11 −0 src/JMS/PhpManipulator/SimultaneousTokenAstStream.php
View
@@ -7,6 +7,7 @@
{"name": "Johannes M. Schmitt"}
],
"require": {
+ "php": ">=5.3.0",
"phpoption/phpoption": "dev-master"
},
"require-dev": {
@@ -22,6 +22,17 @@
use JMS\PhpManipulator\TokenStream\LiteralToken;
use JMS\PhpManipulator\TokenStream\PhpToken;
+// Define some constants which are not available on PHP 5.3. It does not really
+// matter what values we assign here, as token_get_all will never return them, and
+// just fail if forced to parse PHP 5.4 code, but it will allow us to use these
+// constants safely in our code.
+if ( ! defined('T_TRAIT')) {
+ define('T_TRAIT', 100001);
+ define('T_INSTEADOF', 100002);
+ define('T_CALLABLE', 100003);
+ define('T_TRAIT_C', 100004);
+}
+
/**
* This is an simultaneous stream implementation allowing access to the raw token
* as well as the higher-level AST stream.

0 comments on commit 948de4b

Please sign in to comment.