forked from nowiko/AliceBundle
-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Ensure the database is not populated several times in PHP 8.2 (#43)
In PHP 8.2 static properties declared in traits behaves as if they were declared in the class using the trait, hence it will no longer be shared between classes using this trait. Closes #42. This PR is another take of #42 where the state is kept within an internal constant instead as a constant would mean introducing global state that cannot be mutated which I am not too found of. --------- Co-authored-by: TRAVIS | Mark <[email protected]>
- Loading branch information
1 parent
4df65fd
commit 841ac01
Showing
2 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Hautelook\AliceBundle package. | ||
* | ||
* (c) Baldur Rensch <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Hautelook\AliceBundle\PhpUnit; | ||
|
||
final class RefreshDatabaseState | ||
{ | ||
private static bool $dbPopulated = false; | ||
|
||
public static function setDbPopulated(bool $populated): void | ||
{ | ||
self::$dbPopulated = $populated; | ||
} | ||
|
||
public static function isDbPopulated(): bool | ||
{ | ||
return self::$dbPopulated; | ||
} | ||
|
||
private function __construct() | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters