Skip to content

Add comments support in ArrayShapeNode #279

@MordiSacks

Description

@MordiSacks

Feature request

I'm encountering an a problem with dedoc scramble (a automatic swagger generator for laravel).

It parses phpdoc to determine params and response, and with that I can do something like this

<?php
/**
 * List
 *
 * @return array{
 *      data: array<int, array{id: int, name: string}>,
 *      paging: array{
 *          cursors: array{before: string, after: string},
 *          next?: string, // if has next page # this is not parsed
 *      },
 *  }
 */
function getFoo() {
    $foo = loadFoo();
    return $foo;
}

It handles text as descriptions for the various parameters, however, as PHPstan does not parse comments in ArrayShapeNode, this comment is not accessible to be auto generated.
would it be possible to implement this? is it at all sensible?

Thank you

Did PHPStan help you today? Did it make you happy in any way?

PHPstan Is awesome

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions