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
Fix mocking classes with new
initializers in method and attribute params on PHP 8.1
#1301
Fix mocking classes with new
initializers in method and attribute params on PHP 8.1
#1301
Conversation
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
new
initializers in method and attribute params on PHP 8.1
// "Parameter #1 [ <optional> F\Q\CN $a = new \F\Q\CN(param1, param2: 2) ] | ||
preg_match( | ||
'#<optional>\s.*?\s=\snew\s(.*?)\s]$#', | ||
$param->__toString(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not intended to ever call __toString()
directly. This should be a cast instead ((string)$param
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Bilge I agree,
However the reason for using __toString()
instead was because $param
is actually an object that is proxying these calls via __call
method to the ReflectionParameter
which was giving an error because the __toString
expects a string return type.
public function __call($method, array $args) |
Resolves #1300
Released https://github.com/mockery/mockery/releases/tag/1.6.3