swagger-api / swagger-api/swagger-codegen

[lang php] incorrect return type in PHPDoc rot arrays of objects

Open
#10,553 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Generated code:

    /**
     * Gets sessions
     *
     * @return map[string,\Model\Session]
     */
    public function getSessions()
    {
        return $this->container['sessions'];
    }

But PHPDoc don't support map[string,\Model\Session] format. Need use \Model\Session[] instead.

https://docs.phpdoc.org/3.0/guide/guides/types.html

Swagger-codegen version

swagger-codegen-cli-3.0.22.jar

Swagger declaration file content or url
Command line used for generation
docker run --rm -v ${PWD}:/local -w /local openjdk java -jar swagger-codegen-cli.jar generate --input-spec /local/openapi.yaml --lang php --output /local/out/ -c /local/openapi-codegen-php.json
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the PHP generator or template that emits @return annotations, then reproduce the report with the supplied Docker command and a matching OpenAPI input. Done means generated PHPDoc uses PHPDoc-compatible array-of-object syntax instead of map[string,Model\Session], with relevant generator tests updated or added if they exist.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, php
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.