Plugin-php: Convert die to exit?

Created on 20 Feb 2018  路  7Comments  路  Source: prettier/plugin-php

After resolve https://github.com/glayzzle/php-parser/issues/117 we can output die and exit. Should we output always exit as good pretty practice or not?

needs investigation

Most helpful comment

@czosel maybe you are right, let's issue open, and ask community about this:

  • :+1: for exit
  • :-1: for die
  • :heart: don't convert

All 7 comments

I wouldn't convert one alias to the other. I didn't find any styleguide that prefers one over the other.

@czosel maybe you are right, let's issue open, and ask community about this:

  • :+1: for exit
  • :-1: for die
  • :heart: don't convert

What I find great about prettier when it comes to javascript is that it removes or at least greatly reduces ambiguity about formatting etc. PHP in itself has failed to _keep it simple_ by having more than one way of doing it. The prettier plugin has the chanse to "fix" this.

I don't care much if it's exit or die I just feel that if ambiguity and abstraction noise can be reduced it should.

Apparently there are a few more built in functions with aliases. http://php.net/manual/en/aliases.php

One possibility could be to add an option about persisting aliases, but if so I'm still in favor of replacing the aliases as the default.

In my opinion it's not the prettier's job to replace developer choices.
It's here just to format code.

@mathieutu thanks for response, just vote :smile:

I think we can close this issue, because we don't convert by default. Use phpcs to disable usage exit or die in your code base

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexander-akait picture alexander-akait  路  5Comments

nikulis picture nikulis  路  5Comments

czosel picture czosel  路  6Comments

Epskampie picture Epskampie  路  4Comments

ichiriac picture ichiriac  路  3Comments