Skip to content

Commit d7f485c

Browse files
Merge pull request #530 from kamil-tekiela/types-in-Translator
Add native property types in Translator
2 parents f272605 + 28d8b68 commit d7f485c

2 files changed

Lines changed: 9 additions & 14 deletions

File tree

psalm-baseline.xml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -984,12 +984,10 @@
984984
</PossiblyNullArgument>
985985
</file>
986986
<file src="src/Translator.php">
987-
<DocblockTypeContradiction>
988-
<code>self::$loader === null</code>
989-
</DocblockTypeContradiction>
990-
<RedundantConditionGivenDocblockType>
991-
<code>self::$translator !== null</code>
992-
</RedundantConditionGivenDocblockType>
987+
<RedundantPropertyInitializationCheck>
988+
<code>isset(self::$loader)</code>
989+
<code>isset(self::$translator)</code>
990+
</RedundantPropertyInitializationCheck>
993991
</file>
994992
<file src="src/UtfString.php">
995993
<PossiblyUnusedProperty>

src/Translator.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace PhpMyAdmin\SqlParser;
66

77
use PhpMyAdmin\MoTranslator\Loader;
8+
use PhpMyAdmin\MoTranslator\Translator as MoTranslator;
89

910
use function class_exists;
1011

@@ -15,24 +16,20 @@ class Translator
1516
{
1617
/**
1718
* The MoTranslator loader object.
18-
*
19-
* @var Loader
2019
*/
21-
private static $loader;
20+
private static Loader $loader;
2221

2322
/**
2423
* The MoTranslator translator object.
25-
*
26-
* @var \PhpMyAdmin\MoTranslator\Translator
2724
*/
28-
private static $translator;
25+
private static MoTranslator $translator;
2926

3027
/**
3128
* Loads translator.
3229
*/
3330
public static function load(): void
3431
{
35-
if (self::$loader === null) {
32+
if (! isset(self::$loader)) {
3633
// Create loader object
3734
self::$loader = new Loader();
3835

@@ -48,7 +45,7 @@ public static function load(): void
4845
self::$loader->bindtextdomain('sqlparser', __DIR__ . '/../locale/');
4946
}
5047

51-
if (self::$translator !== null) {
48+
if (isset(self::$translator)) {
5249
return;
5350
}
5451

0 commit comments

Comments
 (0)