Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace CollectionWhereNotNull; use Illuminate\Database\Eloquent\Collection as E..

Decoded Output download

<?php

namespace CollectionWhereNotNull;

use Illuminate\Database\Eloquent\Collection as EloquentCollection;

use function PHPStan\Testing\assertType;

/** @param EloquentCollection<int, ?\App\User> $foo */
function test(EloquentCollection $foo): void
{
    assertType('Illuminate\Support\Collection<int, int|string>', collect([1, 2, null, '', 'hello'])->whereNotNull());
    assertType('Illuminate\Support\Collection<int, int|string>', collect([1, 2, null, '', 'hello'])->whereNotNull());
    assertType('Illuminate\Support\Collection<int, int|string>', collect([1, 2, null, '', 'hello'])->whereNotNull(null));
    assertType(
        'Illuminate\Support\Collection<int, App\User|array{id: string}|stdClass>',
        collect([new \App\User, new \stdClass, ['id' => 'foo'], 'foo', true, 22])->whereNotNull('id')
    );
    assertType("Illuminate\Database\Eloquent\Collection<int, App\User>", $foo->whereNotNull('blocked'));
    assertType("Illuminate\Database\Eloquent\Collection<int, App\User>", $foo->whereNotNull('blocked'));
    assertType("Illuminate\Database\Eloquent\Collection<int, App\User>", $foo->whereNotNull());
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace CollectionWhereNotNull;

use Illuminate\Database\Eloquent\Collection as EloquentCollection;

use function PHPStan\Testing\assertType;

/** @param EloquentCollection<int, ?\App\User> $foo */
function test(EloquentCollection $foo): void
{
    assertType('Illuminate\Support\Collection<int, int|string>', collect([1, 2, null, '', 'hello'])->whereNotNull());
    assertType('Illuminate\Support\Collection<int, int|string>', collect([1, 2, null, '', 'hello'])->whereNotNull());
    assertType('Illuminate\Support\Collection<int, int|string>', collect([1, 2, null, '', 'hello'])->whereNotNull(null));
    assertType(
        'Illuminate\Support\Collection<int, App\User|array{id: string}|stdClass>',
        collect([new \App\User, new \stdClass, ['id' => 'foo'], 'foo', true, 22])->whereNotNull('id')
    );
    assertType("Illuminate\Database\Eloquent\Collection<int, App\User>", $foo->whereNotNull('blocked'));
    assertType("Illuminate\Database\Eloquent\Collection<int, App\User>", $foo->whereNotNull('blocked'));
    assertType("Illuminate\Database\Eloquent\Collection<int, App\User>", $foo->whereNotNull());
}

Function Calls

None

Variables

None

Stats

MD5 c5754b299fabf94c6528cc7bedeb00ed
Eval Count 0
Decode Time 88 ms