Skip to content

Commit

Permalink
Change 'number' to int-float type hint in PHPDoc comments: Issue 456.
Browse files Browse the repository at this point in the history
  • Loading branch information
markrogoyski committed Dec 31, 2022
1 parent 75771ae commit d347007
Show file tree
Hide file tree
Showing 32 changed files with 97 additions and 97 deletions.
14 changes: 7 additions & 7 deletions src/Expression/Piecewise.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@ private function constructorPreconditions(array $intervals, array $functions)
* Check the as and bs in the intervals
* Helper method of constructor.
*
* @param number $a
* @param number $b
* @param number $lastA
* @param number $lastB
* @param bool $lastBOpen
* @param bool $aOpen
* @param bool $bOpen
* @param int|float $a
* @param int|float $b
* @param int|float $lastA
* @param int|float $lastB
* @param bool $lastBOpen
* @param bool $aOpen
* @param bool $bOpen
*
* @return void
*
Expand Down
2 changes: 1 addition & 1 deletion src/Expression/Polynomial.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function __toString(): string
* echo $polynomial(4);
* // prints -13
*
* @param number $x₀ The value at which we are evaluating our polynomial
* @param int|float $x₀ The value at which we are evaluating our polynomial
*
* @return float The result of our polynomial evaluated at $x₀
*/
Expand Down
28 changes: 14 additions & 14 deletions src/Functions/Map/Single.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class Single
/**
* Map addition
*
* @param array $xs
* @param number $k Number to add to each element
* @param array $xs
* @param int|float $k Number to add to each element
*
* @return array
*/
Expand All @@ -30,8 +30,8 @@ function ($x) use ($k) {
/**
* Map subtract
*
* @param array $xs
* @param number $k Number to subtract from each element
* @param array $xs
* @param int|float $k Number to subtract from each element
*
* @return array
*/
Expand All @@ -48,8 +48,8 @@ function ($x) use ($k) {
/**
* Map multiply
*
* @param array $xs
* @param number $k Number to multiply to each element
* @param array $xs
* @param int|float $k Number to multiply to each element
*
* @return array
*/
Expand All @@ -66,8 +66,8 @@ function ($x) use ($k) {
/**
* Map Divide
*
* @param array $xs
* @param number $k Number to divide each element by
* @param array $xs
* @param int|float $k Number to divide each element by
*
* @return array
*/
Expand Down Expand Up @@ -148,8 +148,8 @@ function ($x) {
/**
* Map raise to a power
*
* @param array $xs
* @param number $n
* @param array $xs
* @param int|float $n
*
* @return array
*/
Expand Down Expand Up @@ -202,8 +202,8 @@ function ($x) {
* Each element in array is compared against the value,
* and the min of each is returned.
*
* @param array $xs
* @param number $value
* @param array $xs
* @param int|float $value
*
* @return array
*/
Expand All @@ -222,8 +222,8 @@ function ($x) use ($value) {
* Each element in the array is compared against the value,
* and the max of each is returned.
*
* @param array $xs
* @param number $value
* @param array $xs
* @param int|float $value
*
* @return array
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Functions/Special.php
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ public static function erf(float $x): float
* Complementary error function (erfc)
* erfc(x) ≡ 1 - erf(x)
*
* @param number $x
* @param int|float $x
*
* @return float
*/
Expand Down
4 changes: 2 additions & 2 deletions src/InformationTheory/Entropy.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ public static function jointEntropy(array $P⟮x、y⟯)
*
* H is in shannons, or bits.
*
* @param array $p probability distribution
* @param number $α order α
* @param array $p probability distribution
* @param int|float $α order α
*
* @return float
*
Expand Down
2 changes: 1 addition & 1 deletion src/LinearAlgebra/MatrixCatalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public function getSVD(): Decomposition\SVD
// DETERMINANT

/**
* @param number $det
* @param int|float $det
*/
public function addDeterminant($det): void
{
Expand Down
8 changes: 4 additions & 4 deletions src/LinearAlgebra/MatrixFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class MatrixFactory
/**
* Factory method
*
* @param number[][] $A 2-dimensional array of Matrix data
* @param float|null $ε Optional error tolerance
* @param int[][]|float[][]|Complex[][]|object[][] $A 2-dimensional array of Matrix data
* @param float|null $ε Optional error tolerance
*
* @return Matrix
*
Expand Down Expand Up @@ -46,8 +46,8 @@ public static function create(array $A, ?float $ε = null): Matrix
}

/**
* @param number[][] $A
* @param float|null $ε Optional error tolerance
* @param int[][]|float[][] $A
* @param float|null $ε Optional error tolerance
*
* @return NumericMatrix
*
Expand Down
8 changes: 4 additions & 4 deletions src/LinearAlgebra/Vector.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ public function divide(Vector $B): Vector
* Scalar multiplication (scale)
* kA = [k * a₁, k * a₂, k * a₃ ...]
*
* @param number $k Scale factor
* @param int|float $k Scale factor
*
* @return Vector
*/
Expand All @@ -440,7 +440,7 @@ public function scalarMultiply($k): Vector
* Scalar divide
* kA = [k / a₁, k / a₂, k / a₃ ...]
*
* @param number $k Scale factor
* @param int|float $k Scale factor
*
* @return Vector
*/
Expand Down Expand Up @@ -692,9 +692,9 @@ public function l2Norm()
*
* |x|p = (∑|xᵢ|ᵖ)¹/ᵖ
*
* @param number $p
* @param int|float $p
*
* @return number
* @return int|float
*/
public function pNorm($p)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Number/Complex.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class Complex implements ObjectArithmetic
/**
* Constructor
*
* @param number $r Real part
* @param number $i Imaginary part
* @param int|float $r Real part
* @param int|float $i Imaginary part
*/
public function __construct($r, $i)
{
Expand Down Expand Up @@ -383,7 +383,7 @@ public function divide($c): Complex
* - https://en.wikipedia.org/wiki/Complex_number#Exponentiation
* - https://mathworld.wolfram.com/ComplexExponentiation.html
*
* @param Complex|number $c
* @param Complex|int|float $c
*
* @return Complex
*
Expand Down
8 changes: 4 additions & 4 deletions src/Number/Quaternion.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class Quaternion implements ObjectArithmetic
const EPSILON = 1e-6;

/**
* @param number $r Real part
* @param number $i Imaginary part
* @param number $j Imaginary part
* @param number $k Imaginary part
* @param int|float $r Real part
* @param int|float $i Imaginary part
* @param int|float $j Imaginary part
* @param int|float $k Imaginary part
*/
public function __construct($r, $i, $j, $k)
{
Expand Down
2 changes: 1 addition & 1 deletion src/NumericalAnalysis/Interpolation/ClampedCubicSpline.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ClampedCubicSpline extends Interpolation
* (point) contains precisely three numbers: x, y, and y'
* Example array: [[1,2,1], [2,3,0], [3,4,2]].
* Example callback: function($x) {return $x**2;}
* @param number ...$args (Optional) An additional callback: our first derivative,
* @param int|float ...$args (Optional) An additional callback: our first derivative,
* and arguments of our callback functions: start,
* end, and n.
* Example: approximate($source, $derivative, 0, 8, 5).
Expand Down
2 changes: 1 addition & 1 deletion src/NumericalAnalysis/Interpolation/LagrangePolynomial.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class LagrangePolynomial extends Interpolation
* (point) contains precisely two numbers, an x and y.
* Example array: [[1,2], [2,3], [3,4]].
* Example callback: function($x) {return $x**2;}
* @param number ...$args The arguments of our callback function: start,
* @param int|float ...$args The arguments of our callback function: start,
* end, and n. Example: approximate($source, 0, 8, 5).
* If $source is a set of points, do not input any
* $args. Example: approximate($source).
Expand Down
2 changes: 1 addition & 1 deletion src/NumericalAnalysis/Interpolation/NaturalCubicSpline.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class NaturalCubicSpline extends Interpolation
* (point) contains precisely two numbers, an x and y.
* Example array: [[1,2], [2,3], [3,4]].
* Example callback: function($x) {return $x**2;}
* @param number ...$args The arguments of our callback function: start,
* @param int|float ...$args The arguments of our callback function: start,
* end, and n. Example: approximate($source, 0, 8, 5).
* If $source is a set of points, do not input any
* $args. Example: approximate($source).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class NewtonPolynomialForward extends Interpolation
* (point) contains precisely two numbers, an x and y.
* Example array: [[1,2], [2,3], [3,4]].
* Example callback: function($x) {return $x**2;}
* @param number ...$args The arguments of our callback function: start,
* @param int|float ...$args The arguments of our callback function: start,
* end, and n. Example: approximate($source, 0, 8, 5).
* If $source is a set of points, do not input any
* $args. Example: approximate($source).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class FivePointFormula extends NumericalDifferentiation
* (point) contains precisely two numbers, an x and y.
* Example array: [[1,2], [2,3], [3,4], [4,5], [5,6]].
* Example callback: function($x) {return $x**2;}
* @param number ...$args The arguments of our callback function: start,
* @param int|float ...$args The arguments of our callback function: start,
* end, and n. Example: approximate($number, $source, 0, 8, 5).
* If $source is a set of points, do not input any
* $args. Example: approximate($source).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ public static function getPoints($source, array $args = []): array
* Evaluate our callback function at n evenly spaced points on the interval
* between start and end
*
* @param callable $function f(x) callback function
* @param number $start the start of the interval
* @param number $end the end of the interval
* @param number $n the number of function evaluations
* @param callable $function f(x) callback function
* @param int|float $start the start of the interval
* @param int|float $end the end of the interval
* @param int|float $n the number of function evaluations
*
* @return array[]
*/
Expand Down Expand Up @@ -164,8 +164,8 @@ public static function isSpacingConstant(array $sorted)
/**
* Ensures that our target is the x-component of one of the points we supply
*
* @param number $target The value at which we are approximating the derivative
* @param array $sorted Points sorted by (increasing) x-component
* @param int|float $target The value at which we are approximating the derivative
* @param array $sorted Points sorted by (increasing) x-component
*
* @throws Exception\BadDataException if $target is not contained in the array of our x-components
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class SecondDerivativeMidpointFormula extends NumericalDifferentiation
* (point) contains precisely two numbers, an x and y.
* Example array: [[1,2], [2,3], [3,4]].
* Example callback: function($x) {return $x**2;}
* @param number ...$args The arguments of our callback function: start,
* @param int|float ...$args The arguments of our callback function: start,
* end, and n. Example: differentiate($target, $source, 0, 8, 3).
* If $source is a set of points, do not input any
* $args. Example: approximate($source).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ThreePointFormula extends NumericalDifferentiation
* (point) contains precisely two numbers, an x and y.
* Example array: [[1,2], [2,3], [3,4]].
* Example callback: function($x) {return $x**2;}
* @param number ...$args The arguments of our callback function: start,
* @param int|float ...$args The arguments of our callback function: start,
* end, and n. Example: differentiate($target, $source, 0, 8, 3).
* If $source is a set of points, do not input any
* $args. Example: approximate($source).
Expand Down
2 changes: 1 addition & 1 deletion src/NumericalAnalysis/NumericalIntegration/BoolesRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class BoolesRule extends NumericalIntegration
* (point) contains precisely two numbers, an x and y.
* Example array: [[1,2], [2,3], [3,4], [4,5], [5,6]].
* Example callback: function($x) {return $x**2;}
* @param number ...$args The arguments of our callback function: start,
* @param int|float ...$args The arguments of our callback function: start,
* end, and n. Example: approximate($source, 0, 8, 4).
* If $source is a set of points, do not input any
* $args. Example: approximate($source).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class MidpointRule extends NumericalIntegration
* (point) contains precisely two numbers, an x and y.
* Example array: [[1,2], [2,3], [3,4]].
* Example callback: function($x) {return $x**2;}
* @param number ...$args The arguments of our callback function: start,
* @param int|float ...$args The arguments of our callback function: start,
* end, and n. Example: approximate($source, 0, 8, 5).
* If $source is a set of points, do not input any
* $args. Example: approximate($source).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class RectangleMethod extends NumericalIntegration
* (point) contains precisely two numbers, an x and y.
* Example array: [[1,2], [2,3], [3,4]].
* Example callback: function($x) {return $x**2;}
* @param number ...$args The arguments of our callback function: start,
* @param int|float ...$args The arguments of our callback function: start,
* end, and n. Example: approximate($source, 0, 8, 5).
* If $source is a set of points, do not input any
* $args. Example: approximate($source).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class SimpsonsRule extends NumericalIntegration
* (point) contains precisely two numbers, an x and y.
* Example array: [[1,2], [2,3], [3,4]].
* Example callback: function($x) {return $x**2;}
* @param number ...$args The arguments of our callback function: start,
* @param int|float ...$args The arguments of our callback function: start,
* end, and n. Example: approximate($source, 0, 8, 5).
* If $source is a set of points, do not input any
* $args. Example: approximate($source).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SimpsonsThreeEighthsRule extends NumericalIntegration
* (point) contains precisely two numbers, an x and y.
* Example array: [[1,2], [2,3], [3,4], [4,5]].
* Example callback: function($x) {return $x**2;}
* @param number ...$args The arguments of our callback function: start,
* @param int|float ...$args The arguments of our callback function: start,
* end, and n. Example: approximate($source, 0, 8, 4).
* If $source is a set of points, do not input any
* $args. Example: approximate($source).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class TrapezoidalRule extends NumericalIntegration
* (point) contains precisely two numbers, an x and y.
* Example array: [[1,2], [2,3], [3,4]].
* Example callback: function($x) {return $x**2;}
* @param number ...$args The arguments of our callback function: start,
* @param int|float ...$args The arguments of our callback function: start,
* end, and n. Example: approximate($source, 0, 8, 5).
* If $source is a set of points, do not input any
* $args. Example: approximate($source).
Expand Down
16 changes: 8 additions & 8 deletions src/NumericalAnalysis/RootFinding/BisectionMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class BisectionMethod
/**
* Use the Bisection Method to find the x which produces $function(x) = 0.
*
* @param callable $function f(x) callback function
* @param number $a The start of the interval which contains a root
* @param number $b The end of the interval which contains a root
* @param number $tol Tolerance; How close to the actual solution we would like.
* @param callable $function f(x) callback function
* @param int|float $a The start of the interval which contains a root
* @param int|float $b The end of the interval which contains a root
* @param int|float $tol Tolerance; How close to the actual solution we would like.
* @return number
*
Expand Down Expand Up @@ -65,10 +65,10 @@ public static function solve(callable $function, $a, $b, $tol)
* we cannot run our loop as $a and $b will themselves be the midpoint, so we
* throw an Exception.
*
* @param Callable $function f(x) callback function
* @param number $a The start of the interval which contains a root
* @param number $b The end of the interval which contains a root
* @param number $tol Tolerance; How close to the actual solution we would like.
* @param Callable $function f(x) callback function
* @param int|float $a The start of the interval which contains a root
* @param int|float $b The end of the interval which contains a root
* @param int|float $tol Tolerance; How close to the actual solution we would like.
*
* @throws Exception\OutOfBoundsException if $tol (the tolerance) is negative
* @throws Exception\BadDataException if $a = $b
Expand Down
Loading

0 comments on commit d347007

Please sign in to comment.