mirror of
https://github.com/php/php-src.git
synced 2025-08-20 17:34:35 +02:00

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.
46 lines
741 B
PHP
46 lines
741 B
PHP
--TEST--
|
|
PhpToken constructor
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("tokenizer")) print "skip tokenizer extension not enabled"; ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$token = new PhpToken(300, 'function');
|
|
var_dump($token);
|
|
$token = new PhpToken(300, 'function', 10);
|
|
var_dump($token);
|
|
$token = new PhpToken(300, 'function', 10, 100);
|
|
var_dump($token);
|
|
|
|
?>
|
|
--EXPECT--
|
|
object(PhpToken)#1 (4) {
|
|
["id"]=>
|
|
int(300)
|
|
["text"]=>
|
|
string(8) "function"
|
|
["line"]=>
|
|
int(-1)
|
|
["pos"]=>
|
|
int(-1)
|
|
}
|
|
object(PhpToken)#2 (4) {
|
|
["id"]=>
|
|
int(300)
|
|
["text"]=>
|
|
string(8) "function"
|
|
["line"]=>
|
|
int(10)
|
|
["pos"]=>
|
|
int(-1)
|
|
}
|
|
object(PhpToken)#1 (4) {
|
|
["id"]=>
|
|
int(300)
|
|
["text"]=>
|
|
string(8) "function"
|
|
["line"]=>
|
|
int(10)
|
|
["pos"]=>
|
|
int(100)
|
|
}
|