Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restart phpcs/phpcbf when xdebug is loaded #3724

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions autoload.php
Expand Up @@ -73,6 +73,8 @@ public static function load($class)
return;
}

require_once __DIR__.'/vendor/autoload.php';

if (strpos(__DIR__, 'phar://') !== 0
&& @file_exists(__DIR__.'/../../autoload.php') === true
) {
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -29,7 +29,8 @@
"php": ">=5.4.0",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"ext-simplexml": "*"
"ext-simplexml": "*",
"composer/xdebug-handler": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
Expand Down
9 changes: 9 additions & 0 deletions src/Runner.php
Expand Up @@ -12,6 +12,7 @@

namespace PHP_CodeSniffer;

use Composer\XdebugHandler\XdebugHandler;
use PHP_CodeSniffer\Exceptions\DeepExitException;
use PHP_CodeSniffer\Exceptions\RuntimeException;
use PHP_CodeSniffer\Files\DummyFile;
Expand Down Expand Up @@ -53,6 +54,10 @@ class Runner
*/
public function runPHPCS()
{
$xdebug = new XdebugHandler('phpcs');
$xdebug->check();
unset($xdebug);

$this->registerOutOfMemoryShutdownMessage('phpcs');

try {
Expand Down Expand Up @@ -155,6 +160,10 @@ public function runPHPCS()
*/
public function runPHPCBF()
{
$xdebug = new XdebugHandler('phpcbf');
$xdebug->check();
unset($xdebug);

$this->registerOutOfMemoryShutdownMessage('phpcbf');

if (defined('PHP_CODESNIFFER_CBF') === false) {
Expand Down