"glyphicons.com" did not exist on "main"
[BUG][php-symfony] phpLegacySupport=false does not seem to generate strongly typed code
Created by: rbaarsma
Bug Report Checklist
Description
When using the option phpLegacySupport=false
, I expect type hinting to be generated in all files, but sadly it isn't. From a quick look at https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java#L346 I deduced that there should be type hinting when legacy support is disabled. Haven't looked very deeply.
openapi-generator version
Latest docker, used this command:
docker run --rm \
-v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i /local/doc/swagger.yml \
-g php-symfony \
-o /local/src/Swagger
--additional-properties phpLegacySupport=false
OpenAPI declaration file content or url
swagger: '2.0'
info:
title: Test
paths:
/esbm/nesting:
get:
tags:
- esbmodel
summary: Get nestings
parameters:
- in: query
name: limit
type: integer
required: false
- in: query
name: q
type: string
required: false
responses:
'200':
description: successful operation
schema:
type: object
properties:
total:
type: integer
data:
type: array
items:
$ref: '#/definitions/Nesting'
security:
- esb_auth: []
definitions:
Nesting:
type: object
properties:
id:
type: string
readOnly: true
_created_at:
type: string
format: date-time
_updated_at:
type: string
format: date-time
name:
type: string
job_number:
type: string
sequence_number:
type: integer
##### Command line used for generation
(see above under "openapi-generator version")
##### Steps to reproduce
simply run the command with the given swagger definition. Generates nicely, but no type hinting.
##### Related issues/PRs
none found
##### Suggest a fix
typehint all function arguments and return types. Properly use ex. `?string` when types are nullable.
Best is to also generate `declare(strict_types=1);` on every file.