PhpUnit error with unusual error

PHP Fatal error:  Default value for parameters with a class type hint can only be NULL in /usr/share/php/PHPUnit/Framework/Test.php on line 66
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP   3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:130
PHP   4. PHPUnit_Runner_BaseTestRunner->getTest() /usr/share/php/PHPUnit/TextUI/Command.php:150
PHP   5. PHPUnit_Runner_BaseTestRunner->loadSuiteClass() /usr/share/php/PHPUnit/Runner/BaseTestRunner.php:104
PHP   6. PHPUnit_Runner_StandardTestSuiteLoader->load() /usr/share/php/PHPUnit/Runner/BaseTestRunner.php:168
PHP   7. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/php/PHPUnit/Runner/StandardTestSuiteLoader.php:78
PHP   8. PHPUnit_Util_Fileloader::load() /usr/share/php/PHPUnit/Util/Fileloader.php:79
PHP   9. include_once() /usr/share/php/PHPUnit/Util/Fileloader.php:95
PHP  10. phpunit_autoload() /usr/share/php/PHPUnit/Autoload.php:0
PHP  11. require() /usr/share/php/PHPUnit/Autoload.php:203
PHP  12. phpunit_autoload() /usr/share/php/PHPUnit/Autoload.php:0

This line has:

public function run(PHPUnit_Framework_TestResult $result = NULL)

When I delete = NULL, it passes, but fails on another line, which also has = NULL, but the problem is that the error basically says that it should be NULL, that it is.

I did not modify PhpUnit in any way; I installed it using the method described here:

http://www.giocc.com/installing-phpunit-on-ubuntu-11-04-natty-narwhal.html

Honestly, I do not understand why this is happening. Something tells me that PHP is listening, that it is giving me the wrong error.

+5
source share
1 answer

Found the answer, quoting me from the comments section:

, , , . , NULL ORM. , , , .

, TIL, , ,

define('NAMESPACE\CONSTANT',        'value');
// or
define(__NAMESPACE__ . '\CONSTANT', 'value'); // to use the current namespace
+1

All Articles