Skip to content

Commit

Permalink
PHPStanServiceFactory - add tests directory as analysed paths
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Feb 23, 2021
1 parent 7a199b2 commit 9071f1b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Rector\NodeTypeResolver;

/**
* @deprecated This must be replaced by ReflectionProvider from PHPStan, that knows about classes and autolaods them statically
*/
final class ClassExistenceStaticHelper
{
public static function doesClassLikeExist(string $classLike): bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,21 @@ public function __construct(ParameterProvider $parameterProvider)

$existingAdditionalConfigFiles = array_filter($additionalConfigFiles, 'file_exists');

$this->container = $containerFactory->create(sys_get_temp_dir(), $existingAdditionalConfigFiles, []);
// this allows to statically autoload files from Rector tests
$analysedPathsFromConfig = [];
if (defined('RECTOR_REPOSITORY')) {
$analysedPathsFromConfig[] = sys_get_temp_dir() . '/_temp_fixture_easy_testing';
// just for loading Source directory
$analysedPathsFromConfig[] = __DIR__ . '/../../../../rules/renaming/tests/Rector/Name/RenameClassRector/Source';
}

$this->container = $containerFactory->create(
sys_get_temp_dir(),
$existingAdditionalConfigFiles,
[],
[],
$analysedPathsFromConfig
);
}

/**
Expand Down

0 comments on commit 9071f1b

Please sign in to comment.