Skip to content

Commit a6a7430

Browse files
committed
Update TypeSpecifierContext.php
1 parent 7a3e7da commit a6a7430

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

src/Analyser/TypeSpecifierContext.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use PHPStan\ShouldNotHappenException;
66
use PHPStan\Type\MixedType;
7+
use PHPStan\Type\Type;
78

89
/**
910
* @api
@@ -90,7 +91,8 @@ public function null(): bool
9091
return $this->value === null;
9192
}
9293

93-
public function getReturnType(): Type {
94+
public function getReturnType(): Type
95+
{
9496
return new MixedType();
9597
}
9698

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
services:
22
-
3-
class: PHPStan\Analyser\TypeSpecifierContextReturnTypeExtension
3+
class: PHPStan\Tests\TypeSpecifierContextReturnTypeExtension
44
tags:
55
- phpstan.typeSpecifier.methodTypeSpecifyingExtension

tests/PHPStan/Analyser/TypeSpecifierContextReturnTypeTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
namespace PHPStan\Analyser;
44

5-
use PHPStan\ShouldNotHappenException;
6-
use PHPStan\Testing\PHPStanTestCase;
75
use PHPStan\Testing\TypeInferenceTestCase;
86

97
class TypeSpecifierContextReturnTypeTest extends TypeInferenceTestCase
108
{
9+
1110
public function dataContextReturnType(): iterable
1211
{
1312
yield from $this->gatherAssertTypes(__DIR__ . '/data/type-specifier-context-return-type.php');
@@ -20,7 +19,7 @@ public function dataContextReturnType(): iterable
2019
public function testContextReturnType(
2120
string $assertType,
2221
string $file,
23-
...$args,
22+
...$args,
2423
): void
2524
{
2625
$this->assertFileAsserts($assertType, $file, ...$args);
@@ -29,7 +28,7 @@ public function testContextReturnType(
2928
public static function getAdditionalConfigFiles(): array
3029
{
3130
return [
32-
__DIR__.'/TypeSpecifierContextReturnTypeExtension.neon'
31+
__DIR__ . '/TypeSpecifierContextReturnTypeExtension.neon',
3332
];
3433
}
3534

tests/PHPStan/Analyser/TypeSpecifierContextReturnTypeExtension.php renamed to tests/PHPStan/Analyser/data/TypeSpecifierContextReturnTypeExtension.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php declare(strict_types = 1);
22

3-
namespace PHPStan\Analyser;
3+
namespace PHPStan\Tests;
44

55
use PhpParser\Node\Expr\MethodCall;
66
use PHPStan\Analyser\Scope;
@@ -9,12 +9,9 @@
99
use PHPStan\Analyser\TypeSpecifierAwareExtension;
1010
use PHPStan\Analyser\TypeSpecifierContext;
1111
use PHPStan\Reflection\MethodReflection;
12-
use PHPStan\Rules\Properties\PropertyReflectionFinder;
13-
use PHPStan\Type\Accessory\HasPropertyType;
14-
use PHPStan\Type\IntersectionType;
1512
use PHPStan\Type\MethodTypeSpecifyingExtension;
16-
use PHPStan\Type\ObjectWithoutClassType;
17-
use PHPStan\Type\StringType;
13+
use TypeSpecifierContextReturnTypeTest\ContextReturnType;
14+
use function str_starts_with;
1815

1916
class TypeSpecifierContextReturnTypeExtension implements MethodTypeSpecifyingExtension, TypeSpecifierAwareExtension
2017
{
@@ -28,7 +25,7 @@ public function setTypeSpecifier(TypeSpecifier $typeSpecifier): void
2825

2926
public function getClass(): string
3027
{
31-
return \TypeSpecifierContextReturnTypeTest\ContextReturnType::class;
28+
return ContextReturnType::class;
3229
}
3330

3431
public function isMethodSupported(

0 commit comments

Comments
 (0)