Re: function and interface in parameter list?

From: Date: Tue, 01 Feb 2005 15:07:42 +0000
Subject: Re: function and interface in parameter list?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-207833@lists.php.net to get a copy of this message
Hi Am Dienstag, 1. Februar 2005 15:50 schrieb Jochem Maas: > Marco Schuler wrote: > > Hi > > > > I found a function declaration in an open source project (in > > php5) and I could not find documantation for this. The function > > declaration is: > > > > public function registerComp(IComp $comp) > > > > Is it a kind of typecast? > > no its a type declaration (is that the correct term). it states > that $comp must be an object of class IComp (or a subclass of it). > if $comp is not anj IComp object you get a fatal error. Where can I find this in the manual? IComp can also be an interface, right? > this only works for classes. and it does not work in conjunction > with optional params e.g: > > public function registerComp(IComp $comp = null) { /*....*/ } With optional params you mean actually the variable initialisation within the declaration, right? -- Cheers! Marco

« previous php.general (#207833) next »