Avoid using PHPStan --debug when generating reports
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3531515. -->
Reported by: [jonathan1055](https://www.drupal.org/user/92645)
Related to !375
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>This is a follow-up to the discusison on <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/gitlab_templates_downstream/issues/3531065" title="Status: Closed (fixed)">#3531065: Add coverage for @group and @dataprovider, use matrix</a></span> #7-12 where using the <code>--debug</code> flag in PHPStan causes a badly-formatted junit.xml to be produced. The debug output (the names of the files being checked) are written at the top of the .xml making it unparsable.</p>
<p>This sounds like a bug in PHPStan.</p>
<h3 id="summary-steps-reproduce">Steps to reproduce</h3>
<p>Run a job with <code>_PHPSTAN_EXTRA: --debug</code><br>
Here is an exampe <a href="https://project.pages.drupalcode.org/-/gitlab_templates_downstream/-/jobs/5608662/artifacts/junit.xml">https://project.pages.drupalcode.org/-/gitlab_templates_downstream/-/jobs/5608662/artifacts/junit.xml</a><br>
The actual file contains</p>
<pre>tests/src/FunctionalJavascript/GitlabTemplatesDownstreamThreeTest.php<br>tests/src/Functional/GitlabTemplatesDownstreamTwoTest.php<br>tests/src/Functional/GitlabTemplatesDownstreamOneTest.php<br>src/form.inc<br>gitlab_templates_downstream.module<br><?xml version="1.0" encoding="UTF-8"?><testsuite failures="0" name="phpstan" tests="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/junit-team/junit5/r5.5.1/platform-tests/src/test/resources/jenkins-junit.xsd"><testcase name="phpstan"></testcase></testsuite></pre><h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Leave the --debug setting in place on the run that writes to the log. But in all other runs remove that string from <code>$_PHPSTAN_EXTRA</code> to avoid the bad .xml output. Thanks to @fjgarlin for this idea.</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
> Related issue: [Issue #3531065](https://www.drupal.org/node/3531065)
issue