Skip to content

Commit a22ffeb

Browse files
authored
Merge pull request #7 from weirdan/XH-1.3
Update to XdebugHandler 1.3
2 parents ea3b27f + 690c9bc commit a22ffeb

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ install:
2323
- composer install --no-interaction --no-progress --prefer-dist --ansi
2424

2525
script:
26+
- composer cs-check
2627
- composer test

composer.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
"description": "Runs a php script with XDebug disabled",
44
"keywords" : ["Xdebug", "xdebug", "performance"],
55
"require": {
6-
"composer/xdebug-handler": "^1.2",
6+
"composer/xdebug-handler": "^1.3",
77
"php": "~5.3 || ~7.0"
88
},
99
"require-dev": {
1010
"phpunit/phpunit": "^5.0 || ^6.0 || ^7.0",
1111
"ext-xdebug": "*",
12-
"php": "~5.6 || ~7.0"
12+
"php": "~5.6 || ~7.0",
13+
"squizlabs/php_codesniffer": "^3.3"
1314
},
1415
"autoload-dev": {
1516
"psr-4": {
@@ -25,6 +26,8 @@
2526
],
2627
"bin": ["bin/php-noxdebug"],
2728
"scripts": {
28-
"test": "bin/php-noxdebug vendor/bin/phpunit --color=always"
29+
"test": "bin/php-noxdebug vendor/bin/phpunit --color=always",
30+
"cs-check": "phpcs",
31+
"cs-fix": "phpcbf"
2932
}
3033
}

phpcs.xml.dist

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="RWX Standard" namespace="Weirdan\RunWithoutXdebug\CS\Standard">
3+
<file>./src</file>
4+
<file>./tests</file>
5+
<arg name="colors"/>
6+
<rule ref="PSR12">
7+
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols"/>
8+
</rule>
9+
</ruleset>

src/prepend.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
55
// standalone
66
require __DIR__ . '/../vendor/autoload.php';
7-
} else if (file_exists(__DIR__ . '/../../../autoload.php')) {
7+
} elseif (file_exists(__DIR__ . '/../../../autoload.php')) {
88
// global or project
99
require __DIR__ . '/../../../autoload.php';
1010
}
1111

12-
call_user_func(function() {
12+
call_user_func(function () {
1313
$x = new \Composer\XdebugHandler\XdebugHandler('RWX');
1414
if ($logFile = getenv('RWX_DEBUG_LOG')) {
1515
if (!class_exists(Logger::class, false)) {
@@ -33,7 +33,7 @@ public function log($level, $message, array $context = array())
3333
}
3434
$logger = new Logger($logFile);
3535
} else {
36-
$logger = new \Psr\Log\NullLogger;
36+
$logger = new \Psr\Log\NullLogger();
3737
}
3838

3939
// we don't have to detect command line code as auto_prepend_file doesn't work in that case
@@ -44,10 +44,9 @@ public function log($level, $message, array $context = array())
4444
$logger->debug('argv[0]: ' . $_SERVER['argv'][0]);
4545
$logger->debug('Main script: ' . $mainScript);
4646

47-
$x->setMainScript($mainScript);
48-
49-
$x->setLogger($logger);
50-
$x->check();
51-
$config = new \Composer\XdebugHandler\PhpConfig;
52-
$config->usePersistent();
47+
$x
48+
->setMainScript($mainScript)
49+
->setPersistent()
50+
->setLogger($logger)
51+
->check();
5352
});

0 commit comments

Comments
 (0)