summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2018-06-01 17:07:34 +0200
committerAndrey Andreev <narf@devilix.net>2018-06-01 17:07:34 +0200
commit721e34619f79585cdad92174373edcf2b049931f (patch)
treedd5a18ee42a16bdfc64084b6c3d06062f8c1a95d
parentb677461a9c6d617f26eff92d2077ba1dc3177bc0 (diff)
[ci skip] Close #5482
-rw-r--r--system/helpers/inflector_helper.php8
-rw-r--r--user_guide_src/source/helpers/inflector_helper.rst17
-rw-r--r--user_guide_src/source/installation/upgrade_320.rst11
3 files changed, 25 insertions, 11 deletions
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index 376cac783..2682649e9 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -63,7 +63,7 @@ if ( ! function_exists('singular'))
{
$result = strval($str);
- if ( ! is_countable($result))
+ if ( ! word_is_countable($result))
{
return $result;
}
@@ -128,7 +128,7 @@ if ( ! function_exists('plural'))
{
$result = strval($str);
- if ( ! is_countable($result))
+ if ( ! word_is_countable($result))
{
return $result;
}
@@ -226,7 +226,7 @@ if ( ! function_exists('humanize'))
// --------------------------------------------------------------------
-if ( ! function_exists('is_countable'))
+if ( ! function_exists('word_is_countable'))
{
/**
* Checks if the given word has a plural version.
@@ -234,7 +234,7 @@ if ( ! function_exists('is_countable'))
* @param string $word Word to check
* @return bool
*/
- function is_countable($word)
+ function word_is_countable($word)
{
return ! in_array(
strtolower($word),
diff --git a/user_guide_src/source/helpers/inflector_helper.rst b/user_guide_src/source/helpers/inflector_helper.rst
index 76cce6f4d..ca781d2ad 100644
--- a/user_guide_src/source/helpers/inflector_helper.rst
+++ b/user_guide_src/source/helpers/inflector_helper.rst
@@ -85,7 +85,7 @@ The following functions are available:
echo humanize('my-dog-spot', '-'); // Prints 'My Dog Spot'
-.. php:function:: is_countable($word)
+.. php:function:: word_is_countable($word)
:param string $word: Input string
:returns: TRUE if the word is countable or FALSE if not
@@ -93,17 +93,20 @@ The following functions are available:
Checks if the given word has a plural version. Example::
- is_countable('equipment'); // Returns FALSE
+ word_is_countable('equipment'); // Returns FALSE
+
+ .. note:: This function used to be called ``is_countable()`` in
+ in previous CodeIgniter versions.
.. php:function:: ordinal_format($number)
:param int $number: non-negative natural number to be converted
- :returns: Ordinal numeral for given number or original value on failure
- :rtype: string
+ :returns: Ordinal numeral for given number or original value on failure
+ :rtype: string
- Returns the ordinal numeral (1st, 2nd, 3rd etc.) for a
- non-negative natural number. If the input is not a natural number
- greater than 0, the function will return the original value. Examples::
+ Returns the ordinal numeral (1st, 2nd, 3rd etc.) for a
+ non-negative natural number. If the input is not a natural number
+ greater than 0, the function will return the original value. Examples::
echo ordinal_format(1); // Returns 1st
echo ordinal_format(3); // Returns 3rd
diff --git a/user_guide_src/source/installation/upgrade_320.rst b/user_guide_src/source/installation/upgrade_320.rst
index 3eadd8caf..a9dc274c7 100644
--- a/user_guide_src/source/installation/upgrade_320.rst
+++ b/user_guide_src/source/installation/upgrade_320.rst
@@ -257,3 +257,14 @@ so that if you're using the :doc:`Web Page Caching <../general/caching>`
feature, you'll be left with some old, garbage cache files.
That shouldn't be a problem, but you may want to clear them.
+
+Step 13: Check for calls to is_countable()
+==========================================
+
+
+PHP 7.3 introduces a native `is_countable() <https://secure.php.net/is_countable>`_
+function, which creates a name collision with the ``is_countable()`` function
+we've had in our :doc:`Inflector Helpers <../helpers/inflector_helper>`.
+
+If you've been using the helper function in question, you should now rename
+the calls to it to :php:func:`word_is_countable()`.