Skip to content

Commit dee013b

Browse files
committed
Call gatherAssertTypes statically
1 parent 3811672 commit dee013b

27 files changed

+43
-43
lines changed

tests/PHPStan/Analyser/AssertStubTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class AssertStubTest extends TypeInferenceTestCase
99

1010
public static function dataFileAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/assert-stub.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/assert-stub.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/Bug10922Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Bug10922Test extends TypeInferenceTestCase
99

1010
public static function dataFileAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-10922.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/bug-10922.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/Bug11009Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Bug11009Test extends TypeInferenceTestCase
99

1010
public static function dataFileAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-11009.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/bug-11009.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/Bug9307Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Bug9307Test extends TypeInferenceTestCase
99

1010
public static function dataFileAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-9307.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/bug-9307.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/ClassConstantStubFileTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class ClassConstantStubFileTest extends TypeInferenceTestCase
99

1010
public static function dataFileAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/class-constant-stub-files.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/class-constant-stub-files.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/ConditionalReturnTypeFromMethodStubTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class ConditionalReturnTypeFromMethodStubTest extends TypeInferenceTestCase
99

1010
public static function dataFileAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/conditional-return-type-stub.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/conditional-return-type-stub.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/DoNotPolluteScopeWithBlockTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class DoNotPolluteScopeWithBlockTest extends TypeInferenceTestCase
99

1010
public static function dataFileAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/do-not-pollute-scope-with-block.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/do-not-pollute-scope-with-block.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/DoNotRememberPossiblyImpureFunctionValuesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class DoNotRememberPossiblyImpureFunctionValuesTest extends TypeInferenceTestCas
99

1010
public static function dataAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/do-not-remember-possibly-impure-function-values.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/do-not-remember-possibly-impure-function-values.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/DynamicMethodThrowTypeExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public static function dataFileAsserts(): iterable
1414
return [];
1515
}
1616

17-
yield from $this->gatherAssertTypes(__DIR__ . '/data/dynamic-method-throw-type-extension.php');
18-
yield from $this->gatherAssertTypes(__DIR__ . '/data/dynamic-method-throw-type-extension-named-args-fixture.php');
17+
yield from self::gatherAssertTypes(__DIR__ . '/data/dynamic-method-throw-type-extension.php');
18+
yield from self::gatherAssertTypes(__DIR__ . '/data/dynamic-method-throw-type-extension-named-args-fixture.php');
1919
}
2020

2121
/**

tests/PHPStan/Analyser/DynamicReturnTypeExtensionTypeInferenceTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ class DynamicReturnTypeExtensionTypeInferenceTest extends TypeInferenceTestCase
1010

1111
public static function dataAsserts(): iterable
1212
{
13-
yield from $this->gatherAssertTypes(__DIR__ . '/data/dynamic-method-return-types.php');
13+
yield from self::gatherAssertTypes(__DIR__ . '/data/dynamic-method-return-types.php');
1414

1515
if (PHP_VERSION_ID >= 80000) {
16-
yield from $this->gatherAssertTypes(__DIR__ . '/data/dynamic-method-return-types-named-args.php');
16+
yield from self::gatherAssertTypes(__DIR__ . '/data/dynamic-method-return-types-named-args.php');
1717
}
1818

19-
yield from $this->gatherAssertTypes(__DIR__ . '/data/dynamic-method-return-compound-types.php');
20-
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-7344.php');
21-
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-7391b.php');
19+
yield from self::gatherAssertTypes(__DIR__ . '/data/dynamic-method-return-compound-types.php');
20+
yield from self::gatherAssertTypes(__DIR__ . '/data/bug-7344.php');
21+
yield from self::gatherAssertTypes(__DIR__ . '/data/bug-7391b.php');
2222
}
2323

2424
/**

tests/PHPStan/Analyser/ImmediatelyCalledFunctionWithoutImplicitThrowTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ImmediatelyCalledFunctionWithoutImplicitThrowTest extends TypeInferenceTes
1010

1111
public static function dataFileAsserts(): iterable
1212
{
13-
yield from $this->gatherAssertTypes(__DIR__ . '/data/immediately-called-function-without-implicit-throw.php');
13+
yield from self::gatherAssertTypes(__DIR__ . '/data/immediately-called-function-without-implicit-throw.php');
1414
}
1515

1616
/**

tests/PHPStan/Analyser/LooseConstComparisonPhp7Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static function dataFileAsserts(): iterable
1414
{
1515
// compares constants according to the php-version phpstan configuration,
1616
// _NOT_ the current php runtime version
17-
yield from $this->gatherAssertTypes(__DIR__ . '/data/loose-const-comparison-php7.php');
17+
yield from self::gatherAssertTypes(__DIR__ . '/data/loose-const-comparison-php7.php');
1818
}
1919

2020
/**

tests/PHPStan/Analyser/LooseConstComparisonPhp8Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static function dataFileAsserts(): iterable
1414
{
1515
// compares constants according to the php-version phpstan configuration,
1616
// _NOT_ the current php runtime version
17-
yield from $this->gatherAssertTypes(__DIR__ . '/data/loose-const-comparison-php8.php');
17+
yield from self::gatherAssertTypes(__DIR__ . '/data/loose-const-comparison-php8.php');
1818
}
1919

2020
/**

tests/PHPStan/Analyser/NodeScopeResolverTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private static function findTestFiles(): iterable
127127
}
128128

129129
//define('ALREADY_DEFINED_CONSTANT', true);
130-
//yield from $this->gatherAssertTypes(__DIR__ . '/data/already-defined-constant.php');
130+
//yield from self::gatherAssertTypes(__DIR__ . '/data/already-defined-constant.php');
131131

132132
yield __DIR__ . '/../Rules/Methods/data/conditional-complex-templates.php';
133133

@@ -239,7 +239,7 @@ public static function dataFile(): iterable
239239
*/
240240
public function testFile(string $file): void
241241
{
242-
$asserts = $this->gatherAssertTypes($file);
242+
$asserts = self::gatherAssertTypes($file);
243243
$this->assertNotCount(0, $asserts, sprintf('File %s has no asserts.', $file));
244244
$failures = [];
245245

tests/PHPStan/Analyser/ParamClosureThisStubsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class ParamClosureThisStubsTest extends TypeInferenceTestCase
99

1010
public static function dataAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/param-closure-this-stubs.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/param-closure-this-stubs.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/ParamOutTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class ParamOutTypeTest extends TypeInferenceTestCase
99

1010
public static function dataFileAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/param-out.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/param-out.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/ParameterClosureTypeExtensionArrowFunctionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class ParameterClosureTypeExtensionArrowFunctionTest extends TypeInferenceTestCa
99

1010
public static function dataFileAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/parameter-closure-type-extension-arrow-function.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/parameter-closure-type-extension-arrow-function.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/ParameterClosureTypeExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class ParameterClosureTypeExtensionTest extends TypeInferenceTestCase
99

1010
public static function dataFileAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/parameter-closure-type-extension.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/parameter-closure-type-extension.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/ParameterOutTypeExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class ParameterOutTypeExtensionTest extends TypeInferenceTestCase
99

1010
public static function dataAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/param-out/parameter-out-types.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/param-out/parameter-out-types.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/PathConstantsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ class PathConstantsTest extends TypeInferenceTestCase
1111
public static function dataFileAsserts(): iterable
1212
{
1313
if (DIRECTORY_SEPARATOR === '\\') {
14-
yield from $this->gatherAssertTypes(__DIR__ . '/data/pathConstants-win.php');
14+
yield from self::gatherAssertTypes(__DIR__ . '/data/pathConstants-win.php');
1515
} else {
16-
yield from $this->gatherAssertTypes(__DIR__ . '/data/pathConstants.php');
16+
yield from self::gatherAssertTypes(__DIR__ . '/data/pathConstants.php');
1717
}
1818
}
1919

tests/PHPStan/Analyser/ThrowsTagFromNativeFunctionStubTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class ThrowsTagFromNativeFunctionStubTest extends TypeInferenceTestCase
99

1010
public static function dataFileAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/throws-tag-from-native-function-stub.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/throws-tag-from-native-function-stub.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/TraitStubFilesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class TraitStubFilesTest extends TypeInferenceTestCase
99

1010
public static function dataFileAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/trait-stubs.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/trait-stubs.php');
1313
}
1414

1515
/**

tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceFalseTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ class TypeSpecifyingExtensionTypeInferenceFalseTest extends TypeInferenceTestCas
99

1010
public static function dataTypeSpecifyingExtensionsFalse(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-1-false.php');
13-
yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-2-false.php');
14-
yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-3-false.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-1-false.php');
13+
yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-2-false.php');
14+
yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-3-false.php');
1515
}
1616

1717
/**

tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceNullTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ class TypeSpecifyingExtensionTypeInferenceNullTest extends TypeInferenceTestCase
99

1010
public static function dataTypeSpecifyingExtensionsNull(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-1-null.php');
13-
yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-2-null.php');
14-
yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-3-null.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-1-null.php');
13+
yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-2-null.php');
14+
yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-3-null.php');
1515
}
1616

1717
/**

tests/PHPStan/Analyser/TypeSpecifyingExtensionTypeInferenceTrueTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ class TypeSpecifyingExtensionTypeInferenceTrueTest extends TypeInferenceTestCase
99

1010
public static function dataTypeSpecifyingExtensionsTrue(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-1-true.php');
13-
yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-2-true.php');
14-
yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-3-true.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-1-true.php');
13+
yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-2-true.php');
14+
yield from self::gatherAssertTypes(__DIR__ . '/data/type-specifying-extensions-3-true.php');
1515
}
1616

1717
/**

tests/PHPStan/Reflection/AllowedSubTypesClassReflectionExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class AllowedSubTypesClassReflectionExtensionTest extends TypeInferenceTestCase
99

1010
public static function dataFileAsserts(): iterable
1111
{
12-
yield from $this->gatherAssertTypes(__DIR__ . '/data/allowed-sub-types.php');
12+
yield from self::gatherAssertTypes(__DIR__ . '/data/allowed-sub-types.php');
1313
}
1414

1515
/**

tests/PHPStan/Testing/TypeInferenceTestCaseTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,30 +88,30 @@ public function testFileAssertionFailedErrors(string $filePath, string $errorMes
8888
$this->expectException(AssertionFailedError::class);
8989
$this->expectExceptionMessage($errorMessage);
9090

91-
$this->gatherAssertTypes($filePath);
91+
self::gatherAssertTypes($filePath);
9292
}
9393

9494
public function testVariableOrOffsetDescription(): void
9595
{
9696
$filePath = __DIR__ . '/data/assert-certainty-variable-or-offset.php';
9797

98-
[$variableAssert, $offsetAssert] = array_values($this->gatherAssertTypes($filePath));
98+
[$variableAssert, $offsetAssert] = array_values(self::gatherAssertTypes($filePath));
9999

100100
$this->assertSame('variable $context', $variableAssert[4]);
101101
$this->assertSame("offset 'email'", $offsetAssert[4]);
102102
}
103103

104104
public function testNonexistentClassInAnalysedFile(): void
105105
{
106-
foreach ($this->gatherAssertTypes(__DIR__ . '/../../notAutoloaded/nonexistentClasses.php') as $data) {
106+
foreach (self::gatherAssertTypes(__DIR__ . '/../../notAutoloaded/nonexistentClasses.php') as $data) {
107107
$this->assertFileAsserts(...$data);
108108
}
109109
}
110110

111111
public function testNonexistentClassInAnalysedFileWithError(): void
112112
{
113113
try {
114-
foreach ($this->gatherAssertTypes(__DIR__ . '/../../notAutoloaded/nonexistentClasses-error.php') as $data) {
114+
foreach (self::gatherAssertTypes(__DIR__ . '/../../notAutoloaded/nonexistentClasses-error.php') as $data) {
115115
$this->assertFileAsserts(...$data);
116116
}
117117

0 commit comments

Comments
 (0)