Skip to content

Commit

Permalink
Treat CamelCase'd strings as multiple words
Browse files Browse the repository at this point in the history
resolves #3090
  • Loading branch information
brandonkelly committed Jul 13, 2018
1 parent 78c9dea commit 360843c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- `Craft.EntryTypeSwitcher` now triggers a `typeChange` event after switching the entry type. ([#3067](https://github.com/craftcms/cms/pull/3067))
- Reduced the left and right padding in the Control Panel for screens less than 768 pixels wide. ([#3073](https://github.com/craftcms/cms/issues/3073))
- Removed the `useXSendFile` config setting as it’s no longer being used.
- `craft\helpers\StringHelper::toKebabCase()`, `toCamelCase()`, `toPascalCase()`, and `toSnakeCase()` now treat camelCase’d and PascalCale’d strings as multiple words. ([#3090](https://github.com/craftcms/cms/issues/3090))

### Fixed
- Fixed a bug where `craft\i18n\I18N::getPrimarySiteLocale()` and `getPrimarySiteLocaleId()` were returning locale info for the _first_ site, rather than the primary one. ([#3063](https://github.com/craftcms/cms/issues/3063))
Expand Down
3 changes: 2 additions & 1 deletion src/helpers/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Stringy\Stringy as BaseStringy;
use yii\base\Exception;
use yii\base\InvalidConfigException;
use yii\helpers\Inflector;

/**
* This helper class provides various multi-byte aware string related manipulation and encoding methods.
Expand Down Expand Up @@ -1040,7 +1041,7 @@ private static function _prepStringForCasing(string $string, bool $lower = true,
{
if ($lower) {
// Make it lowercase
$string = static::toLowerCase($string);
$string = Inflector::camel2words($string, false);
}

if ($removePunctuation) {
Expand Down

0 comments on commit 360843c

Please sign in to comment.