diff --git a/guides/common.md b/guides/common.md index 95892a0..c64547e 100644 --- a/guides/common.md +++ b/guides/common.md @@ -1,6 +1,9 @@ # Common Language Style Guide +## Capitalization + The following terms describe different forms of capitalization + - StudlyCase - camelCase - UPPER_CASE @@ -9,17 +12,42 @@ The following terms describe different forms of capitalization If an identifier contains more than one word, do not use underscores ( _ ) or hyphens ( - ), except when the identifier is using UPPER_CASE or snake_case. -| Identifier | Casing | -| ----------- | ----------- | -| Class | StudlyCase | -| Interface | StudlyCase | -| Enum Type | StudlyCase | -| Enum Value | StudlyCase | -| Constants | UPPER_CASE | -| Properties | camelCase | -| Method Parameters | camelCase | -| Methods Names | camelCase | -| Function Name | snake_case | -| Function Parameters | camelCase | - -If you encounter a scenario not covered here, please refer to the language-specific style guide. Please open a PR detailing your proposed solution if the scenario is still not covered. +| Identifier | Casing | +|---------------------|------------| +| Class | StudlyCase | +| Interface | StudlyCase | +| Enum Type | StudlyCase | +| Enum Value | StudlyCase | +| Constants | UPPER_CASE | +| Properties | camelCase | +| Method Parameters | camelCase | +| Methods Names | camelCase | +| Function Name | snake_case | +| Function Parameters | camelCase | + + +## Variable Naming + +Variables should always be named descriptively and concisely. Single character variables should never be used unless otherwise specified in a language +specific style guide. + +#### Bad Variable Naming + +```php +foreach ($items as $i) { + //do things in the iteration +} +``` + +#### Good Variable Naming + +```php +foreach ($items as $item) { + //do things in the iteration +} +``` + +## Other Scenarios + +If you encounter a scenario not covered here, please refer to the language-specific style guide. Please open a PR detailing your proposed solution if +the scenario is still not covered.