Skip to content

Commit

Permalink
Merge pull request alexeymezenin#103 from olsza/feature/shorter-optio…
Browse files Browse the repository at this point in the history
…nal-in-php8

Shorter optional() in php8
  • Loading branch information
alexeymezenin authored Sep 28, 2021
2 parents 12c7fa5 + fa5e1e7 commit fb18b33
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ Common syntax | Shorter and more readable syntax
`Session::put('cart', $data)` | `session(['cart' => $data])`
`$request->input('name'), Request::get('name')` | `$request->name, request('name')`
`return Redirect::back()` | `return back()`
`is_null($object->relation) ? null : $object->relation->id` | `optional($object->relation)->id`
`is_null($object->relation) ? null : $object->relation->id` | `optional($object->relation)->id` (in PHP 8: `$object->relation?->id`)
`return view('index')->with('title', $title)->with('client', $client)` | `return view('index', compact('title', 'client'))`
`$request->has('value') ? $request->value : 'default';` | `$request->get('value', 'default')`
`Carbon::now(), Carbon::today()` | `now(), today()`
Expand Down
2 changes: 1 addition & 1 deletion polish.md
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ Powszechna składnia | Krótsza i bardziej czytelna składnia
`Session::put('cart', $data)` | `session(['cart' => $data])`
`$request->input('name'), Request::get('name')` | `$request->name, request('name')`
`return Redirect::back()` | `return back()`
`is_null($object->relation) ? null : $object->relation->id` | `optional($object->relation)->id`
`is_null($object->relation) ? null : $object->relation->id` | `optional($object->relation)->id` (w PHP 8: `$object->relation?->id`)
`return view('index')->with('title', $title)->with('client', $client)` | `return view('index', compact('title', 'client'))`
`$request->has('value') ? $request->value : 'default';` | `$request->get('value', 'default')`
`Carbon::now(), Carbon::today()` | `now(), today()`
Expand Down

0 comments on commit fb18b33

Please sign in to comment.