ITの隊長のブログ

ITの隊長のブログです。Rubyを使って仕事しています。最近も色々やっているお(^ω^ = ^ω^)

`sendPasswordResetNotification` のオーバーライドでエラー

スポンサードリンク

Method 'App\Models\User::sendPasswordResetNotification()' is not compatible with method 'Illuminate\Foundation\Auth\User::sendPasswordResetNotification()'.

なにこれ〜〜〜〜

ぼくが書いたコード

    public function sendPasswordResetNotification(string $token)
    {
        // 処理
    }

元のコード

<?php

namespace Illuminate\Contracts\Auth;

interface CanResetPassword
{
    /**
     * Get the e-mail address where password reset links are sent.
     *
     * @return string
     */
    public function getEmailForPasswordReset();

    /**
     * Send the password reset notification.
     *
     * @param  string  $token
     * @return void
     */
    public function sendPasswordResetNotification($token);
}

わからん???って思ってましたが、まさかと思い修正。

    public function sendPasswordResetNotification($token)
    {
        // 処理
    }

でなくなりました。。。(型定義?も同じにしないといけないっぽい)