Skip to content

Commit

Permalink
[PHP 8.0] Deprecate old UnionTypesRector that is dangerously moving d…
Browse files Browse the repository at this point in the history
…ocblocks, use type declaration rules instead (#3846)

Co-authored-by: GitHub Action <actions@github.com>
  • Loading branch information
TomasVotruba and actions-user committed May 14, 2023
1 parent 37f0942 commit ec61753
Show file tree
Hide file tree
Showing 43 changed files with 21 additions and 1,024 deletions.
4 changes: 0 additions & 4 deletions config/set/php80.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
declare(strict_types=1);

use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector;

use Rector\Arguments\Rector\FuncCall\FunctionArgumentDefaultValueReplacerRector;
use Rector\Arguments\ValueObject\ArgumentAdder;
use Rector\Arguments\ValueObject\ReplaceFuncCallArgumentDefaultValue;
Expand All @@ -21,7 +20,6 @@
use Rector\Php80\Rector\FuncCall\Php8ResourceReturnToObjectRector;
use Rector\Php80\Rector\FuncCall\TokenGetAllToObjectRector;
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
use Rector\Php80\Rector\FunctionLike\UnionTypesRector;
use Rector\Php80\Rector\Identical\StrEndsWithRector;
use Rector\Php80\Rector\Identical\StrStartsWithRector;
use Rector\Php80\Rector\NotIdentical\StrContainsRector;
Expand All @@ -32,8 +30,6 @@
use Rector\Transform\ValueObject\StaticCallToFuncCall;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(UnionTypesRector::class);

$rectorConfig->rule(StrContainsRector::class);
$rectorConfig->rule(StrStartsWithRector::class);
$rectorConfig->rule(StrEndsWithRector::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,6 @@ public function __construct(
) {
}

/**
* Includes non-vendor classes
*/
public function isSoftLocked(ClassMethod $classMethod): bool
{
if ($this->isVendorLocked($classMethod)) {
return true;
}

$classReflection = $this->reflectionResolver->resolveClassReflection($classMethod);
if (! $classReflection instanceof ClassReflection) {
return false;
}

/** @var string $methodName */
$methodName = $this->nodeNameResolver->getName($classMethod);
return $this->hasClassMethodLockMatchingFileName($classReflection, $methodName, '');
}

public function isVendorLocked(ClassMethod $classMethod): bool
{
if ($classMethod->isMagic()) {
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -794,3 +794,6 @@ parameters:
# make autoload of php-parser in rector first
- '#but class PhpParser\\Node\\Stmt\\Expression is not generic#'
- '#Parameter \#3 \$assign of method Rector\\CodeQuality\\Rector\\FunctionLike\\SimplifyUselessVariableRector\:\:processSimplifyUselessVariable\(\) expects PhpParser\\Node\\Expr\\Assign\|PhpParser\\Node\\Expr\\AssignOp, PhpParser\\Node\\Expr given#'

# deprecated
- '#Register "Rector\\Php80\\Rector\\FunctionLike\\UnionTypesRector" service to "php80\.php" config set#'

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit ec61753

Please sign in to comment.