Find the best Rector rule to solve your problem
Replaces defined classes by new ones.
namespace App;
-use SomeOldClass;
+use SomeNewClass;
-function someFunction(SomeOldClass $someOldClass): SomeOldClass
+function someFunction(SomeNewClass $someOldClass): SomeNewClass
{
- if ($someOldClass instanceof SomeOldClass) {
- return new SomeOldClass;
+ if ($someOldClass instanceof SomeNewClass) {
+ return new SomeNewClass;
}
}
Make param/env use in #[Attribute] more precise
namespace App\Service;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
class MessageGenerator
{
public function __construct(
- #[Autowire('%kernel.debug%')]
+ #[Autowire(param: 'kernel.debug')]
bool $debugMode,
- #[Autowire('%env(SOME_ENV_VAR)%')]
+ #[Autowire(env: 'SOME_ENV_VAR')]
string $senderName,
) {
}
}
Return int or false from SignalableCommandInterface::handleSignal() instead of void
-public function handleSignal(int $signal): void
+public function handleSignal(int $signal): int|false
{
+ return false;
}