prettier / prettier/plugin-php
`use` keyword
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1.9k
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Description
If I don't use that keyword, it gives errors with formatting if typing full namespace under an if statement (I think) or only for local namespaces (ServerError is locally in the project)
if ($isAPI && $_SERVER['REQUEST_METHOD'] != 'POST') {
ServerError::METHOD_NOT_ALLOWED->send();
exit(1);
}
if (!$exists) {
ServerError::NOT_FOUND->send();
exit(1);
}
it gives error if:
if ($isAPI && $_SERVER['REQUEST_METHOD'] != 'POST') {
TestPHP\Enums\ServerError::METHOD_NOT_ALLOWED->send();
exit(1);
}
if (!$exists) {
TestPHP\Enums\ServerError::NOT_FOUND->send();
exit(1);
}
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
Reproduce the formatting error with the two PHP snippets, comparing the unqualified ServerError references with the fully qualified TestPHP\Enums\ServerError references inside the if statements. Trace the formatter's handling of these namespace references and ensure both forms are accepted without an error, then verify formatting output for the examples.
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
- 35/100