Skip to content

Commit 5b18530

Browse files
committed
Add test cases for conflicting use and definition in same ns (stas)
1 parent 31d7705 commit 5b18530

File tree

6 files changed

+56
-46
lines changed

6 files changed

+56
-46
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
defining const with same name as imported should fail
3+
--FILE--
4+
<?php
5+
6+
namespace {
7+
use const foo\bar;
8+
9+
const bar = 42;
10+
}
11+
12+
?>
13+
--EXPECTF--
14+
Fatal error: Cannot declare const bar because the name is already in use in %s on line %d
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
using const with same name as defined should fail
3+
--FILE--
4+
<?php
5+
6+
namespace {
7+
const bar = 42;
8+
9+
use const foo\bar;
10+
}
11+
12+
?>
13+
--EXPECTF--
14+
Fatal error: Cannot use const foo\bar as bar because the name is already in use in %s on line %d

Zend/tests/use_const/shadow_global_same_ns.phpt

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
defining function with same name as imported should fail
3+
--FILE--
4+
<?php
5+
6+
namespace {
7+
use function foo\bar;
8+
9+
function bar() {}
10+
}
11+
12+
?>
13+
--EXPECTF--
14+
Fatal error: Cannot declare function bar because the name is already in use in %s on line %d
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
using function with same name as defined should fail
3+
--FILE--
4+
<?php
5+
6+
namespace {
7+
function bar() {}
8+
9+
use function foo\bar;
10+
}
11+
12+
?>
13+
--EXPECTF--
14+
Fatal error: Cannot use function foo\bar as bar because the name is already in use in %s on line %d

Zend/tests/use_function/shadow_global_same_ns.phpt

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)