From 0f9e5f20ac5f2fe377125bc96c70dfd7399d09dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20=C5=BDoljom?= Date: Fri, 12 Aug 2022 16:13:34 +0200 Subject: [PATCH] Add fully qualified names in inline code chapter --- wordpress-coding-standards/php.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/wordpress-coding-standards/php.md b/wordpress-coding-standards/php.md index 3fa6d64..8b5085b 100644 --- a/wordpress-coding-standards/php.md +++ b/wordpress-coding-standards/php.md @@ -561,6 +561,24 @@ $foo = new \Vendor // Source: external dependency. $result = namespace \function_name(); // Notice the space between namespace and \function_name(). ``` +### Using fully qualified names in inline code + +When using a fully or partially qualified name, no whitespace or comments are allowed within the name. + +```php +// Correct. +$foo = new \Vendor\Domain\Foo(); + +$result = namespace\function_name(); + +// Incorrect. +$foo = new \Vendor // Source: external dependency. + \Domain + \Foo(); + +$result = namespace \function_name(); // Notice the space between namespace and \function_name(). +``` + ## Object-Oriented Programming ### Only One Object Structure (Class/Interface/Trait) per File