Skip to content

Commit e5c3212

Browse files
committed
Generic/LowerCaseConstant: add tests with functions which don't create scope
1 parent ec2709a commit e5c3212

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.inc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,12 @@ class TypedThings {
9898
}
9999

100100
$cl = function (int|FALSE $param = NULL, Type|NULL $obj = new MyObj(FALSE)) : string|FALSE|NULL {};
101+
102+
// Adding some extra tests to safeguard that function declarations which don't create scope are handled correctly.
103+
interface InterfaceMethodsWithReturnTypeNoScopeOpener {
104+
private function typed($param = TRUE) : string|FALSE|NULL;
105+
}
106+
107+
abstract class ClassMethodsWithReturnTypeNoScopeOpener {
108+
abstract public function typed($param = FALSE) : TRUE;
109+
}

src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.inc.fixed

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,12 @@ class TypedThings {
9898
}
9999

100100
$cl = function (int|FALSE $param = null, Type|NULL $obj = new MyObj(false)) : string|FALSE|NULL {};
101+
102+
// Adding some extra tests to safeguard that function declarations which don't create scope are handled correctly.
103+
interface InterfaceMethodsWithReturnTypeNoScopeOpener {
104+
private function typed($param = true) : string|FALSE|NULL;
105+
}
106+
107+
abstract class ClassMethodsWithReturnTypeNoScopeOpener {
108+
abstract public function typed($param = false) : TRUE;
109+
}

src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public function getErrorList($testFile='LowerCaseConstantUnitTest.inc')
5151
94 => 2,
5252
95 => 1,
5353
100 => 2,
54+
104 => 1,
55+
108 => 1,
5456
];
5557

5658
case 'LowerCaseConstantUnitTest.js':

0 commit comments

Comments
 (0)