Completed
Pull Request — master (#67)
by
unknown
02:12
created
src/utils/TypeUtils.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -7,75 +7,75 @@
 block discarded – undo
7 7
 
8 8
 class TypeUtils
9 9
 {
10
-    public static $phpTypes = [
11
-        'string',
12
-        'int',
13
-        'integer',
14
-        'bool',
15
-        'boolean',
16
-        'float',
17
-        'double',
18
-        'object',
19
-        'mixed',
20
-        'resource',
21
-        'iterable',
22
-        'array',
23
-        'callable',
24
-    ];
10
+	public static $phpTypes = [
11
+		'string',
12
+		'int',
13
+		'integer',
14
+		'bool',
15
+		'boolean',
16
+		'float',
17
+		'double',
18
+		'object',
19
+		'mixed',
20
+		'resource',
21
+		'iterable',
22
+		'array',
23
+		'callable',
24
+	];
25 25
 
26
-    public static function expressionToTypes(?string $typeExpression): array {
27
-        if (!$typeExpression) {
28
-            return [];
29
-        }
26
+	public static function expressionToTypes(?string $typeExpression): array {
27
+		if (!$typeExpression) {
28
+			return [];
29
+		}
30 30
 
31
-        return explode('|', $typeExpression);
32
-    }
31
+		return explode('|', $typeExpression);
32
+	}
33 33
 
34
-    public static function guessQualifiedName(AbstractPhpStruct $stuct, string $type): string {
35
-        if (in_array($type, self::$phpTypes, true)) {
36
-            return $type;
37
-        }
34
+	public static function guessQualifiedName(AbstractPhpStruct $stuct, string $type): string {
35
+		if (in_array($type, self::$phpTypes, true)) {
36
+			return $type;
37
+		}
38 38
 
39
-        $suffix = '';
40
-        if (strpos($type, '[]') !== false) {
41
-            $type = str_replace('[]', '', $type);
42
-            $suffix = '[]';
43
-        }
39
+		$suffix = '';
40
+		if (strpos($type, '[]') !== false) {
41
+			$type = str_replace('[]', '', $type);
42
+			$suffix = '[]';
43
+		}
44 44
 
45
-        $uses = $stuct->getUseStatements();
46
-        foreach ($uses as $use) {
47
-            $regexp = '/\\\\' . preg_quote($type, '/') . '$/';
48
-            if (preg_match($regexp, $use)) {
49
-                return $use . $suffix;
50
-            }
51
-        }
45
+		$uses = $stuct->getUseStatements();
46
+		foreach ($uses as $use) {
47
+			$regexp = '/\\\\' . preg_quote($type, '/') . '$/';
48
+			if (preg_match($regexp, $use)) {
49
+				return $use . $suffix;
50
+			}
51
+		}
52 52
 
53
-        $sameNamespace = $stuct->getNamespace() . '\\' . $type;
54
-        if (class_exists($sameNamespace)) {
55
-            return $sameNamespace . $suffix;
56
-        }
53
+		$sameNamespace = $stuct->getNamespace() . '\\' . $type;
54
+		if (class_exists($sameNamespace)) {
55
+			return $sameNamespace . $suffix;
56
+		}
57 57
 
58
-        return $type . $suffix;
59
-    }
58
+		return $type . $suffix;
59
+	}
60 60
 
61
-    public static function isGlobalQualifiedName(string $name): bool {
62
-        return $name[0] === '\\' && substr_count($name, '\\') === 1;
63
-    }
61
+	public static function isGlobalQualifiedName(string $name): bool {
62
+		return $name[0] === '\\' && substr_count($name, '\\') === 1;
63
+	}
64 64
 
65
-    public static function isNativeType(string $type): bool {
66
-        return in_array($type, self::$phpTypes, true);
67
-    }
65
+	public static function isNativeType(string $type): bool {
66
+		return in_array($type, self::$phpTypes, true);
67
+	}
68 68
 
69
-    public static function typesToExpression(iterable $types): ?string {
70
-        $typeExpr = '';
71
-        foreach ($types as $type) {
72
-            $typeExpr .= '|' . $type;
73
-        }
69
+	public static function typesToExpression(iterable $types): ?string {
70
+		$typeExpr = '';
71
+		foreach ($types as $type) {
72
+			$typeExpr .= '|' . $type;
73
+		}
74 74
 
75
-        if (!$typeExpr) {
76
-            return null;
77
-        }
75
+		if (!$typeExpr) {
76
+			return null;
77
+		}
78 78
 
79
-        return trim($typeExpr, '|');
80
-    }
79
+		return trim($typeExpr, '|');
80
+	}
81 81
 }
Please login to merge, or discard this patch.
src/model/PhpFunction.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,8 +93,8 @@
 block discarded – undo
93 93
 		$this->setQualifiedName($name);
94 94
 		$this->docblock = new Docblock();
95 95
 		$this->initParameters();
96
-        $this->initTypes();
97
-    }
96
+		$this->initTypes();
97
+	}
98 98
 
99 99
 	/**
100 100
 	 * @inheritDoc
Please login to merge, or discard this patch.
src/model/AbstractModel.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@
 block discarded – undo
33 33
 			$description = implode("\n", $description);
34 34
 		}
35 35
 		if ($description) {
36
-            $this->description = $description;
37
-        }
36
+			$this->description = $description;
37
+		}
38 38
 		return $this;
39 39
 	}
40 40
 
Please login to merge, or discard this patch.
src/model/PhpParameter.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function __construct($name = null) {
57 57
 		$this->setName($name);
58
-        $this->initTypes();
59
-    }
58
+		$this->initTypes();
59
+	}
60 60
 
61 61
 	/**
62 62
 	 * Sets whether this parameter is passed by reference
@@ -85,16 +85,16 @@  discard block
 block discarded – undo
85 85
 	 * @return ParamTag
86 86
 	 */
87 87
 	public function getDocblockTag(): ParamTag {
88
-        $type = '';
89
-        if ($this->getNullable()) {
90
-            $type = 'null';
91
-        }
92
-        if ($this->getTypes()) {
93
-            if ($type) {
94
-                $type .= '|';
95
-            }
96
-            $type .= TypeUtils::typesToExpression($this->getTypes());
97
-        }
88
+		$type = '';
89
+		if ($this->getNullable()) {
90
+			$type = 'null';
91
+		}
92
+		if ($this->getTypes()) {
93
+			if ($type) {
94
+				$type .= '|';
95
+			}
96
+			$type .= TypeUtils::typesToExpression($this->getTypes());
97
+		}
98 98
 		return ParamTag::create()
99 99
 			->setType($type)
100 100
 			->setVariable($this->getName())
Please login to merge, or discard this patch.
src/model/parts/PropertiesPart.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -53,12 +53,12 @@
 block discarded – undo
53 53
 		$property->setParent($this);
54 54
 		$types = $property->getTypes();
55 55
 
56
-        if ($types) {
57
-            foreach ($types as $type) {
58
-                $this->addUseStatement($type);
59
-                $property->addType($type);
60
-            }
61
-        }
56
+		if ($types) {
57
+			foreach ($types as $type) {
58
+				$this->addUseStatement($type);
59
+				$property->addType($type);
60
+			}
61
+		}
62 62
 
63 63
 		$this->properties->set($property->getName(), $property);
64 64
 
Please login to merge, or discard this patch.
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/model/PhpClass.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 		return $this->parentClassName;
72 72
 	}
73 73
 
74
-    public function getParentClass(): PhpClass {
75
-	    return class_exists($this->parentClassName) ?
76
-            self::fromName($this->parentClassName) : PhpClass::create($this->parentClassName);
77
-    }
74
+	public function getParentClass(): PhpClass {
75
+		return class_exists($this->parentClassName) ?
76
+			self::fromName($this->parentClassName) : PhpClass::create($this->parentClassName);
77
+	}
78 78
 
79 79
 	/**
80 80
 	 * Sets the parent class name
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function setParentClassName($parent) {
86 86
 		if ($parent instanceof PhpClass) {
87
-		    $this->addUseStatement($parent->getQualifiedName());
88
-		    $parent = $parent->getName();
89
-        }
90
-        $this->parentClassName = $parent;
87
+			$this->addUseStatement($parent->getQualifiedName());
88
+			$parent = $parent->getName();
89
+		}
90
+		$this->parentClassName = $parent;
91 91
 
92
-        return $this;
92
+		return $this;
93 93
 	}
94 94
 
95 95
 	public function generateDocblock(): void {
Please login to merge, or discard this patch.
src/parser/visitor/parts/MemberParserPart.php 1 patch
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.