Completed
Pull Request — master (#4852)
by
unknown
15:00
created
src/Codeception/Module/Db.php 1 patch
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -402,6 +402,9 @@  discard block
 block discarded – undo
402 402
         return $lastInsertId;
403 403
     }
404 404
     
405
+    /**
406
+     * @param string $table
407
+     */
405 408
     public function _insertInDatabase($table, array $data)
406 409
     {
407 410
         $query = $this->driver->insert($table, $data);
@@ -420,6 +423,10 @@  discard block
 block discarded – undo
420 423
         return $lastInsertId;
421 424
     }
422 425
 
426
+    /**
427
+     * @param string $table
428
+     * @param integer $id
429
+     */
423 430
     private function addInsertedRow($table, array $row, $id)
424 431
     {
425 432
         $primaryKey = $this->driver->getPrimaryKey($table);
@@ -510,6 +517,10 @@  discard block
 block discarded – undo
510 517
         return (int) $this->proceedSeeInDatabase($table, 'count(*)', $criteria);
511 518
     }
512 519
 
520
+    /**
521
+     * @param string $table
522
+     * @param string $column
523
+     */
513 524
     protected function proceedSeeInDatabase($table, $column, $criteria)
514 525
     {
515 526
         $query = $this->driver->select($column, $table, $criteria);
Please login to merge, or discard this patch.
ext/RunFailed.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
             $this->group = $this->config['fail-group'];
46 46
         }
47 47
         $logPath = str_replace($this->getRootDir(), '', $this->getLogDir()); // get local path to logs
48
-        $this->_reconfigure(['groups' => [$this->group => $logPath . $this->group]]);
48
+        $this->_reconfigure(['groups' => [$this->group => $logPath.$this->group]]);
49 49
     }
50 50
 
51 51
     public function saveFailed(PrintResultEvent $e)
52 52
     {
53
-        $file = $this->getLogDir() . $this->group;
53
+        $file = $this->getLogDir().$this->group;
54 54
         $result = $e->getResult();
55 55
         if ($result->wasSuccessful()) {
56 56
             if (is_file($file)) {
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
     protected function localizePath($path)
73 73
     {
74
-        $root = realpath($this->getRootDir()) . DIRECTORY_SEPARATOR;
74
+        $root = realpath($this->getRootDir()).DIRECTORY_SEPARATOR;
75 75
         if (substr($path, 0, strlen($root)) == $root) {
76 76
             return substr($path, strlen($root));
77 77
         }
Please login to merge, or discard this patch.
src/Codeception/Lib/Driver/Db.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
                 continue;
119 119
             }
120 120
 
121
-            $query .= "\n" . rtrim($sqlLine);
121
+            $query .= "\n".rtrim($sqlLine);
122 122
 
123 123
             if (substr($query, -1 * $delimiterLength, $delimiterLength) == $delimiter) {
124 124
                 $this->sqlQuery(substr($query, 0, -1 * $delimiterLength));
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         $params = [];
178 178
         foreach ($criteria as $k => $v) {
179 179
             if ($v === null) {
180
-                $params[] = $this->getQuotedName($k) . " IS NULL ";
180
+                $params[] = $this->getQuotedName($k)." IS NULL ";
181 181
                 unset($criteria[$k]);
182 182
                 continue;
183 183
             }
@@ -192,16 +192,16 @@  discard block
 block discarded – undo
192 192
                 $hasOperand = true;
193 193
                 $k = str_ireplace(" $operand", '', $k);
194 194
                 $operand = strtoupper($operand);
195
-                $params[] = $this->getQuotedName($k) . " $operand ? ";
195
+                $params[] = $this->getQuotedName($k)." $operand ? ";
196 196
                 break;
197 197
             }
198 198
 
199 199
             if (!$hasOperand) {
200
-                $params[] = $this->getQuotedName($k) . " = ? ";
200
+                $params[] = $this->getQuotedName($k)." = ? ";
201 201
             }
202 202
         }
203 203
 
204
-        return 'WHERE ' . implode('AND ', $params);
204
+        return 'WHERE '.implode('AND ', $params);
205 205
     }
206 206
     
207 207
     /**
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
      */
210 210
     public function deleteQuery($table, $id, $primaryKey = 'id')
211 211
     {
212
-        $query = 'DELETE FROM ' . $this->getQuotedName($table) . ' WHERE ' . $this->getQuotedName($primaryKey) . ' = ?';
212
+        $query = 'DELETE FROM '.$this->getQuotedName($table).' WHERE '.$this->getQuotedName($primaryKey).' = ?';
213 213
         $this->executeQuery($query, [$id]);
214 214
     }
215 215
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     {
218 218
         $where = $this->generateWhereClause($criteria);
219 219
 
220
-        $query = 'DELETE FROM ' . $this->getQuotedName($table) . ' ' . $where;
220
+        $query = 'DELETE FROM '.$this->getQuotedName($table).' '.$where;
221 221
         $this->executeQuery($query, array_values($criteria));
222 222
     }
223 223
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
     public function getQuotedName($name)
230 230
     {
231
-        return '"' . str_replace('.', '"."', $name) . '"';
231
+        return '"'.str_replace('.', '"."', $name).'"';
232 232
     }
233 233
 
234 234
     protected function sqlLine($sql)
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         } catch (\PDOException $e) {
249 249
             throw new ModuleException(
250 250
                 'Codeception\Module\Db',
251
-                $e->getMessage() . "\nSQL query being executed: " . $query
251
+                $e->getMessage()."\nSQL query being executed: ".$query
252 252
             );
253 253
         }
254 254
     }
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 
329 329
         $set = [];
330 330
         foreach ($data as $column => $value) {
331
-            $set[] = $this->getQuotedName($column) . " = ?";
331
+            $set[] = $this->getQuotedName($column)." = ?";
332 332
         }
333 333
 
334 334
         $where = $this->generateWhereClause($criteria);
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -33,6 +33,9 @@  discard block
 block discarded – undo
33 33
      */
34 34
     protected $primaryKeys = [];
35 35
 
36
+    /**
37
+     * @param string $dsn
38
+     */
36 39
     public static function connect($dsn, $user, $password, $options = null)
37 40
     {
38 41
         $dbh = new \PDO($dsn, $user, $password, $options);
@@ -339,6 +342,9 @@  discard block
 block discarded – undo
339 342
         return empty($this->primaryKeys);
340 343
     }
341 344
 
345
+    /**
346
+     * @param string $table
347
+     */
342 348
     public function update($table, array $data, array $criteria)
343 349
     {
344 350
         if (empty($data)) {
Please login to merge, or discard this patch.
src/Codeception/Lib/Driver/PostgreSql.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -85,6 +85,9 @@
 block discarded – undo
85 85
         return true;
86 86
     }
87 87
 
88
+    /**
89
+     * @param string $query
90
+     */
88 91
     public function sqlQuery($query)
89 92
     {
90 93
         if (strpos(trim($query), 'COPY ') === 0) {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                 $this->searchPath = $match[0];
49 49
             }
50 50
 
51
-            $query .= "\n" . rtrim($sqlLine);
51
+            $query .= "\n".rtrim($sqlLine);
52 52
 
53 53
             if (!$dollarsOpen && substr($query, -1 * $delimiterLength, $delimiterLength) == $delimiter) {
54 54
                 $this->sqlQuery(substr($query, 0, -1 * $delimiterLength));
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 
76 76
         if ($sql == '\.') {
77 77
             $this->putline = false;
78
-            pg_put_line($this->connection, $sql . "\n");
78
+            pg_put_line($this->connection, $sql."\n");
79 79
             pg_end_copy($this->connection);
80 80
             pg_close($this->connection);
81 81
         } else {
82
-            pg_put_line($this->connection, $sql . "\n");
82
+            pg_put_line($this->connection, $sql."\n");
83 83
         }
84 84
 
85 85
         return true;
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
                 );
102 102
             }
103 103
             $constring = str_replace(';', ' ', substr($this->dsn, 6));
104
-            $constring .= ' user=' . $this->user;
105
-            $constring .= ' password=' . $this->password;
104
+            $constring .= ' user='.$this->user;
105
+            $constring .= ' password='.$this->password;
106 106
             $this->connection = pg_connect($constring);
107 107
 
108 108
             if ($this->searchPath !== null) {
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
          * is based on how postgres names sequences for SERIAL columns
127 127
          */
128 128
 
129
-        $sequenceName = $this->getQuotedName($table . '_id_seq');
129
+        $sequenceName = $this->getQuotedName($table.'_id_seq');
130 130
         $lastSequence = null;
131 131
 
132 132
         try {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         if (!$lastSequence) {
141 141
             $primaryKeys = $this->getPrimaryKey($table);
142 142
             $pkName = array_shift($primaryKeys);
143
-            $lastSequence = $this->getDbh()->lastInsertId($this->getQuotedName($table . '_' . $pkName . '_seq'));
143
+            $lastSequence = $this->getDbh()->lastInsertId($this->getQuotedName($table.'_'.$pkName.'_seq'));
144 144
         }
145 145
 
146 146
         return $lastSequence;
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             $stmt = $this->executeQuery($query, []);
168 168
             $columns = $stmt->fetchAll(\PDO::FETCH_ASSOC);
169 169
             foreach ($columns as $column) {
170
-                $primaryKey []= $column['attname'];
170
+                $primaryKey [] = $column['attname'];
171 171
             }
172 172
             $this->primaryKeys[$tableName] = $primaryKey;
173 173
         }
Please login to merge, or discard this patch.
src/Codeception/Lib/Driver/SqlSrv.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,18 +58,18 @@  discard block
 block discarded – undo
58 58
         foreach ($criteria as $k => $v) {
59 59
             if (strpos(strtolower($k), ' like') > 0) {
60 60
                 $k = str_replace(' like', '', strtolower($k));
61
-                $params[] = $this->getQuotedName($k) . " LIKE ? ";
61
+                $params[] = $this->getQuotedName($k)." LIKE ? ";
62 62
             } else {
63
-                $params[] = $this->getQuotedName($k) . " = ? ";
63
+                $params[] = $this->getQuotedName($k)." = ? ";
64 64
             }
65 65
         }
66 66
 
67
-        return 'WHERE ' . implode('AND ', $params);
67
+        return 'WHERE '.implode('AND ', $params);
68 68
     }
69 69
 
70 70
     public function getQuotedName($name)
71 71
     {
72
-        return '[' . str_replace('.', '].[', $name) . ']';
72
+        return '['.str_replace('.', '].[', $name).']';
73 73
     }
74 74
 
75 75
     /**
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             $columns = $stmt->fetchAll(\PDO::FETCH_ASSOC);
94 94
 
95 95
             foreach ($columns as $column) {
96
-                $primaryKey []= $column['Column_Name'];
96
+                $primaryKey [] = $column['Column_Name'];
97 97
             }
98 98
             $this->primaryKeys[$tableName] = $primaryKey;
99 99
         }
Please login to merge, or discard this patch.
src/Codeception/Coverage/Subscriber/RemoteServer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 
43 43
     protected function retrieveAndPrintHtml($suite)
44 44
     {
45
-        $tempFile = tempnam(sys_get_temp_dir(), 'C3') . '.tar';
45
+        $tempFile = tempnam(sys_get_temp_dir(), 'C3').'.tar';
46 46
         file_put_contents($tempFile, $this->c3Request('html'));
47 47
 
48
-        $destDir = Configuration::outputDir() . $suite . '.remote.coverage';
48
+        $destDir = Configuration::outputDir().$suite.'.remote.coverage';
49 49
         if (is_dir($destDir)) {
50 50
             FileSystem::doEmptyDir($destDir);
51 51
         } else {
@@ -60,22 +60,22 @@  discard block
 block discarded – undo
60 60
 
61 61
     protected function retrieveAndPrintXml($suite)
62 62
     {
63
-        $destFile = Configuration::outputDir() . $suite . '.remote.coverage.xml';
63
+        $destFile = Configuration::outputDir().$suite.'.remote.coverage.xml';
64 64
         file_put_contents($destFile, $this->c3Request('clover'));
65 65
     }
66 66
 
67 67
     protected function retrieveAndPrintCrap4j($suite)
68 68
     {
69
-        $destFile = Configuration::outputDir() . $suite . '.remote.crap4j.xml';
69
+        $destFile = Configuration::outputDir().$suite.'.remote.crap4j.xml';
70 70
         file_put_contents($destFile, $this->c3Request('crap4j'));
71 71
     }
72 72
 
73 73
     protected function retrieveAndPrintPHPUnit($suite)
74 74
     {
75
-        $tempFile = tempnam(sys_get_temp_dir(), 'C3') . '.tar';
75
+        $tempFile = tempnam(sys_get_temp_dir(), 'C3').'.tar';
76 76
         file_put_contents($tempFile, $this->c3Request('phpunit'));
77 77
 
78
-        $destDir = Configuration::outputDir() . $suite . '.remote.coverage-phpunit';
78
+        $destDir = Configuration::outputDir().$suite.'.remote.coverage-phpunit';
79 79
         if (is_dir($destDir)) {
80 80
             FileSystem::doEmptyDir($destDir);
81 81
         } else {
Please login to merge, or discard this patch.
src/Codeception/Module/Symfony.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@
 block discarded – undo
9 9
 use Codeception\Lib\Interfaces\PartedModule;
10 10
 use Symfony\Component\Finder\Finder;
11 11
 use Symfony\Component\DependencyInjection\ContainerInterface;
12
-use Symfony\Component\Finder\SplFileInfo;
13 12
 use Symfony\Component\VarDumper\Cloner\Data;
14 13
 
15 14
 /**
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -172,16 +172,16 @@  discard block
 block discarded – undo
172 172
      */
173 173
     private function initializeSymfonyCache()
174 174
     {
175
-        $cache = Configuration::projectDir() . $this->config['var_path'] . DIRECTORY_SEPARATOR . 'bootstrap.php.cache';
175
+        $cache = Configuration::projectDir().$this->config['var_path'].DIRECTORY_SEPARATOR.'bootstrap.php.cache';
176 176
         if (PHP_VERSION_ID < 70000 && !file_exists($cache)) {
177 177
             throw new ModuleRequireException(
178 178
                 __CLASS__,
179
-                "Symfony bootstrap file not found in $cache\n \n" .
180
-                "Please specify path to bootstrap file using `var_path` config option\n \n" .
181
-                "If you are trying to load bootstrap from a Bundle provide path like:\n \n" .
182
-                "modules:\n    enabled:\n" .
183
-                "    - Symfony:\n" .
184
-                "        var_path: '../../app'\n" .
179
+                "Symfony bootstrap file not found in $cache\n \n".
180
+                "Please specify path to bootstrap file using `var_path` config option\n \n".
181
+                "If you are trying to load bootstrap from a Bundle provide path like:\n \n".
182
+                "modules:\n    enabled:\n".
183
+                "    - Symfony:\n".
184
+                "        var_path: '../../app'\n".
185 185
                 "        app_path: '../../app'"
186 186
             );
187 187
         }
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
      */
257 257
     protected function getKernelClass()
258 258
     {
259
-        $path = codecept_root_dir() . $this->config['app_path'];
260
-        if (!file_exists(codecept_root_dir() . $this->config['app_path'])) {
259
+        $path = codecept_root_dir().$this->config['app_path'];
260
+        if (!file_exists(codecept_root_dir().$this->config['app_path'])) {
261 261
             throw new ModuleRequireException(
262 262
                 __CLASS__,
263 263
                 "Can't load Kernel from $path.\n"
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
         }
278 278
         $file = current($results);
279 279
 
280
-        if (file_exists(codecept_root_dir() . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php')) {
280
+        if (file_exists(codecept_root_dir().'vendor'.DIRECTORY_SEPARATOR.'autoload.php')) {
281 281
             // ensure autoloader from this dir is loaded
282
-            require_once codecept_root_dir() . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
282
+            require_once codecept_root_dir().'vendor'.DIRECTORY_SEPARATOR.'autoload.php';
283 283
         }
284 284
 
285 285
         require_once $file;
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
                     $this->debugSection(
532 532
                         'User',
533 533
                         $profile->getCollector('security')->getUser()
534
-                        . ' [' . implode(',', $roles) . ']'
534
+                        . ' ['.implode(',', $roles).']'
535 535
                     );
536 536
                 } else {
537 537
                     $this->debugSection('User', 'Anonymous');
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
             if ($profile->hasCollector('swiftmailer')) {
541 541
                 $messages = $profile->getCollector('swiftmailer')->getMessageCount();
542 542
                 if ($messages) {
543
-                    $this->debugSection('Emails', $messages . ' sent');
543
+                    $this->debugSection('Emails', $messages.' sent');
544 544
                 }
545 545
             }
546 546
             if ($profile->hasCollector('timer')) {
Please login to merge, or discard this patch.
src/Codeception/Test/Metadata.php 1 patch
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     }
48 48
 
49 49
     /**
50
-     * @return mixed
50
+     * @return string
51 51
      */
52 52
     public function getSkip()
53 53
     {
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     }
64 64
 
65 65
     /**
66
-     * @return mixed
66
+     * @return string
67 67
      */
68 68
     public function getIncomplete()
69 69
     {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     /**
82 82
      * @param string|null $key
83
-     * @return mixed
83
+     * @return string
84 84
      */
85 85
     public function getCurrent($key = null)
86 86
     {
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     }
165 165
 
166 166
     /**
167
-     * @param $service
167
+     * @param string $service
168 168
      * @return array
169 169
      * @throws InjectionException
170 170
      */
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
     }
195 195
 
196 196
     /**
197
-     * @param $type
198
-     * @param $report
197
+     * @param string $type
198
+     * @param string $report
199 199
      */
200 200
     public function addReport($type, $report)
201 201
     {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      * Returns test params like: env, group, skip, incomplete, etc
207 207
      * Can return by annotation or return all if no key passed
208 208
      *
209
-     * @param null $key
209
+     * @param string $key
210 210
      * @return array|mixed|null
211 211
      */
212 212
     public function getParam($key = null)
Please login to merge, or discard this patch.
src/Codeception/Lib/Generator/Actions.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         }
83 83
 
84 84
         return (new Template($this->template))
85
-            ->place('namespace', $namespace ? $namespace . '\\' : '')
85
+            ->place('namespace', $namespace ? $namespace.'\\' : '')
86 86
             ->place('hash', self::genHash($this->modules, $this->settings))
87 87
             ->place('name', $this->name)
88 88
             ->place('methods', implode("\n\n ", $code))
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             $doc = "*";
104 104
         }
105 105
 
106
-        $conditionalDoc = $doc . "\n     * Conditional Assertion: Test won't be stopped on fail";
106
+        $conditionalDoc = $doc."\n     * Conditional Assertion: Test won't be stopped on fail";
107 107
 
108 108
         $methodTemplate = (new Template($this->methodTemplate))
109 109
             ->place('module', $module)
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             $type = 'Assertion';
116 116
             $body .= $methodTemplate
117 117
                 ->place('doc', $conditionalDoc)
118
-                ->place('action', 'can' . ucfirst($refMethod->name))
118
+                ->place('action', 'can'.ucfirst($refMethod->name))
119 119
                 ->place('step', 'ConditionalAssertion')
120 120
                 ->produce();
121 121
 
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
         $params = [];
152 152
         foreach ($refMethod->getParameters() as $param) {
153 153
             if ($param->isOptional()) {
154
-                $params[] = '$' . $param->name . ' = null';
154
+                $params[] = '$'.$param->name.' = null';
155 155
             } else {
156
-                $params[] = '$' . $param->name;
156
+                $params[] = '$'.$param->name;
157 157
             };
158 158
         }
159 159
         return implode(', ', $params);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             $actions[$moduleName] = get_class_methods(get_class($module));
198 198
         }
199 199
 
200
-        return md5(Codecept::VERSION . serialize($actions) . serialize($settings['modules']));
200
+        return md5(Codecept::VERSION.serialize($actions).serialize($settings['modules']));
201 201
     }
202 202
 
203 203
     public function getNumMethods()
Please login to merge, or discard this patch.