Skip to content

Commit

Permalink
move the test to rule tests
Browse files Browse the repository at this point in the history
  • Loading branch information
canvural committed Dec 1, 2024
1 parent 447d581 commit 6bdd65a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 37 deletions.
35 changes: 0 additions & 35 deletions tests/PHPStan/Analyser/WeirdBugTest.php

This file was deleted.

37 changes: 37 additions & 0 deletions tests/PHPStan/Rules/Functions/WeirdBugTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php declare(strict_types = 1);

namespace PHPStan\Rules\Functions;

use PHPStan\Rules\FunctionReturnTypeCheck;
use PHPStan\Rules\Rule;
use PHPStan\Rules\RuleLevelHelper;
use PHPStan\Testing\RuleTestCase;

/**
* @extends RuleTestCase<ClosureReturnTypeRule>
*/
class WeirdBugTest extends RuleTestCase
{

protected function getRule(): Rule
{
return new ClosureReturnTypeRule(new FunctionReturnTypeCheck(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, true, false)));
}

public function testClosureReturnTypeRule(): void
{
if (PHP_VERSION_ID < 80000) {
$this->markTestSkipped('Test requires PHP 8.0');
}

$this->analyse([__DIR__ . '/data/weird-bug-test.php'], []);
}

public static function getAdditionalConfigFiles(): array
{
return [
__DIR__ . '/data/weird-bug-config.neon',
];
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Model {
*/
public static function getBuilder(): Builder
{
return new Builder(new static()); // @phpstan-ignore-line
return new Builder(new static());
}
}

Expand All @@ -24,7 +24,7 @@ class Builder {
/**
* @param T $model
*/
public function __construct(private Model $model) // @phpstan-ignore-line
public function __construct(private Model $model)
{
}

Expand Down

0 comments on commit 6bdd65a

Please sign in to comment.