[Kde-bindings] KDE/kdebindings/php/phpqt/src

Thomas Moenicke tm at php-qt.org
Mon Oct 13 11:37:51 UTC 2008


SVN commit 870891 by moenicke:

* improved error message thrown when a method is called that is either unknown or its arguments dont match

CCMAIL: kde-bindings at kde.org



 M  +10 -1     php_qt.cpp  
 M  +11 -11    phpqt_internals.cpp  
 M  +1 -1      phpqt_internals.h  


--- trunk/KDE/kdebindings/php/phpqt/src/php_qt.cpp #870890:870891
@@ -318,7 +318,16 @@
                 }
             }
 
-            php_error(E_ERROR,"Call to undefined method %s::%s() or wrong arguments", ce->name, Context::methodName()->constData());
+	    QString types;
+	    for( int i = 0; i < argc; i++ )
+	      {
+		types += PHPQt::printType( (*args[i])->type );
+		if(i != argc-1) types.append(',');
+	      }
+	    QString methodName( Context::methodName()->constData() );
+	    methodName.replace( "$", "" );
+	    methodName.replace( "#", "" );
+            php_error(E_ERROR,"Call to undefined method %s::%s() or wrong arguments: %s", ce->name, methodName.toLatin1().constData(), types.toLatin1().constData() );
 
         }
         else
--- trunk/KDE/kdebindings/php/phpqt/src/phpqt_internals.cpp #870890:870891
@@ -638,20 +638,20 @@
 
 
 
-const char*
+const QString
 PHPQt::printType(int type)
 {
  switch(type){
-	case IS_NULL:	return "IS_NULL"; break; // 0
-	case IS_LONG:	return "IS_LONG"; break; // 1
-	case IS_DOUBLE: return "IS_DOUBLE"; break;	//2
-	case IS_BOOL: return "IS_BOOL"; break; //	3
-	case IS_ARRAY: return "IS_ARRAY"; break; // 4
-	case IS_OBJECT: return "IS_OBJECT"; break; //	5
-	case IS_STRING: return "IS_STRING"; break; // 6
-	case IS_RESOURCE: return "IS_RESOURCE"; break; // 7
-	case IS_CONSTANT: return "IS_CONSTANT"; break; // 8
-	case IS_CONSTANT_ARRAY: return "IS_CONSTANT_ARRAY"; break; //	9
+	case IS_NULL:	return "NULL"; break; // 0
+	case IS_LONG:	return "long"; break; // 1
+	case IS_DOUBLE: return "double"; break;	//2
+	case IS_BOOL: return "bool"; break; //	3
+	case IS_ARRAY: return "array"; break; // 4
+	case IS_OBJECT: return "object"; break; //	5
+	case IS_STRING: return "string"; break; // 6
+	case IS_RESOURCE: return "resource"; break; // 7
+	case IS_CONSTANT: return "constant"; break; // 8
+	case IS_CONSTANT_ARRAY: return "const array"; break; //	9
  }
  return "unknown";
 }
--- trunk/KDE/kdebindings/php/phpqt/src/phpqt_internals.h #870890:870891
@@ -60,7 +60,7 @@
 void 				restoreObject( smokephp_object* o );
 
 void				check_qobject(zval* zobject);
-const char* 		printType(int type);
+const QString 		printType(int type);
 
 }; // namespace PHPQt
 



More information about the Kde-bindings mailing list