<?php
namespace Foo\Bar;
class A
{
}
class B
{
public function __construct($type)
{
$fullType = 'Foo\\Bar\\' . $type;
new $fullType;
new $type;
}
}
new A;
new B('A');
Fatal error: Uncaught Error: Class "A" not found in /in/JpYgN:17
Stack trace:
#0 /in/JpYgN(22): Foo\Bar\B->__construct('A')
#1 {main}
thrown in /in/JpYgN on line 17
Process exited with code 255.
Fatal error: Uncaught Error: Class 'A' not found in /in/JpYgN:17
Stack trace:
#0 /in/JpYgN(22): Foo\Bar\B->__construct('A')
#1 {main}
thrown in /in/JpYgN on line 17
Process exited with code 255.