Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

ZendCode, class generator doesn't generate 'implements interface' correctly when interface is separate namespace #6320

Closed
Danack opened this issue May 23, 2014 · 2 comments

Comments

@Danack
Copy link

Danack commented May 23, 2014

When a class generator is told the output class should implement an interface that exists in a separate namespace to the one the class is in, the implements interface is missing a slash.

<?php



require_once __DIR__ . '/./library/Zend/Loader/ClassMapAutoloader.php';
$loader = new Zend\Loader\ClassMapAutoloader();
//$loader->registerAutoloadMap(__DIR__ . '/./library/Zend/.classmap.php');
$loader->registerAutoloadMap(__DIR__ . '/./library/autoload_classmap.php');
$loader->register();

use Zend\Code\Reflection\ClassReflection;
use Zend\Code\Generator\ClassGenerator;



$classGenerator = new ClassGenerator();
$classGenerator->setName('OutputClass');
$classGenerator->setNamespaceName('SecondNamespace');
$classGenerator->setImplementedInterfaces(['FirstNamespace\SomeInterface']);
$text = $classGenerator->generate();
echo $text;


Expected output:

namespace Third;

class OutputClass implements \First\SomeInterface
{


}

Actual output:

namespace Third;

class OutputClass implements First\SomeInterface
{


}

@Ocramius
Copy link
Member

Looks like a duplicate of #4151

@GeeH
Copy link

GeeH commented Jun 27, 2016

This issue has been closed as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html

@GeeH GeeH closed this as completed Jun 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants