-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace staabm\PHPStanTodoBy; | ||
|
||
interface TagFetcher | ||
{ | ||
public function fetchLatestTagVersion(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace staabm\PHPStanTodoBy\Tests; | ||
|
||
use staabm\PHPStanTodoBy\TagFetcher; | ||
|
||
final class AlwaysThrowingTagFetcher implements TagFetcher { | ||
public function fetchLatestTagVersion(): string | ||
{ | ||
throw new \RuntimeException('Could not determine latest git tag'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace staabm\PHPStanTodoBy\Tests; | ||
|
||
use PHPStan\Rules\Rule; | ||
use PHPStan\Testing\RuleTestCase; | ||
use staabm\PHPStanTodoBy\ReferenceVersionFinder; | ||
use staabm\PHPStanTodoBy\TodoByVersionRule; | ||
|
||
/** | ||
* @extends RuleTestCase<TodoByVersionRule> | ||
*/ | ||
final class TodoByVersionRuleAlwaysThrowingFetchterTest extends RuleTestCase | ||
{ | ||
private string $referenceVersion; | ||
protected function getRule(): Rule | ||
{ | ||
return new TodoByVersionRule(true, new ReferenceVersionFinder($this->referenceVersion, new AlwaysThrowingTagFetcher())); | ||
} | ||
|
||
public function testRule(): void | ||
{ | ||
$this->referenceVersion = "nextMajor"; | ||
|
||
$this->analyse([__DIR__ . '/data/regularComments.php'], []); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace RegularComments; | ||
|
||
// a file comment | ||
|
||
/** | ||
* @return void | ||
*/ | ||
function doFoo() { | ||
// inner function comment | ||
$x = 1; | ||
} |