mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-02 17:30:50 +00:00
b5cb9152fe
34250fb2cf
[automated] Apply Coding Standard (#5934)
25 lines
584 B
PHP
25 lines
584 B
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\NodeTypeResolver\NodeTypeCorrector;
|
|
|
|
use PHPStan\Type\IntersectionType;
|
|
use PHPStan\Type\StringType;
|
|
use PHPStan\Type\Type;
|
|
final class AccessoryNonEmptyStringTypeCorrector
|
|
{
|
|
/**
|
|
* @return \PHPStan\Type\Type|\PHPStan\Type\IntersectionType
|
|
*/
|
|
public function correct(Type $mainType)
|
|
{
|
|
if (!$mainType instanceof IntersectionType) {
|
|
return $mainType;
|
|
}
|
|
if (!$mainType->isNonEmptyString()->yes()) {
|
|
return $mainType;
|
|
}
|
|
return new StringType();
|
|
}
|
|
}
|