Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ private function cleanCastedExpr(Expr $expr): Expr

private function hasCallLikeInAssignExpr(Expr $expr): bool
{
return (bool) $this->betterNodeFinder->findFirst(
$expr,
$this->sideEffectNodeDetector->detectCallExpr(...)
);
return (bool) $this->betterNodeFinder->findFirst($expr, $this->sideEffectNodeDetector->detectCallExpr(...));
}

/**
Expand Down
5 changes: 1 addition & 4 deletions rules/DeadCode/SideEffect/SideEffectNodeDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ public function detect(Expr $expr): bool
return true;
}

return (bool) $this->betterNodeFinder->findFirst(
$expr,
$this->detectCallExpr(...)
);
return (bool) $this->betterNodeFinder->findFirst($expr, $this->detectCallExpr(...));
}

public function detectCallExpr(Node $node): bool
Expand Down
21 changes: 9 additions & 12 deletions rules/Php74/Rector/Double/RealToFloatTypeCastRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@

namespace Rector\Php74\Rector\Double;

use Rector\Renaming\Rector\Cast\RenameCastRector;
use PhpParser\Node;
use PhpParser\Node\Expr\Cast\Double;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\Configuration\Deprecation\Contract\DeprecatedInterface;
use Rector\Exception\ShouldNotHappenException;
use Rector\Rector\AbstractRector;
use Rector\ValueObject\PhpVersionFeature;
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;

/**
* @see \Rector\Tests\Php74\Rector\Double\RealToFloatTypeCastRector\RealToFloatTypeCastRectorTest
* @deprecated Use same but configurable `Rector\Renaming\Rector\Cast\RenameCastRector` with configuration instead
*/
final class RealToFloatTypeCastRector extends AbstractRector implements MinPhpVersionInterface
final class RealToFloatTypeCastRector extends AbstractRector implements MinPhpVersionInterface, DeprecatedInterface
{
public function provideMinPhpVersion(): int
{
Expand Down Expand Up @@ -67,14 +69,9 @@ public function getNodeTypes(): array
*/
public function refactor(Node $node): ?Node
{
$kind = $node->getAttribute(AttributeKey::KIND);
if ($kind !== Double::KIND_REAL) {
return null;
}

$node->setAttribute(AttributeKey::KIND, Double::KIND_FLOAT);
$node->setAttribute(AttributeKey::ORIGINAL_NODE, null);

return $node;
throw new ShouldNotHappenException(sprintf(
'This rule is deprecated. Use configurable "%s" rule instead.',
RenameCastRector::class,
));
}
}
6 changes: 1 addition & 5 deletions src/Util/ArrayParametersMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ final class ArrayParametersMerger
public function merge(mixed $left, mixed $right): mixed
{
if (is_array($left) && is_array($right)) {
return $this->mergeLeftToRightWithCallable(
$left,
$right,
$this->merge(...)
);
return $this->mergeLeftToRightWithCallable($left, $right, $this->merge(...));
}

if ($left !== null) {
Expand Down