Passed
Push — master ( dc3f28...9cb9a1 )
by Andreas
16:51
created
lib/net/nehmer/comments/midcom/interfaces.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,8 @@
 block discarded – undo
47 47
         if ($node_id) {
48 48
             try {
49 49
                 $comments_topic = new midcom_db_topic($node_id);
50
-            } catch (midcom_error) {
50
+            }
51
+            catch (midcom_error) {
51 52
                 return null;
52 53
             }
53 54
 
Please login to merge, or discard this patch.
lib/net/nemein/rss/cron/fetchfeeds.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@
 block discarded – undo
29 29
         foreach ($qb->execute() as $feed) {
30 30
             try {
31 31
                 midcom_db_topic::get_cached($feed->node);
32
-            } catch (midcom_error) {
32
+            }
33
+            catch (midcom_error) {
33 34
                 debug_add("Node #{$feed->node} does not exist, skipping feed #{$feed->id}", MIDCOM_LOG_ERROR);
34 35
                 continue;
35 36
             }
Please login to merge, or discard this patch.
lib/midgard/admin/asgard/handler/welcome.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -112,7 +112,8 @@  discard block
 block discarded – undo
112 112
             $row['approved'] = $object->is_approved() ? $object->metadata->approved : '';
113 113
             try {
114 114
                 $row['index_title'] = $reflector->get_object_label($object) ?: '[' . $this->_l10n->get('no title') . ']';
115
-            } catch (Exception $e) {
115
+            }
116
+            catch (Exception $e) {
116 117
                 $row['index_title'] = 'ERROR: ' . $e->getMessage();
117 118
             }
118 119
             $link = $this->router->generate('object_' . $this->_request_data['default_mode'], ['guid' => $object->guid]);
@@ -177,7 +178,8 @@  discard block
 block discarded – undo
177 178
         foreach ($guids as $guid) {
178 179
             try {
179 180
                 $object = midcom::get()->dbfactory->get_object_by_guid($guid);
180
-            } catch (midcom_error) {
181
+            }
182
+            catch (midcom_error) {
181 183
                 continue;
182 184
             }
183 185
 
@@ -192,7 +194,8 @@  discard block
 block discarded – undo
192 194
         foreach ($guids as $guid) {
193 195
             try {
194 196
                 $object = midcom::get()->dbfactory->get_object_by_guid($guid);
195
-            } catch (midcom_error) {
197
+            }
198
+            catch (midcom_error) {
196 199
                 continue;
197 200
             }
198 201
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
                 $qb = new midcom_core_querybuilder($midcom_dba_classname);
32 32
                 $qb->add_constraint('metadata.revised', '>=', $since);
33 33
 
34
-                if (   $only_mine
34
+                if ($only_mine
35 35
                     && $guid = midcom::get()->auth->user?->guid) {
36 36
                     $qb->add_constraint('metadata.authors', 'LIKE', '|' . $guid . '|');
37 37
                 }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
                 continue;
197 197
             }
198 198
 
199
-            if (   $object->can_do('midgard:update')
199
+            if ($object->can_do('midgard:update')
200 200
                 && $object->can_do('midcom:approve')) {
201 201
                 $object->metadata->approve();
202 202
                 midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('object %s approved'), $object->guid));
Please login to merge, or discard this patch.
lib/midgard/admin/user/style/midgard-admin-user-group-folders.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,8 @@
 block discarded – undo
17 17
         foreach ($data['objects'] as $guid => $privs) {
18 18
             try {
19 19
                 $object = new midcom_db_topic($guid);
20
-            } catch (midcom_error) {
20
+            }
21
+            catch (midcom_error) {
21 22
                 continue;
22 23
             }
23 24
             echo "<tr>\n";
Please login to merge, or discard this patch.
lib/midcom/db/member.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
26 26
         try {
27 27
             $person = new midcom_db_person($this->uid);
28 28
             $grp = new midcom_db_group($this->gid);
29
-        } catch (midcom_error $e) {
29
+        }
30
+        catch (midcom_error $e) {
30 31
             $e->log();
31 32
             return 'Invalid membership record';
32 33
         }
@@ -43,7 +44,8 @@  discard block
 block discarded – undo
43 44
         }
44 45
         try {
45 46
             $person = new midcom_db_person($this->uid);
46
-        } catch (midcom_error) {
47
+        }
48
+        catch (midcom_error) {
47 49
             return;
48 50
         }
49 51
         midcom::get()->cache->invalidate($person->guid);
Please login to merge, or discard this patch.
lib/midcom/db/style.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,8 @@
 block discarded – undo
43 43
                     break;
44 44
                 }
45 45
             }
46
-        } catch (midcom_error) {
46
+        }
47
+        catch (midcom_error) {
47 48
         }
48 49
 
49 50
         $path_parts = array_reverse($path_parts);
Please login to merge, or discard this patch.
lib/midcom/baseclasses/core/dbobject.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -423,7 +423,8 @@
 block discarded – undo
423 423
          */
424 424
         try {
425 425
             return $object->get_by_id($object->id);
426
-        } catch (Exception) {
426
+        }
427
+        catch (Exception) {
427 428
             return false;
428 429
         }
429 430
     }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
         if ($parent = $object->get_parent()) {
120 120
             // Attachments are a special case
121 121
             if ($object instanceof midcom_db_attachment) {
122
-                if (   !$parent->can_do('midgard:attachments')
122
+                if (!$parent->can_do('midgard:attachments')
123 123
                     || !$parent->can_do('midgard:update')) {
124 124
                     debug_add("Failed to create attachment, update or attachments privilege on the parent " . $parent::class . " {$parent->guid} not granted for the current user.",
125 125
                         MIDCOM_LOG_ERROR);
126 126
                     midcom_connection::set_error(MGD_ERR_ACCESS_DENIED);
127 127
                     return false;
128 128
                 }
129
-            } elseif (   !$parent->can_do('midgard:create')
129
+            } elseif (!$parent->can_do('midgard:create')
130 130
                       && !midcom::get()->auth->can_user_do('midgard:create', class: $object::class)) {
131 131
                 debug_add("Failed to create object, create privilege on the parent " . $parent::class . " {$parent->guid} or the actual object class not granted for the current user.",
132 132
                     MIDCOM_LOG_ERROR);
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
             }
239 239
 
240 240
             // Default the owner to first group of current user
241
-            if (   empty($object->metadata->owner)
241
+            if (empty($object->metadata->owner)
242 242
                 && $first_group = midcom::get()->auth->user->get_first_group_guid()) {
243 243
                 $object->metadata->set('owner', $first_group);
244 244
             }
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
      */
463 463
     public static function get_by_guid(midcom_core_dbaobject $object, string $guid) : bool
464 464
     {
465
-        if (   !midcom::get()->auth->admin
465
+        if (!midcom::get()->auth->admin
466 466
             && !midcom::get()->auth->acl->can_do_byguid('midgard:read', $guid, $object::class, midcom::get()->auth->acl->get_user_id())) {
467 467
             debug_add("Failed to load object, read privilege on the " . $object::class . " {$guid} not granted for the current user.", MIDCOM_LOG_ERROR);
468 468
             return false;
Please login to merge, or discard this patch.
lib/midcom/connection.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,8 @@
 block discarded – undo
84 84
 
85 85
         try {
86 86
             $user = new midgard_user($login_tokens);
87
-        } catch (mgd_exception) {
87
+        }
88
+        catch (mgd_exception) {
88 89
             return null;
89 90
         }
90 91
         if (!$trusted && !self::verify_password($password, $user->password)) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@
 block discarded – undo
201 201
             if ($part === '') {
202 202
                 continue;
203 203
             }
204
-            if (    midcom::get()->config->get('theme')
204
+            if (midcom::get()->config->get('theme')
205 205
                 && !$args_started
206 206
                 && self::check_page_exists($part)) {
207 207
                 $page_style .= '/' . $part;
Please login to merge, or discard this patch.
lib/midcom/helper/_dbfactory.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,8 @@  discard block
 block discarded – undo
50 50
     {
51 51
         try {
52 52
             $tmp = midgard_object_class::get_object_by_guid($guid);
53
-        } catch (mgd_exception $e) {
53
+        }
54
+        catch (mgd_exception $e) {
54 55
             debug_add('Loading object by GUID ' . $guid . ' failed, reason: ' . $e->getMessage(), MIDCOM_LOG_INFO);
55 56
 
56 57
             throw new midcom_error_midgard($e, $guid);
@@ -159,7 +160,8 @@  discard block
 block discarded – undo
159 160
 
160 161
         try {
161 162
             return $this->get_cached($classname, $parent_guid);
162
-        } catch (midcom_error) {
163
+        }
164
+        catch (midcom_error) {
163 165
             return null;
164 166
         }
165 167
     }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
             throw new midcom_error_midgard($e, $guid);
57 57
         }
58
-        if (   $tmp::class == 'midgard_person'
58
+        if ($tmp::class == 'midgard_person'
59 59
             && $this->person_class != 'midgard_person') {
60 60
             $tmp = new $this->person_class($guid);
61 61
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      *
68 68
      * @param string $classname Which DBA are we dealing with
69 69
      */
70
-    public function get_cached(string $classname, string|int $src) : midcom_core_dbaobject
70
+    public function get_cached(string $classname, string | int $src) : midcom_core_dbaobject
71 71
     {
72 72
         static $cache = [];
73 73
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         }
83 83
         $object = new $classname($src);
84 84
         $cache[$classname][$object->guid] = $object;
85
-        $cache[$classname][$object->id] =& $cache[$classname][$object->guid];
85
+        $cache[$classname][$object->id] = & $cache[$classname][$object->guid];
86 86
         return $cache[$classname][$object->guid];
87 87
     }
88 88
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             return true;
130 130
         }
131 131
 
132
-        if (   isset($object->__object)
132
+        if (isset($object->__object)
133 133
             && is_object($object->__object)
134 134
             && $object->__object instanceof $class) {
135 135
             // Decorator whose MgdSchema object matches
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             return $this->get_parent_data_uncached($object);
153 153
         });
154 154
 
155
-        if (   empty($parent_guid)
155
+        if (empty($parent_guid)
156 156
             || $parent_guid === $object->guid) {
157 157
             return null;
158 158
         }
Please login to merge, or discard this patch.