Skip to content

string component fixes #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Symfony/Component/String/AbstractUnicodeString.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\String\Exception\ExceptionInterface;
use Symfony\Component\String\Exception\InvalidArgumentException;
use Symfony\Component\String\Exception\RuntimeException;

/**
* Represents a string of abstract Unicode characters.
Expand Down
3 changes: 2 additions & 1 deletion src/Symfony/Component/String/BinaryString.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Symfony\Component\String\Exception\ExceptionInterface;
use Symfony\Component\String\Exception\InvalidArgumentException;
use Symfony\Component\String\Exception\RuntimeException;

/**
* Represents a binary-safe string of bytes.
Expand Down Expand Up @@ -301,7 +302,7 @@ public function slice(int $start = 0, int $length = null): parent
public function splice(string $replacement, int $start = 0, int $length = null): parent
{
$str = clone $this;
$str = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX);
$str->string = substr_replace($this->string, $replacement, $start, $length ?? \PHP_INT_MAX);

return $str;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/String/GraphemeString.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function length(): int
/**
* @return static
*/
public function normalize(int $form = self::NFC): self
public function normalize(int $form = self::NFC): parent
{
if (\in_array($form, [self::NFD, self::NFKD])) {
$this->ignoreCase = null;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/String/Utf8String.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function endsWith($suffix): bool
}

if ($this->ignoreCase) {
return preg_match('{'.preg_quote($suffix).'$}iu');
return preg_match('{'.preg_quote($suffix).'$}iu', $this->string);
}

return \strlen($this->string) - \strlen($suffix) === strrpos($this->string, $suffix);
Expand Down