Completed
Pull Request — master (#67)
by
unknown
02:21
created
src/model/parts/InterfacesPart.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -78,19 +78,19 @@
 block discarded – undo
78 78
 		return $this->interfaces;
79 79
 	}
80 80
 
81
-    /**
82
-     * @return iterable|PhpInterface[]
83
-     */
84
-    public function getPhpInterfaces(): iterable
85
-    {
86
-        $interfaces = [];
87
-        foreach ($this->interfaces as $interface) {
88
-            $interfaces[] = interface_exists($interface) ?
89
-                PhpInterface::fromName($interface) : PhpInterface::create($interface);
90
-        }
91
-
92
-        return $interfaces;
93
-    }
81
+	/**
82
+	 * @return iterable|PhpInterface[]
83
+	 */
84
+	public function getPhpInterfaces(): iterable
85
+	{
86
+		$interfaces = [];
87
+		foreach ($this->interfaces as $interface) {
88
+			$interfaces[] = interface_exists($interface) ?
89
+				PhpInterface::fromName($interface) : PhpInterface::create($interface);
90
+		}
91
+
92
+		return $interfaces;
93
+	}
94 94
 
95 95
 	/**
96 96
 	 * Checks whether interfaces exists
Please login to merge, or discard this patch.
src/model/parts/TraitsPart.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -75,18 +75,18 @@
 block discarded – undo
75 75
 		return $this->traits;
76 76
 	}
77 77
 
78
-    /**
79
-     * @return iterable|PhpTrait[]
80
-     */
81
-    public function getPhpTraits(): iterable {
82
-        $traits = [];
83
-        foreach ($this->traits as $trait) {
84
-            $traits[] = trait_exists($trait) ?
85
-                PhpTrait::fromName($trait) : PhpTrait::create($trait);
86
-        }
87
-
88
-        return $traits;
89
-    }
78
+	/**
79
+	 * @return iterable|PhpTrait[]
80
+	 */
81
+	public function getPhpTraits(): iterable {
82
+		$traits = [];
83
+		foreach ($this->traits as $trait) {
84
+			$traits[] = trait_exists($trait) ?
85
+				PhpTrait::fromName($trait) : PhpTrait::create($trait);
86
+		}
87
+
88
+		return $traits;
89
+	}
90 90
 
91 91
 	/**
92 92
 	 * Checks whether a trait exists
Please login to merge, or discard this patch.
src/parser/visitor/MethodParserVisitor.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
                 if ($type !== $qualifiedType) {
53 53
                     $type = $qualifiedType;
54 54
                 } else {
55
-                    $type = '\\'.$type;
55
+                    $type = '\\' . $type;
56 56
                 }
57 57
             }
58 58
 
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -45,47 +45,47 @@
 block discarded – undo
45 45
 			$p->setName($name);
46 46
 			$p->setPassedByReference($param->byRef);
47 47
 
48
-            $type = null;
49
-            if ($param->type instanceof NullableType) {
50
-                $param->type = $param->type->type;
51
-                $p->setNullable(true);
52
-            }
53
-            if ($param->type instanceof Identifier) {
54
-                $param->type = $param->type->name;
55
-            }
56
-            if (is_string($param->type)) {
48
+			$type = null;
49
+			if ($param->type instanceof NullableType) {
50
+				$param->type = $param->type->type;
51
+				$p->setNullable(true);
52
+			}
53
+			if ($param->type instanceof Identifier) {
54
+				$param->type = $param->type->name;
55
+			}
56
+			if (is_string($param->type)) {
57 57
 				$type = $param->type;
58 58
 			}
59 59
 			if ($param->type instanceof Name) {
60
-                $type = implode('\\', $param->type->parts);
61
-                $qualifiedType = TypeUtils::guessQualifiedName($this->struct, $type);
62
-                if ($type !== $qualifiedType) {
63
-                    $type = $qualifiedType;
64
-                } else {
65
-                    $type = '\\'.$type;
66
-                }
67
-            }
60
+				$type = implode('\\', $param->type->parts);
61
+				$qualifiedType = TypeUtils::guessQualifiedName($this->struct, $type);
62
+				if ($type !== $qualifiedType) {
63
+					$type = $qualifiedType;
64
+				} else {
65
+					$type = '\\'.$type;
66
+				}
67
+			}
68 68
 
69 69
 			if ($type) {
70
-                $p->addType($type);
71
-            }
70
+				$p->addType($type);
71
+			}
72 72
 
73 73
 			$this->parseValue($p, $param);
74 74
 
75 75
 			if ($p->getExpression() === 'null') {
76
-                $p->setNullable(true);
77
-            }
76
+				$p->setNullable(true);
77
+			}
78 78
 
79 79
 			$tag = $params->find($p, static function (ParamTag $t, $p) {
80 80
 				return $t->getVariable() === '$' . $p->getName();
81 81
 			});
82 82
 
83 83
 			if ($tag !== null) {
84
-			    $types = TypeUtils::expressionToTypes($tag->getType());
85
-			    foreach ($types as $type) {
86
-                    $p->addType(TypeUtils::guessQualifiedName($this->struct, $type));
87
-                }
88
-			    $p->setTypeDescription($tag->getDescription());
84
+				$types = TypeUtils::expressionToTypes($tag->getType());
85
+				foreach ($types as $type) {
86
+					$p->addType(TypeUtils::guessQualifiedName($this->struct, $type));
87
+				}
88
+				$p->setTypeDescription($tag->getDescription());
89 89
 			}
90 90
 
91 91
 			$m->addParameter($p);
Please login to merge, or discard this patch.
src/parser/visitor/parts/MemberParserPart.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@
 block discarded – undo
24 24
 			$vars = $docblock->getTags('var');
25 25
 			if ($vars->size() > 0) {
26 26
 				$var = $vars->get(0);
27
-                $types = TypeUtils::expressionToTypes($var->getType());
28
-                foreach($types as $type) {
29
-                    $type = TypeUtils::guessQualifiedName($this->struct, $type);
30
-                    $member->addType($type);
31
-                }
32
-                $member->setTypeDescription($var->getDescription());
27
+				$types = TypeUtils::expressionToTypes($var->getType());
28
+				foreach($types as $type) {
29
+					$type = TypeUtils::guessQualifiedName($this->struct, $type);
30
+					$member->addType($type);
31
+				}
32
+				$member->setTypeDescription($var->getDescription());
33 33
 			}
34 34
 		}
35 35
 	}
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 			if ($vars->size() > 0) {
26 26
 				$var = $vars->get(0);
27 27
                 $types = TypeUtils::expressionToTypes($var->getType());
28
-                foreach($types as $type) {
28
+                foreach ($types as $type) {
29 29
                     $type = TypeUtils::guessQualifiedName($this->struct, $type);
30 30
                     $member->addType($type);
31 31
                 }
Please login to merge, or discard this patch.
src/model/parts/TypePart.php 2 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
 	 * Sets the type
35 35
 	 *
36 36
 	 * @param null|Map|string[]|PhpTypeInterface[] $types
37
-	 * @param string $description
38 37
 	 *
39 38
 	 * @return $this
40 39
 	 */
@@ -54,7 +53,6 @@  discard block
 block discarded – undo
54 53
 	 * adds a type
55 54
 	 *
56 55
 	 * @param string|PhpTypeInterface $type
57
-	 * @param string $description
58 56
 	 * @return $this
59 57
 	 */
60 58
 	public function addType($type) {
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 	private $typeNullable = false;
28 28
 
29 29
 	public function initTypes(): void {
30
-	    $this->types = new Map();
31
-    }
30
+		$this->types = new Map();
31
+	}
32 32
 
33 33
 	/**
34 34
 	 * Sets the type
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @return $this
40 40
 	 */
41
-    public function setTypes(?iterable $types) {
42
-        if (!$types) {
43
-            return $this;
44
-        }
45
-        $this->types->clear();
46
-        foreach ($types as $type) {
47
-            $this->addType($type);
48
-        }
49
-
50
-        return $this;
41
+	public function setTypes(?iterable $types) {
42
+		if (!$types) {
43
+			return $this;
44
+		}
45
+		$this->types->clear();
46
+		foreach ($types as $type) {
47
+			$this->addType($type);
48
+		}
49
+
50
+		return $this;
51 51
 	}
52 52
 
53 53
 	/**
@@ -58,17 +58,17 @@  discard block
 block discarded – undo
58 58
 	 * @return $this
59 59
 	 */
60 60
 	public function addType($type) {
61
-	    if ($type === 'null') {
62
-	        $this->setNullable(true);
63
-	        return $this;
64
-        }
65
-	    if ($type) {
66
-	        if (!$type instanceof PhpTypeInterface) {
67
-	            $type = new PhpType($type);
68
-            }
69
-
70
-            $this->types->set($type->getQualifiedName(), $type);
71
-        }
61
+		if ($type === 'null') {
62
+			$this->setNullable(true);
63
+			return $this;
64
+		}
65
+		if ($type) {
66
+			if (!$type instanceof PhpTypeInterface) {
67
+				$type = new PhpType($type);
68
+			}
69
+
70
+			$this->types->set($type->getQualifiedName(), $type);
71
+		}
72 72
 
73 73
 		return $this;
74 74
 	}
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 * @return $this
81 81
 	 */
82 82
 	public function setTypeDescription(string $description) {
83
-	    if (!$description) {
84
-	        return $this;
85
-        }
83
+		if (!$description) {
84
+			return $this;
85
+		}
86 86
 		$this->typeDescription = $description;
87 87
 		return $this;
88 88
 	}
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	}
98 98
 
99 99
 	public function getTypeExpression(): ?string {
100
-	    return TypeUtils::typesToExpression($this->types);
101
-    }
100
+		return TypeUtils::typesToExpression($this->types);
101
+	}
102 102
 
103 103
 	/**
104 104
 	 * Returns the type description
Please login to merge, or discard this patch.
src/model/PhpType.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@
 block discarded – undo
6 6
 
7 7
 class PhpType implements PhpTypeInterface
8 8
 {
9
-    use QualifiedNamePart;
9
+	use QualifiedNamePart;
10 10
 
11
-    public function __construct($qualifiedName)
12
-    {
13
-        $this->setQualifiedName($qualifiedName);
14
-    }
11
+	public function __construct($qualifiedName)
12
+	{
13
+		$this->setQualifiedName($qualifiedName);
14
+	}
15 15
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,12 +4,10 @@
 block discarded – undo
4 4
 
5 5
 use gossi\codegen\model\parts\QualifiedNamePart;
6 6
 
7
-class PhpType implements PhpTypeInterface
8
-{
7
+class PhpType implements PhpTypeInterface {
9 8
     use QualifiedNamePart;
10 9
 
11
-    public function __construct($qualifiedName)
12
-    {
10
+    public function __construct($qualifiedName) {
13 11
         $this->setQualifiedName($qualifiedName);
14 12
     }
15 13
 }
Please login to merge, or discard this patch.
src/model/parts/ParametersPart.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function addSimpleDescParameter(string $name, $types = null, string $typeDescription = null, $defaultValue = null) {
105 105
 		$types = (array)$types;
106
-	    $parameter = new PhpParameter($name);
106
+		$parameter = new PhpParameter($name);
107 107
 		$parameter->setTypes($types);
108 108
 		$parameter->setTypeDescription($typeDescription);
109 109
 
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
 		$docblock = $this->getDocblock();
219 219
 		$tags = $docblock->getTags('param');
220 220
 		foreach ($this->parameters as $param) {
221
-		    if (!empty($noTypeHint[$param->getName()])) {
222
-                continue;
223
-            }
221
+			if (!empty($noTypeHint[$param->getName()])) {
222
+				continue;
223
+			}
224 224
 			$ptag = $param->getDocblockTag();
225 225
 
226 226
 			$tag = $tags->find($ptag, function (ParamTag $tag, ParamTag $ptag) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
 	 * @return $this
103 103
 	 */
104 104
 	public function addSimpleDescParameter(string $name, $types = null, string $typeDescription = null, $defaultValue = null) {
105
-		$types = (array)$types;
105
+		$types = (array) $types;
106 106
 	    $parameter = new PhpParameter($name);
107 107
 		$parameter->setTypes($types);
108 108
 		$parameter->setTypeDescription($typeDescription);
Please login to merge, or discard this patch.
src/model/parts/QualifiedNamePart.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,8 +78,8 @@
 block discarded – undo
78 78
 		return $this->name;
79 79
 	}
80 80
 
81
-    public function __toString(): string
82
-    {
83
-        return $this->getQualifiedName();
84
-    }
81
+	public function __toString(): string
82
+	{
83
+		return $this->getQualifiedName();
84
+	}
85 85
 }
Please login to merge, or discard this patch.
src/parser/visitor/parts/ValueParserPart.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@
 block discarded – undo
33 33
 			if ($this->isPrimitive($value)) {
34 34
 				$obj->setValue($this->getPrimitiveValue($value));
35 35
 			}
36
-            $expr = $this->getExpression($value);
37
-            if ($expr) {
38
-                $obj->setExpression($expr);
39
-            }
36
+			$expr = $this->getExpression($value);
37
+			if ($expr) {
38
+				$obj->setExpression($expr);
39
+			}
40 40
 		}
41 41
 	}
42 42
 
Please login to merge, or discard this patch.