Fixed/silenced the remaining phpstan level 2 issues

This commit is contained in:
Matias Griese
2019-03-14 09:01:16 +02:00
parent b835db49f4
commit 8789fd91ee
4 changed files with 20 additions and 8 deletions

View File

@@ -26,7 +26,7 @@ class Data implements DataInterface, \ArrayAccess, \Countable, \JsonSerializable
/** @var array */
protected $items;
/** @var Blueprints */
/** @var Blueprint */
protected $blueprints;
/** @var File */

View File

@@ -11,6 +11,7 @@ namespace Grav\Common\Language;
use Grav\Common\Grav;
use Grav\Common\Config\Config;
use Negotiation\AcceptLanguage;
use Negotiation\LanguageNegotiator;
class Language
@@ -208,7 +209,7 @@ class Language
$negotiator = new LanguageNegotiator();
$best_language = $negotiator->getBest($accept, $this->languages);
if ($best_language) {
if ($best_language instanceof AcceptLanguage) {
$this->active = $best_language->getType();
} else {
$this->active = $this->getDefault();

View File

@@ -23,6 +23,7 @@ use Grav\Common\Taxonomy;
use Grav\Common\Uri;
use Grav\Common\Utils;
use Grav\Common\Yaml;
use Negotiation\Accept;
use Negotiation\Negotiator;
use RocketTheme\Toolbox\Event\Event;
use RocketTheme\Toolbox\File\MarkdownFile;
@@ -1405,7 +1406,8 @@ class Page implements PageInterface
$priorities = Utils::getMimeTypes($supported_types);
$media_type = $negotiator->getBest($http_accept, $priorities);
$mimetype = $media_type ? $media_type->getValue() : '';
$mimetype = $media_type instanceof Accept ? $media_type->getValue() : '';
$this->template_format = Utils::getExtensionByMime($mimetype);
return $this->template_format;

View File

@@ -19,7 +19,16 @@ parameters:
- Grav\Common\Session
ignoreErrors:
# Errors that needs some more thinking (design...)
# FIXME: Bugs that need to be fixed
# TODO: Errors that needs some more thinking (bad design?)
- '#Access to an undefined property RocketTheme\\Toolbox\\Event\\Event::#'
- '#Access to an undefined property Grav\\Common\\Data\\Blueprint::#'
- '#Access to an undefined property Grav\\Common\\Media\\Interfaces\\MediaObjectInterface::#'
- '#Access to an undefined property Grav\\Common\\Page\\Interfaces\\PageInterface::#'
-
message: '#Cannot call method path\(\) on string#'
path: 'system/src/Grav/Common/Page/Media.php'
# Needed: full coverage (probably with admin plugin...) then redesign constructor
-
@@ -28,7 +37,7 @@ parameters:
# Needed: psr-17 (http-factories) support (through decorator or further investigations)
-
message: '#Call to an undefined static method Grav\\Framework\\Psr7\\Stream::create\(\).#'
message: '#Call to an undefined static method Grav\\Framework\\Psr7\\Stream::create\(\)#'
path: 'system/src/Grav/Framework/Form/FormFlashFile.php'
# PSR-16 Exception interfaces do not extend \Throwable
@@ -37,7 +46,7 @@ parameters:
# Medium __call() methods
- '#Call to an undefined method Grav\\Common\\Page\\Medium\\(\w*)Medium::#'
# Those errors are about plugins (need to find a better solution)
# These errors are about plugins (need to find a better solution)
-
message: '#Call to static method sendEmail\(\) on an unknown class Grav\\Plugin\\Email\\Utils#'
path: 'system/src/Grav/Common/Scheduler/Job.php'
@@ -50,11 +59,11 @@ parameters:
# Can be ignored, after fopen there's always an $http_response_header locally available
-
message: '#Variable \$http_response_header in isset\(\) always exists and is not nullable.#'
message: '#Variable \$http_response_header in isset\(\) always exists and is not nullable#'
path: 'system/src/Grav/Common/GPM/Response.php'
# Those errors can be ignored (they depends on installed extensions)
# These errors can be ignored (they depend on installed extensions)
-
message: '#Instantiated class (Memcache|Memcached|Redis|RedisException) not found#'
path: 'system/src/Grav/Common/Cache.php'