Skip to content

Instantly share code, notes, and snippets.

@GodsBoss
Created May 30, 2011 20:15
Show Gist options
  • Save GodsBoss/999405 to your computer and use it in GitHub Desktop.
Save GodsBoss/999405 to your computer and use it in GitHub Desktop.
Constructor signature
<?php
interface Something{}
interface AnotherThing{}
class Foo{
public function __construct(Something $thing){}
public function foo(Something $thing){}}
// No problem.
class FooSomeChild extends Foo{
public function __construct(AnotherThing $thing){}}
// Works, but PHP complains.
class FooAnotherChild extends Foo{
public function foo(AnotherThing $thing){}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment