diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php
index 9910e27699590997a6528168bf291ca267058df3..a142fc1056deab841b3cbf5f590a19295313ac80 100644
--- a/include/ajax.tickets.php
+++ b/include/ajax.tickets.php
@@ -214,8 +214,8 @@ class TicketsAjaxAPI extends AjaxController {
             if ($f->get('name') && isset($req[$f->getFormName()])
                     && ($val = $req[$f->getFormName()])) {
                 $name = $f->get('name');
-                $vals[] = "MAX(IF(field.name = '$name', ans.value_id, NULL)) as `{$name}_id`"; # nolint
-                $vals[] = "MAX(IF(field.name = '$name', ans.value, NULL)) as `$name`"; # nolint
+                $vals[] = "MAX(IF(field.name = '$name', ans.value_id, NULL)) as `{$name}_id`";
+                $vals[] = "MAX(IF(field.name = '$name', ans.value, NULL)) as `$name`";
                 $where .= " AND (dyn.`{$name}_id` = ".db_input($val)
                     . " OR dyn.`$name` LIKE '%".db_real_escape($val)."%')";
             }
diff --git a/include/class.format.php b/include/class.format.php
index 6cf6df89c90efc9196bdb02b91e641b640fdf79d..fd51d95867d76918bb85e5a34d1eb524ee2066ff 100644
--- a/include/class.format.php
+++ b/include/class.format.php
@@ -260,8 +260,8 @@ class Format {
         //Wrap long words...
         #$text=preg_replace_callback('/\w{75,}/',
         #    create_function(
-        #        '$matches',                                     # nolint
-        #        'return wordwrap($matches[0],70,"\n",true);'),  # nolint
+        #        '$matches',
+        #        'return wordwrap($matches[0],70,"\n",true);'),
         #    $text);
 
         // Make showing offsite images optional
@@ -295,14 +295,14 @@ class Format {
         $token = $ost->getLinkToken();
         //Not perfect but it works - please help improve it.
         $text=preg_replace_callback('/(?<!"|>)(((f|ht)tp(s?):\/\/)[-a-zA-Z0-9@:%_\+.~#?&;\/\/=]+)/',
-                create_function('$matches', # nolint
-                    sprintf('return "<a href=\"l.php?url=".urlencode($matches[1])."&auth=%s\" target=\"_blank\">".$matches[1]."</a>";', # nolint
+                create_function('$matches',
+                    sprintf('return "<a href=\"l.php?url=".urlencode($matches[1])."&auth=%s\" target=\"_blank\">".$matches[1]."</a>";',
                         $token)),
                 $text);
 
         $text=preg_replace_callback("/(^|[ \\n\\r\\t])(www\.([a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+)(\/[^\/ \\n\\r]*)*)/",
-                create_function('$matches', # nolint
-                    sprintf('return "<a href=\"l.php?url=".urlencode("http://".$matches[2])."&auth=%s\" target=\"_blank\">".$matches[2]."</a>";', # nolint
+                create_function('$matches',
+                    sprintf('return "<a href=\"l.php?url=".urlencode("http://".$matches[2])."&auth=%s\" target=\"_blank\">".$matches[2]."</a>";',
                         $token)),
                 $text);
 
diff --git a/include/class.mailparse.php b/include/class.mailparse.php
index afc89008c32342f61c464c9962a5eabc4179cc16..15247689ca10f3ea5c059c11efd26956002ae70f 100644
--- a/include/class.mailparse.php
+++ b/include/class.mailparse.php
@@ -63,8 +63,8 @@ class Mail_Parse {
         $match = array();
         if (preg_match("/^(.*?)\r?\n\r?\n(.*)/s",
                 $this->mime_message,
-                $match)) {                                  # nolint
-            $this->header=$match[1];                        # nolint
+                $match)) {
+            $this->header=$match[1];
         }
     }
     /**
diff --git a/include/html2text.php b/include/html2text.php
index 713b449274a062328f64d45f52da8b91412002c0..6234f5781e487a3080cc0817e3a9d97f1aa4068b 100644
--- a/include/html2text.php
+++ b/include/html2text.php
@@ -627,7 +627,7 @@ class HtmlTable extends HtmlBlockElement {
                 # Stash the computed width so it doesn't need to be
                 # recomputed again below
                 $cell->width = $cwidth;
-                unset($data); # nolint
+                unset($data);
                 $data = explode("\n", $cell->render($cwidth, $options));
                 $heights[$y] = max(count($data), $heights[$y]);
                 $contents[$y][$i] = &$data;
diff --git a/include/mysql.php b/include/mysql.php
index 9e8194827bd997f00d1d5f9a2bd4c61305e008a8..95be46f5a93b8ee239f13fa441bd94494dad35bc 100644
--- a/include/mysql.php
+++ b/include/mysql.php
@@ -54,8 +54,8 @@
         $matches = array();
         if(preg_match('/(\d{1,2}\.\d{1,2}\.\d{1,2})/',
                 mysql_result(db_query('SELECT VERSION()'),0,0),
-                $matches))                                      # nolint
-            $version=$matches[1];                               # nolint
+                $matches))
+            $version=$matches[1];
 
         return $version;
     }
diff --git a/include/mysqli.php b/include/mysqli.php
index 9d942eb51e2d0d9b1d343a2d3b82090a0d23a211..7d765b428ac35b350dc9c9f4dd58f3e6b22af5c7 100644
--- a/include/mysqli.php
+++ b/include/mysqli.php
@@ -30,7 +30,7 @@ function db_connect($host, $user, $passwd, $options = array()) {
 
     // Setup SSL if enabled
     if (isset($options['ssl']))
-        $__db->ssl_set( # nolint
+        $__db->ssl_set(
                 $options['ssl']['key'],
                 $options['ssl']['cert'],
                 $options['ssl']['ca'],
@@ -50,16 +50,16 @@ function db_connect($host, $user, $passwd, $options = array()) {
 
     // Connect
     $start = microtime(true);
-    if (!@$__db->real_connect($host, $user, $passwd, null, $port)) # nolint
+    if (!@$__db->real_connect($host, $user, $passwd, null, $port))
         return NULL;
 
     //Select the database, if any.
-    if(isset($options['db'])) $__db->select_db($options['db']); # nolint
+    if(isset($options['db'])) $__db->select_db($options['db']);
 
     //set desired encoding just in case mysql charset is not UTF-8 - Thanks to FreshMedia
-    @$__db->query('SET NAMES "utf8"');                          # nolint
-    @$__db->query('SET CHARACTER SET "utf8"');                  # nolint
-    @$__db->query('SET COLLATION_CONNECTION=utf8_general_ci');  # nolint
+    @$__db->query('SET NAMES "utf8"');
+    @$__db->query('SET CHARACTER SET "utf8"');
+    @$__db->query('SET COLLATION_CONNECTION=utf8_general_ci');
 
     @db_set_variable('sql_mode', '');
 
@@ -80,8 +80,8 @@ function db_version() {
     $matches = array();
     if(preg_match('/(\d{1,2}\.\d{1,2}\.\d{1,2})/',
             db_result(db_query('SELECT VERSION()')),
-            $matches))                                      # nolint
-        $version=$matches[1];                               # nolint
+            $matches))
+        $version=$matches[1];
 
     return $version;
 }
@@ -103,13 +103,13 @@ function db_set_variable($variable, $value, $type='session') {
 
 function db_select_database($database) {
     global $__db;
-    return ($database && @$__db->select_db($database)); # nolint
+    return ($database && @$__db->select_db($database));
 }
 
 function db_create_database($database, $charset='utf8',
         $collate='utf8_general_ci') {
     global $__db;
-    return @$__db->query( # nolint
+    return @$__db->query(
         sprintf('CREATE DATABASE %s DEFAULT CHARACTER SET %s COLLATE %s',
             $database, $charset, $collate));
 }
@@ -148,21 +148,21 @@ function db_result($res, $row=0) {
     if (!$res)
         return NULL;
 
-    $res->data_seek($row); # nolint
+    $res->data_seek($row);
     list($value) = db_output($res->fetch_row());
     return $value;
 }
 
 function db_fetch_array($res, $mode=MYSQL_ASSOC) {
-    return ($res) ? db_output($res->fetch_array($mode)) : NULL; # nolint
+    return ($res) ? db_output($res->fetch_array($mode)) : NULL;
 }
 
 function db_fetch_row($res) {
-    return ($res) ? db_output($res->fetch_row()) : NULL; # nolint
+    return ($res) ? db_output($res->fetch_row()) : NULL;
 }
 
 function db_fetch_field($res) {
-    return ($res) ? $res->fetch_field() : NULL; # nolint
+    return ($res) ? $res->fetch_field() : NULL;
 }
 
 function db_assoc_array($res, $mode=false) {
@@ -175,7 +175,7 @@ function db_assoc_array($res, $mode=false) {
 }
 
 function db_num_rows($res) {
-    return ($res) ? $res->num_rows : 0; # nolint
+    return ($res) ? $res->num_rows : 0;
 }
 
 function db_affected_rows() {
@@ -184,7 +184,7 @@ function db_affected_rows() {
 }
 
 function db_data_seek($res, $row_number) {
-    return ($res && $res->data_seek($row_number)); # nolint
+    return ($res && $res->data_seek($row_number));
 }
 
 function db_data_reset($res) {
@@ -197,7 +197,7 @@ function db_insert_id() {
 }
 
 function db_free_result($res) {
-    return ($res && $res->free()); # nolint
+    return ($res && $res->free());
 }
 
 function db_output($var) {
@@ -234,7 +234,7 @@ function db_input($var, $quote=true) {
 
 function db_field_type($res, $col=0) {
     global $__db;
-    return $res->fetch_field_direct($col); # nolint
+    return $res->fetch_field_direct($col);
 }
 
 function db_prepare($stmt) {
diff --git a/setup/cli/modules/class.module.php b/setup/cli/modules/class.module.php
index 788cb21fbde330821ab9feb9855475ab9b156a57..437f87c609eb6b63f6799978ce324f437a456ca5 100644
--- a/setup/cli/modules/class.module.php
+++ b/setup/cli/modules/class.module.php
@@ -72,10 +72,10 @@ class Option {
         $short = explode(':', $this->short);
         $long = explode(':', $this->long);
         if ($this->nargs === '?')
-            $switches = sprintf('    %s [%3$s], %s[=%3$s]', $short[0], # nolint
+            $switches = sprintf('    %s [%3$s], %s[=%3$s]', $short[0],
                 $long[0], $this->metavar);
         elseif ($this->hasArg())
-            $switches = sprintf('    %s %3$s, %s=%3$s', $short[0], $long[0], # nolint
+            $switches = sprintf('    %s %3$s, %s=%3$s', $short[0], $long[0],
                 $this->metavar);
         else
             $switches = sprintf("    %s, %s", $short[0], $long[0]);
@@ -143,7 +143,7 @@ class Module {
 
         echo "Usage:\n";
         echo "    " . str_replace(
-                array('$script', '$args'), # nolint
+                array('$script', '$args'),
                 array($manager ." ". $this->module_name, implode(' ', array_keys($this->arguments))),
             $this->usage) . "\n";
 
diff --git a/setup/test/tests/stubs.php b/setup/test/tests/stubs.php
index fba61da31c613e7a3cae65f8ba37c8f08f599a27..73afec7cd326565fe56d30f0690281a6dd565b7f 100644
--- a/setup/test/tests/stubs.php
+++ b/setup/test/tests/stubs.php
@@ -6,14 +6,23 @@ class mysqli {
     function real_escape_string() {}
     function fetch_row() {}
     function prepare() {}
+    function ssl_set() {}
+    function real_connect() {}
+    function select_db() {}
 }
 
 class mysqli_stmt {
+    var $num_rows;
+
     function store_result() {}
     function data_seek() {}
     function fetch() {}
+    function fetch_array() {}
     function fetch_field() {}
+    function fetch_field_direct() {}
+    function fetch_row() {}
     function result_metadata() {}
+    function free() {}
 }
 
 class ReflectionClass {