Skip to content

Commit

Permalink
Revert "Fix internal phpstan error"
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Mar 4, 2024
1 parent 6ad823e commit 35c8172
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
8 changes: 4 additions & 4 deletions phpstan-without-extension-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ parameters:

-
message: "#^Call to an undefined method Prophecy\\\\Prophecy\\\\ObjectProphecy\\:\\:doubleTheNumber\\(\\)\\.$#"
count: 2
count: 1
path: test/StaticAnalysis/Test/ObjectProphecy/ProphesizeTest.php

-
message: "#^Call to an undefined method Prophecy\\\\Prophecy\\\\ObjectProphecy\\:\\:getFoo\\(\\)\\.$#"
count: 2
count: 1
path: test/StaticAnalysis/Test/ObjectProphecy/ProphesizeTest.php

-
message: "#^Call to an undefined method object\\:\\:doubleTheNumber\\(\\)\\.$#"
count: 2
count: 1
path: test/StaticAnalysis/Test/ObjectProphecy/ProphesizeTest.php

-
message: "#^Call to an undefined method object\\:\\:getFoo\\(\\)\\.$#"
count: 2
count: 1
path: test/StaticAnalysis/Test/ObjectProphecy/ProphesizeTest.php

-
Expand Down
4 changes: 4 additions & 0 deletions src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ public function getTypeFromMethodCall(

$className = $argumentType->getValue();

if (!$returnType instanceof Type\TypeWithClassName) {
throw new ShouldNotHappenException();

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 6.0.0, lowest)

Instantiated class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException not found.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 6.0.0, lowest)

Throwing object of an unknown class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 6.0.0, locked)

Instantiated class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException not found.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 6.0.0, locked)

Throwing object of an unknown class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 6.0.0, highest)

Instantiated class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException not found.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 6.0.0, highest)

Throwing object of an unknown class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 7.0.0, lowest)

Instantiated class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException not found.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 7.0.0, lowest)

Throwing object of an unknown class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 7.0.0, locked)

Instantiated class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException not found.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 7.0.0, locked)

Throwing object of an unknown class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 7.0.0, highest)

Instantiated class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException not found.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 7.0.0, highest)

Throwing object of an unknown class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 8.0.0, lowest)

Instantiated class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException not found.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 8.0.0, lowest)

Throwing object of an unknown class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 8.0.0, locked)

Instantiated class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException not found.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 8.0.0, locked)

Throwing object of an unknown class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 8.0.0, highest)

Instantiated class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException not found.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 8.0.0, highest)

Throwing object of an unknown class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 9.0.0, lowest)

Instantiated class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException not found.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 9.0.0, lowest)

Throwing object of an unknown class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 9.0.0, locked)

Instantiated class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException not found.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 9.0.0, locked)

Throwing object of an unknown class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 9.0.0, highest)

Instantiated class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException not found.

Check failure on line 69 in src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (7.4, 9.0.0, highest)

Throwing object of an unknown class JanGregor\Prophecy\Type\Prophet\ShouldNotHappenException.
}

if ('static' === $className) {
return $returnType;
}
Expand Down
19 changes: 0 additions & 19 deletions test/StaticAnalysis/Test/ObjectProphecy/ProphesizeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use JanGregor\Prophecy\Test\StaticAnalysis\Src;
use PHPUnit\Framework;
use Prophecy\Argument;
use Prophecy\Prophet;

/**
* @internal
Expand Down Expand Up @@ -84,24 +83,6 @@ public function testCreateProphecyInHelperMethod(): void
self::assertEquals(5, $testDouble->doubleTheNumber(2));
}

public function testCreateProphecyInline(): void
{
$prophecy = (new Prophet())->prophesize(Src\BaseModel::class);

$prophecy
->getFoo()
->willReturn('bar');

$prophecy
->doubleTheNumber(Argument::is(2))
->willReturn(5);

$testDouble = $prophecy->reveal();

self::assertEquals('bar', $testDouble->getFoo());
self::assertEquals(5, $testDouble->doubleTheNumber(2));
}

private function createProphecy()
{
return $this->prophesize(Src\BaseModel::class);
Expand Down

0 comments on commit 35c8172

Please sign in to comment.