Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit e5d0781

Browse files
committed
Merge pull request #36 from josecelano/master
Constructors using static instead of self to allow inheritance (late static binding)
2 parents b20ffb6 + eb29a30 commit e5d0781

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Decimal.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static function fromInteger($intValue)
107107
);
108108
}
109109

110-
return new self((string)$intValue, 0);
110+
return new static((string)$intValue, 0);
111111
}
112112

113113
/**
@@ -145,7 +145,7 @@ public static function fromFloat($fltValue, $scale = null, $removeZeros = false)
145145
$strValue = self::removeTrailingZeros($strValue, $scale);
146146
}
147147

148-
return new self($strValue, $scale);
148+
return new static($strValue, $scale);
149149
}
150150

151151
/**
@@ -210,7 +210,7 @@ public static function fromString($strValue, $scale = null, $removeZeros = false
210210
$value = self::removeTrailingZeros($value, $scale);
211211
}
212212

213-
return new self($value, $scale);
213+
return new static($value, $scale);
214214
}
215215

216216
/**
@@ -230,7 +230,7 @@ public static function fromDecimal(Decimal $decValue, $scale = null)
230230
return $decValue;
231231
}
232232

233-
return new self(
233+
return new static(
234234
self::innerRound($decValue->value, $scale),
235235
$scale
236236
);
@@ -566,7 +566,7 @@ public function additiveInverse()
566566
$value = '-' . $this->value;
567567
}
568568

569-
return new self($value, $this->scale);
569+
return new static($value, $this->scale);
570570
}
571571

572572

0 commit comments

Comments
 (0)