<commit_before><?php

declare(strict_types=1);

namespace Rector\Utils\PHPStanAttributeTypeSyncer\Finder;

use Nette\Loaders\RobotLoader;

final class NodeClassFinder
{
    /**
     * @return string[]
     */
    public function findCurrentPHPDocParserNodeClasses(): array
    {
        return $this->findClassesByNamePatternInDirectories(
            '*Node.php',
            [
                // @todo not sure if needed
                //                __DIR__ . '/../../../../vendor/phpstan/phpdoc-parser/src/Ast/Type',
                __DIR__ . '/../../../../vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc',
            ]
        );
    }

    /**
     * @param string[] $directories
     * @return string[]
     */
    private function findClassesByNamePatternInDirectories(string $namePattern, array $directories): array
    {
        $robotLoader = new RobotLoader();
        foreach ($directories as $directory) {
            $robotLoader->addDirectory($directory);
        }<commit_msg>add type<commit_after><?php

declare(strict_types=1);

namespace Rector\Utils\PHPStanAttributeTypeSyncer\Finder;

use Nette\Loaders\RobotLoader;

final class NodeClassFinder
{
    /**
     * @return string[]
     */
    public function findCurrentPHPDocParserNodeClasses(): array
    {
        return $this->findClassesByNamePatternInDirectories(
            '*Node.php',
            [
                __DIR__ . '/../../../../vendor/phpstan/phpdoc-parser/src/Ast/Type',
                __DIR__ . '/../../../../vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc',
            ]
        );
    }

    /**
     * @param string[] $directories
     * @return string[]
     */
    private function findClassesByNamePatternInDirectories(string $namePattern, array $directories): array
    {
        $robotLoader = new RobotLoader();
        foreach ($directories as $directory) {
            $robotLoader->addDirectory($directory);
        }
{'fraction_non_alphanumeric': 0.1369078604893285, 'fraction_numerical': 0.001041124414367517, 'mean_word_length': 2.0801282051282053, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6646823', 'n_tokens_mistral': 552, 'n_tokens_neox': 544, 'n_words': 90}