parent
2287695b44
commit
d16717eb61
3 changed files with 76 additions and 2 deletions
@ -0,0 +1,23 @@ |
||||
--TEST-- |
||||
class constants with heredoc and nowdoc syntax |
||||
--FILE-- |
||||
<?php |
||||
|
||||
class Test |
||||
{ |
||||
const VALUE1 = <<<ABC |
||||
abc |
||||
ABC; |
||||
const VALUE2 = <<<'DEF' |
||||
def |
||||
DEF; |
||||
} |
||||
|
||||
function main() |
||||
{ |
||||
var_dump(Test::VALUE1, Test::VALUE2); |
||||
} |
||||
?> |
||||
--EXPECT-- |
||||
string(3) "abc" |
||||
string(3) "def" |
||||
@ -0,0 +1,38 @@ |
||||
--TEST-- |
||||
global constants, property defaults and parameter defaults with heredoc/nowdoc syntax |
||||
--FILE-- |
||||
<?php |
||||
|
||||
const G_HEREDOC = <<<ABC |
||||
abc |
||||
ABC; |
||||
const G_NOWDOC = <<<'DEF' |
||||
def |
||||
DEF; |
||||
|
||||
class WithProp |
||||
{ |
||||
public string $p = <<<ABC |
||||
xyz |
||||
ABC; |
||||
} |
||||
|
||||
function with_default(string $x = <<<ABC |
||||
abc |
||||
ABC): string { |
||||
return $x; |
||||
} |
||||
|
||||
function main() |
||||
{ |
||||
var_dump(G_HEREDOC, G_NOWDOC); |
||||
$o = new WithProp(); |
||||
var_dump($o->p); |
||||
var_dump(with_default()); |
||||
} |
||||
?> |
||||
--EXPECT-- |
||||
string(3) "abc" |
||||
string(3) "def" |
||||
string(3) "xyz" |
||||
string(3) "abc" |
||||
Loading…
Reference in new issue