diff --git a/rector.php b/rector.php index 8dc46cf..f45265d 100644 --- a/rector.php +++ b/rector.php @@ -3,9 +3,12 @@ use Rector\Caching\ValueObject\Storage\FileCacheStorage; use Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector; use Rector\CodingStyle\Rector\Closure\StaticClosureRector; +use Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector; use Rector\Config\RectorConfig; use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; use Rector\Set\ValueObject\SetList; +use RectorLaravel\Rector\FuncCall\RemoveDumpDataDeadCodeRector; +use RectorLaravel\Rector\PropertyFetch\OptionalToNullsafeOperatorRector; use RectorLaravel\Set\LaravelSetList; return static function (RectorConfig $rectorConfig): void { @@ -16,7 +19,7 @@ ]); $rectorConfig->parallel( - seconds: 360, + processTimeout: 360, maxNumberOfProcess: 16, jobSize: 20 ); @@ -35,6 +38,11 @@ // skip paths and/or rules //---------------------------------------------------------- $rectorConfig->skip([ + // Rector transforme $foo++ en ++$foo et derrière Pint transforme ++$foo en $foo++ + // du coup je désactive, laissant pour le moment la priorité à Pint + // @todo : voir qu'est-ce qui est le mieux + PostIncDecToPreIncDecRector::class, + // Transforms false positives, I prefer to disable that (PHP 8.1) NullToStrictStringFuncCallArgRector::class, @@ -43,6 +51,11 @@ StaticArrowFunctionRector::class, ]); + $rectorConfig->rules([ + OptionalToNullsafeOperatorRector::class, + RemoveDumpDataDeadCodeRector::class, + ]); + // define what sets of rules will be applied // tip: use "SetList" class to autocomplete sets with your IDE //---------------------------------------------------------- diff --git a/src/Components/Forms/Inputs/Date.php b/src/Components/Forms/Inputs/Date.php index 77def96..0f9f6fb 100644 --- a/src/Components/Forms/Inputs/Date.php +++ b/src/Components/Forms/Inputs/Date.php @@ -8,9 +8,9 @@ class Date extends Input { public function __construct( string $name, - string $value = null, - string $id = null, - string $errorBag = null, + ?string $value = null, + ?string $id = null, + ?string $errorBag = null, ) { parent::__construct( name: $name, diff --git a/src/Components/Forms/Inputs/Email.php b/src/Components/Forms/Inputs/Email.php index 60a4fb4..39bca38 100644 --- a/src/Components/Forms/Inputs/Email.php +++ b/src/Components/Forms/Inputs/Email.php @@ -8,9 +8,9 @@ class Email extends Input { public function __construct( string $name, - string $value = null, - string $id = null, - string $errorBag = null, + ?string $value = null, + ?string $id = null, + ?string $errorBag = null, ) { parent::__construct( name: $name, diff --git a/src/Components/Forms/Inputs/Hidden.php b/src/Components/Forms/Inputs/Hidden.php index fcb1267..595e6c2 100644 --- a/src/Components/Forms/Inputs/Hidden.php +++ b/src/Components/Forms/Inputs/Hidden.php @@ -8,8 +8,8 @@ class Hidden extends Input { public function __construct( string $name, - string $value = null, - string $id = null, + ?string $value = null, + ?string $id = null, ) { parent::__construct( name: $name, diff --git a/src/Components/Forms/Inputs/Input.php b/src/Components/Forms/Inputs/Input.php index 1d33182..5ce6ea6 100644 --- a/src/Components/Forms/Inputs/Input.php +++ b/src/Components/Forms/Inputs/Input.php @@ -18,9 +18,9 @@ class Input extends BladeComponent public function __construct( public string $name, public string $type = 'text', - string $value = null, - string $id = null, - string $errorBag = null + ?string $value = null, + ?string $id = null, + ?string $errorBag = null ) { $this->value = \old($name, $value ?? ''); $this->id = $id ?? $name; diff --git a/src/Components/Forms/Inputs/Password.php b/src/Components/Forms/Inputs/Password.php index 4341c4e..537c81f 100644 --- a/src/Components/Forms/Inputs/Password.php +++ b/src/Components/Forms/Inputs/Password.php @@ -8,8 +8,8 @@ class Password extends Input { public function __construct( string $name, - string $id = null, - string $errorBag = null + ?string $id = null, + ?string $errorBag = null ) { parent::__construct( name: $name, diff --git a/src/Components/Forms/Inputs/Select.php b/src/Components/Forms/Inputs/Select.php index 8f2b12c..ce7ef04 100644 --- a/src/Components/Forms/Inputs/Select.php +++ b/src/Components/Forms/Inputs/Select.php @@ -22,8 +22,8 @@ public function __construct( public ?string $placeholder = null, string $labelAttribute = 'name', string $valueAttribute = 'id', - string $id = null, - string $errorBag = null + ?string $id = null, + ?string $errorBag = null ) { $this->id = $id ?? $name; diff --git a/src/Components/Forms/Inputs/Text.php b/src/Components/Forms/Inputs/Text.php index 7445bb1..5aa199f 100644 --- a/src/Components/Forms/Inputs/Text.php +++ b/src/Components/Forms/Inputs/Text.php @@ -8,9 +8,9 @@ class Text extends Input { public function __construct( string $name, - string $value = null, - string $id = null, - string $errorBag = null, + ?string $value = null, + ?string $id = null, + ?string $errorBag = null, ) { parent::__construct( name: $name, diff --git a/src/Components/Forms/Inputs/Textarea.php b/src/Components/Forms/Inputs/Textarea.php index 0556806..ec33f3f 100644 --- a/src/Components/Forms/Inputs/Textarea.php +++ b/src/Components/Forms/Inputs/Textarea.php @@ -15,8 +15,8 @@ class Textarea extends BladeComponent public function __construct( public string $name, - string $id = null, - string $errorBag = null + ?string $id = null, + ?string $errorBag = null ) { $this->id = $id ?? $name; diff --git a/src/Components/Forms/Inputs/Time.php b/src/Components/Forms/Inputs/Time.php index 3e4927f..74ded56 100644 --- a/src/Components/Forms/Inputs/Time.php +++ b/src/Components/Forms/Inputs/Time.php @@ -8,9 +8,9 @@ class Time extends Input { public function __construct( string $name, - string $value = null, - string $id = null, - string $errorBag = null + ?string $value = null, + ?string $id = null, + ?string $errorBag = null ) { parent::__construct( name: $name, diff --git a/src/Concerns/BtnVariant.php b/src/Concerns/BtnVariant.php index 31f1eae..0be3357 100644 --- a/src/Concerns/BtnVariant.php +++ b/src/Concerns/BtnVariant.php @@ -32,6 +32,7 @@ trait BtnVariant private function validBtnVariant(string $variant): string { $allowedVariants = self::ALLOWED_BS5_VARIANTS; + if (\app('config')->get('blade-ui-kit-bootstrap.boostrap_version') === 'bootstrap-4') { $allowedVariants = self::ALLOWED_BS4_VARIANTS; } diff --git a/src/Concerns/CanHaveErrors.php b/src/Concerns/CanHaveErrors.php index 79a525b..85d7273 100644 --- a/src/Concerns/CanHaveErrors.php +++ b/src/Concerns/CanHaveErrors.php @@ -24,7 +24,7 @@ public function messages(): array return $bag->has($this->errorField) ? $bag->get($this->errorField) : []; } - protected function bootCanHaveErrors(string $errorField, string $errorBag = null): void + protected function bootCanHaveErrors(string $errorField, ?string $errorBag = null): void { static $view = null; @@ -45,7 +45,7 @@ protected function errorField(string $errorField): void $this->errorField = $errorField; } - protected function errorBag(string $errorBag = null): void + protected function errorBag(?string $errorBag = null): void { if (is_null($errorBag)) { return;