1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 09:12:14 +01:00
Files
archived-php-src/ext/tokenizer/tests/PhpToken_toString.phpt
Nikita Popov 5a09b9fb0f Add PhpToken class
RFC: https://wiki.php.net/rfc/token_as_object

Relative to the RFC, this also adds a __toString() method,
as discussed on list.

Closes GH-5176.
2020-03-26 11:09:18 +01:00

19 lines
362 B
PHP

--TEST--
PhpToken implements __toString()
--FILE--
<?php
$tokens = PhpToken::getAll('<?php echo "Hello ". $what;');
var_dump(implode($tokens));
var_dump($tokens[0] instanceof Stringable);
var_dump((string) $tokens[0]);
var_dump($tokens[0]->__toString());
?>
--EXPECT--
string(27) "<?php echo "Hello ". $what;"
bool(true)
string(6) "<?php "
string(6) "<?php "