1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 14:31:06 +02:00
Files
archived-php-src/ext/opcache/tests/bug73789.phpt
Christoph M. Becker 75bc3446f8 Add missing SKIPIFs
All these tests are meant to run with OPcache available, and some will
even fail inevitably without it, so we add OPcache as SKIPIF
requirement.
2019-07-01 17:21:16 +02:00

33 lines
613 B
PHP

--TEST--
Bug #73789 (Strange behavior of class constants in switch/case block)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
class Lexer
{
const T_NONE = 1;
const T_STRING = 2;
const T_DOT = 8;
public function getType($value): int
{
$type = self::T_NONE;
switch (true) {
case ctype_alpha($value[0]):
$name = 'Lexer::T_' . strtoupper($value);
$type = constant($name);
if ($type > 100) {
return $type;
}
return self::T_STRING;
case $value === '.':
return self::T_DOT;
default:
}
return $type;
}
}
var_dump((new Lexer())->getType("dot"));
--EXPECT--
int(2)