Home » Language IDEs » PHP Development Tools (PDT) » Autocomplete type hinting
| |
Re: Autocomplete type hinting [message #14148 is a reply to message #14131] |
Tue, 17 April 2007 00:10 |
Eclipse User |
|
|
|
Originally posted by: apaz.yahoo.com
I wouldn't think that's a user error. documentation typically goes
before the variable declaration. I would log it at least as an
enhancement (if not a bug).
-a.
Emil Ivanov wrote:
> Many appologies - I just managed to figure it out myself.
>
> The sollution is to add the pphpdoc AFTER the variable. I was used to
> PHPed's convention, which requires me to add it before the var.
> I'm sorry, again, for the flood.
>
> Take care and keep up the good work!
>
> "Emil Ivanov" <emil.vladev@gmail.com> wrote in message
> news:f00ojf$efv$1@build.eclipse.org...
>> Hi,
>>
>> I've been using PDT/Xdebug for a while and I find it really good.
>>
>> One thing I'm not geting, though - I have some method returning an
>> object - on the new var I don't get autocomplete, because it doesn't know
>> its type. I tried hinting it using phpdoc, but it doesn't seem to work.
>>
>> Any help would be appreciated.
>>
>> Regards,
>> Emil Ivanov
>>
>
>
|
|
| |
Re: Autocomplete type hinting [message #14234 is a reply to message #14200] |
Tue, 17 April 2007 14:37 |
exceptione Messages: 96 Registered: July 2009 |
Member |
|
|
I think this is a bug. You should therefore not list this as an enhancement
request. Once this bug is fixed, you need to change all your variable
documentation. In addition, php documentation tools won't process comments
below variables. This is critical, if not blocker!
"Emil Ivanov" <emil.vladev@gmail.com> schreef in bericht
news:f025ib$kdq$1@build.eclipse.org...
> Logged as an echantment request:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=182693
>
> "Andres Paz" <apaz@yahoo.com> wrote in message
> news:4624105F.6050008@yahoo.com...
>>I wouldn't think that's a user error. documentation typically goes before
>>the variable declaration. I would log it at least as an enhancement (if
>>not a bug).
>>
>> -a.
>>
>> Emil Ivanov wrote:
>>> Many appologies - I just managed to figure it out myself.
>>>
>>> The sollution is to add the pphpdoc AFTER the variable. I was used to
>>> PHPed's convention, which requires me to add it before the var.
>>> I'm sorry, again, for the flood.
>>>
>>> Take care and keep up the good work!
>>>
>>> "Emil Ivanov" <emil.vladev@gmail.com> wrote in message
>>> news:f00ojf$efv$1@build.eclipse.org...
>>>> Hi,
>>>>
>>>> I've been using PDT/Xdebug for a while and I find it really good.
>>>>
>>>> One thing I'm not geting, though - I have some method returning an
>>>> object - on the new var I don't get autocomplete, because it doesn't
>>>> know its type. I tried hinting it using phpdoc, but it doesn't seem to
>>>> work.
>>>>
>>>> Any help would be appreciated.
>>>>
>>>> Regards,
>>>> Emil Ivanov
>>>>
>>>
>
|
|
|
Re: Autocomplete type hinting [message #14249 is a reply to message #14234] |
Tue, 17 April 2007 16:01 |
Christian Müller Messages: 9 Registered: July 2009 |
Junior Member |
|
|
Exception e schrieb:
> I think this is a bug.
I dont't think of it as a Bug.
> In addition, php documentation tools won't process comments
> below variables.
It's not a bug, since these Code-Hints are not PHPDocs.
The correct syntax (as stated in PDT's help) is:
/* @var $Foo MyFoo */
This ist just a comment, not a PHPDoc.
You can use /**, but that's just optional and in respect to a
documentation tool plain wrong, IMHO.
I can't think of a documentation tool, that would make good use of such
a PHPDoc regardless of it's position compared to the hinted variable.
Since these variables are not in any structured position within the
code, but somewhere a documentation tool wouldn't expect a PHPDoc anyway.
>
> "Emil Ivanov" <emil.vladev@gmail.com> schreef in bericht
> news:f025ib$kdq$1@build.eclipse.org...
>> Logged as an echantment request:
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=182693
>>
>> "Andres Paz" <apaz@yahoo.com> wrote in message
>> news:4624105F.6050008@yahoo.com...
>>> I wouldn't think that's a user error. documentation typically goes before
>>> the variable declaration. I would log it at least as an enhancement (if
>>> not a bug).
>>>
>>> -a.
>>>
>>> Emil Ivanov wrote:
>>>> Many appologies - I just managed to figure it out myself.
>>>>
>>>> The sollution is to add the pphpdoc AFTER the variable. I was used to
>>>> PHPed's convention, which requires me to add it before the var.
>>>> I'm sorry, again, for the flood.
>>>>
>>>> Take care and keep up the good work!
>>>>
>>>> "Emil Ivanov" <emil.vladev@gmail.com> wrote in message
>>>> news:f00ojf$efv$1@build.eclipse.org...
>>>>> Hi,
>>>>>
>>>>> I've been using PDT/Xdebug for a while and I find it really good.
>>>>>
>>>>> One thing I'm not geting, though - I have some method returning an
>>>>> object - on the new var I don't get autocomplete, because it doesn't
>>>>> know its type. I tried hinting it using phpdoc, but it doesn't seem to
>>>>> work.
>>>>>
>>>>> Any help would be appreciated.
>>>>>
>>>>> Regards,
>>>>> Emil Ivanov
>>>>>
>
>
|
|
| |
Re: Autocomplete type hinting [message #15125 is a reply to message #15101] |
Wed, 18 April 2007 09:39 |
Christian Müller Messages: 9 Registered: July 2009 |
Junior Member |
|
|
Piotr Szczepanik schrieb:
> Emil Ivanov wrote:
>> The sollution is to add the pphpdoc AFTER the variable. I was used to
>> PHPed's convention, which requires me to add it before the var.
>> I'm sorry, again, for the flood.
>
> Hello Emil,
> As I understand you are trying to hint a variable's type.
> Why not trying to hint the function's return type through PHPDoc? Like
> that:
>
> /**
> * Short description
> *
> * @return companyClass
> */
> function createCompany() {
> ...
> return new companyClass();
> }
>
> Using this:
> $company = createCompany();
>
> I get a perfectly working code completion for companyClass' methods.
> Of course companyClass' definition must be within the same project or
> within the project or folder in "PHP Include Path" defined in Eclipse PDT.
Hi Piotr,
you are perfectly correct. This is a) working for TypeHinting and b)
correctly parsable PHPDoc
But look at this construct (derived from yours):
/**
* Short description
*
* @return companyClass
*/
function createCompany() {
...
return array(new companyClass(), new companyClass(), ...);
}
Using this:
$companies = createCompany();
foreach ($companies as $company)
{
/* @var $company companyClass */
$company->
}
Here you would have no TypeHinting, if you leave out the /* @var.
You need to add this Comment after the definition of $company.
If you would add it before the definition, PDT would use some logic to
determine the Type of the variable and override your comment.
> Best regards,
> Piotr Szczepanik
|
|
| | | | |
Goto Forum:
Current Time: Fri Jan 24 15:28:06 GMT 2025
Powered by FUDForum. Page generated in 0.03326 seconds
|