@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $filters = array_keys($twig->getFilters()); |
| 281 | 281 | foreach ($filters as $filter) { |
| 282 | 282 | $docs = self::FILTER_DOCS[$filter] ?? ''; |
| 283 | - $docs = str_replace('(#', '(' . self::CRAFT_FILTER_DOCS_URL . '#', $docs); |
|
| 283 | + $docs = str_replace('(#', '('.self::CRAFT_FILTER_DOCS_URL.'#', $docs); |
|
| 284 | 284 | CompleteItem::create() |
| 285 | 285 | ->label($filter) |
| 286 | 286 | ->insertText($filter) |
@@ -292,9 +292,9 @@ discard block |
||
| 292 | 292 | // Twig Functions |
| 293 | 293 | $functions = array_keys($twig->getFunctions()); |
| 294 | 294 | foreach ($functions as $function) { |
| 295 | - $functionLabel = $function . '()'; |
|
| 295 | + $functionLabel = $function.'()'; |
|
| 296 | 296 | $docs = self::FUNCTION_DOCS[$function] ?? ''; |
| 297 | - $docs = str_replace('(#', '(' . self::CRAFT_FUNCTION_DOCS_URL . '#', $docs); |
|
| 297 | + $docs = str_replace('(#', '('.self::CRAFT_FUNCTION_DOCS_URL.'#', $docs); |
|
| 298 | 298 | CompleteItem::create() |
| 299 | 299 | ->label($functionLabel) |
| 300 | 300 | ->insertText($functionLabel) |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $tags = array_merge(self::ADDITIONAL_TAGS, array_keys($twig->getTokenParsers())); |
| 308 | 308 | foreach ($tags as $tag) { |
| 309 | 309 | $docs = self::TAG_DOCS[$tag] ?? ''; |
| 310 | - $docs = str_replace('(#', '(' . self::CRAFT_TAG_DOCS_URL . '#', $docs); |
|
| 310 | + $docs = str_replace('(#', '('.self::CRAFT_TAG_DOCS_URL.'#', $docs); |
|
| 311 | 311 | CompleteItem::create() |
| 312 | 312 | ->label($tag) |
| 313 | 313 | ->insertText($tag) |
@@ -62,7 +62,7 @@ |
||
| 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 | } |
@@ -120,10 +120,10 @@ |
||
| 120 | 120 | $value = json_encode(array_keys($value)); |
| 121 | 121 | } |
| 122 | 122 | CompleteItem::create() |
| 123 | - ->detail((string)$value) |
|
| 123 | + ->detail((string) $value) |
|
| 124 | 124 | ->kind($kind) |
| 125 | - ->label((string)$key) |
|
| 126 | - ->insertText((string)$key) |
|
| 125 | + ->label((string) $key) |
|
| 126 | + ->insertText((string) $key) |
|
| 127 | 127 | ->add($this, $path); |
| 128 | 128 | break; |
| 129 | 129 | } |
@@ -41,7 +41,7 @@ |
||
| 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/codeeditor/config.php', false); |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | |
| 6 | 6 | return static function(ECSConfig $ecsConfig): void { |
| 7 | 7 | $ecsConfig->paths([ |
| 8 | - __DIR__ . '/src', |
|
| 8 | + __DIR__.'/src', |
|
| 9 | 9 | __FILE__, |
| 10 | 10 | ]); |
| 11 | 11 | $ecsConfig->parallel(); |
@@ -136,8 +136,8 @@ 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 . get_class($autocomplete), |
|
| 139 | + self::AUTOCOMPLETE_CACHE_TAG.$name, |
|
| 140 | + self::AUTOCOMPLETE_CACHE_TAG.get_class($autocomplete), |
|
| 141 | 141 | ], |
| 142 | 142 | ]); |
| 143 | 143 | // Get the autocompletes from the cache, or generate them if they aren't cached |
@@ -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('CodeEditor caches invalidated', __METHOD__); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | public function getAutocompleteCacheKey(Autocomplete $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 |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | $className = $reflectionClass->getName(); |
| 156 | 156 | $docs = $this->getDocs($reflectionClass, $factory); |
| 157 | 157 | CompleteItem::create() |
| 158 | - ->detail((string)$className) |
|
| 159 | - ->documentation((string)$docs) |
|
| 158 | + ->detail((string) $className) |
|
| 159 | + ->documentation((string) $docs) |
|
| 160 | 160 | ->kind(CompleteItemKind::ClassKind) |
| 161 | - ->label((string)$name) |
|
| 162 | - ->insertText((string)$name) |
|
| 161 | + ->label((string) $name) |
|
| 162 | + ->insertText((string) $name) |
|
| 163 | 163 | ->add($this, $path); |
| 164 | 164 | } |
| 165 | 165 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | // Exclude some properties |
| 210 | 210 | $propertyAllowed = true; |
| 211 | 211 | foreach (self::EXCLUDED_PROPERTY_REGEXES as $excludePattern) { |
| 212 | - $pattern = '`' . $excludePattern . '`i'; |
|
| 212 | + $pattern = '`'.$excludePattern.'`i'; |
|
| 213 | 213 | if (preg_match($pattern, $propertyName) === 1) { |
| 214 | 214 | $propertyAllowed = false; |
| 215 | 215 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $value = json_encode($value); |
| 264 | 264 | } |
| 265 | 265 | if (!empty($value)) { |
| 266 | - $detail = (string)$value; |
|
| 266 | + $detail = (string) $value; |
|
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | } |
@@ -271,12 +271,12 @@ discard block |
||
| 271 | 271 | $thisPath = trim(implode('.', [$path, $propertyName]), '.'); |
| 272 | 272 | $label = $propertyName; |
| 273 | 273 | CompleteItem::create() |
| 274 | - ->detail((string)$detail) |
|
| 275 | - ->documentation((string)$docs) |
|
| 274 | + ->detail((string) $detail) |
|
| 275 | + ->documentation((string) $docs) |
|
| 276 | 276 | ->kind($customField ? CompleteItemKind::FieldKind : CompleteItemKind::PropertyKind) |
| 277 | - ->label((string)$label) |
|
| 278 | - ->insertText((string)$label) |
|
| 279 | - ->sortText((string)$sortPrefix . (string)$label) |
|
| 277 | + ->label((string) $label) |
|
| 278 | + ->insertText((string) $label) |
|
| 279 | + ->sortText((string) $sortPrefix.(string) $label) |
|
| 280 | 280 | ->add($this, $thisPath); |
| 281 | 281 | // Recurse through if this is an object |
| 282 | 282 | if (isset($object->$propertyName) && is_object($object->$propertyName)) { |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | // Exclude some properties |
| 307 | 307 | $methodAllowed = true; |
| 308 | 308 | foreach (self::EXCLUDED_METHOD_REGEXES as $excludePattern) { |
| 309 | - $pattern = '`' . $excludePattern . '`i'; |
|
| 309 | + $pattern = '`'.$excludePattern.'`i'; |
|
| 310 | 310 | if (preg_match($pattern, $methodName) === 1) { |
| 311 | 311 | $methodAllowed = false; |
| 312 | 312 | } |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | if (!empty($docs)) { |
| 319 | 319 | $docblock = $factory->create($docs); |
| 320 | 320 | } |
| 321 | - $detail = $methodName . '('; |
|
| 321 | + $detail = $methodName.'('; |
|
| 322 | 322 | $params = $reflectionMethod->getParameters(); |
| 323 | 323 | $paramList = []; |
| 324 | 324 | foreach ($params as $param) { |
@@ -328,20 +328,20 @@ discard block |
||
| 328 | 328 | $unionTypes = $reflectionType->getTypes(); |
| 329 | 329 | $typeName = ''; |
| 330 | 330 | foreach ($unionTypes as $unionType) { |
| 331 | - $typeName .= '|' . $unionType->getName(); |
|
| 331 | + $typeName .= '|'.$unionType->getName(); |
|
| 332 | 332 | } |
| 333 | 333 | $typeName = trim($typeName, '|'); |
| 334 | - $paramList[] = $typeName . ': ' . '$' . $param->getName(); |
|
| 334 | + $paramList[] = $typeName.': '.'$'.$param->getName(); |
|
| 335 | 335 | } elseif ($param->getType() instanceof ReflectionNamedType) { |
| 336 | - $paramList[] = $param->getType()->getName() . ': ' . '$' . $param->getName(); |
|
| 336 | + $paramList[] = $param->getType()->getName().': '.'$'.$param->getName(); |
|
| 337 | 337 | } |
| 338 | 338 | } else { |
| 339 | - $paramList[] = '$' . $param->getName(); |
|
| 339 | + $paramList[] = '$'.$param->getName(); |
|
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | - $detail .= implode(', ', $paramList) . ')'; |
|
| 342 | + $detail .= implode(', ', $paramList).')'; |
|
| 343 | 343 | $thisPath = trim(implode('.', [$path, $methodName]), '.'); |
| 344 | - $label = $methodName . '()'; |
|
| 344 | + $label = $methodName.'()'; |
|
| 345 | 345 | $docsPreamble = ''; |
| 346 | 346 | // Figure out the type |
| 347 | 347 | if ($docblock) { |
@@ -349,18 +349,18 @@ discard block |
||
| 349 | 349 | if ($tags) { |
| 350 | 350 | $docsPreamble = "Parameters:\n\n"; |
| 351 | 351 | foreach ($tags as $tag) { |
| 352 | - $docsPreamble .= $tag . "\n"; |
|
| 352 | + $docsPreamble .= $tag."\n"; |
|
| 353 | 353 | } |
| 354 | 354 | $docsPreamble .= "\n"; |
| 355 | 355 | } |
| 356 | 356 | } |
| 357 | 357 | CompleteItem::create() |
| 358 | - ->detail((string)$detail) |
|
| 359 | - ->documentation((string)$docsPreamble . (string)$docs) |
|
| 358 | + ->detail((string) $detail) |
|
| 359 | + ->documentation((string) $docsPreamble.(string) $docs) |
|
| 360 | 360 | ->kind(CompleteItemKind::MethodKind) |
| 361 | - ->label((string)$label) |
|
| 362 | - ->insertText((string)$label) |
|
| 363 | - ->sortText($this->methodSortPrefix . (string)$label) |
|
| 361 | + ->label((string) $label) |
|
| 362 | + ->insertText((string) $label) |
|
| 363 | + ->sortText($this->methodSortPrefix.(string) $label) |
|
| 364 | 364 | ->add($this, $thisPath); |
| 365 | 365 | } |
| 366 | 366 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | // Translation category |
| 102 | 102 | $i18n = Craft::$app->getI18n(); |
| 103 | 103 | /** @noinspection UnSafeIsSetOverArrayInspection */ |
| 104 | - if (!isset($i18n->translations[$this->id]) && !isset($i18n->translations[$this->id . '*'])) { |
|
| 104 | + if (!isset($i18n->translations[$this->id]) && !isset($i18n->translations[$this->id.'*'])) { |
|
| 105 | 105 | $i18n->translations[$this->id] = [ |
| 106 | 106 | 'class' => PhpMessageSource::class, |
| 107 | 107 | 'sourceLanguage' => 'en-US', |
@@ -136,14 +136,14 @@ discard block |
||
| 136 | 136 | { |
| 137 | 137 | // Base CP templates directory |
| 138 | 138 | Event::on(View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, function(RegisterTemplateRootsEvent $e) { |
| 139 | - if (is_dir($baseDir = $this->getBasePath() . DIRECTORY_SEPARATOR . 'templates')) { |
|
| 139 | + if (is_dir($baseDir = $this->getBasePath().DIRECTORY_SEPARATOR.'templates')) { |
|
| 140 | 140 | $e->roots[$this->id] = $baseDir; |
| 141 | 141 | } |
| 142 | 142 | }); |
| 143 | 143 | // Base Site templates directory |
| 144 | 144 | if (self::$settings->allowTemplateAccess) { |
| 145 | 145 | Event::on(View::class, View::EVENT_REGISTER_SITE_TEMPLATE_ROOTS, function(RegisterTemplateRootsEvent $e) { |
| 146 | - if (is_dir($baseDir = $this->getBasePath() . DIRECTORY_SEPARATOR . 'templates')) { |
|
| 146 | + if (is_dir($baseDir = $this->getBasePath().DIRECTORY_SEPARATOR.'templates')) { |
|
| 147 | 147 | $e->roots[$this->id] = $baseDir; |
| 148 | 148 | } |
| 149 | 149 | }); |