OpenAPITools / OpenAPITools/openapi-generator
[REQ] PHP Client/Server class property types
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
Currently, PHP 7.4 has support for typed properties (see this RFC: https://wiki.php.net/rfc/typed_properties_v2). I think we should support this behind a feature flag.
Describe the solution you'd like
Add types to class properties, as we have them already as method arguments.
Additional context
This could be added for the following generators:
- clients
- php (Guzzle)
- servers
- PHP Laravel
- PHP Lumen
- PHP Slim
- PHP Symfony
- PHP Zend Expressive (with Path Handler)
I could create this functionality for the Symfony Server if this is wanted, for the others I would hope others could contribute to this.
As an example, the current model output for the PHP Symfony server is:

What it could become afterward:

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the PHP client and server generators listed in the issue, along with how method argument types and feature flags are currently handled. Done means typed class properties can be generated behind a feature flag for the requested PHP generators, including Guzzle, Laravel, Lumen, Slim, Symfony, and Zend Expressive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100