Skip to content

Commit

Permalink
Rename usortClosure() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
webeweb committed Aug 9, 2022
1 parent 397d29c commit 3e6c2d1
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 75 deletions.
6 changes: 3 additions & 3 deletions src/types/Helper/BooleanHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ public static function parseString(?string $value): bool {
}

/**
* Usort callable.
* Usort callback.
*
* @param bool $asc ASC ?
* @return callable Returns the usort callable.
* @return callable Returns the usort callback.
*/
public static function usortCallable(bool $asc = true): callable {
public static function usortCallback(bool $asc = true): callable {

return function(?bool $bool1, ?bool $bool2) use ($asc): int {

Expand Down
6 changes: 3 additions & 3 deletions src/types/Helper/DateTimeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,12 @@ public static function translateWeekday(?string $date, string $locale = "en"): ?
}

/**
* Usort callable.
* Usort callback.
*
* @param bool $asc ASC ?
* @return callable Returns the usort callable.
* @return callable Returns the usort callback.
*/
public static function usortCallable(bool $asc = true): callable {
public static function usortCallback(bool $asc = true): callable {

return function(?DateTime $dateTime1, ?DateTime $dateTime2) use ($asc): int {

Expand Down
6 changes: 3 additions & 3 deletions src/types/Helper/FloatHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ public static function parseString(?string $value): ?float {
}

/**
* Usort callable.
* Usort callback.
*
* @param bool $asc ASC ?
* @return callable Returns the usort callable.
* @return callable Returns the usort callback.
*/
public static function usortCallable(bool $asc = true): callable {
public static function usortCallback(bool $asc = true): callable {

return function(?float $float1, ?float $float2) use ($asc): int {

Expand Down
6 changes: 3 additions & 3 deletions src/types/Helper/IntegerHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ public static function parseString(?string $value): ?int {
}

/**
* Usort callable.
* Usort callback.
*
* @param bool $asc ASC ?
* @return callable Returns the usort callable.
* @return callable Returns the usort callback.
*/
public static function usortCallable(bool $asc = true): callable {
public static function usortCallback(bool $asc = true): callable {

return function(?int $int1, ?int $int2) use ($asc): int {

Expand Down
48 changes: 24 additions & 24 deletions src/types/Helper/ObjectHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ public static function isObject($value): void {
}

/**
* Usort callable by string.
* Usort callback by string.
*
* @param string $method The method.
* @param callable $closure the closure.
* @return callable Returns the usort callable.
* @param callable $closure The closure.
* @return callable Returns the usort callback.
*/
protected static function usortCallable(string $method, callable $closure): callable {
protected static function usortCallback(string $method, callable $closure): callable {

/**
* Get the value.
Expand Down Expand Up @@ -113,58 +113,58 @@ protected static function usortCallable(string $method, callable $closure): call
}

/**
* Usort callable by boolean.
* Usort callback by boolean.
*
* @param string $method The method.
* @param bool $asc ASC ?
* @return callable Returns the usort callable.
* @return callable Returns the usort callback.
*/
public static function usortCallableByBoolean(string $method, bool $asc = true): callable {
public static function usortCallbackByBoolean(string $method, bool $asc = true): callable {

$closure = BooleanHelper::usortCallable($asc);
$closure = BooleanHelper::usortCallback($asc);

return static::usortCallable($method, $closure);
return static::usortCallback($method, $closure);
}

/**
* Usort callable by float.
* Usort callback by float.
*
* @param string $method The method.
* @param bool $asc ASC ?
* @return callable Returns the usort callable.
* @return callable Returns the usort callback.
*/
public static function usortCallableByFloat(string $method, bool $asc = true): callable {
public static function usortCallbackByFloat(string $method, bool $asc = true): callable {

$closure = FloatHelper::usortCallable($asc);
$closure = FloatHelper::usortCallback($asc);

return static::usortCallable($method, $closure);
return static::usortCallback($method, $closure);
}

/**
* Usort callable by integer.
* Usort callback by integer.
*
* @param string $method The method.
* @param bool $asc ASC ?
* @return callable Returns the usort closure.
* @return callable Returns the usort callback.
*/
public static function usortCallableByInteger(string $method, bool $asc = true): callable {
public static function usortCallbackByInteger(string $method, bool $asc = true): callable {

$closure = IntegerHelper::usortCallable($asc);
$closure = IntegerHelper::usortCallback($asc);

return static::usortCallable($method, $closure);
return static::usortCallback($method, $closure);
}

/**
* Usort callable by string.
* Usort callback by string.
*
* @param string $method The method.
* @param bool $asc ASC ?
* @return callable Returns the usort callable.
* @return callable Returns the usort callback.
*/
public static function usortCallableByString(string $method, bool $asc = true): callable {
public static function usortCallbackByString(string $method, bool $asc = true): callable {

$closure = StringHelper::usortCallable($asc);
$closure = StringHelper::usortCallback($asc);

return static::usortCallable($method, $closure);
return static::usortCallback($method, $closure);
}
}
6 changes: 3 additions & 3 deletions src/types/Helper/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,12 @@ public static function ucwords(?string $string, string $separators = " \t\r\n\f\
}

/**
* Usort closure.
* Usort callback.
*
* @param bool $asc ASC ?
* @return callable Returns the usort callable.
* @return callable Returns the usort callback.
*/
public static function usortCallable(bool $asc = true): callable {
public static function usortCallback(bool $asc = true): callable {

return function(?string $string1, ?string $string2) use ($asc): int {

Expand Down
8 changes: 4 additions & 4 deletions tests/types/Helper/BooleanHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ public function testParseString(): void {
}

/**
* Tests usortCallable()
* Tests usortCallback()
*
* @return void
*/
public function testUsortCallable(): void {

$obj = BooleanHelper::usortCallable();
$obj = BooleanHelper::usortCallback();
$this->assertIsCallable($obj);

$this->assertEquals(-1, $obj(false, true));
Expand All @@ -78,13 +78,13 @@ public function testUsortCallable(): void {
}

/**
* Tests usortCallable()
* Tests usortCallback()
*
* @return void
*/
public function testUsortCallableWithAsc(): void {

$obj = BooleanHelper::usortCallable(false);
$obj = BooleanHelper::usortCallback(false);
$this->assertIsCallable($obj);

$this->assertEquals(1, $obj(false, true));
Expand Down
8 changes: 4 additions & 4 deletions tests/types/Helper/DateTimeHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ public function testTranslateWeekday(): void {
}

/**
* Tests usortCallable()
* Tests usortCallback()
*
* @return void
*/
Expand All @@ -708,7 +708,7 @@ public function testUsortCallable(): void {
$a = new DateTime("2022-07-06 11:00");
$b = new DateTime("2022-07-06 12:00");

$obj = DateTimeHelper::usortCallable();
$obj = DateTimeHelper::usortCallback();
$this->assertIsCallable($obj);

$this->assertEquals(-1, $obj($a, $b));
Expand All @@ -721,7 +721,7 @@ public function testUsortCallable(): void {
}

/**
* Tests usortCallable()
* Tests usortCallback()
*
* @return void
*/
Expand All @@ -731,7 +731,7 @@ public function testUsortCallableWithAsc(): void {
$a = new DateTime("2022-07-06 11:00");
$b = new DateTime("2022-07-06 12:00");

$obj = DateTimeHelper::usortCallable(false);
$obj = DateTimeHelper::usortCallback(false);
$this->assertIsCallable($obj);

$this->assertEquals(1, $obj($a, $b));
Expand Down
8 changes: 4 additions & 4 deletions tests/types/Helper/FloatHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ public function testParseStringWithFloatArgumentException(): void {
}

/**
* Tests usortCallable()
* Tests usortCallback()
*
* @return void
*/
public function testUsortCallable(): void {

$obj = FloatHelper::usortCallable();
$obj = FloatHelper::usortCallback();
$this->assertIsCallable($obj);

$this->assertEquals(-1, $obj(0.1, 0.2));
Expand All @@ -110,13 +110,13 @@ public function testUsortCallable(): void {
}

/**
* Tests usortCallable()
* Tests usortCallback()
*
* @return void
*/
public function testUsortCallableWithAsc(): void {

$obj = FloatHelper::usortCallable(false);
$obj = FloatHelper::usortCallback(false);
$this->assertIsCallable($obj);

$this->assertEquals(1, $obj(0.1, 0.2));
Expand Down
8 changes: 4 additions & 4 deletions tests/types/Helper/IntegerHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ public function testParseStringWithIntegerArgumentException(): void {
}

/**
* Tests usortCallable()
* Tests usortCallback()
*
* @return void
*/
public function testUsortCallable(): void {

$obj = IntegerHelper::usortCallable();
$obj = IntegerHelper::usortCallback();
$this->assertIsCallable($obj);

$this->assertEquals(-1, $obj(1, 2));
Expand All @@ -85,13 +85,13 @@ public function testUsortCallable(): void {
}

/**
* Tests usortCallable()
* Tests usortCallback()
*
* @return void
*/
public function testUsortCallableWithAsc(): void {

$obj = IntegerHelper::usortCallable(false);
$obj = IntegerHelper::usortCallback(false);
$this->assertIsCallable($obj);

$this->assertEquals(1, $obj(1, 2));
Expand Down
Loading

0 comments on commit 3e6c2d1

Please sign in to comment.