@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | $className = $reflectionClass->getName(); |
155 | 155 | $docs = $this->getDocs($reflectionClass, $factory); |
156 | 156 | CompleteItem::create() |
157 | - ->detail((string)$className) |
|
158 | - ->documentation((string)$docs) |
|
157 | + ->detail((string) $className) |
|
158 | + ->documentation((string) $docs) |
|
159 | 159 | ->kind(CompleteItemKind::ClassKind) |
160 | - ->label((string)$name) |
|
161 | - ->insertText((string)$name) |
|
160 | + ->label((string) $name) |
|
161 | + ->insertText((string) $name) |
|
162 | 162 | ->add($this, $path); |
163 | 163 | } |
164 | 164 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | // Exclude some properties |
209 | 209 | $propertyAllowed = true; |
210 | 210 | foreach (self::EXCLUDED_PROPERTY_REGEXES as $excludePattern) { |
211 | - $pattern = '`' . $excludePattern . '`i'; |
|
211 | + $pattern = '`'.$excludePattern.'`i'; |
|
212 | 212 | if (preg_match($pattern, $propertyName) === 1) { |
213 | 213 | $propertyAllowed = false; |
214 | 214 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $value = json_encode($value); |
263 | 263 | } |
264 | 264 | if (!empty($value)) { |
265 | - $detail = (string)$value; |
|
265 | + $detail = (string) $value; |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 | } |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | $thisPath = trim(implode('.', [$path, $propertyName]), '.'); |
271 | 271 | $label = $propertyName; |
272 | 272 | CompleteItem::create() |
273 | - ->detail((string)$detail) |
|
274 | - ->documentation((string)$docs) |
|
273 | + ->detail((string) $detail) |
|
274 | + ->documentation((string) $docs) |
|
275 | 275 | ->kind($customField ? CompleteItemKind::FieldKind : CompleteItemKind::PropertyKind) |
276 | - ->label((string)$label) |
|
277 | - ->insertText((string)$label) |
|
278 | - ->sortText((string)$sortPrefix . (string)$label) |
|
276 | + ->label((string) $label) |
|
277 | + ->insertText((string) $label) |
|
278 | + ->sortText((string) $sortPrefix.(string) $label) |
|
279 | 279 | ->add($this, $thisPath); |
280 | 280 | // Recurse through if this is an object |
281 | 281 | if (isset($object->$propertyName) && is_object($object->$propertyName)) { |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | // Exclude some properties |
306 | 306 | $methodAllowed = true; |
307 | 307 | foreach (self::EXCLUDED_METHOD_REGEXES as $excludePattern) { |
308 | - $pattern = '`' . $excludePattern . '`i'; |
|
308 | + $pattern = '`'.$excludePattern.'`i'; |
|
309 | 309 | if (preg_match($pattern, $methodName) === 1) { |
310 | 310 | $methodAllowed = false; |
311 | 311 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | if ($methodAllowed && $reflectionMethod->isPublic()) { |
315 | 315 | $docblock = null; |
316 | 316 | $docs = $this->getDocs($reflectionMethod, $factory); |
317 | - $detail = $methodName . '('; |
|
317 | + $detail = $methodName.'('; |
|
318 | 318 | $params = $reflectionMethod->getParameters(); |
319 | 319 | $paramList = []; |
320 | 320 | foreach ($params as $param) { |
@@ -324,20 +324,20 @@ discard block |
||
324 | 324 | $unionTypes = $reflectionType->getTypes(); |
325 | 325 | $typeName = ''; |
326 | 326 | foreach ($unionTypes as $unionType) { |
327 | - $typeName .= '|' . $unionType->getName(); |
|
327 | + $typeName .= '|'.$unionType->getName(); |
|
328 | 328 | } |
329 | 329 | $typeName = trim($typeName, '|'); |
330 | - $paramList[] = $typeName . ': ' . '$' . $param->getName(); |
|
330 | + $paramList[] = $typeName.': '.'$'.$param->getName(); |
|
331 | 331 | } else { |
332 | - $paramList[] = $param->getType()->getName() . ': ' . '$' . $param->getName(); |
|
332 | + $paramList[] = $param->getType()->getName().': '.'$'.$param->getName(); |
|
333 | 333 | } |
334 | 334 | } else { |
335 | - $paramList[] = '$' . $param->getName(); |
|
335 | + $paramList[] = '$'.$param->getName(); |
|
336 | 336 | } |
337 | 337 | } |
338 | - $detail .= implode(', ', $paramList) . ')'; |
|
338 | + $detail .= implode(', ', $paramList).')'; |
|
339 | 339 | $thisPath = trim(implode('.', [$path, $methodName]), '.'); |
340 | - $label = $methodName . '()'; |
|
340 | + $label = $methodName.'()'; |
|
341 | 341 | $docsPreamble = ''; |
342 | 342 | // Figure out the type |
343 | 343 | if ($docblock) { |
@@ -345,18 +345,18 @@ discard block |
||
345 | 345 | if ($tags) { |
346 | 346 | $docsPreamble = "Parameters:\n\n"; |
347 | 347 | foreach ($tags as $tag) { |
348 | - $docsPreamble .= $tag . "\n"; |
|
348 | + $docsPreamble .= $tag."\n"; |
|
349 | 349 | } |
350 | 350 | $docsPreamble .= "\n"; |
351 | 351 | } |
352 | 352 | } |
353 | 353 | CompleteItem::create() |
354 | - ->detail((string)$detail) |
|
355 | - ->documentation((string)$docsPreamble . (string)$docs) |
|
354 | + ->detail((string) $detail) |
|
355 | + ->documentation((string) $docsPreamble.(string) $docs) |
|
356 | 356 | ->kind(CompleteItemKind::MethodKind) |
357 | - ->label((string)$label) |
|
358 | - ->insertText((string)$label) |
|
359 | - ->sortText($this->methodSortPrefix . (string)$label) |
|
357 | + ->label((string) $label) |
|
358 | + ->insertText((string) $label) |
|
359 | + ->sortText($this->methodSortPrefix.(string) $label) |
|
360 | 360 | ->add($this, $thisPath); |
361 | 361 | } |
362 | 362 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $this->cacheDuration = 1; |
99 | 99 | } |
100 | 100 | // Invalidate any SectionShorthandFieldsAutocomplete caches whenever any field layout is edited |
101 | - Event::on(Fields::class, Fields::EVENT_AFTER_SAVE_FIELD_LAYOUT, function (SectionEvent $e) { |
|
101 | + Event::on(Fields::class, Fields::EVENT_AFTER_SAVE_FIELD_LAYOUT, function(SectionEvent $e) { |
|
102 | 102 | $this->clearAutocompleteCache(SectionShorthandFieldsAutocomplete::class); |
103 | 103 | }); |
104 | 104 | } |
@@ -136,12 +136,12 @@ discard block |
||
136 | 136 | $dependency = new TagDependency([ |
137 | 137 | 'tags' => [ |
138 | 138 | self::AUTOCOMPLETE_CACHE_TAG, |
139 | - self::AUTOCOMPLETE_CACHE_TAG . $name, |
|
140 | - self::AUTOCOMPLETE_CACHE_TAG . $autocomplete::class, |
|
139 | + self::AUTOCOMPLETE_CACHE_TAG.$name, |
|
140 | + self::AUTOCOMPLETE_CACHE_TAG.$autocomplete::class, |
|
141 | 141 | ], |
142 | 142 | ]); |
143 | 143 | // Get the autocompletes from the cache, or generate them if they aren't cached |
144 | - $autocompleteItems[$name] = $cache->getOrSet($cacheKey, static function () use ($name, $autocomplete) { |
|
144 | + $autocompleteItems[$name] = $cache->getOrSet($cacheKey, static function() use ($name, $autocomplete) { |
|
145 | 145 | $autocomplete->generateCompleteItems(); |
146 | 146 | return [ |
147 | 147 | 'name' => $name, |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | public function clearAutocompleteCache(string $autocompleteName = ''): void |
166 | 166 | { |
167 | 167 | $cache = Craft::$app->getCache(); |
168 | - TagDependency::invalidate($cache, self::AUTOCOMPLETE_CACHE_TAG . $autocompleteName); |
|
168 | + TagDependency::invalidate($cache, self::AUTOCOMPLETE_CACHE_TAG.$autocompleteName); |
|
169 | 169 | Craft::info('Twigfield caches invalidated', __METHOD__); |
170 | 170 | } |
171 | 171 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function getAutocompleteCacheKey(AutocompleteInterface $autocomplete, array $config): string |
180 | 180 | { |
181 | - return $this->cacheKeyPrefix . $autocomplete->name . md5(serialize($config)); |
|
181 | + return $this->cacheKeyPrefix.$autocomplete->name.md5(serialize($config)); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | // Protected Methods |