更新组件
This commit is contained in:
1 parent
5319384a34
commit
eb970fd38f
779 files changed
+19480
-75705
No files matched your search
+14
-14
@@ -194,7 +194,7 @@ class Complex
|
||||
*
|
||||
* @return Float
|
||||
*/
|
||||
public function getReal()
|
||||
public function getReal(): float
|
||||
{
|
||||
return $this->realPart;
|
||||
}
|
||||
@@ -204,7 +204,7 @@ class Complex
|
||||
*
|
||||
* @return Float
|
||||
*/
|
||||
public function getImaginary()
|
||||
public function getImaginary(): float
|
||||
{
|
||||
return $this->imaginaryPart;
|
||||
}
|
||||
@@ -214,7 +214,7 @@ class Complex
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public function getSuffix()
|
||||
public function getSuffix(): string
|
||||
{
|
||||
return $this->suffix;
|
||||
}
|
||||
@@ -224,7 +224,7 @@ class Complex
|
||||
*
|
||||
* @return Bool
|
||||
*/
|
||||
public function isReal()
|
||||
public function isReal(): bool
|
||||
{
|
||||
return $this->imaginaryPart == 0.0;
|
||||
}
|
||||
@@ -234,12 +234,12 @@ class Complex
|
||||
*
|
||||
* @return Bool
|
||||
*/
|
||||
public function isComplex()
|
||||
public function isComplex(): bool
|
||||
{
|
||||
return !$this->isReal();
|
||||
}
|
||||
|
||||
public function format()
|
||||
public function format(): string
|
||||
{
|
||||
$str = "";
|
||||
if ($this->imaginaryPart != 0.0) {
|
||||
@@ -262,7 +262,7 @@ class Complex
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->format();
|
||||
}
|
||||
@@ -274,7 +274,7 @@ class Complex
|
||||
* @return Complex
|
||||
* @throws Exception If the argument isn't a Complex number or cannot be converted to one
|
||||
*/
|
||||
public static function validateComplexArgument($complex)
|
||||
public static function validateComplexArgument($complex): Complex
|
||||
{
|
||||
if (is_scalar($complex) || is_array($complex)) {
|
||||
$complex = new Complex($complex);
|
||||
@@ -290,7 +290,7 @@ class Complex
|
||||
*
|
||||
* @return Complex
|
||||
*/
|
||||
public function reverse()
|
||||
public function reverse(): Complex
|
||||
{
|
||||
return new Complex(
|
||||
$this->imaginaryPart,
|
||||
@@ -299,7 +299,7 @@ class Complex
|
||||
);
|
||||
}
|
||||
|
||||
public function invertImaginary()
|
||||
public function invertImaginary(): Complex
|
||||
{
|
||||
return new Complex(
|
||||
$this->realPart,
|
||||
@@ -308,7 +308,7 @@ class Complex
|
||||
);
|
||||
}
|
||||
|
||||
public function invertReal()
|
||||
public function invertReal(): Complex
|
||||
{
|
||||
return new Complex(
|
||||
$this->realPart * -1,
|
||||
@@ -376,15 +376,15 @@ class Complex
|
||||
$functionName = strtolower(str_replace('_', '', $functionName));
|
||||
|
||||
// Test for function calls
|
||||
if (in_array($functionName, self::$functions)) {
|
||||
if (in_array($functionName, self::$functions, true)) {
|
||||
$functionName = "\\" . __NAMESPACE__ . "\\{$functionName}";
|
||||
return $functionName($this, ...$arguments);
|
||||
}
|
||||
// Test for operation calls
|
||||
if (in_array($functionName, self::$operations)) {
|
||||
if (in_array($functionName, self::$operations, true)) {
|
||||
$functionName = "\\" . __NAMESPACE__ . "\\{$functionName}";
|
||||
return $functionName($this, ...$arguments);
|
||||
}
|
||||
throw new Exception('Function or Operation does not exist');
|
||||
throw new Exception('Complex Function or Operation does not exist');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user