Skip to content

Commit

Permalink
Merge 701e454 into 1cdfc42
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] committed Apr 19, 2021
2 parents 1cdfc42 + 701e454 commit 5dcf863
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 39 deletions.
2 changes: 1 addition & 1 deletion dev-tools/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"require-dev": {
"ergebnis/composer-normalize": "^2.13.3",
"friendsofphp/php-cs-fixer": "^2.18.5",
"kubawerlos/php-cs-fixer-config": "^1.9.0",
"kubawerlos/php-cs-fixer-config": "^1.10.0",
"kubawerlos/php-cs-fixer-custom-fixers": "^2.4.1",
"maglnet/composer-require-checker": "^3.2.0",
"mi-schi/phpmd-extension": "^4.3.0",
Expand Down
59 changes: 31 additions & 28 deletions dev-tools/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions src/ClassCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,19 @@ private function getClassesForFile(string $path): array
$i = 1;

while ($i < $count) {
if ($tokens[$i][0] === T_NAMESPACE) {
if ($tokens[$i][0] === \T_NAMESPACE) {
$i += 2;
while (isset($tokens[$i]) && \is_array($tokens[$i])) {
if (\in_array($tokens[$i][0], [T_NS_SEPARATOR, T_STRING], true)) {
if (\in_array($tokens[$i][0], [\T_NS_SEPARATOR, \T_STRING], true)) {
$namespace .= $tokens[$i][1];
}
$i++;
}
}
if (
\in_array($tokens[$i][0], [T_CLASS, T_INTERFACE, T_TRAIT], true)
&& $tokens[$i + 1][0] === T_WHITESPACE
&& $tokens[$i + 2][0] === T_STRING
\in_array($tokens[$i][0], [\T_CLASS, \T_INTERFACE, \T_TRAIT], true)
&& $tokens[$i + 1][0] === \T_WHITESPACE
&& $tokens[$i + 2][0] === \T_STRING
) {
$classes[] = \sprintf('%s\\%s', $namespace, $tokens[$i + 2][1]);
}
Expand All @@ -119,17 +119,17 @@ private function getTokens(string $content): array
$tokens = [];

foreach (\token_get_all($content) as $token) {
if (\defined('T_NAME_QUALIFIED') && \is_array($token) && \in_array($token[0], [T_NAME_QUALIFIED, T_NAME_FULLY_QUALIFIED], true)) {
if (\defined('T_NAME_QUALIFIED') && \is_array($token) && \in_array($token[0], [\T_NAME_QUALIFIED, \T_NAME_FULLY_QUALIFIED], true)) {
$parts = \explode('\\', $token[1]);

if ($parts[0] === '') {
$tokens[] = [T_NS_SEPARATOR, '\\'];
$tokens[] = [\T_NS_SEPARATOR, '\\'];
\array_shift($parts);
}

foreach ($parts as $part) {
$tokens[] = [T_STRING, $part];
$tokens[] = [T_NS_SEPARATOR, '\\'];
$tokens[] = [\T_STRING, $part];
$tokens[] = [\T_NS_SEPARATOR, '\\'];
}

\array_pop($tokens);
Expand Down
2 changes: 1 addition & 1 deletion types-checker
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
declare(strict_types=1);

foreach ([__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php'] as $file) {
if (\file_exists($file)) {
if (file_exists($file)) {
require_once $file;
break;
}
Expand Down

0 comments on commit 5dcf863

Please sign in to comment.