| Conditions | 4 |
| Paths | 4 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 54 | public function sequence(int $currentTime) |
||
| 55 | { |
||
| 56 | /* |
||
| 57 | * If swoole lock failure,we return a bit number, This will cause the program to |
||
| 58 | * perform the next millisecond operation. |
||
| 59 | */ |
||
| 60 | if (!$this->lock->trylock()) { |
||
| 61 | if ($this->count >= 10) { |
||
| 62 | throw new \Exception('Swoole lock failure, Unable to get the program lock after many attempts.'); |
||
| 63 | } |
||
| 64 | |||
| 65 | ++$this->count; |
||
| 66 | |||
| 67 | return 999999; |
||
| 68 | } |
||
| 69 | |||
| 70 | if ($this->lastTimeStamp === $currentTime) { |
||
| 71 | ++$this->sequence; |
||
| 72 | } else { |
||
| 73 | $this->sequence = 0; |
||
| 74 | } |
||
| 75 | |||
| 76 | $this->lastTimeStamp = $currentTime; |
||
|
|
|||
| 77 | |||
| 78 | $this->lock->unlock(); |
||
| 79 | |||
| 80 | return $this->sequence; |
||
| 81 | } |
||
| 82 | } |
||
| 83 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..