Skip to content

Commit b2e59a6

Browse files
connorhuthePanz
authored andcommitted
introduce __DIR__ constants
1 parent b756c43 commit b2e59a6

31 files changed

+83
-83
lines changed

lib/Doctrine/Core.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ public static function setPath($path)
564564
public static function getPath()
565565
{
566566
if ( ! self::$_path) {
567-
self::$_path = realpath(dirname(__FILE__) . '/..');
567+
self::$_path = dirname(__DIR__);
568568
}
569569

570570
return self::$_path;
@@ -1132,7 +1132,7 @@ public static function compile($target = null, $includedDrivers = array())
11321132
public static function autoload($className)
11331133
{
11341134
if (strpos($className, 'sfYaml') === 0) {
1135-
require dirname(__FILE__) . '/Parser/sfYaml/' . $className . '.php';
1135+
require __DIR__ . '/Parser/sfYaml/' . $className . '.php';
11361136

11371137
return true;
11381138
}

lib/Doctrine/Parser/sfYaml/sfYaml.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static function load($input)
8787
return $input;
8888
}
8989

90-
require_once dirname(__FILE__).'/sfYamlParser.php';
90+
require_once __DIR__.'/sfYamlParser.php';
9191

9292
$yaml = new sfYamlParser();
9393

@@ -116,7 +116,7 @@ public static function load($input)
116116
*/
117117
public static function dump($array, $inline = 2)
118118
{
119-
require_once dirname(__FILE__).'/sfYamlDumper.php';
119+
require_once __DIR__.'/sfYamlDumper.php';
120120

121121
$yaml = new sfYamlDumper();
122122

lib/Doctrine/Parser/sfYaml/sfYamlDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
require_once(dirname(__FILE__).'/sfYamlInline.php');
11+
require_once(__DIR__.'/sfYamlInline.php');
1212

1313
/**
1414
* sfYamlDumper dumps PHP variables to YAML strings.

lib/Doctrine/Parser/sfYaml/sfYamlInline.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
require_once dirname(__FILE__).'/sfYaml.php';
11+
require_once __DIR__.'/sfYaml.php';
1212

1313
/**
1414
* sfYamlInline implements a YAML parser/dumper for the YAML inline syntax.

lib/Doctrine/Parser/sfYaml/sfYamlParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* file that was distributed with this source code.
99
*/
1010

11-
require_once(dirname(__FILE__).'/sfYamlInline.php');
11+
require_once(__DIR__.'/sfYamlInline.php');
1212

1313
if (!defined('PREG_BAD_UTF8_OFFSET_ERROR'))
1414
{

tests/CliTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class Doctrine_Cli_TestCase extends UnitTestCase
5757
protected function getFixturesPath()
5858
{
5959
if (! isset($this->fixturesPath)) {
60-
$this->fixturesPath = dirname(__FILE__) . '/CliTestCase';
60+
$this->fixturesPath = __DIR__ . '/CliTestCase';
6161
}
6262

6363
return $this->fixturesPath;

tests/CliTestCase/cli-default.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
* @author Dan Bettles <[email protected]>
66
*/
77

8-
require_once(dirname(dirname(dirname(__FILE__))) . '/lib/Doctrine/Core.php');
8+
require_once dirname(__DIR__, 2) . '/lib/Doctrine/Core.php';
99
spl_autoload_register(array('Doctrine_Core', 'autoload'));
1010

11-
require_once(dirname(__FILE__) . '/TestTask02.php');
11+
require_once(__DIR__ . '/TestTask02.php');
1212

1313
$cli = new Doctrine_Cli();
1414
$cli->run($_SERVER['argv']);

tests/CliTestCase/cli-with-custom-tasks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
* @author Dan Bettles <[email protected]>
66
*/
77

8-
require_once(dirname(dirname(dirname(__FILE__))) . '/lib/Doctrine/Core.php');
8+
require_once dirname(__DIR__, 2) . '/lib/Doctrine/Core.php';
99
spl_autoload_register(array('Doctrine_Core', 'autoload'));
1010

1111
$cli = new Doctrine_Cli();
1212

13-
require_once(dirname(__FILE__) . '/TestTask02.php');
13+
require_once(__DIR__ . '/TestTask02.php');
1414

1515
//Either...:
1616
$cli->registerTaskClass('Doctrine_Cli_TestCase_TestTask02');

tests/CliTestCase/cli-without-autoregistered-custom-tasks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
* @author Dan Bettles <[email protected]>
66
*/
77

8-
require_once(dirname(dirname(dirname(__FILE__))) . '/lib/Doctrine/Core.php');
8+
require_once dirname(__DIR__, 2) . '/lib/Doctrine/Core.php';
99
spl_autoload_register(array('Doctrine_Core', 'autoload'));
1010

11-
require_once(dirname(__FILE__) . '/TestTask02.php');
11+
require_once(__DIR__ . '/TestTask02.php');
1212

1313
$cli = new Doctrine_Cli(array('autoregister_custom_tasks' => false));
1414
$cli->run($_SERVER['argv']);

tests/DoctrineTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
* @version $Revision$
3333
*/
3434

35-
require_once dirname(__FILE__) . '/DoctrineTest/UnitTestCase.php';
36-
require_once dirname(__FILE__) . '/DoctrineTest/GroupTest.php';
37-
require_once dirname(__FILE__) . '/DoctrineTest/Doctrine_UnitTestCase.php';
38-
require_once dirname(__FILE__) . '/DoctrineTest/Reporter.php';
35+
require_once __DIR__ . '/DoctrineTest/UnitTestCase.php';
36+
require_once __DIR__ . '/DoctrineTest/GroupTest.php';
37+
require_once __DIR__ . '/DoctrineTest/Doctrine_UnitTestCase.php';
38+
require_once __DIR__ . '/DoctrineTest/Reporter.php';
3939

4040
class DoctrineTest
4141
{
@@ -75,13 +75,13 @@ public function run()
7575
{
7676
$testGroup = $this->testGroup;
7777
if (PHP_SAPI === 'cli') {
78-
require_once(dirname(__FILE__) . '/DoctrineTest/Reporter/Cli.php');
78+
require_once(__DIR__ . '/DoctrineTest/Reporter/Cli.php');
7979
$reporter = new DoctrineTest_Reporter_Cli();
8080
$argv = $_SERVER['argv'];
8181
array_shift($argv);
8282
$options = $this->parseOptions($argv);
8383
} else {
84-
require_once(dirname(__FILE__) . '/DoctrineTest/Reporter/Html.php');
84+
require_once(__DIR__ . '/DoctrineTest/Reporter/Html.php');
8585
$options = $_GET;
8686
if (isset($options['filter'])) {
8787
if ( ! is_array($options['filter'])) {
@@ -148,7 +148,7 @@ public function run()
148148
* somebody could give it a try. Just replace this block of code
149149
* with the one below
150150
*
151-
define('PHPCOVERAGE_HOME', dirname(dirname(__FILE__)) . '/vendor/spikephpcoverage');
151+
define('PHPCOVERAGE_HOME', dirname(__DIR__) . '/vendor/spikephpcoverage');
152152
require_once PHPCOVERAGE_HOME . '/CoverageRecorder.php';
153153
require_once PHPCOVERAGE_HOME . '/reporter/HtmlCoverageReporter.php';
154154
@@ -170,8 +170,8 @@ public function run()
170170
$ret = $testGroup->run($reporter, $filter);
171171
$result['coverage'] = xdebug_get_code_coverage();
172172
xdebug_stop_code_coverage();
173-
file_put_contents(dirname(__FILE__) . '/coverage/coverage.txt', serialize($result));
174-
require_once dirname(__FILE__) . '/DoctrineTest/Coverage.php';
173+
file_put_contents(__DIR__ . '/coverage/coverage.txt', serialize($result));
174+
require_once __DIR__ . '/DoctrineTest/Coverage.php';
175175
$coverageGeneration = new DoctrineTest_Coverage();
176176
$coverageGeneration->generateReport();
177177
return $ret;
@@ -203,7 +203,7 @@ public function run()
203203
*/
204204
public function requireModels()
205205
{
206-
$models = new DirectoryIterator(dirname(__FILE__) . '/models/');
206+
$models = new DirectoryIterator(__DIR__ . '/models/');
207207

208208
foreach($models as $key => $file) {
209209
if ($file->isFile() && ! $file->isDot()) {

0 commit comments

Comments
 (0)