Fix PHP unit test isolation
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace classes;
|
||||
|
||||
class customer_name_cache_payload_builder
|
||||
{
|
||||
/**
|
||||
* @return array{name:string}|null
|
||||
*/
|
||||
public static function build(mixed $cached_name, ?string $fallback_name): ?array
|
||||
{
|
||||
if (
|
||||
is_object($cached_name)
|
||||
&& isset($cached_name->name)
|
||||
&& is_string($cached_name->name)
|
||||
&& trim($cached_name->name) !== ''
|
||||
) {
|
||||
return ['name' => $cached_name->name];
|
||||
}
|
||||
|
||||
if ($fallback_name !== null && trim($fallback_name) !== '') {
|
||||
return ['name' => $fallback_name];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user