doctrine / couchdb-odm

A Document Mapper based on CouchDB
http://www.doctrine-project.org
MIT License
150 stars 53 forks source link

Updated ProxyFactory to generate proxies compatible with PHP 7 TypeHint #154

Open vermi0ffh opened 5 years ago

vermi0ffh commented 5 years ago

Actual ProxyFactory don't works well with PHP7 type hint et return type.

Examples :

public function getId(): ?string { return $this->id; }

Old generator gives : public function getId() { $this->__load(); return parent::getId(); }

This lead to a compilation error because getId() is not compatible with he original getId() (no return type).

With this patch, the result is : public function getId(): ?string { $this->__load(); return parent::getId(); }

No more compilation error. It's backward compatible with the existing code and PHP < 7 (not tested).

vermi0ffh commented 4 years ago

Any plan to merge this pull request one day ?