mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Fix PHP8 behavior of method_exists
This commit is contained in:
parent
b9f09941c6
commit
ebb2b2937f
@ -429,14 +429,13 @@ class Fabricator
|
||||
$result[$field] = $this->faker->{$formatter};
|
||||
}
|
||||
}
|
||||
|
||||
// If no formatters were defined then look for a model fake() method
|
||||
elseif (method_exists($this->model, 'fake'))
|
||||
{
|
||||
$result = $this->model->fake($this->faker);
|
||||
|
||||
// This should cover entities
|
||||
if (method_exists($result, 'toArray'))
|
||||
if (is_object($result) && method_exists($result, 'toArray'))
|
||||
{
|
||||
$result = $result->toArray();
|
||||
}
|
||||
@ -446,7 +445,6 @@ class Fabricator
|
||||
$result = (array) $result;
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing left to do but give up
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user