Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3f99b29

Browse files
author
Dominik Liebler
authored
Merge pull request DesignPatternsPHP#478 from MathiasReker/0-self-static-accessor
Self static accessor
2 parents 7b24e11 + 40a4645 commit 3f99b29

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Creational/Singleton/Singleton.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ final class Singleton
1515
*/
1616
public static function getInstance(): Singleton
1717
{
18-
if (static::$instance === null) {
19-
static::$instance = new static();
18+
if (self::$instance === null) {
19+
self::$instance = new self();
2020
}
2121

22-
return static::$instance;
22+
return self::$instance;
2323
}
2424

2525
/**

0 commit comments

Comments
 (0)