Skip to content

Instantly share code, notes, and snippets.

@yitsushi
Created May 14, 2011 22:37
Show Gist options
  • Save yitsushi/972712 to your computer and use it in GitHub Desktop.
Save yitsushi/972712 to your computer and use it in GitHub Desktop.
<?php
interface ILogin {
public function check_password(
$username,
$password,
$opts = array()
);
public function do_login(
$username,
$password,
$opts = array()
);
public function check_session(
$username
);
}
class MyOwnLoginClass implements ILogin {
public function ckeck_password(
$username,
$password,
$opts = array()
) {
}
public function do_login(
$username,
$password
) {
}
}
/*
* OUTOUT:
*
* PHP Fatal error: Declaration of MyOwnLoginClass::do_login()
* must be compatible with that of ILogin::do_login()
* in /Users/yitsushi/a.php on line 8
*
* Fatal error: Declaration of MyOwnLoginClass::do_login()
* must be compatible with that of ILogin::do_login()
* in /Users/yitsushi/a.php on line 8
*
* if I fix the parameter error:
* PHP Fatal error: Class MyOwnLoginClass contains 2 abstract
* methods and must therefore be declared abstract
* or implement the remaining methods
* (ILogin::check_password, ILogin::check_session)
* in /Users/yitsushi/a.php on line 14
*
* Fatal error: Class MyOwnLoginClass contains 2 abstract
* methods and must therefore be declared abstract
* or implement the remaining methods
* (ILogin::check_password, ILogin::check_session)
* in /Users/yitsushi/a.php on line 14
*
* I need a check_session() !!!!
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment