Proxy generator messed with PHP7 void return type hint #5342

Closed
opened 2026-01-22 15:05:04 +01:00 by admin · 4 comments
Owner

Originally created by @vpArth on GitHub (Dec 6, 2016).

Originally assigned to: @Ocramius on GitHub.

Proxy generator generate followed code:

public function setStatus(string $status) : void
{
  $this->__initializer__ && $this->__initializer__->__invoke($this, 'setStatus', [$status]);
  return parent::setStatus($status);
}

return statement should be omitted if void return typehint presented.

It should be just parent::setStatus($status); without return


workaround is not to use void return typehint

Originally created by @vpArth on GitHub (Dec 6, 2016). Originally assigned to: @Ocramius on GitHub. Proxy generator generate followed code: ```php public function setStatus(string $status) : void { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setStatus', [$status]); return parent::setStatus($status); } ``` `return` statement should be omitted if `void` return typehint presented. It should be just `parent::setStatus($status);` without `return` ___ workaround is not to use `void` return typehint
admin added the Duplicate label 2026-01-22 15:05:04 +01:00
admin closed this issue 2026-01-22 15:05:04 +01:00
Author
Owner

@lcobucci commented on GitHub (Dec 6, 2016):

Which version of doctrine/common are you using? This was fixed on 2.7.x

On Tue, 6 Dec 2016, 19:16 Alexander Deider, notifications@github.com
wrote:

Proxy generator generate followed code:

public function setStatus(string $status) : void{ $this->initializer && $this->initializer->__invoke($this, 'setStatus', [$status]); return parent::setStatus($status);}

return statement should be omitted if void return typehint presented.

It should be just parent::setStatus($status); without return

workaround is not to use void return typehint


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/6163, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAMU64pMmhAMD-DWrJqEy-rX_Sl3fzkHks5rFaZygaJpZM4LFuTn
.

@lcobucci commented on GitHub (Dec 6, 2016): Which version of doctrine/common are you using? This was fixed on 2.7.x On Tue, 6 Dec 2016, 19:16 Alexander Deider, <notifications@github.com> wrote: > Proxy generator generate followed code: > > public function setStatus(string $status) : void{ $this->__initializer__ && $this->__initializer__->__invoke($this, 'setStatus', [$status]); return parent::setStatus($status);} > > return statement should be omitted if void return typehint presented. > > It should be just parent::setStatus($status); without return > ------------------------------ > > workaround is not to use void return typehint > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <https://github.com/doctrine/doctrine2/issues/6163>, or mute the thread > <https://github.com/notifications/unsubscribe-auth/AAMU64pMmhAMD-DWrJqEy-rX_Sl3fzkHks5rFaZygaJpZM4LFuTn> > . >
Author
Owner

@Ocramius commented on GitHub (Dec 6, 2016):

@vpArth void is currently only supported if you run with doctrine/common 2.7.*. Upgrading the dependency here will be done soon.

@Ocramius commented on GitHub (Dec 6, 2016): @vpArth `void` is currently only supported if you run with `doctrine/common` `2.7.*`. Upgrading the dependency here will be done soon.
Author
Owner

@vpArth commented on GitHub (Dec 6, 2016):

Glad to hear that.
I'm unhappily using doctrine as a part of symfony3.2, which uses doctrine/orm@v2.5.5/doctrine/common@<2.7-dev

@vpArth commented on GitHub (Dec 6, 2016): Glad to hear that. I'm unhappily using doctrine as a part of symfony3.2, which uses `doctrine/orm@v2.5.5`/`doctrine/common@<2.7-dev`
Author
Owner

@Ocramius commented on GitHub (Dec 6, 2016):

Closing as duplicate of #6156

@Ocramius commented on GitHub (Dec 6, 2016): Closing as duplicate of #6156
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5342