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\Naming;

use PhpCsFixer\Tests\Test\AbstractFixerTestCase;

/**
 * @author Fred Cox <[email protected]>
 *
 * @internal
 *
 * @covers \PhpCsFixer\Fixer\Naming\NoHomoglyphNamesFixer
 *
 * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Naming\NoHomoglyphNamesFixer>
 */
final class NoHomoglyphNamesFixerTest extends AbstractFixerTestCase
{
    /**
     * @dataProvider provideFixCases
     */
    public function testFix(string $expected, ?string $input = null): void
    {
        $this->doTest($expected, $input);
    }

    public static function provideFixCases(): iterable
    {
        yield ['<?php $a = 1;'];

        yield ['<?php $name = "This should not be changed";'];

        yield ['<?php $name = "  ";'];

        yield ['<?php $name = \'  \';'];

        yield ['<?php // This should not be chnged'];

        yield ['<?php /* This should not be chnged */'];

        yield [
            '<?php $name = \'wrong\';',
            '<?php $nm = \'wrong\';', // '' in name is a cyrillic letter
        ];

        yield [
            '<?php $a->name = \'wrong\';',
            '<?php $a->nm = \'wrong\';',
        ];

        yield [
            '<?php class A { private $name; }',
            '<?php class A { private $nm; }',
        ];

        yield [
            '<?php class Broken {}',
            '<?php class roken {}', // '' in Broken is a cyrillic letter
        ];

        yield [
            '<?php interface Broken {}',
            '<?php interface roken {}',
        ];

        yield [
            '<?php trait Broken {}',
            '<?php trait roken {}',
        ];

        yield [
            '<?php $a = new Broken();',
            '<?php $a = new roken();',
        ];

        yield [
            '<?php class A extends Broken {}',
            '<?php class A extends roken {}',
        ];

        yield [
            '<?php class A implements Broken {}',
            '<?php class A implements roken {}',
        ];

        yield [
            '<?php class A { use Broken; }',
            '<?php class A { use roken; }',
        ];

        yield [
            '<?php echo Broken::class;',
            '<?php echo roken::class;',
        ];

        yield [
            '<?php function name() {}',
            '<?php function nm() {}',
        ];

        yield [
            '<?php name();',
            '<?php nm();',
        ];

        yield [
            '<?php $first_name = "a";',
            '<?php $firstname = "a";', // Weird underscore symbol
        ];

        yield [
            '<?php class A { private string $name; }',
            '<?php class A { private string $nm; }',
        ];

        yield [
            '<?php class A { private ? Foo\Bar $name; }',
            '<?php class A { private ? Foo\Bar $nm; }',
        ];

        yield [
            '<?php class A { private array $name; }',
            '<?php class A { private array $nm; }',
        ];
    }
}
 ?>

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\Naming;

use PhpCsFixer\Tests\Test\AbstractFixerTestCase;

/**
 * @author Fred Cox <[email protected]>
 *
 * @internal
 *
 * @covers \PhpCsFixer\Fixer\Naming\NoHomoglyphNamesFixer
 *
 * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Naming\NoHomoglyphNamesFixer>
 */
final class NoHomoglyphNamesFixerTest extends AbstractFixerTestCase
{
    /**
     * @dataProvider provideFixCases
     */
    public function testFix(string $expected, ?string $input = null): void
    {
        $this->doTest($expected, $input);
    }

    public static function provideFixCases(): iterable
    {
        yield ['<?php $a = 1;'];

        yield ['<?php $name = "This should not be changed";'];

        yield ['<?php $name = "  ";'];

        yield ['<?php $name = \'  \';'];

        yield ['<?php // This should not be chnged'];

        yield ['<?php /* This should not be chnged */'];

        yield [
            '<?php $name = \'wrong\';',
            '<?php $nm = \'wrong\';', // '' in name is a cyrillic letter
        ];

        yield [
            '<?php $a->name = \'wrong\';',
            '<?php $a->nm = \'wrong\';',
        ];

        yield [
            '<?php class A { private $name; }',
            '<?php class A { private $nm; }',
        ];

        yield [
            '<?php class Broken {}',
            '<?php class roken {}', // '' in Broken is a cyrillic letter
        ];

        yield [
            '<?php interface Broken {}',
            '<?php interface roken {}',
        ];

        yield [
            '<?php trait Broken {}',
            '<?php trait roken {}',
        ];

        yield [
            '<?php $a = new Broken();',
            '<?php $a = new roken();',
        ];

        yield [
            '<?php class A extends Broken {}',
            '<?php class A extends roken {}',
        ];

        yield [
            '<?php class A implements Broken {}',
            '<?php class A implements roken {}',
        ];

        yield [
            '<?php class A { use Broken; }',
            '<?php class A { use roken; }',
        ];

        yield [
            '<?php echo Broken::class;',
            '<?php echo roken::class;',
        ];

        yield [
            '<?php function name() {}',
            '<?php function nm() {}',
        ];

        yield [
            '<?php name();',
            '<?php nm();',
        ];

        yield [
            '<?php $first_name = "a";',
            '<?php $firstname = "a";', // Weird underscore symbol
        ];

        yield [
            '<?php class A { private string $name; }',
            '<?php class A { private string $nm; }',
        ];

        yield [
            '<?php class A { private ? Foo\Bar $name; }',
            '<?php class A { private ? Foo\Bar $nm; }',
        ];

        yield [
            '<?php class A { private array $name; }',
            '<?php class A { private array $nm; }',
        ];
    }
}

Function Calls

None

Variables

None

Stats

MD5 a167991ef06774849f28f7322f965072
Eval Count 0
Decode Time 103 ms