Skip to content

Commit fa27c13

Browse files
nicklemgithub-actions[bot]
authored andcommitted
gpt: Automated pattern documentation updates
1 parent af156c5 commit fa27c13

File tree

5 files changed

+14990
-12181
lines changed

5 files changed

+14990
-12181
lines changed
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
Classes: Return Type Hint
1+
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.
2+
```php
3+
// Example of a method without a return type hint
4+
public function calculateTotal() {
5+
return 123.45;
6+
}
7+
8+
// Improved version with return type hint
9+
public function calculateTotal(): float {
10+
return 123.45;
11+
}
12+
```
13+
14+
<!-- Codacy PatPatBot reviewed: 2024-05-23T16:21:58.634Z -->
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
Commenting: Doc Block Alignment
1+
Align doc blocks uniformly to improve readability and facilitate clean code diffs. Use tools like PHP Code Sniffer (PHPCS) to automate the alignment process.
2+
```php
3+
// Misaligned doc block example
4+
/**
5+
* Summary description.
6+
* @param string $param Description.
7+
* @return void
8+
*/
9+
10+
// Correctly aligned doc block
11+
/**
12+
* Summary description.
13+
* @param string $param Description.
14+
* @return void
15+
*/
16+
```
17+
18+
<!-- Codacy PatPatBot reviewed: 2024-05-23T16:22:58.511Z -->
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
Commenting: Function Comment
1+
Ensure every function in your CakePHP project has a well-structured comment. This enhances code readability and aids in generating automated documentation.
2+
```php
3+
/**
4+
* Calculates the total price.
5+
*
6+
* @param float $price The price of the item.
7+
* @param float $tax The applicable tax rate.
8+
* @return float The total price including tax.
9+
*/
10+
public function calculateTotal(float $price, float $tax): float &#x7B;
11+
return $price + ($price * $tax);
12+
&#x7D;
13+
```
14+
15+
<!-- Codacy PatPatBot reviewed: 2024-05-23T16:23:56.291Z -->

0 commit comments

Comments
 (0)