From d69184eaf5a5c03ca1f8995ce026a98f8e4fe5e9 Mon Sep 17 00:00:00 2001 From: "Kamshory, MT" Date: Sat, 5 Jul 2025 16:47:39 +0700 Subject: [PATCH 1/2] URL-Based Database Credential Parsing --- CHANGELOG.md | 56 +++++ docs/doc.html | 304 +++++++++++++++++++---- src/Database/PicoDatabaseCredentials.php | 83 +++++++ 3 files changed, 400 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24f72b48..66386344 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1078,3 +1078,59 @@ These methods now safely accept **a single argument**, defaulting the missing pa - Prevents PHP warnings in production environments. This bug fix enhances robustness and backward compatibility for developers using dynamic number formatting features in MagicObject. + + +# MagicObject Version 3.14.5 + +## What's Changed + +### New Feature: URL-Based Database Credential Parsing + +MagicObject now supports importing database credentials from a **datasource URL** string using the new method `PicoDatabaseCredentials::importFromUrl()`. + +This enhancement simplifies configuration and integration with environment-based or externalized connection settings (e.g., `DATABASE_URL`). + +#### Supported URL Format + +driver://username:password@host:port/database?schema=public&charset=utf8&timezone=Asia/Jakarta + + +#### Example + +```php +$credentials = new PicoDatabaseCredentials(); +$credentials->importFromUrl( + 'mysql://user:secret@localhost:3306/myapp?schema=public&charset=utf8mb4&timezone=Asia/Jakarta' +); +``` + +#### Optional Override + +Username and password can be passed directly to override the values in the URL: + +```php +$credentials->importFromUrl($url, 'realuser', 'realpass'); +``` + +This is useful when credentials are stored separately from the connection string. + +#### Special Handling for SQLite + +When using sqlite:///path/to/database.db, the file path is automatically mapped to databaseFilePath instead of host/port. + +```php +$url = 'sqlite:///path/to/database.db'; +$credentials->importFromUrl($url); +``` + +### Why It Matters + +- Makes deployment and configuration more flexible in containerized or cloud environments. + +- Simplifies integration with .env files, environment variables, or external secrets managers. + +- Supports both traditional and SQLite-based databases. + +### Backward Compatibility + +This update is fully backward-compatible and does not change any existing behavior unless the new method is used explicitly. \ No newline at end of file diff --git a/docs/doc.html b/docs/doc.html index ad29c4ac..86b79118 100644 --- a/docs/doc.html +++ b/docs/doc.html @@ -11,7 +11,7 @@
+

MagicObject\DataTable

@@ -1314,7 +1314,8 @@

Declaration

public function validate(
    string|null $parentPropertyName = null,
    array|null $messageTemplate = null,
-    MagicObject|null $reference = null
+    MagicObject|null $reference = null,
+    bool $validateIfReferenceEmpty = true
) : self
{
}

Description

@@ -1330,6 +1331,11 @@

Parameters

Optional reference object. If provided and is an instance of MagicObject, validation will use the property annotations from the reference class (not from the validated object's class), but the data to validate is taken from the current object.

+
$validateIfReferenceEmpty
+

If true, and a reference object is provided but empty, +validation will proceed using the current object's properties. +If false, validation is skipped if the reference object is empty. +Defaults to true.

Return

self

Returns the current instance for method chaining.

@@ -3751,7 +3757,8 @@

Declaration

public function validate(
    string|null $parentPropertyName = null,
    array|null $messageTemplate = null,
-    MagicObject|null $reference = null
+    MagicObject|null $reference = null,
+    bool $validateIfReferenceEmpty = true
) : self
{
}

Description

@@ -3767,6 +3774,11 @@

Parameters

Optional reference object. If provided and is an instance of MagicObject, validation will use the property annotations from the reference class (not from the validated object's class), but the data to validate is taken from the current object.

+
$validateIfReferenceEmpty
+

If true, and a reference object is provided but empty, +validation will proceed using the current object's properties. +If false, validation is skipped if the reference object is empty. +Defaults to true.

Return

self

Returns the current instance for method chaining.

@@ -4809,7 +4821,43 @@

Return

-
46. __toString
+
46. validate
+

Declaration

+
public function validate(
+    string|null $parentPropertyName = null,
+    array|null $messageTemplate = null,
+    MagicObject|null $reference = null,
+    bool $validateIfReferenceEmpty = true
+) : self
{
}
+
+

Description

+

Validate the current object based on property annotations.

+

This method checks the properties of the current object against validation annotations. +If any validation rule fails, an InvalidValueException will be thrown.

+

Parameters

+
$parentPropertyName
+

The name of the parent property, if applicable (for nested validation).

+
$messageTemplate
+

Optional custom message templates for validation errors.

+
$reference
+

Optional reference object. If provided and is an instance of MagicObject, +validation will use the property annotations from the reference class +(not from the validated object's class), but the data to validate is taken from the current object.

+
$validateIfReferenceEmpty
+

If true, and a reference object is provided but empty, +validation will proceed using the current object's properties. +If false, validation is skipped if the reference object is empty. +Defaults to true.

+

Return

+
self
+

Returns the current instance for method chaining.

+

Throws

+
InvalidValueException
+

If validation fails.

+
+
+
+
47. __toString

Declaration

public function __toString() : string
{
}
@@ -5191,7 +5239,43 @@

Return

-
17. __toString
+
17. validate
+

Declaration

+
public function validate(
+    string|null $parentPropertyName = null,
+    array|null $messageTemplate = null,
+    MagicObject|null $reference = null,
+    bool $validateIfReferenceEmpty = true
+) : self
{
}
+
+

Description

+

Validate the current object based on property annotations.

+

This method checks the properties of the current object against validation annotations. +If any validation rule fails, an InvalidValueException will be thrown.

+

Parameters

+
$parentPropertyName
+

The name of the parent property, if applicable (for nested validation).

+
$messageTemplate
+

Optional custom message templates for validation errors.

+
$reference
+

Optional reference object. If provided and is an instance of MagicObject, +validation will use the property annotations from the reference class +(not from the validated object's class), but the data to validate is taken from the current object.

+
$validateIfReferenceEmpty
+

If true, and a reference object is provided but empty, +validation will proceed using the current object's properties. +If false, validation is skipped if the reference object is empty. +Defaults to true.

+

Return

+
self
+

Returns the current instance for method chaining.

+

Throws

+
InvalidValueException
+

If validation fails.

+
+
+
+
18. __toString

Declaration

public function __toString() : string
{
}
@@ -6819,9 +6903,12 @@

Description

Example usage:

 <?php
  $credentials = new PicoDatabaseCredentials();
+ $credentials->setDriver('mysql');
  $credentials->setHost('localhost');
+ $credentials->setPort(3306);
  $credentials->setUsername('user');
- $credentials->setPassword('password');
+ $credentials->setPassword('password'); + $credentials->setDatabaseName('app');

The attributes are automatically encrypted when set, providing a secure way to handle sensitive information within your application.

@@ -6938,6 +7025,32 @@

Description

from overriding its value.

+

Methods

+
+
1. importFromUrl
+

Declaration

+
public function importFromUrl(
+    string $url,
+    string|null $username = null,
+    string|null $password = null
+) : self
{
}
+
+

Description

+

Import database credentials from a URL datasource string.

+

Supported format: +scheme://username:password@host:port/database?schema=public&charset=utf8&timezone=Asia/Jakarta

+

Parameters

+
$url
+

The datasource URL

+
$username
+

Optional username to override the one from URL

+
$password
+

Optional password to override the one from URL

+

Return

+
self
+

Returns the current instance for method chaining.

+
+

MagicObject\Database\PicoDatabaseEntity

@@ -10431,7 +10544,8 @@

Declaration

public function validate(
    string|null $parentPropertyName = null,
    array|null $messageTemplate = null,
-    MagicObject|null $reference = null
+    MagicObject|null $reference = null,
+    bool $validateIfReferenceEmpty = true
) : self
{
}

Description

@@ -10447,6 +10561,11 @@

Parameters

Optional reference object. If provided and is an instance of MagicObject, validation will use the property annotations from the reference class (not from the validated object's class), but the data to validate is taken from the current object.

+
$validateIfReferenceEmpty
+

If true, and a reference object is provided but empty, +validation will proceed using the current object's properties. +If false, validation is skipped if the reference object is empty. +Defaults to true.

Return

self

Returns the current instance for method chaining.

@@ -19025,6 +19144,44 @@

Return

+
+

MagicObject\Exceptions\ObjectParsingError

+

Declaration

+
class ObjectParsingError extends Exception implements Throwable +{ +}
+
+

Description

+

Exception thrown when an object encounters an error during parsing or data conversion.

+

This exception indicates that a process intended to parse or convert data into +an object (or from an object into another format) has failed. It can encapsulate +a previous exception that caused the parsing error, providing more context for +debugging and error handling.

+
+

Properties

+
+
1. previous
+

Declaration

+
private Throwable $previous;
+
+

Description

+

Previous exception

+
+
+

Methods

+
+
2. getPreviousException
+

Declaration

+
public function getPreviousException() : Throwable|null
{
}
+
+

Description

+

Get the previous exception.

+

Return

+
Throwable|null
+

The previous exception

+
+
+

MagicObject\Exceptions\UnknownErrorException

Declaration

@@ -21012,7 +21169,25 @@

Return

-
3. getPropertyName
+
3. getMaximumLength
+

Declaration

+
public function getMaximumLength(
+    string $columnType
+) : int|null
{
}
+
+

Description

+

Extract maximum length from column_type string if applicable.

+

Supports MySQL, PostgreSQL, and SQLite types.

+

Parameters

+
$columnType
+
+

Return

+
int|null
+
+
+
+
+
4. getPropertyName

Declaration

public function getPropertyName(
    string $name,
@@ -21035,7 +21210,7 @@

Return

-
4. getColumnType
+
5. getColumnType

Declaration

public function getColumnType(
    array $typeMap,
@@ -21055,7 +21230,7 @@

Return

-
5. getDataType
+
6. getDataType

Declaration

public function getDataType(
    array $typeMap,
@@ -21075,7 +21250,7 @@

Return

-
6. getDataLength
+
7. getDataLength

Declaration

public function getDataLength(
    string $dataType
@@ -21103,7 +21278,7 @@

Return

-
7. getTypeMap
+
8. getTypeMap

Declaration

public function getTypeMap() : array
{
}
@@ -21122,7 +21297,7 @@

Return

-
8. getColumnMap
+
9. getColumnMap

Declaration

public function getColumnMap() : array
{
}
@@ -21136,7 +21311,7 @@

Return

-
9. getColumnMapByType
+
10. getColumnMapByType

Declaration

public function getColumnMapByType(
    string $targetDb
@@ -21155,7 +21330,7 @@

Return

-
10. generate
+
11. generate

Declaration

public function generate(
    string[]|null $nonupdatables = null,
@@ -21178,14 +21353,15 @@

Return

-
11. generateValidatorClass
+
12. generateValidatorClass

Declaration

public function generateValidatorClass(
    string $namespace,
    string $className,
    string $moduleCode,
    array $validationDefinition,
-    string $applyKey
+    string $applyKey,
+    string $tableName = null
) : string
{
}

Description

@@ -21212,6 +21388,8 @@

Parameters

An array of field definitions, each containing field name, type, and validation rules.

$applyKey

Determines which rules to apply, usually 'applyInsert' or 'applyUpdate'.

+
$tableName
+

Original table name

Return

string

Returns the full PHP source code of the generated class as a string.

@@ -25849,7 +26027,9 @@

Return

Declaration

public function validate(
    string|null $parentPropertyName = null,
-    array|null $messageTemplate = null
+    array|null $messageTemplate = null,
+    MagicObject|null $reference = null,
+    bool $validateIfReferenceEmpty = null
) : self
{
}

Description

@@ -25861,12 +26041,23 @@

Parameters

The name of the parent property, if applicable (for nested validation).

$messageTemplate

Optional custom message templates for validation errors.

+
$reference
+

Optional reference object. If provided and is an instance of MagicObject, +validation will use the property annotations from the reference class +(not from the validated object's class), but the data to validate is taken from the current object.

+
$validateIfReferenceEmpty
+

If true, and a reference object is provided but empty, +validation will proceed using the current object's properties. +If false, validation is skipped if the reference object is empty. +Defaults to true.

Return

self

Returns the current instance for method chaining.

Throws

-
\MagicObject\Exceptions\InvalidValueException
-

If validation fails.

+
InvalidValueException
+

If validation fails due to a validation rule.

+
ObjectParsingError
+

If the object cannot be converted to a valid JSON string for validation.

@@ -39746,7 +39937,7 @@

Declaration

public function validate(
    object $object,
    string|null $parentPropertyName = null
-)
{
}
+) : self
{
}

Description

Validates an object's properties against defined annotations in their docblocks. @@ -39757,6 +39948,9 @@

Parameters

accessed via Reflection, so protected/private properties are handled.

$parentPropertyName

Optional. The name of the parent property, used for nested validation messages.

+

Return

+
self
+

Returns the current instance for method chaining.

Throws

InvalidValueException

If any validation constraint is violated.

@@ -40215,7 +40409,31 @@

Throws

-
26. validateLengthAnnotation
+
26. validateMaxLengthAnnotation
+

Declaration

+
private function validateMaxLengthAnnotation(
+    string $propertyName,
+    mixed $propertyValue,
+    string $docComment
+)
{
}
+
+

Description

+

Validates the MaxLength annotation. +Ensures the length of a string does not exceed a specified maximum value.

+

Parameters

+
$propertyName
+

The name of the property being validated, potentially including parent path.

+
$propertyValue
+

The current value of the property.

+
$docComment
+

The docblock comment of the property.

+

Throws

+
InvalidValueException
+

If the string length exceeds the specified maximum.

+
+
+
+
27. validateLengthAnnotation

Declaration

private function validateLengthAnnotation(
    string $propertyName,
@@ -40239,7 +40457,7 @@

Throws

-
27. validateRangeAnnotation
+
28. validateRangeAnnotation

Declaration

private function validateRangeAnnotation(
    string $propertyName,
@@ -40263,7 +40481,7 @@

Throws

-
28. parseAnnotationParameters
+
29. parseAnnotationParameters

Declaration

private function parseAnnotationParameters(
    string $annotation,
@@ -40283,7 +40501,7 @@

Return

-
29. validateNoHtmlAnnotation
+
30. validateNoHtmlAnnotation

Declaration

private function validateNoHtmlAnnotation(
    string $propertyName,
@@ -40307,7 +40525,7 @@

Throws

-
30. validateEnumAnnotation
+
31. validateEnumAnnotation

Declaration

private function validateEnumAnnotation(
    string $propertyName,
@@ -40332,7 +40550,7 @@

Throws

-
31. validatePositiveAnnotation
+
32. validatePositiveAnnotation

Declaration

private function validatePositiveAnnotation()
{
}
@@ -40342,7 +40560,7 @@

Description

-
32. validatePositiveOrZeroAnnotation
+
33. validatePositiveOrZeroAnnotation

Declaration

private function validatePositiveOrZeroAnnotation()
{
}
@@ -40352,7 +40570,7 @@

Description

-
33. validateNegativeAnnotation
+
34. validateNegativeAnnotation

Declaration

private function validateNegativeAnnotation()
{
}
@@ -40362,7 +40580,7 @@

Description

-
34. validateNegativeOrZeroAnnotation
+
35. validateNegativeOrZeroAnnotation

Declaration

private function validateNegativeOrZeroAnnotation()
{
}
@@ -40372,7 +40590,7 @@

Description

-
35. validatePastOrPresentAnnotation
+
36. validatePastOrPresentAnnotation

Declaration

private function validatePastOrPresentAnnotation()
{
}
@@ -40382,7 +40600,7 @@

Description

-
36. validateUrlAnnotation
+
37. validateUrlAnnotation

Declaration

private function validateUrlAnnotation()
{
}
@@ -40392,7 +40610,7 @@

Description

-
37. validateIpAnnotation
+
38. validateIpAnnotation

Declaration

private function validateIpAnnotation()
{
}
@@ -40402,7 +40620,7 @@

Description

-
38. validateDateFormatAnnotation
+
39. validateDateFormatAnnotation

Declaration

private function validateDateFormatAnnotation()
{
}
@@ -40412,7 +40630,7 @@

Description

-
39. validatePhoneAnnotation
+
40. validatePhoneAnnotation

Declaration

private function validatePhoneAnnotation()
{
}
@@ -40422,7 +40640,7 @@

Description

-
40. isBlank
+
41. isBlank

Declaration

public function isBlank(
    string $value
@@ -40440,7 +40658,7 @@

Return

-
41. validateAlphaAnnotation
+
42. validateAlphaAnnotation

Declaration

private function validateAlphaAnnotation()
{
}
@@ -40450,7 +40668,7 @@

Description

-
42. validateAlphaNumericAnnotation
+
43. validateAlphaNumericAnnotation

Declaration

private function validateAlphaNumericAnnotation()
{
}
@@ -40460,7 +40678,7 @@

Description

-
43. validateStartsWithAnnotation
+
44. validateStartsWithAnnotation

Declaration

private function validateStartsWithAnnotation()
{
}
@@ -40471,7 +40689,7 @@

Description

-
44. validateEndsWithAnnotation
+
45. validateEndsWithAnnotation

Declaration

private function validateEndsWithAnnotation()
{
}
@@ -40482,7 +40700,7 @@

Description

-
45. validateContainsAnnotation
+
46. validateContainsAnnotation

Declaration

private function validateContainsAnnotation()
{
}
@@ -40493,7 +40711,7 @@

Description

-
46. validateBeforeDateAnnotation
+
47. validateBeforeDateAnnotation

Declaration

private function validateBeforeDateAnnotation()
{
}
@@ -40503,7 +40721,7 @@

Description

-
47. validateAfterDateAnnotation
+
48. validateAfterDateAnnotation

Declaration

private function validateAfterDateAnnotation()
{
}
diff --git a/src/Database/PicoDatabaseCredentials.php b/src/Database/PicoDatabaseCredentials.php index ee17b07c..20d911c5 100644 --- a/src/Database/PicoDatabaseCredentials.php +++ b/src/Database/PicoDatabaseCredentials.php @@ -2,6 +2,7 @@ namespace MagicObject\Database; +use InvalidArgumentException; use MagicObject\SecretObject; /** @@ -17,9 +18,12 @@ * ```php * setDriver('mysql'); * $credentials->setHost('localhost'); + * $credentials->setPort(3306); * $credentials->setUsername('user'); * $credentials->setPassword('password'); + * $credentials->setDatabaseName('app'); * ``` * * The attributes are automatically encrypted when set, providing a secure way to handle sensitive @@ -113,4 +117,83 @@ class PicoDatabaseCredentials extends SecretObject */ protected $charset; + /** + * Import database credentials from a URL datasource string. + * + * Supported format: + * scheme://username:password@host:port/database?schema=public&charset=utf8&timezone=Asia/Jakarta + * + * @param string $url The datasource URL + * @param string|null $username Optional username to override the one from URL + * @param string|null $password Optional password to override the one from URL + * @return self Returns the current instance for method chaining. + */ + public function importFromUrl($url, $username = null, $password = null) // NOSONAR + { + $parts = parse_url($url); + + if (!$parts) { + throw new InvalidArgumentException("Invalid database URL"); + } + + // Basic connection parts + if (isset($parts['scheme'])) { + $this->setDriver($parts['scheme']); + } + + if ($this->getDriver() === 'sqlite' && isset($parts['path'])) { + $this->setDatabaseFilePath($parts['path']); + return; + } + + if (isset($parts['host'])) { + $this->setHost($parts['host']); + } + + if (isset($parts['port'])) { + $port = (int) $parts['port']; + if ($port < 0) { + throw new InvalidArgumentException("Invalid port: must be a non-negative integer"); + } + $this->setPort($port); + } + + // Username and password + if ($username !== null) { + $this->setUsername($username); + } elseif (isset($parts['user'])) { + $this->setUsername($parts['user']); + } + + if ($password !== null) { + $this->setPassword($password); + } elseif (isset($parts['pass'])) { + $this->setPassword($parts['pass']); + } + + if (isset($parts['path'])) { + $dbName = ltrim($parts['path'], '/'); + $this->setDatabaseName($dbName); + } + + // Optional query parameters + if (isset($parts['query'])) { + parse_str($parts['query'], $query); + + if (isset($query['schema'])) { + $this->setDatabaseSchema($query['schema']); + } + + if (isset($query['timezone'])) { + $this->setTimeZone($query['timezone']); + } + + if (isset($query['charset'])) { + $this->setCharset($query['charset']); + } + } + return $this; + } + + } From 718d087b9b53823ef15486d3031aa792854135dd Mon Sep 17 00:00:00 2001 From: "Kamshory, MT" Date: Sat, 5 Jul 2025 18:14:42 +0700 Subject: [PATCH 2/2] Bug Fix: Class-Typed Default Parameters Now Compatible with PHP 5 --- CHANGELOG.md | 39 ++++++++++++++++++- .../PicoDatabasePersistenceExtended.php | 2 +- src/MagicDto.php | 2 +- src/MagicObject.php | 2 +- src/SecretObject.php | 2 +- src/SetterGetter.php | 2 +- 6 files changed, 43 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66386344..92cc0b93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1133,4 +1133,41 @@ $credentials->importFromUrl($url); ### Backward Compatibility -This update is fully backward-compatible and does not change any existing behavior unless the new method is used explicitly. \ No newline at end of file +This update is fully backward-compatible and does not change any existing behavior unless the new method is used explicitly. + + +### Bug Fix: Class-Typed Default Parameters Now Compatible with PHP 5 + +Fixed a **fatal error** caused by the use of default parameters with a class type hint (`MagicObject`, `SecretObject`, `SetterGetter`, `MagicDto`) and non-null default values in the `validate()` method. + +#### Before (Problematic in PHP 5): + +```php +public function validate( + $parentPropertyName = null, + $messageTemplate = null, + MagicObject $reference = null, + bool $validateIfReferenceEmpty = true // ❌ Causes error in PHP 5 +) +``` + +After (PHP 5 Compatible): + +```php +public function validate( + $parentPropertyName = null, + $messageTemplate = null, + MagicObject $reference = null, + $validateIfReferenceEmpty = true // ✅ Compatible with PHP 5 +) +``` + +> This change ensures full compatibility with legacy environments running PHP 5, while maintaining functionality in modern PHP versions. + +### Backward Compatibility + +- This version is **fully backward-compatible**. + +- No breaking changes were introduced. + +- Existing codebases will continue to function as-is unless the new functionality is explicitly invoked. diff --git a/src/Database/PicoDatabasePersistenceExtended.php b/src/Database/PicoDatabasePersistenceExtended.php index e2a8f9dd..dffe62d1 100644 --- a/src/Database/PicoDatabasePersistenceExtended.php +++ b/src/Database/PicoDatabasePersistenceExtended.php @@ -125,7 +125,7 @@ public function validate( $parentPropertyName = null, $messageTemplate = null, $reference = null, - bool $validateIfReferenceEmpty = true // Changed default to true and type hint to bool + $validateIfReferenceEmpty = true // Changed default to true and type hint to bool ) { $objectToValidate = $this->object; // Default: validate this object $shouldValidate = true; // Flag to determine if validation should proceed diff --git a/src/MagicDto.php b/src/MagicDto.php index ac7e8c1c..72e5271d 100644 --- a/src/MagicDto.php +++ b/src/MagicDto.php @@ -932,7 +932,7 @@ public function validate( $parentPropertyName = null, $messageTemplate = null, $reference = null, - bool $validateIfReferenceEmpty = true + $validateIfReferenceEmpty = true ) { $objectToValidate = $this; // Default: validate this object $shouldValidate = true; // Flag to determine if validation should proceed diff --git a/src/MagicObject.php b/src/MagicObject.php index 31c34976..2ee0614e 100644 --- a/src/MagicObject.php +++ b/src/MagicObject.php @@ -3134,7 +3134,7 @@ public function validate( $parentPropertyName = null, $messageTemplate = null, $reference = null, - bool $validateIfReferenceEmpty = true + $validateIfReferenceEmpty = true ) { $objectToValidate = $this; // Default: validate this object $shouldValidate = true; // Flag to determine if validation should proceed diff --git a/src/SecretObject.php b/src/SecretObject.php index a122c76c..e0b85a25 100644 --- a/src/SecretObject.php +++ b/src/SecretObject.php @@ -1252,7 +1252,7 @@ public function validate( $parentPropertyName = null, $messageTemplate = null, $reference = null, - bool $validateIfReferenceEmpty = true + $validateIfReferenceEmpty = true ) { $objectToValidate = $this; // Default: validate this object $shouldValidate = true; // Flag to determine if validation should proceed diff --git a/src/SetterGetter.php b/src/SetterGetter.php index 8d799eed..e371611d 100644 --- a/src/SetterGetter.php +++ b/src/SetterGetter.php @@ -443,7 +443,7 @@ public function validate( $parentPropertyName = null, $messageTemplate = null, $reference = null, - bool $validateIfReferenceEmpty = true + $validateIfReferenceEmpty = true ) { $objectToValidate = $this; // Default: validate this object $shouldValidate = true; // Flag to determine if validation should proceed