Browse Source

removed functions from functions_global.php

Jozef Grencik 2 years ago
parent
commit
24c80f7147
2 changed files with 0 additions and 80 deletions
  1. 0 56
      src/Core/functions_global.php
  2. 0 24
      tests/TestCase/Core/FunctionsGlobalTest.php

+ 0 - 56
src/Core/functions_global.php

@@ -172,59 +172,3 @@ if (!function_exists('deprecationWarning')) {
         cakeDeprecationWarning($version, $message, $stackFrame + 1);
     }
 }
-
-if (!function_exists('toString')) {
-    /**
-     * Converts the given value to a string.
-     *
-     * This method attempts to convert the given value to a string.
-     * If the value is already a string, it returns the value as it is.
-     * If the conversion is not possible, it returns NULL.
-     *
-     * @param mixed $value The value to be converted.
-     * @return ?string Returns the string representation of the value, or null if the value is not a string.
-     * @since 5.1.0
-     */
-    function toString(mixed $value): ?string
-    {
-        return cakeToString($value);
-    }
-}
-
-if (!function_exists('toInt')) {
-    /**
-     * Converts a value to an integer.
-     *
-     * This method attempts to convert the given value to an integer.
-     * If the conversion is successful, it returns the value as an integer.
-     * If the conversion fails, it returns NULL.
-     *
-     * String values are trimmed using trim().
-     *
-     * @param mixed $value The value to be converted to an integer.
-     * @return int|null Returns the converted integer value or null if the conversion fails.
-     * @since 5.1.0
-     */
-    function toInt(mixed $value): ?int
-    {
-        return cakeToInt($value);
-    }
-}
-
-if (!function_exists('toBool')) {
-    /**
-     * Converts a value to boolean.
-     *
-     *  1 | '1' | 1.0 | true  - values returns as true
-     *  0 | '0' | 0.0 | false - values returns as false
-     *  Other values returns as null.
-     *
-     * @param mixed $value The value to convert to boolean.
-     * @return bool|null Returns true if the value is truthy, false if it's falsy, or NULL otherwise.
-     * @since 5.1.0
-     */
-    function toBool(mixed $value): ?bool
-    {
-        return cakeToBool($value);
-    }
-}

+ 0 - 24
tests/TestCase/Core/FunctionsGlobalTest.php

@@ -337,28 +337,4 @@ class FunctionsGlobalTest extends TestCase
             $this->assertTrue(true);
         });
     }
-
-    /**
-     * @dataProvider \Cake\Test\TestCase\Core\FunctionsTest::toStringProvider
-     */
-    public function testToString(mixed $rawValue, ?string $expected): void
-    {
-        $this->assertSame($expected, toString($rawValue));
-    }
-
-    /**
-     * @dataProvider \Cake\Test\TestCase\Core\FunctionsTest::toIntProvider
-     */
-    public function testToInt(mixed $rawValue, null|int $expected): void
-    {
-        $this->assertSame($expected, toInt($rawValue));
-    }
-
-    /**
-     * @dataProvider \Cake\Test\TestCase\Core\FunctionsTest::toBoolProvider
-     */
-    public function testToBool(mixed $rawValue, ?bool $expected): void
-    {
-        $this->assertSame($expected, toBool($rawValue));
-    }
 }