From 69892eccf851bb64dbbe775a1ec4a1c66146087d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Aug 2011 17:40:51 +0000 Subject: [PATCH] Qual: Optimize PHP Code sniffer rules --- dev/skeletons/skeleton_class.class.php | 44 +++++++++++++++----------- dev/skeletons/skeleton_page.php | 2 +- dev/skeletons/skeleton_script.php | 2 +- dev/translation/autotranslator.php | 1 - 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index ba8899e60e6..847b4f487cd 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -35,7 +35,7 @@ * \brief Put here description of your class * \remarks Put here some comments */ -class Skeleton_class // extends CommonObject +class Skeleton_Class // extends CommonObject { var $db; //!< To store db handler var $error; //!< To return error code (or message) @@ -51,9 +51,10 @@ class Skeleton_class // extends CommonObject /** * Constructor - * @param DB Database handler + * + * @param DoliDb $DB Database handler */ - function Skeleton_class($DB) + function Skeleton_Class($DB) { $this->db = $DB; return 1; @@ -62,9 +63,10 @@ class Skeleton_class // extends CommonObject /** * Create object into database - * @param user User that create - * @param notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, Id of created object if OK + * + * @param User $user User that create + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, Id of created object if OK */ function create($user, $notrigger=0) { @@ -135,8 +137,9 @@ class Skeleton_class // extends CommonObject /** * Load object in memory from database - * @param id id object - * @return int <0 if KO, >0 if OK + * + * @param int $id Id object + * @return int <0 if KO, >0 if OK */ function fetch($id) { @@ -177,9 +180,10 @@ class Skeleton_class // extends CommonObject /** * Update object into database - * @param user User that modify - * @param notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, >0 if OK + * + * @param User $user User that modify + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK */ function update($user=0, $notrigger=0) { @@ -244,9 +248,10 @@ class Skeleton_class // extends CommonObject /** * Delete object in database - * @param user User that delete - * @param notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, >0 if OK + * + * @param User $user User that delete + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK */ function delete($user, $notrigger=0) { @@ -300,8 +305,9 @@ class Skeleton_class // extends CommonObject /** * Load an object from its id and create a new one in database - * @param fromid Id of object to clone - * @return int New id of clone + * + * @param int $fromid Id of object to clone + * @return int New id of clone */ function createFromClone($fromid) { @@ -309,7 +315,7 @@ class Skeleton_class // extends CommonObject $error=0; - $object=new Skeleton_class($this->db); + $object=new Skeleton_Class($this->db); $this->db->begin(); @@ -354,7 +360,9 @@ class Skeleton_class // extends CommonObject /** * Initialisz object with example values - * Id must be 0 if object instance is a specimen. + * Id must be 0 if object instance is a specimen + * + * @return none */ function initAsSpecimen() { diff --git a/dev/skeletons/skeleton_page.php b/dev/skeletons/skeleton_page.php index eb370824773..02691716247 100644 --- a/dev/skeletons/skeleton_page.php +++ b/dev/skeletons/skeleton_page.php @@ -70,7 +70,7 @@ if ($user->societe_id > 0) if ($_GET["action"] == 'add' || $_POST["action"] == 'add') { - $myobject=new Skeleton_class($db); + $myobject=new Skeleton_Class($db); $myobject->prop1=$_POST["field1"]; $myobject->prop2=$_POST["field2"]; $result=$myobject->create($user); diff --git a/dev/skeletons/skeleton_script.php b/dev/skeletons/skeleton_script.php index b07271a314e..0b9fa343d63 100644 --- a/dev/skeletons/skeleton_script.php +++ b/dev/skeletons/skeleton_script.php @@ -71,7 +71,7 @@ $db->begin(); // Examples for manipulating class skeleton_class require_once(DOL_DOCUMENT_ROOT."/../dev/skeletons/skeleton_class.class.php"); -$myobject=new Skeleton_class($db); +$myobject=new Skeleton_Class($db); // Example for inserting creating object in database /* diff --git a/dev/translation/autotranslator.php b/dev/translation/autotranslator.php index 3aa6b45aa50..17ec9feb824 100644 --- a/dev/translation/autotranslator.php +++ b/dev/translation/autotranslator.php @@ -85,7 +85,6 @@ if ($argv[2] != 'all') } } -// Examples for manipulating class skeleton_class require_once(DOL_DOCUMENT_ROOT."/../dev/translation/langAutoParser.class.php"); $langParser = new langAutoParser($argv[2],$argv[1],$dir,$file);