1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-05 04:47:33 +02:00

Fixes phpdoc for objects extending stringy.

This commit is contained in:
Victor Passapera
2017-01-19 22:42:06 -08:00
parent de93eab01f
commit d71d4f0ad6

View File

@@ -64,7 +64,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
*
* @param mixed $str Value to modify, after being cast to string
* @param string $encoding The character encoding
* @return Stringy A Stringy object
* @return static A Stringy object
* @throws \InvalidArgumentException if an array or object without a
* __toString method is passed as the first argument
*/
@@ -87,7 +87,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Returns a new string with $string appended.
*
* @param string $string The string to append
* @return Stringy Object with appended $string
* @return static Object with appended $string
*/
public function append($string)
{
@@ -98,7 +98,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Returns the character at $index, with indexes starting at 0.
*
* @param int $index Position of the character
* @return Stringy The character at $index
* @return static The character at $index
*/
public function at($index)
{
@@ -113,7 +113,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* @param string $start Delimiter marking the start of the substring
* @param string $end Delimiter marking the end of the substring
* @param int $offset Index from which to begin the search
* @return Stringy Object whose $str is a substring between $start and $end
* @return static Object whose $str is a substring between $start and $end
*/
public function between($start, $end, $offset = 0)
{
@@ -136,7 +136,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* capitalizes letters following digits, spaces, dashes and underscores,
* and removes spaces, dashes, as well as underscores.
*
* @return Stringy Object with $str in camelCase
* @return static Object with $str in camelCase
*/
public function camelize()
{
@@ -187,7 +187,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* single space. This includes tabs and newline characters, as well as
* multibyte whitespace such as the thin space and ideographic space.
*
* @return Stringy Object with a trimmed $str and condensed whitespace
* @return static Object with a trimmed $str and condensed whitespace
*/
public function collapseWhitespace()
{
@@ -298,7 +298,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* inserted before uppercase characters (with the exception of the first
* character of the string), and in place of spaces as well as underscores.
*
* @return Stringy Object with a dasherized $str
* @return static Object with a dasherized $str
*/
public function dasherize()
{
@@ -312,7 +312,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* and underscores. Alpha delimiters are not converted to lowercase.
*
* @param string $delimiter Sequence used to separate parts of the string
* @return Stringy Object with a delimited $str
* @return static Object with a delimited $str
*/
public function delimit($delimiter)
{
@@ -358,7 +358,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* prepended.
*
* @param string $substring The substring to add if not present
* @return Stringy Object with its $str prefixed by the $substring
* @return static Object with its $str prefixed by the $substring
*/
public function ensureLeft($substring)
{
@@ -376,7 +376,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* appended.
*
* @param string $substring The substring to add if not present
* @return Stringy Object with its $str suffixed by the $substring
* @return static Object with its $str suffixed by the $substring
*/
public function ensureRight($substring)
{
@@ -393,7 +393,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Returns the first $n characters of the string.
*
* @param int $n Number of characters to retrieve from the start
* @return Stringy Object with its $str being the first $n chars
* @return static Object with its $str being the first $n chars
*/
public function first($n)
{
@@ -459,7 +459,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* http://php.net/manual/en/function.html-entity-decode.php
*
* @param int|null $flags Optional flags
* @return Stringy Object with the resulting $str after being html decoded.
* @return static Object with the resulting $str after being html decoded.
*/
public function htmlDecode($flags = ENT_COMPAT)
{
@@ -474,7 +474,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* for a list of flags.
*
* @param int|null $flags Optional flags
* @return Stringy Object with the resulting $str after being html encoded.
* @return static Object with the resulting $str after being html encoded.
*/
public function htmlEncode($flags = ENT_COMPAT)
{
@@ -487,7 +487,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Capitalizes the first word of the string, replaces underscores with
* spaces, and strips '_id'.
*
* @return Stringy Object with a humanized $str
* @return static Object with a humanized $str
*/
public function humanize()
{
@@ -532,7 +532,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
*
* @param string $substring String to be inserted
* @param int $index The index at which to insert the substring
* @return Stringy Object with the resulting $str after the insertion
* @return static Object with the resulting $str after the insertion
*/
public function insert($substring, $index)
{
@@ -659,7 +659,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Returns the last $n characters of the string.
*
* @param int $n Number of characters to retrieve from the end
* @return Stringy Object with its $str being the last $n chars
* @return static Object with its $str being the last $n chars
*/
public function last($n)
{
@@ -687,7 +687,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Splits on newlines and carriage returns, returning an array of Stringy
* objects corresponding to the lines in the string.
*
* @return Stringy[] An array of Stringy objects
* @return static[] An array of Stringy objects
*/
public function lines()
{
@@ -703,7 +703,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Returns the longest common prefix between the string and $otherStr.
*
* @param string $otherStr Second string for comparison
* @return Stringy Object with its $str being the longest common prefix
* @return static Object with its $str being the longest common prefix
*/
public function longestCommonPrefix($otherStr)
{
@@ -728,7 +728,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Returns the longest common suffix between the string and $otherStr.
*
* @param string $otherStr Second string for comparison
* @return Stringy Object with its $str being the longest common suffix
* @return static Object with its $str being the longest common suffix
*/
public function longestCommonSuffix($otherStr)
{
@@ -754,7 +754,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* In the case of ties, it returns that which occurs first.
*
* @param string $otherStr Second string for comparison
* @return Stringy Object with its $str being the longest common substring
* @return static Object with its $str being the longest common substring
*/
public function longestCommonSubstring($otherStr)
{
@@ -801,7 +801,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/**
* Converts the first character of the string to lower case.
*
* @return Stringy Object with the first character of $str being lower case
* @return static Object with the first character of $str being lower case
*/
public function lowerCaseFirst()
{
@@ -894,7 +894,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* @param int $length Desired string length after padding
* @param string $padStr String used to pad, defaults to space
* @param string $padType One of 'left', 'right', 'both'
* @return Stringy Object with a padded $str
* @return static Object with a padded $str
* @throws /InvalidArgumentException If $padType isn't one of 'right',
* 'left' or 'both'
*/
@@ -921,7 +921,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
*
* @param int $length Desired string length after padding
* @param string $padStr String used to pad, defaults to space
* @return Stringy String with padding applied
* @return static String with padding applied
*/
public function padBoth($length, $padStr = ' ')
{
@@ -937,7 +937,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
*
* @param int $length Desired string length after padding
* @param string $padStr String used to pad, defaults to space
* @return Stringy String with left padding
* @return static String with left padding
*/
public function padLeft($length, $padStr = ' ')
{
@@ -950,7 +950,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
*
* @param int $length Desired string length after padding
* @param string $padStr String used to pad, defaults to space
* @return Stringy String with right padding
* @return static String with right padding
*/
public function padRight($length, $padStr = ' ')
{
@@ -961,7 +961,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Returns a new string starting with $string.
*
* @param string $string The string to append
* @return Stringy Object with appended $string
* @return static Object with appended $string
*/
public function prepend($string)
{
@@ -978,7 +978,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* @param string $pattern The regular expression pattern
* @param string $replacement The string to replace with
* @param string $options Matching conditions to be used
* @return Stringy Object with the resulting $str after the replacements
* @return static Object with the resulting $str after the replacements
*/
public function regexReplace($pattern, $replacement, $options = 'msr')
{
@@ -995,7 +995,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Returns a new string with the prefix $substring removed, if present.
*
* @param string $substring The prefix to remove
* @return Stringy Object having a $str without the prefix $substring
* @return static Object having a $str without the prefix $substring
*/
public function removeLeft($substring)
{
@@ -1013,7 +1013,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Returns a new string with the suffix $substring removed, if present.
*
* @param string $substring The suffix to remove
* @return Stringy Object having a $str without the suffix $substring
* @return static Object having a $str without the suffix $substring
*/
public function removeRight($substring)
{
@@ -1031,7 +1031,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Returns a repeated string given a multiplier. An alias for str_repeat.
*
* @param int $multiplier The number of times to repeat the string
* @return Stringy Object with a repeated str
* @return static Object with a repeated str
*/
public function repeat($multiplier)
{
@@ -1045,7 +1045,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
*
* @param string $search The needle to search for
* @param string $replacement The string to replace with
* @return Stringy Object with the resulting $str after the replacements
* @return static Object with the resulting $str after the replacements
*/
public function replace($search, $replacement)
{
@@ -1055,7 +1055,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/**
* Returns a reversed string. A multibyte version of strrev().
*
* @return Stringy Object with a reversed $str
* @return static Object with a reversed $str
*/
public function reverse()
{
@@ -1078,7 +1078,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
*
* @param int $length Desired length of the truncated string
* @param string $substring The substring to append if it can fit
* @return Stringy Object with the resulting $str after truncating
* @return static Object with the resulting $str after truncating
*/
public function safeTruncate($length, $substring = '')
{
@@ -1110,7 +1110,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* A multibyte str_shuffle() function. It returns a string with its
* characters in random order.
*
* @return Stringy Object with a shuffled $str
* @return static Object with a shuffled $str
*/
public function shuffle()
{
@@ -1133,7 +1133,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* is also converted to lowercase.
*
* @param string $replacement The string used to replace whitespace
* @return Stringy Object whose $str has been converted to an URL slug
* @return static Object whose $str has been converted to an URL slug
*/
public function slugify($replacement = '-')
{
@@ -1202,7 +1202,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
*
* @param int $start Initial index from which to begin extraction
* @param int $end Optional index at which to end extraction
* @return Stringy Object with its $str being the extracted substring
* @return static Object with its $str being the extracted substring
*/
public function slice($start, $end = null)
{
@@ -1228,7 +1228,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
*
* @param string $pattern The regex with which to split the string
* @param int $limit Optional maximum number of results to return
* @return Stringy[] An array of Stringy objects
* @return static[] An array of Stringy objects
*/
public function split($pattern, $limit = null)
{
@@ -1278,7 +1278,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* characters, as well as multibyte whitespace such as the thin space
* and ideographic space.
*
* @return Stringy Object with whitespace stripped
* @return static Object with whitespace stripped
*/
public function stripWhitespace()
{
@@ -1292,7 +1292,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
*
* @param int $start Position of the first character to use
* @param int $length Maximum number of characters used
* @return Stringy Object with its $str being the substring
* @return static Object with its $str being the substring
*/
public function substr($start, $length = null)
{
@@ -1306,7 +1306,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Surrounds $str with the given substring.
*
* @param string $substring The substring to add to both sides
* @return Stringy Object whose $str had the substring both prepended and
* @return static Object whose $str had the substring both prepended and
* appended
*/
public function surround($substring)
@@ -1319,7 +1319,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/**
* Returns a case swapped version of the string.
*
* @return Stringy Object whose $str has each character's case swapped
* @return static Object whose $str has each character's case swapped
*/
public function swapCase()
{
@@ -1346,7 +1346,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Windows-1252 (commonly used in Word documents) replaced by their ASCII
* equivalents.
*
* @return Stringy Object whose $str has those characters removed
* @return static Object whose $str has those characters removed
*/
public function tidy()
{
@@ -1371,7 +1371,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* capitalized.
*
* @param array $ignore An array of words not to capitalize
* @return Stringy Object with a titleized $str
* @return static Object with a titleized $str
*/
public function titleize($ignore = null)
{
@@ -1402,7 +1402,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
*
* @param bool $removeUnsupported Whether or not to remove the
* unsupported characters
* @return Stringy Object whose $str contains only ASCII characters
* @return static Object whose $str contains only ASCII characters
*/
public function toAscii($removeUnsupported = true)
{
@@ -1457,7 +1457,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Converts all characters in the string to lowercase. An alias for PHP's
* mb_strtolower().
*
* @return Stringy Object with all characters of $str being lowercase
* @return static Object with all characters of $str being lowercase
*/
public function toLowerCase()
{
@@ -1471,7 +1471,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* $tabLength. By default, each tab is converted to 4 consecutive spaces.
*
* @param int $tabLength Number of spaces to replace each tab with
* @return Stringy Object whose $str has had tabs switched to spaces
* @return static Object whose $str has had tabs switched to spaces
*/
public function toSpaces($tabLength = 4)
{
@@ -1487,7 +1487,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* are converted to a tab.
*
* @param int $tabLength Number of spaces to replace with a tab
* @return Stringy Object whose $str has had spaces switched to tabs
* @return static Object whose $str has had spaces switched to tabs
*/
public function toTabs($tabLength = 4)
{
@@ -1500,7 +1500,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/**
* Converts the first character of each word in the string to uppercase.
*
* @return Stringy Object with all characters of $str being title-cased
* @return static Object with all characters of $str being title-cased
*/
public function toTitleCase()
{
@@ -1513,7 +1513,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* Converts all characters in the string to uppercase. An alias for PHP's
* mb_strtoupper().
*
* @return Stringy Object with all characters of $str being uppercase
* @return static Object with all characters of $str being uppercase
*/
public function toUpperCase()
{
@@ -1528,7 +1528,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* string of characters to strip instead of the defaults.
*
* @param string $chars Optional string of characters to strip
* @return Stringy Object with a trimmed $str
* @return static Object with a trimmed $str
*/
public function trim($chars = null)
{
@@ -1543,7 +1543,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* string of characters to strip instead of the defaults.
*
* @param string $chars Optional string of characters to strip
* @return Stringy Object with a trimmed $str
* @return static Object with a trimmed $str
*/
public function trimLeft($chars = null)
{
@@ -1558,7 +1558,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* string of characters to strip instead of the defaults.
*
* @param string $chars Optional string of characters to strip
* @return Stringy Object with a trimmed $str
* @return static Object with a trimmed $str
*/
public function trimRight($chars = null)
{
@@ -1574,7 +1574,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
*
* @param int $length Desired length of the truncated string
* @param string $substring The substring to append if it can fit
* @return Stringy Object with the resulting $str after truncating
* @return static Object with the resulting $str after truncating
*/
public function truncate($length, $substring = '')
{
@@ -1599,7 +1599,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* of the first character of the string), and in place of spaces as well as
* dashes.
*
* @return Stringy Object with an underscored $str
* @return static Object with an underscored $str
*/
public function underscored()
{
@@ -1611,7 +1611,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* surrounding spaces, capitalizes letters following digits, spaces, dashes
* and underscores, and removes spaces, dashes, underscores.
*
* @return Stringy Object with $str in UpperCamelCase
* @return static Object with $str in UpperCamelCase
*/
public function upperCamelize()
{
@@ -1621,7 +1621,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
/**
* Converts the first character of the supplied string to upper case.
*
* @return Stringy Object with the first character of $str being upper case
* @return static Object with the first character of $str being upper case
*/
public function upperCaseFirst()
{
@@ -1810,7 +1810,7 @@ class Stringy implements Countable, IteratorAggregate, ArrayAccess
* @param int $left Length of left padding
* @param int $right Length of right padding
* @param string $padStr String used to pad
* @return Stringy String with padding applied
* @return static String with padding applied
*/
protected function applyPadding($left = 0, $right = 0, $padStr = ' ')
{