1--TEST--
2ReflectionConstant::getFileName()
3--FILE--
4<?php
5
6include "included5.inc";
7
8function testConstant(string $name): void {
9    $ref = new ReflectionConstant($name);
10    echo "$name: ";
11    var_dump($ref->getFileName());
12}
13
14define('IN_CURRENT_FILE_DEFINED', 42);
15const IN_CURRENT_FILE_AST = 123;
16
17echo "From PHP:\n";
18testConstant('PHP_VERSION');
19testConstant('STDIN');
20testConstant('STDOUT');
21testConstant('STDERR');
22
23echo "\nFrom the current file:\n";
24testConstant('IN_CURRENT_FILE_DEFINED');
25testConstant('IN_CURRENT_FILE_AST');
26
27echo "\nFrom an included file:\n";
28testConstant('INCLUDED_CONSTANT_DEFINED');
29testConstant('INCLUDED_CONSTANT_AST');
30?>
31--EXPECTF--
32From PHP:
33PHP_VERSION: bool(false)
34STDIN: bool(false)
35STDOUT: bool(false)
36STDERR: bool(false)
37
38From the current file:
39IN_CURRENT_FILE_DEFINED: string(%d) "%sReflectionConstant_getFileName.php"
40IN_CURRENT_FILE_AST: string(%d) "%sReflectionConstant_getFileName.php"
41
42From an included file:
43INCLUDED_CONSTANT_DEFINED: string(%d) "%sincluded5.inc"
44INCLUDED_CONSTANT_AST: string(%d) "%sincluded5.inc"
45