Skip to content
Open
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
249 changes: 0 additions & 249 deletions Tests/InflectorTest.php

This file was deleted.

4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@
"symfony/polyfill-mbstring": "^1.31.0"
},
"require-dev": {
"doctrine/inflector": "^2.0.10",
"joomla/test": "^4.0",
"phpunit/phpunit": "^12.5 || ^13.0",
"squizlabs/php_codesniffer": "^4.0",
"phpstan/phpstan": "^2.1.17",
"phpstan/phpstan-deprecation-rules": "^2.0.3"
},
"suggest": {
"ext-mbstring": "For improved processing",
"doctrine/inflector": "To use the string inflector"
"ext-mbstring": "For improved processing"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* [Overview](overview.md)
* [Updating from v4 to v5](v4-to-v5-update.md)
31 changes: 31 additions & 0 deletions docs/v4-to-v5-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## Updating from v4 to v5

The following changes were made to the String package between version 4 and version 5.

### The `Inflector` class has been removed

`Joomla\String\Inflector`, deprecated in 4.x, has been removed. Use the `doctrine/inflector` package
directly:

```php
use Doctrine\Inflector\InflectorFactory;

$inflector = InflectorFactory::create()->build();

$inflector->pluralize('house'); // 'houses'
$inflector->singularize('houses'); // 'house'
$inflector->tableize('BlogPost'); // 'blog_post'
```

| 4.x | Replacement |
|---|---|
| `Inflector::pluralize()`, `singularize()`, `tableize()`, `classify()`, `camelize()` | The method of the same name on a `Doctrine\Inflector\Inflector` |
| `Inflector::isPlural($word)` | `$inflector->pluralize($inflector->singularize($word)) === $word` |
| `Inflector::isSingular($word)` | `$inflector->singularize($word) === $word` |
| `Inflector::ucwords()` | PHP's `ucwords($string, " \n\t\r\0\x0B-")` |
| `Inflector::addCountableRule()`, `isCountable()` | Keep your own list of countable words |
| `Inflector::rules()`, `reset()` | Had no effect. Use `InflectorFactory::create()->withSingularRules()` / `withPluralRules()` |

### Dependency changes

`doctrine/inflector` is no longer suggested and no longer a development dependency.
Loading
Loading