Merge pull request #2570 from nowackipawel/patch-82

Model's set method should accept not only string
This commit is contained in:
MGatner 2020-02-22 20:08:17 -05:00 committed by GitHub
commit 11c6008f4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -493,17 +493,18 @@ class Model
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/** /**
* Captures the builder's set() method so that we can validate the * Captures the builder's set() method so that we can validate the
* data here. This allows it to be used with any of the other * data here. This allows it to be used with any of the other
* builder methods and still get validated data, like replace. * builder methods and still get validated data, like replace.
* *
* @param mixed $key * @param mixed $key Field name, or an array of field/value pairs
* @param string $value * @param string $value Field value, if $key is a single field
* @param boolean|null $escape * @param boolean $escape Whether to escape values and identifiers
* *
* @return $this * @return $this
*/ */
public function set($key, string $value = '', bool $escape = null) public function set($key, ?string $value = '', bool $escape = null)
{ {
$data = is_array($key) $data = is_array($key)
? $key ? $key