TYPO3-Documentation / t3docs-screenshots

Providing a way to take screenshots of the TYPO3 CMS in a scripted way.
MIT License
10 stars 6 forks source link

[FEATURE] Phpdomain rendering for PHP classes #234

Closed linawolf closed 2 years ago

linawolf commented 2 years ago

This way we can automate the Api structure for Event in TYPO3 Explained. Other usages are possible too

Example:

/**
* Some class comment
*/
class MyClass
{
     protected const MY_CONSTANT = 'MY_CONSTANT';

     public string $myVariable = 'myValue';

     public function myMethod(): string
     {
         return 'I am the method code';
     }

   /**
   *    Add a new column or override an existing one. Latter is only possible,
   *    in case $columnName is given. Otherwise, the column will be added with
   *    a numeric index, which is generally not recommended.
   *  @returns Some cool object
  */ 
     public function createMyFirstObject(array $options, int limit = 0): MyFirstClass
     {
         return new MyFirstClass();
     }

     public function createMySecondObject(): MySecondClass
     {
         return new MySecondClass();
     }
}

Members: ["myVariable", "createMyFirstObject"] Output:

.. php:namespace:: Vendor\Extension\MyNamespace\

.. php:class:: MyClass

   Some class comment

   .. php:const:: MY_CONSTANT

        MY_CONSTANT

   .. php:attr:: myVariable

       Value of some attribute

   .. php:method:: createMyFirstObject(string $column, string $columnName = '')

        Add a new column or override an existing one. Latter is only possible,
        in case $columnName is given. Otherwise, the column will be added with
        a numeric index, which is generally not recommended.

        :param array $options: the options
        :param int $limit: Optional: the limit
        :returntype: MyFirstClass
        :returns: Some cool object
susannemoog commented 2 years ago

Do you think it's possible to add the class comment on top of the files? that - at least for the events - usually contains the description what the event is supposed to be used for.

linawolf commented 2 years ago

Oh, right, forgot that one, will work on it!

linawolf commented 2 years ago

@susannemoog the doc comments of the class get displayed now, too