Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ notifications:
email:
- ci@andrewsville.cz

script: phpunit tests/TokenReflection
before_script:
- composer update --dev

script: phpunit tests/TokenReflection
31 changes: 16 additions & 15 deletions TokenReflection/Broker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down Expand Up @@ -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()->name('*.php')->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;
Expand Down
4 changes: 4 additions & 0 deletions TokenReflection/ReflectionClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,7 @@ public function setStaticPropertyValue($name, $value)
*/
public function __toString()
{
try {
$implements = '';
$interfaceNames = $this->getInterfaceNames();
if (count($interfaceNames) > 0) {
Expand Down Expand Up @@ -1524,6 +1525,9 @@ public function __toString()
$properties,
$methods
);
} catch (\Exception $e) {
return __CLASS__;
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion TokenReflection/ReflectionMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

"require": {
"php": ">=5.3.0",
"ext-tokenizer": "*"
"ext-tokenizer": "*",
"symfony/finder" : "@stable"
},

"autoload": {
Expand Down