-
Couldn't load subscription status.
- Fork 27
Description
Issue Description:
While using vcian/laravel-db-auditor, the following deprecation warning is thrown:
Deprecated: Vcian\LaravelDBAuditor\Traits\Audit::addConstraint(): Implicitly marking parameter $referenceTableName as nullable is deprecated, the explicit nullable type must be used instead in /vendor/vcian/laravel-db-auditor/src/Traits/Audit.php on line 92
This is due to a change in PHP where function parameters with a default value of null must now explicitly be marked as nullable.
File: vendor/vcian/laravel-db-auditor/src/Traits/Audit.php
Line: 92
Current Code:
public function addConstraint(
string $table,
string $field,
string $constraint,
string $referenceTableName = null,
string $referenceField = null
): boolProposed Fix:
To resolve this deprecation, the $referenceTableName and $referenceField parameters in the addConstraint function should be explicitly declared as nullable by prefixing their type with a question mark (?).
Updated Code:
public function addConstraint(
string $table,
string $field,
string $constraint,
?string $referenceTableName = null,
?string $referenceField = null
): boolThis change will make the code compliant with the latest PHP standards and remove the deprecation warning.