-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gpt: Automated pattern documentation updates
- Loading branch information
1 parent
af156c5
commit fa27c13
Showing
5 changed files
with
14,990 additions
and
12,181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
Classes: Return Type Hint | ||
To improve code clarity and static analysis, always define return type hints in your CakePHP class methods. This practice helps catch type errors early and aids in maintaining a robust codebase. | ||
```php | ||
// Example of a method without a return type hint | ||
public function calculateTotal() { | ||
return 123.45; | ||
} | ||
|
||
// Improved version with return type hint | ||
public function calculateTotal(): float { | ||
return 123.45; | ||
} | ||
``` | ||
|
||
<!-- Codacy PatPatBot reviewed: 2024-05-23T16:21:58.634Z --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,18 @@ | ||
Commenting: Doc Block Alignment | ||
Align doc blocks uniformly to improve readability and facilitate clean code diffs. Use tools like PHP Code Sniffer (PHPCS) to automate the alignment process. | ||
```php | ||
// Misaligned doc block example | ||
/** | ||
* Summary description. | ||
* @param string $param Description. | ||
* @return void | ||
*/ | ||
|
||
// Correctly aligned doc block | ||
/** | ||
* Summary description. | ||
* @param string $param Description. | ||
* @return void | ||
*/ | ||
``` | ||
|
||
<!-- Codacy PatPatBot reviewed: 2024-05-23T16:22:58.511Z --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,15 @@ | ||
Commenting: Function Comment | ||
Ensure every function in your CakePHP project has a well-structured comment. This enhances code readability and aids in generating automated documentation. | ||
```php | ||
/** | ||
* Calculates the total price. | ||
* | ||
* @param float $price The price of the item. | ||
* @param float $tax The applicable tax rate. | ||
* @return float The total price including tax. | ||
*/ | ||
public function calculateTotal(float $price, float $tax): float { | ||
return $price + ($price * $tax); | ||
} | ||
``` | ||
|
||
<!-- Codacy PatPatBot reviewed: 2024-05-23T16:23:56.291Z --> |
Oops, something went wrong.