Skip to content

Commit

Permalink
Fix: Use list in DocBlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Jun 16, 2024
1 parent d32cd50 commit 0dca576
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
6 changes: 4 additions & 2 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.24.0@462c80e31c34e58cc4f750c656be3927e80e550e">
<file src="src/Constructs.php">
<MixedArgumentTypeCoercion>
<ArgumentTypeCoercion>
<code><![CDATA[$constructsWithMultipleDefinitions]]></code>
</ArgumentTypeCoercion>
<MixedArgumentTypeCoercion>
<code><![CDATA[\usort($constructs, static function (Construct $a, Construct $b): int {
return \strcmp(
$a->name(),
Expand All @@ -20,7 +22,7 @@
</MixedMethodCall>
<MixedReturnTypeCoercion>
<code><![CDATA[\array_values($constructs)]]></code>
<code><![CDATA[array<int, Construct>]]></code>
<code><![CDATA[list<Construct>]]></code>
</MixedReturnTypeCoercion>
<RedundantFunctionCall>
<code><![CDATA[\array_values]]></code>
Expand Down
4 changes: 2 additions & 2 deletions src/Construct.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
final class Construct
{
/**
* @var array<int, string>
* @var list<string>
*/
private array $fileNames = [];

Expand Down Expand Up @@ -53,7 +53,7 @@ public function name(): string
/**
* Returns an array of file names in which the construct is defined.
*
* @return array<int, string>
* @return list<string>
*/
public function fileNames(): array
{
Expand Down
4 changes: 2 additions & 2 deletions src/Constructs.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class Constructs
*
* @throws Exception\ParseError
*
* @return array<int, Construct>
* @return list<Construct>
*/
public static function fromSource(string $source): array
{
Expand Down Expand Up @@ -116,7 +116,7 @@ public static function fromSource(string $source): array
* @throws Exception\DirectoryDoesNotExist
* @throws Exception\MultipleDefinitionsFound
*
* @return array<int, Construct>
* @return list<Construct>
*/
public static function fromDirectory(string $directory): array
{
Expand Down
6 changes: 3 additions & 3 deletions src/Exception/MultipleDefinitionsFound.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
final class MultipleDefinitionsFound extends \RuntimeException implements ExceptionInterface
{
/**
* @var array<int, Construct>
* @var list<Construct>
*/
private array $constructs = [];

/**
* Returns a new exception from constructs.
*
* @param array<int, Construct> $constructs
* @param list<Construct> $constructs
*/
public static function fromConstructs(array $constructs): self
{
Expand All @@ -48,7 +48,7 @@ public static function fromConstructs(array $constructs): self
/**
* Returns an array of constructs.
*
* @return array<int, Construct>
* @return list<Construct>
*/
public function constructs(): array
{
Expand Down
2 changes: 1 addition & 1 deletion test/Unit/ConstructsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public function testFromDirectoryThrowsMultipleDefinitionsFoundIfMultipleDefinit
}

/**
* @return array<int, Test\Util\Scenario>
* @return list<Test\Util\Scenario>
*/
private static function scenariosWithClassyConstructs(): array
{
Expand Down
4 changes: 2 additions & 2 deletions test/Util/Scenario.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class Scenario
private readonly string $fileContent;

/**
* @var array<int, Classy\Construct>
* @var list<Classy\Construct>
*/
private readonly array $constructs;

Expand Down Expand Up @@ -114,7 +114,7 @@ public function source(): string
}

/**
* @return array<int, Classy\Construct>
* @return list<Classy\Construct>
*/
public function constructsSortedByName(): array
{
Expand Down

0 comments on commit 0dca576

Please sign in to comment.