Skip to content

Commit

Permalink
Updated Rector to commit 41de61755c1f982ec554b6037a724abe708bfa27
Browse files Browse the repository at this point in the history
rectorphp/rector-src@41de617 Add possibility to add multiple phpstan configs (#4798)
  • Loading branch information
TomasVotruba committed Aug 16, 2023
1 parent 2ec1804 commit 1f6016e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 18 deletions.
18 changes: 15 additions & 3 deletions packages/Config/RectorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,25 @@ public function importShortClasses(bool $importShortClasses = \true) : void
SimpleParameterProvider::setParameter(Option::IMPORT_SHORT_CLASSES, $importShortClasses);
}
/**
* Set PHPStan custom config to load extensions and custom configuration to Rector.
* By default, the "phpstan.neon" path is used.
* Add PHPStan custom config to load extensions and custom configuration to Rector.
*/
public function phpstanConfig(string $filePath) : void
{
Assert::fileExists($filePath);
SimpleParameterProvider::setParameter(Option::PHPSTAN_FOR_RECTOR_PATH, $filePath);
$paths = SimpleParameterProvider::provideArrayParameter(Option::PHPSTAN_FOR_RECTOR_PATHS);
$paths[] = $filePath;
SimpleParameterProvider::setParameter(Option::PHPSTAN_FOR_RECTOR_PATHS, $paths);
}
/**
* Add PHPStan custom configs to load extensions and custom configuration to Rector.
*
* @param string[] $filePaths
*/
public function phpstanConfigs(array $filePaths) : void
{
foreach ($filePaths as $filePath) {
$this->phpstanConfig($filePath);
}
}
/**
* @param class-string<ConfigurableRectorInterface&RectorInterface> $rectorClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Rector\Core\Configuration\Parameter\SimpleParameterProvider;
use Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider;
use RectorPrefix202308\Symfony\Component\Filesystem\Filesystem;
use RectorPrefix202308\Webmozart\Assert\Assert;
/**
* Factory so Symfony app can use services from PHPStan container
*
Expand Down Expand Up @@ -119,8 +120,12 @@ public function createDynamicSourceLocatorProvider() : DynamicSourceLocatorProvi
private function resolveAdditionalConfigFiles() : array
{
$additionalConfigFiles = [];
if (SimpleParameterProvider::hasParameter(Option::PHPSTAN_FOR_RECTOR_PATH)) {
$additionalConfigFiles[] = SimpleParameterProvider::provideStringParameter(Option::PHPSTAN_FOR_RECTOR_PATH);
if (SimpleParameterProvider::hasParameter(Option::PHPSTAN_FOR_RECTOR_PATHS)) {
$paths = SimpleParameterProvider::provideArrayParameter(Option::PHPSTAN_FOR_RECTOR_PATHS);
foreach ($paths as $path) {
Assert::string($path);
$additionalConfigFiles[] = $path;
}
}
$additionalConfigFiles[] = __DIR__ . '/../../../config/phpstan/static-reflection.neon';
$additionalConfigFiles[] = __DIR__ . '/../../../config/phpstan/better-infer.neon';
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'a6532a2f295056321924f67b110e79411b95aa50';
public const PACKAGE_VERSION = '41de61755c1f982ec554b6037a724abe708bfa27';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-08-16 18:11:20';
public const RELEASE_DATE = '2023-08-16 23:46:58';
/**
* @var int
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Configuration/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ final class Option
* @internal Use @see \Rector\Config\RectorConfig::phpstanConfig() instead
* @var string
*/
public const PHPSTAN_FOR_RECTOR_PATH = 'phpstan_for_rector_path';
public const PHPSTAN_FOR_RECTOR_PATHS = 'phpstan_for_rector_paths';
/**
* @var string
*/
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInitefab334373889163798290c927ac1463::getLoader();
return ComposerAutoloaderInita98ab5d27d114088f46189c43c1c70f3::getLoader();
10 changes: 5 additions & 5 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInitefab334373889163798290c927ac1463
class ComposerAutoloaderInita98ab5d27d114088f46189c43c1c70f3
{
private static $loader;

Expand All @@ -22,17 +22,17 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInitefab334373889163798290c927ac1463', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInita98ab5d27d114088f46189c43c1c70f3', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitefab334373889163798290c927ac1463', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInita98ab5d27d114088f46189c43c1c70f3', 'loadClassLoader'));

require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitefab334373889163798290c927ac1463::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInita98ab5d27d114088f46189c43c1c70f3::getInitializer($loader));

$loader->setClassMapAuthoritative(true);
$loader->register(true);

$filesToLoad = \Composer\Autoload\ComposerStaticInitefab334373889163798290c927ac1463::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInita98ab5d27d114088f46189c43c1c70f3::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInitefab334373889163798290c927ac1463
class ComposerStaticInita98ab5d27d114088f46189c43c1c70f3
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
Expand Down Expand Up @@ -2637,9 +2637,9 @@ class ComposerStaticInitefab334373889163798290c927ac1463
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitefab334373889163798290c927ac1463::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitefab334373889163798290c927ac1463::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitefab334373889163798290c927ac1463::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInita98ab5d27d114088f46189c43c1c70f3::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInita98ab5d27d114088f46189c43c1c70f3::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInita98ab5d27d114088f46189c43c1c70f3::$classMap;

}, null, ClassLoader::class);
}
Expand Down

0 comments on commit 1f6016e

Please sign in to comment.