Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/set/coding-style/coding-style.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
services:
Rector\CodingStyle\Rector\If_\NullableCompareToNullRector: ~
Rector\CodingStyle\Rector\ClassConst\CompleteVarDocTypeConstantRector: ~
Rector\CodingStyle\Rector\FuncCall\SimpleArrayCallableToStringRector: ~
Rector\CodingStyle\Rector\Identical\IdenticalFalseToBooleanNotRector: ~
Rector\CodingStyle\Rector\Switch_\BinarySwitchToIfElseRector: ~
Expand All @@ -22,4 +21,5 @@ services:
Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector: ~
Rector\CodingStyle\Rector\Property\ArrayPropertyDefaultValueRector: ~
Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector: ~

Rector\CodingStyle\Rector\ClassConst\VarConstantCommentRector: ~

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Rector\CodingStyle\Tests\Rector\ClassConst\CompleteVarDocTypeConstantRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\ClassConst\VarConstantCommentRector\Fixture;

final class SomeClass
final class MiscType
{
private const NUMBER = 5;
private const NUMBER_NEGATIVE = -5;
Expand All @@ -16,9 +16,9 @@ final class SomeClass
-----
<?php

namespace Rector\CodingStyle\Tests\Rector\ClassConst\CompleteVarDocTypeConstantRector\Fixture;
namespace Rector\CodingStyle\Tests\Rector\ClassConst\VarConstantCommentRector\Fixture;

final class SomeClass
final class MiscType
{
/**
* @var int
Expand All @@ -33,7 +33,7 @@ final class SomeClass
*/
const STRING = 'name';
/**
* @var mixed[]
* @var string[][]
*/
const ITEMs = [[self::STRING]];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php declare(strict_types=1);

namespace Rector\CodingStyle\Tests\Rector\ClassConst\VarConstantCommentRector;

class SomeClass
{
/**
* Some text comment
*/
private const CONTROLS_MAPPING = [['a']];
}

?>
-----
<?php declare(strict_types=1);

namespace Rector\CodingStyle\Tests\Rector\ClassConst\VarConstantCommentRector;

class SomeClass
{
/**
* Some text comment
* @var string[][]
*/
private const CONTROLS_MAPPING = [['a']];
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public function test(): void
__DIR__ . '/Fixture/fixture.php.inc',
__DIR__ . '/Fixture/correct_invalid.php.inc',
__DIR__ . '/Fixture/arrays.php.inc',
__DIR__ . '/Fixture/misc_type.php.inc',
__DIR__ . '/Fixture/no_slash.php.inc',
]);
}

Expand Down
3 changes: 3 additions & 0 deletions src/Php/TypeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public function isPhpReservedType(string $type): bool
$type = strtolower($type);
$extraTypes = ['object'];

// remove [] from arrays
$type = Strings::replace($type, '#(\[\])+$#');

return in_array($type, array_merge($this->phpSupportedTypes, $extraTypes), true);
}

Expand Down