[Editor's note: that behavior is caused by a bug in PHP 7.0, which has been fixed as of PHP 7.0.7.]
Regarding the entry "Import names cannot conflict with classes defined in the same file".
- I found that since PHP 7.0 this is no longer the case.
In PHP 7.0 you can have a class with a name that matches an imported class (or namespace or both at the same time).
<?php
namespace ns1 {
class ns1 {
public static function write() {
echo "ns1\\ns1::write()\n";
}
}
}
namespace ns1\ns1 {
class ns1c {
public static function write() {
echo "ns1\\ns1\\ns1c::write()\n";
}
}
}
namespace ns2 {
use ns1\ns1 as ns1; class ns1 {
public static function write() {
echo "ns2\\ns1::write()\n";
}
}
ns1::write(); ns1\ns1c::write(); namespace\ns1::write(); }
?>