Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien..

Decoded Output download

<?php

declare(strict_types=1);

/*
 * This file is part of PHP CS Fixer.
 *
 * (c) Fabien Potencier <[email protected]>
 *     Dariusz Rumiski <[email protected]>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace PhpCsFixer\Tests\DocBlock;

use PhpCsFixer\DocBlock\Line;
use PhpCsFixer\DocBlock\Tag;
use PhpCsFixer\DocBlock\TagComparator;
use PhpCsFixer\Tests\TestCase;

/**
 * @author Graham Campbell <[email protected]>
 * @author Jakub Kwaniewski <[email protected]>
 *
 * @internal
 *
 * @covers \PhpCsFixer\DocBlock\TagComparator
 */
final class TagComparatorTest extends TestCase
{
    /**
     * @dataProvider provideComparatorTogetherCases
     *
     * @group legacy
     */
    public function testComparatorTogether(string $first, string $second, bool $expected): void
    {
        $tag1 = new Tag(new Line('* @'.$first));
        $tag2 = new Tag(new Line('* @'.$second));

        $this->expectDeprecation('Method PhpCsFixer\DocBlock\TagComparator::shouldBeTogether is deprecated and will be removed in version 4.0.');

        self::assertSame($expected, TagComparator::shouldBeTogether($tag1, $tag2));
    }

    public static function provideComparatorTogetherCases(): iterable
    {
        yield ['return', 'return', true];

        yield ['param', 'param', true];

        yield ['return', 'param', false];

        yield ['var', 'foo', false];

        yield ['api', 'deprecated', false];

        yield ['author', 'copyright', true];

        yield ['author', 'since', false];

        yield ['link', 'see', true];

        yield ['category', 'package', true];
    }

    /**
     * @dataProvider provideComparatorTogetherWithDefinedGroupsCases
     *
     * @param list<list<string>> $groups
     *
     * @group legacy
     */
    public function testComparatorTogetherWithDefinedGroups(array $groups, string $first, string $second, bool $expected): void
    {
        $tag1 = new Tag(new Line('* @'.$first));
        $tag2 = new Tag(new Line('* @'.$second));

        $this->expectDeprecation('Method PhpCsFixer\DocBlock\TagComparator::shouldBeTogether is deprecated and will be removed in version 4.0.');

        self::assertSame(
            $expected,
            TagComparator::shouldBeTogether($tag1, $tag2, $groups)
        );
    }

    public static function provideComparatorTogetherWithDefinedGroupsCases(): iterable
    {
        yield [[['param', 'return']], 'return', 'return', true];

        yield [[], 'param', 'return', false];

        yield [[['param', 'return']], 'return', 'param', true];

        yield [[['param', 'return']], 'var', 'foo', false];

        yield [[['param', 'return']], 'api', 'deprecated', false];

        yield [[['param', 'return']], 'author', 'copyright', false];

        yield [[['param', 'return'], ['author', 'since']], 'author', 'since', true];

        yield [[...TagComparator::DEFAULT_GROUPS, ['param', 'return']], 'link', 'see', true];

        yield [[['param', 'return']], 'category', 'package', false];
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

/*
 * This file is part of PHP CS Fixer.
 *
 * (c) Fabien Potencier <[email protected]>
 *     Dariusz Rumiski <[email protected]>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace PhpCsFixer\Tests\DocBlock;

use PhpCsFixer\DocBlock\Line;
use PhpCsFixer\DocBlock\Tag;
use PhpCsFixer\DocBlock\TagComparator;
use PhpCsFixer\Tests\TestCase;

/**
 * @author Graham Campbell <[email protected]>
 * @author Jakub Kwaniewski <[email protected]>
 *
 * @internal
 *
 * @covers \PhpCsFixer\DocBlock\TagComparator
 */
final class TagComparatorTest extends TestCase
{
    /**
     * @dataProvider provideComparatorTogetherCases
     *
     * @group legacy
     */
    public function testComparatorTogether(string $first, string $second, bool $expected): void
    {
        $tag1 = new Tag(new Line('* @'.$first));
        $tag2 = new Tag(new Line('* @'.$second));

        $this->expectDeprecation('Method PhpCsFixer\DocBlock\TagComparator::shouldBeTogether is deprecated and will be removed in version 4.0.');

        self::assertSame($expected, TagComparator::shouldBeTogether($tag1, $tag2));
    }

    public static function provideComparatorTogetherCases(): iterable
    {
        yield ['return', 'return', true];

        yield ['param', 'param', true];

        yield ['return', 'param', false];

        yield ['var', 'foo', false];

        yield ['api', 'deprecated', false];

        yield ['author', 'copyright', true];

        yield ['author', 'since', false];

        yield ['link', 'see', true];

        yield ['category', 'package', true];
    }

    /**
     * @dataProvider provideComparatorTogetherWithDefinedGroupsCases
     *
     * @param list<list<string>> $groups
     *
     * @group legacy
     */
    public function testComparatorTogetherWithDefinedGroups(array $groups, string $first, string $second, bool $expected): void
    {
        $tag1 = new Tag(new Line('* @'.$first));
        $tag2 = new Tag(new Line('* @'.$second));

        $this->expectDeprecation('Method PhpCsFixer\DocBlock\TagComparator::shouldBeTogether is deprecated and will be removed in version 4.0.');

        self::assertSame(
            $expected,
            TagComparator::shouldBeTogether($tag1, $tag2, $groups)
        );
    }

    public static function provideComparatorTogetherWithDefinedGroupsCases(): iterable
    {
        yield [[['param', 'return']], 'return', 'return', true];

        yield [[], 'param', 'return', false];

        yield [[['param', 'return']], 'return', 'param', true];

        yield [[['param', 'return']], 'var', 'foo', false];

        yield [[['param', 'return']], 'api', 'deprecated', false];

        yield [[['param', 'return']], 'author', 'copyright', false];

        yield [[['param', 'return'], ['author', 'since']], 'author', 'since', true];

        yield [[...TagComparator::DEFAULT_GROUPS, ['param', 'return']], 'link', 'see', true];

        yield [[['param', 'return']], 'category', 'package', false];
    }
}

Function Calls

None

Variables

None

Stats

MD5 1690e5f5f0b46e86e9da996238fba1c1
Eval Count 0
Decode Time 97 ms