Skip to content

Commit

Permalink
Merge pull request #216 from pdepend/bugfix/gh213-missing-constants-i…
Browse files Browse the repository at this point in the history
…n-php7

Fixes #213: Missing constants added for backward compatibility
  • Loading branch information
Manuel Pichler committed Sep 19, 2015
2 parents c51b5b4 + a5810b6 commit 1f5b051
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 99 deletions.
27 changes: 14 additions & 13 deletions .travis.yml
@@ -1,26 +1,27 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm
- hhvm-nightly
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm
- hhvm-nightly

matrix:
allow_failures:
- php: hhvm
- php: hhvm-nightly
allow_failures:
- php: hhvm
- php: hhvm-nightly

env:
- TEST_CONFIG="phpunit.xml.dist"
- TEST_CONFIG="phpunit.xml.dist"

before_script:
- composer self-update
- composer install
- composer self-update
- composer install

script: phpunit --configuration $TEST_CONFIG --colors --coverage-text

notifications:
irc: "irc.freenode.org#pdepend"
irc: "irc.freenode.org#pdepend"
2 changes: 1 addition & 1 deletion pdepend.xml.dist
Expand Up @@ -10,7 +10,7 @@
</image-convert>

<cache>
<driver>file</driver>
<driver>memory</driver>
</cache>
</config>

Expand Down
98 changes: 98 additions & 0 deletions src/main/php/PDepend/Source/Language/PHP/PHPTokenizerInternal.php
Expand Up @@ -47,6 +47,104 @@
use PDepend\Source\Tokenizer\Tokenizer;
use PDepend\Source\Tokenizer\Tokens;

/**
* Define PHP 5.4 __TRAIT__ token constant.
*/
if (!defined('T_TRAIT_C')) {
define('T_TRAIT_C', 42000);
}

/**
* Define PHP 5.4 'trait' token constant.
*/
if (!defined('T_TRAIT')) {
define('T_TRAIT', 42001);
}

/**
* Define PHP 5.4 'insteadof' token constant.
*/
if (!defined('T_INSTEADOF')) {
define('T_INSTEADOF', 42002);
}

/**
* Define PHP 5.3 __NAMESPACE__ token constant.
*/
if (!defined('T_NS_C')) {
define('T_NS_C', 42003);
}

/**
* Define PHP 5.3 'use' token constant
*/
if (!defined('T_USE')) {
define('T_USE', 42004);
}

/**
* Define character token that was removed in PHP 7
*/
if (!defined('T_CHARACTER')) {
define('T_CHARACTER', 42005);
}

/**
* Define bad character token that was removed in PHP 7
*/
if (!defined('T_BAD_CHARACTER')) {
define('T_BAD_CHARACTER', 42006);
}

/**
* Define PHP 5.3 'namespace' token constant.
*/
if (!defined('T_NAMESPACE')) {
define('T_NAMESPACE', 42005);
}

/**
* Define PHP 5.6 '...' token constant
*/
if (!defined('T_ELLIPSIS')) {
define('T_ELLIPSIS', 42006);
}

/**
* Define PHP 5.3's '__DIR__' token constant.
*/
if (!defined('T_DIR')) {
define('T_DIR', 42006);
}

/**
* Define PHP 5.3's 'T_GOTO' token constant.
*/
if (!defined('T_GOTO')) {
define('T_GOTO', 42007);
}

/**
* Define PHP 5.4's 'T_CALLABLE' token constant
*/
if (!defined('T_CALLABLE')) {
define('T_CALLABLE', 42008);
}

/**
* Define PHP 5.5's 'T_YIELD' token constant
*/
if (!defined('T_YIELD')) {
define('T_YIELD', 42009);
}

/**
* Define PHP 5,5's 'T_FINALLY' token constant
*/
if (!defined('T_FINALLY')) {
define('T_FINALLY', 42010);
}

/**
* This tokenizer uses the internal {@link token_get_all()} function as token stream
* generator.
Expand Down
84 changes: 0 additions & 84 deletions src/main/php/PDepend/Source/Tokenizer/Tokenizer.php
Expand Up @@ -42,90 +42,6 @@

namespace PDepend\Source\Tokenizer;

/**
* Define PHP 5.4 __TRAIT__ token constant.
*/
if (!defined('T_TRAIT_C')) {
define('T_TRAIT_C', 42000);
}

/**
* Define PHP 5.4 'trait' token constant.
*/
if (!defined('T_TRAIT')) {
define('T_TRAIT', 42001);
}

/**
* Define PHP 5.4 'insteadof' token constant.
*/
if (!defined('T_INSTEADOF')) {
define('T_INSTEADOF', 42002);
}

/**
* Define PHP 5.3 __NAMESPACE__ token constant.
*/
if (!defined('T_NS_C')) {
define('T_NS_C', 42003);
}

/**
* Define PHP 5.3 'use' token constant
*/
if (!defined('T_USE')) {
define('T_USE', 42004);
}

/**
* Define PHP 5.3 'namespace' token constant.
*/
if (!defined('T_NAMESPACE')) {
define('T_NAMESPACE', 42005);
}

/**
* Define PHP 5.6 '...' token constant
*/
if (!defined('T_ELLIPSIS')) {
define('T_ELLIPSIS', 42006);
}

/**
* Define PHP 5.3's '__DIR__' token constant.
*/
if (!defined('T_DIR')) {
define('T_DIR', 42006);
}

/**
* Define PHP 5.3's 'T_GOTO' token constant.
*/
if (!defined('T_GOTO')) {
define('T_GOTO', 42007);
}

/**
* Define PHP 5.4's 'T_CALLABLE' token constant
*/
if (!defined('T_CALLABLE')) {
define('T_CALLABLE', 42008);
}

/**
* Define PHP 5.5's 'T_YIELD' token constant
*/
if (!defined('T_YIELD')) {
define('T_YIELD', 42009);
}

/**
* Define PHP 5,5's 'T_FINALLY' token constant
*/
if (!defined('T_FINALLY')) {
define('T_FINALLY', 42010);
}

/**
* Base interface for all php code tokenizers.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/php/PDepend/Util/Cache/CacheDriver.php
Expand Up @@ -55,7 +55,7 @@ interface CacheDriver
/**
* The current cache version.
*/
const VERSION = '@version:8c0e76329bd5807342f3274c5d9e6262:@';
const VERSION = '@version:fe3bfe797bb91807acf9cf55cfe115cf:@';

/**
* Sets the type for the next <em>store()</em> or <em>restore()</em> method
Expand Down

0 comments on commit 1f5b051

Please sign in to comment.