• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

keradus / PHP-CS-Fixer / 3168 / 7
82%
1.11: 82%

Build:
Build:
LAST BUILD BRANCH: master
DEFAULT BRANCH: 1.11
Ran 20 Sep 2017 10:50PM UTC
Files 276
Run time 16min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

20 Sep 2017 06:01AM UTC coverage: 78.5% (+0.02%) from 78.482%
COLLECT_COVERAGE=1

push

travis-ci

keradus
minor #3078 ConfigurationResolver - hide context while including config file (keradus)

This PR was merged into the 2.2 branch.

Discussion
----------

ConfigurationResolver - hide context while including config file

ref #3077

before:
```
keradus@keradus:~/github/PHP-CS-Fixer$ git du
diff --git a/.php_cs.dist b/.php_cs.dist
index d4891a77..3a399ac8 100644
--- a/.php_cs.dist
+++ b/.php_cs.dist
@@ -1,5 +1,8 @@
 <?php

+var_dump($configFile);
+var_dump($this->options);
+
 $header = <<<'EOF'
 This file is part of PHP CS Fixer.

keradus@keradus:~/github/PHP-CS-Fixer$ php php-cs-fixer fix
string(46) "/home/keradus/github/PHP-CS-Fixer/.php_cs.dist"
array(13) {
  ["allow-risky"]=>
  NULL
  ["cache-file"]=>
  NULL
  ["config"]=>
  NULL
  ["diff"]=>
  bool(false)
  ["dry-run"]=>
  bool(false)
  ["format"]=>
  NULL
  ["path"]=>
  array(0) {
  }
  ["path-mode"]=>
  string(8) "override"
  ["rules"]=>
  NULL
  ["show-progress"]=>
  NULL
  ["stop-on-violation"]=>
  bool(false)
  ["using-cache"]=>
  NULL
  ["verbosity"]=>
  int(32)
}
```

after:
```
keradus@keradus:~/github/PHP-CS-Fixer$ git du
diff --git a/.php_cs.dist b/.php_cs.dist
index d4891a77..b2a84a41 100644
--- a/.php_cs.dist
+++ b/.php_cs.dist
@@ -1,5 +1,8 @@
 <?php

+var_dump($path);
+var_dump($this->options);
+
 $header = <<<'EOF'
 This file is part of PHP CS Fixer.

diff --git a/src/Console/ConfigurationResolver.php b/src/Console/ConfigurationResolver.php
index ee2c3630..9db76ec2 100644
--- a/src/Console/ConfigurationResolver.php
+++ b/src/Console/ConfigurationResolver.php
@@ -217,7 +217,7 @@ public function getConfig()
                     continue;
                 }

-                $config = include $configFile;
+                $config = self::separatedContextLessInclude($configFile);

                 // verify that the config has an instance of Config
                 if (!$config instanceof ConfigInterface) {
@@ -848,4 +848,9 @@ private function resolveOptionBooleanValue($optionName)

         return false;
     }
+
+    private static function separatedContextLessInclude($path)
+    {
+        return include $path;
+    }
 }
keradus@keradus:~/github/PHP-CS-Fixer$ php php-cs-fixer fix
string(46) "/home/keradus/github/PHP-CS-Fixer/.php_cs.dist"
PHP Fatal error:  Uncaught Error: Using $this when not in object context in /home/keradus/github/PHP-CS-Fixer/.php_cs.dist:4
Stack trace:
#0 /home/keradus/github/PHP-CS-Fixer/src/Console/ConfigurationResolver.php(854): include()
#1 /home/keradus/github/PHP-CS-Fixer/src/Console/ConfigurationResolver.php(220): PhpCsFixer\Console\ConfigurationResolver::separatedContextLessInclude('/home/keradus/g...')
#2 /home/keradus/github/PHP-CS-Fixer/src/Console/ConfigurationResolver.php(577): PhpCsFixer\Console\ConfigurationResolver->getConfig()
#3 /home/keradus/github/PHP-CS-Fixer/src/Console/ConfigurationResolver.php(410): PhpCsFixer\Console\ConfigurationResolver->getFormat()
#4 /home/keradus/github/PHP-CS-Fixer/src/Console/Command/FixCommand.php(148): PhpCsFixer\Console\ConfigurationResolver->getReporter()
#5 /home/keradus/github/PHP-CS-Fixer/vendor/symfony/console/Command/Command.php(264): PhpCsFixer\Console\Command\FixCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutpu in /home/keradus/github/PHP-CS-Fixer/.php_cs.dist on line 4
```

Commits
-------

a116337e ConfigurationResolver - hide context while including config file

7222 of 9200 relevant lines covered (78.5%)

25.39 hits per line

Source Files on job 3168.7 (COLLECT_COVERAGE=1)
  • Tree
  • List 0
  • Changed 6
  • Source Changed 6
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 3168
  • Travis Job 3168.7
  • 6fd3457c on github
  • Prev Job for COLLECT_COVERAGE=1 on 2.2 (#3155.7)
  • Next Job for COLLECT_COVERAGE=1 SYMFONY_DEPRECATIONS_HELPER=weak on 2.2 (#3175.5)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc