Fully comply phpstan level2!

This commit is contained in:
Matias Griese
2019-11-15 13:21:20 +02:00
parent bf2b7dcf7b
commit a06520337f
3 changed files with 10 additions and 8 deletions

View File

@@ -1217,8 +1217,8 @@ class Page implements PageInterface
/**
* Gets and sets the associated media as found in the page folder.
*
* @param MediaCollectionInterface|Media $var Representation of associated media.
* @return MediaCollectionInterface|Media Representation of associated media.
* @param Media $var Representation of associated media.
* @return Media Representation of associated media.
*/
public function media($var = null)
{

View File

@@ -26,6 +26,7 @@ use Twig\Extension\DebugExtension;
use Twig\Extension\StringLoaderExtension;
use Twig\Loader\ArrayLoader;
use Twig\Loader\ChainLoader;
use Twig\Loader\ExistsLoaderInterface;
use Twig\Loader\FilesystemLoader;
use Twig\TwigFilter;
use Twig\TwigFunction;
@@ -455,13 +456,14 @@ class Twig
$twig_extension = $extension ? '.'. $extension .TWIG_EXT : TEMPLATE_EXT;
$template_file = $this->template($page->template() . $twig_extension);
if ($this->twig->getLoader()->exists($template_file)) {
$loader = $this->twig->getLoader();
if ($loader instanceof ExistsLoaderInterface && $loader->exists($template_file)) {
return $template_file;
} else {
// Default to HTML
$page->templateFormat('html');
return $template . TEMPLATE_EXT;
}
// Default to HTML
$page->templateFormat('html');
return $template . TEMPLATE_EXT;
}
/**

View File

@@ -71,7 +71,7 @@ parameters:
path: 'system/src/Grav/Common/Page/Pages.php'
-
message: '#on an unknown class Grav\\Plugin\\Admin#'
path: 'system/src/Grav/Common/Page/Flex/PageObject.php'
path: 'system/src/Grav/Common/Flex/Pages/PageObject.php'
-
message: '#Call to method getFlash\(\) on an unknown class Grav\\Common\\Grav\\Plugin\\Form\\Forms#'
path: 'system/src/Grav/Common/Session.php'