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); namespace Rules; use Larastan\Larastan\Collectors\UsedEm..

Decoded Output download

<?php

declare(strict_types=1);

namespace Rules;

use Larastan\Larastan\Collectors\UsedEmailViewCollector;
use Larastan\Larastan\Collectors\UsedRouteFacadeViewCollector;
use Larastan\Larastan\Collectors\UsedViewFacadeMakeCollector;
use Larastan\Larastan\Collectors\UsedViewFunctionCollector;
use Larastan\Larastan\Collectors\UsedViewInAnotherViewCollector;
use Larastan\Larastan\Collectors\UsedViewMakeCollector;
use Larastan\Larastan\Rules\UnusedViewsRule;
use Larastan\Larastan\Support\ViewFileHelper;
use PhpParser\Node;
use PHPStan\Collectors\Collector;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;

/** @extends RuleTestCase<UnusedViewsRule> */
class UnusedViewsRuleTest extends RuleTestCase
{
    protected function getRule(): Rule
    {
        $viewFileHelper = new ViewFileHelper([__DIR__ . '/../application/resources/views'], $this->getFileHelper());

        return new UnusedViewsRule(new UsedViewInAnotherViewCollector(
            $this->getContainer()->getService('currentPhpVersionSimpleDirectParser'),
            $viewFileHelper,
        ), $viewFileHelper);
    }

    /** @return array<Collector<Node, mixed>> */
    protected function getCollectors(): array
    {
        return [
            new UsedViewFunctionCollector(),
            new UsedEmailViewCollector(),
            new UsedViewMakeCollector(),
            new UsedViewFacadeMakeCollector(),
            new UsedRouteFacadeViewCollector(),
        ];
    }

    protected function setUp(): void
    {
        parent::setUp();

        // This is a workaround for a weird PHPStan container cache issue.
        require __DIR__ . '/../../bootstrap.php';
    }

    public function testRule(): void
    {
        $this->analyse([__DIR__ . '/data/FooController.php'], [
            [
                'This view is not used in the project.',
                00,
            ],
        ]);
    }

    /** @return string[] */
    public static function getAdditionalConfigFiles(): array
    {
        return [
            __DIR__ . '/../../extension.neon',
        ];
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace Rules;

use Larastan\Larastan\Collectors\UsedEmailViewCollector;
use Larastan\Larastan\Collectors\UsedRouteFacadeViewCollector;
use Larastan\Larastan\Collectors\UsedViewFacadeMakeCollector;
use Larastan\Larastan\Collectors\UsedViewFunctionCollector;
use Larastan\Larastan\Collectors\UsedViewInAnotherViewCollector;
use Larastan\Larastan\Collectors\UsedViewMakeCollector;
use Larastan\Larastan\Rules\UnusedViewsRule;
use Larastan\Larastan\Support\ViewFileHelper;
use PhpParser\Node;
use PHPStan\Collectors\Collector;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;

/** @extends RuleTestCase<UnusedViewsRule> */
class UnusedViewsRuleTest extends RuleTestCase
{
    protected function getRule(): Rule
    {
        $viewFileHelper = new ViewFileHelper([__DIR__ . '/../application/resources/views'], $this->getFileHelper());

        return new UnusedViewsRule(new UsedViewInAnotherViewCollector(
            $this->getContainer()->getService('currentPhpVersionSimpleDirectParser'),
            $viewFileHelper,
        ), $viewFileHelper);
    }

    /** @return array<Collector<Node, mixed>> */
    protected function getCollectors(): array
    {
        return [
            new UsedViewFunctionCollector(),
            new UsedEmailViewCollector(),
            new UsedViewMakeCollector(),
            new UsedViewFacadeMakeCollector(),
            new UsedRouteFacadeViewCollector(),
        ];
    }

    protected function setUp(): void
    {
        parent::setUp();

        // This is a workaround for a weird PHPStan container cache issue.
        require __DIR__ . '/../../bootstrap.php';
    }

    public function testRule(): void
    {
        $this->analyse([__DIR__ . '/data/FooController.php'], [
            [
                'This view is not used in the project.',
                00,
            ],
        ]);
    }

    /** @return string[] */
    public static function getAdditionalConfigFiles(): array
    {
        return [
            __DIR__ . '/../../extension.neon',
        ];
    }
}

Function Calls

None

Variables

None

Stats

MD5 417b7e85b0dad9577e98b1a3f343cbe1
Eval Count 0
Decode Time 96 ms