├── phpstan.neon ├── ConfigStruct ├── virion.yml └── src │ └── Endermanbugzjfc │ └── ConfigStruct │ ├── Utils │ ├── StaticClassTrait.php │ ├── ReflectionUtils.php │ └── StructureErrorThrowerTrait.php │ ├── ParseContext │ ├── RawContext.php │ ├── PropertyDetails.php │ ├── BasePropertyContext.php │ ├── ChildObjectContext.php │ ├── ListContext.php │ └── ObjectContext.php │ ├── StructureError.php │ ├── KeyName.php │ ├── ListType.php │ ├── ParseError │ ├── TypeMismatchError.php │ └── BaseParseError.php │ ├── Emit.php │ ├── ParseErrorsWrapper.php │ └── Parse.php ├── changelogs ├── 2.1.md └── 2.0.md ├── tests ├── Dummy │ ├── Extending │ │ ├── Base.php │ │ ├── A.php │ │ ├── B.php │ │ ├── Extendable.php │ │ └── ConflictWithA.php │ ├── StructureError │ │ ├── ConstructorProtected.php │ │ └── DuplicatedStructCandidates.php │ └── RecursiveChildObject.php ├── ParseContext │ └── ChildObjectContextTest.php ├── KeyNameTest.php ├── EmitTest.php ├── ParseErrorsWrapperTest.php ├── Utils │ └── ReflectionUtilsTest.php ├── StructureErrorTest.php ├── ParseTest.php └── ParseError │ └── TypeMismatchErrorTest.php ├── .poggit.yml ├── composer.json ├── LICENSE ├── .php-cs-fixer.dist.php ├── README.md └── .editorconfig /phpstan.neon: -------------------------------------------------------------------------------- 1 | parameters: 2 | level: max -------------------------------------------------------------------------------- /ConfigStruct/virion.yml: -------------------------------------------------------------------------------- 1 | name: ConfigStruct 2 | author: Endermanbugzjfc 3 | version: 2.1.0 4 | api: [ 3.0.0, 4.0.0 ] 5 | antigen: Endermanbugzjfc\ConfigStruct -------------------------------------------------------------------------------- /changelogs/2.1.md: -------------------------------------------------------------------------------- 1 | # 2.1.0 2 | ### Documentations 3 | - Function argument and return types are now PHPStan friendly. 4 | - Added generic-type in some object / list parse context classes. -------------------------------------------------------------------------------- /tests/Dummy/Extending/Base.php: -------------------------------------------------------------------------------- 1 | =8.0" 7 | }, 8 | "autoload": { 9 | "psr-0": { 10 | "Endermanbugzjfc\\ConfigStruct\\": "ConfigStruct/src/" 11 | } 12 | }, 13 | "autoload-dev": { 14 | "psr-4": { 15 | "Endermanbugzjfc\\ConfigStruct\\": [ 16 | "tests/" 17 | ] 18 | } 19 | }, 20 | "require-dev": { 21 | "phpunit/phpunit": "^9.5", 22 | "kint-php/kint": "^4.1" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/Dummy/RecursiveChildObject.php: -------------------------------------------------------------------------------- 1 | "testA", 18 | "testSelf" => [ 19 | "testA" => "testB", 20 | "testSelf" => [ 21 | ], 22 | "testUnhandledElement" => null 23 | ] 24 | ]; 25 | } 26 | } -------------------------------------------------------------------------------- /ConfigStruct/src/Endermanbugzjfc/ConfigStruct/ParseContext/RawContext.php: -------------------------------------------------------------------------------- 1 | value; 28 | } 29 | } -------------------------------------------------------------------------------- /ConfigStruct/src/Endermanbugzjfc/ConfigStruct/StructureError.php: -------------------------------------------------------------------------------- 1 | reflection; 25 | } 26 | 27 | 28 | public function getKeyName() : string 29 | { 30 | return $this->keyName; 31 | } 32 | } -------------------------------------------------------------------------------- /tests/ParseContext/ChildObjectContextTest.php: -------------------------------------------------------------------------------- 1 | copyToObject( 26 | $object, 27 | "root object" 28 | ); 29 | $child = $context->getPropertyContexts()["testSelf"]; 30 | 31 | $this->assertTrue( 32 | $child->getUnhandledElements() === [ 33 | "testUnhandledElement" => null 34 | ] 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /changelogs/2.0.md: -------------------------------------------------------------------------------- 1 | # 2.0.0 2 | Starting from version 2, this library will focus on parsing more than emitting. In API, the number of emit-related classes was reduced to 1 ([Emit.php](https://github.com/Endermanbugzjfc/ConfigStruct/blob/master/ConfigStruct/src/Endermanbugzjfc/ConfigStruct/Emit.php)). 3 | ## Features 4 | - A clearer and user-friendly parse errors system had been introduced. 5 | - List (typed-array) had been introduced. 6 | - Child objects can now be recognised in union-types. 7 | ## API 8 | - PascalCase had replaced camelCase in namespaces and had become the main choice for directory naming. 9 | - Parse output classes were renamed to parse context. 10 | - [StructureError](https://github.com/Endermanbugzjfc/ConfigStruct/blob/master/ConfigStruct/src/Endermanbugzjfc/ConfigStruct/StructureError.php) had become a wrapper for another error. 11 | 12 | # 2.0.0-BETA2 13 | ## API 14 | - `ObjectContext::copyToObject()` now returns `void` instead of `object`. 15 | ## Performance 16 | - Closures have been set to static if necessary. 17 | 18 | # Final 19 | - Type-strict are now declared for all files. 20 | -------------------------------------------------------------------------------- /ConfigStruct/src/Endermanbugzjfc/ConfigStruct/ListType.php: -------------------------------------------------------------------------------- 1 | getType(); 24 | 25 | if ($type === null) { 26 | return []; 27 | } 28 | if ($type instanceof ReflectionNamedType) { 29 | return [$type]; 30 | } 31 | if ($type instanceof ReflectionUnionType) { 32 | return $type->getTypes(); 33 | } 34 | 35 | $className = $property->getDeclaringClass()->getName(); 36 | $propertyName = $property->getName(); 37 | return throw new RuntimeException( 38 | "Expecting $className->$propertyName is in the form of null / " . ReflectionNamedType::class . " / " . ReflectionUnionType::class . ", got " . get_debug_type($type) 39 | ); 40 | } 41 | } -------------------------------------------------------------------------------- /ConfigStruct/src/Endermanbugzjfc/ConfigStruct/ParseError/TypeMismatchError.php: -------------------------------------------------------------------------------- 1 | expectedTypes; 38 | } 39 | 40 | 41 | public function getGivenType() : string 42 | { 43 | return $this->givenType; 44 | } 45 | 46 | public function getMessage() : string 47 | { 48 | $expectedTypes = implode( 49 | " / ", 50 | $this->getExpectedTypes() 51 | ); 52 | return "Element is {$this->getGivenType()} while it should be $expectedTypes"; 53 | } 54 | } -------------------------------------------------------------------------------- /ConfigStruct/src/Endermanbugzjfc/ConfigStruct/Utils/StructureErrorThrowerTrait.php: -------------------------------------------------------------------------------- 1 | |ReflectionProperty $classOrProperty 18 | */ 19 | private static function invalidStructure( 20 | Throwable $previous, 21 | ReflectionClass|ReflectionProperty $classOrProperty 22 | ) : void { 23 | if ($classOrProperty instanceof ReflectionClass) { 24 | $className = $classOrProperty->getName(); 25 | $propertyName = ""; 26 | } else { 27 | $className = $classOrProperty->getDeclaringClass()->getName(); 28 | $propertyName = "->" . $classOrProperty->getName(); 29 | } 30 | 31 | throw new StructureError( 32 | "Invalid structure in " . $className . $propertyName, 33 | $previous 34 | ); 35 | } 36 | } -------------------------------------------------------------------------------- /ConfigStruct/src/Endermanbugzjfc/ConfigStruct/ParseError/BaseParseError.php: -------------------------------------------------------------------------------- 1 | getMessage(); 22 | } 23 | 24 | public function __construct( 25 | protected ?Throwable $previous = null 26 | ) { 27 | } 28 | 29 | public function getPrevious() : ?Throwable 30 | { 31 | return $this->previous; 32 | } 33 | 34 | public function __debugInfo() : ?array // @phpstan-ignore-line: TODO: Delete. 35 | { 36 | $return = [ 37 | "message" => $this->getMessage() 38 | ]; 39 | $previous = $this->getPrevious(); 40 | if ($previous !== null) { 41 | $return["previous"] = [ 42 | "class" => $previous::class, 43 | "message" => $previous->getMessage(), 44 | "code" => $previous->getCode() 45 | ]; 46 | } 47 | 48 | return $return; 49 | } 50 | } -------------------------------------------------------------------------------- /tests/KeyNameTest.php: -------------------------------------------------------------------------------- 1 | "a", 29 | "b" => "b", 30 | "c" => "c" 31 | ] 32 | ); 33 | $context->copyToObject( 34 | $object, 35 | "root object" 36 | ); 37 | 38 | $this->assertTrue( 39 | $object->testOneKeyName === "a" 40 | ); 41 | $this->assertTrue( 42 | $object->testMultipleKeyNames === "b" 43 | ); 44 | 45 | $context = Parse::object( 46 | $object, 47 | [ 48 | "c" => "c" 49 | ] 50 | ); 51 | $context->copyToObject( 52 | $object, 53 | "root object" 54 | ); 55 | 56 | $this->assertTrue( 57 | $object->testMultipleKeyNames === "c" 58 | ); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /ConfigStruct/src/Endermanbugzjfc/ConfigStruct/ParseContext/BasePropertyContext.php: -------------------------------------------------------------------------------- 1 | details; 20 | } 21 | 22 | /** 23 | * @return array Key = header label. 24 | */ 25 | public function getErrorsTree() : array 26 | { 27 | return []; 28 | } 29 | 30 | public function hasError() : bool 31 | { 32 | $tree = $this->getErrorsTree(); 33 | return $tree !== []; 34 | } 35 | 36 | final public function getErrorsTreeKey() : string 37 | { 38 | return "element \"{$this->getDetails()->getKeyName()}\""; 39 | } 40 | 41 | /** 42 | * Get the errors tree and put it in an array using the key name ({@link BasePropertyContext::getErrorsTreeKey()}) as key. 43 | * @return array Can be array_merge() with the wrapped errors tree of other properties. 44 | */ 45 | final public function getWrappedErrorsTree() : array 46 | { 47 | $key = $this->getErrorsTreeKey(); 48 | $tree = $this->getErrorsTree(); 49 | return $tree === [] 50 | ? [] 51 | : [ 52 | $key => $tree 53 | ]; 54 | } 55 | 56 | /** 57 | * @return mixed[] 58 | */ 59 | public function getUnhandledElements() : array 60 | { 61 | return []; 62 | } 63 | 64 | public function omitCopyToObject() : bool 65 | { 66 | return false; 67 | } 68 | } -------------------------------------------------------------------------------- /tests/EmitTest.php: -------------------------------------------------------------------------------- 1 | assertTrue( 25 | $output === [ 26 | "testNoType" => null, 27 | "testDefaultValue" => true, 28 | "testNull" => null 29 | ] 30 | ); 31 | } 32 | 33 | public function testObjectCustomKeyName() 34 | { 35 | $object = new class() { 36 | #[KeyName(1)] 37 | public int $testA = 3; 38 | 39 | #[KeyName(0)] 40 | public int $testB = 2; 41 | }; 42 | $output = Emit::object( 43 | $object 44 | ); 45 | 46 | $this->assertNotTrue( 47 | $output === [ 48 | 2, 49 | 3 50 | ] 51 | ); 52 | $this->assertTrue( 53 | $output === [ 54 | 1 => 3, 55 | 0 => 2 56 | ] 57 | ); 58 | } 59 | 60 | 61 | public function testObjectRecursiveChildren() 62 | { 63 | $root = new class() { 64 | public string $testA; 65 | 66 | public self $testSelf; 67 | }; 68 | $oneDeep = clone $root; 69 | $twoDeep = clone $root; 70 | 71 | $root->testA = "testA"; 72 | $root->testSelf = $oneDeep; 73 | $oneDeep->testA = "testB"; 74 | $oneDeep->testSelf = $twoDeep; 75 | 76 | $output = Emit::object( 77 | $root 78 | ); 79 | 80 | $this->assertTrue( 81 | $output === [ 82 | "testA" => "testA", 83 | "testSelf" => [ 84 | "testA" => "testB", 85 | "testSelf" => [ 86 | 87 | ] 88 | ] 89 | ] 90 | ); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /ConfigStruct/src/Endermanbugzjfc/ConfigStruct/ParseContext/ChildObjectContext.php: -------------------------------------------------------------------------------- 1 | 18 | */ 19 | protected ObjectContext $objectContext; 20 | 21 | /** 22 | * @var ParseErrorsWrapper|null If one is thrown by {@link ObjectContext::copyToNewObject()} in {@link ChildObjectContext::__construct}. 23 | */ 24 | protected ?ParseErrorsWrapper $error = null; 25 | 26 | /** 27 | * @param ObjectContext|ParseErrorsWrapper $objectContextOrError 28 | */ 29 | public function __construct( 30 | PropertyDetails $details, 31 | ObjectContext|ParseErrorsWrapper $objectContextOrError 32 | ) { 33 | parent::__construct( 34 | $details 35 | ); 36 | if ($objectContextOrError instanceof ParseErrorsWrapper) { 37 | $this->error = $objectContextOrError; 38 | return; 39 | } 40 | 41 | $this->objectContext = $objectContextOrError; 42 | try { 43 | $this->object = $this->asObjectContext()->copyToNewObject( 44 | "object array" 45 | ); 46 | } catch (ParseErrorsWrapper $err) { 47 | $this->error = $err; 48 | } 49 | } 50 | 51 | /** 52 | * @return object Copy the object context to a new object. 53 | */ 54 | public function getValue() : object 55 | { 56 | return $this->object; 57 | } 58 | 59 | /** 60 | * @return ObjectContext 61 | */ 62 | public function asObjectContext() : ObjectContext 63 | { 64 | return $this->objectContext; 65 | } 66 | 67 | public function getErrorsTree() : array 68 | { 69 | return $this->error?->getErrorsTree() ?? []; 70 | } 71 | 72 | /** 73 | * @return mixed[] Unhandled elements in the object context. 74 | */ 75 | public function getUnhandledElements() : array 76 | { 77 | return $this->asObjectContext()->getUnhandledElements(); 78 | } 79 | 80 | public function omitCopyToObject() : bool 81 | { 82 | return !isset( 83 | $this->object 84 | ); 85 | } 86 | } -------------------------------------------------------------------------------- /ConfigStruct/src/Endermanbugzjfc/ConfigStruct/Emit.php: -------------------------------------------------------------------------------- 1 | getProperties( 35 | ReflectionProperty::IS_PUBLIC 36 | ) as $property 37 | ) { 38 | if (!$property->isInitialized( 39 | $object 40 | )) { 41 | continue; 42 | } 43 | $keyName = $property->getAttributes( 44 | KeyName::class 45 | )[0] ?? null; 46 | $name = $keyName?->getArguments()[0] 47 | ?? $property->getName(); 48 | 49 | $value = $property->getValue( 50 | $object 51 | ); 52 | $value = self::value( 53 | $value 54 | ); 55 | $return[$name] = $value; 56 | } 57 | 58 | return $return ?? []; 59 | } 60 | 61 | /** 62 | * Redirect to the correct emit function. Base on the value's type and attributes provided. 63 | * @param mixed $value Value of the property. 64 | * @return scalar|mixed[] 65 | */ 66 | public static function value( 67 | mixed $value 68 | ) : string|int|bool|array|float|null { 69 | if (is_object( 70 | $value 71 | )) { 72 | return self::object( 73 | $value 74 | ); 75 | } 76 | 77 | if (is_array( 78 | $value 79 | )) { 80 | foreach ($value as $key => $item) { 81 | $return[$key] = self::value( 82 | $item 83 | ); 84 | } 85 | return $return ?? []; 86 | } 87 | 88 | if ( 89 | $value !== null 90 | and 91 | !is_scalar( 92 | $value 93 | ) 94 | ) { 95 | return (array)$value; 96 | } 97 | 98 | return $value; 99 | } 100 | } -------------------------------------------------------------------------------- /.php-cs-fixer.dist.php: -------------------------------------------------------------------------------- 1 | append([$file]); 14 | } 15 | } 16 | 17 | 18 | return (new Config) 19 | ->setRiskyAllowed(true) 20 | ->setFinder($finder) 21 | ->setIndent(" ") 22 | ->setRules([ 23 | "align_multiline_comment" => [ 24 | "comment_type" => "phpdocs_only" 25 | ], 26 | "array_indentation" => true, 27 | "array_syntax" => [ 28 | "syntax" => "short" 29 | ], 30 | "binary_operator_spaces" => [ 31 | "default" => "single_space" 32 | ], 33 | "blank_line_after_namespace" => true, 34 | "blank_line_after_opening_tag" => true, 35 | "blank_line_before_statement" => [ 36 | "statements" => [ 37 | "declare" 38 | ] 39 | ], 40 | "braces" => [ 41 | "allow_single_line_closure" => false, 42 | "position_after_anonymous_constructs" => "same", 43 | "position_after_control_structures" => "same", 44 | "position_after_functions_and_oop_constructs" => "next", 45 | ], 46 | "concat_space" => [ 47 | "spacing" => "one" 48 | ], 49 | "declare_strict_types" => true, 50 | "elseif" => true, 51 | "global_namespace_import" => [ 52 | "import_constants" => true, 53 | "import_functions" => true, 54 | "import_classes" => true, 55 | ], 56 | "indentation_type" => true, 57 | "native_function_invocation" => [ 58 | "scope" => "namespaced", 59 | "include" => ["@all"], 60 | ], 61 | "no_closing_tag" => true, 62 | "no_empty_phpdoc" => true, 63 | "no_superfluous_phpdoc_tags" => [ 64 | "allow_mixed" => true, 65 | ], 66 | "no_trailing_whitespace" => true, 67 | "no_trailing_whitespace_in_comment" => true, 68 | "no_whitespace_in_blank_line" => true, 69 | "no_unused_imports" => true, 70 | "ordered_imports" => [ 71 | "imports_order" => [ 72 | "class", 73 | "function", 74 | "const", 75 | ], 76 | "sort_algorithm" => "alpha" 77 | ], 78 | "phpdoc_line_span" => [ 79 | "property" => null, 80 | "method" => null, 81 | "const" => null 82 | ], 83 | "phpdoc_trim" => true, 84 | "phpdoc_trim_consecutive_blank_line_separation" => true, 85 | "return_type_declaration" => [ 86 | "space_before" => "one" 87 | ], 88 | "single_import_per_statement" => true, 89 | "strict_param" => true, 90 | "unary_operator_spaces" => true, 91 | ]); 92 | })(); -------------------------------------------------------------------------------- /ConfigStruct/src/Endermanbugzjfc/ConfigStruct/ParseContext/ListContext.php: -------------------------------------------------------------------------------- 1 | 24 | */ 25 | protected array $baseErrorsTree = []; 26 | 27 | /** 28 | * @param ObjectContext[] $objectContexts 29 | * @param array $elementsErrorsTree 30 | * @param mixed[] $unhandledElements 31 | */ 32 | public function __construct( 33 | PropertyDetails $details, 34 | protected array $objectContexts, 35 | array $elementsErrorsTree, 36 | protected array $unhandledElements 37 | ) { 38 | foreach ($elementsErrorsTree as $key => $value) { 39 | $subElementKey = self::getErrorsTreeSubElementKey( 40 | $key 41 | ); 42 | $this->baseErrorsTree[$subElementKey] = $value; 43 | } 44 | 45 | $contexts = $this->getObjectContextsArray(); 46 | foreach ($contexts as $key => $context) { 47 | try { 48 | $object = $context->copyToNewObject( 49 | "object array" 50 | ); 51 | } catch (ParseErrorsWrapper $err) { 52 | $subElementKey = self::getErrorsTreeSubElementKey( 53 | $key 54 | ); 55 | $this->baseErrorsTree[$subElementKey][] = $err->getErrorsTree(); 56 | continue; 57 | } 58 | $objects[$key] = $object; 59 | } 60 | $this->objects = $objects ?? []; 61 | 62 | parent::__construct( 63 | $details 64 | ); 65 | } 66 | 67 | /** 68 | * Copy object contexts to new objects. 69 | * @return object[] Keys are reserved. 70 | */ 71 | public function getValue() : array 72 | { 73 | return $this->objects; 74 | } 75 | 76 | /** 77 | * @return ObjectContext[] Keys are reserved. 78 | */ 79 | public function getObjectContextsArray() : array 80 | { 81 | return $this->objectContexts; 82 | } 83 | 84 | public function getErrorsTree() : array 85 | { 86 | $tree = parent::getErrorsTree(); 87 | $tree = array_merge( 88 | $tree, 89 | $this->baseErrorsTree 90 | ); 91 | 92 | $contexts = $this->getObjectContextsArray(); 93 | foreach ($contexts as $key => $context) { 94 | if ($context->hasError()) { 95 | $treeKey = self::getErrorsTreeSubElementKey( 96 | $key 97 | ); 98 | $tree[$treeKey] = $context->getErrorsTree(); 99 | } 100 | } 101 | 102 | return $tree; 103 | } 104 | 105 | private static function getErrorsTreeSubElementKey( 106 | string|int $elementKey 107 | ) : string { 108 | return "index \"$elementKey\""; 109 | } 110 | 111 | 112 | public function getUnhandledElements() : array 113 | { 114 | return $this->unhandledElements; 115 | } 116 | } -------------------------------------------------------------------------------- /tests/ParseErrorsWrapperTest.php: -------------------------------------------------------------------------------- 1 | [ 26 | "a" => null 27 | ], 28 | "testErrorFilter" => null 29 | ] 30 | ); 31 | try { 32 | $context->copyToObject( 33 | $object, 34 | "root object" 35 | ); 36 | } catch (ParseErrorsWrapper $err) { 37 | return $err; 38 | } 39 | throw new AssertionError( 40 | "No errors when copy parsed data to object" 41 | ); 42 | } 43 | 44 | /** 45 | * @throws ParseErrorsWrapper 46 | */ 47 | public function testRegenerateErrorMessageFilterSpecifiedError() 48 | { 49 | $err = self::parseErrorsWrapperProvider(); 50 | $err->regenerateErrorMessage( 51 | $err->getRootHeaderLabel(), 52 | $err->getIndentation(), 53 | fn( 54 | array $keys, 55 | BaseParseError $parseError 56 | ) : bool => $keys !== [ 57 | "root object", 58 | "element \"testErrorFilter\"" 59 | ] 60 | ); 61 | 62 | $this->expectExceptionMessage( 63 | <<regenerateErrorMessage( 77 | $err->getRootHeaderLabel(), 78 | $err->getIndentation(), 79 | $filter = fn( 80 | array $keys, 81 | BaseParseError $parseError 82 | ) : bool => false 83 | ); 84 | 85 | $this->assertTrue( 86 | $err->getMessageRtrim() === "" 87 | ); 88 | $this->assertTrue( 89 | $err->getErrorFilter() === $filter 90 | ); 91 | } 92 | 93 | /** 94 | * @throws ParseErrorsWrapper 95 | */ 96 | public function testRegenerateErrorMessageIndentation() 97 | { 98 | $err = self::parseErrorsWrapperProvider(); 99 | $indentation = "----"; 100 | $err->regenerateErrorMessage( 101 | $err->getRootHeaderLabel(), 102 | $indentation 103 | ); 104 | 105 | $this->assertTrue( 106 | $err->getIndentation() === $indentation 107 | ); 108 | $this->expectExceptionMessage( 109 | <<assertTrue( 26 | array_diff( 27 | $a, 28 | $b 29 | ) === [ 30 | ] 31 | ); 32 | } 33 | 34 | public function testGetPropertyTypes() 35 | { 36 | $object = new class() { 37 | public bool $testOneType; 38 | public ?bool $testNullable; 39 | public A $testOneClass; 40 | 41 | public bool|int|float|string $testScalars; 42 | public A|B $testTwoClasses; 43 | public self|array|null $testSelfAndArrayNullable; 44 | }; 45 | $reflect = new ReflectionClass( 46 | $object 47 | ); 48 | $properties = $reflect->getProperties( 49 | ReflectionProperty::IS_PUBLIC 50 | ); 51 | $results = []; 52 | foreach ($properties as $index => $property) { 53 | $raws = []; 54 | $types = ReflectionUtils::getPropertyTypes( 55 | $property 56 | ); 57 | foreach ($types as $type) { 58 | $raws[] = $type->getName(); 59 | } 60 | 61 | switch ($index) { 62 | case 0: 63 | case 1: // Does not detect nullability here. 64 | $this->assertEqualsArrayDiff( 65 | $raws, 66 | [ 67 | "bool" 68 | ] 69 | ); 70 | break; 71 | 72 | case 2: 73 | $this->assertEqualsArrayDiff( 74 | $raws, 75 | [ 76 | A::class 77 | ] 78 | ); 79 | break; 80 | 81 | case 3: 82 | $this->assertEqualsArrayDiff( 83 | $raws, 84 | [ 85 | "bool", 86 | "int", 87 | "float", 88 | "string" 89 | ] 90 | ); 91 | break; 92 | 93 | case 4: 94 | $this->assertEqualsArrayDiff( 95 | $raws, 96 | [ 97 | A::class, 98 | B::class 99 | ] 100 | ); 101 | break; 102 | 103 | case 5: 104 | $this->assertEqualsArrayDiff( 105 | $raws, 106 | [ 107 | "self", 108 | "array", 109 | "null" 110 | ] 111 | ); 112 | break; 113 | 114 | default: 115 | $propertyName = $property->getName(); 116 | throw new RuntimeException( 117 | "No test for property \"$propertyName\"" 118 | ); 119 | 120 | } 121 | } 122 | 123 | // TODO: Test for intersection type (?). 124 | } 125 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Gave up maintenance (不羈放縱愛自由) 2 | Use https://github.com/sylvrs/libMarshal instead. 3 | # ConfigStruct 4 | 5 | Type and shape system for arrays. Help write clearer code when implementing configs for your PocketMine-MP plugin or 6 | composer project. 7 | 8 | It also generates more human-readable errors when something is wrong with the data. Encouraging and guiding the user (especially some PocketMine-MP server owners) to read the error and fix their mess. 9 | 10 | 11 | ![](https://i.imgflip.com/67yyc9.jpg) 12 | 13 | https://github.com/Sandertv/Marshal is an alternative that supports lower versions of PHP. However, it is not as ~~bloat~~ feature-rich as this library. 14 | # The section that everyone is looking for 15 | ## Installation 16 | Via Composer: 17 | ``` 18 | composer require endermanbugzjfc/configstruct 19 | ``` 20 | Via PocketMine-MP virion infection: 21 | https://poggit.pmmp.io/v.dl/Endermanbugzjfc/ConfigStruct/ConfigStruct/%5E2.0.0 22 | ## Preview 23 | ### Parse errors 24 | ``` 25 | 2 errors in /Users/Shoghi/Documents/shog chips.yml 26 | 1 errors in element "a" 27 | 1 errors in index "0" 28 | 1 errors in element "c" 29 | Element is array while it should be string 30 | 1 errors in element "b" 31 | Element is null while it should be bool 32 | 33 | ``` 34 | Notice there is a trailing line break. 35 | 36 | # Developer guide 37 | ## Parsing data 38 | ```php 39 | use Endermanbugzjfc\ConfigStruct\Parse; 40 | ``` 41 | ```php 42 | $context = Parse::object($object, $data); 43 | $context->copyToObject($object, $dataFilePath); 44 | ``` 45 | `$dataFilePath` will be displayed in error messages if there is any. 46 | 47 | The errors will be wrapped and thrown with a [ParseErrorsWrapper](https://github.com/Endermanbugzjfc/ConfigStruct/blob/master/ConfigStruct/src/Endermanbugzjfc/ConfigStruct/ParseErrorsWrapper.php) when calling `copyToObject()`. Although it is recommended to catch it, you can yet ignore it. Because the errors can still be displayed well in a PHP uncaught error message. 48 | 49 | You may use `Parse::objectByReflection()` if you don't have an object but instead, its ReflectionClass instance. And use `$context->copyToNewObject()` to copy the parsed data to a new object. 50 | ## Customising error message 51 | ### Changing the root header label 52 | `/Users/Shoghi/Documents/shog chips.yml` is the root header label in the following errors tree: 53 | ``` 54 | 2 errors in /Users/Shoghi/Documents/shog chips.yml 55 | 1 errors in element "a" 56 | 1 errors in index "0" 57 | 1 errors in element "c" 58 | Element is array while it should be string 59 | 1 errors in element "b" 60 | Element is null while it should be bool 61 | ``` 62 | You can change it in the first argument of `ParseErrorsWrapper::regenerateErrorMessage()`: 63 | ```php 64 | $parseErrorsWrapper->regenerateErrorMessage('C:\Windows\System32\ntoskrnl.exe'); 65 | ``` 66 | ### Changing the indentation 67 | You can change it in the second argument of `ParseErrorsWrapper::regenerateErrorMessage()` 68 | ### Filtering errors 69 | You can hide certain errors from the errors tree by filtering them out. 70 | Apply an error filter with the third argument of `ParseErrorsWrapper::regenerateErrorMessage()`: 71 | ```php 72 | $parseErrorsWrapper->regenerateErrorMessage( 73 | $parseErrorsWrapper->getRootHeaderLabel(), 74 | $parseErrorsWrapper->getIndentation(), 75 | fn (array $keys, BaseParseError $parseError) : bool => !$parseError instanceof TypeMismatchError 76 | ); 77 | ``` 78 | This filters out all the [TypeMismatchError](https://github.com/Endermanbugzjfc/ConfigStruct/blob/master/ConfigStruct/src/Endermanbugzjfc/ConfigStruct/ParseError/TypeMismatchError.php). Although `$parseError->getErrorsTree()` will still have them, they will not be shown in the error message. 79 | ### Print the updated error message 80 | Simply throw the parse errors wrapper again. Or you may choose to `echo $parseErrorsWrapper->getMessage()`. By default, the error message has a trailing line break (`\n`). You can get an error message without the trailing line break (and other whitespaces) by calling `$parseErrorsWrapper->getMessageRtrim()` instead. 81 | -------------------------------------------------------------------------------- /tests/StructureErrorTest.php: -------------------------------------------------------------------------------- 1 | copyToNewObject( 33 | "root object" 34 | ); 35 | } catch (StructureError $err) { 36 | $class = $object::class; 37 | $expected = "Invalid structure in $class"; 38 | if ($property !== null) { 39 | $expected .= "->$property"; 40 | } 41 | 42 | $this->assertTrue( 43 | $err->getMessage() === $expected 44 | ); 45 | echo $err->getPrevious()->getMessage() . "\n"; 46 | $this->assertTrue( 47 | $err->getPrevious()->getMessage() === $message 48 | ); 49 | return; 50 | } 51 | throw new AssertionError( 52 | "No " . StructureError::class . " had been thrown" 53 | ); 54 | } 55 | 56 | /** 57 | * @throws ParseErrorsWrapper 58 | */ 59 | public function test__constructDuplicatedKeyNames() 60 | { 61 | $object = new class() { 62 | #[KeyName(-1)] #[KeyName("-1")] 63 | #[KeyName(0)] #[KeyName("0")] 64 | #[KeyName("kjaldf")] #[KeyName("kjaldf")] 65 | public bool $testOneDuplicatedKeyNames; 66 | }; 67 | $this->expectPreviousExceptionMessage( 68 | 'Duplicated key names "kjaldf"', 69 | $object, 70 | null, 71 | [ 72 | ] 73 | ); 74 | } 75 | 76 | /** 77 | * @throws ParseErrorsWrapper 78 | */ 79 | public function test__constructDuplicatedListTypes() 80 | { 81 | $object = new DuplicatedStructCandidates(); 82 | $keyName = "testThreeDuplicatedListTypes"; 83 | $this->expectPreviousExceptionMessage( 84 | "Duplicated struct candidates Endermanbugzjfc\ConfigStruct\Dummy\StructureError\DuplicatedStructCandidates, Endermanbugzjfc\ConfigStruct\Dummy\Extending\A, Endermanbugzjfc\ConfigStruct\Dummy\Extending\B", 85 | $object, 86 | $keyName, 87 | [ 88 | $keyName => [ 89 | [ 90 | null 91 | ] 92 | ] 93 | ] 94 | ); 95 | } 96 | 97 | /** 98 | * @throws ParseErrorsWrapper 99 | */ 100 | public function test__constructInvalidListTypes() 101 | { 102 | $object = new class() { 103 | #[ListType("ajbfl")] 104 | public string $testThreeInvalidListTypes; 105 | }; 106 | $reflection = new ReflectionClass( 107 | $object 108 | ); 109 | $keyName = "testThreeInvalidListTypes"; 110 | try { 111 | $property = $reflection->getProperty( 112 | $keyName 113 | ); 114 | } catch (ReflectionException $err) { 115 | throw new AssertionError( 116 | "Property does not exist", 117 | 0, 118 | $err 119 | ); 120 | } 121 | $listType = $property->getAttributes( 122 | ListType::class 123 | )[0]; 124 | $class = $listType->getArguments()[0]; 125 | $this->assertNotTrue( 126 | class_exists( 127 | $class 128 | ) 129 | ); 130 | 131 | $this->expectPreviousExceptionMessage( 132 | "List type attribute has invalid class", 133 | $object, 134 | $keyName, 135 | [ 136 | $keyName => [ 137 | ] 138 | ] 139 | ); 140 | } 141 | 142 | /** 143 | * @throws ParseErrorsWrapper 144 | */ 145 | private function failedToCreateANewObjectFromReflection( 146 | object $object 147 | ) : void { 148 | $this->expectPreviousExceptionMessage( 149 | "Failed to create a new object from reflection", 150 | $object, 151 | null, 152 | [ 153 | ] 154 | ); 155 | } 156 | 157 | /** 158 | * @throws ParseErrorsWrapper 159 | */ 160 | public function test__constructObjectConstructorProtected() 161 | { 162 | $object = ConstructorProtected::create(); 163 | $this->failedToCreateANewObjectFromReflection( 164 | $object 165 | ); 166 | } 167 | } -------------------------------------------------------------------------------- /tests/ParseTest.php: -------------------------------------------------------------------------------- 1 | null, 37 | "testProtectedProperty" => null, 38 | $keyName => null 39 | ] 40 | ); 41 | $context->copyToObject( 42 | $object, 43 | "root object" 44 | ); 45 | $this->assertTrue( 46 | $context->getPropertyContexts()[$keyName]->getDetails()->getKeyName() 47 | === $keyName 48 | ); 49 | 50 | [ 51 | $private, 52 | $protected, 53 | $public 54 | ] = $context->getReflection()->getProperties(); 55 | $private->setAccessible(true); 56 | $protected->setAccessible(true); 57 | $this->assertNotTrue($private->isInitialized($object)); 58 | $this->assertNotTrue($protected->isInitialized($object)); 59 | $this->assertTrue($public->isInitialized($object)); 60 | $this->assertTrue($public->getValue($object) === null); 61 | } 62 | 63 | /** 64 | * @throws ParseErrorsWrapper 65 | */ 66 | public function testObjectUnhandledElements() 67 | { 68 | $object = new class() { 69 | }; 70 | 71 | $context = Parse::object( 72 | $object, 73 | [ 74 | "testA" => "testA", 75 | null => "", 76 | 0 77 | ] 78 | ); 79 | $context->copyToObject( 80 | $object, 81 | "root object" 82 | ); 83 | $this->assertTrue( 84 | $context->getUnhandledElements() === [ 85 | "testA" => "testA", 86 | null => "", 87 | 0 88 | ] 89 | ); 90 | } 91 | 92 | public function testObjectMissingElements() 93 | { 94 | $object = new class() { 95 | public bool $testNoDefaultValue; 96 | 97 | public bool $testDefaultValue = true; 98 | }; 99 | $context = Parse::object( 100 | $object, 101 | [ 102 | 103 | ] 104 | ); 105 | 106 | $this->assertTrue( 107 | $context->getMissingElements() 108 | ["testNoDefaultValue"] 109 | ->getName() === "testNoDefaultValue" 110 | ); 111 | $this->assertTrue( 112 | $context->getMissingElements() 113 | ["testDefaultValue"] 114 | ->getName() === "testDefaultValue" 115 | ); 116 | } 117 | 118 | /** 119 | * @throws ParseErrorsWrapper 120 | */ 121 | public function testObjectChildStructRecursive() 122 | { 123 | $object = new RecursiveChildObject(); 124 | $class = $object::class; 125 | $context = Parse::object( 126 | $object, 127 | $object::dataSampleA() 128 | ); 129 | $context->copyToObject( 130 | $object, 131 | "root object" 132 | ); 133 | 134 | $this->assertTrue( 135 | $object->testA === "testA" 136 | ); 137 | 138 | $oneDeeper = $object->testSelf; 139 | $this->assertTrue( 140 | $oneDeeper instanceof $class 141 | ); 142 | $this->assertTrue( 143 | $oneDeeper->testA === "testB" 144 | ); 145 | 146 | $twoDeeper = $oneDeeper->testSelf; 147 | $this->assertTrue( 148 | $twoDeeper instanceof $class 149 | ); 150 | $this->assertTrue( 151 | !isset($twoDeeper->testA) 152 | ); 153 | $this->assertTrue( 154 | !isset($twoDeeper->testSelf) 155 | ); 156 | } 157 | 158 | /** 159 | * @return ReflectionClass[] 160 | * @throws ReflectionException 161 | */ 162 | private function structCandidatesSampleA() : array 163 | { 164 | return array_map( 165 | fn(string $class) : ReflectionClass => new ReflectionClass( 166 | $class 167 | ), 168 | [ 169 | A::class, 170 | ConflictWithA::class 171 | ] 172 | ); 173 | } 174 | 175 | /** 176 | * @throws Exception 177 | */ 178 | public function testFindMatchingStructSuccess() 179 | { 180 | $candidates = self::structCandidatesSampleA(); 181 | 182 | $findA = Parse::findMatchingStruct( 183 | $candidates, 184 | [ 185 | "a" => "" 186 | ] 187 | ); 188 | $this->assertTrue( 189 | $findA->getReflection()->getName() 190 | === A::class 191 | ); 192 | 193 | $findConflictWithA = Parse::findMatchingStruct( 194 | $candidates, 195 | [ 196 | "a" => [ 197 | ] 198 | ] 199 | ); 200 | $this->assertTrue( 201 | $findConflictWithA->getReflection()->getName() 202 | === ConflictWithA::class 203 | ); 204 | } 205 | 206 | /** 207 | * @throws Exception 208 | */ 209 | public function testFindMatchingStructFailure() 210 | { 211 | $candidates = self::structCandidatesSampleA(); 212 | 213 | $firstErr = Parse::findMatchingStruct( 214 | $candidates, 215 | [ 216 | "a" => [ 217 | "a" => "" 218 | ] 219 | ] 220 | ); 221 | $this->assertTrue( 222 | $firstErr instanceof ParseErrorsWrapper 223 | ); 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /ConfigStruct/src/Endermanbugzjfc/ConfigStruct/ParseContext/ObjectContext.php: -------------------------------------------------------------------------------- 1 | $reflection 33 | * @param BasePropertyContext[] $propertyContexts Key = property name. 34 | * @param mixed[] $unhandledElements Raw value of elements in the input which do not have the corresponding property. 35 | * @param ReflectionProperty[] $missingElements Key = property name. 36 | */ 37 | public function __construct( 38 | protected ReflectionClass $reflection, 39 | protected array $propertyContexts, 40 | protected array $unhandledElements, 41 | protected array $missingElements 42 | ) { 43 | } 44 | 45 | /** 46 | * @return ReflectionClass 47 | */ 48 | public function getReflection() : ReflectionClass 49 | { 50 | return $this->reflection; 51 | } 52 | 53 | /** 54 | * @return mixed[] Raw value of elements in the input which do not have the corresponding property. Please notice that some properties might also have their unhandled elements, see {@link BasePropertyContext::getUnhandledElements()}. 55 | */ 56 | public function getUnhandledElements() : array 57 | { 58 | return $this->unhandledElements; 59 | } 60 | 61 | /** 62 | * @return ReflectionProperty[] Key = property name. 63 | */ 64 | public function getMissingElements() : array 65 | { 66 | return $this->missingElements; 67 | } 68 | 69 | /** 70 | * @return BasePropertyContext[] Key = property name. 71 | */ 72 | public function getPropertyContexts() : array 73 | { 74 | return $this->propertyContexts; 75 | } 76 | 77 | /** 78 | * Copy output data to the given object. 79 | * @param object $object This object will be modified. 80 | * @param string $rootHeaderLabel See {@link ParseErrorsWrapper::getRootHeaderLabel()}. 81 | * @throws ParseErrorsWrapper 82 | */ 83 | public function copyToObject( 84 | object $object, 85 | string $rootHeaderLabel 86 | ) : void { 87 | $propertyContexts = $this->getPropertyContexts(); 88 | $tree = $this->getErrorsTree(); 89 | foreach ($propertyContexts as $propertyContext) { 90 | if ($propertyContext->omitCopyToObject()) { 91 | continue; 92 | } 93 | 94 | $reflection = $propertyContext->getDetails()->getReflection(); 95 | $value = $propertyContext->getValue(); 96 | try { 97 | $reflection->setValue( 98 | $object, 99 | $value 100 | ); 101 | } catch (TypeError $err) { 102 | $expectedTypes = array_unique( 103 | array_map( 104 | static fn(ReflectionNamedType $type) : string => ( 105 | class_exists($raw = $type->getName()) 106 | or 107 | $raw === "self" 108 | ) 109 | ? "array" 110 | : $raw, 111 | ReflectionUtils::getPropertyTypes($reflection) 112 | ) 113 | ); 114 | $types = $reflection->getType(); 115 | if ($types?->allowsNull() ?? true) { 116 | $expectedTypes[] = "null"; 117 | } 118 | $expectedTypes = array_unique( 119 | $expectedTypes // There might be multiple "null"s. 120 | ); 121 | 122 | $treeKey = $propertyContext->getErrorsTreeKey(); 123 | $tree[$treeKey][] = new TypeMismatchError( 124 | $err, 125 | $expectedTypes, 126 | get_debug_type($value) 127 | ); 128 | } 129 | } 130 | 131 | if ($tree !== []) { 132 | throw new ParseErrorsWrapper( 133 | $tree, 134 | $rootHeaderLabel 135 | ); 136 | } 137 | } 138 | 139 | /** 140 | * @param string $rootHeaderLabel See {@link ParseErrorsWrapper::getRootHeaderLabel()}. 141 | * @return T The constructor of object should have 0 arguments. 142 | * @throws ParseErrorsWrapper 143 | */ 144 | public function copyToNewObject( 145 | string $rootHeaderLabel 146 | ) : object { 147 | try { 148 | $instance = $this->getReflection()->newInstance(); 149 | } catch (ReflectionException $err) { 150 | self::invalidStructure( // Failed to create a new object from reflection. 151 | new StructureError( 152 | "Failed to create a new object from reflection", 153 | $err 154 | ), 155 | $this->getReflection() 156 | ); 157 | 158 | throw new AssertionError("unreachable"); // Blame PHPStan. 159 | } 160 | $this->copyToObject( 161 | $instance, 162 | $rootHeaderLabel 163 | ); 164 | return $instance; 165 | } 166 | 167 | /** 168 | * @return array 169 | */ 170 | public function getErrorsTree() : array 171 | { 172 | $tree = []; 173 | $propertyContexts = $this->getPropertyContexts(); 174 | foreach ($propertyContexts as $propertyContext) { 175 | $tree = array_merge( 176 | $tree, 177 | $propertyContext->getWrappedErrorsTree() 178 | ); 179 | } 180 | 181 | return $tree; 182 | } 183 | 184 | public function hasError() : bool 185 | { 186 | $tree = $this->getErrorsTree(); 187 | return $tree !== []; 188 | } 189 | } -------------------------------------------------------------------------------- /ConfigStruct/src/Endermanbugzjfc/ConfigStruct/ParseErrorsWrapper.php: -------------------------------------------------------------------------------- 1 | $errorsTree 29 | */ 30 | public function __construct( 31 | protected array $errorsTree, 32 | protected string $rootHeaderLabel 33 | ) { 34 | $message = $this->generateErrorMessage(); 35 | parent::__construct( 36 | $message, 37 | E_RECOVERABLE_ERROR 38 | ); 39 | } 40 | 41 | /** 42 | * @return array 43 | */ 44 | public function getErrorsTree() : array 45 | { 46 | return $this->errorsTree; 47 | } 48 | 49 | /** 50 | * @return string The label that will be displayed in the first line (header). File path should be given if the parsed data was from a file. 51 | */ 52 | public function getRootHeaderLabel() : string 53 | { 54 | return $this->rootHeaderLabel; 55 | } 56 | 57 | /** 58 | * @return Closure(string[], BaseParseError) : bool|null Should have exactly 2 arguments and return bool. False = the error will not be displayed in the final error message. The first argument is array $keys, a list of error labels that can be used for identifying which error in the tree has just been walked. The second argument is {@link BaseParseError} $parseError, the error itself. 59 | */ 60 | public function getErrorFilter() : ?Closure 61 | { 62 | return $this->errorFilter; 63 | } 64 | 65 | 66 | public function getIndentation() : string 67 | { 68 | return $this->indentation; 69 | } 70 | 71 | /** 72 | * @param Closure|null $errorFilter See {@link ParseErrorsWrapper::getErrorFilter()}. 73 | * @see ParseErrorsWrapper::errorsTreeToString() 74 | */ 75 | public function regenerateErrorMessage( 76 | string $rootHeaderLabel, 77 | string $indentation = " ", 78 | Closure $errorFilter = null 79 | ) : void { 80 | $this->rootHeaderLabel = $rootHeaderLabel; 81 | $this->errorFilter = $errorFilter; 82 | $this->indentation = $indentation; 83 | 84 | $this->message = $this->generateErrorMessage(); 85 | } 86 | 87 | protected function generateErrorMessage() : string 88 | { 89 | $tree = $this->getErrorsTree(); 90 | $label = $this->getRootHeaderLabel(); 91 | return self::errorsTreeToString( 92 | $tree, 93 | $label, 94 | $this->getIndentation(), 95 | $this->getErrorFilter() 96 | ) . "\n"; 97 | } 98 | 99 | /** 100 | * @param array $tree The errors tree. 101 | * @param string $label The label that will be displayed in the first line (header). File path should be given if the parsed data was from a file. 102 | * @param string $indentation Indentation per depth, to make the errors tree more readable for human. Four spaces by default. 103 | * @param Closure|null $errorFilter See {@link ParseErrorsWrapper::getErrorFilter()}. 104 | */ 105 | public static function errorsTreeToString( 106 | array $tree, 107 | string $label, 108 | string $indentation = " ", 109 | ?Closure $errorFilter = null 110 | ) : string { 111 | return self::errorsTreeToStringRecursive( 112 | $tree, 113 | [ 114 | $label 115 | ], 116 | $indentation, 117 | $errorFilter 118 | )[0] ?? ""; 119 | } 120 | 121 | /** 122 | * @param array $tree 123 | * @param string[] $keys 124 | * @return array{string|null, int} Lines and errors count. 125 | */ 126 | protected static function errorsTreeToStringRecursive( 127 | array $tree, 128 | array $keys, 129 | string $defaultIndentation, 130 | ?Closure $errorFilter 131 | ) : array { 132 | $lines = []; 133 | $depth = count($keys); 134 | $indentation = str_repeat( 135 | $defaultIndentation, 136 | $depth 137 | ); 138 | 139 | $count = 0; 140 | foreach ($tree as $key => $content) { 141 | if (!$content instanceof BaseParseError) { 142 | $children[$key] = $content; 143 | continue; 144 | } 145 | 146 | if ( 147 | $errorFilter !== null 148 | and 149 | !$errorFilter( 150 | $keys, 151 | $content 152 | ) 153 | ) { 154 | continue; 155 | } 156 | $count++; 157 | $lines[] = $indentation . $content; 158 | } 159 | unset($tree); 160 | foreach ($children ?? [] as $key => $child) { 161 | $keysClone = $keys; 162 | $keysClone[] = $key; 163 | /** 164 | * @var array $child 165 | */ 166 | [ 167 | $newLines, 168 | $newCount 169 | ] = self::errorsTreeToStringRecursive( 170 | $child, 171 | $keysClone, 172 | $defaultIndentation, 173 | $errorFilter 174 | ); 175 | $count += $newCount; 176 | if ($newLines !== null) { 177 | $lines[] = $newLines; 178 | } 179 | } 180 | if ($lines !== []) { 181 | $indentation = str_repeat( 182 | $defaultIndentation, 183 | $depth - 1 184 | ); 185 | $label = $keys[$depth - 1]; 186 | array_unshift( 187 | $lines, 188 | $indentation . "$count errors in $label" 189 | ); 190 | return [ 191 | implode( 192 | "\n", 193 | $lines 194 | ), 195 | $count 196 | ]; 197 | } 198 | return [ 199 | null, 200 | 0 201 | ]; 202 | } 203 | 204 | /** 205 | * Trim out the trailing line break and other whitespaces. 206 | */ 207 | public function getMessageRtrim() : string 208 | { 209 | return rtrim( 210 | $this->getMessage() 211 | ); 212 | } 213 | } -------------------------------------------------------------------------------- /tests/ParseError/TypeMismatchErrorTest.php: -------------------------------------------------------------------------------- 1 | :( 22 | */ 23 | private static function objectProvider() 24 | { 25 | return new class () { 26 | public bool $testBool; 27 | public int $testInt; 28 | public float $testFloat; 29 | public string $testString; 30 | public array $testArray; 31 | 32 | public Extendable|A|B $testUnionTypesChildObject; 33 | #[ListType(Extendable::class)] #[ListType(A::class)] #[ListType(B::class)] 34 | public array $testListMultipleTypes; 35 | }; 36 | } 37 | 38 | /** 39 | * @throws ParseErrorsWrapper 40 | */ 41 | private static function parse( 42 | mixed $value, 43 | object $object 44 | ) : void { 45 | $context = Parse::object( 46 | $object, 47 | [ 48 | "testBool" => $value, 49 | "testInt" => $value, 50 | "testFloat" => $value, 51 | "testString" => $value, 52 | "testArray" => $value, 53 | 54 | "testUnionTypesChildObject" => $value, 55 | "testListMultipleTypes" => $value 56 | ] 57 | ); 58 | $context->copyToObject( 59 | $object, 60 | "root object" 61 | ); 62 | } 63 | 64 | /** 65 | * @throws ParseErrorsWrapper 66 | */ 67 | public function testGetMessageNull() 68 | { 69 | $object = self::objectProvider(); 70 | $this->expectExceptionMessage( 71 | <<expectExceptionMessage( 103 | <<expectExceptionMessage( 127 | <<expectExceptionMessage( 151 | <<expectExceptionMessage( 175 | <<expectExceptionMessage( 201 | <<expectExceptionMessage( 229 | << [ 256 | "extendable" => null 257 | ] 258 | ] 259 | ); 260 | $this->expectExceptionMessage( 261 | <<copyToObject( 270 | $object, 271 | "root object" 272 | ); 273 | } 274 | 275 | /** 276 | * @throws ParseErrorsWrapper 277 | */ 278 | public function testGetMessageNoMatchingStructForList() 279 | { 280 | $object = self::objectProvider(); 281 | $context = Parse::object( 282 | $object, 283 | [ 284 | "testListMultipleTypes" => [ 285 | [ 286 | "extendable" => null 287 | ] 288 | ] 289 | ] 290 | ); 291 | $this->expectExceptionMessage( 292 | <<copyToObject( 302 | $object, 303 | "root object" 304 | ); 305 | } 306 | 307 | public function testGetExpectedTypes() 308 | { 309 | $object = new class () { 310 | public array|self $testUnionTypesOfArrayAndClass; 311 | 312 | public ?bool $testNullableBool; 313 | }; 314 | 315 | $context = Parse::object( 316 | $object, 317 | [ 318 | "testUnionTypesOfArrayAndClass" => null, 319 | "testNullableString" => "" 320 | ] 321 | ); 322 | try { 323 | $context->copyToObject( 324 | $object, 325 | "root object" 326 | ); 327 | } catch (ParseErrorsWrapper $parseError) { 328 | } 329 | if (!isset($parseError)) { 330 | throw new AssertionError( 331 | "No errors when copy parsed data to object" 332 | ); 333 | } 334 | 335 | $properties = $context->getPropertyContexts(); 336 | foreach ($properties as $property) { 337 | $treeKey = $property->getErrorsTreeKey(); 338 | $tree = $parseError->getErrorsTree()[$treeKey]; 339 | [$err] = $tree; 340 | 341 | if ($err instanceof TypeMismatchError) { 342 | $this->assertTrue( 343 | $err->getExpectedTypes() === [ 344 | "array" 345 | ] 346 | ); 347 | } else { 348 | throw new AssertionError( 349 | "Error is not " . TypeMismatchError::class 350 | ); 351 | } 352 | } 353 | } 354 | } 355 | -------------------------------------------------------------------------------- /ConfigStruct/src/Endermanbugzjfc/ConfigStruct/Parse.php: -------------------------------------------------------------------------------- 1 | $object. 44 | */ 45 | public static function object( 46 | object $object, 47 | array $input 48 | ) : ObjectContext { 49 | $reflect = new ReflectionClass( 50 | $object 51 | ); 52 | return self::objectByReflection( 53 | $reflect, 54 | $input 55 | ); 56 | } 57 | 58 | /** 59 | * @template T of object 60 | * @param ReflectionClass $reflect 61 | * @param mixed[] $input 62 | * @return ObjectContext 63 | */ 64 | public static function objectByReflection( 65 | ReflectionClass $reflect, 66 | array $input 67 | ) : ObjectContext { 68 | $properties = $reflect->getProperties( 69 | ReflectionProperty::IS_PUBLIC 70 | ); 71 | try { 72 | $map = self::getPropertyNameToKeyNameMap( 73 | $properties, 74 | $input 75 | ); 76 | } catch (Exception $err) { 77 | self::invalidStructure( // Duplicated key names. 78 | $err, 79 | $reflect 80 | ); 81 | } 82 | foreach ( 83 | $properties as $property 84 | ) { 85 | $propertyName = $property->getName(); 86 | $name = $map[$propertyName] ?? null; 87 | if ($name === null) { 88 | $missing[$propertyName] = $property; 89 | continue; 90 | } 91 | $value = $input[$name]; 92 | unset( 93 | $input[$name] 94 | ); 95 | $context = self::createPropertyDetails( 96 | $name, 97 | $property 98 | ); 99 | $output[$propertyName] = self::property( 100 | $context, 101 | $value 102 | ); 103 | } 104 | return new ObjectContext( 105 | $reflect, 106 | $output ?? [], 107 | $input, 108 | $missing ?? [] 109 | ); 110 | } 111 | 112 | protected static function createPropertyDetails( 113 | string $name, 114 | ReflectionProperty $property 115 | ) : PropertyDetails { 116 | return new PropertyDetails( 117 | $name, 118 | $property 119 | ); 120 | } 121 | 122 | /** 123 | * Redirect to the correct parse function. Base on the property's type and attributes provided. 124 | * 125 | * Property type "self" will be interpreted as the declaring class of that property. Overriding of "self" will be implemented in future versions. 126 | * @return BasePropertyContext A non-abstract property parse context. 127 | */ 128 | public static function property( 129 | PropertyDetails $details, 130 | mixed $value 131 | ) : BasePropertyContext { 132 | if (is_array( 133 | $value 134 | )) { 135 | $property = $details->getReflection(); 136 | $types = ReflectionUtils::getPropertyTypes($property); 137 | $candidates = $raws = []; 138 | foreach ($types as $type) { 139 | $raw = $type->getName(); 140 | if ($raw === "self") { 141 | $raw = $details->getReflection()->getDeclaringClass()->getName(); 142 | } elseif (!class_exists($raw)) { 143 | continue; 144 | } 145 | $raws[] = $raw; 146 | } 147 | $raws = array_unique( 148 | $raws 149 | ); // Since it is possible to have both "self" and the own class name in an union-types. 150 | /** 151 | * @var class-string[] $raws 152 | */ 153 | foreach ($raws as $raw) { 154 | $candidate = new ReflectionClass( 155 | $raw 156 | ); 157 | $candidates[] = $candidate; 158 | } 159 | if ($candidates !== []) { 160 | try { 161 | $found = self::findMatchingStruct( 162 | $candidates, 163 | $value 164 | ); 165 | } catch (Exception $err) { 166 | throw new AssertionError( 167 | "unreachable", 168 | -1, 169 | $err 170 | ); 171 | } 172 | return new ChildObjectContext( 173 | $details, 174 | $found 175 | ); 176 | } 177 | 178 | $listTypes = $property->getAttributes( 179 | ListType::class 180 | ); 181 | if ($listTypes !== []) { 182 | foreach ($listTypes as $listType) { 183 | $listTypeRaw = $listType->getArguments()[0]; 184 | try { 185 | $listReflect = new ReflectionClass( 186 | $listTypeRaw 187 | ); 188 | } catch (ReflectionException $err) { 189 | self::invalidStructure( // List type attribute has invalid class. 190 | new StructureError( 191 | "List type attribute has invalid class", 192 | $err 193 | ), 194 | $property 195 | ); 196 | 197 | throw new AssertionError("unreachable"); 198 | } 199 | $listReflects[] = $listReflect; 200 | } 201 | foreach ($value as $key => $input) { 202 | try { 203 | $element = self::findMatchingStruct( 204 | $listReflects, 205 | $input 206 | ); 207 | } catch (Exception $err) { 208 | self::invalidStructure( // Duplicated struct candidates. 209 | $err, 210 | $property 211 | ); 212 | 213 | throw new AssertionError("unreachable"); 214 | } catch (TypeError $err) { // @phpstan-ignore-line $input might not be an array. 215 | $elementsErrorsTree[$key] = new TypeMismatchError( 216 | $err, 217 | [ 218 | "array" 219 | ], 220 | get_debug_type($input) 221 | ); 222 | continue; 223 | } 224 | if ($element instanceof ParseErrorsWrapper) { 225 | $elementsErrorsTree[$key] = $element->getErrorsTree(); 226 | continue; 227 | } 228 | 229 | unset( 230 | $value[$key] 231 | ); 232 | $elements[$key] = $element; 233 | } 234 | return new ListContext( 235 | $details, 236 | $elements ?? [], 237 | $elementsErrorsTree ?? [], 238 | $value 239 | ); 240 | } 241 | } 242 | 243 | return new RawContext( 244 | $details, 245 | $value 246 | ); 247 | } 248 | 249 | /** 250 | * @param ReflectionProperty[] $properties 251 | * @param mixed[] $input 252 | * @return array 253 | * @throws Exception Duplicated key names. 254 | */ 255 | protected static function getPropertyNameToKeyNameMap( 256 | array $properties, 257 | array $input 258 | ) : array { 259 | foreach ($properties as $property) { 260 | $propertyName = $property->getName(); 261 | 262 | $names = $duplicated = []; 263 | foreach ( 264 | $property->getAttributes(KeyName::class) 265 | as $keyName 266 | ) { 267 | $name = $keyName->getArguments()[0]; 268 | if (in_array( 269 | $name, 270 | $names, true 271 | // PHP array index is not strictly typed. Classic PHP. 272 | )) { 273 | $duplicated[] = $name; 274 | } 275 | $names[] = $name; 276 | } 277 | 278 | if ($duplicated !== []) { 279 | $duplicatedList = implode( 280 | "\", \"", 281 | $duplicated 282 | ); 283 | throw new Exception( 284 | "Duplicated key names \"$duplicatedList\"" 285 | ); 286 | } 287 | foreach ( 288 | $names === [] 289 | ? [$propertyName] 290 | : $names 291 | as $name 292 | ) { 293 | if (!array_key_exists($name, $input)) { 294 | continue; 295 | } 296 | $map[$propertyName] = $name; 297 | break; 298 | } 299 | } 300 | return $map ?? []; 301 | } 302 | 303 | /** 304 | * Find the struct with the most handled elements count. And parse the input with the selected struct. 305 | * 306 | * @template T of object 307 | * @param ReflectionClass[] $candidates Struct candidates. 308 | * @param mixed[] $input An array which was converted from object. 309 | * @return ObjectContext|ParseErrorsWrapper If all structs conflict with the input, the error of the first {@link ObjectContext} will be returned. 310 | * @throws Exception Duplicated struct candidates. 311 | */ 312 | public static function findMatchingStruct( 313 | array $candidates, 314 | array $input 315 | ) : ObjectContext|ParseErrorsWrapper { 316 | if ($candidates === []) { 317 | throw new InvalidArgumentException( 318 | "No struct candidates were given" 319 | ); 320 | } 321 | 322 | $raws = $duplicated = $outputs = []; 323 | $firstErr = null; 324 | foreach ($candidates as $key => $candidate) { 325 | if ($candidate->isAbstract()) { 326 | continue; 327 | } 328 | $raw = $candidate->getName(); 329 | if (in_array( 330 | $raw, 331 | $raws, 332 | true 333 | )) { 334 | $duplicated[] = $raw; 335 | continue; 336 | } 337 | $raws[] = $raw; 338 | $output = self::objectByReflection( 339 | $candidate, 340 | $input 341 | ); 342 | try { 343 | $output->copyToNewObject( 344 | "object" 345 | ); 346 | } catch (ParseErrorsWrapper $err) { 347 | $firstErr = $err; 348 | continue; 349 | } 350 | $outputs[] = $output; 351 | } 352 | if ($duplicated !== []) { 353 | $duplicatedList = implode( 354 | ", ", 355 | $duplicated 356 | ); 357 | throw new Exception( 358 | "Duplicated struct candidates $duplicatedList" 359 | ); 360 | } 361 | if ($outputs === []) { 362 | assert(isset($firstErr)); 363 | return $firstErr; 364 | } 365 | $leastUnhandled = $outputs[0]; 366 | foreach ($outputs as $output2) { 367 | if ( 368 | count( 369 | $leastUnhandled->getUnhandledElements() 370 | ) < count( 371 | $output2->getUnhandledElements() 372 | ) 373 | ) { 374 | continue; 375 | } 376 | $leastUnhandled = $output2; 377 | } 378 | 379 | return $leastUnhandled; 380 | } 381 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | charset = utf-8 3 | end_of_line = lf 4 | indent_size = 4 5 | indent_style = space 6 | insert_final_newline = false 7 | max_line_length = 120 8 | tab_width = 4 9 | ij_continuation_indent_size = 8 10 | ij_formatter_off_tag = @formatter:off 11 | ij_formatter_on_tag = @formatter:on 12 | ij_formatter_tags_enabled = false 13 | ij_smart_tabs = false 14 | ij_visual_guides = none 15 | ij_wrap_on_typing = false 16 | 17 | [*.css] 18 | ij_css_align_closing_brace_with_properties = false 19 | ij_css_blank_lines_around_nested_selector = 1 20 | ij_css_blank_lines_between_blocks = 1 21 | ij_css_block_comment_add_space = false 22 | ij_css_brace_placement = end_of_line 23 | ij_css_enforce_quotes_on_format = false 24 | ij_css_hex_color_long_format = false 25 | ij_css_hex_color_lower_case = false 26 | ij_css_hex_color_short_format = false 27 | ij_css_hex_color_upper_case = false 28 | ij_css_keep_blank_lines_in_code = 2 29 | ij_css_keep_indents_on_empty_lines = false 30 | ij_css_keep_single_line_blocks = false 31 | ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow 32 | ij_css_space_after_colon = true 33 | ij_css_space_before_opening_brace = true 34 | ij_css_use_double_quotes = true 35 | ij_css_value_alignment = do_not_align 36 | 37 | [*.feature] 38 | indent_size = 2 39 | ij_gherkin_keep_indents_on_empty_lines = false 40 | 41 | [*.gsp] 42 | ij_gsp_keep_indents_on_empty_lines = false 43 | 44 | [*.haml] 45 | indent_size = 2 46 | ij_haml_keep_indents_on_empty_lines = false 47 | 48 | [*.java] 49 | ij_java_align_consecutive_assignments = false 50 | ij_java_align_consecutive_variable_declarations = false 51 | ij_java_align_group_field_declarations = false 52 | ij_java_align_multiline_annotation_parameters = false 53 | ij_java_align_multiline_array_initializer_expression = false 54 | ij_java_align_multiline_assignment = false 55 | ij_java_align_multiline_binary_operation = false 56 | ij_java_align_multiline_chained_methods = false 57 | ij_java_align_multiline_extends_list = false 58 | ij_java_align_multiline_for = true 59 | ij_java_align_multiline_method_parentheses = false 60 | ij_java_align_multiline_parameters = true 61 | ij_java_align_multiline_parameters_in_calls = false 62 | ij_java_align_multiline_parenthesized_expression = false 63 | ij_java_align_multiline_records = true 64 | ij_java_align_multiline_resources = true 65 | ij_java_align_multiline_ternary_operation = false 66 | ij_java_align_multiline_text_blocks = false 67 | ij_java_align_multiline_throws_list = false 68 | ij_java_align_subsequent_simple_methods = false 69 | ij_java_align_throws_keyword = false 70 | ij_java_annotation_parameter_wrap = off 71 | ij_java_array_initializer_new_line_after_left_brace = false 72 | ij_java_array_initializer_right_brace_on_new_line = false 73 | ij_java_array_initializer_wrap = off 74 | ij_java_assert_statement_colon_on_next_line = false 75 | ij_java_assert_statement_wrap = off 76 | ij_java_assignment_wrap = off 77 | ij_java_binary_operation_sign_on_next_line = false 78 | ij_java_binary_operation_wrap = off 79 | ij_java_blank_lines_after_anonymous_class_header = 0 80 | ij_java_blank_lines_after_class_header = 0 81 | ij_java_blank_lines_after_imports = 1 82 | ij_java_blank_lines_after_package = 1 83 | ij_java_blank_lines_around_class = 1 84 | ij_java_blank_lines_around_field = 0 85 | ij_java_blank_lines_around_field_in_interface = 0 86 | ij_java_blank_lines_around_initializer = 1 87 | ij_java_blank_lines_around_method = 1 88 | ij_java_blank_lines_around_method_in_interface = 1 89 | ij_java_blank_lines_before_class_end = 0 90 | ij_java_blank_lines_before_imports = 1 91 | ij_java_blank_lines_before_method_body = 0 92 | ij_java_blank_lines_before_package = 0 93 | ij_java_block_brace_style = end_of_line 94 | ij_java_block_comment_add_space = false 95 | ij_java_block_comment_at_first_column = true 96 | ij_java_builder_methods = none 97 | ij_java_call_parameters_new_line_after_left_paren = false 98 | ij_java_call_parameters_right_paren_on_new_line = false 99 | ij_java_call_parameters_wrap = off 100 | ij_java_case_statement_on_separate_line = true 101 | ij_java_catch_on_new_line = false 102 | ij_java_class_annotation_wrap = split_into_lines 103 | ij_java_class_brace_style = end_of_line 104 | ij_java_class_count_to_use_import_on_demand = 5 105 | ij_java_class_names_in_javadoc = 1 106 | ij_java_do_not_indent_top_level_class_members = false 107 | ij_java_do_not_wrap_after_single_annotation = false 108 | ij_java_do_while_brace_force = never 109 | ij_java_doc_add_blank_line_after_description = true 110 | ij_java_doc_add_blank_line_after_param_comments = false 111 | ij_java_doc_add_blank_line_after_return = false 112 | ij_java_doc_add_p_tag_on_empty_lines = true 113 | ij_java_doc_align_exception_comments = true 114 | ij_java_doc_align_param_comments = true 115 | ij_java_doc_do_not_wrap_if_one_line = false 116 | ij_java_doc_enable_formatting = true 117 | ij_java_doc_enable_leading_asterisks = true 118 | ij_java_doc_indent_on_continuation = false 119 | ij_java_doc_keep_empty_lines = true 120 | ij_java_doc_keep_empty_parameter_tag = true 121 | ij_java_doc_keep_empty_return_tag = true 122 | ij_java_doc_keep_empty_throws_tag = true 123 | ij_java_doc_keep_invalid_tags = true 124 | ij_java_doc_param_description_on_new_line = false 125 | ij_java_doc_preserve_line_breaks = false 126 | ij_java_doc_use_throws_not_exception_tag = true 127 | ij_java_else_on_new_line = false 128 | ij_java_entity_dd_suffix = EJB 129 | ij_java_entity_eb_suffix = Bean 130 | ij_java_entity_hi_suffix = Home 131 | ij_java_entity_lhi_prefix = Local 132 | ij_java_entity_lhi_suffix = Home 133 | ij_java_entity_li_prefix = Local 134 | ij_java_entity_pk_class = java.lang.String 135 | ij_java_entity_vo_suffix = VO 136 | ij_java_enum_constants_wrap = off 137 | ij_java_extends_keyword_wrap = off 138 | ij_java_extends_list_wrap = off 139 | ij_java_field_annotation_wrap = split_into_lines 140 | ij_java_finally_on_new_line = false 141 | ij_java_for_brace_force = never 142 | ij_java_for_statement_new_line_after_left_paren = false 143 | ij_java_for_statement_right_paren_on_new_line = false 144 | ij_java_for_statement_wrap = off 145 | ij_java_generate_final_locals = false 146 | ij_java_generate_final_parameters = false 147 | ij_java_if_brace_force = never 148 | ij_java_imports_layout = *,|,javax.**,java.**,|,$* 149 | ij_java_indent_case_from_switch = true 150 | ij_java_insert_inner_class_imports = false 151 | ij_java_insert_override_annotation = true 152 | ij_java_keep_blank_lines_before_right_brace = 2 153 | ij_java_keep_blank_lines_between_package_declaration_and_header = 2 154 | ij_java_keep_blank_lines_in_code = 2 155 | ij_java_keep_blank_lines_in_declarations = 2 156 | ij_java_keep_builder_methods_indents = false 157 | ij_java_keep_control_statement_in_one_line = true 158 | ij_java_keep_first_column_comment = true 159 | ij_java_keep_indents_on_empty_lines = false 160 | ij_java_keep_line_breaks = true 161 | ij_java_keep_multiple_expressions_in_one_line = false 162 | ij_java_keep_simple_blocks_in_one_line = false 163 | ij_java_keep_simple_classes_in_one_line = false 164 | ij_java_keep_simple_lambdas_in_one_line = false 165 | ij_java_keep_simple_methods_in_one_line = false 166 | ij_java_label_indent_absolute = false 167 | ij_java_label_indent_size = 0 168 | ij_java_lambda_brace_style = end_of_line 169 | ij_java_layout_static_imports_separately = true 170 | ij_java_line_comment_add_space = false 171 | ij_java_line_comment_at_first_column = true 172 | ij_java_message_dd_suffix = EJB 173 | ij_java_message_eb_suffix = Bean 174 | ij_java_method_annotation_wrap = split_into_lines 175 | ij_java_method_brace_style = end_of_line 176 | ij_java_method_call_chain_wrap = off 177 | ij_java_method_parameters_new_line_after_left_paren = false 178 | ij_java_method_parameters_right_paren_on_new_line = false 179 | ij_java_method_parameters_wrap = off 180 | ij_java_modifier_list_wrap = false 181 | ij_java_names_count_to_use_import_on_demand = 3 182 | ij_java_new_line_after_lparen_in_record_header = false 183 | ij_java_packages_to_use_import_on_demand = java.awt.*,javax.swing.* 184 | ij_java_parameter_annotation_wrap = off 185 | ij_java_parentheses_expression_new_line_after_left_paren = false 186 | ij_java_parentheses_expression_right_paren_on_new_line = false 187 | ij_java_place_assignment_sign_on_next_line = false 188 | ij_java_prefer_longer_names = true 189 | ij_java_prefer_parameters_wrap = false 190 | ij_java_record_components_wrap = normal 191 | ij_java_repeat_synchronized = true 192 | ij_java_replace_instanceof_and_cast = false 193 | ij_java_replace_null_check = true 194 | ij_java_replace_sum_lambda_with_method_ref = true 195 | ij_java_resource_list_new_line_after_left_paren = false 196 | ij_java_resource_list_right_paren_on_new_line = false 197 | ij_java_resource_list_wrap = off 198 | ij_java_rparen_on_new_line_in_record_header = false 199 | ij_java_session_dd_suffix = EJB 200 | ij_java_session_eb_suffix = Bean 201 | ij_java_session_hi_suffix = Home 202 | ij_java_session_lhi_prefix = Local 203 | ij_java_session_lhi_suffix = Home 204 | ij_java_session_li_prefix = Local 205 | ij_java_session_si_suffix = Service 206 | ij_java_space_after_closing_angle_bracket_in_type_argument = false 207 | ij_java_space_after_colon = true 208 | ij_java_space_after_comma = true 209 | ij_java_space_after_comma_in_type_arguments = true 210 | ij_java_space_after_for_semicolon = true 211 | ij_java_space_after_quest = true 212 | ij_java_space_after_type_cast = true 213 | ij_java_space_before_annotation_array_initializer_left_brace = false 214 | ij_java_space_before_annotation_parameter_list = false 215 | ij_java_space_before_array_initializer_left_brace = false 216 | ij_java_space_before_catch_keyword = true 217 | ij_java_space_before_catch_left_brace = true 218 | ij_java_space_before_catch_parentheses = true 219 | ij_java_space_before_class_left_brace = true 220 | ij_java_space_before_colon = true 221 | ij_java_space_before_colon_in_foreach = true 222 | ij_java_space_before_comma = false 223 | ij_java_space_before_do_left_brace = true 224 | ij_java_space_before_else_keyword = true 225 | ij_java_space_before_else_left_brace = true 226 | ij_java_space_before_finally_keyword = true 227 | ij_java_space_before_finally_left_brace = true 228 | ij_java_space_before_for_left_brace = true 229 | ij_java_space_before_for_parentheses = true 230 | ij_java_space_before_for_semicolon = false 231 | ij_java_space_before_if_left_brace = true 232 | ij_java_space_before_if_parentheses = true 233 | ij_java_space_before_method_call_parentheses = false 234 | ij_java_space_before_method_left_brace = true 235 | ij_java_space_before_method_parentheses = false 236 | ij_java_space_before_opening_angle_bracket_in_type_parameter = false 237 | ij_java_space_before_quest = true 238 | ij_java_space_before_switch_left_brace = true 239 | ij_java_space_before_switch_parentheses = true 240 | ij_java_space_before_synchronized_left_brace = true 241 | ij_java_space_before_synchronized_parentheses = true 242 | ij_java_space_before_try_left_brace = true 243 | ij_java_space_before_try_parentheses = true 244 | ij_java_space_before_type_parameter_list = false 245 | ij_java_space_before_while_keyword = true 246 | ij_java_space_before_while_left_brace = true 247 | ij_java_space_before_while_parentheses = true 248 | ij_java_space_inside_one_line_enum_braces = false 249 | ij_java_space_within_empty_array_initializer_braces = false 250 | ij_java_space_within_empty_method_call_parentheses = false 251 | ij_java_space_within_empty_method_parentheses = false 252 | ij_java_spaces_around_additive_operators = true 253 | ij_java_spaces_around_assignment_operators = true 254 | ij_java_spaces_around_bitwise_operators = true 255 | ij_java_spaces_around_equality_operators = true 256 | ij_java_spaces_around_lambda_arrow = true 257 | ij_java_spaces_around_logical_operators = true 258 | ij_java_spaces_around_method_ref_dbl_colon = false 259 | ij_java_spaces_around_multiplicative_operators = true 260 | ij_java_spaces_around_relational_operators = true 261 | ij_java_spaces_around_shift_operators = true 262 | ij_java_spaces_around_type_bounds_in_type_parameters = true 263 | ij_java_spaces_around_unary_operator = false 264 | ij_java_spaces_within_angle_brackets = false 265 | ij_java_spaces_within_annotation_parentheses = false 266 | ij_java_spaces_within_array_initializer_braces = false 267 | ij_java_spaces_within_braces = false 268 | ij_java_spaces_within_brackets = false 269 | ij_java_spaces_within_cast_parentheses = false 270 | ij_java_spaces_within_catch_parentheses = false 271 | ij_java_spaces_within_for_parentheses = false 272 | ij_java_spaces_within_if_parentheses = false 273 | ij_java_spaces_within_method_call_parentheses = false 274 | ij_java_spaces_within_method_parentheses = false 275 | ij_java_spaces_within_parentheses = false 276 | ij_java_spaces_within_record_header = false 277 | ij_java_spaces_within_switch_parentheses = false 278 | ij_java_spaces_within_synchronized_parentheses = false 279 | ij_java_spaces_within_try_parentheses = false 280 | ij_java_spaces_within_while_parentheses = false 281 | ij_java_special_else_if_treatment = true 282 | ij_java_subclass_name_suffix = Impl 283 | ij_java_ternary_operation_signs_on_next_line = false 284 | ij_java_ternary_operation_wrap = off 285 | ij_java_test_name_suffix = Test 286 | ij_java_throws_keyword_wrap = off 287 | ij_java_throws_list_wrap = off 288 | ij_java_use_external_annotations = false 289 | ij_java_use_fq_class_names = false 290 | ij_java_use_relative_indents = false 291 | ij_java_use_single_class_imports = true 292 | ij_java_variable_annotation_wrap = off 293 | ij_java_visibility = public 294 | ij_java_while_brace_force = never 295 | ij_java_while_on_new_line = false 296 | ij_java_wrap_comments = false 297 | ij_java_wrap_first_method_in_call_chain = false 298 | ij_java_wrap_long_lines = false 299 | 300 | [*.less] 301 | indent_size = 2 302 | ij_less_align_closing_brace_with_properties = false 303 | ij_less_blank_lines_around_nested_selector = 1 304 | ij_less_blank_lines_between_blocks = 1 305 | ij_less_block_comment_add_space = false 306 | ij_less_brace_placement = 0 307 | ij_less_enforce_quotes_on_format = false 308 | ij_less_hex_color_long_format = false 309 | ij_less_hex_color_lower_case = false 310 | ij_less_hex_color_short_format = false 311 | ij_less_hex_color_upper_case = false 312 | ij_less_keep_blank_lines_in_code = 2 313 | ij_less_keep_indents_on_empty_lines = false 314 | ij_less_keep_single_line_blocks = false 315 | ij_less_line_comment_add_space = false 316 | ij_less_line_comment_at_first_column = false 317 | ij_less_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow 318 | ij_less_space_after_colon = true 319 | ij_less_space_before_opening_brace = true 320 | ij_less_use_double_quotes = true 321 | ij_less_value_alignment = 0 322 | 323 | [*.proto] 324 | indent_size = 2 325 | tab_width = 2 326 | ij_continuation_indent_size = 4 327 | ij_protobuf_keep_blank_lines_in_code = 2 328 | ij_protobuf_keep_indents_on_empty_lines = false 329 | ij_protobuf_keep_line_breaks = true 330 | ij_protobuf_space_after_comma = true 331 | ij_protobuf_space_before_comma = false 332 | ij_protobuf_spaces_around_assignment_operators = true 333 | ij_protobuf_spaces_within_braces = false 334 | ij_protobuf_spaces_within_brackets = false 335 | 336 | [*.sass] 337 | indent_size = 2 338 | ij_sass_align_closing_brace_with_properties = false 339 | ij_sass_blank_lines_around_nested_selector = 1 340 | ij_sass_blank_lines_between_blocks = 1 341 | ij_sass_brace_placement = 0 342 | ij_sass_enforce_quotes_on_format = false 343 | ij_sass_hex_color_long_format = false 344 | ij_sass_hex_color_lower_case = false 345 | ij_sass_hex_color_short_format = false 346 | ij_sass_hex_color_upper_case = false 347 | ij_sass_keep_blank_lines_in_code = 2 348 | ij_sass_keep_indents_on_empty_lines = false 349 | ij_sass_keep_single_line_blocks = false 350 | ij_sass_line_comment_add_space = false 351 | ij_sass_line_comment_at_first_column = false 352 | ij_sass_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow 353 | ij_sass_space_after_colon = true 354 | ij_sass_space_before_opening_brace = true 355 | ij_sass_use_double_quotes = true 356 | ij_sass_value_alignment = 0 357 | 358 | [*.scss] 359 | indent_size = 2 360 | ij_scss_align_closing_brace_with_properties = false 361 | ij_scss_blank_lines_around_nested_selector = 1 362 | ij_scss_blank_lines_between_blocks = 1 363 | ij_scss_block_comment_add_space = false 364 | ij_scss_brace_placement = 0 365 | ij_scss_enforce_quotes_on_format = false 366 | ij_scss_hex_color_long_format = false 367 | ij_scss_hex_color_lower_case = false 368 | ij_scss_hex_color_short_format = false 369 | ij_scss_hex_color_upper_case = false 370 | ij_scss_keep_blank_lines_in_code = 2 371 | ij_scss_keep_indents_on_empty_lines = false 372 | ij_scss_keep_single_line_blocks = false 373 | ij_scss_line_comment_add_space = false 374 | ij_scss_line_comment_at_first_column = false 375 | ij_scss_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow 376 | ij_scss_space_after_colon = true 377 | ij_scss_space_before_opening_brace = true 378 | ij_scss_use_double_quotes = true 379 | ij_scss_value_alignment = 0 380 | 381 | [*.styl] 382 | indent_size = 2 383 | ij_stylus_align_closing_brace_with_properties = false 384 | ij_stylus_blank_lines_around_nested_selector = 1 385 | ij_stylus_blank_lines_between_blocks = 1 386 | ij_stylus_brace_placement = 0 387 | ij_stylus_enforce_quotes_on_format = false 388 | ij_stylus_hex_color_long_format = false 389 | ij_stylus_hex_color_lower_case = false 390 | ij_stylus_hex_color_short_format = false 391 | ij_stylus_hex_color_upper_case = false 392 | ij_stylus_keep_blank_lines_in_code = 2 393 | ij_stylus_keep_indents_on_empty_lines = false 394 | ij_stylus_keep_single_line_blocks = false 395 | ij_stylus_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow 396 | ij_stylus_space_after_colon = true 397 | ij_stylus_space_before_opening_brace = true 398 | ij_stylus_use_double_quotes = true 399 | ij_stylus_value_alignment = 0 400 | 401 | [.editorconfig] 402 | ij_editorconfig_align_group_field_declarations = false 403 | ij_editorconfig_space_after_colon = false 404 | ij_editorconfig_space_after_comma = true 405 | ij_editorconfig_space_before_colon = false 406 | ij_editorconfig_space_before_comma = false 407 | ij_editorconfig_spaces_around_assignment_operators = true 408 | 409 | [{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.pom,*.rng,*.tld,*.wadl,*.wsdd,*.wsdl,*.xjb,*.xml,*.xsd,*.xsl,*.xslt,*.xul,phpunit.xml.dist}] 410 | ij_xml_align_attributes = true 411 | ij_xml_align_text = false 412 | ij_xml_attribute_wrap = normal 413 | ij_xml_block_comment_add_space = false 414 | ij_xml_block_comment_at_first_column = true 415 | ij_xml_keep_blank_lines = 2 416 | ij_xml_keep_indents_on_empty_lines = false 417 | ij_xml_keep_line_breaks = true 418 | ij_xml_keep_line_breaks_in_text = true 419 | ij_xml_keep_whitespaces = false 420 | ij_xml_keep_whitespaces_around_cdata = preserve 421 | ij_xml_keep_whitespaces_inside_cdata = false 422 | ij_xml_line_comment_at_first_column = true 423 | ij_xml_space_after_tag_name = false 424 | ij_xml_space_around_equals_in_attribute = false 425 | ij_xml_space_inside_empty_tag = false 426 | ij_xml_text_wrap = normal 427 | 428 | [{*.ats,*.cts,*.mts,*.ts}] 429 | ij_continuation_indent_size = 4 430 | ij_typescript_align_imports = false 431 | ij_typescript_align_multiline_array_initializer_expression = false 432 | ij_typescript_align_multiline_binary_operation = false 433 | ij_typescript_align_multiline_chained_methods = false 434 | ij_typescript_align_multiline_extends_list = false 435 | ij_typescript_align_multiline_for = true 436 | ij_typescript_align_multiline_parameters = true 437 | ij_typescript_align_multiline_parameters_in_calls = false 438 | ij_typescript_align_multiline_ternary_operation = false 439 | ij_typescript_align_object_properties = 0 440 | ij_typescript_align_union_types = false 441 | ij_typescript_align_var_statements = 0 442 | ij_typescript_array_initializer_new_line_after_left_brace = false 443 | ij_typescript_array_initializer_right_brace_on_new_line = false 444 | ij_typescript_array_initializer_wrap = off 445 | ij_typescript_assignment_wrap = off 446 | ij_typescript_binary_operation_sign_on_next_line = false 447 | ij_typescript_binary_operation_wrap = off 448 | ij_typescript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** 449 | ij_typescript_blank_lines_after_imports = 1 450 | ij_typescript_blank_lines_around_class = 1 451 | ij_typescript_blank_lines_around_field = 0 452 | ij_typescript_blank_lines_around_field_in_interface = 0 453 | ij_typescript_blank_lines_around_function = 1 454 | ij_typescript_blank_lines_around_method = 1 455 | ij_typescript_blank_lines_around_method_in_interface = 1 456 | ij_typescript_block_brace_style = end_of_line 457 | ij_typescript_block_comment_add_space = false 458 | ij_typescript_block_comment_at_first_column = true 459 | ij_typescript_call_parameters_new_line_after_left_paren = false 460 | ij_typescript_call_parameters_right_paren_on_new_line = false 461 | ij_typescript_call_parameters_wrap = off 462 | ij_typescript_catch_on_new_line = false 463 | ij_typescript_chained_call_dot_on_new_line = true 464 | ij_typescript_class_brace_style = end_of_line 465 | ij_typescript_comma_on_new_line = false 466 | ij_typescript_do_while_brace_force = never 467 | ij_typescript_else_on_new_line = false 468 | ij_typescript_enforce_trailing_comma = keep 469 | ij_typescript_enum_constants_wrap = on_every_item 470 | ij_typescript_extends_keyword_wrap = off 471 | ij_typescript_extends_list_wrap = off 472 | ij_typescript_field_prefix = _ 473 | ij_typescript_file_name_style = relaxed 474 | ij_typescript_finally_on_new_line = false 475 | ij_typescript_for_brace_force = never 476 | ij_typescript_for_statement_new_line_after_left_paren = false 477 | ij_typescript_for_statement_right_paren_on_new_line = false 478 | ij_typescript_for_statement_wrap = off 479 | ij_typescript_force_quote_style = false 480 | ij_typescript_force_semicolon_style = false 481 | ij_typescript_function_expression_brace_style = end_of_line 482 | ij_typescript_if_brace_force = never 483 | ij_typescript_import_merge_members = global 484 | ij_typescript_import_prefer_absolute_path = global 485 | ij_typescript_import_sort_members = true 486 | ij_typescript_import_sort_module_name = false 487 | ij_typescript_import_use_node_resolution = true 488 | ij_typescript_imports_wrap = on_every_item 489 | ij_typescript_indent_case_from_switch = true 490 | ij_typescript_indent_chained_calls = true 491 | ij_typescript_indent_package_children = 0 492 | ij_typescript_jsdoc_include_types = false 493 | ij_typescript_jsx_attribute_value = braces 494 | ij_typescript_keep_blank_lines_in_code = 2 495 | ij_typescript_keep_first_column_comment = true 496 | ij_typescript_keep_indents_on_empty_lines = false 497 | ij_typescript_keep_line_breaks = true 498 | ij_typescript_keep_simple_blocks_in_one_line = false 499 | ij_typescript_keep_simple_methods_in_one_line = false 500 | ij_typescript_line_comment_add_space = true 501 | ij_typescript_line_comment_at_first_column = false 502 | ij_typescript_method_brace_style = end_of_line 503 | ij_typescript_method_call_chain_wrap = off 504 | ij_typescript_method_parameters_new_line_after_left_paren = false 505 | ij_typescript_method_parameters_right_paren_on_new_line = false 506 | ij_typescript_method_parameters_wrap = off 507 | ij_typescript_object_literal_wrap = on_every_item 508 | ij_typescript_parentheses_expression_new_line_after_left_paren = false 509 | ij_typescript_parentheses_expression_right_paren_on_new_line = false 510 | ij_typescript_place_assignment_sign_on_next_line = false 511 | ij_typescript_prefer_as_type_cast = false 512 | ij_typescript_prefer_explicit_types_function_expression_returns = false 513 | ij_typescript_prefer_explicit_types_function_returns = false 514 | ij_typescript_prefer_explicit_types_vars_fields = false 515 | ij_typescript_prefer_parameters_wrap = false 516 | ij_typescript_reformat_c_style_comments = false 517 | ij_typescript_space_after_colon = true 518 | ij_typescript_space_after_comma = true 519 | ij_typescript_space_after_dots_in_rest_parameter = false 520 | ij_typescript_space_after_generator_mult = true 521 | ij_typescript_space_after_property_colon = true 522 | ij_typescript_space_after_quest = true 523 | ij_typescript_space_after_type_colon = true 524 | ij_typescript_space_after_unary_not = false 525 | ij_typescript_space_before_async_arrow_lparen = true 526 | ij_typescript_space_before_catch_keyword = true 527 | ij_typescript_space_before_catch_left_brace = true 528 | ij_typescript_space_before_catch_parentheses = true 529 | ij_typescript_space_before_class_lbrace = true 530 | ij_typescript_space_before_class_left_brace = true 531 | ij_typescript_space_before_colon = true 532 | ij_typescript_space_before_comma = false 533 | ij_typescript_space_before_do_left_brace = true 534 | ij_typescript_space_before_else_keyword = true 535 | ij_typescript_space_before_else_left_brace = true 536 | ij_typescript_space_before_finally_keyword = true 537 | ij_typescript_space_before_finally_left_brace = true 538 | ij_typescript_space_before_for_left_brace = true 539 | ij_typescript_space_before_for_parentheses = true 540 | ij_typescript_space_before_for_semicolon = false 541 | ij_typescript_space_before_function_left_parenth = true 542 | ij_typescript_space_before_generator_mult = false 543 | ij_typescript_space_before_if_left_brace = true 544 | ij_typescript_space_before_if_parentheses = true 545 | ij_typescript_space_before_method_call_parentheses = false 546 | ij_typescript_space_before_method_left_brace = true 547 | ij_typescript_space_before_method_parentheses = false 548 | ij_typescript_space_before_property_colon = false 549 | ij_typescript_space_before_quest = true 550 | ij_typescript_space_before_switch_left_brace = true 551 | ij_typescript_space_before_switch_parentheses = true 552 | ij_typescript_space_before_try_left_brace = true 553 | ij_typescript_space_before_type_colon = false 554 | ij_typescript_space_before_unary_not = false 555 | ij_typescript_space_before_while_keyword = true 556 | ij_typescript_space_before_while_left_brace = true 557 | ij_typescript_space_before_while_parentheses = true 558 | ij_typescript_spaces_around_additive_operators = true 559 | ij_typescript_spaces_around_arrow_function_operator = true 560 | ij_typescript_spaces_around_assignment_operators = true 561 | ij_typescript_spaces_around_bitwise_operators = true 562 | ij_typescript_spaces_around_equality_operators = true 563 | ij_typescript_spaces_around_logical_operators = true 564 | ij_typescript_spaces_around_multiplicative_operators = true 565 | ij_typescript_spaces_around_relational_operators = true 566 | ij_typescript_spaces_around_shift_operators = true 567 | ij_typescript_spaces_around_unary_operator = false 568 | ij_typescript_spaces_within_array_initializer_brackets = false 569 | ij_typescript_spaces_within_brackets = false 570 | ij_typescript_spaces_within_catch_parentheses = false 571 | ij_typescript_spaces_within_for_parentheses = false 572 | ij_typescript_spaces_within_if_parentheses = false 573 | ij_typescript_spaces_within_imports = false 574 | ij_typescript_spaces_within_interpolation_expressions = false 575 | ij_typescript_spaces_within_method_call_parentheses = false 576 | ij_typescript_spaces_within_method_parentheses = false 577 | ij_typescript_spaces_within_object_literal_braces = false 578 | ij_typescript_spaces_within_object_type_braces = true 579 | ij_typescript_spaces_within_parentheses = false 580 | ij_typescript_spaces_within_switch_parentheses = false 581 | ij_typescript_spaces_within_type_assertion = false 582 | ij_typescript_spaces_within_union_types = true 583 | ij_typescript_spaces_within_while_parentheses = false 584 | ij_typescript_special_else_if_treatment = true 585 | ij_typescript_ternary_operation_signs_on_next_line = false 586 | ij_typescript_ternary_operation_wrap = off 587 | ij_typescript_union_types_wrap = on_every_item 588 | ij_typescript_use_chained_calls_group_indents = false 589 | ij_typescript_use_double_quotes = true 590 | ij_typescript_use_explicit_js_extension = auto 591 | ij_typescript_use_path_mapping = always 592 | ij_typescript_use_public_modifier = false 593 | ij_typescript_use_semicolon_after_statement = true 594 | ij_typescript_var_declaration_wrap = normal 595 | ij_typescript_while_brace_force = never 596 | ij_typescript_while_on_new_line = false 597 | ij_typescript_wrap_comments = false 598 | 599 | [{*.bash,*.sh,*.zsh}] 600 | indent_size = 2 601 | tab_width = 2 602 | ij_shell_binary_ops_start_line = false 603 | ij_shell_keep_column_alignment_padding = false 604 | ij_shell_minify_program = false 605 | ij_shell_redirect_followed_by_space = false 606 | ij_shell_switch_cases_indented = false 607 | ij_shell_use_unix_line_separator = true 608 | 609 | [{*.cjs,*.js}] 610 | ij_continuation_indent_size = 4 611 | ij_javascript_align_imports = false 612 | ij_javascript_align_multiline_array_initializer_expression = false 613 | ij_javascript_align_multiline_binary_operation = false 614 | ij_javascript_align_multiline_chained_methods = false 615 | ij_javascript_align_multiline_extends_list = false 616 | ij_javascript_align_multiline_for = true 617 | ij_javascript_align_multiline_parameters = true 618 | ij_javascript_align_multiline_parameters_in_calls = false 619 | ij_javascript_align_multiline_ternary_operation = false 620 | ij_javascript_align_object_properties = 0 621 | ij_javascript_align_union_types = false 622 | ij_javascript_align_var_statements = 0 623 | ij_javascript_array_initializer_new_line_after_left_brace = false 624 | ij_javascript_array_initializer_right_brace_on_new_line = false 625 | ij_javascript_array_initializer_wrap = off 626 | ij_javascript_assignment_wrap = off 627 | ij_javascript_binary_operation_sign_on_next_line = false 628 | ij_javascript_binary_operation_wrap = off 629 | ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** 630 | ij_javascript_blank_lines_after_imports = 1 631 | ij_javascript_blank_lines_around_class = 1 632 | ij_javascript_blank_lines_around_field = 0 633 | ij_javascript_blank_lines_around_function = 1 634 | ij_javascript_blank_lines_around_method = 1 635 | ij_javascript_block_brace_style = end_of_line 636 | ij_javascript_block_comment_add_space = false 637 | ij_javascript_block_comment_at_first_column = true 638 | ij_javascript_call_parameters_new_line_after_left_paren = false 639 | ij_javascript_call_parameters_right_paren_on_new_line = false 640 | ij_javascript_call_parameters_wrap = off 641 | ij_javascript_catch_on_new_line = false 642 | ij_javascript_chained_call_dot_on_new_line = true 643 | ij_javascript_class_brace_style = end_of_line 644 | ij_javascript_comma_on_new_line = false 645 | ij_javascript_do_while_brace_force = never 646 | ij_javascript_else_on_new_line = false 647 | ij_javascript_enforce_trailing_comma = keep 648 | ij_javascript_extends_keyword_wrap = off 649 | ij_javascript_extends_list_wrap = off 650 | ij_javascript_field_prefix = _ 651 | ij_javascript_file_name_style = relaxed 652 | ij_javascript_finally_on_new_line = false 653 | ij_javascript_for_brace_force = never 654 | ij_javascript_for_statement_new_line_after_left_paren = false 655 | ij_javascript_for_statement_right_paren_on_new_line = false 656 | ij_javascript_for_statement_wrap = off 657 | ij_javascript_force_quote_style = false 658 | ij_javascript_force_semicolon_style = false 659 | ij_javascript_function_expression_brace_style = end_of_line 660 | ij_javascript_if_brace_force = never 661 | ij_javascript_import_merge_members = global 662 | ij_javascript_import_prefer_absolute_path = global 663 | ij_javascript_import_sort_members = true 664 | ij_javascript_import_sort_module_name = false 665 | ij_javascript_import_use_node_resolution = true 666 | ij_javascript_imports_wrap = on_every_item 667 | ij_javascript_indent_case_from_switch = true 668 | ij_javascript_indent_chained_calls = true 669 | ij_javascript_indent_package_children = 0 670 | ij_javascript_jsx_attribute_value = braces 671 | ij_javascript_keep_blank_lines_in_code = 2 672 | ij_javascript_keep_first_column_comment = true 673 | ij_javascript_keep_indents_on_empty_lines = false 674 | ij_javascript_keep_line_breaks = true 675 | ij_javascript_keep_simple_blocks_in_one_line = false 676 | ij_javascript_keep_simple_methods_in_one_line = false 677 | ij_javascript_line_comment_add_space = true 678 | ij_javascript_line_comment_at_first_column = false 679 | ij_javascript_method_brace_style = end_of_line 680 | ij_javascript_method_call_chain_wrap = off 681 | ij_javascript_method_parameters_new_line_after_left_paren = false 682 | ij_javascript_method_parameters_right_paren_on_new_line = false 683 | ij_javascript_method_parameters_wrap = off 684 | ij_javascript_object_literal_wrap = on_every_item 685 | ij_javascript_parentheses_expression_new_line_after_left_paren = false 686 | ij_javascript_parentheses_expression_right_paren_on_new_line = false 687 | ij_javascript_place_assignment_sign_on_next_line = false 688 | ij_javascript_prefer_as_type_cast = false 689 | ij_javascript_prefer_explicit_types_function_expression_returns = false 690 | ij_javascript_prefer_explicit_types_function_returns = false 691 | ij_javascript_prefer_explicit_types_vars_fields = false 692 | ij_javascript_prefer_parameters_wrap = false 693 | ij_javascript_reformat_c_style_comments = false 694 | ij_javascript_space_after_colon = true 695 | ij_javascript_space_after_comma = true 696 | ij_javascript_space_after_dots_in_rest_parameter = false 697 | ij_javascript_space_after_generator_mult = true 698 | ij_javascript_space_after_property_colon = true 699 | ij_javascript_space_after_quest = true 700 | ij_javascript_space_after_type_colon = true 701 | ij_javascript_space_after_unary_not = false 702 | ij_javascript_space_before_async_arrow_lparen = true 703 | ij_javascript_space_before_catch_keyword = true 704 | ij_javascript_space_before_catch_left_brace = true 705 | ij_javascript_space_before_catch_parentheses = true 706 | ij_javascript_space_before_class_lbrace = true 707 | ij_javascript_space_before_class_left_brace = true 708 | ij_javascript_space_before_colon = true 709 | ij_javascript_space_before_comma = false 710 | ij_javascript_space_before_do_left_brace = true 711 | ij_javascript_space_before_else_keyword = true 712 | ij_javascript_space_before_else_left_brace = true 713 | ij_javascript_space_before_finally_keyword = true 714 | ij_javascript_space_before_finally_left_brace = true 715 | ij_javascript_space_before_for_left_brace = true 716 | ij_javascript_space_before_for_parentheses = true 717 | ij_javascript_space_before_for_semicolon = false 718 | ij_javascript_space_before_function_left_parenth = true 719 | ij_javascript_space_before_generator_mult = false 720 | ij_javascript_space_before_if_left_brace = true 721 | ij_javascript_space_before_if_parentheses = true 722 | ij_javascript_space_before_method_call_parentheses = false 723 | ij_javascript_space_before_method_left_brace = true 724 | ij_javascript_space_before_method_parentheses = false 725 | ij_javascript_space_before_property_colon = false 726 | ij_javascript_space_before_quest = true 727 | ij_javascript_space_before_switch_left_brace = true 728 | ij_javascript_space_before_switch_parentheses = true 729 | ij_javascript_space_before_try_left_brace = true 730 | ij_javascript_space_before_type_colon = false 731 | ij_javascript_space_before_unary_not = false 732 | ij_javascript_space_before_while_keyword = true 733 | ij_javascript_space_before_while_left_brace = true 734 | ij_javascript_space_before_while_parentheses = true 735 | ij_javascript_spaces_around_additive_operators = true 736 | ij_javascript_spaces_around_arrow_function_operator = true 737 | ij_javascript_spaces_around_assignment_operators = true 738 | ij_javascript_spaces_around_bitwise_operators = true 739 | ij_javascript_spaces_around_equality_operators = true 740 | ij_javascript_spaces_around_logical_operators = true 741 | ij_javascript_spaces_around_multiplicative_operators = true 742 | ij_javascript_spaces_around_relational_operators = true 743 | ij_javascript_spaces_around_shift_operators = true 744 | ij_javascript_spaces_around_unary_operator = false 745 | ij_javascript_spaces_within_array_initializer_brackets = false 746 | ij_javascript_spaces_within_brackets = false 747 | ij_javascript_spaces_within_catch_parentheses = false 748 | ij_javascript_spaces_within_for_parentheses = false 749 | ij_javascript_spaces_within_if_parentheses = false 750 | ij_javascript_spaces_within_imports = false 751 | ij_javascript_spaces_within_interpolation_expressions = false 752 | ij_javascript_spaces_within_method_call_parentheses = false 753 | ij_javascript_spaces_within_method_parentheses = false 754 | ij_javascript_spaces_within_object_literal_braces = false 755 | ij_javascript_spaces_within_object_type_braces = true 756 | ij_javascript_spaces_within_parentheses = false 757 | ij_javascript_spaces_within_switch_parentheses = false 758 | ij_javascript_spaces_within_type_assertion = false 759 | ij_javascript_spaces_within_union_types = true 760 | ij_javascript_spaces_within_while_parentheses = false 761 | ij_javascript_special_else_if_treatment = true 762 | ij_javascript_ternary_operation_signs_on_next_line = false 763 | ij_javascript_ternary_operation_wrap = off 764 | ij_javascript_union_types_wrap = on_every_item 765 | ij_javascript_use_chained_calls_group_indents = false 766 | ij_javascript_use_double_quotes = true 767 | ij_javascript_use_explicit_js_extension = auto 768 | ij_javascript_use_path_mapping = always 769 | ij_javascript_use_public_modifier = false 770 | ij_javascript_use_semicolon_after_statement = true 771 | ij_javascript_var_declaration_wrap = normal 772 | ij_javascript_while_brace_force = never 773 | ij_javascript_while_on_new_line = false 774 | ij_javascript_wrap_comments = false 775 | 776 | [{*.ctp,*.hphp,*.inc,*.module,*.php,*.php4,*.php5,*.phtml}] 777 | ij_continuation_indent_size = 4 778 | ij_php_align_assignments = false 779 | ij_php_align_class_constants = false 780 | ij_php_align_group_field_declarations = false 781 | ij_php_align_inline_comments = false 782 | ij_php_align_key_value_pairs = false 783 | ij_php_align_match_arm_bodies = false 784 | ij_php_align_multiline_array_initializer_expression = false 785 | ij_php_align_multiline_binary_operation = false 786 | ij_php_align_multiline_chained_methods = false 787 | ij_php_align_multiline_extends_list = false 788 | ij_php_align_multiline_for = true 789 | ij_php_align_multiline_parameters = true 790 | ij_php_align_multiline_parameters_in_calls = false 791 | ij_php_align_multiline_ternary_operation = false 792 | ij_php_align_named_arguments = false 793 | ij_php_align_phpdoc_comments = false 794 | ij_php_align_phpdoc_param_names = false 795 | ij_php_anonymous_brace_style = end_of_line 796 | ij_php_api_weight = 28 797 | ij_php_array_initializer_new_line_after_left_brace = false 798 | ij_php_array_initializer_right_brace_on_new_line = false 799 | ij_php_array_initializer_wrap = off 800 | ij_php_assignment_wrap = off 801 | ij_php_attributes_wrap = off 802 | ij_php_author_weight = 28 803 | ij_php_binary_operation_sign_on_next_line = false 804 | ij_php_binary_operation_wrap = off 805 | ij_php_blank_lines_after_class_header = 0 806 | ij_php_blank_lines_after_function = 1 807 | ij_php_blank_lines_after_imports = 1 808 | ij_php_blank_lines_after_opening_tag = 0 809 | ij_php_blank_lines_after_package = 0 810 | ij_php_blank_lines_around_class = 1 811 | ij_php_blank_lines_around_constants = 0 812 | ij_php_blank_lines_around_field = 0 813 | ij_php_blank_lines_around_method = 1 814 | ij_php_blank_lines_before_class_end = 0 815 | ij_php_blank_lines_before_imports = 1 816 | ij_php_blank_lines_before_method_body = 0 817 | ij_php_blank_lines_before_package = 1 818 | ij_php_blank_lines_before_return_statement = 0 819 | ij_php_blank_lines_between_imports = 0 820 | ij_php_block_brace_style = end_of_line 821 | ij_php_call_parameters_new_line_after_left_paren = true 822 | ij_php_call_parameters_right_paren_on_new_line = true 823 | ij_php_call_parameters_wrap = split_into_lines 824 | ij_php_catch_on_new_line = false 825 | ij_php_category_weight = 28 826 | ij_php_class_brace_style = next_line 827 | ij_php_comma_after_last_array_element = false 828 | ij_php_concat_spaces = true 829 | ij_php_copyright_weight = 28 830 | ij_php_deprecated_weight = 28 831 | ij_php_do_while_brace_force = never 832 | ij_php_else_if_style = as_is 833 | ij_php_else_on_new_line = false 834 | ij_php_example_weight = 28 835 | ij_php_extends_keyword_wrap = off 836 | ij_php_extends_list_wrap = off 837 | ij_php_fields_default_visibility = private 838 | ij_php_filesource_weight = 28 839 | ij_php_finally_on_new_line = false 840 | ij_php_for_brace_force = never 841 | ij_php_for_statement_new_line_after_left_paren = false 842 | ij_php_for_statement_right_paren_on_new_line = false 843 | ij_php_for_statement_wrap = off 844 | ij_php_force_empty_methods_in_one_line = false 845 | ij_php_force_short_declaration_array_style = false 846 | ij_php_getters_setters_naming_style = camel_case 847 | ij_php_getters_setters_order_style = getters_first 848 | ij_php_global_weight = 28 849 | ij_php_group_use_wrap = on_every_item 850 | ij_php_if_brace_force = never 851 | ij_php_if_lparen_on_next_line = false 852 | ij_php_if_rparen_on_next_line = false 853 | ij_php_ignore_weight = 28 854 | ij_php_import_sorting = alphabetic 855 | ij_php_indent_break_from_case = true 856 | ij_php_indent_case_from_switch = true 857 | ij_php_indent_code_in_php_tags = false 858 | ij_php_internal_weight = 28 859 | ij_php_keep_blank_lines_after_lbrace = 2 860 | ij_php_keep_blank_lines_before_right_brace = 2 861 | ij_php_keep_blank_lines_in_code = 2 862 | ij_php_keep_blank_lines_in_declarations = 2 863 | ij_php_keep_control_statement_in_one_line = true 864 | ij_php_keep_first_column_comment = true 865 | ij_php_keep_indents_on_empty_lines = false 866 | ij_php_keep_line_breaks = true 867 | ij_php_keep_rparen_and_lbrace_on_one_line = false 868 | ij_php_keep_simple_classes_in_one_line = false 869 | ij_php_keep_simple_methods_in_one_line = false 870 | ij_php_lambda_brace_style = end_of_line 871 | ij_php_license_weight = 28 872 | ij_php_line_comment_add_space = false 873 | ij_php_line_comment_at_first_column = true 874 | ij_php_link_weight = 28 875 | ij_php_lower_case_boolean_const = false 876 | ij_php_lower_case_keywords = true 877 | ij_php_lower_case_null_const = false 878 | ij_php_method_brace_style = next_line 879 | ij_php_method_call_chain_wrap = off 880 | ij_php_method_parameters_new_line_after_left_paren = true 881 | ij_php_method_parameters_right_paren_on_new_line = true 882 | ij_php_method_parameters_wrap = split_into_lines 883 | ij_php_method_weight = 28 884 | ij_php_modifier_list_wrap = false 885 | ij_php_multiline_chained_calls_semicolon_on_new_line = false 886 | ij_php_namespace_brace_style = 1 887 | ij_php_new_line_after_php_opening_tag = false 888 | ij_php_null_type_position = in_the_end 889 | ij_php_package_weight = 28 890 | ij_php_param_weight = 0 891 | ij_php_parameters_attributes_wrap = off 892 | ij_php_parentheses_expression_new_line_after_left_paren = false 893 | ij_php_parentheses_expression_right_paren_on_new_line = false 894 | ij_php_phpdoc_blank_line_before_tags = false 895 | ij_php_phpdoc_blank_lines_around_parameters = false 896 | ij_php_phpdoc_keep_blank_lines = true 897 | ij_php_phpdoc_param_spaces_between_name_and_description = 1 898 | ij_php_phpdoc_param_spaces_between_tag_and_type = 1 899 | ij_php_phpdoc_param_spaces_between_type_and_name = 1 900 | ij_php_phpdoc_use_fqcn = false 901 | ij_php_phpdoc_wrap_long_lines = false 902 | ij_php_place_assignment_sign_on_next_line = false 903 | ij_php_place_parens_for_constructor = 1 904 | ij_php_property_read_weight = 28 905 | ij_php_property_weight = 28 906 | ij_php_property_write_weight = 28 907 | ij_php_return_type_on_new_line = false 908 | ij_php_return_weight = 1 909 | ij_php_see_weight = 28 910 | ij_php_since_weight = 28 911 | ij_php_sort_phpdoc_elements = true 912 | ij_php_space_after_colon = true 913 | ij_php_space_after_colon_in_enum_backed_type = true 914 | ij_php_space_after_colon_in_named_argument = true 915 | ij_php_space_after_colon_in_return_type = true 916 | ij_php_space_after_comma = true 917 | ij_php_space_after_for_semicolon = true 918 | ij_php_space_after_quest = true 919 | ij_php_space_after_type_cast = false 920 | ij_php_space_after_unary_not = false 921 | ij_php_space_before_array_initializer_left_brace = false 922 | ij_php_space_before_catch_keyword = true 923 | ij_php_space_before_catch_left_brace = true 924 | ij_php_space_before_catch_parentheses = true 925 | ij_php_space_before_class_left_brace = true 926 | ij_php_space_before_closure_left_parenthesis = true 927 | ij_php_space_before_colon = true 928 | ij_php_space_before_colon_in_enum_backed_type = false 929 | ij_php_space_before_colon_in_named_argument = false 930 | ij_php_space_before_colon_in_return_type = true 931 | ij_php_space_before_comma = false 932 | ij_php_space_before_do_left_brace = true 933 | ij_php_space_before_else_keyword = true 934 | ij_php_space_before_else_left_brace = true 935 | ij_php_space_before_finally_keyword = true 936 | ij_php_space_before_finally_left_brace = true 937 | ij_php_space_before_for_left_brace = true 938 | ij_php_space_before_for_parentheses = true 939 | ij_php_space_before_for_semicolon = false 940 | ij_php_space_before_if_left_brace = true 941 | ij_php_space_before_if_parentheses = true 942 | ij_php_space_before_method_call_parentheses = false 943 | ij_php_space_before_method_left_brace = true 944 | ij_php_space_before_method_parentheses = false 945 | ij_php_space_before_quest = true 946 | ij_php_space_before_short_closure_left_parenthesis = false 947 | ij_php_space_before_switch_left_brace = true 948 | ij_php_space_before_switch_parentheses = true 949 | ij_php_space_before_try_left_brace = true 950 | ij_php_space_before_unary_not = false 951 | ij_php_space_before_while_keyword = true 952 | ij_php_space_before_while_left_brace = true 953 | ij_php_space_before_while_parentheses = true 954 | ij_php_space_between_ternary_quest_and_colon = false 955 | ij_php_spaces_around_additive_operators = true 956 | ij_php_spaces_around_arrow = false 957 | ij_php_spaces_around_assignment_in_declare = false 958 | ij_php_spaces_around_assignment_operators = true 959 | ij_php_spaces_around_bitwise_operators = true 960 | ij_php_spaces_around_equality_operators = true 961 | ij_php_spaces_around_logical_operators = true 962 | ij_php_spaces_around_multiplicative_operators = true 963 | ij_php_spaces_around_null_coalesce_operator = true 964 | ij_php_spaces_around_pipe_in_union_type = false 965 | ij_php_spaces_around_relational_operators = true 966 | ij_php_spaces_around_shift_operators = true 967 | ij_php_spaces_around_unary_operator = false 968 | ij_php_spaces_around_var_within_brackets = false 969 | ij_php_spaces_within_array_initializer_braces = false 970 | ij_php_spaces_within_brackets = false 971 | ij_php_spaces_within_catch_parentheses = false 972 | ij_php_spaces_within_for_parentheses = false 973 | ij_php_spaces_within_if_parentheses = false 974 | ij_php_spaces_within_method_call_parentheses = false 975 | ij_php_spaces_within_method_parentheses = false 976 | ij_php_spaces_within_parentheses = false 977 | ij_php_spaces_within_short_echo_tags = true 978 | ij_php_spaces_within_switch_parentheses = false 979 | ij_php_spaces_within_while_parentheses = false 980 | ij_php_special_else_if_treatment = false 981 | ij_php_subpackage_weight = 28 982 | ij_php_ternary_operation_signs_on_next_line = false 983 | ij_php_ternary_operation_wrap = off 984 | ij_php_throws_weight = 2 985 | ij_php_todo_weight = 28 986 | ij_php_unknown_tag_weight = 28 987 | ij_php_upper_case_boolean_const = false 988 | ij_php_upper_case_null_const = false 989 | ij_php_uses_weight = 28 990 | ij_php_var_weight = 28 991 | ij_php_variable_naming_style = mixed 992 | ij_php_version_weight = 28 993 | ij_php_while_brace_force = never 994 | ij_php_while_on_new_line = false 995 | 996 | [{*.ft,*.vm,*.vsl}] 997 | ij_vtl_keep_indents_on_empty_lines = false 998 | 999 | [{*.gant,*.groovy,*.gson,*.gy}] 1000 | ij_groovy_align_group_field_declarations = false 1001 | ij_groovy_align_multiline_array_initializer_expression = false 1002 | ij_groovy_align_multiline_assignment = false 1003 | ij_groovy_align_multiline_binary_operation = false 1004 | ij_groovy_align_multiline_chained_methods = false 1005 | ij_groovy_align_multiline_extends_list = false 1006 | ij_groovy_align_multiline_for = true 1007 | ij_groovy_align_multiline_list_or_map = true 1008 | ij_groovy_align_multiline_method_parentheses = false 1009 | ij_groovy_align_multiline_parameters = true 1010 | ij_groovy_align_multiline_parameters_in_calls = false 1011 | ij_groovy_align_multiline_resources = true 1012 | ij_groovy_align_multiline_ternary_operation = false 1013 | ij_groovy_align_multiline_throws_list = false 1014 | ij_groovy_align_named_args_in_map = true 1015 | ij_groovy_align_throws_keyword = false 1016 | ij_groovy_array_initializer_new_line_after_left_brace = false 1017 | ij_groovy_array_initializer_right_brace_on_new_line = false 1018 | ij_groovy_array_initializer_wrap = off 1019 | ij_groovy_assert_statement_wrap = off 1020 | ij_groovy_assignment_wrap = off 1021 | ij_groovy_binary_operation_wrap = off 1022 | ij_groovy_blank_lines_after_class_header = 0 1023 | ij_groovy_blank_lines_after_imports = 1 1024 | ij_groovy_blank_lines_after_package = 1 1025 | ij_groovy_blank_lines_around_class = 1 1026 | ij_groovy_blank_lines_around_field = 0 1027 | ij_groovy_blank_lines_around_field_in_interface = 0 1028 | ij_groovy_blank_lines_around_method = 1 1029 | ij_groovy_blank_lines_around_method_in_interface = 1 1030 | ij_groovy_blank_lines_before_imports = 1 1031 | ij_groovy_blank_lines_before_method_body = 0 1032 | ij_groovy_blank_lines_before_package = 0 1033 | ij_groovy_block_brace_style = end_of_line 1034 | ij_groovy_block_comment_add_space = false 1035 | ij_groovy_block_comment_at_first_column = true 1036 | ij_groovy_call_parameters_new_line_after_left_paren = false 1037 | ij_groovy_call_parameters_right_paren_on_new_line = false 1038 | ij_groovy_call_parameters_wrap = off 1039 | ij_groovy_catch_on_new_line = false 1040 | ij_groovy_class_annotation_wrap = split_into_lines 1041 | ij_groovy_class_brace_style = end_of_line 1042 | ij_groovy_class_count_to_use_import_on_demand = 5 1043 | ij_groovy_do_while_brace_force = never 1044 | ij_groovy_else_on_new_line = false 1045 | ij_groovy_enum_constants_wrap = off 1046 | ij_groovy_extends_keyword_wrap = off 1047 | ij_groovy_extends_list_wrap = off 1048 | ij_groovy_field_annotation_wrap = split_into_lines 1049 | ij_groovy_finally_on_new_line = false 1050 | ij_groovy_for_brace_force = never 1051 | ij_groovy_for_statement_new_line_after_left_paren = false 1052 | ij_groovy_for_statement_right_paren_on_new_line = false 1053 | ij_groovy_for_statement_wrap = off 1054 | ij_groovy_if_brace_force = never 1055 | ij_groovy_import_annotation_wrap = 2 1056 | ij_groovy_imports_layout = *,|,javax.**,java.**,|,$* 1057 | ij_groovy_indent_case_from_switch = true 1058 | ij_groovy_indent_label_blocks = true 1059 | ij_groovy_insert_inner_class_imports = false 1060 | ij_groovy_keep_blank_lines_before_right_brace = 2 1061 | ij_groovy_keep_blank_lines_in_code = 2 1062 | ij_groovy_keep_blank_lines_in_declarations = 2 1063 | ij_groovy_keep_control_statement_in_one_line = true 1064 | ij_groovy_keep_first_column_comment = true 1065 | ij_groovy_keep_indents_on_empty_lines = false 1066 | ij_groovy_keep_line_breaks = true 1067 | ij_groovy_keep_multiple_expressions_in_one_line = false 1068 | ij_groovy_keep_simple_blocks_in_one_line = false 1069 | ij_groovy_keep_simple_classes_in_one_line = true 1070 | ij_groovy_keep_simple_lambdas_in_one_line = true 1071 | ij_groovy_keep_simple_methods_in_one_line = true 1072 | ij_groovy_label_indent_absolute = false 1073 | ij_groovy_label_indent_size = 0 1074 | ij_groovy_lambda_brace_style = end_of_line 1075 | ij_groovy_layout_static_imports_separately = true 1076 | ij_groovy_line_comment_add_space = false 1077 | ij_groovy_line_comment_at_first_column = true 1078 | ij_groovy_method_annotation_wrap = split_into_lines 1079 | ij_groovy_method_brace_style = end_of_line 1080 | ij_groovy_method_call_chain_wrap = off 1081 | ij_groovy_method_parameters_new_line_after_left_paren = false 1082 | ij_groovy_method_parameters_right_paren_on_new_line = false 1083 | ij_groovy_method_parameters_wrap = off 1084 | ij_groovy_modifier_list_wrap = false 1085 | ij_groovy_names_count_to_use_import_on_demand = 3 1086 | ij_groovy_packages_to_use_import_on_demand = java.awt.*,javax.swing.* 1087 | ij_groovy_parameter_annotation_wrap = off 1088 | ij_groovy_parentheses_expression_new_line_after_left_paren = false 1089 | ij_groovy_parentheses_expression_right_paren_on_new_line = false 1090 | ij_groovy_prefer_parameters_wrap = false 1091 | ij_groovy_resource_list_new_line_after_left_paren = false 1092 | ij_groovy_resource_list_right_paren_on_new_line = false 1093 | ij_groovy_resource_list_wrap = off 1094 | ij_groovy_space_after_assert_separator = true 1095 | ij_groovy_space_after_colon = true 1096 | ij_groovy_space_after_comma = true 1097 | ij_groovy_space_after_comma_in_type_arguments = true 1098 | ij_groovy_space_after_for_semicolon = true 1099 | ij_groovy_space_after_quest = true 1100 | ij_groovy_space_after_type_cast = true 1101 | ij_groovy_space_before_annotation_parameter_list = false 1102 | ij_groovy_space_before_array_initializer_left_brace = false 1103 | ij_groovy_space_before_assert_separator = false 1104 | ij_groovy_space_before_catch_keyword = true 1105 | ij_groovy_space_before_catch_left_brace = true 1106 | ij_groovy_space_before_catch_parentheses = true 1107 | ij_groovy_space_before_class_left_brace = true 1108 | ij_groovy_space_before_closure_left_brace = true 1109 | ij_groovy_space_before_colon = true 1110 | ij_groovy_space_before_comma = false 1111 | ij_groovy_space_before_do_left_brace = true 1112 | ij_groovy_space_before_else_keyword = true 1113 | ij_groovy_space_before_else_left_brace = true 1114 | ij_groovy_space_before_finally_keyword = true 1115 | ij_groovy_space_before_finally_left_brace = true 1116 | ij_groovy_space_before_for_left_brace = true 1117 | ij_groovy_space_before_for_parentheses = true 1118 | ij_groovy_space_before_for_semicolon = false 1119 | ij_groovy_space_before_if_left_brace = true 1120 | ij_groovy_space_before_if_parentheses = true 1121 | ij_groovy_space_before_method_call_parentheses = false 1122 | ij_groovy_space_before_method_left_brace = true 1123 | ij_groovy_space_before_method_parentheses = false 1124 | ij_groovy_space_before_quest = true 1125 | ij_groovy_space_before_record_parentheses = false 1126 | ij_groovy_space_before_switch_left_brace = true 1127 | ij_groovy_space_before_switch_parentheses = true 1128 | ij_groovy_space_before_synchronized_left_brace = true 1129 | ij_groovy_space_before_synchronized_parentheses = true 1130 | ij_groovy_space_before_try_left_brace = true 1131 | ij_groovy_space_before_try_parentheses = true 1132 | ij_groovy_space_before_while_keyword = true 1133 | ij_groovy_space_before_while_left_brace = true 1134 | ij_groovy_space_before_while_parentheses = true 1135 | ij_groovy_space_in_named_argument = true 1136 | ij_groovy_space_in_named_argument_before_colon = false 1137 | ij_groovy_space_within_empty_array_initializer_braces = false 1138 | ij_groovy_space_within_empty_method_call_parentheses = false 1139 | ij_groovy_spaces_around_additive_operators = true 1140 | ij_groovy_spaces_around_assignment_operators = true 1141 | ij_groovy_spaces_around_bitwise_operators = true 1142 | ij_groovy_spaces_around_equality_operators = true 1143 | ij_groovy_spaces_around_lambda_arrow = true 1144 | ij_groovy_spaces_around_logical_operators = true 1145 | ij_groovy_spaces_around_multiplicative_operators = true 1146 | ij_groovy_spaces_around_regex_operators = true 1147 | ij_groovy_spaces_around_relational_operators = true 1148 | ij_groovy_spaces_around_shift_operators = true 1149 | ij_groovy_spaces_within_annotation_parentheses = false 1150 | ij_groovy_spaces_within_array_initializer_braces = false 1151 | ij_groovy_spaces_within_braces = true 1152 | ij_groovy_spaces_within_brackets = false 1153 | ij_groovy_spaces_within_cast_parentheses = false 1154 | ij_groovy_spaces_within_catch_parentheses = false 1155 | ij_groovy_spaces_within_for_parentheses = false 1156 | ij_groovy_spaces_within_gstring_injection_braces = false 1157 | ij_groovy_spaces_within_if_parentheses = false 1158 | ij_groovy_spaces_within_list_or_map = false 1159 | ij_groovy_spaces_within_method_call_parentheses = false 1160 | ij_groovy_spaces_within_method_parentheses = false 1161 | ij_groovy_spaces_within_parentheses = false 1162 | ij_groovy_spaces_within_switch_parentheses = false 1163 | ij_groovy_spaces_within_synchronized_parentheses = false 1164 | ij_groovy_spaces_within_try_parentheses = false 1165 | ij_groovy_spaces_within_tuple_expression = false 1166 | ij_groovy_spaces_within_while_parentheses = false 1167 | ij_groovy_special_else_if_treatment = true 1168 | ij_groovy_ternary_operation_wrap = off 1169 | ij_groovy_throws_keyword_wrap = off 1170 | ij_groovy_throws_list_wrap = off 1171 | ij_groovy_use_flying_geese_braces = false 1172 | ij_groovy_use_fq_class_names = false 1173 | ij_groovy_use_fq_class_names_in_javadoc = true 1174 | ij_groovy_use_relative_indents = false 1175 | ij_groovy_use_single_class_imports = true 1176 | ij_groovy_variable_annotation_wrap = off 1177 | ij_groovy_while_brace_force = never 1178 | ij_groovy_while_on_new_line = false 1179 | ij_groovy_wrap_chain_calls_after_dot = false 1180 | ij_groovy_wrap_long_lines = false 1181 | 1182 | [{*.go,*.go2}] 1183 | indent_style = tab 1184 | ij_continuation_indent_size = 4 1185 | ij_go_GROUP_CURRENT_PROJECT_IMPORTS = false 1186 | ij_go_add_leading_space_to_comments = false 1187 | ij_go_add_parentheses_for_single_import = false 1188 | ij_go_call_parameters_new_line_after_left_paren = true 1189 | ij_go_call_parameters_right_paren_on_new_line = true 1190 | ij_go_call_parameters_wrap = normal 1191 | ij_go_fill_paragraph_width = 80 1192 | ij_go_group_stdlib_imports = false 1193 | ij_go_import_sorting = gofmt 1194 | ij_go_keep_indents_on_empty_lines = false 1195 | ij_go_local_group_mode = project 1196 | ij_go_move_all_imports_in_one_declaration = false 1197 | ij_go_move_all_stdlib_imports_in_one_group = false 1198 | ij_go_remove_redundant_import_aliases = false 1199 | ij_go_run_go_fmt_on_reformat = true 1200 | ij_go_use_back_quotes_for_imports = false 1201 | ij_go_wrap_comp_lit = off 1202 | ij_go_wrap_comp_lit_newline_after_lbrace = true 1203 | ij_go_wrap_comp_lit_newline_before_rbrace = true 1204 | ij_go_wrap_func_params = split_into_lines 1205 | ij_go_wrap_func_params_newline_after_lparen = true 1206 | ij_go_wrap_func_params_newline_before_rparen = true 1207 | ij_go_wrap_func_result = split_into_lines 1208 | ij_go_wrap_func_result_newline_after_lparen = true 1209 | ij_go_wrap_func_result_newline_before_rparen = true 1210 | 1211 | [{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,composer.lock,jest.config}] 1212 | indent_size = 2 1213 | ij_json_keep_blank_lines_in_code = 0 1214 | ij_json_keep_indents_on_empty_lines = false 1215 | ij_json_keep_line_breaks = true 1216 | ij_json_space_after_colon = true 1217 | ij_json_space_after_comma = true 1218 | ij_json_space_before_colon = true 1219 | ij_json_space_before_comma = false 1220 | ij_json_spaces_within_braces = false 1221 | ij_json_spaces_within_brackets = false 1222 | ij_json_wrap_long_lines = false 1223 | 1224 | [{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}] 1225 | ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 1226 | ij_html_align_attributes = true 1227 | ij_html_align_text = false 1228 | ij_html_attribute_wrap = normal 1229 | ij_html_block_comment_add_space = false 1230 | ij_html_block_comment_at_first_column = true 1231 | ij_html_do_not_align_children_of_min_lines = 0 1232 | ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p 1233 | ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot 1234 | ij_html_enforce_quotes = false 1235 | ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var 1236 | ij_html_keep_blank_lines = 2 1237 | ij_html_keep_indents_on_empty_lines = false 1238 | ij_html_keep_line_breaks = true 1239 | ij_html_keep_line_breaks_in_text = true 1240 | ij_html_keep_whitespaces = false 1241 | ij_html_keep_whitespaces_inside = span,pre,textarea 1242 | ij_html_line_comment_at_first_column = true 1243 | ij_html_new_line_after_last_attribute = never 1244 | ij_html_new_line_before_first_attribute = never 1245 | ij_html_quote_style = double 1246 | ij_html_remove_new_line_before_tags = br 1247 | ij_html_space_after_tag_name = false 1248 | ij_html_space_around_equality_in_attribute = false 1249 | ij_html_space_inside_empty_tag = false 1250 | ij_html_text_wrap = normal 1251 | 1252 | [{*.jsf,*.jsp,*.jspf,*.tag,*.tagf,*.xjsp}] 1253 | ij_jsp_jsp_prefer_comma_separated_import_list = false 1254 | ij_jsp_keep_indents_on_empty_lines = false 1255 | 1256 | [{*.jspx,*.tagx}] 1257 | ij_jspx_keep_indents_on_empty_lines = false 1258 | 1259 | [{*.pb,*.textproto}] 1260 | indent_size = 2 1261 | tab_width = 2 1262 | ij_continuation_indent_size = 4 1263 | ij_prototext_keep_blank_lines_in_code = 2 1264 | ij_prototext_keep_indents_on_empty_lines = false 1265 | ij_prototext_keep_line_breaks = true 1266 | ij_prototext_space_after_colon = true 1267 | ij_prototext_space_after_comma = true 1268 | ij_prototext_space_before_colon = false 1269 | ij_prototext_space_before_comma = false 1270 | ij_prototext_spaces_within_braces = true 1271 | ij_prototext_spaces_within_brackets = false 1272 | 1273 | [{*.properties,spring.handlers,spring.schemas}] 1274 | ij_properties_align_group_field_declarations = false 1275 | ij_properties_keep_blank_lines = false 1276 | ij_properties_key_value_delimiter = equals 1277 | ij_properties_spaces_around_key_value_delimiter = false 1278 | 1279 | [{*.qute.html,*.qute.json,*.qute.txt,*.qute.yaml,*.qute.yml}] 1280 | ij_qute_keep_indents_on_empty_lines = false 1281 | 1282 | [{*.toml,Cargo.lock,Cargo.toml.orig,Gopkg.lock,Pipfile,poetry.lock}] 1283 | ij_toml_keep_indents_on_empty_lines = false 1284 | 1285 | [{*.yaml,*.yml}] 1286 | indent_size = 2 1287 | ij_yaml_align_values_properties = do_not_align 1288 | ij_yaml_autoinsert_sequence_marker = true 1289 | ij_yaml_block_mapping_on_new_line = false 1290 | ij_yaml_indent_sequence_value = true 1291 | ij_yaml_keep_indents_on_empty_lines = false 1292 | ij_yaml_keep_line_breaks = true 1293 | ij_yaml_sequence_on_new_line = false 1294 | ij_yaml_space_before_colon = false 1295 | ij_yaml_spaces_within_braces = true 1296 | ij_yaml_spaces_within_brackets = true 1297 | --------------------------------------------------------------------------------