40 * @param Checkout
41 * @return collection of the payment types.
42 */
43 public static function forCheckout(Checkout $checkout) 44 {
45 return Cache::remember('paymentTypesFor.'.$checkout, 86400, function () use ($checkout) {
46 $payment_types = [self::INCOME, self::EXPENSE];
103 /**
104 * @return book Whether the question is a multiple-choice question (with checkboxes).
105 */
106 public function isMultipleChoice(): bool107 {
108 return $this->max_options>1;
109 }
The typehint provided for the function is not a valid class type. This may happen because of a typo, or the class specified in typehint is not present in the current namespace. You can also face this issue on using native union types if your PHP version is < 8.0. Native union types are only available in PHP 8.0 and later.
// invalid: User class used as return type doesn't exists
function getUser(): User
{
return new User('John');
}
class User
{
public function update(array $data) {}
}
// invalid: Parameter type contains typo
function updateUser(Usr $user, array $data): void
{
$user->update(['name' => $data['name']]);
}
Make sure class used in return typehint exists:
class User
{
private string $name;
public function __construct(string $name)
{
$this->name = $name;
}
}
function getUser(): User
{
return new User('John');
}
Make sure there are no typos:
class User
{
public function update(array $data) {}
}
// invalid: Parameter type contains typo
function updateUser(User $user, array $data): void
{
$user->update(['name' => $data['name']]);
}