phpDocumentor / fig-standards

Standards either proposed or approved by the Framework Interop Group
http://www.php-fig.org/
Other
361 stars 85 forks source link

Qualified and unqualified type-declarations #161

Closed mindplay-dk closed 5 years ago

mindplay-dk commented 5 years ago

Since this work on the BNF and over the period of this PSR standing still, use of qualified and unqualified (rather than fully-qualified) type-declarations have become commonplace in codebases everywhere.

IDE and tool support is there.

So I think we need to expand the definition of type-declarations to include qualified and unqualified type-declarations, including resolution rules as prescribed by PHP itself.

Merely allowing fully-qualified references to structural elements at this point seems insufficient?

neuro159 commented 5 years ago

When namespaces were added to PHP we had a huge incident with Symfony migrating to namespaces and NOT adding leading slash to any of PHPDOC FQNs. Thousand users reported PhpStorm not supporting namespaces properly.... Fortunately our strong "NOPE ITS THEM, AND WE WON'T SUPPORT NONDETERMINISTIC NAME RESOLUTION EVER" [global function lookup is more than enough :(] made our users push on sensiolabs and they fixed it. AFAIK there is no such cases out there and(==because) all tools support only "resolution rules as prescribed by PHP itself". So no real issue, but having this in spec may be nice.

ashnazg commented 5 years ago

@neuro159 , are you meaning the spec should specify "fully qualified is required... relative/unqualified is not allowed" ?

ashnazg commented 5 years ago

ABNF changes are now in PR #162

neuro159 commented 5 years ago

Rules in docs shall be the same as in code ==> all relative names used in docs shall have proper imports. Took a lot to convince everyone but fortunately, its de facto a standard, so let's write it down.

ashnazg commented 5 years ago

@neuro159 ok, now I'm following you.

ashnazg commented 5 years ago

@mindplay-dk , please bring this up as a new thread on the FIG mailing list for discussion -- https://groups.google.com/forum/#!forum/php-fig