Completed
Push — master ( 59491d...2f0e29 )
by Ajit
10:43
created

..._00_000000_create_mojo_refund_details_table.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateMojoRefundDetailsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('mojo_refund_details', function (Blueprint $table) {
17
            $table->increments('id');
18
            $table->integer('user_id')->unsigned();
19
            $table->foreign('user_id')->references('id')->on('users');
0 ignored issues
show
The method references does only exist in Illuminate\Database\Schema\ForeignKeyDefinition, but not in Illuminate\Support\Fluent.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
20
            $table->string('refund_id');
21
            $table->string('payment_id');
22
            $table->string('status');
23
            $table->string('type');
24
            $table->string('body');
25
            $table->string('refund_amount');
26
            $table->string('total_amount');
27
            $table->timestamps();
28
        });
29
    }
30
31
    /**
32
     * Reverse the migrations.
33
     *
34
     * @return void
35
     */
36
    public function down()
37
    {
38
        Schema::dropIfExists('mojo_refund_details');
39
    }
40
}
41