Skip to content

[10.x] fix Expression string casting#46137

Merged
taylorotwell merged 1 commit intolaravel:10.xfrom
browner12:AB-has-in-database
Feb 16, 2023
Merged

[10.x] fix Expression string casting#46137
taylorotwell merged 1 commit intolaravel:10.xfrom
browner12:AB-has-in-database

Conversation

@browner12
Copy link
Copy Markdown
Contributor

The Expression class no longer provides a __toString() method, so we cannot cast it to a string here.

We'll now use the ->getValue() method and pass the current database connection's query grammar.

#44784

strangely enough, the HasInDatabase::toString() method is only called to get the failure description, but I was getting the unavailable string casting error even without a test failure. this leads me to believe PHPUnit is (sometimes) calling the failureDescription() method even without a failure? Not sure on this.

The `Expression` class no longer provides a `__toString()` method, so we cannot cast it to a string here.

We'll now use the `->getValue()` method and pass the current database connection's query grammar.

laravel#44784
Comment thread src/Illuminate/Testing/Constraints/HasInDatabase.php
@taylorotwell taylorotwell merged commit 35ce656 into laravel:10.x Feb 16, 2023
@browner12 browner12 deleted the AB-has-in-database branch February 16, 2023 16:04
chu121su12 pushed a commit to chu121su12/framework that referenced this pull request Feb 25, 2023
The `Expression` class no longer provides a `__toString()` method, so we cannot cast it to a string here.

We'll now use the `->getValue()` method and pass the current database connection's query grammar.

laravel#44784
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants