Commit 73f7d115 authored by webchick's avatar webchick

Issue #2400407 by DuaelFr: Ensure vendor phpunit/php-token-stream is on latest stable release

parent 1f266870
......@@ -1368,16 +1368,16 @@
},
{
"name": "phpunit/php-token-stream",
"version": "1.4.1",
"version": "1.4.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "eab81d02569310739373308137284e0158424330"
"reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/eab81d02569310739373308137284e0158424330",
"reference": "eab81d02569310739373308137284e0158424330",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3ab72c62e550370a6cd5dc873e1a04ab57562f5b",
"reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b",
"shasum": ""
},
"require": {
......@@ -1413,7 +1413,7 @@
"keywords": [
"tokenizer"
],
"time": "2015-04-08 04:46:07"
"time": "2015-08-16 08:51:00"
},
{
"name": "phpunit/phpunit",
......
......@@ -223,7 +223,9 @@
'PHP_Token_ARRAY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ARRAY_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_AS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ASYNC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_AT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_AWAIT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_BACKTICK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_BAD_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_BOOLEAN_AND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
......@@ -243,9 +245,11 @@
'PHP_Token_CLOSE_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CLOSE_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CLOSE_TAG' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_COALESCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_COLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_COMMA' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_COMPILER_HALT_OFFSET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CONCAT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CONST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_CONSTANT_ENCAPSED_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
......@@ -280,7 +284,9 @@
'PHP_Token_ENDSWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ENDWHILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_END_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ENUM' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_EQUALS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_EVAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_EXCLAMATION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_EXIT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
......@@ -339,6 +345,7 @@
'PHP_Token_NUM_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_OBJECT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_OBJECT_OPERATOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_ONUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_OPEN_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_OPEN_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_OPEN_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
......@@ -364,6 +371,7 @@
'PHP_Token_SHAPE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_SL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_SL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_SPACESHIP' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_SR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_SR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_START_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
......@@ -387,10 +395,21 @@
'PHP_Token_USE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_VAR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_VARIABLE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_WHERE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_WHILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_ATTRIBUTE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_CATEGORY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_CATEGORY_LABEL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_CHILDREN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_LABEL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_REQUIRED' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_TAG_GT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_TAG_LT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XHP_TEXT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_XOR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_YIELD' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_Token_YIELD_FROM' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'SebastianBergmann\\Comparator\\ArrayComparator' => $vendorDir . '/sebastian/comparator/src/ArrayComparator.php',
'SebastianBergmann\\Comparator\\Comparator' => $vendorDir . '/sebastian/comparator/src/Comparator.php',
'SebastianBergmann\\Comparator\\ComparisonFailure' => $vendorDir . '/sebastian/comparator/src/ComparisonFailure.php',
......
......@@ -772,57 +772,6 @@
"xunit"
]
},
{
"name": "phpunit/php-token-stream",
"version": "1.4.1",
"version_normalized": "1.4.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "eab81d02569310739373308137284e0158424330"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/eab81d02569310739373308137284e0158424330",
"reference": "eab81d02569310739373308137284e0158424330",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"time": "2015-04-08 04:46:07",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"installation-source": "dist",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
]
},
{
"name": "mikey179/vfsStream",
"version": "v1.5.0",
......@@ -3483,5 +3432,56 @@
"keywords": [
"template"
]
},
{
"name": "phpunit/php-token-stream",
"version": "1.4.6",
"version_normalized": "1.4.6.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3ab72c62e550370a6cd5dc873e1a04ab57562f5b",
"reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"time": "2015-08-16 08:51:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"installation-source": "dist",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
]
}
]
......@@ -7,7 +7,6 @@ php:
- 5.5
- 5.6
- hhvm
- hhvm-nightly
before_script:
- composer self-update
......
......@@ -14,7 +14,6 @@
* @author Sebastian Bergmann <sebastian@phpunit.de>
* @copyright Sebastian Bergmann <sebastian@phpunit.de>
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
* @version Release: @package_version@
* @link http://github.com/sebastianbergmann/php-token-stream/tree
* @since Class available since Release 1.0.0
*/
......@@ -75,6 +74,9 @@ public function getLine()
abstract class PHP_TokenWithScope extends PHP_Token
{
/**
* @var integer
*/
protected $endTokenId;
/**
......@@ -122,27 +124,26 @@ public function getDocblock()
}
}
/**
* @return integer
*/
public function getEndTokenId()
{
$block = 0;
$i = $this->id;
$tokens = $this->tokenStream->tokens();
while ($this->endTokenId === NULL && isset($tokens[$i])) {
while ($this->endTokenId === null && isset($tokens[$i])) {
if ($tokens[$i] instanceof PHP_Token_OPEN_CURLY ||
$tokens[$i] instanceof PHP_Token_CURLY_OPEN) {
$block++;
}
else if ($tokens[$i] instanceof PHP_Token_CLOSE_CURLY) {
} elseif ($tokens[$i] instanceof PHP_Token_CLOSE_CURLY) {
$block--;
if ($block === 0) {
$this->endTokenId = $i;
}
}
else if (($this instanceof PHP_Token_FUNCTION ||
} elseif (($this instanceof PHP_Token_FUNCTION ||
$this instanceof PHP_Token_NAMESPACE) &&
$tokens[$i] instanceof PHP_Token_SEMICOLON) {
if ($block === 0) {
......@@ -153,22 +154,27 @@ public function getEndTokenId()
$i++;
}
if ($this->endTokenId === NULL) {
if ($this->endTokenId === null) {
$this->endTokenId = $this->id;
}
return $this->endTokenId;
}
/**
* @return integer
*/
public function getEndLine()
{
return $this->tokenStream[$this->getEndTokenId()]->getLine();
}
}
abstract class PHP_TokenWithScopeAndVisibility extends PHP_TokenWithScope {
abstract class PHP_TokenWithScopeAndVisibility extends PHP_TokenWithScope
{
/**
* @return string
*/
public function getVisibility()
{
$tokens = $this->tokenStream->tokens();
......@@ -179,7 +185,7 @@ public function getVisibility()
$tokens[$i] instanceof PHP_Token_PROTECTED ||
$tokens[$i] instanceof PHP_Token_PUBLIC)) {
return strtolower(
str_replace('PHP_Token_', '', get_class($tokens[$i]))
str_replace('PHP_Token_', '', get_class($tokens[$i]))
);
}
if (isset($tokens[$i]) &&
......@@ -192,10 +198,13 @@ public function getVisibility()
}
}
/**
* @return string
*/
public function getKeywords()
{
$keywords = array();
$tokens = $this->tokenStream->tokens();
$tokens = $this->tokenStream->tokens();
for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) {
if (isset($tokens[$i]) &&
......@@ -210,78 +219,113 @@ public function getKeywords()
$tokens[$i] instanceof PHP_Token_FINAL ||
$tokens[$i] instanceof PHP_Token_ABSTRACT)) {
$keywords[] = strtolower(
str_replace('PHP_Token_', '', get_class($tokens[$i]))
str_replace('PHP_Token_', '', get_class($tokens[$i]))
);
}
}
return implode(',', $keywords);
}
}
abstract class PHP_Token_Includes extends PHP_Token
{
/**
* @var string
*/
protected $name;
/**
* @var string
*/
protected $type;
/**
* @return string
*/
public function getName()
{
if ($this->name !== NULL) {
return $this->name;
if ($this->name === null) {
$this->process();
}
return $this->name;
}
/**
* @return string
*/
public function getType()
{
if ($this->type === null) {
$this->process();
}
return $this->type;
}
private function process()
{
$tokens = $this->tokenStream->tokens();
if ($tokens[$this->id+2] instanceof PHP_Token_CONSTANT_ENCAPSED_STRING) {
$this->name = trim($tokens[$this->id+2], "'\"");
$this->type = strtolower(
str_replace('PHP_Token_', '', get_class($tokens[$this->id]))
str_replace('PHP_Token_', '', get_class($tokens[$this->id]))
);
}
return $this->name;
}
public function getType()
{
$this->getName();
return $this->type;
}
}
class PHP_Token_FUNCTION extends PHP_TokenWithScopeAndVisibility
{
/**
* @var array
*/
protected $arguments;
/**
* @var integer
*/
protected $ccn;
/**
* @var string
*/
protected $name;
/**
* @var string
*/
protected $signature;
/**
* @return array
*/
public function getArguments()
{
if ($this->arguments !== NULL) {
if ($this->arguments !== null) {
return $this->arguments;
}
$this->arguments = array();
$tokens = $this->tokenStream->tokens();
$typeHint = NULL;
$typeDeclaration = null;
// Search for first token inside brackets
$i = $this->id + 2;
while (!$tokens[$i-1] instanceof PHP_Token_OPEN_BRACKET) {
$i++;
}
while (!$tokens[$i] instanceof PHP_Token_CLOSE_BRACKET) {
if ($tokens[$i] instanceof PHP_Token_STRING) {
$typeHint = (string)$tokens[$i];
}
else if ($tokens[$i] instanceof PHP_Token_VARIABLE) {
$this->arguments[(string)$tokens[$i]] = $typeHint;
$typeHint = NULL;
$typeDeclaration = (string)$tokens[$i];
} elseif ($tokens[$i] instanceof PHP_Token_VARIABLE) {
$this->arguments[(string)$tokens[$i]] = $typeDeclaration;
$typeDeclaration = null;
}
$i++;
......@@ -290,9 +334,12 @@ public function getArguments()
return $this->arguments;
}
/**
* @return string
*/
public function getName()
{
if ($this->name !== NULL) {
if ($this->name !== null) {
return $this->name;
}
......@@ -302,15 +349,11 @@ public function getName()
if ($tokens[$i] instanceof PHP_Token_STRING) {
$this->name = (string)$tokens[$i];
break;
}
else if ($tokens[$i] instanceof PHP_Token_AMPERSAND &&
} elseif ($tokens[$i] instanceof PHP_Token_AMPERSAND &&
$tokens[$i+1] instanceof PHP_Token_STRING) {
$this->name = (string)$tokens[$i+1];
break;
}
else if ($tokens[$i] instanceof PHP_Token_OPEN_BRACKET) {
} elseif ($tokens[$i] instanceof PHP_Token_OPEN_BRACKET) {
$this->name = 'anonymous function';
break;
}
......@@ -332,9 +375,12 @@ public function getName()
return $this->name;
}
/**
* @return integer
*/
public function getCCN()
{
if ($this->ccn !== NULL) {
if ($this->ccn !== null) {
return $this->ccn;
}
......@@ -355,19 +401,21 @@ public function getCCN()
case 'PHP_Token_LOGICAL_AND':
case 'PHP_Token_BOOLEAN_OR':
case 'PHP_Token_LOGICAL_OR':
case 'PHP_Token_QUESTION_MARK': {
case 'PHP_Token_QUESTION_MARK':
$this->ccn++;
}
break;
break;
}
}
return $this->ccn;
}
/**
* @return string
*/
public function getSignature()
{
if ($this->signature !== NULL) {
if ($this->signature !== null) {
return $this->signature;
}
......@@ -395,29 +443,41 @@ public function getSignature()
class PHP_Token_INTERFACE extends PHP_TokenWithScopeAndVisibility
{
/**
* @var array
*/
protected $interfaces;
/**
* @return string
*/
public function getName()
{
return (string)$this->tokenStream[$this->id + 2];
}
/**
* @return boolean
*/
public function hasParent()
{
return $this->tokenStream[$this->id + 4] instanceof PHP_Token_EXTENDS;
}
/**
* @return array
*/
public function getPackage()
{
$className = $this->getName();
$docComment = $this->getDocblock();
$result = array(
'namespace' => '',
'fullPackage' => '',
'category' => '',
'package' => '',
'subpackage' => ''
'namespace' => '',
'fullPackage' => '',
'category' => '',
'package' => '',
'subpackage' => ''
);
for ($i = $this->id; $i; --$i) {
......@@ -443,13 +503,19 @@ public function getPackage()
if (empty($result['fullPackage'])) {
$result['fullPackage'] = $this->arrayToName(
explode('_', str_replace('\\', '_', $className)), '.'
explode('_', str_replace('\\', '_', $className)),
'.'
);
}
return $result;
}
/**
* @param array $parts
* @param string $join
* @return string
*/
protected function arrayToName(array $parts, $join = '\\')
{
$result = '';
......@@ -463,10 +529,13 @@ protected function arrayToName(array $parts, $join = '\\')
return $result;
}
/**
* @return boolean|string
*/
public function getParent()
{
if (!$this->hasParent()) {
return FALSE;
return false;
}
$i = $this->id + 6;
......@@ -481,6 +550,9 @@ public function getParent()
return $className