We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | <?php |
||
5 | trait Revisions { |
||
6 | |||
7 | /** |
||
8 | * Display the revisions for specified resource. |
||
9 | * |
||
10 | * @param int $id |
||
11 | * |
||
12 | * @return Response |
||
|
|||
13 | */ |
||
14 | View Code Duplication | public function listRevisions($id) |
|
28 | |||
29 | /** |
||
30 | * Restore a specific revision for the specified resource. |
||
31 | * |
||
32 | * Used via AJAX in the revisions view |
||
33 | * |
||
34 | * @param int $id |
||
35 | * |
||
36 | * @return JSON Response containing the new revision that was created from the update |
||
37 | * @return HTTP 500 if the request did not contain the revision ID |
||
38 | */ |
||
39 | public function restoreRevision($id) |
||
61 | |||
62 | } |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.