Skip to content

Commit 84ab687

Browse files
ramonjdwestonruter
andauthored
Coding standards: Skip anonymous class methods in block library function name sniff (#83900)
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: westonruter <westonruter@git.wordpress.org>
1 parent 57df508 commit 84ab687

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎test/php/gutenberg-coding-standards/Gutenberg/Sniffs/NamingConventions/ValidBlockLibraryFunctionNameSniff.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ private function processFunctionToken( File $phpcsFile, $stackPointer ) {
9292

9393
$wrapping_tokens_to_check = array(
9494
T_CLASS,
95+
T_ANON_CLASS,
9596
T_INTERFACE,
9697
T_TRAIT,
9798
);

‎test/php/gutenberg-coding-standards/Gutenberg/Tests/fixtures/block-library/src/my-block/index.inc‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,9 @@ class MyClass {
3434

3535
function foo() {
3636
}
37+
38+
$object = new class() {
39+
// Represents a non-prefixed method within an anonymous class.
40+
public function some_non_prefixed_anonymous_class_method() {
41+
}
42+
};

0 commit comments

Comments
 (0)