diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 64b5d20..4fc0d64 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- php-version: ['8.1', '8.2', '8.3']
+ php-version: ['8.1', '8.2', '8.3', '8.4']
steps:
- uses: actions/checkout@v4
diff --git a/.gitignore b/.gitignore
index b07e95c..192ff1a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@
###> symfony/phpunit-bridge ###
.phpunit
+.phpunit.cache
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
diff --git a/.idea/attribute-model.iml b/.idea/attribute-model.iml
index 4a4d94a..6e13f3c 100644
--- a/.idea/attribute-model.iml
+++ b/.idea/attribute-model.iml
@@ -42,6 +42,10 @@
+
+
+
+
diff --git a/.idea/php.xml b/.idea/php.xml
index 749056a..7f6b8a7 100644
--- a/.idea/php.xml
+++ b/.idea/php.xml
@@ -50,6 +50,10 @@
+
+
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7641cbe..6b8fbf9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,12 @@
Change Log
==========
+2024-11-28
+----------
+
+ * fix PHP 8.4 deprecations
+ * switch to symfony/string instead of pragmarx/ia-str
+
2024-03-02
----------
diff --git a/composer.json b/composer.json
index 3f1a5dc..8419be6 100644
--- a/composer.json
+++ b/composer.json
@@ -6,7 +6,7 @@
"require": {
"php": ">=8.1",
"ext-json": "*",
- "pragmarx/ia-str": "^7.0"
+ "symfony/string": "^6.4|^7.0"
},
"require-dev": {
"phpunit/phpunit": "^10.5",
diff --git a/src/AbstractModel.php b/src/AbstractModel.php
index 04dab49..e79f217 100644
--- a/src/AbstractModel.php
+++ b/src/AbstractModel.php
@@ -13,6 +13,7 @@
use function method_exists;
use function preg_match;
use function sprintf;
+use function Symfony\Component\String\u;
abstract class AbstractModel
{
@@ -26,7 +27,7 @@ public function __construct(array $attributes = [])
public function __call($method, $parameters)
{
$mutator = $this->getAttributeMutator($method);
- $attribute = Str::snake($method);
+ $attribute = u($method)->snake()->toString();
if (array_key_exists($attribute, $this->attributes) || method_exists($this, $mutator)) {
return $this->getAttribute($attribute);
@@ -69,7 +70,7 @@ public function getAttributes(): array
$matches = [];
if (!in_array($method, $ignore) && preg_match('/^get(?[\w\d]+)Attribute/', $method, $matches)) {
- $prop = Str::snake($matches['property']);
+ $prop = u($matches['property'])->snake()->toString();
$attributes[$prop] = $this->{$method}($this->attributes[$prop] ?? null);
}
@@ -122,6 +123,6 @@ public function getAttribute(string $name): mixed
protected function getAttributeMutator(string $name): string
{
- return sprintf('get%sAttribute', Str::studly($name));
+ return sprintf('get%sAttribute', u($name)->camel()->title()->toString());
}
}