JsonUtils icon indicating copy to clipboard operation
JsonUtils copied to clipboard

Better PHP types + PHP types in annotations so IDE recognize type correctly

Open dakorpar opened this issue 7 years ago • 2 comments

Instead of:

class BreadCrumbTrailItem
{
    public $associatedFieldName; //object
    public $searchParams; //String
    public $text; //String
    public $type; //String
    public $value; //String
}

we get:

class BreadCrumbTrailItem
{
    /**
     * @var object
     */
    public $associatedFieldName;

    /**
     * @var string
     */
    public $searchParams;

    /**
     * @var string
     */
    public $text;

    /**
     * @var string
     */
    public $type;

    /**
     * @var string
     */
    public $value;

}

which is how it should look like in PHP. File types are also fixed, but it's also not perfect, but far better then it was till now...

dakorpar avatar Jul 25 '17 11:07 dakorpar

You can actually use this to save lines

    /** @var object */
    public $associatedFieldName;

instead of

    /**
     * @var object
     */
    public $associatedFieldName;

earlpeterg avatar Mar 06 '19 08:03 earlpeterg

@earlpeterg that's just a coding style and I prefer multiline phpdoc comments :)

dakorpar avatar Mar 06 '19 08:03 dakorpar