mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Modernize private property declarations in src/timings
This commit is contained in:
parent
9de88aa734
commit
1d5430937f
@ -34,8 +34,7 @@ use function dechex;
|
||||
abstract class Timings{
|
||||
public const INCLUDED_BY_OTHER_TIMINGS_PREFIX = "** ";
|
||||
|
||||
/** @var bool */
|
||||
private static $initialized = false;
|
||||
private static bool $initialized = false;
|
||||
|
||||
/** @var TimingsHandler */
|
||||
public static $fullTick;
|
||||
|
@ -29,10 +29,8 @@ use function count;
|
||||
use function hrtime;
|
||||
|
||||
class TimingsHandler{
|
||||
/** @var bool */
|
||||
private static $enabled = false;
|
||||
/** @var int */
|
||||
private static $timingStart = 0;
|
||||
private static bool $enabled = false;
|
||||
private static int $timingStart = 0;
|
||||
|
||||
/** @return string[] */
|
||||
public static function printTimings() : array{
|
||||
@ -99,21 +97,13 @@ class TimingsHandler{
|
||||
}
|
||||
}
|
||||
|
||||
/** @var string */
|
||||
private $name;
|
||||
/** @var TimingsHandler|null */
|
||||
private $parent = null;
|
||||
private ?TimingsRecord $record = null;
|
||||
private int $timingDepth = 0;
|
||||
|
||||
/** @var TimingsRecord|null */
|
||||
private $record = null;
|
||||
|
||||
/** @var int */
|
||||
private $timingDepth = 0;
|
||||
|
||||
public function __construct(string $name, ?TimingsHandler $parent = null){
|
||||
$this->name = $name;
|
||||
$this->parent = $parent;
|
||||
}
|
||||
public function __construct(
|
||||
private string $name,
|
||||
private ?TimingsHandler $parent = null
|
||||
){}
|
||||
|
||||
public function getName() : string{ return $this->name; }
|
||||
|
||||
|
@ -36,7 +36,7 @@ final class TimingsRecord{
|
||||
* @var self[]
|
||||
* @phpstan-var array<int, self>
|
||||
*/
|
||||
private static $records = [];
|
||||
private static array $records = [];
|
||||
|
||||
public static function clearRecords() : void{
|
||||
foreach(self::$records as $record){
|
||||
@ -71,26 +71,18 @@ final class TimingsRecord{
|
||||
}
|
||||
}
|
||||
|
||||
/** @var TimingsHandler */
|
||||
private $handler;
|
||||
private int $count = 0;
|
||||
private int $curCount = 0;
|
||||
private int $start = 0;
|
||||
private int $totalTime = 0;
|
||||
private int $curTickTotal = 0;
|
||||
private int $violations = 0;
|
||||
|
||||
/** @var int */
|
||||
private $count = 0;
|
||||
/** @var int */
|
||||
private $curCount = 0;
|
||||
/** @var int */
|
||||
private $start = 0;
|
||||
/** @var int */
|
||||
private $totalTime = 0;
|
||||
/** @var int */
|
||||
private $curTickTotal = 0;
|
||||
/** @var int */
|
||||
private $violations = 0;
|
||||
|
||||
public function __construct(TimingsHandler $handler){
|
||||
self::$records[spl_object_id($this)] = $this;
|
||||
public function __construct(
|
||||
//I'm not the biggest fan of this cycle, but it seems to be the most effective way to avoid leaking anything.
|
||||
$this->handler = $handler;
|
||||
private TimingsHandler $handler
|
||||
){
|
||||
self::$records[spl_object_id($this)] = $this;
|
||||
}
|
||||
|
||||
public function getName() : string{ return $this->handler->getName(); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user