1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 18:04:03 +00:00

Improve ValidatesDatabaseParameters docblocks

This commit is contained in:
lukinovec 2026-04-29 17:30:58 +02:00
parent 740d53e9cc
commit 85929493d5

View file

@ -6,6 +6,15 @@ namespace Stancl\Tenancy\Database\Concerns;
use InvalidArgumentException; use InvalidArgumentException;
/**
* Provides methods to validate database parameters (e.g. database names, usernames, passwords)
* before using them in SQL statements (or in file paths in the case of SQLiteDatabaseManager).
*
* Used where parameters can be provided by users, and where parameter binding isn't possible.
*
* @mixin \Stancl\Tenancy\Database\TenantDatabaseManagers\TenantDatabaseManager
* @mixin \Stancl\Tenancy\Database\TenantDatabaseManagers\SQLiteDatabaseManager
*/
trait ValidatesDatabaseParameters trait ValidatesDatabaseParameters
{ {
/** /**
@ -30,8 +39,9 @@ trait ValidatesDatabaseParameters
} }
/** /**
* Validate that parameters (database names, usernames, etc.) * Ensure that parameters (database names, usernames, etc.)
* only contain allowed characters before used in SQL statements. * only contain allowed characters before used in SQL statements
* (or file names in the case of SQLiteDatabaseManager).
* *
* By default, only the characters in static::parameterAllowlist() are allowed. * By default, only the characters in static::parameterAllowlist() are allowed.
* *
@ -60,9 +70,9 @@ trait ValidatesDatabaseParameters
} }
/** /**
* Validate that a password only contains allowed characters before used in SQL statements. * Ensure password only contains allowed characters before used in SQL statements.
* *
* Used as a shorthand for validateParameter() with the less strict allowlist. * Used as a shorthand for calling validateParameter() with the less strict allowlist.
* *
* @throws InvalidArgumentException * @throws InvalidArgumentException
*/ */