zendframework / zend-soap

Soap component from Zend Framework
BSD 3-Clause "New" or "Revised" License
75 stars 43 forks source link

Improve docblock to pick up namespace in Parser as well as class, or at least add it to the docs. #51

Open NoMan2000 opened 6 years ago

NoMan2000 commented 6 years ago

The docs do not contain any warnings about this problem, which makes it annoying to debug. The error occurs when using anything in a namespace. PHPs typical way of dealing with this is to add the (overused) use statement to the top with the namespace and the class.

However, Zend\Soap\AutoDiscover does not pick up that use statement and instead only uses the classname.

<?php

use myNameSpace\MyClass;

class Foo
{
    /**
     * @var MyClass
     */ 
    public $customer;
}

That fails. When Zend parses it, it will not parse the namespace, just the classname "MyClass", and then fail.

For it to work, it must be done like this:

<?php

class Foo
{
    /**
     * The backspace qualifier is only necessary if this is namespaced.
     * @var \myNameSpace\MyClass
     */ 
    public $customer;
}

A code fix is probably above and beyond, but some docs highlighting that problem would help.

weierophinney commented 4 years ago

This repository has been closed and moved to laminas/laminas-soap; a new issue has been opened at https://github.com/laminas/laminas-soap/issues/8.