Completed
Push — master ( 8e973a...811a95 )
by
unknown
03:40 queued 01:04
created
vendor/jetbrains/phpstorm-stubs/tests/Parsers/Visitors/ParentConnector.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -12,26 +12,26 @@
 block discarded – undo
12 12
  */
13 13
 class ParentConnector extends NodeVisitorAbstract
14 14
 {
15
-    /**
16
-     * @var Node[]
17
-     */
18
-    private array $stack;
15
+	/**
16
+	 * @var Node[]
17
+	 */
18
+	private array $stack;
19 19
 
20
-    public function beforeTraverse(array $nodes): void
21
-    {
22
-        $this->stack = [];
23
-    }
20
+	public function beforeTraverse(array $nodes): void
21
+	{
22
+		$this->stack = [];
23
+	}
24 24
 
25
-    public function enterNode(Node $node): void
26
-    {
27
-        if (!empty($this->stack)) {
28
-            $node->setAttribute('parent', $this->stack[count($this->stack) - 1]);
29
-        }
30
-        $this->stack[] = $node;
31
-    }
25
+	public function enterNode(Node $node): void
26
+	{
27
+		if (!empty($this->stack)) {
28
+			$node->setAttribute('parent', $this->stack[count($this->stack) - 1]);
29
+		}
30
+		$this->stack[] = $node;
31
+	}
32 32
 
33
-    public function leaveNode(Node $node): void
34
-    {
35
-        array_pop($this->stack);
36
-    }
33
+	public function leaveNode(Node $node): void
34
+	{
35
+		array_pop($this->stack);
36
+	}
37 37
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@
 block discarded – undo
10 10
 /**
11 11
  * The visitor is required to provide "parent" attribute to nodes
12 12
  */
13
-class ParentConnector extends NodeVisitorAbstract
14
-{
13
+class ParentConnector extends NodeVisitorAbstract {
15 14
     /**
16 15
      * @var Node[]
17 16
      */
Please login to merge, or discard this patch.
phpstorm-stubs/tests/Parsers/Visitors/MetaOverrideFunctionsParser.php 3 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -15,49 +15,49 @@
 block discarded – undo
15 15
 
16 16
 class MetaOverrideFunctionsParser extends NodeVisitorAbstract
17 17
 {
18
-    private const OVERRIDE_FUNCTION = 'override';
18
+	private const OVERRIDE_FUNCTION = 'override';
19 19
 
20
-    /**
21
-     * @var string[]
22
-     */
23
-    public array $overridenFunctions;
20
+	/**
21
+	 * @var string[]
22
+	 */
23
+	public array $overridenFunctions;
24 24
 
25
-    /**
26
-     * @throws UnexpectedValueException
27
-     * @throws LogicException
28
-     */
29
-    public function __construct()
30
-    {
31
-        $this->overridenFunctions = [];
32
-        StubParser::processStubs(
33
-            $this,
34
-            null,
35
-            fn (SplFileInfo $file): bool => $file->getFilename() === '.phpstorm.meta.php'
36
-        );
37
-    }
25
+	/**
26
+	 * @throws UnexpectedValueException
27
+	 * @throws LogicException
28
+	 */
29
+	public function __construct()
30
+	{
31
+		$this->overridenFunctions = [];
32
+		StubParser::processStubs(
33
+			$this,
34
+			null,
35
+			fn (SplFileInfo $file): bool => $file->getFilename() === '.phpstorm.meta.php'
36
+		);
37
+	}
38 38
 
39
-    /**
40
-     * @throws RuntimeException
41
-     */
42
-    public function enterNode(Node $node): void
43
-    {
44
-        if ($node instanceof Node\Expr\FuncCall && (string)$node->name === self::OVERRIDE_FUNCTION) {
45
-            $args = $node->args;
46
-            if (count($args) < 2) {
47
-                throw new RuntimeException('Expected at least 2 arguments for override call');
48
-            }
49
-            $this->overridenFunctions[] = self::getOverrideFunctionName($args[0]);
50
-        }
51
-    }
39
+	/**
40
+	 * @throws RuntimeException
41
+	 */
42
+	public function enterNode(Node $node): void
43
+	{
44
+		if ($node instanceof Node\Expr\FuncCall && (string)$node->name === self::OVERRIDE_FUNCTION) {
45
+			$args = $node->args;
46
+			if (count($args) < 2) {
47
+				throw new RuntimeException('Expected at least 2 arguments for override call');
48
+			}
49
+			$this->overridenFunctions[] = self::getOverrideFunctionName($args[0]);
50
+		}
51
+	}
52 52
 
53
-    private static function getOverrideFunctionName(Node\Arg $param): string
54
-    {
55
-        $paramValue = $param->value;
56
-        if ($paramValue instanceof Expr\StaticCall) {
57
-            $targetFunction = $paramValue->class . '::' . $paramValue->name;
58
-        } else {
59
-            $targetFunction = (string)$paramValue->name;
60
-        }
61
-        return $targetFunction;
62
-    }
53
+	private static function getOverrideFunctionName(Node\Arg $param): string
54
+	{
55
+		$paramValue = $param->value;
56
+		if ($paramValue instanceof Expr\StaticCall) {
57
+			$targetFunction = $paramValue->class . '::' . $paramValue->name;
58
+		} else {
59
+			$targetFunction = (string)$paramValue->name;
60
+		}
61
+		return $targetFunction;
62
+	}
63 63
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
     {
55 55
         $paramValue = $param->value;
56 56
         if ($paramValue instanceof Expr\StaticCall) {
57
-            $targetFunction = $paramValue->class . '::' . $paramValue->name;
57
+            $targetFunction = $paramValue->class.'::'.$paramValue->name;
58 58
         } else {
59 59
             $targetFunction = (string)$paramValue->name;
60 60
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
13 13
 use UnexpectedValueException;
14 14
 use function count;
15 15
 
16
-class MetaOverrideFunctionsParser extends NodeVisitorAbstract
17
-{
16
+class MetaOverrideFunctionsParser extends NodeVisitorAbstract {
18 17
     private const OVERRIDE_FUNCTION = 'override';
19 18
 
20 19
     /**
Please login to merge, or discard this patch.
vendor/jetbrains/phpstorm-stubs/tests/Parsers/Visitors/ASTVisitor.php 2 patches
Indentation   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -25,151 +25,151 @@
 block discarded – undo
25 25
 
26 26
 class ASTVisitor extends NodeVisitorAbstract
27 27
 {
28
-    public function __construct(
29
-        protected StubsContainer $stubs,
30
-        protected bool $isStubCore = false,
31
-        public ?string $sourceFilePath = null
32
-    ) {}
28
+	public function __construct(
29
+		protected StubsContainer $stubs,
30
+		protected bool $isStubCore = false,
31
+		public ?string $sourceFilePath = null
32
+	) {}
33 33
 
34
-    /**
35
-     * @throws Exception
36
-     */
37
-    public function enterNode(Node $node): void
38
-    {
39
-        if ($node instanceof Function_) {
40
-            $function = (new PHPFunction())->readObjectFromStubNode($node);
41
-            $function->sourceFilePath = $this->sourceFilePath;
42
-            if ($this->isStubCore) {
43
-                $function->stubBelongsToCore = true;
44
-            }
45
-            $this->stubs->addFunction($function);
46
-        } elseif ($node instanceof Const_) {
47
-            $constant = (new PHPConst())->readObjectFromStubNode($node);
48
-            $constant->sourceFilePath = $this->sourceFilePath;
49
-            if ($this->isStubCore) {
50
-                $constant->stubBelongsToCore = true;
51
-            }
52
-            if ($constant->parentName === null) {
53
-                $this->stubs->addConstant($constant);
54
-            } elseif ($this->stubs->getClass($constant->parentName, $this->sourceFilePath, false) !== null) {
55
-                $this->stubs->getClass($constant->parentName, $this->sourceFilePath, false)->addConstant($constant);
56
-            } elseif ($this->stubs->getInterface($constant->parentName, $this->sourceFilePath, false) !== null) {
57
-                $this->stubs->getInterface($constant->parentName, $this->sourceFilePath, false)->addConstant($constant);
58
-            }
59
-        } elseif ($node instanceof FuncCall) {
60
-            if ($node->name->parts[0] === 'define') {
61
-                $constant = (new PHPDefineConstant())->readObjectFromStubNode($node);
62
-                $constant->sourceFilePath = $this->sourceFilePath;
63
-                if ($this->isStubCore) {
64
-                    $constant->stubBelongsToCore = true;
65
-                }
66
-                $this->stubs->addConstant($constant);
67
-            }
68
-        } elseif ($node instanceof ClassMethod) {
69
-            $method = (new PHPMethod())->readObjectFromStubNode($node);
70
-            $method->sourceFilePath = $this->sourceFilePath;
71
-            if ($this->isStubCore) {
72
-                $method->stubBelongsToCore = true;
73
-            }
74
-            if ($this->stubs->getClass($method->parentName, $this->sourceFilePath, false) !== null) {
75
-                $this->stubs->getClass($method->parentName, $this->sourceFilePath, false)->addMethod($method);
76
-            } elseif ($this->stubs->getInterface($method->parentName, $this->sourceFilePath, false) !== null) {
77
-                $this->stubs->getInterface($method->parentName, $this->sourceFilePath, false)->addMethod($method);
78
-            }
79
-        } elseif ($node instanceof Interface_) {
80
-            $interface = (new PHPInterface())->readObjectFromStubNode($node);
81
-            $interface->sourceFilePath = $this->sourceFilePath;
82
-            if ($this->isStubCore) {
83
-                $interface->stubBelongsToCore = true;
84
-            }
85
-            $this->stubs->addInterface($interface);
86
-        } elseif ($node instanceof Class_) {
87
-            $class = (new PHPClass())->readObjectFromStubNode($node);
88
-            $class->sourceFilePath = $this->sourceFilePath;
89
-            if ($this->isStubCore) {
90
-                $class->stubBelongsToCore = true;
91
-            }
92
-            $this->stubs->addClass($class);
93
-        } elseif ($node instanceof Node\Stmt\Property) {
94
-            $property = (new PHPProperty())->readObjectFromStubNode($node);
95
-            $property->sourceFilePath = $this->sourceFilePath;
96
-            if ($this->isStubCore) {
97
-                $property->stubBelongsToCore = true;
98
-            }
34
+	/**
35
+	 * @throws Exception
36
+	 */
37
+	public function enterNode(Node $node): void
38
+	{
39
+		if ($node instanceof Function_) {
40
+			$function = (new PHPFunction())->readObjectFromStubNode($node);
41
+			$function->sourceFilePath = $this->sourceFilePath;
42
+			if ($this->isStubCore) {
43
+				$function->stubBelongsToCore = true;
44
+			}
45
+			$this->stubs->addFunction($function);
46
+		} elseif ($node instanceof Const_) {
47
+			$constant = (new PHPConst())->readObjectFromStubNode($node);
48
+			$constant->sourceFilePath = $this->sourceFilePath;
49
+			if ($this->isStubCore) {
50
+				$constant->stubBelongsToCore = true;
51
+			}
52
+			if ($constant->parentName === null) {
53
+				$this->stubs->addConstant($constant);
54
+			} elseif ($this->stubs->getClass($constant->parentName, $this->sourceFilePath, false) !== null) {
55
+				$this->stubs->getClass($constant->parentName, $this->sourceFilePath, false)->addConstant($constant);
56
+			} elseif ($this->stubs->getInterface($constant->parentName, $this->sourceFilePath, false) !== null) {
57
+				$this->stubs->getInterface($constant->parentName, $this->sourceFilePath, false)->addConstant($constant);
58
+			}
59
+		} elseif ($node instanceof FuncCall) {
60
+			if ($node->name->parts[0] === 'define') {
61
+				$constant = (new PHPDefineConstant())->readObjectFromStubNode($node);
62
+				$constant->sourceFilePath = $this->sourceFilePath;
63
+				if ($this->isStubCore) {
64
+					$constant->stubBelongsToCore = true;
65
+				}
66
+				$this->stubs->addConstant($constant);
67
+			}
68
+		} elseif ($node instanceof ClassMethod) {
69
+			$method = (new PHPMethod())->readObjectFromStubNode($node);
70
+			$method->sourceFilePath = $this->sourceFilePath;
71
+			if ($this->isStubCore) {
72
+				$method->stubBelongsToCore = true;
73
+			}
74
+			if ($this->stubs->getClass($method->parentName, $this->sourceFilePath, false) !== null) {
75
+				$this->stubs->getClass($method->parentName, $this->sourceFilePath, false)->addMethod($method);
76
+			} elseif ($this->stubs->getInterface($method->parentName, $this->sourceFilePath, false) !== null) {
77
+				$this->stubs->getInterface($method->parentName, $this->sourceFilePath, false)->addMethod($method);
78
+			}
79
+		} elseif ($node instanceof Interface_) {
80
+			$interface = (new PHPInterface())->readObjectFromStubNode($node);
81
+			$interface->sourceFilePath = $this->sourceFilePath;
82
+			if ($this->isStubCore) {
83
+				$interface->stubBelongsToCore = true;
84
+			}
85
+			$this->stubs->addInterface($interface);
86
+		} elseif ($node instanceof Class_) {
87
+			$class = (new PHPClass())->readObjectFromStubNode($node);
88
+			$class->sourceFilePath = $this->sourceFilePath;
89
+			if ($this->isStubCore) {
90
+				$class->stubBelongsToCore = true;
91
+			}
92
+			$this->stubs->addClass($class);
93
+		} elseif ($node instanceof Node\Stmt\Property) {
94
+			$property = (new PHPProperty())->readObjectFromStubNode($node);
95
+			$property->sourceFilePath = $this->sourceFilePath;
96
+			if ($this->isStubCore) {
97
+				$property->stubBelongsToCore = true;
98
+			}
99 99
 
100
-            if ($this->stubs->getClass($property->parentName, $this->sourceFilePath, false) !== null) {
101
-                $this->stubs->getClass($property->parentName, $this->sourceFilePath, false)->addProperty($property);
102
-            }
103
-        }
104
-    }
100
+			if ($this->stubs->getClass($property->parentName, $this->sourceFilePath, false) !== null) {
101
+				$this->stubs->getClass($property->parentName, $this->sourceFilePath, false)->addProperty($property);
102
+			}
103
+		}
104
+	}
105 105
 
106
-    /**
107
-     * @throws RuntimeException
108
-     */
109
-    public function combineParentInterfaces(PHPInterface $interface): array
110
-    {
111
-        $parents = [];
112
-        if (empty($interface->parentInterfaces)) {
113
-            return $parents;
114
-        }
115
-        /** @var string $parentInterface */
116
-        foreach ($interface->parentInterfaces as $parentInterface) {
117
-            $parents[] = $parentInterface;
118
-            if ($this->stubs->getInterface(
119
-                $parentInterface,
120
-                $interface->stubBelongsToCore ? null : $interface->sourceFilePath,
121
-                false
122
-            ) !== null) {
123
-                foreach ($this->combineParentInterfaces(
124
-                    $this->stubs->getInterface(
125
-                        $parentInterface,
126
-                        $interface->stubBelongsToCore ? null : $interface->sourceFilePath,
127
-                        false
128
-                    )
129
-                ) as $value) {
130
-                    $parents[] = $value;
131
-                }
132
-            }
133
-        }
134
-        return $parents;
135
-    }
106
+	/**
107
+	 * @throws RuntimeException
108
+	 */
109
+	public function combineParentInterfaces(PHPInterface $interface): array
110
+	{
111
+		$parents = [];
112
+		if (empty($interface->parentInterfaces)) {
113
+			return $parents;
114
+		}
115
+		/** @var string $parentInterface */
116
+		foreach ($interface->parentInterfaces as $parentInterface) {
117
+			$parents[] = $parentInterface;
118
+			if ($this->stubs->getInterface(
119
+				$parentInterface,
120
+				$interface->stubBelongsToCore ? null : $interface->sourceFilePath,
121
+				false
122
+			) !== null) {
123
+				foreach ($this->combineParentInterfaces(
124
+					$this->stubs->getInterface(
125
+						$parentInterface,
126
+						$interface->stubBelongsToCore ? null : $interface->sourceFilePath,
127
+						false
128
+					)
129
+				) as $value) {
130
+					$parents[] = $value;
131
+				}
132
+			}
133
+		}
134
+		return $parents;
135
+	}
136 136
 
137
-    /**
138
-     * @throws RuntimeException
139
-     */
140
-    public function combineImplementedInterfaces(PHPClass $class): array
141
-    {
142
-        $interfaces = [];
143
-        /** @var string $interface */
144
-        foreach ($class->interfaces as $interface) {
145
-            $interfaces[] = $interface;
146
-            if ($this->stubs->getInterface(
147
-                $interface,
148
-                $class->stubBelongsToCore ? null : $class->sourceFilePath,
149
-                false
150
-            ) !== null) {
151
-                $interfaces[] = $this->stubs->getInterface(
152
-                    $interface,
153
-                    $class->stubBelongsToCore ? null : $class->sourceFilePath,
154
-                    false
155
-                )->parentInterfaces;
156
-            }
157
-        }
158
-        if ($class->parentClass === null) {
159
-            return $interfaces;
160
-        }
161
-        if ($this->stubs->getClass(
162
-            $class->parentClass,
163
-            $class->stubBelongsToCore ? null : $class->sourceFilePath,
164
-            false
165
-        ) !== null) {
166
-            $inherited = $this->combineImplementedInterfaces($this->stubs->getClass(
167
-                $class->parentClass,
168
-                $class->stubBelongsToCore ? null : $class->sourceFilePath,
169
-                false
170
-            ));
171
-            $interfaces[] = CommonUtils::flattenArray($inherited, false);
172
-        }
173
-        return $interfaces;
174
-    }
137
+	/**
138
+	 * @throws RuntimeException
139
+	 */
140
+	public function combineImplementedInterfaces(PHPClass $class): array
141
+	{
142
+		$interfaces = [];
143
+		/** @var string $interface */
144
+		foreach ($class->interfaces as $interface) {
145
+			$interfaces[] = $interface;
146
+			if ($this->stubs->getInterface(
147
+				$interface,
148
+				$class->stubBelongsToCore ? null : $class->sourceFilePath,
149
+				false
150
+			) !== null) {
151
+				$interfaces[] = $this->stubs->getInterface(
152
+					$interface,
153
+					$class->stubBelongsToCore ? null : $class->sourceFilePath,
154
+					false
155
+				)->parentInterfaces;
156
+			}
157
+		}
158
+		if ($class->parentClass === null) {
159
+			return $interfaces;
160
+		}
161
+		if ($this->stubs->getClass(
162
+			$class->parentClass,
163
+			$class->stubBelongsToCore ? null : $class->sourceFilePath,
164
+			false
165
+		) !== null) {
166
+			$inherited = $this->combineImplementedInterfaces($this->stubs->getClass(
167
+				$class->parentClass,
168
+				$class->stubBelongsToCore ? null : $class->sourceFilePath,
169
+				false
170
+			));
171
+			$interfaces[] = CommonUtils::flattenArray($inherited, false);
172
+		}
173
+		return $interfaces;
174
+	}
175 175
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@
 block discarded – undo
23 23
 use StubTests\Model\PHPProperty;
24 24
 use StubTests\Model\StubsContainer;
25 25
 
26
-class ASTVisitor extends NodeVisitorAbstract
27
-{
26
+class ASTVisitor extends NodeVisitorAbstract {
28 27
     public function __construct(
29 28
         protected StubsContainer $stubs,
30 29
         protected bool $isStubCore = false,
Please login to merge, or discard this patch.
vendor/jetbrains/phpstorm-stubs/tests/Parsers/StubsParserErrorHandler.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@
 block discarded – undo
8 8
 
9 9
 class StubsParserErrorHandler implements ErrorHandler
10 10
 {
11
-    public function handleError(Error $error): void
12
-    {
13
-        $error->setRawMessage($error->getRawMessage() . "\n" . $error->getFile());
14
-    }
11
+	public function handleError(Error $error): void
12
+	{
13
+		$error->setRawMessage($error->getRawMessage() . "\n" . $error->getFile());
14
+	}
15 15
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,6 +10,6 @@
 block discarded – undo
10 10
 {
11 11
     public function handleError(Error $error): void
12 12
     {
13
-        $error->setRawMessage($error->getRawMessage() . "\n" . $error->getFile());
13
+        $error->setRawMessage($error->getRawMessage()."\n".$error->getFile());
14 14
     }
15 15
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@
 block discarded – undo
6 6
 use PhpParser\Error;
7 7
 use PhpParser\ErrorHandler;
8 8
 
9
-class StubsParserErrorHandler implements ErrorHandler
10
-{
9
+class StubsParserErrorHandler implements ErrorHandler {
11 10
     public function handleError(Error $error): void
12 11
     {
13 12
         $error->setRawMessage($error->getRawMessage() . "\n" . $error->getFile());
Please login to merge, or discard this patch.
jetbrains/phpstorm-stubs/tests/Parsers/ExpectedFunctionArgumentsInfo.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -8,54 +8,54 @@
 block discarded – undo
8 8
 
9 9
 class ExpectedFunctionArgumentsInfo
10 10
 {
11
-    /**
12
-     * ExpectedFunctionArgumentsInfo constructor.
13
-     * @param Expr|null $functionReference
14
-     * @param Expr[] $expectedArguments
15
-     * @param int $index
16
-     */
17
-    public function __construct(private ?Expr $functionReference, private array $expectedArguments, private int $index) {}
18
-
19
-    public function getFunctionReference(): ?Expr
20
-    {
21
-        return $this->functionReference;
22
-    }
23
-
24
-    public function setFunctionReference(Expr $functionReference): void
25
-    {
26
-        $this->functionReference = $functionReference;
27
-    }
28
-
29
-    /**
30
-     * @return Expr[]
31
-     */
32
-    public function getExpectedArguments(): array
33
-    {
34
-        return $this->expectedArguments;
35
-    }
36
-
37
-    /**
38
-     * @param Expr[] $expectedArguments
39
-     */
40
-    public function setExpectedArguments(array $expectedArguments): void
41
-    {
42
-        $this->expectedArguments = $expectedArguments;
43
-    }
44
-
45
-    public function getIndex(): int
46
-    {
47
-        return $this->index;
48
-    }
49
-
50
-    #[Pure]
51
-    public function __toString(): string
52
-    {
53
-        if ($this->functionReference === null) {
54
-            return '';
55
-        }
56
-        if (property_exists($this->functionReference, 'name')) {
57
-            return (string)$this->functionReference->name;
58
-        }
59
-        return implode(',', $this->functionReference->getAttributes());
60
-    }
11
+	/**
12
+	 * ExpectedFunctionArgumentsInfo constructor.
13
+	 * @param Expr|null $functionReference
14
+	 * @param Expr[] $expectedArguments
15
+	 * @param int $index
16
+	 */
17
+	public function __construct(private ?Expr $functionReference, private array $expectedArguments, private int $index) {}
18
+
19
+	public function getFunctionReference(): ?Expr
20
+	{
21
+		return $this->functionReference;
22
+	}
23
+
24
+	public function setFunctionReference(Expr $functionReference): void
25
+	{
26
+		$this->functionReference = $functionReference;
27
+	}
28
+
29
+	/**
30
+	 * @return Expr[]
31
+	 */
32
+	public function getExpectedArguments(): array
33
+	{
34
+		return $this->expectedArguments;
35
+	}
36
+
37
+	/**
38
+	 * @param Expr[] $expectedArguments
39
+	 */
40
+	public function setExpectedArguments(array $expectedArguments): void
41
+	{
42
+		$this->expectedArguments = $expectedArguments;
43
+	}
44
+
45
+	public function getIndex(): int
46
+	{
47
+		return $this->index;
48
+	}
49
+
50
+	#[Pure]
51
+	public function __toString(): string
52
+	{
53
+		if ($this->functionReference === null) {
54
+			return '';
55
+		}
56
+		if (property_exists($this->functionReference, 'name')) {
57
+			return (string)$this->functionReference->name;
58
+		}
59
+		return implode(',', $this->functionReference->getAttributes());
60
+	}
61 61
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@
 block discarded – undo
6 6
 use JetBrains\PhpStorm\Pure;
7 7
 use PhpParser\Node\Expr;
8 8
 
9
-class ExpectedFunctionArgumentsInfo
10
-{
9
+class ExpectedFunctionArgumentsInfo {
11 10
     /**
12 11
      * ExpectedFunctionArgumentsInfo constructor.
13 12
      * @param Expr|null $functionReference
Please login to merge, or discard this patch.
vendor/jetbrains/phpstorm-stubs/tests/Parsers/DocFactoryProvider.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@
 block discarded – undo
8 8
 
9 9
 class DocFactoryProvider
10 10
 {
11
-    private static ?DocBlockFactory $docFactory = null;
11
+	private static ?DocBlockFactory $docFactory = null;
12 12
 
13
-    public static function getDocFactory(): DocBlockFactory
14
-    {
15
-        if (self::$docFactory === null) {
16
-            self::$docFactory = DocBlockFactory::createInstance(['removed' => RemovedTag::class]);
17
-        }
18
-        return self::$docFactory;
19
-    }
13
+	public static function getDocFactory(): DocBlockFactory
14
+	{
15
+		if (self::$docFactory === null) {
16
+			self::$docFactory = DocBlockFactory::createInstance(['removed' => RemovedTag::class]);
17
+		}
18
+		return self::$docFactory;
19
+	}
20 20
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@
 block discarded – undo
6 6
 use phpDocumentor\Reflection\DocBlockFactory;
7 7
 use StubTests\Model\Tags\RemovedTag;
8 8
 
9
-class DocFactoryProvider
10
-{
9
+class DocFactoryProvider {
11 10
     private static ?DocBlockFactory $docFactory = null;
12 11
 
13 12
     public static function getDocFactory(): DocBlockFactory
Please login to merge, or discard this patch.
vendor/jetbrains/phpstorm-stubs/tests/Parsers/PHPReflectionParser.php 3 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -14,49 +14,49 @@
 block discarded – undo
14 14
 
15 15
 class PHPReflectionParser
16 16
 {
17
-    public static function getStubs(): StubsContainer
18
-    {
19
-        if (file_exists(__DIR__ . '/../../ReflectionData.json')) {
20
-            $stubs = unserialize(file_get_contents(__DIR__ . '/../../ReflectionData.json'));
21
-        } else {
22
-            $stubs = new StubsContainer();
23
-
24
-            $jsonData = json_decode(file_get_contents(__DIR__ . '/../TestData/mutedProblems.json'));
25
-            $const_groups = get_defined_constants(true);
26
-            unset($const_groups['user']);
27
-            $const_groups = CommonUtils::flattenArray($const_groups, true);
28
-            foreach ($const_groups as $name => $value) {
29
-                $constant = (new PHPDefineConstant())->readObjectFromReflection([$name, $value]);
30
-                $constant->readMutedProblems($jsonData->constants);
31
-                $stubs->addConstant($constant);
32
-            }
33
-
34
-            foreach (get_defined_functions()['internal'] as $function) {
35
-                $reflectionFunction = new ReflectionFunction($function);
36
-                $phpFunction = (new PHPFunction())->readObjectFromReflection($reflectionFunction);
37
-                $phpFunction->readMutedProblems($jsonData->functions);
38
-                $stubs->addFunction($phpFunction);
39
-            }
40
-
41
-            foreach (get_declared_classes() as $clazz) {
42
-                $reflectionClass = new ReflectionClass($clazz);
43
-                if ($reflectionClass->isInternal()) {
44
-                    $class = (new PHPClass())->readObjectFromReflection($reflectionClass);
45
-                    $class->readMutedProblems($jsonData->classes);
46
-                    $stubs->addClass($class);
47
-                }
48
-            }
49
-
50
-            foreach (get_declared_interfaces() as $interface) {
51
-                $reflectionInterface = new ReflectionClass($interface);
52
-                if ($reflectionInterface->isInternal()) {
53
-                    $phpInterface = (new PHPInterface())->readObjectFromReflection($reflectionInterface);
54
-                    $phpInterface->readMutedProblems($jsonData->interfaces);
55
-                    $stubs->addInterface($phpInterface);
56
-                }
57
-            }
58
-        }
59
-
60
-        return $stubs;
61
-    }
17
+	public static function getStubs(): StubsContainer
18
+	{
19
+		if (file_exists(__DIR__ . '/../../ReflectionData.json')) {
20
+			$stubs = unserialize(file_get_contents(__DIR__ . '/../../ReflectionData.json'));
21
+		} else {
22
+			$stubs = new StubsContainer();
23
+
24
+			$jsonData = json_decode(file_get_contents(__DIR__ . '/../TestData/mutedProblems.json'));
25
+			$const_groups = get_defined_constants(true);
26
+			unset($const_groups['user']);
27
+			$const_groups = CommonUtils::flattenArray($const_groups, true);
28
+			foreach ($const_groups as $name => $value) {
29
+				$constant = (new PHPDefineConstant())->readObjectFromReflection([$name, $value]);
30
+				$constant->readMutedProblems($jsonData->constants);
31
+				$stubs->addConstant($constant);
32
+			}
33
+
34
+			foreach (get_defined_functions()['internal'] as $function) {
35
+				$reflectionFunction = new ReflectionFunction($function);
36
+				$phpFunction = (new PHPFunction())->readObjectFromReflection($reflectionFunction);
37
+				$phpFunction->readMutedProblems($jsonData->functions);
38
+				$stubs->addFunction($phpFunction);
39
+			}
40
+
41
+			foreach (get_declared_classes() as $clazz) {
42
+				$reflectionClass = new ReflectionClass($clazz);
43
+				if ($reflectionClass->isInternal()) {
44
+					$class = (new PHPClass())->readObjectFromReflection($reflectionClass);
45
+					$class->readMutedProblems($jsonData->classes);
46
+					$stubs->addClass($class);
47
+				}
48
+			}
49
+
50
+			foreach (get_declared_interfaces() as $interface) {
51
+				$reflectionInterface = new ReflectionClass($interface);
52
+				if ($reflectionInterface->isInternal()) {
53
+					$phpInterface = (new PHPInterface())->readObjectFromReflection($reflectionInterface);
54
+					$phpInterface->readMutedProblems($jsonData->interfaces);
55
+					$stubs->addInterface($phpInterface);
56
+				}
57
+			}
58
+		}
59
+
60
+		return $stubs;
61
+	}
62 62
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,12 +16,12 @@
 block discarded – undo
16 16
 {
17 17
     public static function getStubs(): StubsContainer
18 18
     {
19
-        if (file_exists(__DIR__ . '/../../ReflectionData.json')) {
20
-            $stubs = unserialize(file_get_contents(__DIR__ . '/../../ReflectionData.json'));
19
+        if (file_exists(__DIR__.'/../../ReflectionData.json')) {
20
+            $stubs = unserialize(file_get_contents(__DIR__.'/../../ReflectionData.json'));
21 21
         } else {
22 22
             $stubs = new StubsContainer();
23 23
 
24
-            $jsonData = json_decode(file_get_contents(__DIR__ . '/../TestData/mutedProblems.json'));
24
+            $jsonData = json_decode(file_get_contents(__DIR__.'/../TestData/mutedProblems.json'));
25 25
             $const_groups = get_defined_constants(true);
26 26
             unset($const_groups['user']);
27 27
             $const_groups = CommonUtils::flattenArray($const_groups, true);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@
 block discarded – undo
12 12
 use StubTests\Model\PHPInterface;
13 13
 use StubTests\Model\StubsContainer;
14 14
 
15
-class PHPReflectionParser
16
-{
15
+class PHPReflectionParser {
17 16
     public static function getStubs(): StubsContainer
18 17
     {
19 18
         if (file_exists(__DIR__ . '/../../ReflectionData.json')) {
Please login to merge, or discard this patch.
jetbrains/phpstorm-stubs/tests/Parsers/MetaExpectedArgumentsCollector.php 3 patches
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -18,105 +18,105 @@
 block discarded – undo
18 18
 
19 19
 class MetaExpectedArgumentsCollector extends NodeVisitorAbstract
20 20
 {
21
-    private const EXPECTED_ARGUMENTS = 'expectedArguments';
22
-    private const EXPECTED_RETURN_VALUES = 'expectedReturnValues';
23
-    private const REGISTER_ARGUMENTS_SET_NAME = 'registerArgumentsSet';
24
-    /**
25
-     * @var ExpectedFunctionArgumentsInfo[]
26
-     */
27
-    private array $expectedArgumentsInfos = [];
28
-    /**
29
-     * @var string[]
30
-     */
31
-    private array $registeredArgumentsSet = [];
21
+	private const EXPECTED_ARGUMENTS = 'expectedArguments';
22
+	private const EXPECTED_RETURN_VALUES = 'expectedReturnValues';
23
+	private const REGISTER_ARGUMENTS_SET_NAME = 'registerArgumentsSet';
24
+	/**
25
+	 * @var ExpectedFunctionArgumentsInfo[]
26
+	 */
27
+	private array $expectedArgumentsInfos = [];
28
+	/**
29
+	 * @var string[]
30
+	 */
31
+	private array $registeredArgumentsSet = [];
32 32
 
33
-    /**
34
-     * @throws LogicException
35
-     * @throws UnexpectedValueException
36
-     */
37
-    public function __construct()
38
-    {
39
-        StubParser::processStubs(
40
-            $this,
41
-            null,
42
-            fn (SplFileInfo $file): bool => $file->getFilename() === '.phpstorm.meta.php'
43
-        );
44
-    }
33
+	/**
34
+	 * @throws LogicException
35
+	 * @throws UnexpectedValueException
36
+	 */
37
+	public function __construct()
38
+	{
39
+		StubParser::processStubs(
40
+			$this,
41
+			null,
42
+			fn (SplFileInfo $file): bool => $file->getFilename() === '.phpstorm.meta.php'
43
+		);
44
+	}
45 45
 
46
-    /**
47
-     * @throws RuntimeException
48
-     */
49
-    public function enterNode(Node $node): void
50
-    {
51
-        if ($node instanceof FuncCall) {
52
-            $name = (string)$node->name;
53
-            if ($name === self::EXPECTED_ARGUMENTS) {
54
-                $args = $node->args;
55
-                if (count($args) < 3) {
56
-                    throw new RuntimeException('Expected at least 3 arguments for expectedArguments call');
57
-                }
58
-                $this->expectedArgumentsInfos[] = self::getExpectedArgumentsInfo($args[0]->value, array_slice($args, 2), $args[1]->value->value);
59
-            } elseif ($name === self::REGISTER_ARGUMENTS_SET_NAME) {
60
-                $args = $node->args;
61
-                if (count($args) < 2) {
62
-                    throw new RuntimeException('Expected at least 2 arguments for registerArgumentsSet call');
63
-                }
64
-                $this->expectedArgumentsInfos[] = self::getExpectedArgumentsInfo(null, array_slice($args, 1));
65
-                $name = $args[0]->value->value;
66
-                $this->registeredArgumentsSet[] = $name;
67
-            } elseif ($name === self::EXPECTED_RETURN_VALUES) {
68
-                $args = $node->args;
69
-                if (count($args) < 2) {
70
-                    throw new RuntimeException('Expected at least 2 arguments for expectedReturnValues call');
71
-                }
72
-                $this->expectedArgumentsInfos[] = self::getExpectedArgumentsInfo($args[0]->value, array_slice($args, 1));
73
-            }
74
-        }
75
-    }
46
+	/**
47
+	 * @throws RuntimeException
48
+	 */
49
+	public function enterNode(Node $node): void
50
+	{
51
+		if ($node instanceof FuncCall) {
52
+			$name = (string)$node->name;
53
+			if ($name === self::EXPECTED_ARGUMENTS) {
54
+				$args = $node->args;
55
+				if (count($args) < 3) {
56
+					throw new RuntimeException('Expected at least 3 arguments for expectedArguments call');
57
+				}
58
+				$this->expectedArgumentsInfos[] = self::getExpectedArgumentsInfo($args[0]->value, array_slice($args, 2), $args[1]->value->value);
59
+			} elseif ($name === self::REGISTER_ARGUMENTS_SET_NAME) {
60
+				$args = $node->args;
61
+				if (count($args) < 2) {
62
+					throw new RuntimeException('Expected at least 2 arguments for registerArgumentsSet call');
63
+				}
64
+				$this->expectedArgumentsInfos[] = self::getExpectedArgumentsInfo(null, array_slice($args, 1));
65
+				$name = $args[0]->value->value;
66
+				$this->registeredArgumentsSet[] = $name;
67
+			} elseif ($name === self::EXPECTED_RETURN_VALUES) {
68
+				$args = $node->args;
69
+				if (count($args) < 2) {
70
+					throw new RuntimeException('Expected at least 2 arguments for expectedReturnValues call');
71
+				}
72
+				$this->expectedArgumentsInfos[] = self::getExpectedArgumentsInfo($args[0]->value, array_slice($args, 1));
73
+			}
74
+		}
75
+	}
76 76
 
77
-    /**
78
-     * @return ExpectedFunctionArgumentsInfo[]
79
-     */
80
-    public function getExpectedArgumentsInfos(): array
81
-    {
82
-        return $this->expectedArgumentsInfos;
83
-    }
77
+	/**
78
+	 * @return ExpectedFunctionArgumentsInfo[]
79
+	 */
80
+	public function getExpectedArgumentsInfos(): array
81
+	{
82
+		return $this->expectedArgumentsInfos;
83
+	}
84 84
 
85
-    /**
86
-     * @return string[]
87
-     */
88
-    public function getRegisteredArgumentsSet(): array
89
-    {
90
-        return $this->registeredArgumentsSet;
91
-    }
85
+	/**
86
+	 * @return string[]
87
+	 */
88
+	public function getRegisteredArgumentsSet(): array
89
+	{
90
+		return $this->registeredArgumentsSet;
91
+	}
92 92
 
93
-    /**
94
-     * @param Expr[] $expressions
95
-     * @return Expr[]
96
-     */
97
-    private static function unpackArguments(array $expressions): array
98
-    {
99
-        $result = [];
100
-        foreach ($expressions as $expr) {
101
-            if ($expr instanceof BitwiseOr) {
102
-                /** @noinspection SlowArrayOperationsInLoopInspection */
103
-                $result = array_merge($result, self::unpackArguments([$expr->left, $expr->right]));
104
-            } else {
105
-                $result[] = $expr;
106
-            }
107
-        }
108
-        return $result;
109
-    }
93
+	/**
94
+	 * @param Expr[] $expressions
95
+	 * @return Expr[]
96
+	 */
97
+	private static function unpackArguments(array $expressions): array
98
+	{
99
+		$result = [];
100
+		foreach ($expressions as $expr) {
101
+			if ($expr instanceof BitwiseOr) {
102
+				/** @noinspection SlowArrayOperationsInLoopInspection */
103
+				$result = array_merge($result, self::unpackArguments([$expr->left, $expr->right]));
104
+			} else {
105
+				$result[] = $expr;
106
+			}
107
+		}
108
+		return $result;
109
+	}
110 110
 
111
-    /**
112
-     * @param Expr|null $functionReference
113
-     * @param Arg[] $args
114
-     * @param int $index
115
-     * @return ExpectedFunctionArgumentsInfo
116
-     */
117
-    private static function getExpectedArgumentsInfo(?Expr $functionReference, array $args, int $index = -1): ExpectedFunctionArgumentsInfo
118
-    {
119
-        $expressions = array_map(fn (Arg $arg): Expr => $arg->value, $args);
120
-        return new ExpectedFunctionArgumentsInfo($functionReference, self::unpackArguments($expressions), $index);
121
-    }
111
+	/**
112
+	 * @param Expr|null $functionReference
113
+	 * @param Arg[] $args
114
+	 * @param int $index
115
+	 * @return ExpectedFunctionArgumentsInfo
116
+	 */
117
+	private static function getExpectedArgumentsInfo(?Expr $functionReference, array $args, int $index = -1): ExpectedFunctionArgumentsInfo
118
+	{
119
+		$expressions = array_map(fn (Arg $arg): Expr => $arg->value, $args);
120
+		return new ExpectedFunctionArgumentsInfo($functionReference, self::unpackArguments($expressions), $index);
121
+	}
122 122
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
      */
117 117
     private static function getExpectedArgumentsInfo(?Expr $functionReference, array $args, int $index = -1): ExpectedFunctionArgumentsInfo
118 118
     {
119
-        $expressions = array_map(fn (Arg $arg): Expr => $arg->value, $args);
119
+        $expressions = array_map(fn (Arg $arg) : Expr => $arg->value, $args);
120 120
         return new ExpectedFunctionArgumentsInfo($functionReference, self::unpackArguments($expressions), $index);
121 121
     }
122 122
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@
 block discarded – undo
16 16
 use function array_slice;
17 17
 use function count;
18 18
 
19
-class MetaExpectedArgumentsCollector extends NodeVisitorAbstract
20
-{
19
+class MetaExpectedArgumentsCollector extends NodeVisitorAbstract {
21 20
     private const EXPECTED_ARGUMENTS = 'expectedArguments';
22 21
     private const EXPECTED_RETURN_VALUES = 'expectedReturnValues';
23 22
     private const REGISTER_ARGUMENTS_SET_NAME = 'registerArgumentsSet';
Please login to merge, or discard this patch.
php-scoper/vendor/jetbrains/phpstorm-stubs/tests/Parsers/StubParser.php 3 patches
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -27,90 +27,90 @@
 block discarded – undo
27 27
 
28 28
 class StubParser
29 29
 {
30
-    private static ?StubsContainer $stubs = null;
30
+	private static ?StubsContainer $stubs = null;
31 31
 
32
-    /**
33
-     * @throws LogicException
34
-     * @throws RuntimeException
35
-     * @throws UnexpectedValueException
36
-     * @throws JsonException
37
-     */
38
-    public static function getPhpStormStubs(): StubsContainer
39
-    {
40
-        self::$stubs = new StubsContainer();
41
-        $visitor = new ASTVisitor(self::$stubs);
42
-        $coreStubVisitor = new CoreStubASTVisitor(self::$stubs);
43
-        self::processStubs(
44
-            $visitor,
45
-            $coreStubVisitor,
46
-            fn (SplFileInfo $file): bool => $file->getFilename() !== '.phpstorm.meta.php'
47
-        );
32
+	/**
33
+	 * @throws LogicException
34
+	 * @throws RuntimeException
35
+	 * @throws UnexpectedValueException
36
+	 * @throws JsonException
37
+	 */
38
+	public static function getPhpStormStubs(): StubsContainer
39
+	{
40
+		self::$stubs = new StubsContainer();
41
+		$visitor = new ASTVisitor(self::$stubs);
42
+		$coreStubVisitor = new CoreStubASTVisitor(self::$stubs);
43
+		self::processStubs(
44
+			$visitor,
45
+			$coreStubVisitor,
46
+			fn (SplFileInfo $file): bool => $file->getFilename() !== '.phpstorm.meta.php'
47
+		);
48 48
 
49
-        $jsonData = json_decode(file_get_contents(__DIR__ . '/../TestData/mutedProblems.json'), false, 512, JSON_THROW_ON_ERROR);
50
-        foreach (self::$stubs->getInterfaces() as $interface) {
51
-            $interface->readMutedProblems($jsonData->interfaces);
52
-            $interface->parentInterfaces = $visitor->combineParentInterfaces($interface);
53
-        }
54
-        foreach (self::$stubs->getClasses() as $class) {
55
-            $class->readMutedProblems($jsonData->classes);
56
-            $class->interfaces = CommonUtils::flattenArray($visitor->combineImplementedInterfaces($class), false);
57
-        }
58
-        foreach (self::$stubs->getFunctions() as $function) {
59
-            $function->readMutedProblems($jsonData->functions);
60
-        }
61
-        foreach (self::$stubs->getConstants() as $constant) {
62
-            $constant->readMutedProblems($jsonData->constants);
63
-        }
64
-        return self::$stubs;
65
-    }
49
+		$jsonData = json_decode(file_get_contents(__DIR__ . '/../TestData/mutedProblems.json'), false, 512, JSON_THROW_ON_ERROR);
50
+		foreach (self::$stubs->getInterfaces() as $interface) {
51
+			$interface->readMutedProblems($jsonData->interfaces);
52
+			$interface->parentInterfaces = $visitor->combineParentInterfaces($interface);
53
+		}
54
+		foreach (self::$stubs->getClasses() as $class) {
55
+			$class->readMutedProblems($jsonData->classes);
56
+			$class->interfaces = CommonUtils::flattenArray($visitor->combineImplementedInterfaces($class), false);
57
+		}
58
+		foreach (self::$stubs->getFunctions() as $function) {
59
+			$function->readMutedProblems($jsonData->functions);
60
+		}
61
+		foreach (self::$stubs->getConstants() as $constant) {
62
+			$constant->readMutedProblems($jsonData->constants);
63
+		}
64
+		return self::$stubs;
65
+	}
66 66
 
67
-    /**
68
-     * @throws LogicException
69
-     * @throws UnexpectedValueException
70
-     */
71
-    public static function processStubs(NodeVisitorAbstract $visitor, ?CoreStubASTVisitor $coreStubASTVisitor, callable $fileCondition): void
72
-    {
73
-        $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
74
-        $nameResolver = new NameResolver(null, ['preserveOriginalNames' => true]);
67
+	/**
68
+	 * @throws LogicException
69
+	 * @throws UnexpectedValueException
70
+	 */
71
+	public static function processStubs(NodeVisitorAbstract $visitor, ?CoreStubASTVisitor $coreStubASTVisitor, callable $fileCondition): void
72
+	{
73
+		$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
74
+		$nameResolver = new NameResolver(null, ['preserveOriginalNames' => true]);
75 75
 
76
-        $stubsIterator =
77
-            new RecursiveIteratorIterator(
78
-                new RecursiveDirectoryIterator(__DIR__ . '/../../', FilesystemIterator::SKIP_DOTS)
79
-            );
80
-        $coreStubDirectories = PhpCoreStubsProvider::getCoreStubsDirectories();
81
-        /** @var SplFileInfo $file */
82
-        foreach ($stubsIterator as $file) {
83
-            if (!$fileCondition($file) || basename(dirname($file->getRealPath())) === 'phpstorm-stubs' ||
84
-                strpos($file->getRealPath(), 'vendor') || strpos($file->getRealPath(), '.git') ||
85
-                strpos($file->getRealPath(), 'tests') || strpos($file->getRealPath(), '.idea')) {
86
-                continue;
87
-            }
88
-            $code = file_get_contents($file->getRealPath());
89
-            $traverser = new NodeTraverser();
90
-            $traverser->addVisitor(new ParentConnector());
91
-            $traverser->addVisitor($nameResolver);
92
-            if ($coreStubASTVisitor !== null && self::stubBelongsToCore($file, $coreStubDirectories)) {
93
-                $coreStubASTVisitor->sourceFilePath = $file->getPath();
94
-                $traverser->addVisitor($coreStubASTVisitor);
95
-            } else {
96
-                if ($visitor instanceof ASTVisitor) {
97
-                    $visitor->sourceFilePath = $file->getPath();
98
-                }
99
-                $traverser->addVisitor($visitor);
100
-            }
101
-            $traverser->traverse($parser->parse($code, new StubsParserErrorHandler()));
102
-        }
103
-    }
76
+		$stubsIterator =
77
+			new RecursiveIteratorIterator(
78
+				new RecursiveDirectoryIterator(__DIR__ . '/../../', FilesystemIterator::SKIP_DOTS)
79
+			);
80
+		$coreStubDirectories = PhpCoreStubsProvider::getCoreStubsDirectories();
81
+		/** @var SplFileInfo $file */
82
+		foreach ($stubsIterator as $file) {
83
+			if (!$fileCondition($file) || basename(dirname($file->getRealPath())) === 'phpstorm-stubs' ||
84
+				strpos($file->getRealPath(), 'vendor') || strpos($file->getRealPath(), '.git') ||
85
+				strpos($file->getRealPath(), 'tests') || strpos($file->getRealPath(), '.idea')) {
86
+				continue;
87
+			}
88
+			$code = file_get_contents($file->getRealPath());
89
+			$traverser = new NodeTraverser();
90
+			$traverser->addVisitor(new ParentConnector());
91
+			$traverser->addVisitor($nameResolver);
92
+			if ($coreStubASTVisitor !== null && self::stubBelongsToCore($file, $coreStubDirectories)) {
93
+				$coreStubASTVisitor->sourceFilePath = $file->getPath();
94
+				$traverser->addVisitor($coreStubASTVisitor);
95
+			} else {
96
+				if ($visitor instanceof ASTVisitor) {
97
+					$visitor->sourceFilePath = $file->getPath();
98
+				}
99
+				$traverser->addVisitor($visitor);
100
+			}
101
+			$traverser->traverse($parser->parse($code, new StubsParserErrorHandler()));
102
+		}
103
+	}
104 104
 
105
-    private static function stubBelongsToCore(SplFileInfo $file, array $coreStubDirectories): bool
106
-    {
107
-        $filePath = dirname($file->getRealPath());
108
-        while (stripos($filePath, 'phpstorm-stubs') !== strlen($filePath) - strlen('phpstorm-stubs')) {
109
-            if (in_array(basename($filePath), $coreStubDirectories, true)) {
110
-                return true;
111
-            }
112
-            $filePath = dirname($filePath);
113
-        }
114
-        return false;
115
-    }
105
+	private static function stubBelongsToCore(SplFileInfo $file, array $coreStubDirectories): bool
106
+	{
107
+		$filePath = dirname($file->getRealPath());
108
+		while (stripos($filePath, 'phpstorm-stubs') !== strlen($filePath) - strlen('phpstorm-stubs')) {
109
+			if (in_array(basename($filePath), $coreStubDirectories, true)) {
110
+				return true;
111
+			}
112
+			$filePath = dirname($filePath);
113
+		}
114
+		return false;
115
+	}
116 116
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             fn (SplFileInfo $file): bool => $file->getFilename() !== '.phpstorm.meta.php'
47 47
         );
48 48
 
49
-        $jsonData = json_decode(file_get_contents(__DIR__ . '/../TestData/mutedProblems.json'), false, 512, JSON_THROW_ON_ERROR);
49
+        $jsonData = json_decode(file_get_contents(__DIR__.'/../TestData/mutedProblems.json'), false, 512, JSON_THROW_ON_ERROR);
50 50
         foreach (self::$stubs->getInterfaces() as $interface) {
51 51
             $interface->readMutedProblems($jsonData->interfaces);
52 52
             $interface->parentInterfaces = $visitor->combineParentInterfaces($interface);
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
         $stubsIterator =
77 77
             new RecursiveIteratorIterator(
78
-                new RecursiveDirectoryIterator(__DIR__ . '/../../', FilesystemIterator::SKIP_DOTS)
78
+                new RecursiveDirectoryIterator(__DIR__.'/../../', FilesystemIterator::SKIP_DOTS)
79 79
             );
80 80
         $coreStubDirectories = PhpCoreStubsProvider::getCoreStubsDirectories();
81 81
         /** @var SplFileInfo $file */
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@
 block discarded – undo
25 25
 use function in_array;
26 26
 use function strlen;
27 27
 
28
-class StubParser
29
-{
28
+class StubParser {
30 29
     private static ?StubsContainer $stubs = null;
31 30
 
32 31
     /**
Please login to merge, or discard this patch.