Skip to content

Commit e974feb

Browse files
committed
Fix phpunit tests in PHP 5.2, where the __DIR__ is not defined.
Per http://php.net/manual/en/language.constants.predefined.php the `__DIR__` is an equivalent to `dirname(__FILE__)`. This commit is replacing `__DIR__` by `dirname(__FILE___)`
1 parent 23d1e51 commit e974feb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

WordPressVIPMinimum/Sniffs/Variables/VariableAnalysisSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ function scopeKey($currScope) {
379379

380380
// Warning: this is an autovivifying get
381381
function getScopeInfo($currScope, $autoCreate = true) {
382-
require_once( __DIR__ . '/VariableAnalysisHelper.php' );
382+
require_once( dirname(__FILE__) . '/VariableAnalysisHelper.php' );
383383
$scopeKey = $this->scopeKey($currScope);
384384
if (!isset($this->_scopes[$scopeKey])) {
385385
if (!$autoCreate) {
@@ -391,7 +391,7 @@ function getScopeInfo($currScope, $autoCreate = true) {
391391
}
392392

393393
function getVariableInfo($varName, $currScope, $autoCreate = true) {
394-
require_once( __DIR__ . '/VariableAnalysisHelper.php' );
394+
require_once( dirname(__FILE__) . '/VariableAnalysisHelper.php' );
395395
$scopeInfo = $this->getScopeInfo($currScope, $autoCreate);
396396
if (!isset($scopeInfo->variables[$varName])) {
397397
if (!$autoCreate) {

0 commit comments

Comments
 (0)