From 601d7934672f7a962a59e79456fcf910a4db7811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=B6nthal?= Date: Thu, 12 Jun 2014 13:25:32 +0200 Subject: [PATCH 1/9] Update Broker.php --- TokenReflection/Broker.php | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/TokenReflection/Broker.php b/TokenReflection/Broker.php index 3b216901..5dd72411 100644 --- a/TokenReflection/Broker.php +++ b/TokenReflection/Broker.php @@ -17,6 +17,8 @@ use TokenReflection\Broker, TokenReflection\Exception; use RecursiveDirectoryIterator, RecursiveIteratorIterator; +use Symfony\Component\Finder\Finder; +use Symfony\Component\Finder\SplFileInfo; // Detect if we have native traits support define('NATIVE_TRAITS', defined('T_TRAIT')); @@ -275,25 +277,24 @@ public function processDirectory($path, $filters = array(), $returnReflectionFil } try { - $result = array(); - foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($realPath)) as $entry) { - if ($entry->isFile()) { - $process = empty($filters); - if (!$process) { - foreach ((array) $filters as $filter) { - $whitelisting = '!' !== $filter{0}; - if (fnmatch($whitelisting ? $filter : substr($filter, 1), $entry->getPathName(), FNM_NOESCAPE)) { - $process = $whitelisting; - } - } - } + $files = Finder::create()->files()->ignoreVCS(true)->ignoreDotFiles(true)->ignoreUnreadableDirs(); - if ($process) { - $result[$entry->getPathName()] = $this->processFile($entry->getPathName(), $returnReflectionFile); - } + foreach ($filters as $filter) { + if ('!' === $filter{0}) { + $files->notPath(substr($filter,1)); + } else { + $files->path($filter); } } + $files->in($realPath); + + $result = array(); + foreach ($files as $entry) { + /** @var SplFileInfo $entry */ + $result[$entry->getPathName()] = $this->processFile($entry->getPathName(), $returnReflectionFile); + } + return $returnReflectionFile ? $result : true; } catch (Exception\ParseException $e) { throw $e; From b160eeb1e4f452b079a1d02269a49b36d62c753c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=B6nthal?= Date: Thu, 12 Jun 2014 13:26:01 +0200 Subject: [PATCH 2/9] Update composer.json --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1569e612..274d6c50 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,8 @@ "require": { "php": ">=5.3.0", - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "symfony/finder" : "@stable", }, "autoload": { From 26bff7ff8b078d2216b3c1135dc0b011ee7b4d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=B6nthal?= Date: Thu, 12 Jun 2014 13:28:28 +0200 Subject: [PATCH 3/9] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 274d6c50..a65744ac 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "require": { "php": ">=5.3.0", "ext-tokenizer": "*", - "symfony/finder" : "@stable", + "symfony/finder" : "@stable" }, "autoload": { From de443308bc586677b6354036feb8c3e4238b5e19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=B6nthal?= Date: Thu, 12 Jun 2014 13:47:58 +0200 Subject: [PATCH 4/9] Update Broker.php --- TokenReflection/Broker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TokenReflection/Broker.php b/TokenReflection/Broker.php index 5dd72411..2fffd53f 100644 --- a/TokenReflection/Broker.php +++ b/TokenReflection/Broker.php @@ -277,7 +277,7 @@ public function processDirectory($path, $filters = array(), $returnReflectionFil } try { - $files = Finder::create()->files()->ignoreVCS(true)->ignoreDotFiles(true)->ignoreUnreadableDirs(); + $files = Finder::create()->files()->contains('*.php')->ignoreVCS(true)->ignoreDotFiles(true)->ignoreUnreadableDirs(); foreach ($filters as $filter) { if ('!' === $filter{0}) { From c1ee0f87d6c3aff965888c360f16495e7cb38f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=B6nthal?= Date: Thu, 12 Jun 2014 13:50:44 +0200 Subject: [PATCH 5/9] Update Broker.php --- TokenReflection/Broker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TokenReflection/Broker.php b/TokenReflection/Broker.php index 2fffd53f..a09e2c06 100644 --- a/TokenReflection/Broker.php +++ b/TokenReflection/Broker.php @@ -277,7 +277,7 @@ public function processDirectory($path, $filters = array(), $returnReflectionFil } try { - $files = Finder::create()->files()->contains('*.php')->ignoreVCS(true)->ignoreDotFiles(true)->ignoreUnreadableDirs(); + $files = Finder::create()->files()->contains('.php')->ignoreVCS(true)->ignoreDotFiles(true)->ignoreUnreadableDirs(); foreach ($filters as $filter) { if ('!' === $filter{0}) { From f043d559ab9c1651fd10321b3cd9e5cefbb47470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=B6nthal?= Date: Thu, 12 Jun 2014 13:58:49 +0200 Subject: [PATCH 6/9] Update Broker.php --- TokenReflection/Broker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TokenReflection/Broker.php b/TokenReflection/Broker.php index a09e2c06..6e670503 100644 --- a/TokenReflection/Broker.php +++ b/TokenReflection/Broker.php @@ -277,7 +277,7 @@ public function processDirectory($path, $filters = array(), $returnReflectionFil } try { - $files = Finder::create()->files()->contains('.php')->ignoreVCS(true)->ignoreDotFiles(true)->ignoreUnreadableDirs(); + $files = Finder::create()->files()->name('*.php')->ignoreVCS(true)->ignoreDotFiles(true)->ignoreUnreadableDirs(); foreach ($filters as $filter) { if ('!' === $filter{0}) { From ed58b3b8031eba7f4614a37de83184a06023b405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=B6nthal?= Date: Thu, 12 Jun 2014 14:28:11 +0200 Subject: [PATCH 7/9] Update .travis.yml --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 93abdd19..e934e976 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,4 +16,7 @@ notifications: email: - ci@andrewsville.cz -script: phpunit tests/TokenReflection \ No newline at end of file +before_script: + - composer update --dev + +script: phpunit tests/TokenReflection From 2425ce0326cc23ac95f8f4d22b4a9b7fd66a4dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=B6nthal?= Date: Thu, 12 Jun 2014 16:33:10 +0200 Subject: [PATCH 8/9] Update ReflectionMethod.php --- TokenReflection/ReflectionMethod.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TokenReflection/ReflectionMethod.php b/TokenReflection/ReflectionMethod.php index eddf5af1..e419a5bd 100644 --- a/TokenReflection/ReflectionMethod.php +++ b/TokenReflection/ReflectionMethod.php @@ -384,7 +384,7 @@ public function __toString() $prototype = ', prototype ' . $this->getPrototype()->getDeclaringClassName(); } catch (Exception\RuntimeException $e) { if ($declaringClassParent && $declaringClassParent->isInternal()) { - $internal = 'internal:' . $parentClass->getExtensionName(); + $internal = 'internal:' . $declaringClassParent->getExtensionName(); } } From c4e80b4b2aaf44fbd87349de154f7ff060d2b8fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=B6nthal?= Date: Wed, 18 Jun 2014 09:28:00 +0200 Subject: [PATCH 9/9] Update ReflectionClass.php fixed exception in __toString --- TokenReflection/ReflectionClass.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TokenReflection/ReflectionClass.php b/TokenReflection/ReflectionClass.php index a2c55a8d..aacbd9bd 100644 --- a/TokenReflection/ReflectionClass.php +++ b/TokenReflection/ReflectionClass.php @@ -1437,6 +1437,7 @@ public function setStaticPropertyValue($name, $value) */ public function __toString() { + try { $implements = ''; $interfaceNames = $this->getInterfaceNames(); if (count($interfaceNames) > 0) { @@ -1524,6 +1525,9 @@ public function __toString() $properties, $methods ); + } catch (\Exception $e) { + return __CLASS__; + } } /**