Releases: rectorphp/rector
Releases · rectorphp/rector
0.8.46
Summary release for last 2 weeks, since 0.8.28
- See full diff: 0.8.28...0.8.46
New Features 🎉
- [#4490] [EarlyReturn] Brand new set
- [#4517] [Doctrine] Add a Doctrine DBAL 2.11 set, Thanks @chrisguitarguy
- [#4526] [CakePHP] Started ruleset for CakePHP 4.2, Thanks @markstory
- [#4468] [CodeQuality] Added
NewStaticToNewSelfRector
- [#4442] [DoctrineCodeQuality] Added
ImproveDoctrineCollectionDocTypeInEntityRector
- [#4471] [Restoratoin] Added
InferParamFromClassMethodReturnRector
- [#4457] [CodeQualityString] Added
MoveOutMethodCallInsideIfConditionRector
, Thanks @samsonasik - [#4489] [Performance] Add
CountArrayToEmptyArrayComparisonRector
, Thanks @samsonasik - [#4515] [Nette] Add
RemoveParentAndNameFromComponentConstructorRector
Changes ⌚
AbstractFileSystemRector
was dropped and replaced byFileNode
, this was a crappy part of Rector, that split node-based refatoring and file-based; now the logic is simplified to essential code, and to workwith file, we can useFileNode
- [#4510] [TypeDeclaration] We switched types from string
"int"
fully to @phpstan typesnew IntegerType()
- [#4513] Composer v2 was released, so we put it right into our GitHub Actions CI and cut install time to 50 %
Removed 🧹
- [#4451] [DynamicTypedAnalysis] Very narrow package with lack of practise didn't get any feedback. As unfinished and better suitable for tombstoning, this part was dropped to keep Rector's focus on automated refactoring
- [#4521] [Decouple] This had only 1 rule, it was hard to configure and use - the set was dropped, better use PHPStorm for local refactoring
They Write about Rector
- @freekmurze made practical 4-min video about upgrading to PHP 8
0.8.28
This is first release note list, so we included changes from the last month.
- See full diff: v0.8.7...0.8.28
New Features 🎉
Do you want to run Rector only on changed files?
# rector.php
use Rector\Core\Configuration\Option;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::ENABLE_CACHE, true);
};
- [#4311] Add
init
command, so you can createrector.php
config
vendor/bin/rector init
# "rector.php" created
- [#4336] [Restoration] Add
RestoreFullyQualifiedNameRector
to restore accidentaly shortened class names
-public \SomeClass $someProperty;
+public \App\Full\SomeClass $someProperty;
- [#4341] [Symfony] Add
AutoWireWithClassNameSuffixForMethodWithRequiredAnnotationRector
for class method names with@require
annotation, Thanks @samsonasik
- [#4348] [PHP 8.0] Add @required annotation to #[Required] attribute from Symfony 5.2
- [#4350] [PHP 8.0] Add @route annotation to #[Route] attribute in Symfony 5.2
- [#4391] [SimplePhpDocParser] Decoupled first split package - https://github.com/rectorphp/simple-php-doc-parser, can be installed as
composer require rector/simple-php-doc-parser
class SomeClass
{
public function canDrive(Car $car)
{
- if ($car->hasWheels && $car->hasFuel) {
- return true;
+ if (!$car->hasWheels) {
+ return false;
}
- return false;
+ if (!$car->hasFuel) {
+ return false;
+ }
+
+ return true;
}
}