Skip to content

Commit

Permalink
cleanup type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
verfriemelt-dot-org committed Jul 9, 2023
1 parent 4944190 commit d6dd6e1
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/Rule/Assertion/Declaration/DeclarationAssertion.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

abstract class DeclarationAssertion implements Assertion
{
/** @var array<array{string, SelectorInterface, array<SelectorInterface>, array<SelectorInterface>, array<SelectorInterface>}> */
/** @var array<array{string, SelectorInterface, array<SelectorInterface>, string[]}> */
protected array $statements;
protected Configuration $configuration;
protected ReflectionProvider $reflectionProvider;
Expand Down
2 changes: 2 additions & 0 deletions src/Rule/Assertion/Declaration/ValidationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
trait ValidationTrait
{
/**
* @param string[] $tips
* @throws ShouldNotHappenException
* @return array<RuleError>
*/
Expand All @@ -35,6 +36,7 @@ protected function applyShould(string $ruleName, ClassReflection $subject, bool
}

/**
* @param string[] $tips
* @throws ShouldNotHappenException
* @return array<RuleError>
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Statement/Builder/DeclarationStatementBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class DeclarationStatementBuilder implements StatementBuilder
{
/** @var array<array{string, SelectorInterface, array<SelectorInterface>}> */
/** @var array<array{string, SelectorInterface, array<SelectorInterface>, string[]}> */
protected $statements = [];
/** @var array<RelationRule> */
protected array $rules;
Expand All @@ -30,7 +30,7 @@ final public function __construct(string $assertion, array $rules)
}

/**
* @return array<array{string, SelectorInterface, array<SelectorInterface>}>
* @return array<array{string, SelectorInterface, array<SelectorInterface>, string[]}>
*/
public function build(): array
{
Expand Down Expand Up @@ -58,7 +58,7 @@ private function addStatement(

/**
* @param array<Rule> $rules
* @return array<array{string, SelectorInterface, array<SelectorInterface>}>
* @return array<array{string, SelectorInterface, array<SelectorInterface>, string[]}>
*/
private function extractCurrentAssertion(array $rules): array
{
Expand Down
15 changes: 7 additions & 8 deletions tests/unit/tips/Declaration/MultipleTipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@

namespace Tests\PHPat\unit\tips\Declaration;

use Attribute;
use PHPat\Configuration;
use PHPat\Rule\Assertion\Declaration\ShouldBeFinal\IsFinalRule;
use PHPat\Rule\Assertion\Declaration\ShouldBeFinal\ShouldBeFinal;
use PHPat\Rule\Assertion\Relation\CanOnlyDepend\CanOnlyDepend;
use PHPat\Rule\Assertion\Relation\CanOnlyDepend\ClassAttributeRule;
use PHPat\Selector\Classname;
use PHPat\Statement\Builder\StatementBuilderFactory;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use PHPStan\Type\FileTypeMapper;
use Tests\PHPat\fixtures\FixtureClass;
use Tests\PHPat\fixtures\Simple\SimpleAttribute;
use Tests\PHPat\unit\FakeTestParser;

use function sprintf;

use Tests\PHPat\fixtures\FixtureClass;

use Tests\PHPat\unit\FakeTestParser;

/**
* @extends RuleTestCase<ClassAttributeRule>
*/
Expand All @@ -34,9 +33,9 @@ public function testRule(): void
sprintf('%s should be final', FixtureClass::class),
31,
<<<TIPS
• tip #1
• tip #2
TIPS,
• tip #1
• tip #2
TIPS,
],
]);
}
Expand Down
9 changes: 4 additions & 5 deletions tests/unit/tips/Declaration/NoTipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@

namespace Tests\PHPat\unit\tips\Declaration;

use Attribute;
use PHPat\Configuration;
use PHPat\Rule\Assertion\Declaration\ShouldBeFinal\IsFinalRule;
use PHPat\Rule\Assertion\Declaration\ShouldBeFinal\ShouldBeFinal;
use PHPat\Rule\Assertion\Relation\CanOnlyDepend\CanOnlyDepend;
use PHPat\Rule\Assertion\Relation\CanOnlyDepend\ClassAttributeRule;
use PHPat\Selector\Classname;
use PHPat\Statement\Builder\StatementBuilderFactory;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use PHPStan\Type\FileTypeMapper;
use Tests\PHPat\fixtures\FixtureClass;
use Tests\PHPat\fixtures\Simple\SimpleAttribute;
use Tests\PHPat\unit\FakeTestParser;

use function sprintf;

use Tests\PHPat\fixtures\FixtureClass;

use Tests\PHPat\unit\FakeTestParser;

/**
* @extends RuleTestCase<ClassAttributeRule>
*/
Expand Down
11 changes: 5 additions & 6 deletions tests/unit/tips/Declaration/OneTipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@

namespace Tests\PHPat\unit\tips\Declaration;

use Attribute;
use PHPat\Configuration;
use PHPat\Rule\Assertion\Declaration\ShouldBeFinal\IsFinalRule;
use PHPat\Rule\Assertion\Declaration\ShouldBeFinal\ShouldBeFinal;
use PHPat\Rule\Assertion\Relation\CanOnlyDepend\CanOnlyDepend;
use PHPat\Rule\Assertion\Relation\CanOnlyDepend\ClassAttributeRule;
use PHPat\Selector\Classname;
use PHPat\Statement\Builder\StatementBuilderFactory;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use PHPStan\Type\FileTypeMapper;
use Tests\PHPat\fixtures\FixtureClass;
use Tests\PHPat\fixtures\Simple\SimpleAttribute;
use Tests\PHPat\unit\FakeTestParser;

use function sprintf;

use Tests\PHPat\fixtures\FixtureClass;

use Tests\PHPat\unit\FakeTestParser;

/**
* @extends RuleTestCase<ClassAttributeRule>
*/
Expand All @@ -33,7 +32,7 @@ public function testRule(): void
[
sprintf('%s should be final', FixtureClass::class),
31,
'tip #1'
'tip #1',
],
]);
}
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/tips/Relation/MultipleTipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use PHPStan\Type\FileTypeMapper;

use function sprintf;

use Tests\PHPat\fixtures\FixtureClass;
use Tests\PHPat\fixtures\Simple\SimpleAttribute;
use Tests\PHPat\unit\FakeTestParser;

use function sprintf;
use Tests\PHPat\unit\FakeTestParser;

/**
* @extends RuleTestCase<ClassAttributeRule>
Expand Down

0 comments on commit d6dd6e1

Please sign in to comment.