Skip to content

Commit

Permalink
[DX] Detach typo3 from core to allow stable growth of both packages (#…
Browse files Browse the repository at this point in the history
…2446)

* remove old init command docs

* detach typo3 from core, for very specific domain and many direct BC breaks from rector

* cleanup scoper

* remove downgrade of enum package, as not used anymore

* remove non-existing directory
  • Loading branch information
TomasVotruba committed Jun 6, 2022
1 parent 0eba231 commit bd0104d
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 138 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_scoped_rector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
php-version: 7.2
coverage: none
- run: composer global require php-parallel-lint/php-parallel-lint
- run: /home/runner/.composer/vendor/bin/parallel-lint rector-prefixed-downgraded --exclude rector-prefixed-downgraded/stubs --exclude rector-prefixed-downgraded/vendor/tracy/tracy/examples --exclude rector-prefixed-downgraded/vendor/ssch/typo3-rector/templates/maker --exclude rector-prefixed-downgraded/vendor/rector/rector-generator/templates --exclude rector-prefixed-downgraded/vendor/symfony/contracts/Cache --exclude rector-prefixed-downgraded/vendor/symfony/contracts/HttpClient/Test
- run: /home/runner/.composer/vendor/bin/parallel-lint rector-prefixed-downgraded --exclude rector-prefixed-downgraded/stubs --exclude rector-prefixed-downgraded/vendor/tracy/tracy/examples --exclude rector-prefixed-downgraded/vendor/rector/rector-generator/templates --exclude rector-prefixed-downgraded/vendor/symfony/contracts/Cache --exclude rector-prefixed-downgraded/vendor/symfony/contracts/HttpClient/Test

# 5. copy repository meta files
- run: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/packages_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
- rectorphp/rector-nette
- rectorphp/rector-cakephp
- rectorphp/rector-phpoffice
- sabbelasichon/typo3-rector

steps:
# see https://github.com/actions/checkout#usage
Expand Down
6 changes: 0 additions & 6 deletions build/config/config-downgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ final class DowngradeRectorConfig
// symfony test are parts of package
'*/Test/*',

// only for dev
'packages/Testing/PhpConfigPrinter/*',

// Individual classes that can be excluded because
// they are not used by Rector, and they use classes
// loaded with "require-dev" so it'd throw an error
Expand All @@ -46,10 +43,7 @@ final class DowngradeRectorConfig
'vendor/cweagans/*',
// Rector doesn't use it, so we simply skip downgrading this class
'vendor/symfony/contracts/Cache/*',
// depends on PHPUnit, that is only in dev deps
'vendor/myclabs/php-enum/src/PHPUnit/Comparator.php',

'vendor/rector/rector-generator/templates',
'vendor/ssch/typo3-rector/config',
];
}
2 changes: 1 addition & 1 deletion build/target-repository/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Rector instantly upgrades and refactors the PHP code of your application. It ca

### 1. Instant Upgrades

Rector now supports upgrades from PHP 5.3 to 8.1 and major open-source projects like [Symfony](https://github.com/rectorphp/rector-symfony), [PHPUnit](https://github.com/rectorphp/rector-phpunit), [Nette](https://github.com/rectorphp/rector-nette), [Laravel](https://github.com/rectorphp/rector-laravel), [CakePHP](https://github.com/rectorphp/rector-cakephp), [Doctrine](https://github.com/rectorphp/rector-doctrine) and [TYPO3](https://github.com/sabbelasichon/typo3-rector) out of the box. Do you want to **be constantly on the latest PHP and Framework without effort**?
Rector now supports upgrades from PHP 5.3 to 8.1 and major open-source projects like [Symfony](https://github.com/rectorphp/rector-symfony), [PHPUnit](https://github.com/rectorphp/rector-phpunit), [Nette](https://github.com/rectorphp/rector-nette), [Laravel](https://github.com/rectorphp/rector-laravel), [CakePHP](https://github.com/rectorphp/rector-cakephp) and [Doctrine](https://github.com/rectorphp/rector-doctrine). Do you want to **be constantly on the latest PHP and Framework without effort**?

Use Rector to handle **instant upgrades** for you.

Expand Down
93 changes: 0 additions & 93 deletions build/target-repository/docs/init_command.md

This file was deleted.

1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"rector/rector-phpunit": "dev-main",
"rector/rector-symfony": "dev-main",
"sebastian/diff": "^4.0.4",
"ssch/typo3-rector": "dev-main",
"symfony/console": "6.1.*",
"symfony/contracts": "3.1.*",
"symfony/dependency-injection": "6.1.*",
Expand Down
7 changes: 0 additions & 7 deletions dev-docs/packages_ci_status.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@
* ![](https://github.com/rectorphp/rector-doctrine/actions/workflows/tests.yaml/badge.svg)
* ![](https://github.com/rectorphp/rector-doctrine/actions/workflows/code_analysis.yaml/badge.svg)

## Typo3

* https://github.com/sabbelasichon/typo3-rector
* ![](https://github.com/sabbelasichon/typo3-rector/actions/workflows/tests.yaml/badge.svg)
* ![](https://github.com/sabbelasichon/typo3-rector/actions/workflows/phpstan.yaml/badge.svg)
* ![](https://github.com/sabbelasichon/typo3-rector/actions/workflows/rector.yaml/badge.svg)

## PHP Office

* https://github.com/rectorphp/rector-phpoffice
Expand Down
2 changes: 1 addition & 1 deletion full_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ sh build/build-rector-scoped.sh rector-build rector-prefixed-downgraded

# verify syntax valid in php 7.2
composer global require php-parallel-lint/php-parallel-lint
~/.composer/vendor/bin/parallel-lint rector-prefixed-downgraded --exclude rector-prefixed-downgraded/stubs --exclude rector-prefixed-downgraded/vendor/tracy/tracy/examples --exclude rector-prefixed-downgraded/vendor/ssch/typo3-rector/templates/maker --exclude rector-prefixed-downgraded/vendor/rector/rector-generator/templates --exclude rector-prefixed-downgraded/vendor/symfony/contracts/Cache --exclude rector-prefixed-downgraded/vendor/symfony/contracts/HttpClient/Test
~/.composer/vendor/bin/parallel-lint rector-prefixed-downgraded --exclude rector-prefixed-downgraded/stubs --exclude rector-prefixed-downgraded/vendor/tracy/tracy/examples --exclude rector-prefixed-downgraded/vendor/rector/rector-generator/templates --exclude rector-prefixed-downgraded/vendor/symfony/contracts/Cache --exclude rector-prefixed-downgraded/vendor/symfony/contracts/HttpClient/Test

# Check php 7.2 can be used locally with PHP72_BIN_PATH env
# rector-prefixed-downgraded check
Expand Down
24 changes: 1 addition & 23 deletions scoper.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,6 @@ function (string $filePath, string $prefix, string $content): string {
'Symplify\SmartFileSystem\SmartFileInfo'
),

// unprefixed Statement
fn (string $filePath, string $prefix, string $content): string => Strings::replace(
$content,
'#' . $prefix . '\\\\Helmich\\\\TypoScriptParser\\\\Parser\\\\AST\\\\Statement#',
'Helmich\TypoScriptParser\Parser\AST\Statement'
),

// unprefixed Traverser
fn (string $filePath, string $prefix, string $content): string => Strings::replace(
$content,
'#' . $prefix . '\\\\Helmich\\\\TypoScriptParser\\\\Parser\\\\Traverser\\\\Traverser#',
'Helmich\TypoScriptParser\Parser\Traverser\Traverser'
),

// unprefixed PHPUnit IsEqual
fn (string $filePath, string $prefix, string $content): string => Strings::replace(
$content,
Expand Down Expand Up @@ -183,10 +169,7 @@ function (string $filePath, string $prefix, string $content): string {
// unprefix string classes, as they're string on purpose - they have to be checked in original form, not prefixed
function (string $filePath, string $prefix, string $content): string {
// skip vendor, expect rector packages
if (\str_contains($filePath, 'vendor/') && ! \str_contains($filePath, 'vendor/rector') && ! \str_contains(
$filePath,
'vendor/ssch/typo3-rector'
)) {
if (\str_contains($filePath, 'vendor/') && ! \str_contains($filePath, 'vendor/rector')) {
return $content;
}

Expand All @@ -210,11 +193,6 @@ function (string $filePath, string $prefix, string $content): string {
return $content;
}

// skip "Ssch\\" namespace
if (\str_contains($content, '$services->load(\'Ssch')) {
return $content;
}

return Strings::replace($content, '#services\->load\(\'#', "services->load('" . $prefix . '\\');
},

Expand Down
4 changes: 0 additions & 4 deletions utils/compiler/src/PhpScoper/StaticEasyPrefixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ final class StaticEasyPrefixer
'Symplify\SmartFileSystem\SmartFileInfo',
// for ComposerJson because it is part of the public API. I.e. ComposerRectorInterface
'Symplify\ComposerJsonManipulator\ValueObject\ComposerJson',
// for usage in Helmich\TypoScriptParser\Parser\Traverser\Visitor
'Helmich\TypoScriptParser\Parser\AST\Statement',
'Helmich\TypoScriptParser\Parser\Traverser\Traverser',
// for usage in packages/Testing/PHPUnit/PlatformAgnosticAssertions.php
'PHPUnit\Framework\Constraint\IsEqual',
];
Expand All @@ -31,7 +28,6 @@ final class StaticEasyPrefixer
'Rector\*',
// we use this API a lot
'PhpParser\*',
'Ssch\TYPO3Rector\*',

// phpstan needs to be here, as phpstan/vendor autoload is statically generated and namespaces cannot be changed
'PHPStan\*',
Expand Down

0 comments on commit bd0104d

Please sign in to comment.