diff --git a/composer.lock b/composer.lock
index 76c42a09d..e4a77b051 100644
--- a/composer.lock
+++ b/composer.lock
@@ -8,23 +8,26 @@
"packages": [
{
"name": "symfony/config",
- "version": "v2.6.4",
+ "version": "v2.6.7",
"target-dir": "Symfony/Component/Config",
"source": {
"type": "git",
"url": "https://github.com/symfony/Config.git",
- "reference": "a9f781ba1221067d1f07c8cec0bc50f81b8d7408"
+ "reference": "b6fddb4aa2daaa2b06f0040071ac131b4a1ecf25"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Config/zipball/a9f781ba1221067d1f07c8cec0bc50f81b8d7408",
- "reference": "a9f781ba1221067d1f07c8cec0bc50f81b8d7408",
+ "url": "https://api.github.com/repos/symfony/Config/zipball/b6fddb4aa2daaa2b06f0040071ac131b4a1ecf25",
+ "reference": "b6fddb4aa2daaa2b06f0040071ac131b4a1ecf25",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/filesystem": "~2.3"
},
+ "require-dev": {
+ "symfony/phpunit-bridge": "~2.7"
+ },
"type": "library",
"extra": {
"branch-alias": {
@@ -41,32 +44,32 @@
"MIT"
],
"authors": [
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- },
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Config Component",
- "homepage": "http://symfony.com",
- "time": "2015-01-21 20:57:55"
+ "homepage": "https://symfony.com",
+ "time": "2015-05-02 15:18:45"
},
{
"name": "symfony/dependency-injection",
- "version": "v2.6.4",
+ "version": "v2.6.7",
"target-dir": "Symfony/Component/DependencyInjection",
"source": {
"type": "git",
"url": "https://github.com/symfony/DependencyInjection.git",
- "reference": "42bbb43fab66292a1865dc9616c299904c3d4d14"
+ "reference": "b575c160af001d3525ee733085bcc4ec7c8e1b51"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/42bbb43fab66292a1865dc9616c299904c3d4d14",
- "reference": "42bbb43fab66292a1865dc9616c299904c3d4d14",
+ "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/b575c160af001d3525ee733085bcc4ec7c8e1b51",
+ "reference": "b575c160af001d3525ee733085bcc4ec7c8e1b51",
"shasum": ""
},
"require": {
@@ -78,6 +81,7 @@
"require-dev": {
"symfony/config": "~2.2",
"symfony/expression-language": "~2.6",
+ "symfony/phpunit-bridge": "~2.7",
"symfony/yaml": "~2.1"
},
"suggest": {
@@ -101,37 +105,40 @@
"MIT"
],
"authors": [
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- },
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony DependencyInjection Component",
- "homepage": "http://symfony.com",
- "time": "2015-01-25 04:39:26"
+ "homepage": "https://symfony.com",
+ "time": "2015-05-02 15:18:45"
},
{
"name": "symfony/filesystem",
- "version": "v2.6.4",
+ "version": "v2.6.7",
"target-dir": "Symfony/Component/Filesystem",
"source": {
"type": "git",
"url": "https://github.com/symfony/Filesystem.git",
- "reference": "a1f566d1f92e142fa1593f4555d6d89e3044a9b7"
+ "reference": "f73904bd2dae525c42ea1f0340c7c98480ecacde"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a1f566d1f92e142fa1593f4555d6d89e3044a9b7",
- "reference": "a1f566d1f92e142fa1593f4555d6d89e3044a9b7",
+ "url": "https://api.github.com/repos/symfony/Filesystem/zipball/f73904bd2dae525c42ea1f0340c7c98480ecacde",
+ "reference": "f73904bd2dae525c42ea1f0340c7c98480ecacde",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
+ "require-dev": {
+ "symfony/phpunit-bridge": "~2.7"
+ },
"type": "library",
"extra": {
"branch-alias": {
@@ -148,18 +155,18 @@
"MIT"
],
"authors": [
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- },
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Filesystem Component",
- "homepage": "http://symfony.com",
- "time": "2015-01-03 21:13:09"
+ "homepage": "https://symfony.com",
+ "time": "2015-05-08 00:09:07"
}
],
"packages-dev": [
@@ -268,21 +275,22 @@
},
{
"name": "phpspec/prophecy",
- "version": "v1.3.1",
+ "version": "v1.4.1",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
- "reference": "9ca52329bcdd1500de24427542577ebf3fc2f1c9"
+ "reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpspec/prophecy/zipball/9ca52329bcdd1500de24427542577ebf3fc2f1c9",
- "reference": "9ca52329bcdd1500de24427542577ebf3fc2f1c9",
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373",
+ "reference": "3132b1f44c7bf2ec4c7eb2d3cb78fdeca760d373",
"shasum": ""
},
"require": {
- "doctrine/instantiator": "~1.0,>=1.0.2",
- "phpdocumentor/reflection-docblock": "~2.0"
+ "doctrine/instantiator": "^1.0.2",
+ "phpdocumentor/reflection-docblock": "~2.0",
+ "sebastian/comparator": "~1.1"
},
"require-dev": {
"phpspec/phpspec": "~2.0"
@@ -290,7 +298,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.2.x-dev"
+ "dev-master": "1.4.x-dev"
}
},
"autoload": {
@@ -314,7 +322,7 @@
}
],
"description": "Highly opinionated mocking framework for PHP 5.3+",
- "homepage": "http://phpspec.org",
+ "homepage": "https://github.com/phpspec/prophecy",
"keywords": [
"Double",
"Dummy",
@@ -323,20 +331,20 @@
"spy",
"stub"
],
- "time": "2014-11-17 16:23:49"
+ "time": "2015-04-27 22:15:08"
},
{
"name": "phpunit/php-code-coverage",
- "version": "2.0.15",
+ "version": "2.0.16",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "34cc484af1ca149188d0d9e91412191e398e0b67"
+ "reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/34cc484af1ca149188d0d9e91412191e398e0b67",
- "reference": "34cc484af1ca149188d0d9e91412191e398e0b67",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/934fd03eb6840508231a7f73eb8940cf32c3b66c",
+ "reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c",
"shasum": ""
},
"require": {
@@ -385,35 +393,37 @@
"testing",
"xunit"
],
- "time": "2015-01-24 10:06:35"
+ "time": "2015-04-11 04:35:00"
},
{
"name": "phpunit/php-file-iterator",
- "version": "1.3.4",
+ "version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
- "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb"
+ "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb",
- "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb",
+ "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4.x-dev"
+ }
+ },
"autoload": {
"classmap": [
- "File/"
+ "src/"
]
},
"notification-url": "https://packagist.org/downloads/",
- "include-path": [
- ""
- ],
"license": [
"BSD-3-Clause"
],
@@ -430,7 +440,7 @@
"filesystem",
"iterator"
],
- "time": "2013-10-10 15:34:57"
+ "time": "2015-04-02 05:19:05"
},
{
"name": "phpunit/php-text-template",
@@ -522,16 +532,16 @@
},
{
"name": "phpunit/php-token-stream",
- "version": "1.4.0",
+ "version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
- "reference": "db32c18eba00b121c145575fcbcd4d4d24e6db74"
+ "reference": "eab81d02569310739373308137284e0158424330"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/db32c18eba00b121c145575fcbcd4d4d24e6db74",
- "reference": "db32c18eba00b121c145575fcbcd4d4d24e6db74",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/eab81d02569310739373308137284e0158424330",
+ "reference": "eab81d02569310739373308137284e0158424330",
"shasum": ""
},
"require": {
@@ -567,20 +577,20 @@
"keywords": [
"tokenizer"
],
- "time": "2015-01-17 09:51:32"
+ "time": "2015-04-08 04:46:07"
},
{
"name": "phpunit/phpunit",
- "version": "4.5.0",
+ "version": "4.6.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "5b578d3865a9128b9c209b011fda6539ec06e7a5"
+ "reference": "3afe303d873a4d64c62ef84de491b97b006fbdac"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5b578d3865a9128b9c209b011fda6539ec06e7a5",
- "reference": "5b578d3865a9128b9c209b011fda6539ec06e7a5",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3afe303d873a4d64c62ef84de491b97b006fbdac",
+ "reference": "3afe303d873a4d64c62ef84de491b97b006fbdac",
"shasum": ""
},
"require": {
@@ -590,19 +600,19 @@
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
- "phpspec/prophecy": "~1.3.1",
- "phpunit/php-code-coverage": "~2.0",
- "phpunit/php-file-iterator": "~1.3.2",
+ "phpspec/prophecy": "~1.3,>=1.3.1",
+ "phpunit/php-code-coverage": "~2.0,>=2.0.11",
+ "phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2",
- "phpunit/php-timer": "~1.0.2",
+ "phpunit/php-timer": "~1.0",
"phpunit/phpunit-mock-objects": "~2.3",
"sebastian/comparator": "~1.1",
- "sebastian/diff": "~1.1",
+ "sebastian/diff": "~1.2",
"sebastian/environment": "~1.2",
"sebastian/exporter": "~1.2",
"sebastian/global-state": "~1.0",
"sebastian/version": "~1.0",
- "symfony/yaml": "~2.0"
+ "symfony/yaml": "~2.1|~3.0"
},
"suggest": {
"phpunit/php-invoker": "~1.1"
@@ -613,7 +623,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.5.x-dev"
+ "dev-master": "4.6.x-dev"
}
},
"autoload": {
@@ -639,29 +649,29 @@
"testing",
"xunit"
],
- "time": "2015-02-05 15:51:19"
+ "time": "2015-04-29 15:18:52"
},
{
"name": "phpunit/phpunit-mock-objects",
- "version": "2.3.0",
+ "version": "2.3.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
- "reference": "c63d2367247365f688544f0d500af90a11a44c65"
+ "reference": "74ffb87f527f24616f72460e54b595f508dccb5c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/c63d2367247365f688544f0d500af90a11a44c65",
- "reference": "c63d2367247365f688544f0d500af90a11a44c65",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/74ffb87f527f24616f72460e54b595f508dccb5c",
+ "reference": "74ffb87f527f24616f72460e54b595f508dccb5c",
"shasum": ""
},
"require": {
- "doctrine/instantiator": "~1.0,>=1.0.1",
+ "doctrine/instantiator": "~1.0,>=1.0.2",
"php": ">=5.3.3",
"phpunit/php-text-template": "~1.2"
},
"require-dev": {
- "phpunit/phpunit": "~4.3"
+ "phpunit/phpunit": "~4.4"
},
"suggest": {
"ext-soap": "*"
@@ -694,7 +704,7 @@
"mock",
"xunit"
],
- "time": "2014-10-03 05:12:11"
+ "time": "2015-04-02 05:36:41"
},
{
"name": "sebastian/comparator",
@@ -762,16 +772,16 @@
},
{
"name": "sebastian/diff",
- "version": "1.2.0",
+ "version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
- "reference": "5843509fed39dee4b356a306401e9dd1a931fec7"
+ "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/5843509fed39dee4b356a306401e9dd1a931fec7",
- "reference": "5843509fed39dee4b356a306401e9dd1a931fec7",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3",
+ "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3",
"shasum": ""
},
"require": {
@@ -783,7 +793,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.2-dev"
+ "dev-master": "1.3-dev"
}
},
"autoload": {
@@ -810,32 +820,32 @@
"keywords": [
"diff"
],
- "time": "2014-08-15 10:29:00"
+ "time": "2015-02-22 15:13:53"
},
{
"name": "sebastian/environment",
- "version": "1.2.1",
+ "version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
- "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7"
+ "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e6c71d918088c251b181ba8b3088af4ac336dd7",
- "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e",
+ "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
- "phpunit/phpunit": "~4.3"
+ "phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.2.x-dev"
+ "dev-master": "1.3.x-dev"
}
},
"autoload": {
@@ -860,7 +870,7 @@
"environment",
"hhvm"
],
- "time": "2014-10-25 08:00:45"
+ "time": "2015-01-01 10:01:08"
},
{
"name": "sebastian/exporter",
@@ -1034,16 +1044,16 @@
},
{
"name": "sebastian/version",
- "version": "1.0.4",
+ "version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
- "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b"
+ "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/a77d9123f8e809db3fbdea15038c27a95da4058b",
- "reference": "a77d9123f8e809db3fbdea15038c27a95da4058b",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/ab931d46cd0d3204a91e1b9a40c4bc13032b58e4",
+ "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4",
"shasum": ""
},
"type": "library",
@@ -1065,24 +1075,25 @@
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
- "time": "2014-12-15 14:25:24"
+ "time": "2015-02-24 06:35:25"
},
{
"name": "squizlabs/php_codesniffer",
- "version": "2.2.0",
+ "version": "2.3.2",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
- "reference": "b301c98f19414d836fdaa678648745fcca5aeb4f"
+ "reference": "e96d8579fbed0c95ecf2a0501ec4f307a4aa6404"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b301c98f19414d836fdaa678648745fcca5aeb4f",
- "reference": "b301c98f19414d836fdaa678648745fcca5aeb4f",
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e96d8579fbed0c95ecf2a0501ec4f307a4aa6404",
+ "reference": "e96d8579fbed0c95ecf2a0501ec4f307a4aa6404",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
+ "ext-xmlwriter": "*",
"php": ">=5.1.2"
},
"bin": [
@@ -1090,6 +1101,11 @@
"scripts/phpcbf"
],
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
"autoload": {
"classmap": [
"CodeSniffer.php",
@@ -1133,26 +1149,29 @@
"phpcs",
"standards"
],
- "time": "2015-01-21 22:44:05"
+ "time": "2015-04-28 23:28:20"
},
{
"name": "symfony/yaml",
- "version": "v2.6.4",
+ "version": "v2.6.7",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
- "reference": "60ed7751671113cf1ee7d7778e691642c2e9acd8"
+ "reference": "f157ab074e453ecd4c0fa775f721f6e67a99d9e2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Yaml/zipball/60ed7751671113cf1ee7d7778e691642c2e9acd8",
- "reference": "60ed7751671113cf1ee7d7778e691642c2e9acd8",
+ "url": "https://api.github.com/repos/symfony/Yaml/zipball/f157ab074e453ecd4c0fa775f721f6e67a99d9e2",
+ "reference": "f157ab074e453ecd4c0fa775f721f6e67a99d9e2",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
+ "require-dev": {
+ "symfony/phpunit-bridge": "~2.7"
+ },
"type": "library",
"extra": {
"branch-alias": {
@@ -1169,18 +1188,18 @@
"MIT"
],
"authors": [
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- },
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
- "homepage": "http://symfony.com",
- "time": "2015-01-25 04:39:26"
+ "homepage": "https://symfony.com",
+ "time": "2015-05-02 15:18:45"
}
],
"aliases": [],
diff --git a/src/main/php/PDepend/Source/AST/ASTFormalParameter.php b/src/main/php/PDepend/Source/AST/ASTFormalParameter.php
index 1c11d0229..67e3b4fe0 100644
--- a/src/main/php/PDepend/Source/AST/ASTFormalParameter.php
+++ b/src/main/php/PDepend/Source/AST/ASTFormalParameter.php
@@ -58,6 +58,29 @@
*/
class ASTFormalParameter extends ASTNode
{
+ /**
+ * This method will return true when the parameter is declared as a
+ * variable argument list ....
+ *
+ * @return boolean
+ * @since 2.0.7
+ */
+ public function isVariableArgList()
+ {
+ return $this->getMetadataBoolean(6);
+ }
+
+ /**
+ * This method can be used to mark this parameter as passed by reference.
+ *
+ * @return void
+ @since 2.0.7
+ */
+ public function setVariableArgList()
+ {
+ return $this->setMetadataBoolean(6, true);
+ }
+
/**
* This method will return true when the parameter is passed by
* reference.
@@ -102,6 +125,6 @@ public function accept(ASTVisitor $visitor, $data = null)
*/
protected function getMetadataSize()
{
- return 6;
+ return 7;
}
}
diff --git a/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php b/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php
index 36f4f08d8..5f3a84fb7 100644
--- a/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php
+++ b/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php
@@ -5418,7 +5418,7 @@ private function parseFormalParameterAndByReference()
* @return \PDepend\Source\AST\ASTFormalParameter
* @since 0.9.6
*/
- private function parseFormalParameter()
+ protected function parseFormalParameter()
{
$parameter = $this->builder->buildAstFormalParameter();
$parameter->addChild($this->parseVariableDeclarator());
@@ -6204,7 +6204,7 @@ private function parseStaticVariableDeclaration(Token $token)
* @return \PDepend\Source\AST\ASTVariableDeclarator
* @since 0.9.6
*/
- private function parseVariableDeclarator()
+ protected function parseVariableDeclarator()
{
$this->tokenStack->push();
diff --git a/src/main/php/PDepend/Source/Language/PHP/PHPParserGeneric.php b/src/main/php/PDepend/Source/Language/PHP/PHPParserGeneric.php
index 2fb171382..b9501c703 100644
--- a/src/main/php/PDepend/Source/Language/PHP/PHPParserGeneric.php
+++ b/src/main/php/PDepend/Source/Language/PHP/PHPParserGeneric.php
@@ -376,4 +376,33 @@ protected function parseStaticValueVersionSpecific(ASTValue $value)
return $value;
}
+
+ /**
+ * This method will parse a formal parameter. A formal parameter is at least
+ * a variable name, but can also contain a default parameter value.
+ *
+ *
+ * // -- -------
+ * function foo(Bar $x, $y = 42) {}
+ * // -- -------
+ *
+ *
+ * @return \PDepend\Source\AST\ASTFormalParameter
+ * @since 2.0.7
+ */
+ protected function parseFormalParameter()
+ {
+ $parameter = $this->builder->buildAstFormalParameter();
+
+ if (Tokens::T_ELLIPSIS === $this->tokenizer->peek()) {
+ $this->consumeToken(Tokens::T_ELLIPSIS);
+ $this->consumeComments();
+
+ $parameter->setVariableArgList();
+ }
+
+ $parameter->addChild($this->parseVariableDeclarator());
+
+ return $parameter;
+ }
}
diff --git a/src/main/php/PDepend/Source/Language/PHP/PHPTokenizerInternal.php b/src/main/php/PDepend/Source/Language/PHP/PHPTokenizerInternal.php
index ac7128b36..a5b9b790c 100644
--- a/src/main/php/PDepend/Source/Language/PHP/PHPTokenizerInternal.php
+++ b/src/main/php/PDepend/Source/Language/PHP/PHPTokenizerInternal.php
@@ -56,6 +56,11 @@
*/
class PHPTokenizerInternal implements Tokenizer
{
+ /**
+ * Internally used transition token.
+ */
+ const T_ELLIPSIS = 23006;
+
/**
* Mapping between php internal tokens and php depend tokens.
*
@@ -129,6 +134,7 @@ class PHPTokenizerInternal implements Tokenizer
T_OR_EQUAL => Tokens::T_OR_EQUAL,
T_CONTINUE => Tokens::T_CONTINUE,
T_METHOD_C => Tokens::T_METHOD_C,
+ T_ELLIPSIS => Tokens::T_ELLIPSIS,
T_OPEN_TAG => Tokens::T_OPEN_TAG,
T_SL_EQUAL => Tokens::T_SL_EQUAL,
T_SR_EQUAL => Tokens::T_SR_EQUAL,
@@ -358,6 +364,19 @@ class PHPTokenizerInternal implements Tokenizer
),
);
+ protected static $reductionMap = array(
+ Tokens::T_CONCAT => array(
+ Tokens::T_CONCAT => array(
+ 'type' => self::T_ELLIPSIS,
+ 'image' => '..'
+ ),
+ self::T_ELLIPSIS => array(
+ 'type' => Tokens::T_ELLIPSIS,
+ 'image' => '...'
+ )
+ ),
+ );
+
/**
* The source file instance.
*
@@ -592,12 +611,20 @@ private function tokenize()
if (isset($literalMap[$value])) {
// Fetch literal type
$type = $literalMap[$value];
+ $image = $token[1];
// Check for a context sensitive alternative
if (isset(self::$alternativeMap[$type][$previousType])) {
$type = self::$alternativeMap[$type][$previousType];
}
- $image = $token[1];
+
+ if (isset(self::$reductionMap[$type][$previousType])) {
+ $image = self::$reductionMap[$type][$previousType]['image'];
+ $type = self::$reductionMap[$type][$previousType]['type'];
+
+ array_pop($this->tokens);
+ }
+
} elseif (isset($tokenMap[$token[0]])) {
$type = $tokenMap[$token[0]];
// Check for a context sensitive alternative
diff --git a/src/main/php/PDepend/Source/Tokenizer/Tokenizer.php b/src/main/php/PDepend/Source/Tokenizer/Tokenizer.php
index d2de36fd1..0e86d32a0 100644
--- a/src/main/php/PDepend/Source/Tokenizer/Tokenizer.php
+++ b/src/main/php/PDepend/Source/Tokenizer/Tokenizer.php
@@ -84,6 +84,13 @@
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.
*/
diff --git a/src/main/php/PDepend/Source/Tokenizer/Tokens.php b/src/main/php/PDepend/Source/Tokenizer/Tokens.php
index 48688f60a..fbfe3c058 100644
--- a/src/main/php/PDepend/Source/Tokenizer/Tokens.php
+++ b/src/main/php/PDepend/Source/Tokenizer/Tokens.php
@@ -850,6 +850,13 @@ interface Tokens
*/
const T_FINALLY = 160;
+ /**
+ * TOken that represents the '...' token
+ *
+ * @since 2.0.7
+ */
+ const T_ELLIPSIS = 161;
+
/**
* Marks any content not between php tags.
*/
diff --git a/src/test/php/PDepend/Source/AST/ASTFormalParameterTest.php b/src/test/php/PDepend/Source/AST/ASTFormalParameterTest.php
index e8a9b6c16..5f2d36795 100644
--- a/src/test/php/PDepend/Source/AST/ASTFormalParameterTest.php
+++ b/src/test/php/PDepend/Source/AST/ASTFormalParameterTest.php
@@ -55,6 +55,61 @@
*/
class ASTFormalParameterTest extends \PDepend\Source\AST\ASTNodeTest
{
+ /**
+ * testIsVariableArgListReturnsFalseByDefault
+ *
+ * @return void
+ */
+ public function testIsVariableArgListReturnsFalseByDefault()
+ {
+ $parameter = $this->_getFirstFormalParameterInFunction();
+ $this->assertFalse($parameter->isVariableArgList());
+ }
+
+ /**
+ * testIsVariableArgListReturnsTrue
+ *
+ * @return void
+ */
+ public function testIsVariableArgListReturnsTrue()
+ {
+ $parameter = $this->_getFirstFormalParameterInFunction();
+ $this->assertTrue($parameter->isVariableArgList());
+ }
+
+ /**
+ * testIsVariableArgListWithArrayTypeHint
+ *
+ * @return void
+ */
+ public function testIsVariableArgListWithArrayTypeHint()
+ {
+ $parameter = $this->_getFirstFormalParameterInFunction();
+ $this->assertTrue($parameter->isVariableArgList());
+ }
+
+ /**
+ * testIsVariableArgListWithClassTypeHint
+ *
+ * @return void
+ */
+ public function testIsVariableArgListWithClassTypeHint()
+ {
+ $parameter = $this->_getFirstFormalParameterInFunction();
+ $this->assertTrue($parameter->isVariableArgList());
+ }
+
+ /**
+ * testIsVariableArgListPassedByReference
+ *
+ * @return void
+ */
+ public function testIsVariableArgListPassedByReference()
+ {
+ $parameter = $this->_getFirstFormalParameterInFunction();
+ $this->assertTrue($parameter->isVariableArgList());
+ }
+
/**
* testIsPassedByReferenceReturnsFalseByDefault
*
diff --git a/src/test/resources/files/Source/AST/ASTFormalParameter/testIsVariableArgListPassedByReference.php b/src/test/resources/files/Source/AST/ASTFormalParameter/testIsVariableArgListPassedByReference.php
new file mode 100644
index 000000000..8417fbe17
--- /dev/null
+++ b/src/test/resources/files/Source/AST/ASTFormalParameter/testIsVariableArgListPassedByReference.php
@@ -0,0 +1,5 @@
+