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  | 
            ||
| 4 | class DeployPlanDispatcher extends Dispatcher { | 
            ||
| 5 | |||
| 6 | const ACTION_PLAN = 'plan';  | 
            ||
| 7 | |||
| 8 | /**  | 
            ||
| 9 | * @var array  | 
            ||
| 10 | */  | 
            ||
| 11 | private static $action_types = [  | 
            ||
| 12 | self::ACTION_PLAN  | 
            ||
| 13 | ];  | 
            ||
| 14 | |||
| 15 | /**  | 
            ||
| 16 | * @var array  | 
            ||
| 17 | */  | 
            ||
| 18 | public static $allowed_actions = [  | 
            ||
| 19 | 'gitupdate',  | 
            ||
| 20 | 'gitrefs',  | 
            ||
| 21 | ];  | 
            ||
| 22 | |||
| 23 | /**  | 
            ||
| 24 | * @var \DNProject  | 
            ||
| 25 | */  | 
            ||
| 26 | protected $project = null;  | 
            ||
| 27 | |||
| 28 | /**  | 
            ||
| 29 | * @var \DNEnvironment  | 
            ||
| 30 | */  | 
            ||
| 31 | protected $environment = null;  | 
            ||
| 32 | |||
| 33 | 	public function init() { | 
            ||
| 34 | parent::init();  | 
            ||
| 35 | |||
| 36 | $this->project = $this->getCurrentProject();  | 
            ||
| 37 | |||
| 38 | 		if(!$this->project) { | 
            ||
| 39 | return $this->project404Response();  | 
            ||
| 40 | }  | 
            ||
| 41 | |||
| 42 | // Performs canView permission check by limiting visible projects  | 
            ||
| 43 | $this->environment = $this->getCurrentEnvironment($this->project);  | 
            ||
| 44 | 		if(!$this->environment) { | 
            ||
| 45 | return $this->environment404Response();  | 
            ||
| 46 | }  | 
            ||
| 47 | }  | 
            ||
| 48 | |||
| 49 | /**  | 
            ||
| 50 | * @return string  | 
            ||
| 51 | */  | 
            ||
| 52 | 	public function Link() { | 
            ||
| 53 | return \Controller::join_links($this->environment->Link(), self::ACTION_PLAN);  | 
            ||
| 54 | }  | 
            ||
| 55 | |||
| 56 | /**  | 
            ||
| 57 | *  | 
            ||
| 58 | * @param \SS_HTTPRequest $request  | 
            ||
| 59 | *  | 
            ||
| 60 | * @return \HTMLText|\SS_HTTPResponse  | 
            ||
| 61 | */  | 
            ||
| 62 | 	public function index(\SS_HTTPRequest $request) { | 
            ||
| 68 | |||
| 69 | /**  | 
            ||
| 70 | * @param SS_HTTPRequest $request  | 
            ||
| 71 | * @return SS_HTTPResponse  | 
            ||
| 72 | */  | 
            ||
| 73 | 	public function gitupdate(SS_HTTPRequest $request) { | 
            ||
| 83 | |||
| 84 | /**  | 
            ||
| 85 | * @param SS_HTTPRequest $request  | 
            ||
| 86 | *  | 
            ||
| 87 | * @return string  | 
            ||
| 88 | */  | 
            ||
| 89 | 	public function gitrefs(\SS_HTTPRequest $request) { | 
            ||
| 127 | |||
| 128 | /**  | 
            ||
| 129 | * Generate the data structure used by the frontend component.  | 
            ||
| 130 | *  | 
            ||
| 131 | * @param string $name of the component  | 
            ||
| 132 | *  | 
            ||
| 133 | * @return array  | 
            ||
| 134 | */  | 
            ||
| 135 | 	public function getModel($name) { | 
            ||
| 140 | |||
| 141 | /**  | 
            ||
| 142 | * @param int $ID  | 
            ||
| 143 | * @return SS_HTTPResponse  | 
            ||
| 144 | */  | 
            ||
| 145 | 	protected function getFetch($ID) { | 
            ||
| 158 | |||
| 159 | /**  | 
            ||
| 160 | * @return SS_HTTPResponse  | 
            ||
| 161 | */  | 
            ||
| 162 | View Code Duplication | 	protected function createFetch() { | 
            |
| 179 | |||
| 180 | /**  | 
            ||
| 181 | * @param $project  | 
            ||
| 182 | *  | 
            ||
| 183 | * @return array  | 
            ||
| 184 | */  | 
            ||
| 185 | 	protected function getGitBranches($project) { | 
            ||
| 195 | |||
| 196 | /**  | 
            ||
| 197 | * @param $project  | 
            ||
| 198 | *  | 
            ||
| 199 | * @return array  | 
            ||
| 200 | */  | 
            ||
| 201 | 	protected function getGitTags($project) { | 
            ||
| 211 | |||
| 212 | /**  | 
            ||
| 213 | * @param $project  | 
            ||
| 214 | *  | 
            ||
| 215 | * @return array  | 
            ||
| 216 | */  | 
            ||
| 217 | 	protected function getGitPrevDeploys($project) { | 
            ||
| 244 | |||
| 245 | /**  | 
            ||
| 246 | * Return a simple response with a message  | 
            ||
| 247 | *  | 
            ||
| 248 | * @param string $message  | 
            ||
| 249 | * @param int $statusCode  | 
            ||
| 250 | * @return SS_HTTPResponse  | 
            ||
| 251 | */  | 
            ||
| 252 | 	protected function getAPIResponse($message, $statusCode) { | 
            ||
| 264 | }  | 
            ||
| 265 | 
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: