| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace PHPStan\PhpDocParser\Printer; |
| 4 | |
| 5 | /** |
| 6 | * Inspired by https://github.com/nikic/PHP-Parser/tree/36a6dcd04e7b0285e8f0868f44bd4927802f7df1 |
| 7 | * |
| 8 | * Copyright (c) 2011, Nikita Popov |
| 9 | * All rights reserved. |
| 10 | * |
| 11 | * Implements the Myers diff algorithm. |
| 12 | * |
| 13 | * @internal |
| 14 | */ |
| 15 | class DiffElem |
| 16 | { |
| 17 | |
| 18 | public const TYPE_KEEP = 0; |
| 19 | public const TYPE_REMOVE = 1; |
| 20 | public const TYPE_ADD = 2; |
| 21 | public const TYPE_REPLACE = 3; |
| 22 | |
| 23 | /** @var self::TYPE_* */ |
| 24 | public $type; |
| 25 | |
| 26 | /** @var mixed Is null for add operations */ |
| 27 | public $old; |
| 28 | |
| 29 | /** @var mixed Is null for remove operations */ |
| 30 | public $new; |
| 31 | |
| 32 | /** |
| 33 | * @param self::TYPE_* $type |
| 34 | * @param mixed $old Is null for add operations |
| 35 | * @param mixed $new Is null for remove operations |
| 36 | */ |
| 37 | public function __construct(int $type, $old, $new) |
| 38 | { |
| 39 | $this->type = $type; |
| 40 | $this->old = $old; |
| 41 | $this->new = $new; |
| 42 | } |
| 43 | |
| 44 | } |