Skip to content

Commit ff4d128

Browse files
Fix depricated warning on PHP 8.4
1 parent 136c77b commit ff4d128

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

helpers/helpers.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
use Kris\LaravelFormBuilder\Fields\FormField;
44
use Kris\LaravelFormBuilder\Form;
55

6-
if(! function_exists('getFormBuilderViewPath')) {
6+
if (! function_exists('getFormBuilderViewPath')) {
77
function getFormBuilderViewPath(string $fileName): string
88
{
99
$p = explode('.', $fileName);
1010
$c = count($p);
11-
if($c > 2 || $p[$c - 1] != 'php') {
11+
if ($c > 2 || $p[$c - 1] != 'php') {
1212
throw new Exception('You should use only *.php files with this function');
1313
}
1414

@@ -18,7 +18,7 @@ function getFormBuilderViewPath(string $fileName): string
1818
}
1919
}
2020

21-
if(! function_exists('errorBlockPath')) {
21+
if (! function_exists('errorBlockPath')) {
2222

2323
function errorBlockPath(): string
2424
{
@@ -27,7 +27,7 @@ function errorBlockPath(): string
2727

2828
}
2929

30-
if(! function_exists('helpBlockPath')) {
30+
if (! function_exists('helpBlockPath')) {
3131

3232
function helpBlockPath(): string
3333
{

src/Filters/Exception/InvalidInstanceException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
class InvalidInstanceException extends \Exception
1515
{
16-
public function __construct($message = '', $code = 0, Throwable $previous = null)
16+
public function __construct($message = '', $code = 0, ?Throwable $previous = null)
1717
{
1818
$message = 'Filter object must implement ' . FilterInterface::class;
1919
parent::__construct($message, $code, $previous);

src/Filters/Exception/UnableToResolveFilterException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
class UnableToResolveFilterException extends \Exception
1414
{
15-
public function __construct($message = '', $code = 0, Throwable $previous = null)
15+
public function __construct($message = '', $code = 0, ?Throwable $previous = null)
1616
{
1717
$message = "Passed filter can't be resolved.";
1818
parent::__construct($message, $code, $previous);

src/FormHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private function loadCustomTypes(): void
7575
}
7676
}
7777

78-
public function getConfig(string $key = null, string $default = null, array $customConfig = []): mixed
78+
public function getConfig(?string $key = null, ?string $default = null, array $customConfig = []): mixed
7979
{
8080
$config = array_replace_recursive($this->config, $customConfig);
8181

src/Rules.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function setFieldName(string $name): static
2828
return $this;
2929
}
3030

31-
public function addFieldRule($rule, string $fieldName = null): void
31+
public function addFieldRule($rule, ?string $fieldName = null): void
3232
{
3333
$rules = $this->getFieldRules($fieldName);
3434
$rules[] = $rule;
@@ -57,7 +57,7 @@ protected function ensureFieldName(string $fieldName): ?string
5757
return $fieldName;
5858
}
5959

60-
public function setFieldRules(array $rules, string $fieldName = null): void
60+
public function setFieldRules(array $rules, ?string $fieldName = null): void
6161
{
6262
$fieldName = $this->ensureFieldName($fieldName);
6363
$this->rules[$fieldName] = $rules;

src/Supports/FormBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __construct(
5555
UrlGenerator $url,
5656
Factory $view,
5757
$csrfToken,
58-
Request $request = null
58+
?Request $request = null
5959
) {
6060
$this->url = $url;
6161
$this->html = $html;

src/Supports/HtmlBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class HtmlBuilder
2121

2222
protected Factory $view;
2323

24-
public function __construct(UrlGenerator $url = null, Factory $view)
24+
public function __construct(?UrlGenerator $url = null, Factory $view)
2525
{
2626
$this->url = $url;
2727
$this->view = $view;

0 commit comments

Comments
 (0)