mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-01 08:50:50 +00:00
[Php74] Skip mixed type on TypedPropertyRector on auto import enabled (#1798)
* Add failing test fixture for TypedPropertyRector # Failing Test for TypedPropertyRector Based on https://getrector.org/demo/1ec8a2b5-0221-6fc0-ae53-e3ff0cc295bf * mixed does not exists in php 7.4 mixed is not exists yet in php 7.4, so better skip it, ref https://3v4l.org/v1Vcd#v7.4.27 * Rename file * Code review suggestion * Try moving file. * Patch
This commit is contained in:
parent
8bf042b6ae
commit
d29b89113a
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\Php74\Rector\Property\TypedPropertyRector\Fixture;
|
||||
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
|
||||
class SkipMixedType
|
||||
{
|
||||
/** @var Foo|mixed|MockObject */
|
||||
private $x;
|
||||
}
|
|
@ -23,6 +23,10 @@ final class ObjectTypeAnalyzer
|
|||
: [$varType];
|
||||
|
||||
foreach ($types as $type) {
|
||||
if ($type instanceof \PHPStan\Type\MixedType) {
|
||||
// mixed does not exists in PHP 7.4
|
||||
return true;
|
||||
}
|
||||
if (! $type instanceof FullyQualifiedObjectType) {
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user