Bug Report
| Subject |
Details |
| Rector version |
v0.17.0 |
| laravel/framework |
v10.16.1 |
| laravel/socialite |
v5.8.0 |
| socialiteproviders/manager |
v4.3.0 |
AddParamTypeFromPropertyTypeRector does not respect inheritance.
When using SetList::TYPE_DECLARATION in a project that has classes extending those from 3rd parties,
Rector will attempt to add a type declaration to functions that extend from their parent, triggering a fatal error due to the signature mismatching.
Minimal PHP Code Causing Issue

Difficult to create a demo since this issue relies on a class being read-only.
However, the above screenshot was from the following (abbreviated) code
<?php
namespace App\Providers;
class XeroSocialiteProvider extends \SocialiteProviders\Manager\OAuth2\AbstractProvider
{
protected function getUserByToken($token)
{
//
}
}
Expected Behaviour
Rector should not add the string type to the param, as it breaks the change.
Or even better, Rector should inspect the inheritance chain to fix it if it has broken (eg, due to an upgrade).
Bug Report
AddParamTypeFromPropertyTypeRector does not respect inheritance.
When using
SetList::TYPE_DECLARATIONin a project that has classes extending those from 3rd parties,Rector will attempt to add a type declaration to functions that extend from their parent, triggering a fatal error due to the signature mismatching.
Minimal PHP Code Causing Issue
Difficult to create a demo since this issue relies on a class being read-only.
However, the above screenshot was from the following (abbreviated) code
Expected Behaviour
Rector should not add the
stringtype to the param, as it breaks the change.Or even better, Rector should inspect the inheritance chain to fix it if it has broken (eg, due to an upgrade).