Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Dec 18, 2023
1 parent 1ec2931 commit 3bf0433
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# phpstan-todo-by: comments with expiration date
# phpstan-todo-by: comments with expiration date/version

PHPStan extension to check for TODO comments with expiration date.
PHPStan extension to check for TODO comments with expiration date/version.
Inspired by [parker-codes/todo-by](https://github.com/parker-codes/todo_by).

## Example:
Expand All @@ -13,6 +13,11 @@ function doFoo() {

}

// TODO: <1.0.0 This has to be in the first major release
function doBar() {

}

```

## Supported todo formats
Expand Down Expand Up @@ -45,6 +50,9 @@ examples supported as of version 0.1.5:
* @todo 2023-12-14 classic multi line comment
* more comment data
*/

// TODO: <1.0.0 This has to be in the first major release
// TODO >123.4: Must fix this or bump the version
```

## Configuration
Expand All @@ -62,14 +70,15 @@ parameters:

### Reference time

By default comments are checked against todays date.
By default date-todo-comments are checked against todays date.

You might be interested, which comments will expire e.g. within the next 7 days, which can be configured with the `referenceTime` option.
You need to configure a date parsable by `strtotime`.

```neon
parameters:
todo_by:
# any strtotime() compatible string
referenceTime: "now+7days"
```

Expand All @@ -83,6 +92,23 @@ parameters:

`TODOBY_REF_TIME="now+7days" vendor/bin/phpstan analyze`

### Reference version

By default version-todo-comments are checked against `"nextMajor"` version.
This is determined by fetching the latest local available git tag and incrementing the major version number.

This behaviour can be configured with the `referenceVersion` option.
Possible values are `"nextMajor"`, `"nextMinor"`, `"nextPatch"` - which will be computed based on the latest local git tag - or any other version string like `"1.2.3"`.

```neon
parameters:
todo_by:
# "nextMajor", "nextMinor", "nextPatch" or a version string like "1.2.3"
referenceVersion: "nextMinor"
```

As shown in the "Reference time"-paragraph above, you might even use a env variable instead.

## Installation

To use this extension, require it in [Composer](https://getcomposer.org/):
Expand Down

0 comments on commit 3bf0433

Please sign in to comment.