Skip to content

PHP formatting improvements#414

Open
jeffski wants to merge 4 commits into
Mermade:mainfrom
jeffski:php-formatting-improvements
Open

PHP formatting improvements#414
jeffski wants to merge 4 commits into
Mermade:mainfrom
jeffski:php-formatting-improvements

Conversation

@jeffski

@jeffski jeffski commented Dec 31, 2020

Copy link
Copy Markdown
Contributor

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

jeffski commented Dec 31, 2020

Copy link
Copy Markdown
Contributor Author

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