Passed
Push — develop ( 2bfc67...cda6cd )
by Andrew
04:19
created
src/autocompletes/TwigLanguageAutocomplete.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         $filters = array_keys($twig->getFilters());
249 249
         foreach ($filters as $filter) {
250 250
             $docs = self::FILTER_DOCS[$filter] ?? '';
251
-            $docs = str_replace('(#', '(' . self::CRAFT_FILTER_DOCS_URL . '#', $docs);
251
+            $docs = str_replace('(#', '('.self::CRAFT_FILTER_DOCS_URL.'#', $docs);
252 252
             CompleteItem::create()
253 253
                 ->label($filter)
254 254
                 ->insertText($filter)
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
         // Twig Functions
261 261
         $functions = array_keys($twig->getFunctions());
262 262
         foreach ($functions as $function) {
263
-            $functionLabel = $function . '()';
263
+            $functionLabel = $function.'()';
264 264
             $docs = self::FUNCTION_DOCS[$function] ?? '';
265
-            $docs = str_replace('(#', '(' . self::CRAFT_FUNCTION_DOCS_URL . '#', $docs);
265
+            $docs = str_replace('(#', '('.self::CRAFT_FUNCTION_DOCS_URL.'#', $docs);
266 266
             CompleteItem::create()
267 267
                 ->label($functionLabel)
268 268
                 ->insertText($functionLabel)
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         $tags = array_keys($twig->getTokenParsers());
276 276
         foreach ($tags as $tag) {
277 277
             $docs = self::TAG_DOCS[$tag] ?? '';
278
-            $docs = str_replace('(#', '(' . self::CRAFT_TAG_DOCS_URL . '#', $docs);
278
+            $docs = str_replace('(#', '('.self::CRAFT_TAG_DOCS_URL.'#', $docs);
279 279
             CompleteItem::create()
280 280
                 ->label($tag)
281 281
                 ->insertText($tag)
Please login to merge, or discard this patch.
src/services/AutocompleteService.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
             $name = $autocomplete->name;
112 112
             // Set up the cache parameters
113 113
             $cache = Craft::$app->getCache();
114
-            $cacheKey = $this->cacheKeyPrefix . $name;
114
+            $cacheKey = $this->cacheKeyPrefix.$name;
115 115
             $dependency = new TagDependency([
116 116
                 'tags' => [
117 117
                     self::AUTOCOMPLETE_CACHE_TAG,
118
-                    self::AUTOCOMPLETE_CACHE_TAG . $name,
118
+                    self::AUTOCOMPLETE_CACHE_TAG.$name,
119 119
                 ],
120 120
             ]);
121 121
             // Get the autocompletes from the cache, or generate them if they aren't cached
122
-            $autocompleteItems[$name] = $cache->getOrSet($cacheKey, static function () use ($name, $autocomplete) {
122
+            $autocompleteItems[$name] = $cache->getOrSet($cacheKey, static function() use ($name, $autocomplete) {
123 123
                 $autocomplete->generateCompleteItems();
124 124
                 return [
125 125
                     'name' => $name,
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     public function clearAutocompleteCache(string $autocompleteName = ''): void
143 143
     {
144 144
         $cache = Craft::$app->getCache();
145
-        TagDependency::invalidate($cache, self::AUTOCOMPLETE_CACHE_TAG . $autocompleteName);
145
+        TagDependency::invalidate($cache, self::AUTOCOMPLETE_CACHE_TAG.$autocompleteName);
146 146
         Craft::info('Twigfield caches invalidated', __METHOD__);
147 147
     }
148 148
 
Please login to merge, or discard this patch.
src/Twigfield.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         // Translation category
103 103
         $i18n = Craft::$app->getI18n();
104 104
         /** @noinspection UnSafeIsSetOverArrayInspection */
105
-        if (!isset($i18n->translations[$this->id]) && !isset($i18n->translations[$this->id . '*'])) {
105
+        if (!isset($i18n->translations[$this->id]) && !isset($i18n->translations[$this->id.'*'])) {
106 106
             $i18n->translations[$this->id] = [
107 107
                 'class' => PhpMessageSource::class,
108 108
                 'sourceLanguage' => 'en-US',
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
     public function registerEventHandlers(): void
137 137
     {
138 138
         // Base CP templates directory
139
-        Event::on(View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $e) {
140
-            if (is_dir($baseDir = $this->getBasePath() . DIRECTORY_SEPARATOR . 'templates')) {
139
+        Event::on(View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, function(RegisterTemplateRootsEvent $e) {
140
+            if (is_dir($baseDir = $this->getBasePath().DIRECTORY_SEPARATOR.'templates')) {
141 141
                 $e->roots[$this->id] = $baseDir;
142 142
             }
143 143
         });
144 144
         // Base Site templates directory
145 145
         if (self::$settings->allowFrontendAccess) {
146
-            Event::on(View::class, View::EVENT_REGISTER_SITE_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $e) {
147
-                if (is_dir($baseDir = $this->getBasePath() . DIRECTORY_SEPARATOR . 'templates')) {
146
+            Event::on(View::class, View::EVENT_REGISTER_SITE_TEMPLATE_ROOTS, function(RegisterTemplateRootsEvent $e) {
147
+                if (is_dir($baseDir = $this->getBasePath().DIRECTORY_SEPARATOR.'templates')) {
148 148
                     $e->roots[$this->id] = $baseDir;
149 149
                 }
150 150
             });
Please login to merge, or discard this patch.
src/helpers/Config.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         $fileName .= self::PHP_SUFFIX;
42 42
         $currentEnv = Craft::$app->getConfig()->env;
43 43
         // Try craft/config first
44
-        $path = Craft::getAlias('@config/' . $fileName, false);
44
+        $path = Craft::getAlias('@config/'.$fileName, false);
45 45
         if ($path === false || !file_exists($path)) {
46 46
             // Now try our own internal config
47 47
             $path = Craft::getAlias('@nystudio107/twigfield/config.php', false);
Please login to merge, or discard this patch.
src/base/Autocomplete.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
             $path = $item->label;
72 72
         }
73 73
         ArrayHelper::setValue($this->completeItems, $path, [
74
-            self::COMPLETION_KEY => array_filter($item->toArray(), static function ($v) {
74
+            self::COMPLETION_KEY => array_filter($item->toArray(), static function($v) {
75 75
                 return !is_null($v);
76 76
             })
77 77
         ]);
Please login to merge, or discard this patch.
src/autocompletes/EnvironmentVariableAutocomplete.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
                     ->filterText($trimmedName)
63 63
                     ->detail($item['hint'])
64 64
                     ->kind(CompleteItemKind::ConstantKind)
65
-                    ->sortText('~' . $name)
65
+                    ->sortText('~'.$name)
66 66
                     ->add($this);
67 67
             }
68 68
         }
Please login to merge, or discard this patch.
src/autocompletes/CraftApiAutocomplete.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
                             $kind = CompleteItemKind::ConstantKind;
143 143
                         }
144 144
                         $this->addCompleteItem(new CompleteItem([
145
-                            'detail' => (string)$value,
145
+                            'detail' => (string) $value,
146 146
                             'kind' => $kind,
147
-                            'label' => (string)$key,
148
-                            'insertText' => (string)$key,
147
+                            'label' => (string) $key,
148
+                            'insertText' => (string) $key,
149 149
                         ]), $path);
150 150
                         break;
151 151
                 }
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
             }
218 218
         }
219 219
         $this->addCompleteItem(new CompleteItem([
220
-            'detail' => (string)$className,
221
-            'documentation' => (string)$docs,
220
+            'detail' => (string) $className,
221
+            'documentation' => (string) $docs,
222 222
             'kind' => CompleteItemKind::ClassKind,
223
-            'label' => (string)$name,
224
-            'insertText' => (string)$name,
223
+            'label' => (string) $name,
224
+            'insertText' => (string) $name,
225 225
         ]), $path);
226 226
     }
227 227
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
             // Exclude some properties
272 272
             $propertyAllowed = true;
273 273
             foreach (self::EXCLUDED_PROPERTY_REGEXES as $excludePattern) {
274
-                $pattern = '`' . $excludePattern . '`i';
274
+                $pattern = '`'.$excludePattern.'`i';
275 275
                 if (preg_match($pattern, $propertyName) === 1) {
276 276
                     $propertyAllowed = false;
277 277
                 }
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
                 $thisPath = trim(implode('.', [$path, $propertyName]), '.');
342 342
                 $label = $propertyName;
343 343
                 $this->addCompleteItem(new CompleteItem([
344
-                    'detail' => (string)$detail,
345
-                    'documentation' => (string)$docs,
344
+                    'detail' => (string) $detail,
345
+                    'documentation' => (string) $docs,
346 346
                     'kind' => $customField ? CompleteItemKind::FieldKind : CompleteItemKind::PropertyKind,
347
-                    'label' => (string)$label,
348
-                    'insertText' => (string)$label,
349
-                    'sortText' => (string)$sortPrefix . (string)$label,
347
+                    'label' => (string) $label,
348
+                    'insertText' => (string) $label,
349
+                    'sortText' => (string) $sortPrefix.(string) $label,
350 350
                 ]), $thisPath);
351 351
                 // Recurse through if this is an object
352 352
                 if (isset($object->$propertyName) && is_object($object->$propertyName)) {
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
             // Exclude some properties
377 377
             $methodAllowed = true;
378 378
             foreach (self::EXCLUDED_METHOD_REGEXES as $excludePattern) {
379
-                $pattern = '`' . $excludePattern . '`i';
379
+                $pattern = '`'.$excludePattern.'`i';
380 380
                 if (preg_match($pattern, $methodName) === 1) {
381 381
                     $methodAllowed = false;
382 382
                 }
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                         }
399 399
                     }
400 400
                 }
401
-                $detail = $methodName . '(';
401
+                $detail = $methodName.'(';
402 402
                 $params = $reflectionMethod->getParameters();
403 403
                 $paramList = [];
404 404
                 foreach ($params as $param) {
@@ -408,20 +408,20 @@  discard block
 block discarded – undo
408 408
                             $unionTypes = $reflectionType->getTypes();
409 409
                             $typeName = '';
410 410
                             foreach ($unionTypes as $unionType) {
411
-                                $typeName .= '|' . $unionType->getName();
411
+                                $typeName .= '|'.$unionType->getName();
412 412
                             }
413 413
                             $typeName = trim($typeName, '|');
414
-                            $paramList[] = $typeName . ': ' . '$' . $param->getName();
414
+                            $paramList[] = $typeName.': '.'$'.$param->getName();
415 415
                         } else {
416
-                            $paramList[] = $param->getType()->getName() . ': ' . '$' . $param->getName();
416
+                            $paramList[] = $param->getType()->getName().': '.'$'.$param->getName();
417 417
                         }
418 418
                     } else {
419
-                        $paramList[] = '$' . $param->getName();
419
+                        $paramList[] = '$'.$param->getName();
420 420
                     }
421 421
                 }
422
-                $detail .= implode(', ', $paramList) . ')';
422
+                $detail .= implode(', ', $paramList).')';
423 423
                 $thisPath = trim(implode('.', [$path, $methodName]), '.');
424
-                $label = $methodName . '()';
424
+                $label = $methodName.'()';
425 425
                 $docsPreamble = '';
426 426
                 // Figure out the type
427 427
                 if ($docblock) {
@@ -429,18 +429,18 @@  discard block
 block discarded – undo
429 429
                     if ($tags) {
430 430
                         $docsPreamble = "Parameters:\n\n";
431 431
                         foreach ($tags as $tag) {
432
-                            $docsPreamble .= $tag . "\n";
432
+                            $docsPreamble .= $tag."\n";
433 433
                         }
434 434
                         $docsPreamble .= "\n";
435 435
                     }
436 436
                 }
437 437
                 $this->addCompleteItem(new CompleteItem([
438
-                    'detail' => (string)$detail,
439
-                    'documentation' => (string)$docsPreamble . (string)$docs,
438
+                    'detail' => (string) $detail,
439
+                    'documentation' => (string) $docsPreamble.(string) $docs,
440 440
                     'kind' => CompleteItemKind::MethodKind,
441
-                    'label' => (string)$label,
442
-                    'insertText' => (string)$label,
443
-                    'sortText' => '~~~' . (string)$label,
441
+                    'label' => (string) $label,
442
+                    'insertText' => (string) $label,
443
+                    'sortText' => '~~~'.(string) $label,
444 444
                 ]), $thisPath);
445 445
             }
446 446
         }
Please login to merge, or discard this patch.