Skip to content

Commit 78c4f0a

Browse files
committed
PhpGenerator: PhpLiteral is immutable object (and consistent with SqlLiteral) (BC break)
1 parent 58e904b commit 78c4f0a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/PhpGenerator/Helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static function dump($var)
3939
private static function _dump(&$var, $level = 0)
4040
{
4141
if ($var instanceof PhpLiteral) {
42-
return $var->value;
42+
return (string) $var;
4343

4444
} elseif (is_float($var)) {
4545
$var = var_export($var, TRUE);

src/PhpGenerator/PhpLiteral.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,22 @@
2323
class PhpLiteral
2424
{
2525
/** @var string */
26-
public $value = '';
26+
private $value;
2727

2828

2929
public function __construct($value)
3030
{
3131
$this->value = (string) $value;
3232
}
3333

34+
35+
36+
/**
37+
* @return string
38+
*/
39+
public function __toString()
40+
{
41+
return $this->value;
42+
}
43+
3444
}

0 commit comments

Comments
 (0)