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

(DX) api/v3/examples - Rename *.php to *.ex.php #15310

Merged
merged 4 commits into from
Sep 15, 2019

Conversation

totten
Copy link
Member

@totten totten commented Sep 15, 2019

Overview

The api/v3/examples folder contains a large number of files with the same names (Get.php, Create.php, etc).

If you are in an IDE (or non-trivial text-editor) and wish to jump to a file by name (<hotkey> + Get.php), then the uniqueness of the names becomes a factor in usability (DX).

Before

Ex: If you want to jump to any file named Get.php, the list is very long. It includes ~10 code files and ~68 example files.

Screen Shot 2019-09-15 at 3 02 20 PM

Anecdotally, I never open any of those ~68 files; I do open the others occasionally, and there's no way to filter down the list further. It's awkward picking the one you want.

After

The example files use the extension *.ex.php, which means that you can easily trim-down the list of autocomplete results (Get vs Get.php vs Get.ex).

Screen Shot 2019-09-15 at 3 10 11 PM

Screen Shot 2019-09-15 at 3 10 31 PM

@civibot
Copy link

civibot bot commented Sep 15, 2019

(Standard links)

@civibot civibot bot added the master label Sep 15, 2019
@seamuslee001
Copy link
Contributor

@totten this seems to make sense to me but given that extensions can have their own examples we will probably want to flag this in a change log or similar

@colemanw
Copy link
Member

I feel like the examples were sort of a precursor to the api explorer, which goes further than just presenting a static example by generating the code specific to whatever you're trying to do. I'd be curious to know if anyone actually refers to those example files anymore.
I wasn't planning to do anything similar in api4, as it's documented by the explorer, docblocks, and tests.
Which is all to say, sure lets merge this.

@colemanw colemanw merged commit 04d8165 into civicrm:master Sep 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants