Hi Marco,

Regarding point #1, I believe the current spec provides for this with
Collections (see
https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md#appendix-a-types
).

Cheers
Robbie

On Sat, 13 Oct 2018 at 4:32 PM, Marco Perone <[email protected]> wrote:

> Hi,
>
> I would like to share some (not very refined) ideas regarding the usage of
> PHPDoc annotations, to see if they can be of any interest. Since I am quite
> a fan of types, they all concern the ability of expressing typing
> information in the documentation.
>
> 1) One desirable feature which is missing from the language is the use of
> generics. It would be nice to provide their usage at the level of
> documentation. This is already possible for arrays with the `[]` notation.
> It would be nice to be able to write something like `Collection<User>` to
> denote that the collection contains `User` objects
>
> 2) Another great limitation in the PHP type system is the impossibility to
> type input and return types of callables. At the moment `callable` is the
> best documentation which can be provided. It would be nice to introduce a
> syntax like `callable: User -> string` to document the actual type of the
> callable.
>
> 3) Define the usage of type variables at the level of documentation. This
> would allow to declare that the types of two different entities are
> related. For example, one could desire to express that two variables need
> to have the same type, or that a callable should receive an input of the
> same type of another variable.
>
> Marco Perone
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "PHP Framework Interoperability Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/php-fig/8984c673-629a-40f1-91f3-0d385a5efddb%40googlegroups.com
> <https://groups.google.com/d/msgid/php-fig/8984c673-629a-40f1-91f3-0d385a5efddb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Robbie Averill | Senior Developer
04 978 7330
http://silverstripe.com/

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/CANv6TC07ngU6a%3DSyjTxbY0Fw8r_ch%3DbpeXsKCFHTfkLD2DtO-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to