Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-5370

Generate abstract method with array return type in PHPDocs

    XMLWordPrintableJSON

Details

    Description

      Please see the example code below. Create a new PHP file in NetBeans and paste the code into it. At each class declaration for Class1, Class2 and Class3, click the 💡 Hint icon and select Implement All Abstract Methods. The issue will become apparent. If PHPDocs has return type specified as eg. return string[], the generated code will be broken.

      <?php declare(strict_types = 1);
      
      namespace Cz\Test\GenerateMethod;
      
      class Class1 extends Base1
      {
      
      }
      
      abstract class Base1
      {
          abstract public function getSingleItem(): string;
      }
      
      class Class2 extends Base2
      {
      
      }
      
      abstract class Base2
      {
          /**
           * @return string[]
           */
          abstract public function getItemsList(): array;
      }
      
      class Class3 extends Base3
      {
      
      }
      
      abstract class Base3
      {
          abstract public function getSingleItem(): string;
      
          /**
           * @return string[]
           */
          abstract public function getItemsList(): array;
      }
      

      Attachments

        Issue Links

          Activity

            People

              junichi11 Junichi Yamamoto
              czukowski Czukowski
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m