diff --git a/CHANGELOG-5.x.md b/CHANGELOG-5.x.md index b743c65c27..c11e6fe325 100644 --- a/CHANGELOG-5.x.md +++ b/CHANGELOG-5.x.md @@ -1,3 +1,8 @@ +#### 5.3.1 + +* Issue 6857: Update Actor::__call() to have return type 'mixed' by @troy-rudolph in #6858 +* Fix auto-injection of the tester property by @W0rma in #6856 + #### 5.3.0 * Update readme.md by @rossaddison in #6834 diff --git a/src/Codeception/Actor.php b/src/Codeception/Actor.php index 01ab32e67f..8c6299b928 100644 --- a/src/Codeception/Actor.php +++ b/src/Codeception/Actor.php @@ -40,7 +40,7 @@ public function wantToTest(string $text): void { } - public function __call(string $method, array $arguments): never + public function __call(string $method, array $arguments): mixed { throw new RuntimeException(sprintf('Call to undefined method %s::%s', static::class, $method)); } diff --git a/src/Codeception/Codecept.php b/src/Codeception/Codecept.php index 5cd7e5d2b8..77df61b93c 100644 --- a/src/Codeception/Codecept.php +++ b/src/Codeception/Codecept.php @@ -36,7 +36,7 @@ class Codecept /** * @var string */ - public const VERSION = '5.3.0'; + public const VERSION = '5.3.1'; protected ResultAggregator $resultAggregator; diff --git a/src/Codeception/Test/Unit.php b/src/Codeception/Test/Unit.php index 05f9d7817e..619c023326 100644 --- a/src/Codeception/Test/Unit.php +++ b/src/Codeception/Test/Unit.php @@ -78,12 +78,11 @@ protected function _setUp() $di = $metadata->getService('di'); // Auto-inject $tester property - if ($actor = $metadata->getCurrent('actor')) { - $suffix = (string) Configuration::config()['actor_suffix']; - $property = lcfirst($suffix); - if (property_exists($this, $property)) { - $this->{$property} = $di->instantiate($actor); - } + if ( + ($actor = $this->getMetadata()->getCurrent('actor')) && + ($property = lcfirst((string) Configuration::config()['actor_suffix'])) + ) { + $this->{$property} = $di->instantiate($actor); } $this->scenario = $di->get(Scenario::class);