Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 178103 - [68cat] Wrong code genaration from interface
[68cat] Wrong code genaration from interface
Product: php
Classification: Unclassified
Component: Editor
All All
: P2 (vote)
: 6.x
Assigned To: rmatous
Depends on:
  Show dependency treegraph
Reported: 2009-12-03 13:32 UTC by ingoreinhart
Modified: 2010-01-27 07:27 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT


Note You need to log in before you can comment on or make changes to this bug.
Description ingoreinhart 2009-12-03 13:32:04 UTC

I found lately one big error.

Given this interface:
interface PHPInterface {
     * @param string $input
    public function myfunc($input);


Look at the @param line!

If you now autogenerate a php function for myfunct the result looks like:
class PHPClass implements PHPInterface {
    public function myfunc(string $input) {

The result is a PHP parse error because string (in the method signature) is not allowed.
Comment 1 Petr Jiricka 2009-12-03 15:26:24 UTC
Hi, so if I understand this correctly, the workaround is to change the generated code by hand, right?
Comment 2 ingoreinhart 2009-12-03 23:33:23 UTC

Yes, and that 100 times a day. PHP is not typesave - so allmost string needs to be decleard in docblock.

Comment 3 rmatous 2009-12-04 01:18:41 UTC
Unpleasant, on the other hand I think P2 is more appropriate here. Will be fixed ASAP
Comment 4 Petr Jiricka 2009-12-04 01:33:26 UTC
Changing to P2 and marking as a patch candidate.
Comment 5 rmatous 2009-12-04 08:12:41 UTC
Also, this piece of code is wrong and needs to be fixed:
interface PHPInterface {
     * @param PHPInterface $input
    public function myfunc($input);


class PHPClass implements PHPInterface {
    public function myfunc(PHPInterface $input) {

Declaration in subclass needs to be compatible. Type taken from PhpDoc cannot be used for generating/overriding method in subclass.
Comment 6 rmatous 2009-12-04 09:43:43 UTC
Fixed in trunk:
Comment 7 Quality Engineering 2009-12-05 14:33:32 UTC
Integrated into 'main-golden', will be available in build *200912051400* on (upload may still be in progress)
User: Radek Matous <>
Log: #178103 - Wrong code genaration from interface
Comment 8 ingoreinhart 2009-12-06 06:07:45 UTC
Test with Build 200912060200 => all OK!

Many thanks for the fast responce!
Comment 9 Filip Zamboj 2009-12-07 05:52:47 UTC
reopening because we need to close this as verified to integrate to patch1 later. (and closed fixed doesn't give me chance go back to verified ;) )
Comment 10 Filip Zamboj 2009-12-07 05:53:54 UTC
closing as resolved fixed again
Comment 11 Filip Zamboj 2009-12-07 05:56:04 UTC
Product Version: NetBeans IDE Dev (Build 091207-11903a3229df)
Java: 1.5.0_17-ea; Java HotSpot(TM) 64-Bit Server VM 1.5.0_17-ea-b01
Comment 12 Jiri Kovalsky 2009-12-08 08:42:48 UTC
Reported by NetCAT 6.8 participant.
Comment 13 pgebauer 2009-12-16 07:03:21 UTC
The fix has been ported into the release68_fixes repository.
Comment 14 Filip Zamboj 2010-01-27 07:27:52 UTC
verified in 
Product Version: NetBeans IDE 6.8 (Build 201001261800)
Java: 1.6.0_16; Java HotSpot(TM) 64-Bit Server VM 14.2-b01

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo