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

Whats with the formatting of PHP samples?? #143

Open
uuf6429 opened this issue Jul 15, 2023 · 0 comments
Open

Whats with the formatting of PHP samples?? #143

uuf6429 opened this issue Jul 15, 2023 · 0 comments
Assignees

Comments

@uuf6429
Copy link

uuf6429 commented Jul 15, 2023

Let's take a look at this one: https://github.com/googleworkspace/php-samples/blob/main/sheets/snippets/src/SpreadsheetBatchUpdate.php

A blind person could have formatted that code better.

On top of that, there are several other problems:

  1. sometimes the samples have a PHP closing tag (?>)... which is totally pointless and increases the risk of bugs with trailing space
  2. dependencies are loaded in the end of the samples... it is common practice to have require "<the autoloader>"; at the beginning
  3. Exceptions are handled badly, by printing the exception message only - totally missing the stacktrace, which is sometimes even more important than just the message. Additionally, I don't know why it needs to handle exceptions in the first place - unhandled exceptions are always printed out.
  4. The samples are using a mixture of old non-namespaced classes, and newer ones...please decide and keep it consistent.

But the formatting is the biggest problem.. I'm already having a hard time jumping between browser tabs trying to figure out things from references, guides, stackoverflow and so on. Having to go through unreadable code on top feels unnecessary.

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

No branches or pull requests

2 participants