Skip to content

Commit

Permalink
do not rename property on property promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Feb 20, 2025
1 parent 8f99b2b commit de6fed3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Php80\Rector\Catch_\RemoveUnusedVariableInCatchRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;

Expand Down Expand Up @@ -41,4 +42,7 @@

MixedTypeRector::class,
])
->withPhpSets(php80: true);
->withPhpSets(php80: true)
->withConfiguredRule(ClassPropertyAssignToConstructorPromotionRector::class, [
ClassPropertyAssignToConstructorPromotionRector::RENAME_PROPERTY => false,
]);
10 changes: 8 additions & 2 deletions src/base/MemoizableArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
*/
class MemoizableArray implements IteratorAggregate, Countable
{
/**
* @var array Array elements
*/
private array $_elements;

/**
* @var callable|null Normalizer method
*/
Expand All @@ -52,12 +57,13 @@ class MemoizableArray implements IteratorAggregate, Countable
/**
* Constructor
*
* @param array $_elements The items to be memoized
* @param array $elements The items to be memoized
* @param callable|null $normalizer A method that the items should be normalized with when first returned by
* [[all()]] or [[firstWhere()]].
*/
public function __construct(private array $_elements, ?callable $normalizer = null)
public function __construct(array $elements, ?callable $normalizer = null)
{
$this->_elements = $elements;
$this->_normalizer = $normalizer;
}

Expand Down

0 comments on commit de6fed3

Please sign in to comment.