vangelis/todoordie

Write TODOs in code that ensure you actually do them

v0.0.2 2024-10-20 20:06 UTC

This package is auto-updated.

Last update: 2025-04-05 11:26:35 UTC


README

Latest Version on Packagist Tests Total Downloads

Keep your projects clean

To understand why you would ever call a function to write a comment, read on.

If you have some code you know you'll need to change later, don't just leave a comment for later that you'll never read, ever again.

For all the following cases, forgetting a TODO is NOT GOOD:

  • remove some code when the dependency support expires,
  • remove a feature flag,
  • update some code related to another project,
  • update a dependency when another refactoring is done,
  • ...

This can lead to nasty issues so make your TODOs speak up when they need to with this module ;)

You can now replace your simple comment with this function that will raise and error when the time or the condition are met and remind you to do something about it.

Caution

This can cause some production apps to break ! This code is named todoordie, not todo_and_kittens so be careful.

Pull-Requests are welcome to make this more production-ready !

Note this module has no warranty, see the LICENSE !

Installation

You can install the package via composer:

composer require vangelis/todoordie

Usage

This will raise an error if the date is reached or passed:

use Vangelis\TodoOrDie\TodoOrDie;

TodoOrDie::check('Test task', '2023-01-01');

This will not raise an error until the condition is met (in about 75 years):

use Vangelis\TodoOrDie\TodoOrDie;

TodoOrDie::check('Test task', '2099-01-01');

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.