laulamanapps/phpunit-debug-code-detector

检测项目文件中的调试代码

dev-master 2021-05-21 15:39 UTC

This package is auto-updated.

Last update: 2024-09-21 23:30:42 UTC


README

你曾经向包含调试代码的仓库推送过代码吗?我也是!使用这个PHPUnit扩展,至少在你运行测试时会有通知。

Screenshot

安装

需求

$ composer require --dev laulamanapps/phpunit-debug-code-detector

配置

<extensions>
    <extension class="LauLamanApps\DebugCodeDetector\DebugCodeDetectorExtension">
        <arguments>
            <array><!-- Folders we want scanned -->
                <element key="0"><string>src</string></element>
                <element key="1"><string>templates</string></element>
            </array>
        </arguments>
    </extension>
</extensions>

仅启用某些检测器

<extensions>
    <extension class="LauLamanApps\DebugCodeDetector\DebugCodeDetectorExtension">
        <arguments>
            <array><!-- Folders we want scanned -->
                <element key="0"><string>src</string></element>
                <element key="1"><string>templates</string></element>
            </array>
            <array><!-- Detectors we want to use -->
                <element key="0"><object class="LauLamanApps\DebugCodeDetector\Detector\Php\VarDumpDetector"/></element>
                <element key="1"><object class="LauLamanApps\DebugCodeDetector\Detector\Php\PrintRDetector"/></element>
                <element key="2"><object class="LauLamanApps\DebugCodeDetector\Detector\Symfony\VarDumper\DumpDetector"/></element>
            </array>
        </arguments>
    </extension>
</extensions>

禁用彩色输出

<extensions>
    <extension class="LauLamanApps\DebugCodeDetector\DebugCodeDetectorExtension">
        <arguments>
            <array><!-- Folders we want scanned -->
                <element key="0"><string>src</string></element>
                <element key="1"><string>templates</string></element>
            </array>
            <string>all</string><!-- Use all detectors -->
            <bool>false</bool>
        </arguments>
    </extension>
</extensions>