Skip to content

Commit

Permalink
fix: doctype of View::render violates contract (laravel#38789)
Browse files Browse the repository at this point in the history
The Illuminate\View\View class is implementing the Illuminate\Contracts\View\View contract which extends the Illuminate\Contracts\Support\Renderable contract. The renderable contract is ensuring a contract for the render method always return a string:
```php
    /**
     * Get the evaluated contents of the object.
     *
     * @return string
     */
    public function render();
```

But the View class implementing the contract is specifying a return type violating the contract:
```php
/**
     * Get the string contents of the view.
     *
     * @param  callable|null  $callback
     * @return array|string
     *
     * @throws \Throwable
     */
    public function render(callable $callback = null) {}
```
  • Loading branch information
tpetry authored and wouterj committed Sep 15, 2021
1 parent b827e51 commit d421378
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/View/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function __construct(Factory $factory, Engine $engine, $view, $path, $dat
* Get the string contents of the view.
*
* @param callable|null $callback
* @return array|string
* @return string
*
* @throws \Throwable
*/
Expand Down

0 comments on commit d421378

Please sign in to comment.