* Dariusz Rumiński * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\DocBlock; /** * This class is responsible for comparing tags to see if they should be kept * together, or kept apart. * * @author Graham Campbell * @author Jakub Kwaśniewski * * @deprecated */ final class TagComparator { /** * Groups of tags that should be allowed to immediately follow each other. * * @var list> * * @internal */ public const DEFAULT_GROUPS = [ ['deprecated', 'link', 'see', 'since'], ['author', 'copyright', 'license'], ['category', 'package', 'subpackage'], ['property', 'property-read', 'property-write'], ]; /** * Should the given tags be kept together, or kept apart? * * @param list> $groups */ public static function shouldBeTogether(Tag $first, Tag $second, array $groups = self::DEFAULT_GROUPS): bool { @trigger_error('Method '.__METHOD__.' is deprecated and will be removed in version 4.0.', E_USER_DEPRECATED); $firstName = $first->getName(); $secondName = $second->getName(); if ($firstName === $secondName) { return true; } foreach ($groups as $group) { if (\in_array($firstName, $group, true) && \in_array($secondName, $group, true)) { return true; } } return false; } }