| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Yatra\Upgrades; |
| 6 |
|
| 7 |
use Yatra\Upgrades\Contracts\UpgradeStepInterface; |
| 8 |
|
| 9 |
/** |
| 10 |
* Default {@see UpgradeStepInterface::shouldApply()}: run only when crossing this target from below. |
| 11 |
*/ |
| 12 |
abstract class AbstractUpgradeStep implements UpgradeStepInterface |
| 13 |
{ |
| 14 |
public static function shouldApply(string $fromVersion, string $toVersion): bool |
| 15 |
{ |
| 16 |
return version_compare($fromVersion, static::targetVersion(), '<') |
| 17 |
&& version_compare($toVersion, static::targetVersion(), '>='); |
| 18 |
} |
| 19 |
} |
| 20 |
|