These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of Gitamin. |
||
5 | * |
||
6 | * Copyright (C) 2015-2016 The Gitamin Team |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Gitamin\Commands\Owner; |
||
13 | |||
14 | View Code Duplication | final class AddOwnerCommand |
|
0 ignored issues
–
show
|
|||
15 | { |
||
16 | /** |
||
17 | * The project owner name. |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | public $name; |
||
22 | |||
23 | /** |
||
24 | * The project owner path. |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | public $path; |
||
29 | |||
30 | /** |
||
31 | * The project owner user_id. |
||
32 | * |
||
33 | * @var int |
||
34 | */ |
||
35 | public $user_id; |
||
36 | |||
37 | /** |
||
38 | * The project owner description. |
||
39 | * |
||
40 | * @var text |
||
41 | */ |
||
42 | public $description; |
||
43 | |||
44 | /** |
||
45 | * The project namespace type. |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | public $type; |
||
50 | |||
51 | /** |
||
52 | * The validation rules. |
||
53 | * |
||
54 | * @var string[] |
||
55 | */ |
||
56 | public $rules = [ |
||
57 | 'name' => 'required|string', |
||
58 | 'path' => 'required|string', |
||
59 | 'user_id' => 'int', |
||
60 | 'type' => 'string', |
||
61 | ]; |
||
62 | |||
63 | /** |
||
64 | * Create a add project team command instance. |
||
65 | * |
||
66 | * @param string $name |
||
67 | * @param string $path |
||
68 | * @param int $user_id |
||
69 | * @param string $description |
||
70 | * @param string $type |
||
71 | * |
||
72 | * @return void |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Adding a
@return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.
Adding a Please refer to the PHP core documentation on constructors.
Loading history...
|
|||
73 | */ |
||
74 | public function __construct($name, $path, $user_id, $description, $type) |
||
75 | { |
||
76 | $this->name = $name; |
||
77 | $this->path = $path; |
||
78 | $this->user_id = $user_id; |
||
79 | $this->description = $description; |
||
0 ignored issues
–
show
It seems like
$description of type string is incompatible with the declared type object<Gitamin\Commands\Owner\text> of property $description .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..
Loading history...
|
|||
80 | $this->type = $type; |
||
81 | } |
||
82 | } |
||
83 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.