Skip to content

Commit

Permalink
deprecated return/property type declarations that work with non-relia…
Browse files Browse the repository at this point in the history
…ble doblocks
  • Loading branch information
TomasVotruba committed Nov 27, 2022
1 parent 37ec50e commit f8b847f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions rules/Php74/Rector/Property/TypedPropertyRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
*
* @see \Rector\Tests\Php74\Rector\Property\TypedPropertyRector\TypedPropertyRectorTest
* @see \Rector\Tests\Php74\Rector\Property\TypedPropertyRector\ImportedTest
*
* @deprecated Moving doc types to type declarations is dangerous. Use specific strict types instead.
* This rule will be split info many small ones.
*/
final class TypedPropertyRector extends AbstractScopeAwareRector implements AllowEmptyConfigurableRectorInterface, MinPhpVersionInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
use PHPStan\Type\Type;
use Rector\TypeDeclaration\Contract\PriorityAwareInterface;

/**
* @deprecated These inferers are complex and work with non-reliable docblocks.
* Instead split them to specific rules that work with strict types.
*/
interface ReturnTypeInfererInterface extends PriorityAwareInterface
{
public function inferFunctionLike(FunctionLike $functionLike): Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function refactor(Node $node): ?Node
{
trigger_error(
'Use specific rules to infer params instead. This rule will was split info many small ones.',
E_WARNING
E_ERROR
);
sleep(3);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
* @changelog https://wiki.php.net/rfc/scalar_type_hints_v5
*
* @see \Rector\Tests\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector\ReturnTypeDeclarationRectorTest
*
* @deprecated Moving doc types to type declarations is dangerous. Use specific strict types instead.
* This rule will be split info many small ones.
*/
final class ReturnTypeDeclarationRector extends AbstractRector implements MinPhpVersionInterface
{
Expand Down

0 comments on commit f8b847f

Please sign in to comment.