Skip to content

Commit

Permalink
Rename Debugger::print() to Debugger::printVar()
Browse files Browse the repository at this point in the history
Can't use method name print() in PHP 5.x
  • Loading branch information
ADmad committed Jan 8, 2017
1 parent 230d494 commit 4db4a1e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Error/Debugger.php
Expand Up @@ -801,7 +801,7 @@ public static function getType($var)
* data in a browser-friendly way.
* @return void
*/
public static function print($var, $location = [], $showHtml = null)
public static function printVar($var, $location = [], $showHtml = null)
{
$location += ['file' => null, 'line' => null];
$file = $location['file'];
Expand Down
4 changes: 2 additions & 2 deletions src/basics.php
Expand Up @@ -55,7 +55,7 @@ function debug($var, $showHtml = null, $showFrom = true)
];
}

Debugger::print($var, $location, $showHtml);
Debugger::printVar($var, $location, $showHtml);

return $var;
}
Expand Down Expand Up @@ -136,7 +136,7 @@ function dd($var, $showHtml = null)
'file' => $trace[0]['file']
];

Debugger::print($var, $location);
Debugger::printVar($var, $location);
die(1);
}
}
24 changes: 12 additions & 12 deletions tests/TestCase/Error/DebuggerTest.php
Expand Up @@ -587,14 +587,14 @@ public function testDebugInfo()
}

/**
* test testPrint()
* test testPrintVar()
*
* @return void
*/
public function testPrint()
public function testPrintVar()
{
ob_start();
Debugger::print('this-is-a-test', ['file' => __FILE__, 'line' => __LINE__], false);
Debugger::printVar('this-is-a-test', ['file' => __FILE__, 'line' => __LINE__], false);
$result = ob_get_clean();
$expectedText = <<<EXPECTED
%s (line %d)
Expand All @@ -609,7 +609,7 @@ public function testPrint()

ob_start();
$value = '<div>this-is-a-test</div>';
Debugger::print($value, ['file' => __FILE__, 'line' => __LINE__], true);
Debugger::printVar($value, ['file' => __FILE__, 'line' => __LINE__], true);
$result = ob_get_clean();
$expectedHtml = <<<EXPECTED
<div class="cake-debug-output">
Expand All @@ -623,7 +623,7 @@ public function testPrint()
$this->assertEquals($expected, $result);

ob_start();
Debugger::print('<div>this-is-a-test</div>', ['file' => __FILE__, 'line' => __LINE__], true);
Debugger::printVar('<div>this-is-a-test</div>', ['file' => __FILE__, 'line' => __LINE__], true);
$result = ob_get_clean();
$expected = <<<EXPECTED
<div class="cake-debug-output">
Expand All @@ -637,7 +637,7 @@ public function testPrint()
$this->assertEquals($expected, $result);

ob_start();
Debugger::print('<div>this-is-a-test</div>', [], true);
Debugger::printVar('<div>this-is-a-test</div>', [], true);
$result = ob_get_clean();
$expected = <<<EXPECTED
<div class="cake-debug-output">
Expand All @@ -651,7 +651,7 @@ public function testPrint()
$this->assertEquals($expected, $result);

ob_start();
Debugger::print('<div>this-is-a-test</div>', ['file' => __FILE__, 'line' => __LINE__]);
Debugger::printVar('<div>this-is-a-test</div>', ['file' => __FILE__, 'line' => __LINE__]);
$result = ob_get_clean();
$expectedHtml = <<<EXPECTED
<div class="cake-debug-output">
Expand All @@ -676,7 +676,7 @@ public function testPrint()
$this->assertEquals($expected, $result);

ob_start();
Debugger::print('<div>this-is-a-test</div>');
Debugger::printVar('<div>this-is-a-test</div>');
$result = ob_get_clean();
$expectedHtml = <<<EXPECTED
<div class="cake-debug-output">
Expand All @@ -701,7 +701,7 @@ public function testPrint()
$this->assertEquals($expected, $result);

ob_start();
Debugger::print('<div>this-is-a-test</div>', ['file' => __FILE__, 'line' => __LINE__], false);
Debugger::printVar('<div>this-is-a-test</div>', ['file' => __FILE__, 'line' => __LINE__], false);
$result = ob_get_clean();
$expected = <<<EXPECTED
%s (line %d)
Expand All @@ -714,7 +714,7 @@ public function testPrint()
$this->assertEquals($expected, $result);

ob_start();
Debugger::print('<div>this-is-a-test</div>', ['file' => __FILE__, 'line' => __LINE__], false);
Debugger::printVar('<div>this-is-a-test</div>', ['file' => __FILE__, 'line' => __LINE__], false);
$result = ob_get_clean();
$expected = <<<EXPECTED
%s (line %d)
Expand All @@ -727,7 +727,7 @@ public function testPrint()
$this->assertEquals($expected, $result);

ob_start();
Debugger::print('<div>this-is-a-test</div>', [], false);
Debugger::printVar('<div>this-is-a-test</div>', [], false);
$result = ob_get_clean();
$expected = <<<EXPECTED
Expand All @@ -740,7 +740,7 @@ public function testPrint()
$this->assertEquals($expected, $result);

ob_start();
Debugger::print(false, [], false);
Debugger::printVar(false, [], false);
$result = ob_get_clean();
$expected = <<<EXPECTED
Expand Down

0 comments on commit 4db4a1e

Please sign in to comment.