Skip to content
New issue

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

ProxyGenerator turns double quoted default values into single quoted default values #987

Closed
ampaze opened this issue Sep 27, 2022 · 5 comments · Fixed by #989
Closed

ProxyGenerator turns double quoted default values into single quoted default values #987

ampaze opened this issue Sep 27, 2022 · 5 comments · Fixed by #989
Labels
Milestone

Comments

@ampaze
Copy link

ampaze commented Sep 27, 2022

Using PHP 8.1 and doctrine/common 3.4.1

the method in my entity

public function formatAsString(string $rowDelim = "\n"): string
{
}

is turned in to

public function formatAsString(string $rowDelim = '\n'): string
{
}

in the proxy.


Fyi:

This is the version that 3.3.1 generates

public function formatAsString(string $rowDelim = '
'): string
{
}
@malarzm
Copy link
Member

malarzm commented Sep 27, 2022

This might be a bug in how PHP is generating default values as 3.4.x started to relying on that. I'll try to have it reproduced later

@malarzm malarzm added the Bug label Sep 27, 2022
@malarzm malarzm added this to the 3.4.2 milestone Sep 27, 2022
@nicolas-grekas
Copy link
Member

This looks like a PHP issue to me, I opened php/php-src#9622
There might be a workaround, to be discovered.

@malarzm
Copy link
Member

malarzm commented Sep 27, 2022

@ampaze as a workaround you could define your method like this:

public function formatAsString(string $rowDelim = \PHP_EOL): string
{
}

referencing global consts is working good enough with 3.4.1

@stof
Copy link
Member

stof commented Sep 28, 2022

@malarzm \PHP_EOL is not the same than "\n" though

@malarzm
Copy link
Member

malarzm commented Sep 28, 2022

@stof you're right,I thought it was just "good enough" to mention :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants