)[]
*/
public $css = [];
/**
diff --git a/web/AssetManager.php b/web/AssetManager.php
index b61607199..3266336d9 100644
--- a/web/AssetManager.php
+++ b/web/AssetManager.php
@@ -412,10 +412,10 @@ protected function resolveAsset($bundle, $asset)
public function getConverter()
{
if ($this->_converter === null) {
- $this->_converter = Yii::createObject(AssetConverter::className());
+ $this->_converter = Yii::createObject(AssetConverter::class);
} elseif (is_array($this->_converter) || is_string($this->_converter)) {
if (is_array($this->_converter) && !isset($this->_converter['class'])) {
- $this->_converter['class'] = AssetConverter::className();
+ $this->_converter['class'] = AssetConverter::class;
}
$this->_converter = Yii::createObject($this->_converter);
}
diff --git a/web/CompositeUrlRule.php b/web/CompositeUrlRule.php
index dd711cc1f..c0057196d 100644
--- a/web/CompositeUrlRule.php
+++ b/web/CompositeUrlRule.php
@@ -60,7 +60,7 @@ public function parseRequest($manager, $request)
Yii::debug([
'rule' => method_exists($rule, '__toString') ? $rule->__toString() : get_class($rule),
'match' => $result !== false,
- 'parent' => self::className(),
+ 'parent' => self::class,
], __METHOD__);
}
if ($result !== false) {
diff --git a/web/Controller.php b/web/Controller.php
index 3508bfe0c..f7dc12101 100644
--- a/web/Controller.php
+++ b/web/Controller.php
@@ -160,8 +160,7 @@ public function bindActionParams($action, $params)
$args[] = $actionParams[$name] = $params[$name];
unset($params[$name]);
} elseif (
- PHP_VERSION_ID >= 70100
- && ($type = $param->getType()) !== null
+ ($type = $param->getType()) !== null
&& $type instanceof \ReflectionNamedType
&& !$type->isBuiltin()
) {
@@ -214,12 +213,11 @@ private function filterSingleTypeActionParam($param, $type)
}
if (
- PHP_VERSION_ID >= 70000
- && method_exists($type, 'isBuiltin')
+ method_exists($type, 'isBuiltin')
&& $type->isBuiltin()
&& ($param !== null || !$type->allowsNull())
) {
- $typeName = PHP_VERSION_ID >= 70100 ? $type->getName() : (string)$type;
+ $typeName = $type->getName();
if ($param === '' && $type->allowsNull()) {
if ($typeName !== 'string') { // for old string behavior compatibility
return [null, true];
@@ -256,7 +254,7 @@ private function filterUnionTypeActionParam($param, $type)
) {
continue;
}
- $typeName = PHP_VERSION_ID >= 70100 ? $partialType->getName() : (string)$partialType;
+ $typeName = $partialType->getName();
if ($typeName === 'string') {
return ['', true];
}
@@ -277,7 +275,7 @@ private function filterUnionTypeActionParam($param, $type)
continue;
}
$foundBuiltinType = true;
- $typeName = PHP_VERSION_ID >= 70100 ? $partialType->getName() : (string)$partialType;
+ $typeName = $partialType->getName();
$canBeArray |= $typeName === 'array';
$canBeString |= $typeName === 'string';
if (is_array($param)) {
diff --git a/web/DbSession.php b/web/DbSession.php
index 1ef79cb7c..b2e48b9ef 100644
--- a/web/DbSession.php
+++ b/web/DbSession.php
@@ -90,7 +90,7 @@ class DbSession extends MultiFieldSession
public function init()
{
parent::init();
- $this->db = Instance::ensure($this->db, Connection::className());
+ $this->db = Instance::ensure($this->db, Connection::class);
}
/**
diff --git a/web/ErrorHandler.php b/web/ErrorHandler.php
index 570a84b41..201eaef9d 100644
--- a/web/ErrorHandler.php
+++ b/web/ErrorHandler.php
@@ -487,7 +487,7 @@ public function argumentsToString($args)
*/
public function getExceptionName($exception)
{
- if ($exception instanceof \yii\base\Exception || $exception instanceof \yii\base\InvalidCallException || $exception instanceof \yii\base\InvalidParamException || $exception instanceof \yii\base\UnknownMethodException) {
+ if ($exception instanceof \yii\base\Exception || $exception instanceof \yii\base\InvalidCallException || $exception instanceof \yii\base\InvalidArgumentException || $exception instanceof \yii\base\UnknownMethodException) {
return $exception->getName();
}
diff --git a/web/JqueryAsset.php b/web/JqueryAsset.php
index df365d768..e7a534671 100644
--- a/web/JqueryAsset.php
+++ b/web/JqueryAsset.php
@@ -15,7 +15,7 @@
*/
class JqueryAsset extends AssetBundle
{
- public $sourcePath = '@bower/jquery/dist';
+ public $sourcePath = '@npm/jquery/dist';
public $js = [
'jquery.js',
];
diff --git a/web/Request.php b/web/Request.php
index 7b9645d53..a1e0ea937 100644
--- a/web/Request.php
+++ b/web/Request.php
@@ -95,11 +95,6 @@ class Request extends \yii\base\Request
* Default name of the HTTP header for sending CSRF token.
*/
const CSRF_HEADER = 'X-CSRF-Token';
- /**
- * The length of the CSRF token mask.
- * @deprecated since 2.0.12. The mask length is now equal to the token length.
- */
- const CSRF_MASK_LENGTH = 8;
/**
* @var bool whether to enable CSRF (Cross-Site Request Forgery) validation. Defaults to true.
@@ -1767,11 +1762,7 @@ protected function loadCookies()
if ($data === false) {
continue;
}
- if (defined('PHP_VERSION_ID') && PHP_VERSION_ID >= 70000) {
- $data = @unserialize($data, ['allowed_classes' => false]);
- } else {
- $data = @unserialize($data);
- }
+ $data = @unserialize($data, ['allowed_classes' => false]);
if (is_array($data) && isset($data[0], $data[1]) && $data[0] === $name) {
$cookies[$name] = Yii::createObject([
'class' => 'yii\web\Cookie',
diff --git a/web/RequestParserInterface.php b/web/RequestParserInterface.php
index 44a1051a6..c79b77838 100644
--- a/web/RequestParserInterface.php
+++ b/web/RequestParserInterface.php
@@ -19,7 +19,7 @@ interface RequestParserInterface
* Parses a HTTP request body.
* @param string $rawBody the raw HTTP request body.
* @param string $contentType the content type specified for the request body.
- * @return array parameters parsed from the request body
+ * @return array|object parameters parsed from the request body
*/
public function parse($rawBody, $contentType);
}
diff --git a/web/Response.php b/web/Response.php
index 172443880..b39363485 100644
--- a/web/Response.php
+++ b/web/Response.php
@@ -413,24 +413,14 @@ protected function sendCookies()
if ($expire != 1 && isset($validationKey)) {
$value = Yii::$app->getSecurity()->hashData(serialize([$cookie->name, $value]), $validationKey);
}
- if (PHP_VERSION_ID >= 70300) {
- setcookie($cookie->name, $value, [
- 'expires' => $expire,
- 'path' => $cookie->path,
- 'domain' => $cookie->domain,
- 'secure' => $cookie->secure,
- 'httpOnly' => $cookie->httpOnly,
- 'sameSite' => !empty($cookie->sameSite) ? $cookie->sameSite : null,
- ]);
- } else {
- // Work around for setting sameSite cookie prior PHP 7.3
- // https://stackoverflow.com/questions/39750906/php-setcookie-samesite-strict/46971326#46971326
- $cookiePath = $cookie->path;
- if (!is_null($cookie->sameSite)) {
- $cookiePath .= '; samesite=' . $cookie->sameSite;
- }
- setcookie($cookie->name, $value, $expire, $cookiePath, $cookie->domain, $cookie->secure, $cookie->httpOnly);
- }
+ setcookie($cookie->name, $value, [
+ 'expires' => $expire,
+ 'path' => $cookie->path,
+ 'domain' => $cookie->domain,
+ 'secure' => $cookie->secure,
+ 'httpOnly' => $cookie->httpOnly,
+ 'sameSite' => !empty($cookie->sameSite) ? $cookie->sameSite : null,
+ ]);
}
}
diff --git a/web/Session.php b/web/Session.php
index 3b2e74753..0d7c1607e 100644
--- a/web/Session.php
+++ b/web/Session.php
@@ -417,14 +417,7 @@ private function setCookieParamsInternal()
{
$data = $this->getCookieParams();
if (isset($data['lifetime'], $data['path'], $data['domain'], $data['secure'], $data['httponly'])) {
- if (PHP_VERSION_ID >= 70300) {
- session_set_cookie_params($data);
- } else {
- if (!empty($data['samesite'])) {
- $data['path'] .= '; samesite=' . $data['samesite'];
- }
- session_set_cookie_params($data['lifetime'], $data['path'], $data['domain'], $data['secure'], $data['httponly']);
- }
+ session_set_cookie_params($data);
} else {
throw new InvalidArgumentException('Please make sure cookieParams contains these elements: lifetime, path, domain, secure and httponly.');
}
@@ -556,17 +549,9 @@ public function setTimeout($value)
*/
public function setUseStrictMode($value)
{
- if (PHP_VERSION_ID < 50502) {
- if ($this->getUseCustomStorage() || !$value) {
- self::$_useStrictModePolyfill = $value;
- } else {
- throw new InvalidConfigException('Enabling `useStrictMode` on PHP < 5.5.2 is only supported with custom storage classes.');
- }
- } else {
- $this->freeze();
- ini_set('session.use_strict_mode', $value ? '1' : '0');
- $this->unfreeze();
- }
+ $this->freeze();
+ ini_set('session.use_strict_mode', $value ? '1' : '0');
+ $this->unfreeze();
}
/**
@@ -576,10 +561,6 @@ public function setUseStrictMode($value)
*/
public function getUseStrictMode()
{
- if (PHP_VERSION_ID < 50502) {
- return self::$_useStrictModePolyfill;
- }
-
return (bool)ini_get('session.use_strict_mode');
}
diff --git a/web/UrlManager.php b/web/UrlManager.php
index fe324effc..b2b7c6703 100644
--- a/web/UrlManager.php
+++ b/web/UrlManager.php
@@ -178,7 +178,7 @@ public function init()
if ($this->normalizer !== false) {
$this->normalizer = Yii::createObject($this->normalizer);
if (!$this->normalizer instanceof UrlNormalizer) {
- throw new InvalidConfigException('`' . get_class($this) . '::normalizer` should be an instance of `' . UrlNormalizer::className() . '` or its DI compatible configuration.');
+ throw new InvalidConfigException('`' . get_class($this) . '::normalizer` should be an instance of `' . UrlNormalizer::class . '` or its DI compatible configuration.');
}
}
diff --git a/web/UrlRule.php b/web/UrlRule.php
index da4aef3f4..07c9ec1da 100644
--- a/web/UrlRule.php
+++ b/web/UrlRule.php
@@ -197,7 +197,7 @@ public function init()
throw new InvalidConfigException('UrlRule::route must be set.');
}
if (is_array($this->normalizer)) {
- $normalizerConfig = array_merge(['class' => UrlNormalizer::className()], $this->normalizer);
+ $normalizerConfig = array_merge(['class' => UrlNormalizer::class], $this->normalizer);
$this->normalizer = Yii::createObject($normalizerConfig);
}
if ($this->normalizer !== null && $this->normalizer !== false && !$this->normalizer instanceof UrlNormalizer) {
diff --git a/web/User.php b/web/User.php
index 215097a5a..f48b04021 100644
--- a/web/User.php
+++ b/web/User.php
@@ -819,20 +819,6 @@ public function checkRedirectAcceptable()
return false;
}
- /**
- * Returns auth manager associated with the user component.
- *
- * By default this is the `authManager` application component.
- * You may override this method to return a different auth manager instance if needed.
- * @return \yii\rbac\ManagerInterface
- * @since 2.0.6
- * @deprecated since version 2.0.9, to be removed in 2.1. Use [[getAccessChecker()]] instead.
- */
- protected function getAuthManager()
- {
- return Yii::$app->getAuthManager();
- }
-
/**
* Returns the access checker used for checking access.
* @return CheckAccessInterface
@@ -840,6 +826,6 @@ protected function getAuthManager()
*/
protected function getAccessChecker()
{
- return $this->accessChecker !== null ? $this->accessChecker : $this->getAuthManager();
+ return $this->accessChecker !== null ? $this->accessChecker : Yii::$app->getAuthManager();
}
}
diff --git a/web/View.php b/web/View.php
index 335a14086..4cf53dad0 100644
--- a/web/View.php
+++ b/web/View.php
@@ -45,23 +45,27 @@
* @phpstan-type RegisterJsFileOptions array{
* depends?: class-string[],
* position?: int,
- * appendTimestamp?: boolean
+ * appendTimestamp?: bool,
+ * ...
* }
*
* @psalm-type RegisterJsFileOptions = array{
* depends?: class-string[],
* position?: int,
- * appendTimestamp?: boolean
+ * appendTimestamp?: bool,
+ * ...
* }
*
* @phpstan-type RegisterCssFileOptions array{
* depends?: class-string[],
- * appendTimestamp?: boolean
+ * appendTimestamp?: bool,
+ * ...
* }
*
* @psalm-type RegisterCssFileOptions = array{
* depends?: class-string[],
- * appendTimestamp?: boolean
+ * appendTimestamp?: bool,
+ * ...
* }
*/
class View extends \yii\base\View
@@ -556,7 +560,7 @@ private function registerFile($type, $url, $options = [], $key = null)
}
} else {
$this->getAssetManager()->bundles[$key] = Yii::createObject([
- 'class' => AssetBundle::className(),
+ 'class' => AssetBundle::class,
'baseUrl' => '',
'basePath' => '@webroot',
(string)$type => [ArrayHelper::merge([!Url::isRelative($url) ? $url : ltrim($url, '/')], $originalOptions)],
diff --git a/widgets/ActiveField.php b/widgets/ActiveField.php
index 1761b8566..54712d7a3 100644
--- a/widgets/ActiveField.php
+++ b/widgets/ActiveField.php
@@ -175,12 +175,6 @@ public function __toString()
try {
return $this->render();
} catch (\Throwable $e) {
- if (PHP_VERSION_ID < 70400) {
- trigger_error(ErrorHandler::convertExceptionToString($e), E_USER_ERROR);
-
- return '';
- }
-
throw $e;
}
}
diff --git a/widgets/MaskedInputAsset.php b/widgets/MaskedInputAsset.php
index 473f4315f..2a0a6a197 100644
--- a/widgets/MaskedInputAsset.php
+++ b/widgets/MaskedInputAsset.php
@@ -19,7 +19,7 @@
*/
class MaskedInputAsset extends AssetBundle
{
- public $sourcePath = '@bower/inputmask/dist';
+ public $sourcePath = '@npm/inputmask/dist';
public $js = [
'jquery.inputmask.js',
];
diff --git a/widgets/PjaxAsset.php b/widgets/PjaxAsset.php
index 47795f683..c084763f9 100644
--- a/widgets/PjaxAsset.php
+++ b/widgets/PjaxAsset.php
@@ -17,7 +17,7 @@
*/
class PjaxAsset extends AssetBundle
{
- public $sourcePath = '@bower/yii2-pjax';
+ public $sourcePath = '@npm/yii2-pjax';
public $js = [
'jquery.pjax.js',
];
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy