mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-01 17:00:51 +00:00
[downgrade] remove extra configs, unite parameters (#5861)
This commit is contained in:
parent
e0158925cd
commit
c1c6c9aaf2
104
.github/inactive_workflows/build_php71.yaml
vendored
104
.github/inactive_workflows/build_php71.yaml
vendored
|
@ -1,104 +0,0 @@
|
|||
name: Rector Run
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
downgrade_php71:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
# see https://github.com/shivammathur/setup-php
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 7.4
|
||||
coverage: none
|
||||
|
||||
# The Symfony Polyfill libraries are needed
|
||||
- run: composer require symfony/polyfill-php72 symfony/polyfill-php73 symfony/polyfill-php74 symfony/polyfill-php80 --no-install --no-update
|
||||
|
||||
# Execute the downgrade script
|
||||
- run: ./build/downgrade/downgrade_packages.sh 7.1
|
||||
|
||||
# Upload the artifact so we can download and review the downgraded code
|
||||
- run: mkdir build
|
||||
- uses: montudor/action-zip@v0.1.1
|
||||
with:
|
||||
args: zip -X -r build/rector-php71.zip . -x *.git* .* "*/\.*" build** ci** tests** "**/tests**"
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: rector-downgraded-code
|
||||
path: build/rector-php71.zip
|
||||
|
||||
# Run all the tests on PHP 7.4 (because JUnit needs PHP 7.3+),
|
||||
# but using Rector downgraded to PHP 7.1
|
||||
- run: vendor/bin/phpunit
|
||||
|
||||
# Avoid Composer v2 platform checks (composer.json requires PHP 7.3+, but below we are running 7.1)
|
||||
- run: composer config platform-check false
|
||||
# Regenerating the autoload files will remove vendor/composer/platform_check.php, otherwise executing bin/rector on 7.1 fails
|
||||
- run: composer dumpautoload
|
||||
|
||||
- run: composer install
|
||||
|
||||
# Replace the composer.json file
|
||||
- run: cp ci/downgrade/composer.json.after ./composer.json
|
||||
|
||||
# Rector without DEV needs phpstan.neon removed
|
||||
- run: rm phpstan.neon
|
||||
- run: rm phpstan-for-rector.neon
|
||||
|
||||
# Override the artifact with downgraded Composer too
|
||||
- run: rm build/rector-php71.zip
|
||||
- uses: montudor/action-zip@v0.1.1
|
||||
with:
|
||||
args: zip -X -r build/rector-php71.zip . -x *.git* .* "*/\.*" build**
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: rector-downgraded-code
|
||||
path: build/rector-php71.zip
|
||||
|
||||
# Switch to PHP 7.1 and run PHPStan to analyze the code,
|
||||
# as to make sure no 7.2+ code was left behind (if there is, PHP will throw some error)
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 7.1
|
||||
coverage: none
|
||||
|
||||
# Test the downgraded Rector by running the default set on its own src
|
||||
- run: bin/rector process rules/downgrade-php70/src
|
||||
|
||||
# Run PHPStan to make sure no PHP 7.2+ code was left behind
|
||||
- run: vendor/bin/phpstan analyse -c ci/downgrade/phpstan.neon --ansi
|
||||
|
||||
# If we reach here the downgrade works! Then, deploy it to its own repo
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 7.4
|
||||
coverage: none
|
||||
|
||||
# Copy all files for the target repo to rector-downgrade/
|
||||
# Remove the artifact
|
||||
- run: rm build/rector-php71.zip
|
||||
- run: rm -R build
|
||||
# Copy all files
|
||||
- run: rsync -av * rector-downgrade --quiet
|
||||
# Set-up own workflows for target repo
|
||||
- run: cp -R ci/downgrade/target-repo/. rector-downgrade/
|
||||
|
||||
# publish it to remote repository
|
||||
-
|
||||
uses: symplify/github-action-monorepo-split@1.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
with:
|
||||
package-directory: 'rector-downgrade'
|
||||
split-repository-organization: 'rectorphp'
|
||||
split-repository-name: 'rector-php71'
|
||||
user-name: "kaizen-ci"
|
||||
user-email: "info@kaizen-ci.org"
|
|
@ -1,23 +0,0 @@
|
|||
name: Tests Lowest Dependencies
|
||||
|
||||
on:
|
||||
pull_request: null
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
test_lowest_dependencies:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: git fetch --depth=100000 origin
|
||||
|
||||
# see https://github.com/shivammathur/setup-php
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 7.3
|
||||
coverage: none
|
||||
|
||||
- run: composer update --no-progress --ansi --prefer-lowest
|
||||
- run: vendor/bin/phpunit
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::DEPENDENCY_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_80,
|
||||
DowngradeSetList::PHP_74,
|
||||
DowngradeSetList::PHP_73,
|
||||
DowngradeSetList::PHP_72,
|
||||
DowngradeSetList::PHP_71,
|
||||
]);
|
||||
};
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::DEPENDENCY_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_80,
|
||||
DowngradeSetList::PHP_74,
|
||||
DowngradeSetList::PHP_73,
|
||||
DowngradeSetList::PHP_72,
|
||||
]);
|
||||
};
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::DEPENDENCY_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_80,
|
||||
DowngradeSetList::PHP_74,
|
||||
DowngradeSetList::PHP_73,
|
||||
]);
|
||||
};
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::DEPENDENCY_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_80,
|
||||
DowngradeSetList::PHP_74,
|
||||
]);
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::DEPENDENCY_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_80,
|
||||
]);
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::DEPENDENCY_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_71,
|
||||
]);
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::DEPENDENCY_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_72,
|
||||
]);
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::DEPENDENCY_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_73,
|
||||
]);
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::DEPENDENCY_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_74,
|
||||
]);
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::DEPENDENCY_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_80,
|
||||
]);
|
||||
};
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::RECTOR_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_80,
|
||||
DowngradeSetList::PHP_74,
|
||||
DowngradeSetList::PHP_73,
|
||||
DowngradeSetList::PHP_72,
|
||||
DowngradeSetList::PHP_71,
|
||||
]);
|
||||
};
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::RECTOR_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_80,
|
||||
DowngradeSetList::PHP_74,
|
||||
DowngradeSetList::PHP_73,
|
||||
DowngradeSetList::PHP_72,
|
||||
]);
|
||||
};
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::RECTOR_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_80,
|
||||
DowngradeSetList::PHP_74,
|
||||
DowngradeSetList::PHP_73,
|
||||
]);
|
||||
};
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::RECTOR_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_80,
|
||||
DowngradeSetList::PHP_74,
|
||||
]);
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::RECTOR_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_80,
|
||||
]);
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::RECTOR_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_71,
|
||||
]);
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::RECTOR_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_72,
|
||||
]);
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::RECTOR_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_73,
|
||||
]);
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::RECTOR_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_74,
|
||||
]);
|
||||
};
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Set\ValueObject\DowngradeSetList;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
require_once __DIR__ . '/configuration.php';
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::SKIP, DowngradeRectorConfig::RECTOR_EXCLUDE_PATHS);
|
||||
|
||||
$parameters->set(Option::SETS, [
|
||||
DowngradeSetList::PHP_80,
|
||||
]);
|
||||
};
|
|
@ -1,78 +0,0 @@
|
|||
<?php
|
||||
|
||||
// handy script for fast local operations
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Nette\Utils\Strings;
|
||||
use Symplify\SmartFileSystem\FileSystemFilter;
|
||||
use Symplify\SmartFileSystem\Finder\FinderSanitizer;
|
||||
use Symplify\SmartFileSystem\Finder\SmartFinder;
|
||||
use Symplify\SmartFileSystem\SmartFileInfo;
|
||||
use Symplify\SmartFileSystem\SmartFileSystem;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// USE ↓
|
||||
|
||||
$fileRenamer = new FileRenamer();
|
||||
$fileRenamer->rename(
|
||||
// paths
|
||||
[__DIR__ . '/../utils'],
|
||||
'*.php.inc',
|
||||
'#(\.php\.inc)$#',
|
||||
'.php'
|
||||
);
|
||||
|
||||
// CODE ↓
|
||||
|
||||
final class FileRenamer
|
||||
{
|
||||
/**
|
||||
* @var SmartFinder
|
||||
*/
|
||||
private $smartFinder;
|
||||
|
||||
/**
|
||||
* @var SmartFileSystem
|
||||
*/
|
||||
private $smartFileSystem;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->smartFinder = new SmartFinder(new FinderSanitizer(), new FileSystemFilter()); ;
|
||||
$this->smartFileSystem = new SmartFileSystem();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $sources
|
||||
*/
|
||||
public function rename(array $sources, string $suffix, string $matchingRegex, string $replacement)
|
||||
{
|
||||
Assert::allString($sources);
|
||||
Assert::allFileExists($sources);
|
||||
|
||||
$fileInfos = $this->smartFinder->find($sources, $suffix);
|
||||
|
||||
$this->renameFileInfos($fileInfos, $matchingRegex, $replacement);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SmartFileInfo[] $fileInfos
|
||||
*/
|
||||
private function renameFileInfos(array $fileInfos, string $matchingRegex, string $replacement): void
|
||||
{
|
||||
foreach ($fileInfos as $fileInfo) {
|
||||
// do the rename
|
||||
$oldRealPath = $fileInfo->getRealPath();
|
||||
$newRealPath = Strings::replace($oldRealPath, $matchingRegex, $replacement);
|
||||
|
||||
if ($oldRealPath === $newRealPath) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->smartFileSystem->rename($oldRealPath, $newRealPath);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -48,16 +48,16 @@
|
|||
"symfony/http-kernel": "^4.4.8|^5.1",
|
||||
"symfony/process": "^4.4.8|^5.1",
|
||||
"symfony/uid": "^4.4.8|^5.1",
|
||||
"symplify/astral": "^9.2.4",
|
||||
"symplify/autowire-array-parameter": "^9.2.4",
|
||||
"symplify/console-color-diff": "^9.2.4",
|
||||
"symplify/package-builder": "^9.2.4",
|
||||
"symplify/rule-doc-generator": "^9.2.4",
|
||||
"symplify/set-config-resolver": "^9.2.4",
|
||||
"symplify/simple-php-doc-parser": "^9.2.4",
|
||||
"symplify/skipper": "^9.2.4",
|
||||
"symplify/smart-file-system": "^9.2.4",
|
||||
"symplify/symfony-php-config": "^9.2.4",
|
||||
"symplify/astral": "^9.2.11",
|
||||
"symplify/autowire-array-parameter": "^9.2.11",
|
||||
"symplify/console-color-diff": "^9.2.11",
|
||||
"symplify/package-builder": "^9.2.11",
|
||||
"symplify/rule-doc-generator": "^9.2.11",
|
||||
"symplify/set-config-resolver": "^9.2.11",
|
||||
"symplify/simple-php-doc-parser": "^9.2.11",
|
||||
"symplify/skipper": "^9.2.11",
|
||||
"symplify/smart-file-system": "^9.2.11",
|
||||
"symplify/symfony-php-config": "^9.2.11",
|
||||
"webmozart/assert": "^1.10"
|
||||
},
|
||||
"require-dev": {
|
||||
|
@ -71,12 +71,12 @@
|
|||
"rector/rector-generator": "^0.1.1",
|
||||
"symfony/security-core": "^5.2",
|
||||
"symfony/security-http": "^5.2",
|
||||
"symplify/coding-standard": "^9.2.4",
|
||||
"symplify/easy-ci": "^9.2.4",
|
||||
"symplify/easy-coding-standard": "^9.2.4",
|
||||
"symplify/easy-testing": "^9.2.4",
|
||||
"symplify/phpstan-extensions": "^9.2.4",
|
||||
"symplify/phpstan-rules": "^9.2.4",
|
||||
"symplify/coding-standard": "^9.2.11",
|
||||
"symplify/easy-ci": "^9.2.11",
|
||||
"symplify/easy-coding-standard": "^9.2.11",
|
||||
"symplify/easy-testing": "^9.2.11",
|
||||
"symplify/phpstan-extensions": "^9.2.11",
|
||||
"symplify/phpstan-rules": "^9.2.11",
|
||||
"tracy/tracy": "^2.8"
|
||||
},
|
||||
"replace": {
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\ValueObject\ProjectType;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
|
@ -12,22 +10,4 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$containerConfigurator->import(__DIR__ . '/services-rules.php');
|
||||
$containerConfigurator->import(__DIR__ . '/parameters.php');
|
||||
$containerConfigurator->import(__DIR__ . '/../utils/*/config/config.php', null, true);
|
||||
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::PATHS, []);
|
||||
|
||||
$parameters->set(Option::FILE_EXTENSIONS, ['php']);
|
||||
|
||||
$parameters->set(Option::AUTOLOAD_PATHS, []);
|
||||
|
||||
$parameters->set(Option::AUTO_IMPORT_NAMES, false);
|
||||
$parameters->set(Option::IMPORT_SHORT_CLASSES, true);
|
||||
$parameters->set(Option::IMPORT_DOC_BLOCKS, true);
|
||||
|
||||
$parameters->set(Option::PHP_VERSION_FEATURES, null);
|
||||
|
||||
$parameters->set(Option::PROJECT_TYPE, ProjectType::PROPRIETARY);
|
||||
$parameters->set(Option::NESTED_CHAIN_METHOD_CALL_LIMIT, 30);
|
||||
$parameters->set(Option::SKIP, []);
|
||||
};
|
||||
|
|
|
@ -3,12 +3,30 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\ValueObject\ProjectType;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
|
||||
$parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, getcwd() . '/phpstan-for-rector.neon');
|
||||
|
||||
// paths and extensions
|
||||
$parameters->set(Option::PATHS, []);
|
||||
$parameters->set(Option::FILE_EXTENSIONS, ['php']);
|
||||
$parameters->set(Option::AUTOLOAD_PATHS, []);
|
||||
|
||||
// FQN class importing
|
||||
$parameters->set(Option::AUTO_IMPORT_NAMES, false);
|
||||
$parameters->set(Option::IMPORT_SHORT_CLASSES, true);
|
||||
$parameters->set(Option::IMPORT_DOC_BLOCKS, true);
|
||||
|
||||
$parameters->set(Option::PHP_VERSION_FEATURES, null);
|
||||
$parameters->set(Option::PROJECT_TYPE, ProjectType::PROPRIETARY);
|
||||
$parameters->set(Option::NESTED_CHAIN_METHOD_CALL_LIMIT, 30);
|
||||
$parameters->set(Option::SKIP, []);
|
||||
|
||||
// cache
|
||||
$parameters->set(Option::ENABLE_CACHE, false);
|
||||
$parameters->set(Option::CACHE_DIR, sys_get_temp_dir() . '/rector_cached_files');
|
||||
$parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, getcwd() . '/phpstan-for-rector.neon');
|
||||
};
|
||||
|
|
|
@ -2,10 +2,15 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Core\ValueObject\PhpVersion;
|
||||
use Rector\DowngradePhp70\Rector\FunctionLike\DowngradeTypeDeclarationRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_56);
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(DowngradeTypeDeclarationRector::class);
|
||||
};
|
||||
|
|
|
@ -13,13 +13,12 @@ use Rector\DowngradePhp71\Rector\TryCatch\DowngradePipeToMultiCatchExceptionRect
|
|||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(DowngradeNullableTypeDeclarationRector::class);
|
||||
$services->set(DowngradeVoidTypeDeclarationRector::class);
|
||||
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_70);
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(DowngradeNullableTypeDeclarationRector::class);
|
||||
$services->set(DowngradeVoidTypeDeclarationRector::class);
|
||||
$services->set(DowngradeClassConstantVisibilityRector::class);
|
||||
$services->set(DowngradePipeToMultiCatchExceptionRector::class);
|
||||
$services->set(SymmetricArrayDestructuringToListRector::class);
|
||||
|
|
|
@ -9,11 +9,10 @@ use Rector\DowngradePhp72\Rector\FunctionLike\DowngradeObjectTypeDeclarationRect
|
|||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(DowngradeObjectTypeDeclarationRector::class);
|
||||
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_71);
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(DowngradeObjectTypeDeclarationRector::class);
|
||||
$services->set(DowngradeParameterTypeWideningRector::class);
|
||||
};
|
||||
|
|
|
@ -11,13 +11,12 @@ use Rector\DowngradePhp73\Rector\String_\DowngradeFlexibleHeredocSyntaxRector;
|
|||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(DowngradeFlexibleHeredocSyntaxRector::class);
|
||||
$services->set(DowngradeListReferenceAssignmentRector::class);
|
||||
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_72);
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(DowngradeFlexibleHeredocSyntaxRector::class);
|
||||
$services->set(DowngradeListReferenceAssignmentRector::class);
|
||||
$services->set(DowngradeTrailingCommasInFunctionCallsRector::class);
|
||||
$services->set(SetCookieOptionsArrayToArgumentsRector::class);
|
||||
};
|
||||
|
|
|
@ -18,6 +18,9 @@ use Rector\DowngradePhp74\Rector\Property\DowngradeTypedPropertyRector;
|
|||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_73);
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(DowngradeTypedPropertyRector::class);
|
||||
$services->set(ArrowFunctionToAnonymousFunctionRector::class);
|
||||
|
@ -28,10 +31,6 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services->set(DowngradeStripTagsCallWithArrayRector::class);
|
||||
$services->set(DowngradeArraySpreadRector::class);
|
||||
$services->set(DowngradeArrayMergeCallWithoutArgumentsRector::class);
|
||||
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_73);
|
||||
|
||||
$services->set(DowngradeFreadFwriteFalsyToNegationRector::class);
|
||||
$services->set(DowngradeSelfTypeDeclarationRector::class);
|
||||
};
|
||||
|
|
|
@ -17,15 +17,14 @@ use Rector\DowngradePhp80\Rector\Property\DowngradeUnionTypeTypedPropertyRector;
|
|||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_74);
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
$services->set(DowngradeUnionTypeTypedPropertyRector::class);
|
||||
$services->set(DowngradeUnionTypeDeclarationRector::class);
|
||||
$services->set(DowngradeMixedTypeDeclarationRector::class);
|
||||
$services->set(DowngradeStaticTypeDeclarationRector::class);
|
||||
|
||||
$parameters = $containerConfigurator->parameters();
|
||||
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_74);
|
||||
|
||||
$services->set(DowngradePropertyPromotionRector::class);
|
||||
$services->set(DowngradeNonCapturingCatchesRector::class);
|
||||
$services->set(DowngradeMatchToSwitchRector::class);
|
||||
|
|
|
@ -75,14 +75,19 @@ CODE_SAMPLE
|
|||
/** @var string $includeValue */
|
||||
$includeValue = $this->valueResolver->getValue($node->expr);
|
||||
|
||||
// skip phar and absolute paths
|
||||
if (Strings::startsWith($includeValue, 'phar://') || Strings::startsWith($includeValue, '/')) {
|
||||
// skip phar
|
||||
if (Strings::startsWith($includeValue, 'phar://')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// skip absolute paths
|
||||
if (Strings::startsWith($includeValue, '/')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// add preslash to string
|
||||
if (Strings::startsWith($includeValue, './')) {
|
||||
$node->expr->value = substr($includeValue, 1);
|
||||
$node->expr->value = Strings::substring($includeValue, 1);
|
||||
} else {
|
||||
$node->expr->value = '/' . $includeValue;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ use PhpParser\Node\Stmt\ClassMethod;
|
|||
use PhpParser\Node\UnionType;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Reflection\Php\PhpMethodReflection;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger;
|
||||
|
@ -185,6 +186,10 @@ CODE_SAMPLE
|
|||
$classMethodScope = $classMethod->getAttribute(AttributeKey::SCOPE);
|
||||
$parameterMethodReflection = $parentClassAndInterface->getMethod($methodName, $classMethodScope);
|
||||
|
||||
if (! $parameterMethodReflection instanceof PhpMethodReflection) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/** @var Type $parentReturnType */
|
||||
$parentReturnType = $this->privatesCaller->callPrivateMethod(
|
||||
$parameterMethodReflection,
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Symplify\SmartFileSystem\FileSystemFilter;
|
||||
use Symplify\SmartFileSystem\Finder\FinderSanitizer;
|
||||
use Symplify\SmartFileSystem\Finder\SmartFinder;
|
||||
use Symplify\SmartFileSystem\SmartFileSystem;
|
||||
|
||||
require __DIR__ . '/../../../vendor/autoload.php';
|
||||
|
||||
// @todo complete later..., maybe decoupled to symplify?
|
||||
// @todo normal commadn with arugment?
|
||||
// cleans all useless files
|
||||
$smartFinder = new SmartFinder(new FinderSanitizer(), new FileSystemFilter());
|
||||
$sartFileSystem = new SmartFileSystem();
|
||||
|
||||
$fileInfos = $smartFinder->find([
|
||||
__DIR__ . '/../../../packages',
|
||||
__DIR__ . '/../../../src',
|
||||
__DIR__ . '/../../../rules',
|
||||
__DIR__ . '/../../../tests',
|
||||
], '#.(\.php\.inc|Test\.php)$#');
|
||||
|
||||
echo sprintf('Found %d files to be deleted', count($fileInfos));
|
||||
|
||||
foreach ($fileInfos as $fileInfo) {
|
||||
echo $fileInfo->getRelativeFilePathFromCwd() . PHP_EOL;
|
||||
}
|
||||
|
||||
$sartFileSystem->remove($fileInfos);
|
Loading…
Reference in New Issue
Block a user