We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug No suggestions available for class with ArrayAccess returning object using Square brackets
Describe the eclipse environment Eclipse PDT 8.1.0.202307051059
To Reproduce Steps to reproduce the behavior:
#!/usr/bin/php <?php class ArrayNewObject { public $prop; public function __construct($prop) { $this->prop = $prop; } } class ArrayNewObjectCollection implements ArrayAccess { private $members; /** * * {@inheritdoc} * @see ArrayAccess::offsetGet() */ public function offsetGet(mixed $offset): ?ArrayNewObject { if (isset($this->members[$offset])) { return $this->members[$offset]; } else { return null; } } public function offsetExists(mixed $offset): bool {} public function offsetUnset(mixed $offset): void {} public function offsetSet(mixed $offset, mixed $value): void { $this->members[$offset] = $value; } } $array_new_collection = new ArrayNewObjectCollection(); $array_new_collection['my_key_1'] = new ArrayNewObject('Hello'); $array_new_collection['my_key_2'] = new ArrayNewObject('World'); echo 'Short array access: ' . $array_new_collection['my_key_1']->prop . " " . $array_new_collection['my_key_2']->prop . PHP_EOL; echo 'Method array access: ' . $array_new_collection->offsetGet('my_key_1')->prop . " " . $array_new_collection->offsetGet('my_key_2')->prop . PHP_EOL; //$array_new_collection['my_key_1']->
Expected behavior Suggestion: $array_new_collection['my_key_1']->prop
The text was updated successfully, but these errors were encountered:
For now PDT not always understand arrayaccess interface. Marking as an enhancement.
Sorry, something went wrong.
No branches or pull requests
Describe the bug
No suggestions available for class with ArrayAccess returning object using Square brackets
Describe the eclipse environment
Eclipse PDT 8.1.0.202307051059
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Suggestion: $array_new_collection['my_key_1']->prop
The text was updated successfully, but these errors were encountered: