Skip to content

Commit

Permalink
Generic/LowerCaseConstant: add tests with functions which don't creat…
Browse files Browse the repository at this point in the history
…e scope
  • Loading branch information
jrfnl committed Dec 8, 2023
1 parent ec2709a commit e5c3212
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,12 @@ class TypedThings {
}

$cl = function (int|FALSE $param = NULL, Type|NULL $obj = new MyObj(FALSE)) : string|FALSE|NULL {};

// Adding some extra tests to safeguard that function declarations which don't create scope are handled correctly.
interface InterfaceMethodsWithReturnTypeNoScopeOpener {
private function typed($param = TRUE) : string|FALSE|NULL;
}

abstract class ClassMethodsWithReturnTypeNoScopeOpener {
abstract public function typed($param = FALSE) : TRUE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,12 @@ class TypedThings {
}

$cl = function (int|FALSE $param = null, Type|NULL $obj = new MyObj(false)) : string|FALSE|NULL {};

// Adding some extra tests to safeguard that function declarations which don't create scope are handled correctly.
interface InterfaceMethodsWithReturnTypeNoScopeOpener {
private function typed($param = true) : string|FALSE|NULL;
}

abstract class ClassMethodsWithReturnTypeNoScopeOpener {
abstract public function typed($param = false) : TRUE;
}
2 changes: 2 additions & 0 deletions src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public function getErrorList($testFile='LowerCaseConstantUnitTest.inc')
94 => 2,
95 => 1,
100 => 2,
104 => 1,
108 => 1,
];

case 'LowerCaseConstantUnitTest.js':
Expand Down

0 comments on commit e5c3212

Please sign in to comment.