Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of support for new PHP7 typing features #4

Merged
merged 6 commits into from
Sep 22, 2020

Conversation

ricardopedias
Copy link
Contributor

Corresponding to issue #3

  1. Enabling code generation with type hints;
  2. Options to adapt the generated code to PSR 1, 2 and 12;
  3. Option to choose PHPDoc notation type for typing non-empty arrays

model-example.zip

@nahakiole
Copy link
Owner

Thank you, this is quite the big pull request
I will have a look at it tomorrow, but on the first viewing everything looks great.

@ricardopedias
Copy link
Contributor Author

It's ok. I hope the implementation will help the project

@@ -119,6 +139,13 @@ class PHPCodeGenerator {
fullPath = basePath + '/' + elem.name + '.php';
codeWriter = new codegen.CodeWriter(this.getIndentString(options));
codeWriter.writeLine("<?php");

if (options.useStrictTypes === true) {
codeWriter.writeLine("");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was repeated code before, but with adding more I would either try to get the repeated code into a function or check if it is either a UMLClass, UMLInterface or UMLEnumeration and then output the common header. That would be an improvement, but functionally everything looks great 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As soon as I have some time, I make some improvements to adjust this. Glad it was useful. 👍

Copy link
Owner

@nahakiole nahakiole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment I made can be fixed later and would just be a bit nicer, but overall it looks very clean 👍
Thank you again for fixing the issue.

@nahakiole nahakiole merged commit c3ccfb3 into nahakiole:master Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants