Skip to content

Commit

Permalink
qa: add return types to some functions
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilian Bösing <[email protected]>
  • Loading branch information
boesing committed Sep 14, 2021
1 parent 1e4a3d3 commit 69bc237
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@
<InternalMethod occurrences="1">
<code>getContainer</code>
</InternalMethod>
<InvalidArgument occurrences="6"/>
<InvalidArgument occurrences="5"/>
<MissingClosureParamType occurrences="14">
<code>$callback</code>
<code>$container</code>
Expand Down
3 changes: 2 additions & 1 deletion test/AbstractPluginManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,11 @@ public function testValidateWillFallBackToValidatePluginWhenDefinedAndEmitDeprec
$pluginManager->assertion = $assertion;

$errorHandlerCalled = false;
set_error_handler(function (int $errno, string $errmsg) use (&$errorHandlerCalled) {
set_error_handler(function (int $errno, string $errmsg) use (&$errorHandlerCalled): bool {
$this->assertEquals(E_USER_DEPRECATED, $errno);
$this->assertStringContainsString('3.0', $errmsg);
$errorHandlerCalled = true;
return true;
}, E_USER_DEPRECATED);
$pluginManager->validate($instance);
restore_error_handler();
Expand Down
6 changes: 3 additions & 3 deletions test/CommonServiceLocatorBehaviorsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ public function testCanConfigureAllServiceTypes(): void
],
'delegators' => [
stdClass::class => [
function (ContainerInterface $container, string $name, callable $callback) {
function (ContainerInterface $container, string $name, callable $callback): object {
$instance = $callback();
self::assertInstanceOf(stdClass::class, $instance);
$instance->foo = 'bar';
Expand Down Expand Up @@ -921,9 +921,9 @@ public function testAllowOverrideFlagIsMutable(ServiceManager $container): void
public function testCanRetrieveParentContainerViaGetServiceLocatorWithDeprecationNotice(): void
{
$container = $this->createContainer();
/** @psalm-suppress InvalidArgument */
set_error_handler(function (int $errno) {
set_error_handler(function (int $errno): bool {
$this->assertEquals(E_USER_DEPRECATED, $errno);
return true;
}, E_USER_DEPRECATED);
$this->assertSame($this->creationContext, $container->getServiceLocator());
restore_error_handler();
Expand Down

0 comments on commit 69bc237

Please sign in to comment.