Skip to content

Commit ecd367a

Browse files
authored
Merge pull request #119 from localheinz/fix/side-effects
Fix: Method invocations on methods of ObjectProphecy might have side effects
2 parents 3d73704 + 192ca31 commit ecd367a

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ For a full diff see [`0.6.0...0.6.1`][0.6.0...0.6.1].
1515
### Changed
1616

1717
* Marked classes as `final` ([#118]), by [@localheinz]
18+
* Modified return value of `ObjectPropecyMethodReflection::hasSideEffects()` as invoking methods on an instance of `Prophecy\Prophecy\ObjectProphecy` might have side effects ([#119]), by [@localheinz]
1819

1920
## [`0.6.0`][0.6.0]
2021

@@ -105,6 +106,7 @@ For a full diff see [`afd6fd9...0.1`][afd6fd9...0.1].
105106
[#92]: https://github.com/Jan0707/phpstan-prophecy/pull/92
106107
[#94]: https://github.com/Jan0707/phpstan-prophecy/pull/94
107108
[#118]: https://github.com/Jan0707/phpstan-prophecy/pull/118
109+
[#119]: https://github.com/Jan0707/phpstan-prophecy/pull/119
108110

109111
[@localheinz]: https://github.com/localheinz
110112
[@PedroTroller]: https://github.com/PedroTroller

src/Reflection/ObjectProphecyMethodReflection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function getThrowType(): ?Type\Type
100100

101101
public function hasSideEffects(): TrinaryLogic
102102
{
103-
return TrinaryLogic::createNo();
103+
return TrinaryLogic::createMaybe();
104104
}
105105

106106
public function getDocComment(): ?string

tests/Unit/Reflection/ObjectProphecyMethodReflectionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function testDefaults(): void
6464
];
6565

6666
self::assertEquals($variants, $reflection->getVariants());
67-
self::assertTrue($reflection->hasSideEffects()->equals(TrinaryLogic::createNo()));
67+
self::assertTrue($reflection->hasSideEffects()->equals(TrinaryLogic::createMaybe()));
6868
self::assertTrue($reflection->isDeprecated()->equals(TrinaryLogic::createNo()));
6969
self::assertTrue($reflection->isInternal()->equals(TrinaryLogic::createNo()));
7070
self::assertFalse($reflection->isPrivate());

0 commit comments

Comments
 (0)