While I think typehints are generally a good idea, this one broke a few plugins, notably CakeDC/search. I don't think it is wise for 2.X release to break BC in that way. I think reverting this change is probably the safest path right now.
@@ -1644,6 +1644,10 @@ class DboSource extends DataSource {
public function generateAssociationQuery(Model $Model, $LinkModel, $type, $association, $assocData, &$queryData, $external) {
$assocData = $this->_scrubQueryData($assocData);
+ if ($LinkModel === null) {
+ return '';
+ }
+
if ($external && !empty($assocData['finderQuery'])) {
return $assocData['finderQuery'];
}