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  | 
            ||
| 22 | class RootURLController extends Controller { | 
            ||
| 23 | |||
| 24 | /**  | 
            ||
| 25 | * @var bool  | 
            ||
| 26 | */  | 
            ||
| 27 | protected static $is_at_root = false;  | 
            ||
| 28 | |||
| 29 | /**  | 
            ||
| 30 | * @config  | 
            ||
| 31 | * @var string  | 
            ||
| 32 | */  | 
            ||
| 33 | private static $default_homepage_link = 'home';  | 
            ||
| 34 | |||
| 35 | /**  | 
            ||
| 36 | * @var string  | 
            ||
| 37 | */  | 
            ||
| 38 | protected static $cached_homepage_link;  | 
            ||
| 39 | |||
| 40 | /**  | 
            ||
| 41 | * Get the full form (e.g. /home/) relative link to the home page for the current HTTP_HOST value. Note that the  | 
            ||
| 42 | * link is trimmed of leading and trailing slashes before returning to ensure consistency.  | 
            ||
| 43 | *  | 
            ||
| 44 | * @return string  | 
            ||
| 45 | */  | 
            ||
| 46 | 	static public function get_homepage_link() { | 
            ||
| 77 | |||
| 78 | /**  | 
            ||
| 79 | * Set the URL Segment used for your homepage when it is created by dev/build.  | 
            ||
| 80 | * This allows you to use home page URLs other than the default "home".  | 
            ||
| 81 | *  | 
            ||
| 82 | * @deprecated 4.0 Use the "RootURLController.default_homepage_link" config setting instead  | 
            ||
| 83 | * @param string $urlsegment the URL segment for your home page  | 
            ||
| 84 | */  | 
            ||
| 85 | 	static public function set_default_homepage_link($urlsegment = "home") { | 
            ||
| 89 | |||
| 90 | /**  | 
            ||
| 91 | * Gets the link that denotes the homepage if there is not one explicitly defined for this HTTP_HOST value.  | 
            ||
| 92 | *  | 
            ||
| 93 | * @deprecated 4.0 Use the "RootURLController.default_homepage_link" config setting instead  | 
            ||
| 94 | * @return string  | 
            ||
| 95 | */  | 
            ||
| 96 | 	static public function get_default_homepage_link() { | 
            ||
| 100 | |||
| 101 | /**  | 
            ||
| 102 | * Returns TRUE if a request to a certain page should be redirected to the site root (i.e. if the page acts as the  | 
            ||
| 103 | * home page).  | 
            ||
| 104 | *  | 
            ||
| 105 | * @param SiteTree $page  | 
            ||
| 106 | * @return bool  | 
            ||
| 107 | */  | 
            ||
| 108 | 	static public function should_be_on_root(SiteTree $page) { | 
            ||
| 120 | |||
| 121 | /**  | 
            ||
| 122 | * Resets the cached homepage link value - useful for testing.  | 
            ||
| 123 | */  | 
            ||
| 124 | 	static public function reset() { | 
            ||
| 127 | |||
| 128 | View Code Duplication | 	protected function beforeHandleRequest(SS_HTTPRequest $request, DataModel $model) { | 
            |
| 144 | |||
| 145 | /**  | 
            ||
| 146 | * @param SS_HTTPRequest $request  | 
            ||
| 147 | * @param DataModel|null $model  | 
            ||
| 148 | * @return SS_HTTPResponse  | 
            ||
| 149 | */  | 
            ||
| 150 | 	public function handleRequest(SS_HTTPRequest $request, DataModel $model = null) { | 
            ||
| 174 | |||
| 175 | }  | 
            ||
| 176 | 
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: