prettier / prettier/plugin-php
ugly retif with only false expr and call
Open
Nobody has claimed this yet.
enhancement
ugly
- Dominant language
- PHP
- Stars
- 1.9k
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Description
Prettier 1.14.3
PHP Plugin 0.7.0
Input:
$var = $this->getFromLocalArray(
$attribute,
$lowerRule,
$this->fallbackMessages
) ?: $key;
$var = $this->getFromLocalOnlyArray(
$attribute,
$lowerRule,
$this->fallbackMessages
) ?: $key;
return $this->getFromLocalArray(
$attribute,
$lowerRule,
$this->fallbackMessages
) ?: $key;
Output:
$var =
$this->getFromLocalArray($attribute, $lowerRule, $this->fallbackMessages) ?:
$key;
$var =
$this->getFromLocalOnlyArray(
$attribute,
$lowerRule,
$this->fallbackMessages
) ?:
$key;
return $this->getFromLocalArray(
$attribute,
$lowerRule,
$this->fallbackMessages
) ?:
$key;
Expected behavior:
$var =
$this->getFromLocalArray($attribute, $lowerRule, $this->fallbackMessages) ?:
$key;
$var =
$this->getFromLocalOnlyArray(
$attribute,
$lowerRule,
$this->fallbackMessages
) ?: $key;
return $this->getFromLocalArray(
$attribute,
$lowerRule,
$this->fallbackMessages
) ?: $key;
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the PHP input and comparing the current output with the expected output shown here. Trace the formatter behavior for the ternary and shorthand-ternary expressions, then add coverage if the repository has a relevant test location; done means the second assignment and return match the expected formatting without regressing the first assignment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100