Skip to content

Commit

Permalink
PHP 8.3: Deep-cloning of readonly properties (part 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-boudry committed May 28, 2024
1 parent 67ef646 commit 3b6de2f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Election.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static function setMaxVoteNumber(

// Mechanics
protected ElectionState $State = ElectionState::CANDIDATES_REGISTRATION;
protected Timer_Manager $timer;
protected readonly Timer_Manager $timer;

// Params
protected bool $ImplicitRanking = true;
Expand Down
2 changes: 1 addition & 1 deletion src/ElectionProcess/VotesProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ trait VotesProcess
/////////// CONSTRUCTOR ///////////

// Data and global options
protected VotesManager $Votes; // Votes list
protected readonly VotesManager $Votes; // Votes list
protected int $voteFastMode = 0; // When parsing vote, avoid unnecessary checks


Expand Down
2 changes: 1 addition & 1 deletion src/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function count(): int

protected readonly array $Result;
protected array $ResultIterator;
protected $Stats;
public readonly mixed $Stats;
protected array $warning = [];

#[PublicAPI]
Expand Down
11 changes: 3 additions & 8 deletions src/Timer/Chrono.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ class Chrono
{
use CondorcetVersion;

protected Manager $manager;
protected float $start;
protected readonly Manager $manager;
public readonly float $start;
protected ?string $role = null;

public function __construct(Manager $timer, ?string $role = null)
{
$this->manager = $timer;
$this->setRole($role);
$this->resetStart();
$this->start = microtime(true);
$this->managerStartDeclare();
}

Expand All @@ -44,11 +44,6 @@ public function getTimerManager(): Manager
return $this->manager;
}

protected function resetStart(): void
{
$this->start = microtime(true);
}

public function getRole(): ?string
{
return $this->role;
Expand Down

0 comments on commit 3b6de2f

Please sign in to comment.