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\Fixer\Phpdoc;

use PhpCsFixer\Tests\Test\AbstractFixerTestCase;

/**
 * @internal
 *
 * @covers \PhpCsFixer\Fixer\Phpdoc\PhpdocListTypeFixer
 *
 * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Phpdoc\PhpdocListTypeFixer>
 */
final class PhpdocListTypeFixerTest extends AbstractFixerTestCase
{
    /**
     * @dataProvider provideFixCases
     */
    public function testFix(string $expected, ?string $input = null): void
    {
        $this->doTest($expected, $input);
    }

    /**
     * @return iterable<array{string, 1?: string}>
     */
    public static function provideFixCases(): iterable
    {
        yield ['<?php /** @tagNotSupportingTypes string[] */'];

        yield ['<?php /** @var array<string, int> */'];

        yield ['<?php /** @var array<int, array<string, bool>> */'];

        yield ['<?php /** @var array<class-string<Foo>, bool> */'];

        yield ['<?php /** @var array<int<1, 10>, bool> */'];

        yield ['<?php /** @var array<Foo::BAR_*, bool> */'];

        yield ['<?php /** @var array<\'foo\'|\'bar\', bool> */'];

        yield ['<?php /** @var array{} */'];

        yield ['<?php /** @var array{string, string, string} */'];

        yield ['<?php /** @var array{"a", "b[]", "c"} */'];

        yield ["<?php /** @var array{'a', 'b[]', 'c'} */"];

        yield [
            '<?php /** @var list<Foo> */',
            '<?php /** @var array<Foo> */',
        ];

        yield [
            '<?php /** @var list<Foo> */',
            '<?php /** @var ARRAY<Foo> */',
        ];

        yield [
            '<?php /** @var ?list<Foo> */',
            '<?php /** @var ?array<Foo> */',
        ];

        yield [
            '<?php /** @var list<bool>|list<float>|list<int>|list<string> */',
            '<?php /** @var array<bool>|list<float>|array<int>|list<string> */',
        ];

        yield [
            '<?php /** @var non-empty-list<string> */',
            '<?php /** @var non-empty-array<string> */',
        ];

        yield [
            '<?php /** @var array{string, list<array{Foo, list<int>, Bar}>} */',
            '<?php /** @var array{string, array<array{Foo, array<int>, Bar}>} */',
        ];

        yield [
            '<?php /** @var list<int<1, 10>> */',
            '<?php /** @var array<int<1, 10>> */',
        ];
    }
}
 ?>

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\Fixer\Phpdoc;

use PhpCsFixer\Tests\Test\AbstractFixerTestCase;

/**
 * @internal
 *
 * @covers \PhpCsFixer\Fixer\Phpdoc\PhpdocListTypeFixer
 *
 * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Phpdoc\PhpdocListTypeFixer>
 */
final class PhpdocListTypeFixerTest extends AbstractFixerTestCase
{
    /**
     * @dataProvider provideFixCases
     */
    public function testFix(string $expected, ?string $input = null): void
    {
        $this->doTest($expected, $input);
    }

    /**
     * @return iterable<array{string, 1?: string}>
     */
    public static function provideFixCases(): iterable
    {
        yield ['<?php /** @tagNotSupportingTypes string[] */'];

        yield ['<?php /** @var array<string, int> */'];

        yield ['<?php /** @var array<int, array<string, bool>> */'];

        yield ['<?php /** @var array<class-string<Foo>, bool> */'];

        yield ['<?php /** @var array<int<1, 10>, bool> */'];

        yield ['<?php /** @var array<Foo::BAR_*, bool> */'];

        yield ['<?php /** @var array<\'foo\'|\'bar\', bool> */'];

        yield ['<?php /** @var array{} */'];

        yield ['<?php /** @var array{string, string, string} */'];

        yield ['<?php /** @var array{"a", "b[]", "c"} */'];

        yield ["<?php /** @var array{'a', 'b[]', 'c'} */"];

        yield [
            '<?php /** @var list<Foo> */',
            '<?php /** @var array<Foo> */',
        ];

        yield [
            '<?php /** @var list<Foo> */',
            '<?php /** @var ARRAY<Foo> */',
        ];

        yield [
            '<?php /** @var ?list<Foo> */',
            '<?php /** @var ?array<Foo> */',
        ];

        yield [
            '<?php /** @var list<bool>|list<float>|list<int>|list<string> */',
            '<?php /** @var array<bool>|list<float>|array<int>|list<string> */',
        ];

        yield [
            '<?php /** @var non-empty-list<string> */',
            '<?php /** @var non-empty-array<string> */',
        ];

        yield [
            '<?php /** @var array{string, list<array{Foo, list<int>, Bar}>} */',
            '<?php /** @var array{string, array<array{Foo, array<int>, Bar}>} */',
        ];

        yield [
            '<?php /** @var list<int<1, 10>> */',
            '<?php /** @var array<int<1, 10>> */',
        ];
    }
}

Function Calls

None

Variables

None

Stats

MD5 ca2d7b73f493f44c10ef1e0907bdee47
Eval Count 0
Decode Time 126 ms