Completed
Push — master ( 8e973a...811a95 )
by
unknown
03:40 queued 01:04
created
php-scoper/vendor/jetbrains/phpstorm-stubs/tests/BaseStubsTest.php 3 patches
Indentation   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -27,180 +27,180 @@
 block discarded – undo
27 27
 
28 28
 abstract class BaseStubsTest extends TestCase
29 29
 {
30
-    public static function setUpBeforeClass(): void
31
-    {
32
-        parent::setUpBeforeClass();
33
-        PhpStormStubsSingleton::getPhpStormStubs();
34
-        ReflectionStubsSingleton::getReflectionStubs();
35
-    }
30
+	public static function setUpBeforeClass(): void
31
+	{
32
+		parent::setUpBeforeClass();
33
+		PhpStormStubsSingleton::getPhpStormStubs();
34
+		ReflectionStubsSingleton::getReflectionStubs();
35
+	}
36 36
 
37
-    /**
38
-     * @throws Exception|RuntimeException
39
-     */
40
-    public static function getStringRepresentationOfDefaultParameterValue(mixed $defaultValue, PHPClass|PHPInterface $contextClass = null): float|bool|int|string|null
41
-    {
42
-        if ($defaultValue instanceof ConstFetch) {
43
-            $defaultValueName = (string)$defaultValue->name;
44
-            if ($defaultValueName !== 'false' && $defaultValueName !== 'true' && $defaultValueName !== 'null') {
45
-                $constant = PhpStormStubsSingleton::getPhpStormStubs()->getConstant($defaultValueName);
46
-                $value = $constant->value;
47
-            } else {
48
-                $value = $defaultValueName;
49
-            }
50
-        } elseif ($defaultValue instanceof String_ || $defaultValue instanceof LNumber || $defaultValue instanceof DNumber) {
51
-            $value = strval($defaultValue->value);
52
-        } elseif ($defaultValue instanceof BitwiseOr) {
53
-            if ($defaultValue->left instanceof ConstFetch && $defaultValue->right instanceof ConstFetch) {
54
-                $constants = array_filter(
55
-                    PhpStormStubsSingleton::getPhpStormStubs()->getConstants(),
56
-                    fn (PHPConst $const) => property_exists($defaultValue->left, 'name') &&
57
-                        $const->name === (string)$defaultValue->left->name
58
-                );
59
-                /** @var PHPConst $leftConstant */
60
-                $leftConstant = array_pop($constants);
61
-                $constants = array_filter(
62
-                    PhpStormStubsSingleton::getPhpStormStubs()->getConstants(),
63
-                    fn (PHPConst $const) => property_exists($defaultValue->right, 'name') &&
64
-                        $const->name === (string)$defaultValue->right->name
65
-                );
66
-                /** @var PHPConst $rightConstant */
67
-                $rightConstant = array_pop($constants);
68
-                $value = $leftConstant->value|$rightConstant->value;
69
-            }
70
-        } elseif ($defaultValue instanceof UnaryMinus && property_exists($defaultValue->expr, 'value')) {
71
-            $value = '-' . $defaultValue->expr->value;
72
-        } elseif ($defaultValue instanceof ClassConstFetch) {
73
-            $class = (string)$defaultValue->class;
74
-            if ($class === 'self' && $contextClass !== null) {
75
-                $class = $contextClass->name;
76
-            }
77
-            $parentClass = PhpStormStubsSingleton::getPhpStormStubs()->getClass($class) ??
78
-                PhpStormStubsSingleton::getPhpStormStubs()->getInterface($class);
79
-            if ($parentClass === null) {
80
-                throw new Exception("Class $class not found in stubs");
81
-            }
82
-            if ((string)$defaultValue->name === 'class') {
83
-                $value = (string)$defaultValue->class;
84
-            } else {
85
-                $constant = $parentClass->getConstant((string)$defaultValue->name);;
86
-                $value = $constant->value;
87
-            }
88
-        } else {
89
-            $value = strval($defaultValue);
90
-        }
91
-        return $value;
92
-    }
37
+	/**
38
+	 * @throws Exception|RuntimeException
39
+	 */
40
+	public static function getStringRepresentationOfDefaultParameterValue(mixed $defaultValue, PHPClass|PHPInterface $contextClass = null): float|bool|int|string|null
41
+	{
42
+		if ($defaultValue instanceof ConstFetch) {
43
+			$defaultValueName = (string)$defaultValue->name;
44
+			if ($defaultValueName !== 'false' && $defaultValueName !== 'true' && $defaultValueName !== 'null') {
45
+				$constant = PhpStormStubsSingleton::getPhpStormStubs()->getConstant($defaultValueName);
46
+				$value = $constant->value;
47
+			} else {
48
+				$value = $defaultValueName;
49
+			}
50
+		} elseif ($defaultValue instanceof String_ || $defaultValue instanceof LNumber || $defaultValue instanceof DNumber) {
51
+			$value = strval($defaultValue->value);
52
+		} elseif ($defaultValue instanceof BitwiseOr) {
53
+			if ($defaultValue->left instanceof ConstFetch && $defaultValue->right instanceof ConstFetch) {
54
+				$constants = array_filter(
55
+					PhpStormStubsSingleton::getPhpStormStubs()->getConstants(),
56
+					fn (PHPConst $const) => property_exists($defaultValue->left, 'name') &&
57
+						$const->name === (string)$defaultValue->left->name
58
+				);
59
+				/** @var PHPConst $leftConstant */
60
+				$leftConstant = array_pop($constants);
61
+				$constants = array_filter(
62
+					PhpStormStubsSingleton::getPhpStormStubs()->getConstants(),
63
+					fn (PHPConst $const) => property_exists($defaultValue->right, 'name') &&
64
+						$const->name === (string)$defaultValue->right->name
65
+				);
66
+				/** @var PHPConst $rightConstant */
67
+				$rightConstant = array_pop($constants);
68
+				$value = $leftConstant->value|$rightConstant->value;
69
+			}
70
+		} elseif ($defaultValue instanceof UnaryMinus && property_exists($defaultValue->expr, 'value')) {
71
+			$value = '-' . $defaultValue->expr->value;
72
+		} elseif ($defaultValue instanceof ClassConstFetch) {
73
+			$class = (string)$defaultValue->class;
74
+			if ($class === 'self' && $contextClass !== null) {
75
+				$class = $contextClass->name;
76
+			}
77
+			$parentClass = PhpStormStubsSingleton::getPhpStormStubs()->getClass($class) ??
78
+				PhpStormStubsSingleton::getPhpStormStubs()->getInterface($class);
79
+			if ($parentClass === null) {
80
+				throw new Exception("Class $class not found in stubs");
81
+			}
82
+			if ((string)$defaultValue->name === 'class') {
83
+				$value = (string)$defaultValue->class;
84
+			} else {
85
+				$constant = $parentClass->getConstant((string)$defaultValue->name);;
86
+				$value = $constant->value;
87
+			}
88
+		} else {
89
+			$value = strval($defaultValue);
90
+		}
91
+		return $value;
92
+	}
93 93
 
94
-    public static function getParameterRepresentation(PHPFunction $function): string
95
-    {
96
-        $result = '';
97
-        foreach ($function->parameters as $parameter) {
98
-            $types = array_unique($parameter->typesFromSignature + Model\CommonUtils::flattenArray($parameter->typesFromAttribute, false));
99
-            if (!empty($types)) {
100
-                $result .= implode('|', $types) . ' ';
101
-            }
102
-            if ($parameter->is_passed_by_ref) {
103
-                $result .= '&';
104
-            }
105
-            if ($parameter->is_vararg) {
106
-                $result .= '...';
107
-            }
108
-            $result .= '$' . $parameter->name . ', ';
109
-        }
110
-        return rtrim($result, ', ');
111
-    }
94
+	public static function getParameterRepresentation(PHPFunction $function): string
95
+	{
96
+		$result = '';
97
+		foreach ($function->parameters as $parameter) {
98
+			$types = array_unique($parameter->typesFromSignature + Model\CommonUtils::flattenArray($parameter->typesFromAttribute, false));
99
+			if (!empty($types)) {
100
+				$result .= implode('|', $types) . ' ';
101
+			}
102
+			if ($parameter->is_passed_by_ref) {
103
+				$result .= '&';
104
+			}
105
+			if ($parameter->is_vararg) {
106
+				$result .= '...';
107
+			}
108
+			$result .= '$' . $parameter->name . ', ';
109
+		}
110
+		return rtrim($result, ', ');
111
+	}
112 112
 
113
-    /**
114
-     * @param PHPFunction[] $filtered
115
-     * @return PHPFunction[]
116
-     * @throws RuntimeException
117
-     */
118
-    protected static function getDuplicatedFunctions(array $filtered): array
119
-    {
120
-        $duplicatedFunctions = array_filter($filtered, function (PHPFunction $value, int|string $key) {
121
-            $duplicatesOfFunction = self::getAllDuplicatesOfFunction($value->name);
122
-            $functionVersions[] = ParserUtils::getAvailableInVersions(
123
-                PhpStormStubsSingleton::getPhpStormStubs()->getFunction($value->name, shouldSuitCurrentPhpVersion: false)
124
-            );
125
-            array_push($functionVersions, ...array_values(array_map(
126
-                fn (PHPFunction $function) => ParserUtils::getAvailableInVersions($function),
127
-                $duplicatesOfFunction
128
-            )));
129
-            $hasDuplicates = false;
130
-            $current = array_pop($functionVersions);
131
-            $next = array_pop($functionVersions);
132
-            while ($next !== null) {
133
-                if (!empty(array_intersect($current, $next))) {
134
-                    $hasDuplicates = true;
135
-                }
136
-                $current = array_merge($current, $next);
137
-                $next = array_pop($functionVersions);
138
-            }
139
-            return $hasDuplicates;
140
-        }, ARRAY_FILTER_USE_BOTH);
141
-        return array_unique(array_map(fn (PHPFunction $function) => $function->name, $duplicatedFunctions));
142
-    }
113
+	/**
114
+	 * @param PHPFunction[] $filtered
115
+	 * @return PHPFunction[]
116
+	 * @throws RuntimeException
117
+	 */
118
+	protected static function getDuplicatedFunctions(array $filtered): array
119
+	{
120
+		$duplicatedFunctions = array_filter($filtered, function (PHPFunction $value, int|string $key) {
121
+			$duplicatesOfFunction = self::getAllDuplicatesOfFunction($value->name);
122
+			$functionVersions[] = ParserUtils::getAvailableInVersions(
123
+				PhpStormStubsSingleton::getPhpStormStubs()->getFunction($value->name, shouldSuitCurrentPhpVersion: false)
124
+			);
125
+			array_push($functionVersions, ...array_values(array_map(
126
+				fn (PHPFunction $function) => ParserUtils::getAvailableInVersions($function),
127
+				$duplicatesOfFunction
128
+			)));
129
+			$hasDuplicates = false;
130
+			$current = array_pop($functionVersions);
131
+			$next = array_pop($functionVersions);
132
+			while ($next !== null) {
133
+				if (!empty(array_intersect($current, $next))) {
134
+					$hasDuplicates = true;
135
+				}
136
+				$current = array_merge($current, $next);
137
+				$next = array_pop($functionVersions);
138
+			}
139
+			return $hasDuplicates;
140
+		}, ARRAY_FILTER_USE_BOTH);
141
+		return array_unique(array_map(fn (PHPFunction $function) => $function->name, $duplicatedFunctions));
142
+	}
143 143
 
144
-    /**
145
-     * @return PHPFunction[]
146
-     */
147
-    protected static function getAllDuplicatesOfFunction(?string $name): array
148
-    {
149
-        return array_filter(
150
-            PhpStormStubsSingleton::getPhpStormStubs()->getFunctions(),
151
-            fn ($duplicateValue, $duplicateKey) => $duplicateValue->name === $name && str_contains($duplicateKey, 'duplicated'),
152
-            ARRAY_FILTER_USE_BOTH
153
-        );
154
-    }
144
+	/**
145
+	 * @return PHPFunction[]
146
+	 */
147
+	protected static function getAllDuplicatesOfFunction(?string $name): array
148
+	{
149
+		return array_filter(
150
+			PhpStormStubsSingleton::getPhpStormStubs()->getFunctions(),
151
+			fn ($duplicateValue, $duplicateKey) => $duplicateValue->name === $name && str_contains($duplicateKey, 'duplicated'),
152
+			ARRAY_FILTER_USE_BOTH
153
+		);
154
+	}
155 155
 
156
-    /**
157
-     * @param string[] $reflectionTypes
158
-     * @param string[] $typesFromSignature
159
-     */
160
-    public static function isReflectionTypesMatchSignature(array $reflectionTypes, array $typesFromSignature): bool
161
-    {
162
-        return empty(array_merge(
163
-            array_diff($reflectionTypes, $typesFromSignature),
164
-            array_diff($typesFromSignature, $reflectionTypes)
165
-        ));
166
-    }
156
+	/**
157
+	 * @param string[] $reflectionTypes
158
+	 * @param string[] $typesFromSignature
159
+	 */
160
+	public static function isReflectionTypesMatchSignature(array $reflectionTypes, array $typesFromSignature): bool
161
+	{
162
+		return empty(array_merge(
163
+			array_diff($reflectionTypes, $typesFromSignature),
164
+			array_diff($typesFromSignature, $reflectionTypes)
165
+		));
166
+	}
167 167
 
168
-    /**
169
-     * @param string[] $reflectionTypes
170
-     * @param string[] $typesFromAttribute
171
-     */
172
-    public static function isReflectionTypesExistInAttributes(array $reflectionTypes, array $typesFromAttribute): bool
173
-    {
174
-        return empty(array_merge(
175
-            array_diff($reflectionTypes, array_filter($typesFromAttribute, fn ($type) => !empty($type))),
176
-            array_diff(array_filter($typesFromAttribute, fn ($type) => !empty($type)), $reflectionTypes)
177
-        ));
178
-    }
168
+	/**
169
+	 * @param string[] $reflectionTypes
170
+	 * @param string[] $typesFromAttribute
171
+	 */
172
+	public static function isReflectionTypesExistInAttributes(array $reflectionTypes, array $typesFromAttribute): bool
173
+	{
174
+		return empty(array_merge(
175
+			array_diff($reflectionTypes, array_filter($typesFromAttribute, fn ($type) => !empty($type))),
176
+			array_diff(array_filter($typesFromAttribute, fn ($type) => !empty($type)), $reflectionTypes)
177
+		));
178
+	}
179 179
 
180
-    /**
181
-     * @param string[][] $typesFromAttribute
182
-     */
183
-    public static function getStringRepresentationOfTypeHintsFromAttributes(array $typesFromAttribute): string
184
-    {
185
-        $resultString = '';
186
-        foreach ($typesFromAttribute as $types) {
187
-            $resultString .= '[' . implode('|', $types) . ']';
188
-        }
189
-        return $resultString;
190
-    }
180
+	/**
181
+	 * @param string[][] $typesFromAttribute
182
+	 */
183
+	public static function getStringRepresentationOfTypeHintsFromAttributes(array $typesFromAttribute): string
184
+	{
185
+		$resultString = '';
186
+		foreach ($typesFromAttribute as $types) {
187
+			$resultString .= '[' . implode('|', $types) . ']';
188
+		}
189
+		return $resultString;
190
+	}
191 191
 
192
-    /**
193
-     * @param string[] $typesToProcess
194
-     * @param string[] $resultArray
195
-     */
196
-    public static function convertNullableTypesToUnion(array $typesToProcess, array &$resultArray)
197
-    {
198
-        array_walk($typesToProcess, function (string $type) use (&$resultArray) {
199
-            if (str_contains($type, '?')) {
200
-                array_push($resultArray, 'null', ltrim($type, '?'));
201
-            } else {
202
-                $resultArray[] = $type;
203
-            }
204
-        });
205
-    }
192
+	/**
193
+	 * @param string[] $typesToProcess
194
+	 * @param string[] $resultArray
195
+	 */
196
+	public static function convertNullableTypesToUnion(array $typesToProcess, array &$resultArray)
197
+	{
198
+		array_walk($typesToProcess, function (string $type) use (&$resultArray) {
199
+			if (str_contains($type, '?')) {
200
+				array_push($resultArray, 'null', ltrim($type, '?'));
201
+			} else {
202
+				$resultArray[] = $type;
203
+			}
204
+		});
205
+	}
206 206
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     /**
38 38
      * @throws Exception|RuntimeException
39 39
      */
40
-    public static function getStringRepresentationOfDefaultParameterValue(mixed $defaultValue, PHPClass|PHPInterface $contextClass = null): float|bool|int|string|null
40
+    public static function getStringRepresentationOfDefaultParameterValue(mixed $defaultValue, PHPClass | PHPInterface $contextClass = null): float | bool | int | string | null
41 41
     {
42 42
         if ($defaultValue instanceof ConstFetch) {
43 43
             $defaultValueName = (string)$defaultValue->name;
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
                 );
66 66
                 /** @var PHPConst $rightConstant */
67 67
                 $rightConstant = array_pop($constants);
68
-                $value = $leftConstant->value|$rightConstant->value;
68
+                $value = $leftConstant->value | $rightConstant->value;
69 69
             }
70 70
         } elseif ($defaultValue instanceof UnaryMinus && property_exists($defaultValue->expr, 'value')) {
71
-            $value = '-' . $defaultValue->expr->value;
71
+            $value = '-'.$defaultValue->expr->value;
72 72
         } elseif ($defaultValue instanceof ClassConstFetch) {
73 73
             $class = (string)$defaultValue->class;
74 74
             if ($class === 'self' && $contextClass !== null) {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             if ((string)$defaultValue->name === 'class') {
83 83
                 $value = (string)$defaultValue->class;
84 84
             } else {
85
-                $constant = $parentClass->getConstant((string)$defaultValue->name);;
85
+                $constant = $parentClass->getConstant((string)$defaultValue->name); ;
86 86
                 $value = $constant->value;
87 87
             }
88 88
         } else {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         foreach ($function->parameters as $parameter) {
98 98
             $types = array_unique($parameter->typesFromSignature + Model\CommonUtils::flattenArray($parameter->typesFromAttribute, false));
99 99
             if (!empty($types)) {
100
-                $result .= implode('|', $types) . ' ';
100
+                $result .= implode('|', $types).' ';
101 101
             }
102 102
             if ($parameter->is_passed_by_ref) {
103 103
                 $result .= '&';
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             if ($parameter->is_vararg) {
106 106
                 $result .= '...';
107 107
             }
108
-            $result .= '$' . $parameter->name . ', ';
108
+            $result .= '$'.$parameter->name.', ';
109 109
         }
110 110
         return rtrim($result, ', ');
111 111
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     protected static function getDuplicatedFunctions(array $filtered): array
119 119
     {
120
-        $duplicatedFunctions = array_filter($filtered, function (PHPFunction $value, int|string $key) {
120
+        $duplicatedFunctions = array_filter($filtered, function(PHPFunction $value, int | string $key) {
121 121
             $duplicatesOfFunction = self::getAllDuplicatesOfFunction($value->name);
122 122
             $functionVersions[] = ParserUtils::getAvailableInVersions(
123 123
                 PhpStormStubsSingleton::getPhpStormStubs()->getFunction($value->name, shouldSuitCurrentPhpVersion: false)
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     {
185 185
         $resultString = '';
186 186
         foreach ($typesFromAttribute as $types) {
187
-            $resultString .= '[' . implode('|', $types) . ']';
187
+            $resultString .= '['.implode('|', $types).']';
188 188
         }
189 189
         return $resultString;
190 190
     }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
      */
196 196
     public static function convertNullableTypesToUnion(array $typesToProcess, array &$resultArray)
197 197
     {
198
-        array_walk($typesToProcess, function (string $type) use (&$resultArray) {
198
+        array_walk($typesToProcess, function(string $type) use (&$resultArray) {
199 199
             if (str_contains($type, '?')) {
200 200
                 array_push($resultArray, 'null', ltrim($type, '?'));
201 201
             } else {
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 property_exists;
26 26
 use function strval;
27 27
 
28
-abstract class BaseStubsTest extends TestCase
29
-{
28
+abstract class BaseStubsTest extends TestCase {
30 29
     public static function setUpBeforeClass(): void
31 30
     {
32 31
         parent::setUpBeforeClass();
Please login to merge, or discard this patch.
vendor/jetbrains/phpstorm-stubs/tests/StubsParameterNamesTest.php 3 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -14,56 +14,56 @@
 block discarded – undo
14 14
 
15 15
 class StubsParameterNamesTest extends BaseStubsTest
16 16
 {
17
-    /**
18
-     * @dataProvider \StubTests\TestData\Providers\Reflection\ReflectionParametersProvider::functionParametersProvider
19
-     * @throws RuntimeException
20
-     */
21
-    public function testFunctionsParameterNames(PHPFunction $function, PHPParameter $parameter)
22
-    {
23
-        $phpstormFunction = PhpStormStubsSingleton::getPhpStormStubs()->getFunction($function->name);
24
-        self::assertNotEmpty(
25
-            array_filter(
26
-                $phpstormFunction->parameters,
27
-                fn (PHPParameter $stubParameter) => $stubParameter->name === $parameter->name
28
-            ),
29
-            "Function $function->name has signature $function->name(" . self::printParameters($function->parameters) . ')' .
30
-            " but stub function has signature $phpstormFunction->name(" . self::printParameters($phpstormFunction->parameters) . ')'
31
-        );
32
-    }
17
+	/**
18
+	 * @dataProvider \StubTests\TestData\Providers\Reflection\ReflectionParametersProvider::functionParametersProvider
19
+	 * @throws RuntimeException
20
+	 */
21
+	public function testFunctionsParameterNames(PHPFunction $function, PHPParameter $parameter)
22
+	{
23
+		$phpstormFunction = PhpStormStubsSingleton::getPhpStormStubs()->getFunction($function->name);
24
+		self::assertNotEmpty(
25
+			array_filter(
26
+				$phpstormFunction->parameters,
27
+				fn (PHPParameter $stubParameter) => $stubParameter->name === $parameter->name
28
+			),
29
+			"Function $function->name has signature $function->name(" . self::printParameters($function->parameters) . ')' .
30
+			" but stub function has signature $phpstormFunction->name(" . self::printParameters($phpstormFunction->parameters) . ')'
31
+		);
32
+	}
33 33
 
34
-    /**
35
-     * @dataProvider \StubTests\TestData\Providers\Reflection\ReflectionParametersProvider::methodParametersProvider
36
-     * @throws RuntimeException
37
-     */
38
-    public function testMethodsParameterNames(PHPClass|PHPInterface $reflectionClass, PHPMethod $reflectionMethod, PHPParameter $reflectionParameter)
39
-    {
40
-        $className = $reflectionClass->name;
41
-        $methodName = $reflectionMethod->name;
42
-        if ($reflectionClass instanceof PHPClass) {
43
-            $stubMethod = PhpStormStubsSingleton::getPhpStormStubs()->getClass($className)->getMethod($methodName);
44
-        } else {
45
-            $stubMethod = PhpStormStubsSingleton::getPhpStormStubs()->getInterface($className)->getMethod($methodName);
46
-        }
47
-        self::assertNotEmpty(
48
-            array_filter(
49
-                $stubMethod->parameters,
50
-                fn (PHPParameter $stubParameter) => $stubParameter->name === $reflectionParameter->name
51
-            ),
52
-            "Method $className::$methodName has signature $methodName(" . self::printParameters($reflectionMethod->parameters) . ')' .
53
-            " but stub function has signature $methodName(" . self::printParameters($stubMethod->parameters) . ')'
54
-        );
55
-    }
34
+	/**
35
+	 * @dataProvider \StubTests\TestData\Providers\Reflection\ReflectionParametersProvider::methodParametersProvider
36
+	 * @throws RuntimeException
37
+	 */
38
+	public function testMethodsParameterNames(PHPClass|PHPInterface $reflectionClass, PHPMethod $reflectionMethod, PHPParameter $reflectionParameter)
39
+	{
40
+		$className = $reflectionClass->name;
41
+		$methodName = $reflectionMethod->name;
42
+		if ($reflectionClass instanceof PHPClass) {
43
+			$stubMethod = PhpStormStubsSingleton::getPhpStormStubs()->getClass($className)->getMethod($methodName);
44
+		} else {
45
+			$stubMethod = PhpStormStubsSingleton::getPhpStormStubs()->getInterface($className)->getMethod($methodName);
46
+		}
47
+		self::assertNotEmpty(
48
+			array_filter(
49
+				$stubMethod->parameters,
50
+				fn (PHPParameter $stubParameter) => $stubParameter->name === $reflectionParameter->name
51
+			),
52
+			"Method $className::$methodName has signature $methodName(" . self::printParameters($reflectionMethod->parameters) . ')' .
53
+			" but stub function has signature $methodName(" . self::printParameters($stubMethod->parameters) . ')'
54
+		);
55
+	}
56 56
 
57
-    /**
58
-     * @param PHPParameter[] $params
59
-     */
60
-    #[Pure]
61
-    public static function printParameters(array $params): string
62
-    {
63
-        $signature = '';
64
-        foreach ($params as $param) {
65
-            $signature .= '$' . $param->name . ', ';
66
-        }
67
-        return trim($signature, ', ');
68
-    }
57
+	/**
58
+	 * @param PHPParameter[] $params
59
+	 */
60
+	#[Pure]
61
+	public static function printParameters(array $params): string
62
+	{
63
+		$signature = '';
64
+		foreach ($params as $param) {
65
+			$signature .= '$' . $param->name . ', ';
66
+		}
67
+		return trim($signature, ', ');
68
+	}
69 69
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
                 $phpstormFunction->parameters,
27 27
                 fn (PHPParameter $stubParameter) => $stubParameter->name === $parameter->name
28 28
             ),
29
-            "Function $function->name has signature $function->name(" . self::printParameters($function->parameters) . ')' .
30
-            " but stub function has signature $phpstormFunction->name(" . self::printParameters($phpstormFunction->parameters) . ')'
29
+            "Function $function->name has signature $function->name(".self::printParameters($function->parameters).')'.
30
+            " but stub function has signature $phpstormFunction->name(".self::printParameters($phpstormFunction->parameters).')'
31 31
         );
32 32
     }
33 33
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * @dataProvider \StubTests\TestData\Providers\Reflection\ReflectionParametersProvider::methodParametersProvider
36 36
      * @throws RuntimeException
37 37
      */
38
-    public function testMethodsParameterNames(PHPClass|PHPInterface $reflectionClass, PHPMethod $reflectionMethod, PHPParameter $reflectionParameter)
38
+    public function testMethodsParameterNames(PHPClass | PHPInterface $reflectionClass, PHPMethod $reflectionMethod, PHPParameter $reflectionParameter)
39 39
     {
40 40
         $className = $reflectionClass->name;
41 41
         $methodName = $reflectionMethod->name;
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
                 $stubMethod->parameters,
50 50
                 fn (PHPParameter $stubParameter) => $stubParameter->name === $reflectionParameter->name
51 51
             ),
52
-            "Method $className::$methodName has signature $methodName(" . self::printParameters($reflectionMethod->parameters) . ')' .
53
-            " but stub function has signature $methodName(" . self::printParameters($stubMethod->parameters) . ')'
52
+            "Method $className::$methodName has signature $methodName(".self::printParameters($reflectionMethod->parameters).')'.
53
+            " but stub function has signature $methodName(".self::printParameters($stubMethod->parameters).')'
54 54
         );
55 55
     }
56 56
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $signature = '';
64 64
         foreach ($params as $param) {
65
-            $signature .= '$' . $param->name . ', ';
65
+            $signature .= '$'.$param->name.', ';
66 66
         }
67 67
         return trim($signature, ', ');
68 68
     }
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\PHPParameter;
13 13
 use StubTests\TestData\Providers\PhpStormStubsSingleton;
14 14
 
15
-class StubsParameterNamesTest extends BaseStubsTest
16
-{
15
+class StubsParameterNamesTest extends BaseStubsTest {
17 16
     /**
18 17
      * @dataProvider \StubTests\TestData\Providers\Reflection\ReflectionParametersProvider::functionParametersProvider
19 18
      * @throws RuntimeException
Please login to merge, or discard this patch.
tests/TestData/Providers/Reflection/ReflectionClassesTestDataProviders.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -11,57 +11,57 @@
 block discarded – undo
11 11
 
12 12
 class ReflectionClassesTestDataProviders
13 13
 {
14
-    public static function allClassesProvider(): ?Generator
15
-    {
16
-        $allClassesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
17
-            ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
18
-        foreach (EntitiesFilter::getFiltered($allClassesAndInterfaces) as $class) {
19
-            //exclude classes from PHPReflectionParser
20
-            if (strncmp($class->name, 'PHP', 3) !== 0) {
21
-                yield "class $class->name" => [$class];
22
-            }
23
-        }
24
-    }
14
+	public static function allClassesProvider(): ?Generator
15
+	{
16
+		$allClassesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
17
+			ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
18
+		foreach (EntitiesFilter::getFiltered($allClassesAndInterfaces) as $class) {
19
+			//exclude classes from PHPReflectionParser
20
+			if (strncmp($class->name, 'PHP', 3) !== 0) {
21
+				yield "class $class->name" => [$class];
22
+			}
23
+		}
24
+	}
25 25
 
26
-    public static function classesWithInterfacesProvider(): ?Generator
27
-    {
28
-        foreach (EntitiesFilter::getFiltered(
29
-            ReflectionStubsSingleton::getReflectionStubs()->getClasses(),
30
-            fn (PHPClass $class) => empty($class->interfaces),
31
-            StubProblemType::WRONG_INTERFACE
32
-        ) as $class) {
33
-            //exclude classes from PHPReflectionParser
34
-            if (strncmp($class->name, 'PHP', 3) !== 0) {
35
-                yield "class $class->name" => [$class];
36
-            }
37
-        }
38
-    }
26
+	public static function classesWithInterfacesProvider(): ?Generator
27
+	{
28
+		foreach (EntitiesFilter::getFiltered(
29
+			ReflectionStubsSingleton::getReflectionStubs()->getClasses(),
30
+			fn (PHPClass $class) => empty($class->interfaces),
31
+			StubProblemType::WRONG_INTERFACE
32
+		) as $class) {
33
+			//exclude classes from PHPReflectionParser
34
+			if (strncmp($class->name, 'PHP', 3) !== 0) {
35
+				yield "class $class->name" => [$class];
36
+			}
37
+		}
38
+	}
39 39
 
40
-    public static function classWithParentProvider(): ?Generator
41
-    {
42
-        $classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
43
-            ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
44
-        $filtered = EntitiesFilter::getFiltered(
45
-            $classesAndInterfaces,
46
-            fn ($class) => empty($class->parentInterfaces) && empty($class->parentClass),
47
-            StubProblemType::WRONG_PARENT
48
-        );
49
-        foreach ($filtered as $class) {
50
-            yield "class $class->name" => [$class];
51
-        }
52
-    }
40
+	public static function classWithParentProvider(): ?Generator
41
+	{
42
+		$classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
43
+			ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
44
+		$filtered = EntitiesFilter::getFiltered(
45
+			$classesAndInterfaces,
46
+			fn ($class) => empty($class->parentInterfaces) && empty($class->parentClass),
47
+			StubProblemType::WRONG_PARENT
48
+		);
49
+		foreach ($filtered as $class) {
50
+			yield "class $class->name" => [$class];
51
+		}
52
+	}
53 53
 
54
-    public static function finalClassesProvider(): ?Generator
55
-    {
56
-        $classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
57
-            ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
58
-        $filtered = EntitiesFilter::getFiltered(
59
-            $classesAndInterfaces,
60
-            null,
61
-            StubProblemType::WRONG_FINAL_MODIFIER
62
-        );
63
-        foreach ($filtered as $class) {
64
-            yield "class $class->name" => [$class];
65
-        }
66
-    }
54
+	public static function finalClassesProvider(): ?Generator
55
+	{
56
+		$classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
57
+			ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
58
+		$filtered = EntitiesFilter::getFiltered(
59
+			$classesAndInterfaces,
60
+			null,
61
+			StubProblemType::WRONG_FINAL_MODIFIER
62
+		);
63
+		foreach ($filtered as $class) {
64
+			yield "class $class->name" => [$class];
65
+		}
66
+	}
67 67
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@
 block discarded – undo
9 9
 use StubTests\TestData\Providers\EntitiesFilter;
10 10
 use StubTests\TestData\Providers\ReflectionStubsSingleton;
11 11
 
12
-class ReflectionClassesTestDataProviders
13
-{
12
+class ReflectionClassesTestDataProviders {
14 13
     public static function allClassesProvider(): ?Generator
15 14
     {
16 15
         $allClassesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
Please login to merge, or discard this patch.
tests/TestData/Providers/Reflection/ReflectionParametersProvider.php 2 patches
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -11,111 +11,111 @@
 block discarded – undo
11 11
 
12 12
 class ReflectionParametersProvider
13 13
 {
14
-    public static function functionParametersProvider(): ?Generator
15
-    {
16
-        foreach (EntitiesFilter::getFilteredFunctions() as $function) {
17
-            $PHPParameters = EntitiesFilter::getFilteredParameters(
18
-                $function
19
-            );
20
-            foreach ($PHPParameters as $parameter) {
21
-                yield "$function->name($parameter->name)" => [$function, $parameter];
22
-            }
23
-        }
24
-    }
14
+	public static function functionParametersProvider(): ?Generator
15
+	{
16
+		foreach (EntitiesFilter::getFilteredFunctions() as $function) {
17
+			$PHPParameters = EntitiesFilter::getFilteredParameters(
18
+				$function
19
+			);
20
+			foreach ($PHPParameters as $parameter) {
21
+				yield "$function->name($parameter->name)" => [$function, $parameter];
22
+			}
23
+		}
24
+	}
25 25
 
26
-    public static function functionParametersWithTypeProvider(): ?Generator
27
-    {
28
-        foreach (EntitiesFilter::getFilteredFunctions() as $function) {
29
-            foreach (EntitiesFilter::getFilteredParameters(
30
-                $function,
31
-                null,
32
-                StubProblemType::PARAMETER_TYPE_MISMATCH
33
-            ) as $parameter) {
34
-                yield "$function->name($parameter->name)" => [$function, $parameter];
35
-            }
36
-        }
37
-    }
26
+	public static function functionParametersWithTypeProvider(): ?Generator
27
+	{
28
+		foreach (EntitiesFilter::getFilteredFunctions() as $function) {
29
+			foreach (EntitiesFilter::getFilteredParameters(
30
+				$function,
31
+				null,
32
+				StubProblemType::PARAMETER_TYPE_MISMATCH
33
+			) as $parameter) {
34
+				yield "$function->name($parameter->name)" => [$function, $parameter];
35
+			}
36
+		}
37
+	}
38 38
 
39
-    public static function functionOptionalParametersProvider(): ?Generator
40
-    {
41
-        foreach (EntitiesFilter::getFilteredFunctions() as $function) {
42
-            foreach (EntitiesFilter::getFilteredParameters(
43
-                $function,
44
-                fn (PHPParameter $parameter) => !$parameter->isOptional,
45
-                StubProblemType::PARAMETER_TYPE_MISMATCH,
46
-                StubProblemType::WRONG_OPTIONALLITY
47
-            ) as $parameter) {
48
-                yield "$function->name($parameter->name)" => [$function, $parameter];
49
-            }
50
-        }
51
-    }
39
+	public static function functionOptionalParametersProvider(): ?Generator
40
+	{
41
+		foreach (EntitiesFilter::getFilteredFunctions() as $function) {
42
+			foreach (EntitiesFilter::getFilteredParameters(
43
+				$function,
44
+				fn (PHPParameter $parameter) => !$parameter->isOptional,
45
+				StubProblemType::PARAMETER_TYPE_MISMATCH,
46
+				StubProblemType::WRONG_OPTIONALLITY
47
+			) as $parameter) {
48
+				yield "$function->name($parameter->name)" => [$function, $parameter];
49
+			}
50
+		}
51
+	}
52 52
 
53
-    public static function functionOptionalParametersWithDefaultValueProvider(): ?Generator
54
-    {
55
-        foreach (EntitiesFilter::getFilteredFunctions() as $function) {
56
-            foreach (EntitiesFilter::getFilteredParameters(
57
-                $function,
58
-                fn (PHPParameter $parameter) => !$parameter->isOptional || empty($parameter->defaultValue),
59
-                StubProblemType::WRONG_PARAMETER_DEFAULT_VALUE
60
-            ) as $parameter) {
61
-                yield "$function->name($parameter->name)" => [$function, $parameter];
62
-            }
63
-        }
64
-    }
53
+	public static function functionOptionalParametersWithDefaultValueProvider(): ?Generator
54
+	{
55
+		foreach (EntitiesFilter::getFilteredFunctions() as $function) {
56
+			foreach (EntitiesFilter::getFilteredParameters(
57
+				$function,
58
+				fn (PHPParameter $parameter) => !$parameter->isOptional || empty($parameter->defaultValue),
59
+				StubProblemType::WRONG_PARAMETER_DEFAULT_VALUE
60
+			) as $parameter) {
61
+				yield "$function->name($parameter->name)" => [$function, $parameter];
62
+			}
63
+		}
64
+	}
65 65
 
66
-    public static function methodParametersProvider(): ?Generator
67
-    {
68
-        $classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
69
-            ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
70
-        foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
71
-            //exclude classes from PHPReflectionParser
72
-            if (strncmp($class->name, 'PHP', 3) !== 0) {
73
-                foreach (EntitiesFilter::getFilteredFunctions($class) as $method) {
74
-                    foreach (EntitiesFilter::getFilteredParameters($method) as $parameter) {
75
-                        yield "$class->name::$method->name($parameter->name)" => [$class, $method, $parameter];
76
-                    }
77
-                }
78
-            }
79
-        }
80
-    }
66
+	public static function methodParametersProvider(): ?Generator
67
+	{
68
+		$classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
69
+			ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
70
+		foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
71
+			//exclude classes from PHPReflectionParser
72
+			if (strncmp($class->name, 'PHP', 3) !== 0) {
73
+				foreach (EntitiesFilter::getFilteredFunctions($class) as $method) {
74
+					foreach (EntitiesFilter::getFilteredParameters($method) as $parameter) {
75
+						yield "$class->name::$method->name($parameter->name)" => [$class, $method, $parameter];
76
+					}
77
+				}
78
+			}
79
+		}
80
+	}
81 81
 
82
-    public static function methodOptionalParametersProvider(): ?Generator
83
-    {
84
-        $classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
85
-            ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
86
-        foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
87
-            //exclude classes from PHPReflectionParser
88
-            if (strncmp($class->name, 'PHP', 3) !== 0) {
89
-                foreach (EntitiesFilter::getFilteredFunctions($class) as $method) {
90
-                    foreach (EntitiesFilter::getFilteredParameters(
91
-                        $method,
92
-                        fn (PHPParameter $parameter) => !$parameter->isOptional,
93
-                        StubProblemType::WRONG_OPTIONALLITY
94
-                    ) as $parameter) {
95
-                        yield "$class->name::$method->name($parameter->name)" => [$class, $method, $parameter];
96
-                    }
97
-                }
98
-            }
99
-        }
100
-    }
82
+	public static function methodOptionalParametersProvider(): ?Generator
83
+	{
84
+		$classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
85
+			ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
86
+		foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
87
+			//exclude classes from PHPReflectionParser
88
+			if (strncmp($class->name, 'PHP', 3) !== 0) {
89
+				foreach (EntitiesFilter::getFilteredFunctions($class) as $method) {
90
+					foreach (EntitiesFilter::getFilteredParameters(
91
+						$method,
92
+						fn (PHPParameter $parameter) => !$parameter->isOptional,
93
+						StubProblemType::WRONG_OPTIONALLITY
94
+					) as $parameter) {
95
+						yield "$class->name::$method->name($parameter->name)" => [$class, $method, $parameter];
96
+					}
97
+				}
98
+			}
99
+		}
100
+	}
101 101
 
102
-    public static function methodOptionalParametersWithDefaultValueProvider(): ?Generator
103
-    {
104
-        $classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
105
-            ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
106
-        foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
107
-            //exclude classes from PHPReflectionParser
108
-            if (strncmp($class->name, 'PHP', 3) !== 0) {
109
-                foreach (EntitiesFilter::getFilteredFunctions($class) as $method) {
110
-                    foreach (EntitiesFilter::getFilteredParameters(
111
-                        $method,
112
-                        fn (PHPParameter $parameter) => !$parameter->isOptional || empty($parameter->defaultValue),
113
-                        StubProblemType::WRONG_PARAMETER_DEFAULT_VALUE
114
-                    ) as $parameter) {
115
-                        yield "$class->name::$method->name($parameter->name)" => [$class, $method, $parameter];
116
-                    }
117
-                }
118
-            }
119
-        }
120
-    }
102
+	public static function methodOptionalParametersWithDefaultValueProvider(): ?Generator
103
+	{
104
+		$classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
105
+			ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
106
+		foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
107
+			//exclude classes from PHPReflectionParser
108
+			if (strncmp($class->name, 'PHP', 3) !== 0) {
109
+				foreach (EntitiesFilter::getFilteredFunctions($class) as $method) {
110
+					foreach (EntitiesFilter::getFilteredParameters(
111
+						$method,
112
+						fn (PHPParameter $parameter) => !$parameter->isOptional || empty($parameter->defaultValue),
113
+						StubProblemType::WRONG_PARAMETER_DEFAULT_VALUE
114
+					) as $parameter) {
115
+						yield "$class->name::$method->name($parameter->name)" => [$class, $method, $parameter];
116
+					}
117
+				}
118
+			}
119
+		}
120
+	}
121 121
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@
 block discarded – undo
9 9
 use StubTests\TestData\Providers\EntitiesFilter;
10 10
 use StubTests\TestData\Providers\ReflectionStubsSingleton;
11 11
 
12
-class ReflectionParametersProvider
13
-{
12
+class ReflectionParametersProvider {
14 13
     public static function functionParametersProvider(): ?Generator
15 14
     {
16 15
         foreach (EntitiesFilter::getFilteredFunctions() as $function) {
Please login to merge, or discard this patch.
tests/TestData/Providers/Reflection/ReflectionConstantsProvider.php 3 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -13,57 +13,57 @@
 block discarded – undo
13 13
 
14 14
 class ReflectionConstantsProvider
15 15
 {
16
-    public static function constantProvider(): ?Generator
17
-    {
18
-        foreach (EntitiesFilter::getFiltered(ReflectionStubsSingleton::getReflectionStubs()->getConstants()) as $constant) {
19
-            yield "constant $constant->name" => [$constant];
20
-        }
21
-    }
16
+	public static function constantProvider(): ?Generator
17
+	{
18
+		foreach (EntitiesFilter::getFiltered(ReflectionStubsSingleton::getReflectionStubs()->getConstants()) as $constant) {
19
+			yield "constant $constant->name" => [$constant];
20
+		}
21
+	}
22 22
 
23
-    public static function constantValuesProvider(): ?Generator
24
-    {
25
-        foreach (self::getFilteredConstants() as $constant) {
26
-            yield "constant $constant->name" => [$constant];
27
-        }
28
-    }
23
+	public static function constantValuesProvider(): ?Generator
24
+	{
25
+		foreach (self::getFilteredConstants() as $constant) {
26
+			yield "constant $constant->name" => [$constant];
27
+		}
28
+	}
29 29
 
30
-    public static function classConstantProvider(): ?Generator
31
-    {
32
-        $classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
33
-            ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
34
-        foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
35
-            foreach (EntitiesFilter::getFiltered($class->constants) as $constant) {
36
-                yield "constant $class->name::$constant->name" => [$class, $constant];
37
-            }
38
-        }
39
-    }
30
+	public static function classConstantProvider(): ?Generator
31
+	{
32
+		$classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
33
+			ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
34
+		foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
35
+			foreach (EntitiesFilter::getFiltered($class->constants) as $constant) {
36
+				yield "constant $class->name::$constant->name" => [$class, $constant];
37
+			}
38
+		}
39
+	}
40 40
 
41
-    public static function classConstantValuesProvider(): ?Generator
42
-    {
43
-        $classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
44
-            ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
45
-        foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
46
-            foreach (self::getFilteredConstants($class) as $constant) {
47
-                yield "constant $class->name::$constant->name" => [$class, $constant];
48
-            }
49
-        }
50
-    }
41
+	public static function classConstantValuesProvider(): ?Generator
42
+	{
43
+		$classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
44
+			ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
45
+		foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
46
+			foreach (self::getFilteredConstants($class) as $constant) {
47
+				yield "constant $class->name::$constant->name" => [$class, $constant];
48
+			}
49
+		}
50
+	}
51 51
 
52
-    /**
53
-     * @return PHPConst[]
54
-     */
55
-    public static function getFilteredConstants(PHPInterface|PHPClass $class = null): array
56
-    {
57
-        if ($class === null) {
58
-            $allConstants = ReflectionStubsSingleton::getReflectionStubs()->getConstants();
59
-        } else {
60
-            $allConstants = $class->constants;
61
-        }
62
-        /** @var PHPConst[] $resultArray */
63
-        $resultArray = [];
64
-        foreach (EntitiesFilter::getFiltered($allConstants, null, StubProblemType::WRONG_CONSTANT_VALUE) as $constant) {
65
-            $resultArray[] = $constant;
66
-        }
67
-        return $resultArray;
68
-    }
52
+	/**
53
+	 * @return PHPConst[]
54
+	 */
55
+	public static function getFilteredConstants(PHPInterface|PHPClass $class = null): array
56
+	{
57
+		if ($class === null) {
58
+			$allConstants = ReflectionStubsSingleton::getReflectionStubs()->getConstants();
59
+		} else {
60
+			$allConstants = $class->constants;
61
+		}
62
+		/** @var PHPConst[] $resultArray */
63
+		$resultArray = [];
64
+		foreach (EntitiesFilter::getFiltered($allConstants, null, StubProblemType::WRONG_CONSTANT_VALUE) as $constant) {
65
+			$resultArray[] = $constant;
66
+		}
67
+		return $resultArray;
68
+	}
69 69
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
     /**
53 53
      * @return PHPConst[]
54 54
      */
55
-    public static function getFilteredConstants(PHPInterface|PHPClass $class = null): array
55
+    public static function getFilteredConstants(PHPInterface | PHPClass $class = null): array
56 56
     {
57 57
         if ($class === null) {
58 58
             $allConstants = ReflectionStubsSingleton::getReflectionStubs()->getConstants();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@
 block discarded – undo
11 11
 use StubTests\TestData\Providers\EntitiesFilter;
12 12
 use StubTests\TestData\Providers\ReflectionStubsSingleton;
13 13
 
14
-class ReflectionConstantsProvider
15
-{
14
+class ReflectionConstantsProvider {
16 15
     public static function constantProvider(): ?Generator
17 16
     {
18 17
         foreach (EntitiesFilter::getFiltered(ReflectionStubsSingleton::getReflectionStubs()->getConstants()) as $constant) {
Please login to merge, or discard this patch.
tests/TestData/Providers/Reflection/ReflectionPropertiesProvider.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -11,42 +11,42 @@
 block discarded – undo
11 11
 
12 12
 class ReflectionPropertiesProvider
13 13
 {
14
-    public static function classPropertiesProvider(): Generator
15
-    {
16
-        return self::yieldFilteredMethodProperties();
17
-    }
18
-
19
-    public static function classStaticPropertiesProvider(): Generator
20
-    {
21
-        return self::yieldFilteredMethodProperties(StubProblemType::PROPERTY_IS_STATIC);
22
-    }
23
-
24
-    public static function classPropertiesWithAccessProvider(): Generator
25
-    {
26
-        return self::yieldFilteredMethodProperties(StubProblemType::PROPERTY_ACCESS);
27
-    }
28
-
29
-    public static function classPropertiesWithTypeProvider(): Generator
30
-    {
31
-        return self::yieldFilteredMethodProperties(StubProblemType::PROPERTY_TYPE);
32
-    }
33
-
34
-    public static function classReadonlyPropertiesProvider(): Generator
35
-    {
36
-        return self::yieldFilteredMethodProperties(StubProblemType::PROPERTY_READONLY);
37
-    }
38
-
39
-    private static function yieldFilteredMethodProperties(int ...$problemTypes): ?Generator
40
-    {
41
-        $classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses();
42
-        foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
43
-            foreach (EntitiesFilter::getFiltered(
44
-                $class->properties,
45
-                fn (PHPProperty $property) => $property->access === 'private',
46
-                ...$problemTypes
47
-            ) as $property) {
48
-                yield "Property $class->name::$property->name" => [$class, $property];
49
-            }
50
-        }
51
-    }
14
+	public static function classPropertiesProvider(): Generator
15
+	{
16
+		return self::yieldFilteredMethodProperties();
17
+	}
18
+
19
+	public static function classStaticPropertiesProvider(): Generator
20
+	{
21
+		return self::yieldFilteredMethodProperties(StubProblemType::PROPERTY_IS_STATIC);
22
+	}
23
+
24
+	public static function classPropertiesWithAccessProvider(): Generator
25
+	{
26
+		return self::yieldFilteredMethodProperties(StubProblemType::PROPERTY_ACCESS);
27
+	}
28
+
29
+	public static function classPropertiesWithTypeProvider(): Generator
30
+	{
31
+		return self::yieldFilteredMethodProperties(StubProblemType::PROPERTY_TYPE);
32
+	}
33
+
34
+	public static function classReadonlyPropertiesProvider(): Generator
35
+	{
36
+		return self::yieldFilteredMethodProperties(StubProblemType::PROPERTY_READONLY);
37
+	}
38
+
39
+	private static function yieldFilteredMethodProperties(int ...$problemTypes): ?Generator
40
+	{
41
+		$classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses();
42
+		foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
43
+			foreach (EntitiesFilter::getFiltered(
44
+				$class->properties,
45
+				fn (PHPProperty $property) => $property->access === 'private',
46
+				...$problemTypes
47
+			) as $property) {
48
+				yield "Property $class->name::$property->name" => [$class, $property];
49
+			}
50
+		}
51
+	}
52 52
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@
 block discarded – undo
9 9
 use StubTests\TestData\Providers\EntitiesFilter;
10 10
 use StubTests\TestData\Providers\ReflectionStubsSingleton;
11 11
 
12
-class ReflectionPropertiesProvider
13
-{
12
+class ReflectionPropertiesProvider {
14 13
     public static function classPropertiesProvider(): Generator
15 14
     {
16 15
         return self::yieldFilteredMethodProperties();
Please login to merge, or discard this patch.
tests/TestData/Providers/Reflection/ReflectionMethodsProvider.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -11,81 +11,81 @@
 block discarded – undo
11 11
 
12 12
 class ReflectionMethodsProvider
13 13
 {
14
-    public static function classMethodsProvider(): ?Generator
15
-    {
16
-        return self::yieldFilteredMethods();
17
-    }
14
+	public static function classMethodsProvider(): ?Generator
15
+	{
16
+		return self::yieldFilteredMethods();
17
+	}
18 18
 
19
-    public static function classMethodsWithReturnTypeHintProvider(): ?Generator
20
-    {
21
-        return self::yieldFilteredMethods(StubProblemType::WRONG_RETURN_TYPEHINT);
22
-    }
19
+	public static function classMethodsWithReturnTypeHintProvider(): ?Generator
20
+	{
21
+		return self::yieldFilteredMethods(StubProblemType::WRONG_RETURN_TYPEHINT);
22
+	}
23 23
 
24
-    public static function classMethodsWithAccessProvider(): ?Generator
25
-    {
26
-        return self::yieldFilteredMethods(StubProblemType::FUNCTION_ACCESS);
27
-    }
24
+	public static function classMethodsWithAccessProvider(): ?Generator
25
+	{
26
+		return self::yieldFilteredMethods(StubProblemType::FUNCTION_ACCESS);
27
+	}
28 28
 
29
-    public static function classFinalMethodsProvider(): ?Generator
30
-    {
31
-        return self::yieldFilteredMethods(StubProblemType::WRONG_FINAL_MODIFIER);
32
-    }
29
+	public static function classFinalMethodsProvider(): ?Generator
30
+	{
31
+		return self::yieldFilteredMethods(StubProblemType::WRONG_FINAL_MODIFIER);
32
+	}
33 33
 
34
-    public static function classStaticMethodsProvider(): ?Generator
35
-    {
36
-        return self::yieldFilteredMethods(StubProblemType::WRONG_STATIC_MODIFIER);
37
-    }
34
+	public static function classStaticMethodsProvider(): ?Generator
35
+	{
36
+		return self::yieldFilteredMethods(StubProblemType::WRONG_STATIC_MODIFIER);
37
+	}
38 38
 
39
-    public static function classMethodsWithParametersProvider(): ?Generator
40
-    {
41
-        return self::yieldFilteredMethods(
42
-            StubProblemType::HAS_DUPLICATION,
43
-            StubProblemType::FUNCTION_PARAMETER_MISMATCH
44
-        );
45
-    }
39
+	public static function classMethodsWithParametersProvider(): ?Generator
40
+	{
41
+		return self::yieldFilteredMethods(
42
+			StubProblemType::HAS_DUPLICATION,
43
+			StubProblemType::FUNCTION_PARAMETER_MISMATCH
44
+		);
45
+	}
46 46
 
47
-    public static function classMethodsWithoutTentitiveReturnTypeProvider(): ?Generator
48
-    {
49
-        $classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
50
-            ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
51
-        foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
52
-            foreach (EntitiesFilter::getFiltered(
53
-                $class->methods,
54
-                fn (PHPMethod $method) => $method->isReturnTypeTentative,
55
-                StubProblemType::HAS_DUPLICATION,
56
-                StubProblemType::FUNCTION_PARAMETER_MISMATCH,
57
-                StubProblemType::WRONG_RETURN_TYPEHINT
58
-            ) as $method) {
59
-                yield "Method $class->name::$method->name" => [$class, $method];
60
-            }
61
-        }
62
-    }
47
+	public static function classMethodsWithoutTentitiveReturnTypeProvider(): ?Generator
48
+	{
49
+		$classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
50
+			ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
51
+		foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
52
+			foreach (EntitiesFilter::getFiltered(
53
+				$class->methods,
54
+				fn (PHPMethod $method) => $method->isReturnTypeTentative,
55
+				StubProblemType::HAS_DUPLICATION,
56
+				StubProblemType::FUNCTION_PARAMETER_MISMATCH,
57
+				StubProblemType::WRONG_RETURN_TYPEHINT
58
+			) as $method) {
59
+				yield "Method $class->name::$method->name" => [$class, $method];
60
+			}
61
+		}
62
+	}
63 63
 
64
-    public static function classMethodsWithTentitiveReturnTypeProvider(): ?Generator
65
-    {
66
-        $classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
67
-            ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
68
-        foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
69
-            foreach (EntitiesFilter::getFiltered(
70
-                $class->methods,
71
-                fn (PHPMethod $method) => !$method->isReturnTypeTentative,
72
-                StubProblemType::HAS_DUPLICATION,
73
-                StubProblemType::FUNCTION_PARAMETER_MISMATCH,
74
-                StubProblemType::WRONG_RETURN_TYPEHINT
75
-            ) as $method) {
76
-                yield "Method $class->name::$method->name" => [$class, $method];
77
-            }
78
-        }
79
-    }
64
+	public static function classMethodsWithTentitiveReturnTypeProvider(): ?Generator
65
+	{
66
+		$classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
67
+			ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
68
+		foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
69
+			foreach (EntitiesFilter::getFiltered(
70
+				$class->methods,
71
+				fn (PHPMethod $method) => !$method->isReturnTypeTentative,
72
+				StubProblemType::HAS_DUPLICATION,
73
+				StubProblemType::FUNCTION_PARAMETER_MISMATCH,
74
+				StubProblemType::WRONG_RETURN_TYPEHINT
75
+			) as $method) {
76
+				yield "Method $class->name::$method->name" => [$class, $method];
77
+			}
78
+		}
79
+	}
80 80
 
81
-    private static function yieldFilteredMethods(int ...$problemTypes): ?Generator
82
-    {
83
-        $classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
84
-            ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
85
-        foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
86
-            foreach (EntitiesFilter::getFiltered($class->methods, null, ...$problemTypes) as $method) {
87
-                yield "Method $class->name::$method->name" => [$class, $method];
88
-            }
89
-        }
90
-    }
81
+	private static function yieldFilteredMethods(int ...$problemTypes): ?Generator
82
+	{
83
+		$classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() +
84
+			ReflectionStubsSingleton::getReflectionStubs()->getInterfaces();
85
+		foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) {
86
+			foreach (EntitiesFilter::getFiltered($class->methods, null, ...$problemTypes) as $method) {
87
+				yield "Method $class->name::$method->name" => [$class, $method];
88
+			}
89
+		}
90
+	}
91 91
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@
 block discarded – undo
9 9
 use StubTests\TestData\Providers\EntitiesFilter;
10 10
 use StubTests\TestData\Providers\ReflectionStubsSingleton;
11 11
 
12
-class ReflectionMethodsProvider
13
-{
12
+class ReflectionMethodsProvider {
14 13
     public static function classMethodsProvider(): ?Generator
15 14
     {
16 15
         return self::yieldFilteredMethods();
Please login to merge, or discard this patch.
tests/TestData/Providers/Reflection/ReflectionFunctionsProvider.php 2 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -10,33 +10,33 @@
 block discarded – undo
10 10
 
11 11
 class ReflectionFunctionsProvider
12 12
 {
13
-    public static function allFunctionsProvider(): ?Generator
14
-    {
15
-        foreach (EntitiesFilter::getFiltered(ReflectionStubsSingleton::getReflectionStubs()->getFunctions()) as $function) {
16
-            yield "function $function->name" => [$function];
17
-        }
18
-    }
13
+	public static function allFunctionsProvider(): ?Generator
14
+	{
15
+		foreach (EntitiesFilter::getFiltered(ReflectionStubsSingleton::getReflectionStubs()->getFunctions()) as $function) {
16
+			yield "function $function->name" => [$function];
17
+		}
18
+	}
19 19
 
20
-    public static function functionsForDeprecationTestsProvider(): ?Generator
21
-    {
22
-        foreach (EntitiesFilter::getFiltered(
23
-            ReflectionStubsSingleton::getReflectionStubs()->getFunctions(),
24
-            null,
25
-            StubProblemType::FUNCTION_IS_DEPRECATED
26
-        ) as $function) {
27
-            yield "function $function->name" => [$function];
28
-        }
29
-    }
20
+	public static function functionsForDeprecationTestsProvider(): ?Generator
21
+	{
22
+		foreach (EntitiesFilter::getFiltered(
23
+			ReflectionStubsSingleton::getReflectionStubs()->getFunctions(),
24
+			null,
25
+			StubProblemType::FUNCTION_IS_DEPRECATED
26
+		) as $function) {
27
+			yield "function $function->name" => [$function];
28
+		}
29
+	}
30 30
 
31
-    public static function functionsForParamsAmountTestsProvider(): ?Generator
32
-    {
33
-        foreach (EntitiesFilter::getFiltered(
34
-            ReflectionStubsSingleton::getReflectionStubs()->getFunctions(),
35
-            null,
36
-            StubProblemType::FUNCTION_PARAMETER_MISMATCH,
37
-            StubProblemType::HAS_DUPLICATION
38
-        ) as $function) {
39
-            yield "function $function->name" => [$function];
40
-        }
41
-    }
31
+	public static function functionsForParamsAmountTestsProvider(): ?Generator
32
+	{
33
+		foreach (EntitiesFilter::getFiltered(
34
+			ReflectionStubsSingleton::getReflectionStubs()->getFunctions(),
35
+			null,
36
+			StubProblemType::FUNCTION_PARAMETER_MISMATCH,
37
+			StubProblemType::HAS_DUPLICATION
38
+		) as $function) {
39
+			yield "function $function->name" => [$function];
40
+		}
41
+	}
42 42
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
 use StubTests\TestData\Providers\EntitiesFilter;
9 9
 use StubTests\TestData\Providers\ReflectionStubsSingleton;
10 10
 
11
-class ReflectionFunctionsProvider
12
-{
11
+class ReflectionFunctionsProvider {
13 12
     public static function allFunctionsProvider(): ?Generator
14 13
     {
15 14
         foreach (EntitiesFilter::getFiltered(ReflectionStubsSingleton::getReflectionStubs()->getFunctions()) as $function) {
Please login to merge, or discard this patch.
phpstorm-stubs/tests/TestData/Providers/PhpStormStubsSingleton.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 PhpStormStubsSingleton
10 10
 {
11
-    private static ?StubsContainer $phpstormStubs = null;
11
+	private static ?StubsContainer $phpstormStubs = null;
12 12
 
13
-    public static function getPhpStormStubs(): StubsContainer
14
-    {
15
-        if (self::$phpstormStubs === null) {
16
-            self::$phpstormStubs = StubParser::getPhpStormStubs();
17
-        }
18
-        return self::$phpstormStubs;
19
-    }
13
+	public static function getPhpStormStubs(): StubsContainer
14
+	{
15
+		if (self::$phpstormStubs === null) {
16
+			self::$phpstormStubs = StubParser::getPhpStormStubs();
17
+		}
18
+		return self::$phpstormStubs;
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 StubTests\Model\StubsContainer;
7 7
 use StubTests\Parsers\StubParser;
8 8
 
9
-class PhpStormStubsSingleton
10
-{
9
+class PhpStormStubsSingleton {
11 10
     private static ?StubsContainer $phpstormStubs = null;
12 11
 
13 12
     public static function getPhpStormStubs(): StubsContainer
Please login to merge, or discard this patch.