It seems like you code against a specific sub-type and not the parent class Database_Query_Builder as the method join() does only exist in the following sub-classes of Database_Query_Builder: Database_Query_Builder_Select, Jam_Query_Builder_Collection, Jam_Query_Builder_Join, Jam_Query_Builder_Select, Kohana_Database_Query_Builder_Select, Kohana_Jam_Query_Builder_Collection, Kohana_Jam_Query_Builder_Join, Kohana_Jam_Query_Builder_Select, Model_Collection_Test_Author. Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example:
abstractclassUser{/** @return string */abstractpublicfunctiongetPassword();}classMyUserextendsUser{publicfunctiongetPassword(){// return something}publicfunctiongetDisplayName(){// return some name.}}classAuthSystem{publicfunctionauthenticate(User$user){$this->logger->info(sprintf('Authenticating %s.',$user->getDisplayName()));// do something.}}
In the above example, the authenticate() method works fine as long as you just pass
instances of MyUser. However, if you now also want to pass a different sub-classes
of User which does not have a getDisplayName() method, the code will break.
classAuthSystem{publicfunctionauthenticate(User$user){if($userinstanceofMyUser){$this->logger->info(/** ... */);}// or alternativelyif(!$userinstanceofMyUser){thrownew\LogicException('$user must be an instance of MyUser, '.'other instances are not supported.');}}}
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
It seems like you code against a specific sub-type and not the parent class Database_Query_Builder as the method where() does only exist in the following sub-classes of Database_Query_Builder: Database_Query_Builder_Delete, Database_Query_Builder_Select, Database_Query_Builder_Update, Database_Query_Builder_Where, Jam_Query_Builder_Collection, Jam_Query_Builder_Delete, Jam_Query_Builder_Select, Jam_Query_Builder_Update, Kohana_Database_Query_Builder_Delete, Kohana_Database_Query_Builder_Select, Kohana_Database_Query_Builder_Update, Kohana_Database_Query_Builder_Where, Kohana_Jam_Query_Builder_Collection, Kohana_Jam_Query_Builder_Delete, Kohana_Jam_Query_Builder_Select, Kohana_Jam_Query_Builder_Update, Model_Collection_Test_Author. Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example:
abstractclassUser{/** @return string */abstractpublicfunctiongetPassword();}classMyUserextendsUser{publicfunctiongetPassword(){// return something}publicfunctiongetDisplayName(){// return some name.}}classAuthSystem{publicfunctionauthenticate(User$user){$this->logger->info(sprintf('Authenticating %s.',$user->getDisplayName()));// do something.}}
In the above example, the authenticate() method works fine as long as you just pass
instances of MyUser. However, if you now also want to pass a different sub-classes
of User which does not have a getDisplayName() method, the code will break.
classAuthSystem{publicfunctionauthenticate(User$user){if($userinstanceofMyUser){$this->logger->info(/** ... */);}// or alternativelyif(!$userinstanceofMyUser){thrownew\LogicException('$user must be an instance of MyUser, '.'other instances are not supported.');}}}
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
It seems like you code against a specific sub-type and not the parent class Database_Query_Builder as the method join() does only exist in the following sub-classes of Database_Query_Builder: Database_Query_Builder_Select, Jam_Query_Builder_Collection, Jam_Query_Builder_Join, Jam_Query_Builder_Select, Kohana_Database_Query_Builder_Select, Kohana_Jam_Query_Builder_Collection, Kohana_Jam_Query_Builder_Join, Kohana_Jam_Query_Builder_Select, Model_Collection_Test_Author. Maybe you want to instanceof check for one of these explicitly?
Let’s take a look at an example:
abstractclassUser{/** @return string */abstractpublicfunctiongetPassword();}classMyUserextendsUser{publicfunctiongetPassword(){// return something}publicfunctiongetDisplayName(){// return some name.}}classAuthSystem{publicfunctionauthenticate(User$user){$this->logger->info(sprintf('Authenticating %s.',$user->getDisplayName()));// do something.}}
In the above example, the authenticate() method works fine as long as you just pass
instances of MyUser. However, if you now also want to pass a different sub-classes
of User which does not have a getDisplayName() method, the code will break.
classAuthSystem{publicfunctionauthenticate(User$user){if($userinstanceofMyUser){$this->logger->info(/** ... */);}// or alternativelyif(!$userinstanceofMyUser){thrownew\LogicException('$user must be an instance of MyUser, '.'other instances are not supported.');}}}
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types
inside the if block in such a case.
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.