I know it does not really belong in this subforum, but I did not find a better one.
I am considering fixing/extending some things in apidoc.
Despite it’s basically just a Yii-Thing, it’s currently one of the nicest generators.
I am not sure if I really have time to do everything (it’s just an attempt), but what’s the best approach to contribute?
Is it OK if I just enter a issue in bugtracker (without much details - just as a reference), create a branch named bug-xxxx and then make a pull request for the branch?
The main things I noticed so far is:
Current 2.1 does not work with PHP 7.1 nullable (?) returns (parser error). But this problem is gone when using 4.0 reflector
Types are ignored in documentation. It seems it just says “void” then
{@inheritDoc} shows {@inheritDoc} (at least with reflector 4.0)
And a few other things.
And it would also be nice to make it a bit more generally usable - e.g having a way to specify “extensions”. It could be even better be used for 3rdparty-stuff if apidoc did not just handle known official extensions as extensions, but having a way to specify “packages” somewhere in a configuration/parameter, so documentation can be split up.
But anyway: I cannot promise that I come far with these changes anyway (did not really analyze the real necessary effort). But I have a bit time left to try.
It is fine to just jump into it. apidoc is mainly creation of @cebe and he’s busy right now but I think myself and him will be able to answer questions if any.
Yes. apidoc is really a nice tool. If it was a bit more “open” it could be even more usable for extension/component developers and also for internal project documentation.
@AndreasP How can you install phpdocumentor/reflection 4.0 along with a Yii 2 application? Composer complains “Your requirements could not be resolved to an installable set of packages.” if I try it.
My modified version already works (quite) well with reflection 4 but it’s not a trivial change.
Internally phpdocumentor has completely changed it’s API. I use the approach “change as little as possible in apidoc, but as much as necessary”. Just changing composer requires unfortunately do not do the job.
Once I have the current functionality completely running again my plans are:
Add support for variadics
Add support for declared return types (I am going to merge them with the types specified in @return). My plan is to “change” the assumptions of phpdocumentor a bit: Currently apidoc assumes “void” if no @return is specified, but phpdocumentor assumies “Mixed”. So I am going to treat “mixed” reported by reflection as “void” unless it’s specified with in a @return tag.
Support for @property. Currently it automatically generates the properties from getXxxx and setXxxx methdos if the class is a subclass of BaseObject (which is a good thing). But additionally it should support properties just declared by @property.
It’s still a bit buggy. The differences between in the reflection are big.
And a little rant about the now trendy “close classes”:
The new library version contains a lot of “final” stuff. It has places to hook in to customize, but there are not that many and a lot of stuff needs either copy&paste implementations or wrapper-classes.
Looking at it from the library user POV this pattern really turns into a develoopment nitemare quickly if just a litte detail needs to be extended, but there is nothing to hook in.