Skip to content

Commit

Permalink
[CodingStyle] Skip non-empty-string on VarConstantCommentRector (#2451)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jun 9, 2022
1 parent 17b86d4 commit ff931e4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/StaticTypeMapper/Mapper/ScalarStringToTypeMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
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;
Expand All @@ -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'],
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit ff931e4

Please sign in to comment.