ReturnTypeFromStrictTypedPropertyRector

Add return method return type based on strict typed property

 final class SomeClass
 {
     private int $age = 100;

-    public function getAge()
+    public function getAge(): int
     {
         return $this->age;
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedPropertyRector;

return RectorConfig::configure()
    ->withRules([
        ReturnTypeFromStrictTypedPropertyRector::class,
    ]);