1
0
mirror of https://github.com/php/php-src.git synced 2026-04-05 07:02:33 +02:00
Files
archived-php-src/ext/tokenizer/tests/PhpToken_extension_errors.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

31 lines
607 B
PHP

--TEST--
PhpToken extensions that throw during construction
--SKIPIF--
<?php if (!extension_loaded("tokenizer")) print "skip tokenizer extension not enabled"; ?>
--FILE--
<?php
class MyPhpToken1 extends PhpToken {
public $extra = UNKNOWN;
}
try {
var_dump(MyPhpToken1::getAll("<?php foo"));
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
abstract class MyPhpToken2 extends PhpToken {
}
try {
var_dump(MyPhpToken2::getAll("<?php foo"));
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Undefined constant 'UNKNOWN'
Cannot instantiate abstract class MyPhpToken2