Skip to content

Commit 9ea58ef

Browse files
committed
Generic/CamelCapsFunctionName: improve code coverage
1 parent 2c66318 commit 9ea58ef

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

src/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.1.inc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,22 @@ enum Suit: string implements Colorful, CardGame {
183183
public function parseMyDSN() {}
184184
public function get_some_value() {}
185185
}
186+
187+
interface MyInterface {
188+
function getSomeValue(); // Ok.
189+
function get_some_value(); // Not ok.
190+
}
191+
192+
class MyClass {
193+
// phpcs:set Generic.NamingConventions.CamelCapsFunctionName strict false
194+
function strictFOrmatDIsabled() {} // Ok.
195+
// phpcs:set Generic.NamingConventions.CamelCapsFunctionName strict true
196+
197+
function strictFOrmatIsENabled() {} // Not ok.
198+
}
199+
200+
// phpcs:set Generic.NamingConventions.CamelCapsFunctionName strict false
201+
function strictFOrmatDIsabled() {} // Ok.
202+
// phpcs:set Generic.NamingConventions.CamelCapsFunctionName strict true
203+
204+
function strictFOrmatIsENabled() {} // Not ok.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
// Intentional parse error (missing method name).
4+
// This should be the only test in this file.
5+
// Testing that the sniff is *not* triggered.
6+
7+
class My_Class {
8+
public function {}
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
// Intentional parse error (missing function name).
4+
// This should be the only test in this file.
5+
// Testing that the sniff is *not* triggered.
6+
7+
function

src/Standards/Generic/Tests/NamingConventions/CamelCapsFunctionNameUnitTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ public function getErrorList($testFile='')
7676
180 => 2,
7777
183 => 1,
7878
184 => 1,
79+
189 => 1,
80+
197 => 1,
81+
204 => 1,
7982
];
8083
default:
8184
return [];

0 commit comments

Comments
 (0)