spatie / laravel-short-schedule

Schedule artisan commands to run at a sub-minute frequency
https://freek.dev/1683-a-package-to-schedule-artisan-commands-at-sub-minute-frequencies
MIT License
611 stars 52 forks source link

Replacing call to EventLoop\Factory with call to EventLoop\Loop. Ensuring value of lifetime option is either int of null as required #70

Closed alexongh closed 1 year ago

alexongh commented 1 year ago

This PR contains two small changes to src/Commands/ShortScheduleRunCommand.php

1. Replacing call to React\EventLoop\Factory with call to React\EventLoop\Loop, since Factory is deprecated and suggests usage of Loop.

2. The run method called requires the $lifetime argument to be of type int or null, however this isn't ensured as it could be also string for example. This PR also solves this and ensures that the value passed to the run method is either int or null. This is an issue for people who use this library with Lumen, which requires them to copy the Command to their repository (Docs for usage with Lumen). However, static code analyzers, like PHPStan, will notice that the type passed to run is not guaranteed to be int|null, and will therefore trigger and error.

Solves:

alexongh commented 1 year ago

@freekmurze @AdrianMrn Would be great, if this PR could be reviewed

freekmurze commented 1 year ago

Thank you!

Could you take a look at the failing tests?

freekmurze commented 1 year ago

Closing due to inactivity.