Skip to content

Commit

Permalink
Improve typehints
Browse files Browse the repository at this point in the history
PHPStan level 6
  • Loading branch information
pawel-slowik committed Sep 26, 2024
1 parent 8991137 commit b6ae065
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 1 deletion.
1 change: 0 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
'php_unit_no_expectation_annotation' => true,
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_strict' => true,
'phpdoc_align' => true, // @Symfony]
'phpdoc_annotation_without_dot' => true, // @Symfony]
'phpdoc_indent' => true, // @Symfony]
'phpdoc_inline_tag_normalizer' => true, // @Symfony]
Expand Down
1 change: 1 addition & 0 deletions src/AutoSoapServer/Documentation/DocumentedService.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function __construct(
}

/**
* @param ClassReflection<object> $class
* @param class-string[] $complexTypeNames
*/
public static function fromClassReflection(string $name, ClassReflection $class, array $complexTypeNames): self
Expand Down
3 changes: 3 additions & 0 deletions src/AutoSoapServer/Documentation/DocumentedType.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public static function fromClassName(string $className): self
);
}

/**
* @param ClassReflection<object> $reflection
*/
private static function getTypeDescription(ClassReflection $reflection): ?string
{
$descriptions = [];
Expand Down
6 changes: 6 additions & 0 deletions src/AutoSoapServer/RoutingConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use AutoSoapServer\Controllers\HomeController;
use AutoSoapServer\Controllers\WsdlController;
use AutoSoapServer\SoapService\SoapServiceRegistry;
use DI\Container;
use Slim\App;
use Slim\Handlers\Strategies\RequestResponseArgs;

Expand All @@ -21,6 +22,11 @@ public function __construct(SoapServiceRegistry $soapServiceRegistry)
$this->soapServiceRegistry = $soapServiceRegistry;
}

/**
* @param App<Container> $app
*
* @return App<Container>
*/
public function apply(App $app): App
{
$strategy = new RequestResponseArgs();
Expand Down
6 changes: 6 additions & 0 deletions tests/RoutingConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/
class RoutingConfigurationTest extends TestCase
{
/**
* @var App<Container>
*/
private App $app;

private SoapServiceRegistry&MockObject $soapServiceRegistry;
Expand Down Expand Up @@ -68,6 +71,9 @@ public function testNamedFromRegistry(string $routeName): void
$this->assertFalse($exceptionThrown);
}

/**
* @return array<array{0: string}>
*/
public static function namedFromRegistryDataProvider(): array
{
return [
Expand Down
1 change: 1 addition & 0 deletions tests/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Type
*/
public $baz;

// @phpstan-ignore missingType.property (purposefully untyped for DocumentedProperty tests)
public $xuz;

/**
Expand Down

0 comments on commit b6ae065

Please sign in to comment.