Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the return type of View::make in Laravel?

Tags:

php

laravel

I like clean docs and phpdoc will automagically look up the type. When documenting a controller function that returns View::make, I have no idea what type to use for the @return in my documentation.

<?php

class FooController extends BaseController {

    /**
     * Show a view.
     *
     * @return  ??? description of the view
     */
    public function show(){
        return View::make('bar');
    }

}

What is the type here or is there a better way to document the function for this purpose?

like image 922
skovacs1 Avatar asked Dec 16 '13 22:12

skovacs1


1 Answers

The return value is

Illuminate\View\View

I traced through the ServiceProvider which lead me to

Illuminate\View\Environment::make

Which is line 113 of vendor/laravel/framework/src/Illuminate/View/Environment.php (in 4.1 at least)

/**
 * Get a evaluated view contents for the given view.
 *
 * @param  string  $view
 * @param  array   $data
 * @param  array   $mergeData
 * @return \Illuminate\View\View
 */
public function make($view, $data = array(), $mergeData = array())
{
    $path = $this->finder->find($view);

    $data = array_merge($mergeData, $this->parseData($data));

    $this->callCreator($view = new View($this, $this->getEngineFromPath($path), $view, $path, $data));

    return $view;
}
like image 79
ollieread Avatar answered Sep 26 '22 08:09

ollieread