Added more deprecation messages

This commit is contained in:
Matias Griese
2019-02-26 12:11:51 +02:00
parent ccb465e998
commit f934256e06
12 changed files with 39 additions and 29 deletions

View File

@@ -82,12 +82,13 @@ trait LegacyAssetsTrait
* @param bool $pipeline
* @param string $group name of the group
*
* @deprecated Please use dynamic method with ['loading' => 'async']
*
* @return \Grav\Common\Assets
* @deprecated Please use dynamic method with ['loading' => 'async'].
*/
public function addAsyncJs($asset, $priority = 10, $pipeline = true, $group = 'head')
{
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6, use dynamic method with [\'loading\' => \'async\']', E_USER_DEPRECATED);
return $this->addJs($asset, $priority, $pipeline, 'async', $group);
}
@@ -99,12 +100,13 @@ trait LegacyAssetsTrait
* @param bool $pipeline
* @param string $group name of the group
*
* @deprecated Please use dynamic method with ['loading' => 'defer']
*
* @return \Grav\Common\Assets
* @deprecated Please use dynamic method with ['loading' => 'defer'].
*/
public function addDeferJs($asset, $priority = 10, $pipeline = true, $group = 'head')
{
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6, use dynamic method with [\'loading\' => \'defer\']', E_USER_DEPRECATED);
return $this->addJs($asset, $priority, $pipeline, 'defer', $group);
}

View File

@@ -116,7 +116,7 @@ class Config extends Data
/**
* @return mixed
* @deprecated
* @deprecated 1.5 Use Grav::instance()['languages'] instead.
*/
public function getLanguages()
{

View File

@@ -60,7 +60,7 @@ class FormFlash extends \Grav\Framework\Form\FormFlash
/**
* @return array
* @deprecated 1.6 For backwards compatibility only, do not use.
* @deprecated 1.6 For backwards compatibility only, do not use
*/
public function getLegacyFiles(): array
{
@@ -85,7 +85,7 @@ class FormFlash extends \Grav\Framework\Form\FormFlash
* @param string $filename
* @param array $upload
* @return bool
* @deprecated 1.6 For backwards compatibility only, do not use.
* @deprecated 1.6 For backwards compatibility only, do not use
*/
public function uploadFile(string $field, string $filename, array $upload): bool
{
@@ -114,7 +114,7 @@ class FormFlash extends \Grav\Framework\Form\FormFlash
* @param array $upload
* @param array $crop
* @return bool
* @deprecated 1.6 For backwards compatibility only, do not use.
* @deprecated 1.6 For backwards compatibility only, do not use
*/
public function cropFile(string $field, string $filename, array $upload, array $crop): bool
{

View File

@@ -10,7 +10,7 @@
namespace Grav\Common;
/**
* @deprecated 1.4 Use Grav::instance() instead
* @deprecated 1.4 Use Grav::instance() instead.
*/
trait GravTrait
{
@@ -18,15 +18,16 @@ trait GravTrait
/**
* @return Grav
* @deprecated 1.4 Use Grav::instance() instead.
*/
public static function getGrav()
{
user_error(__TRAIT__ . ' is deprecated since Grav 1.4, use Grav::instance() instead', E_USER_DEPRECATED);
if (!self::$grav) {
self::$grav = Grav::instance();
}
user_error(__TRAIT__ . ' is deprecated since Grav 1.4, use Grav::instance() instead', E_USER_DEPRECATED);
return self::$grav;
}
}

View File

@@ -473,10 +473,9 @@ class Language
/**
* Get the browser accepted languages
*
* @deprecated 1.6.0 no longer used - using content negotiation
*
* @param array $accept_langs
* @return array
* @deprecated 1.6 No longer used - using content negotiation.
*/
public function getBrowserLanguages($accept_langs = [])
{

View File

@@ -2186,10 +2186,12 @@ class Page implements PageInterface
* @param string $var the order, either "asc" or "desc"
*
* @return string the order, either "asc" or "desc"
* @deprecated
* @deprecated 1.6
*/
public function orderDir($var = null)
{
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED);
if ($var !== null) {
$this->order_dir = $var;
}
@@ -2212,10 +2214,12 @@ class Page implements PageInterface
* @param string $var supported options include "default", "title", "date", and "folder"
*
* @return string supported options include "default", "title", "date", and "folder"
* @deprecated
* @deprecated 1.6
*/
public function orderBy($var = null)
{
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED);
if ($var !== null) {
$this->order_by = $var;
}
@@ -2229,10 +2233,12 @@ class Page implements PageInterface
* @param string $var supported options include "default", "title", "date", and "folder"
*
* @return array
* @deprecated
* @deprecated 1.6
*/
public function orderManual($var = null)
{
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED);
if ($var !== null) {
$this->order_manual = $var;
}
@@ -2247,10 +2253,12 @@ class Page implements PageInterface
* @param int $var the maximum number of sub-pages
*
* @return int the maximum number of sub-pages
* @deprecated
* @deprecated 1.6
*/
public function maxCount($var = null)
{
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.6', E_USER_DEPRECATED);
if ($var !== null) {
$this->max_count = (int)$var;
}

View File

@@ -18,11 +18,11 @@ class Session extends \Grav\Framework\Session\Session
/**
* @return \Grav\Framework\Session\Session
* @deprecated 1.5 Use getInstance() method instead
* @deprecated 1.5 Use ->getInstance() method instead.
*/
public static function instance()
{
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.5, use getInstance() method instead', E_USER_DEPRECATED);
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.5, use ->getInstance() method instead', E_USER_DEPRECATED);
return static::getInstance();
}
@@ -56,11 +56,11 @@ class Session extends \Grav\Framework\Session\Session
* Returns attributes.
*
* @return array Attributes
* @deprecated 1.5 Use getAll() method instead
* @deprecated 1.5 Use ->getAll() method instead.
*/
public function all()
{
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.5, use getAll() method instead', E_USER_DEPRECATED);
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.5, use ->getAll() method instead', E_USER_DEPRECATED);
return $this->getAll();
}
@@ -69,11 +69,11 @@ class Session extends \Grav\Framework\Session\Session
* Checks if the session was started.
*
* @return Boolean
* @deprecated 1.5 Use isStarted() method instead
* @deprecated 1.5 Use ->isStarted() method instead.
*/
public function started()
{
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.5, use isStarted() method instead', E_USER_DEPRECATED);
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.5, use ->isStarted() method instead', E_USER_DEPRECATED);
return $this->isStarted();
}

View File

@@ -438,7 +438,7 @@ class Twig
* Overrides the autoescape setting
*
* @param boolean $state
* @deprecated 1.5
* @deprecated 1.5 Auto-escape should always be turned on to protect against XSS issues (can be disabled per template file).
*/
public function setAutoescape($state)
{

View File

@@ -949,11 +949,11 @@ abstract class Utils
* @param null $default
* @return mixed
*
* @deprecated Use getDotNotation() method instead
* @deprecated 1.5 Use ->getDotNotation() method instead.
*/
public static function resolve(array $array, $path, $default = null)
{
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.5, use getDotNotation() method instead', E_USER_DEPRECATED);
user_error(__CLASS__ . '::' . __FUNCTION__ . '() is deprecated since Grav 1.5, use ->getDotNotation() method instead', E_USER_DEPRECATED);
return static::getDotNotation($array, $path, $default);
}

View File

@@ -216,7 +216,7 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
* Alias of getBlueprint()
*
* @return Blueprint
* @deprecated Admin compatibility
* @deprecated 1.6 Admin compatibility
*/
public function blueprints()
{

View File

@@ -16,7 +16,7 @@ use Psr\Http\Message\UriInterface;
* Bare minimum PSR7 implementation.
*
* @package Grav\Framework\Uri\Psr7
* @deprecated 1.6
* @deprecated 1.6 Using message PSR-7 decorators instead.
*/
abstract class AbstractUri implements UriInterface
{

View File

@@ -275,7 +275,7 @@ class Route
/**
* @return string
* @deprecated 1.6
* @deprecated 1.6 Use ->toString(true) or ->getUri() instead.
*/
public function __toString()
{