Lighthouse: Fix naming conventions such as 'GraphQL' to 'GraphQl'

Created on 10 Nov 2019  路  6Comments  路  Source: nuwave/lighthouse

In the PHP world and especially in Laravel, it is the convention to write abbreviations like 'HTTP' in namespaces (and by extension classes) as Http. E.g. App\Http\Requests\MyRequest, not App\HTTP\Requests\MyRequest.

I hate to suggest a breaking change, but GraphQL should be renamed to GraphQl. The same applies to methods. So $this->graphQL() in unit tests should become $this->graphQl().

It might not look pretty, but naming standards should be followed. Literally every package I use at the moment follows the PHP standards, but at the moment Lighthouse does not.

discussion

Most helpful comment

Wouldn't Graphql be better? Looks a bit less ugly.

All 6 comments

I'm with you, but I think most of those naming comes from webonyx/graphql-php, so Lighthouse has to be consistent with that package (I THINK!)
Anyways, in the case of namespaces you can configure them in the config, and for tests I just have an alias, so there is no problem at all.

Wouldn't Graphql be better? Looks a bit less ugly.

The official name is GraphQL.

image

If we want to call it Graphql we might as well just keep it as is. However, if we take naming conventions strictly, it's GraphQl.

On the other hand, one could argue that because 'GraphQL' is the name, it is wrong to change the casing. I just don't think that tools such as linters would like it...

Well if we change it, I would prefer 'Graphql'.

In fact - webonyx/graphql-php uses 'GraphQL', and I would let it as is.

Are there any linters that are blaming?

If we are open to change it, I also would prefer Graphql. So far I already have this naming in my projects without problems.

Let's keep it as is, consistency with webonyx/graphql-php and the overall ecosystem is good.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

caizhigang97 picture caizhigang97  路  3Comments

nguyentrongbang picture nguyentrongbang  路  3Comments

sadhakbj picture sadhakbj  路  4Comments

vine1993 picture vine1993  路  3Comments

Leuloch picture Leuloch  路  3Comments