cvs: pear /CodeGen_PECL/PECL Extension.php /CodeGen_PECL/PECL/Element Class.php
| From: | Hartmut Holzgraefe | Date: | Sun, 24 Jul 2005 17:41:57 +0000 |
| Subject: | cvs: pear /CodeGen_PECL/PECL Extension.php /CodeGen_PECL/PECL/Element Class.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-33271@lists.php.net to get a copy of this message | ||
hholzgra Sun Jul 24 13:41:57 2005 EDT
Modified files:
/pear/CodeGen_PECL/PECL Extension.php
/pear/CodeGen_PECL/PECL/Element Class.php
Log:
use type hints instead of explicit checking
http://cvs.php.net/diff.php/pear/CodeGen_PECL/PECL/Extension.php?r1=1.1&r2=1.2&ty=u
Index: pear/CodeGen_PECL/PECL/Extension.php
diff -u pear/CodeGen_PECL/PECL/Extension.php:1.1 pear/CodeGen_PECL/PECL/Extension.php:1.2
--- pear/CodeGen_PECL/PECL/Extension.php:1.1 Sat Jul 23 17:35:04 2005
+++ pear/CodeGen_PECL/PECL/Extension.php Sun Jul 24 13:41:55 2005
@@ -15,7 +15,7 @@
* @author Hartmut Holzgraefe <hartmut@php.net>
* @copyright 2005 Hartmut Holzgraefe
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: Extension.php,v 1.1 2005/07/23 21:35:04 hholzgra Exp $
+ * @version CVS: $Id: Extension.php,v 1.2 2005/07/24 17:41:55 hholzgra Exp $
* @link http://pear.php.net/package/CodeGen
*/
@@ -295,12 +295,8 @@
* @access public
* @param object a function object
*/
- function addFunction($function)
+ function addFunction(CodeGen_PECL_Element_Function $function)
{
- if (!is_a($function, "CodeGen_PECL_Element_Function")) {
- return PEAR::raiseError("argument is not CodeGen_PECL_Element_Function");
- }
-
$role = $function->getRole();
switch ($role) {
@@ -1980,11 +1976,7 @@
* @access public
* @param object a Test object
*/
- function addTest($test) {
- if (! is_a($test, "CodeGen_PECL_Element_Test")) {
- return PEAR::raiseError("Parameter is not a CodeGen_PECL Test instance");
- }
-
+ function addTest(CodeGen_PECL_Element_Test $test) {
$this->testcases[$test->name] = $test;
return true;
}
http://cvs.php.net/diff.php/pear/CodeGen_PECL/PECL/Element/Class.php?r1=1.1&r2=1.2&ty=u
Index: pear/CodeGen_PECL/PECL/Element/Class.php
diff -u pear/CodeGen_PECL/PECL/Element/Class.php:1.1 pear/CodeGen_PECL/PECL/Element/Class.php:1.2
--- pear/CodeGen_PECL/PECL/Element/Class.php:1.1 Sat Jul 23 17:35:04 2005
+++ pear/CodeGen_PECL/PECL/Element/Class.php Sun Jul 24 13:41:57 2005
@@ -15,7 +15,7 @@
* @author Hartmut Holzgraefe <hartmut@php.net>
* @copyright 2005 Hartmut Holzgraefe
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: Class.php,v 1.1 2005/07/23 21:35:04 hholzgra Exp $
+ * @version CVS: $Id: Class.php,v 1.2 2005/07/24 17:41:57 hholzgra Exp $
* @link http://pear.php.net/package/CodeGen
*/
@@ -159,12 +159,8 @@
*/
private $properties = array();
- function addProperty($property)
+ function addProperty(CodeGen_PECL_Element_Property $property)
{
- if (!is_a($property, "CodeGen_PECL_Element_Property")) {
- return PEAR::raiseError("argument is not CodeGen_PECL_Element_Property");
- }
-
if (isset($this->properties[$property->getName()])) {
return PEAR::raiseError("property '$property' already exists");
}
@@ -180,12 +176,8 @@
*/
public $methods = array();
- function addMethod($method)
+ function addMethod(CodeGen_PECL_Element_Method $method)
{
- if (!is_a($method, "CodeGen_PECL_Element_Method")) {
- return PEAR::raiseError("argument is not CodeGen_PECL_Element_Method");
- }
-
if (isset($this->functions[$method->name])) {
return PEAR::raiseError("method '$function' already exists");
}