diff --git a/composer.json b/composer.json
index 5c61152..b67b3e7 100644
--- a/composer.json
+++ b/composer.json
@@ -32,7 +32,8 @@
"require-dev": {
"phpunit/phpunit": "^10 || ^11",
"filament/filament": "^3.0",
- "orchestra/testbench": "8.x-dev"
+ "orchestra/testbench": "8.x-dev",
+ "phpstan/phpstan": "^1.10"
},
"extra": {
"laravel": {
@@ -42,6 +43,7 @@
}
},
"scripts": {
+ "phpstan": "vendor/bin/phpstan analyse src --level=9",
"post-autoload-dump": [
"@clear",
"@prepare"
diff --git a/composer.lock b/composer.lock
index 5b37ecd..b47d559 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "e07789ed60060e36a3a23cb5ddc754e6",
+ "content-hash": "f0b93513ac3bfb4dfc797b273a410acc",
"packages": [
{
"name": "blade-ui-kit/blade-heroicons",
@@ -3690,8 +3690,7 @@
},
"require-dev": {
"pestphp/pest": "^1.20",
- "phpstan/phpstan": "^1.4",
- "spatie/ray": "^1.28"
+ "phpstan/phpstan": "^1.4"
},
"type": "library",
"autoload": {
@@ -8243,16 +8242,16 @@
},
{
"name": "phpstan/phpstan",
- "version": "1.11.x-dev",
+ "version": "1.10.67",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
- "reference": "35e3cbdb5fe90347ab6ce24d8040dd76fa1b65eb"
+ "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpstan/phpstan/zipball/35e3cbdb5fe90347ab6ce24d8040dd76fa1b65eb",
- "reference": "35e3cbdb5fe90347ab6ce24d8040dd76fa1b65eb",
+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/16ddbe776f10da6a95ebd25de7c1dbed397dc493",
+ "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493",
"shasum": ""
},
"require": {
@@ -8261,7 +8260,6 @@
"conflict": {
"phpstan/phpstan-shim": "*"
},
- "default-branch": true,
"bin": [
"phpstan",
"phpstan.phar"
@@ -8296,13 +8294,9 @@
{
"url": "https://github.com/phpstan",
"type": "github"
- },
- {
- "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
- "type": "tidelift"
}
],
- "time": "2024-02-22T13:52:50+00:00"
+ "time": "2024-04-16T07:22:02+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -10638,8 +10632,10 @@
],
"aliases": [],
"minimum-stability": "dev",
- "stability-flags": [],
- "prefer-stable": false,
+ "stability-flags": {
+ "orchestra/testbench": 20
+ },
+ "prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^8.2",
diff --git a/phpunit.xml b/phpunit.xml
index 1df37cf..a3986eb 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -12,12 +12,12 @@
tests
-
-
-
+
+
+
diff --git a/src/Forms/Components/MoneyInput.php b/src/Forms/Components/MoneyInput.php
index aa74407..23d0775 100644
--- a/src/Forms/Components/MoneyInput.php
+++ b/src/Forms/Components/MoneyInput.php
@@ -7,12 +7,12 @@
use Illuminate\Support\Facades\Config;
use Pelmered\FilamentMoneyField\Forms\Rules\MaxValueRule;
use Pelmered\FilamentMoneyField\Forms\Rules\MinValueRule;
-use Pelmered\FilamentMoneyField\hasMoneyAttributes;
+use Pelmered\FilamentMoneyField\HasMoneyAttributes;
use Pelmered\FilamentMoneyField\MoneyFormatter;
class MoneyInput extends TextInput
{
- use hasMoneyAttributes;
+ use HasMoneyAttributes;
protected function setUp(): void
{
diff --git a/src/hasMoneyAttributes.php b/src/HasMoneyAttributes.php
similarity index 87%
rename from src/hasMoneyAttributes.php
rename to src/HasMoneyAttributes.php
index c9cadb1..6c03243 100644
--- a/src/hasMoneyAttributes.php
+++ b/src/HasMoneyAttributes.php
@@ -6,7 +6,7 @@
use Money\Currencies\ISOCurrencies;
use Money\Currency;
-trait hasMoneyAttributes
+trait HasMoneyAttributes
{
protected Currency $currency;
protected string $locale;
@@ -24,7 +24,7 @@ public function getLocale(): string
public function currency(string|\Closure|null $currencyCode = null): static
{
- $this->currency = new Currency($currencyCode);
+ $this->currency = new Currency($this->evaluate($currencyCode));
$currencies = new ISOCurrencies();
if (!$currencies->contains($this->currency)) {
@@ -36,7 +36,7 @@ public function currency(string|\Closure|null $currencyCode = null): static
public function locale(string|\Closure|null $locale = null): static
{
- $this->locale = $locale;
+ $this->locale = $this->evaluate($locale);
return $this;
}
diff --git a/src/Infolists/Components/MoneyEntry.php b/src/Infolists/Components/MoneyEntry.php
index 14f3ec5..49144ab 100644
--- a/src/Infolists/Components/MoneyEntry.php
+++ b/src/Infolists/Components/MoneyEntry.php
@@ -3,12 +3,12 @@
namespace Pelmered\FilamentMoneyField\Infolists\Components;
use Filament\Infolists\Components\TextEntry;
-use Pelmered\FilamentMoneyField\hasMoneyAttributes;
+use Pelmered\FilamentMoneyField\HasMoneyAttributes;
use Pelmered\FilamentMoneyField\MoneyFormatter;
class MoneyEntry extends TextEntry
{
- use hasMoneyAttributes;
+ use HasMoneyAttributes;
protected function setUp(): void
{
diff --git a/src/Tables/Columns/MoneyColumn.php b/src/Tables/Columns/MoneyColumn.php
index bfdbbf7..ba4f527 100644
--- a/src/Tables/Columns/MoneyColumn.php
+++ b/src/Tables/Columns/MoneyColumn.php
@@ -3,12 +3,12 @@
namespace Pelmered\FilamentMoneyField\Tables\Columns;
use Filament\Tables\Columns\TextColumn;
-use Pelmered\FilamentMoneyField\hasMoneyAttributes;
+use Pelmered\FilamentMoneyField\HasMoneyAttributes;
use Pelmered\FilamentMoneyField\MoneyFormatter;
class MoneyColumn extends TextColumn
{
- use hasMoneyAttributes;
+ use HasMoneyAttributes;
protected function setUp(): void
{