Php:如果没有"先前声明",如何解决"无法重新声明课程"

Oli*_*ons 4 php

我想测试phpDocumentor-alpha,并且有一些人似乎没有问题:

# sudo pear uninstall phpdoc/phpDocumentor-alpha
uninstall ok: channel://pear.phpdoc.org/phpDocumentor-2.0.0a6
olivier@olivier-ubuntu ~/Documents/pizzas/dev # phpdoc --help
bash: /usr/bin/phpdoc: Aucun fichier ou dossier de ce type
# 
# sudo pear install --alldeps -f phpdoc/phpDocumentor-alpha
downloading phpDocumentor-2.0.0a6.tgz ...
Starting to download phpDocumentor-2.0.0a6.tgz (1,107,853 bytes)
..................................done: 1,107,853 bytes
install ok: channel://pear.phpdoc.org/phpDocumentor-2.0.0a6
# phpdoc --help
PHP Fatal error:  Cannot redeclare class phpDocumentor\Plugin\Core\Listener in /usr/share/php/phpDocumentor/src/phpDocumentor/Plugin/Core/Listener.php on line 194

Fatal error: Cannot redeclare class phpDocumentor\Plugin\Core\Listener in /usr/share/php/phpDocumentor/src/phpDocumentor/Plugin/Core/Listener.php on line 194
# 
Run Code Online (Sandbox Code Playgroud)

好的,我可以避免这个问题:

if ( !class_exists('MTIHelperEstadosLocal') ) {...}
Run Code Online (Sandbox Code Playgroud)

但这只是一个丑陋的解决方法.我想知道是否有办法知道声明在哪里(包括或其他).

任何的想法?

Oli*_*ons 9

这是简单的解决方案:

print_r(get_declared_classes());
Run Code Online (Sandbox Code Playgroud)