Why return an object ElementMissing instead of throwing an ElementMissingException?
Open
Nobody has claimed this yet.
bug
question
- Dominant language
- PHP
- Stars
- 2.7k
- Forks
- 579
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
I am debugging an "Missing encoding data for: """ and I noticed something that maybe is wrong...
Should Header->get($name) return an object of ElementMissing instead of throwing something like ElementMissingException?
/**
* @param string $name
*
* @return Element|PDFObject
*/
public function get($name)
{
if (\array_key_exists($name, $this->elements)) {
return $this->resolveXRef($name);
}
return new ElementMissing();
}
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 with the Header->get($name) method and its ElementMissing return path, then trace the missing-encoding case described in the report. Compare the current behavior with the proposed exception-based contract; done requires a decided, documented behavior and confirmation that the affected lookup path handles missing elements consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100