Skip to content

Commit

Permalink
Merge branch '2.18'
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus committed Apr 16, 2021
2 parents 456fe40 + c990a13 commit 372591b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/rules/class_notation/final_internal_class.rst
Expand Up @@ -33,7 +33,7 @@ of the white list ones are used as well. (case insensitive)

Allowed types: ``array``

Default value: ``['@final', '@Entity', '@ORM\\Entity', '@ORM\\Mapping\\Entity', '@Mapping\\Entity']``
Default value: ``['@final', '@Entity', '@ORM\\Entity', '@ORM\\Mapping\\Entity', '@Mapping\\Entity', '@Document', '@ODM\\Document']``

``consider_absent_docblock_as_internal_class``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions src/Fixer/ClassNotation/FinalInternalClassFixer.php
Expand Up @@ -169,6 +169,8 @@ protected function createConfigurationDefinition()
'@ORM\Entity',
'@ORM\Mapping\Entity',
'@Mapping\Entity',
'@Document',
'@ODM\Document',
])
->setNormalizer($annotationsNormalizer)
->getOption(),
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/Phpdoc/PhpdocTypesOrderFixer.php
Expand Up @@ -163,7 +163,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens)
private function sortTypes(array $types)
{
foreach ($types as $index => $type) {
$types[$index] = Preg::replaceCallback('/^([^<]+)<(?:([\w\|]+?)(,\s*))?(.*)>$/', function (array $matches) {
$types[$index] = Preg::replaceCallback('/^([^<]+)<(?:([\w\|]+?|<?.*>)(,\s*))?(.*)>$/', function (array $matches) {
return $matches[1].'<'.$this->sortJoinedTypes($matches[2]).$matches[3].$this->sortJoinedTypes($matches[4]).'>';
}, $type);
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Fixer/ClassNotation/FinalClassFixerTest.php
Expand Up @@ -41,6 +41,8 @@ public function provideFixCases()
['<?php use Doctrine\ORM\Mapping as ORM; /** @ORM\Entity */ class MyEntity {}'],
['<?php use Doctrine\ORM\Mapping; /** @Mapping\Entity */ class MyEntity {}'],
['<?php use Doctrine\ORM; /** @ORM\Mapping\Entity */ class MyEntity {}'],
['<?php /** @Document */ class MyDocument {}'],
['<?php use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; /** @ODM\Document */ class MyEntity {}'],
['<?php /** @entity */ class MyEntity {}'],
['<?php use Doctrine\ORM\Mapping as ORM; /** @orm\entity */ class MyEntity {}'],
['<?php abstract class MyAbstract {}'],
Expand Down
3 changes: 3 additions & 0 deletions tests/Fixer/Phpdoc/PhpdocTypesOrderFixerTest.php
Expand Up @@ -145,6 +145,9 @@ public function provideFixCases()
'<?php /** @method void bar(null|string $delimiter = \',<br/>\') */',
'<?php /** @method void bar(string|null $delimiter = \',<br/>\') */',
],
[
'<?php /** @var array<array<int, int>, OutputInterface> */',
],
];
}

Expand Down

0 comments on commit 372591b

Please sign in to comment.