File: Fluent.php

package info (click to toggle)
php-laravel-framework 11.46.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,276 kB
  • sloc: php: 266,630; sh: 167; javascript: 51; makefile: 46
file content (22 lines) | stat: -rw-r--r-- 1,063 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

use Illuminate\Support\Fluent;

use function PHPStan\Testing\assertType;

$fluent = new Fluent(['name' => 'Taylor', 'age' => 25, 'user' => new User]);

assertType("Illuminate\Support\Fluent<string, 25|'Taylor'|User>", $fluent);
assertType('Illuminate\Support\Fluent<string, string>', new Fluent(['name' => 'Taylor']));
assertType('Illuminate\Support\Fluent<string, int>', new Fluent(['age' => 25]));
assertType('Illuminate\Support\Fluent<string, User>', new Fluent(['user' => new User]));

assertType("25|'Taylor'|User|null", $fluent['name']);
assertType("25|'Taylor'|User|null", $fluent['age']);
assertType("25|'Taylor'|User|null", $fluent['age']);
assertType("25|'Taylor'|User|null", $fluent->get('name'));
assertType("25|'Taylor'|User|null", $fluent->get('foobar'));
assertType("25|'Taylor'|'zonda'|User", $fluent->get('foobar', 'zonda'));
assertType("array<string, 25|'Taylor'|User>", $fluent->getAttributes());
assertType("array<string, 25|'Taylor'|User>", $fluent->toArray());
assertType("array<string, 25|'Taylor'|User>", $fluent->jsonSerialize());