-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Objects with __toString() can be asserted.
In a recent change, some regex matches changed to stripos() calls. The problem is that stripos() converts the needle parameter to int if it is not a string. While objects having __toString() can be converted into string by most of the internal PHP functions, they cannot be converted to int, resulting in an error.
- Loading branch information
Showing
3 changed files
with
51 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace Behat\Mink\Tests\helpers; | ||
|
||
/** | ||
* Class Stringer | ||
* | ||
* A container class to hold a string. | ||
* | ||
* @package Behat\Mink\Tests\helpers | ||
*/ | ||
class Stringer | ||
{ | ||
|
||
/** | ||
* Internal storage. | ||
* | ||
* @var string | ||
*/ | ||
protected $content; | ||
|
||
/** | ||
* Stringer constructor. | ||
* | ||
* @param $content | ||
*/ | ||
public function __construct($content) | ||
{ | ||
$this->content = $content; | ||
} | ||
|
||
/** | ||
* Returns in the wrapped string. | ||
* | ||
* @return string | ||
*/ | ||
public function __toString() | ||
{ | ||
return $this->content; | ||
} | ||
|
||
} |