[CodingStyle] Skip non-empty-string on VarConstantCommentRector (#2451)

This commit is contained in:
Abdul Malik Ikhsan 2022-06-09 13:09:34 +07:00 committed by GitHub
parent 17b86d4b77
commit ff931e4b74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Rector\StaticTypeMapper\Mapper;
use Nette\Utils\Strings;
use PHPStan\Type\Accessory\AccessoryNonEmptyStringType;
use PHPStan\Type\ArrayType;
use PHPStan\Type\BooleanType;
use PHPStan\Type\CallableType;
@ -29,6 +30,7 @@ final class ScalarStringToTypeMapper
*/
private const SCALAR_NAME_BY_TYPE = [
StringType::class => ['string'],
AccessoryNonEmptyStringType::class => ['non-empty-string'],
ClassStringType::class => ['class-string'],
FloatType::class => ['float', 'real', 'double'],
IntegerType::class => ['int', 'integer'],

View File

@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace Rector\Tests\CodingStyle\Rector\ClassConst\VarConstantCommentRector\Fixture;
final class SkipNonEmptyStringVarDoc
{
/** @var non-empty-string */
public const NAME = 'testing';
/**
* @return non-empty-string
*/
public function run(): string
{
return self::NAME;
}
}