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

PHP formatting improvements #414

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jeffski
Copy link
Contributor

@jeffski jeffski commented Dec 31, 2020

This PR addresses a couple issues, 1 bug and 1 improvement related to the PHP code examples.

When generating documentation, the PHP code example is cut off at the start and in my case looks like this (won't work):

php-missing

With this update it will look like (correct):

php-correct

I think the <?php tag at the start is breaking things, but I think any PHP developer is smart enough to know to add the tag in to their script so it isn't needed.

Also you can see that the code now uses modern array syntax [], available since PHP7, released in 2015. I think support for PHP5 which is EOL can be dropped in favour of the [] syntax.

@jeffski
Copy link
Contributor Author

jeffski commented Dec 31, 2020

I think the request body would be better written as:

// Define array of request body.
$request_body_json = <<<JSON
{{=data.bodyParameter.exampleValues.json}}
JSON;
$request_body = json_decode($request_body_json, true);

However when I use <<< the text seems to be truncated. I need a way to escape the <<< so they are displayed when rendered.

In any case, the improvements I have made are better than the current template so they should be merged as a first step.

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.

1 participant