PHP Code Style Fixes (#6844)

This commit is contained in:
Lucas Bartholemy 2024-02-08 12:31:43 +01:00 committed by GitHub
parent 3a6108bfd5
commit e7bb964cda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
237 changed files with 421 additions and 550 deletions

View File

@ -6,7 +6,7 @@ $finder = (new PhpCsFixer\Finder())
'views/',
])
->in([
'protected/humhub/modules',
'protected/humhub',
]);
return (new PhpCsFixer\Config())

View File

@ -127,7 +127,9 @@
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::postCreateProject"
]
],
"cs:fix": "protected/vendor/bin/php-cs-fixer fix",
"cs:check": "protected/vendor/bin/php-cs-fixer fix --dry-run --diff"
},
"extra": {
"yii\\composer\\Installer::postCreateProject": {

View File

@ -44,9 +44,9 @@ class AppAsset extends WebStaticAssetBundle
*/
public $jsPosition = View::POS_HEAD;
const BUNDLE_NAME = 'app';
public const BUNDLE_NAME = 'app';
const STATIC_DEPENDS = [
public const STATIC_DEPENDS = [
JqueryAsset::class,
JuiBootstrapBridgeAsset::class,
JuiAsset::class,

View File

@ -17,7 +17,6 @@ use humhub\components\assets\AssetBundle;
*/
class BlueimpFileUploadAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -17,7 +17,6 @@ use humhub\components\assets\AssetBundle;
*/
class BlueimpGalleryAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -17,7 +17,6 @@ use humhub\components\assets\AssetBundle;
*/
class BlueimpGalleryStyleAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -22,9 +22,9 @@ class BootstrapColorPickerAsset extends WebStaticAssetBundle
*/
public $js = ['js/colorpicker/js/bootstrap-colorpicker-modified.js'];
/**
* @inheritdoc
*/
/**
* @inheritdoc
*/
public $css = ['js/colorpicker/css/bootstrap-colorpicker.min.css'];
}

View File

@ -17,7 +17,6 @@ use yii\web\AssetBundle;
*/
class CaretjsAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -17,7 +17,6 @@ use humhub\components\assets\AssetBundle;
*/
class ClipboardJsAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -29,11 +29,11 @@ use humhub\modules\user\assets\UserPickerAsset;
*/
class CoreBundleAsset extends WebStaticAssetBundle
{
const BUNDLE_NAME = 'defer';
public const BUNDLE_NAME = 'defer';
public $defaultDepends = false;
const STATIC_DEPENDS = [
public const STATIC_DEPENDS = [
AppAsset::class,
JqueryHighlightAsset::class,
JqueryAutosizeAsset::class,

View File

@ -1,6 +1,5 @@
<?php
namespace humhub\assets;
use humhub\components\assets\WebStaticAssetBundle;

View File

@ -17,7 +17,6 @@ use humhub\components\assets\AssetBundle;
*/
class FontAwesomeAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -13,4 +13,4 @@ class GridViewAsset extends WebStaticAssetBundle
public $css = [
'css/grid-view.css'
];
}
}

View File

@ -13,7 +13,6 @@ use humhub\components\assets\WebStaticAssetBundle;
class HighlightJsAsset extends WebStaticAssetBundle
{
/**
* @inheritdoc
*/

View File

@ -13,7 +13,6 @@ use humhub\components\assets\WebStaticAssetBundle;
class HighlightJsStyleAsset extends WebStaticAssetBundle
{
/**
* @inheritdoc
*/

View File

@ -19,7 +19,6 @@ use yii\web\AssetBundle;
*/
class Html5shivAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -17,7 +17,6 @@ use humhub\components\assets\AssetBundle;
*/
class ImagesLoadedAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -17,7 +17,6 @@ use yii\web\AssetBundle;
*/
class JplayerAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -17,7 +17,6 @@ use humhub\components\assets\AssetBundle;
*/
class JqueryAutosizeAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -17,7 +17,6 @@ use yii\web\AssetBundle;
*/
class JqueryCookieAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -18,7 +18,6 @@ use yii\web\View;
*/
class JqueryKnobAsset extends AssetBundle
{
public $jsOptions = ['position' => View::POS_BEGIN];
/**

View File

@ -17,7 +17,6 @@ use humhub\components\assets\WebStaticAssetBundle;
*/
class JqueryNiceScrollAsset extends WebStaticAssetBundle
{
/**
* @inheritdoc
*/

View File

@ -18,7 +18,6 @@ use yii\web\AssetBundle;
*/
class JqueryTimeEntryAsset extends AssetBundle
{
public $publishOptions = [
'forceCopy' => false
];

View File

@ -17,7 +17,6 @@ use humhub\components\assets\AssetBundle;
*/
class JqueryWidgetAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -18,7 +18,6 @@ use humhub\components\assets\AssetBundle;
*/
class NProgressAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -18,7 +18,6 @@ use humhub\components\assets\AssetBundle;
*/
class NProgressStyleAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -17,7 +17,6 @@ use yii\web\AssetBundle;
*/
class Select2Asset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -18,7 +18,6 @@ use yii\web\AssetBundle;
*/
class Select2BootstrapAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -18,4 +18,4 @@ class Select2SearchInputPlaceholderAsset extends WebStaticAssetBundle
* @inheritdoc
*/
public $js = ['js/select2-searchInputPlaceholder.min.js'];
}
}

View File

@ -17,7 +17,6 @@ use yii\web\AssetBundle;
*/
class Select2StyleAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -18,7 +18,6 @@ use yii\web\AssetBundle;
*/
class SocketIoAsset extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -17,7 +17,6 @@ use humhub\components\assets\AssetBundle;
*/
class SwipedEventsAssets extends AssetBundle
{
/**
* @inheritdoc
*/

View File

@ -1,9 +1,7 @@
<?php
namespace humhub\assets;
use yii\web\AssetBundle;
class TopNavigationAsset extends AssetBundle

View File

@ -21,22 +21,21 @@ use yii\helpers\Console;
*/
class CronController extends Controller
{
/**
* @event Event an event that is triggered when the hourly cron is started.
*/
const EVENT_ON_HOURLY_RUN = "hourly";
public const EVENT_ON_HOURLY_RUN = "hourly";
/**
* @event Event an event that is triggered when the daily cron is started.
*/
const EVENT_ON_DAILY_RUN = "daily";
public const EVENT_ON_DAILY_RUN = "daily";
/**
* @var string mutex to acquire
*/
const MUTEX_ID = 'cron-mutex';
public const MUTEX_ID = 'cron-mutex';
/**

View File

@ -18,11 +18,10 @@ use yii\helpers\Console;
*/
class IntegrityController extends Controller
{
/**
* @event Event an event that is triggered when the integritychecker is started.
*/
const EVENT_ON_RUN = "run";
public const EVENT_ON_RUN = "run";
/**
* @inheritdoc
@ -60,7 +59,7 @@ class IntegrityController extends Controller
* If not in interactive mode, it returns true otherwise a confirm dialog will be shown.
*
* @param string $headline
* @return boolean
* @return bool
*/
public function showFix($message)
{

View File

@ -21,7 +21,6 @@ use yii\base\Exception;
*/
class MessageController extends \yii\console\controllers\MessageController
{
/**
* Extracts messages for a given module from source code.
*

View File

@ -67,7 +67,7 @@ class MigrateController extends \yii\console\controllers\MigrateController
public $migrationPath = '@humhub/migrations';
/**
* @var boolean also include migration paths of all enabled modules
* @var bool also include migration paths of all enabled modules
*/
public bool $includeModuleMigrations = false;

View File

@ -26,7 +26,6 @@ use yii\console\widgets\Table;
*/
class SettingsController extends Controller
{
/**
* Lists all stored settings
*
@ -138,4 +137,3 @@ class SettingsController extends Controller
}
}

View File

@ -18,7 +18,6 @@ use yii\helpers\Console;
*/
class TestController extends \yii\console\Controller
{
/**
* Sends a test e-mail to the given e-mail address
*

View File

@ -9,7 +9,6 @@
namespace Zend\Stdlib;
use ArrayAccess;
use Countable;
use IteratorAggregate;
@ -28,12 +27,12 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
* Properties of the object have their normal functionality
* when accessed as list (var_dump, foreach, etc.).
*/
const STD_PROP_LIST = 1;
public const STD_PROP_LIST = 1;
/**
* Entries can be accessed as properties (read and write).
*/
const ARRAY_AS_PROPS = 2;
public const ARRAY_AS_PROPS = 2;
/**
* @var array
@ -133,7 +132,7 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
{
$ret = null;
if ($this->flag == self::ARRAY_AS_PROPS) {
$ret =& $this->offsetGet($key);
$ret = & $this->offsetGet($key);
return $ret;
}
@ -296,7 +295,7 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
if (!$this->offsetExists($key)) {
return $ret;
}
$ret =& $this->storage[$key];
$ret = & $this->storage[$key];
return $ret;
}
@ -425,7 +424,7 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Countable
$this->setIteratorClass($v);
break;
case 'protectedProperties':
// continue;
// continue;
// HUMHUB MODIFICATION
continue 2;

View File

@ -26,18 +26,18 @@ use yii\widgets\ActiveField;
*/
class HForm extends \yii\base\Component
{
const EVENT_BEFORE_VALIDATE = 'beforeValidate';
const EVENT_AFTER_VALIDATE = 'afterValidate';
public const EVENT_BEFORE_VALIDATE = 'beforeValidate';
public const EVENT_AFTER_VALIDATE = 'afterValidate';
/**
* @since 1.2.6
*/
const EVENT_AFTER_INIT = 'afterInit';
public const EVENT_AFTER_INIT = 'afterInit';
/**
* @since 1.2.6
*/
const EVENT_BEFORE_RENDER = 'beforeRender';
public const EVENT_BEFORE_RENDER = 'beforeRender';
public $showErrorSummary;
@ -52,7 +52,7 @@ class HForm extends \yii\base\Component
public $definition = [];
/**
* @var boolean manually mark form as submitted
* @var bool manually mark form as submitted
*/
public $markedAsSubmitted = false;

View File

@ -26,7 +26,6 @@ use yii\validators\Validator;
*/
class ActiveRecord extends \yii\db\ActiveRecord
{
/**
* @var \humhub\modules\file\components\FileManager
*/
@ -41,7 +40,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
/**
* @event Event is used to append rules what defined in [[rules()]].
*/
const EVENT_APPEND_RULES = 'appendRules';
public const EVENT_APPEND_RULES = 'appendRules';
/**
* @inheritdoc
@ -180,7 +179,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
public function __unserialize($unserializedArr)
{
$this->init();
$this->setAttributes($unserializedArr['attributes'],false);
$this->setAttributes($unserializedArr['attributes'], false);
$this->setOldAttributes($unserializedArr['oldAttributes']);
}

View File

@ -74,7 +74,7 @@ trait ApplicationTrait
/**
* Checks if Humhub is installed
*
* @return boolean
* @return bool
* @since 1.16
*/
public function isInstalled(): bool

View File

@ -75,7 +75,7 @@ class AssetManager extends \yii\web\AssetManager
array_unshift($bundle->depends, CoreBundleAsset::class);
// Allows to add defer to non HumHub AssetBundles
if(property_exists($bundle,'defer') && $bundle->defer) {
if(property_exists($bundle, 'defer') && $bundle->defer) {
$bundle->jsOptions['defer'] = 'defer';
}
}

View File

@ -21,7 +21,6 @@ use yii\base\BaseObject;
*/
abstract class ContentContainerUrlRule extends BaseObject implements UrlRuleInterface
{
/**
* @var string default route to content container home
*/
@ -48,7 +47,7 @@ abstract class ContentContainerUrlRule extends BaseObject implements UrlRuleInte
* @param string $url
* @return ContentContainerActiveRecord
*/
abstract static protected function getContentContainerByUrl(string $url): ?ContentContainerActiveRecord;
abstract protected static function getContentContainerByUrl(string $url): ?ContentContainerActiveRecord;
/**
* Get Content Container by guid
@ -156,7 +155,7 @@ abstract class ContentContainerUrlRule extends BaseObject implements UrlRuleInte
$ruleRoute = [];
foreach ($ruleParts as $r => $rulePart) {
if (preg_match( '/^<([a-zA-Z0-9_-]+)>$/', $rulePart, $ruleParamMatch)) {
if (preg_match('/^<([a-zA-Z0-9_-]+)>$/', $rulePart, $ruleParamMatch)) {
if (!isset($params[$ruleParamMatch[1]])) {
return false;
}
@ -254,7 +253,7 @@ abstract class ContentContainerUrlRule extends BaseObject implements UrlRuleInte
$ruleParams = [];
foreach ($ruleParts as $r => $rulePart) {
if (preg_match( '/^<([a-zA-Z0-9_-]+)>$/', $rulePart, $ruleParamMatch)) {
if (preg_match('/^<([a-zA-Z0-9_-]+)>$/', $rulePart, $ruleParamMatch)) {
$ruleParams[$ruleParamMatch[1]] = $requestParts[$r];
} elseif ($rulePart !== $requestParts[$r]) {
// Skip the rule if at least one part is different

View File

@ -30,7 +30,7 @@ class Controller extends \yii\web\Controller
/**
* @event \yii\base\Event an event raised on init a controller.
*/
const EVENT_INIT = 'init';
public const EVENT_INIT = 'init';
/**
* @var null|string the name of the sub layout to be applied to this controller's views.
@ -49,7 +49,7 @@ class Controller extends \yii\web\Controller
public $actionTitlesMap = [];
/**
* @var boolean append page title
* @var bool append page title
*/
public $prependActionTitles = true;
@ -161,7 +161,7 @@ class Controller extends \yii\web\Controller
/**
* Throws HttpException in case the request is not an post request, otherwise returns true.
*
* @return boolean returns true in case the current request is a POST
* @return bool returns true in case the current request is a POST
* @throws \yii\web\HttpException
*/
public function forcePostRequest()
@ -271,7 +271,7 @@ class Controller extends \yii\web\Controller
*
* @param array $map
* [action_id => action_page_title]
* @param boolean $prependActionTitles set to false if the action titles should rather be appended
* @param bool $prependActionTitles set to false if the action titles should rather be appended
*/
public function setActionTitles($map = [], $prependActionTitles = true)
{

View File

@ -16,7 +16,6 @@ namespace humhub\components;
*/
class Event extends \yii\base\Event
{
/**
* @var mixed an optional result which can be manipulated by the event handler.
* Note that this varies according to which event is currently executing.

View File

@ -214,7 +214,7 @@ class Module extends \yii\base\Module
/**
* Determines whether or not this module has an asset directory.
* @return boolean
* @return bool
*/
private function hasAssets()
{
@ -430,7 +430,7 @@ class Module extends \yii\base\Module
/**
* Determines whether the module has notification classes or not
*
* @return boolean has notifications
* @return bool has notifications
* @since 1.2
*/
public function hasNotifications()

View File

@ -1,9 +1,7 @@
<?php
namespace humhub\components;
use Yii;
class ModuleEvent extends \yii\base\Event

View File

@ -68,7 +68,7 @@ class ModuleManager extends Component
/**
* Create a backup on module folder deletion
*
* @var boolean
* @var bool
*/
public bool $createBackup = true;
@ -468,7 +468,7 @@ class ModuleManager extends Component
*
* @param string $id
*
* @return boolean
* @return bool
*/
public function hasModule($id)
{

View File

@ -119,7 +119,7 @@ class SettingsManager extends BaseSettingsManager
* changed at runtime.
*
* @param string $name
* @return boolean
* @return bool
*/
public function isFixed(string $name): bool
{

View File

@ -39,7 +39,6 @@ use yii\helpers\Url;
*/
abstract class SocialActivity extends BaseObject implements rendering\Viewable
{
/**
* User which performed the activity.
*
@ -202,7 +201,7 @@ abstract class SocialActivity extends BaseObject implements rendering\Viewable
}
/**
* @return integer related space id in case the activity source is an related contentcontainer of type space, otherwise null
* @return int related space id in case the activity source is an related contentcontainer of type space, otherwise null
* @throws \yii\base\Exception
*/
public function getSpaceId()
@ -216,7 +215,7 @@ abstract class SocialActivity extends BaseObject implements rendering\Viewable
* Determines if this activity is related to a content. This is the case if the activitiy source
* is of type ContentOwner.
*
* @return boolean true if this activity is related to a ContentOwner else false
* @return bool true if this activity is related to a ContentOwner else false
*/
public function hasContent()
{
@ -253,7 +252,7 @@ abstract class SocialActivity extends BaseObject implements rendering\Viewable
if ($this->source instanceof Comment) {
$url = $this->source->getUrl();
} else if ($this->hasContent()) {
} elseif ($this->hasContent()) {
$url = $this->getContent()->getUrl();
} elseif ($this->source instanceof ContentContainerActiveRecord) {
$url = $this->source->getUrl();

View File

@ -8,7 +8,6 @@
namespace humhub\components;
/**
* @inheritdoc
* @deprecated since 1.3

View File

@ -17,11 +17,10 @@ use humhub\libs\WidgetCreateEvent;
*/
class Widget extends \yii\base\Widget
{
/**
* @event WidgetCreateEvent an event raised before creating a widget.
*/
const EVENT_CREATE = 'create';
public const EVENT_CREATE = 'create';
/**
* @var bool if set to false this widget won't be rendered
@ -60,7 +59,7 @@ class Widget extends \yii\base\Widget
$widget = Yii::createObject($config);
$out = '';
if ($widget->beforeRun()) {
$result = (empty($widget->widgetLayout)) ? $widget->run() : $widget->render($widget->widgetLayout, $widget->getLayoutViewParams());
$result = (empty($widget->widgetLayout)) ? $widget->run() : $widget->render($widget->widgetLayout, $widget->getLayoutViewParams());
$out = $widget->afterRun($result);
}
} catch (\Throwable $e) {

View File

@ -93,7 +93,7 @@ abstract class AccessValidator extends BaseObject
* The whole rule set can be retrieved by calling `$this->access->rules`.
*
*
* @return boolean true if validation passed otherwise true
* @return bool true if validation passed otherwise true
*/
abstract public function run();

View File

@ -20,7 +20,6 @@ namespace humhub\components\access;
*/
abstract class ActionAccessValidator extends AccessValidator
{
/**
* @var bool if set to true (default) all validator related rules have to pass otherwise only one
*/
@ -33,7 +32,7 @@ abstract class ActionAccessValidator extends AccessValidator
*
* @param $rule array
* @param $access ControllerAccess
* @return boolean
* @return bool
*/
public function run()
{

View File

@ -109,70 +109,70 @@ class ControllerAccess extends BaseObject
/**
* Allows the action rule setting only by extra option ['myRule', 'actions' => ['action1', 'action2']]
*/
const ACTION_SETTING_TYPE_OPTION_ONLY = 0;
public const ACTION_SETTING_TYPE_OPTION_ONLY = 0;
/**
* Allows the action rule setting by extra option ['myRule', 'actions' => ['action1', 'action2']]
* or immediate ['myRule' => ['action1', 'action2']]
*/
const ACTION_SETTING_TYPE_BOTH = 1;
public const ACTION_SETTING_TYPE_BOTH = 1;
/**
* Only admins have access to the given set of actions e.g.: ['admin' => ['action1']]
*/
const RULE_ADMIN_ONLY = 'admin';
public const RULE_ADMIN_ONLY = 'admin';
/**
* Validate against a given set of permissions e.g.:
* ['permission' => [MyPermission::class], 'actions' => ['action1']]
*/
const RULE_PERMISSION = 'permission';
public const RULE_PERMISSION = 'permission';
/**
* Only logged in user have access e.g.: ['login' => ['action1', 'action2']]
*/
const RULE_LOGGED_IN_ONLY = 'login';
public const RULE_LOGGED_IN_ONLY = 'login';
/**
* Check guest mode e.g.: ['strict'] (mainly used as global)
*/
const RULE_STRICT = 'strict';
public const RULE_STRICT = 'strict';
/**
* Check guest if user is disabled
*/
const RULE_DISABLED_USER = 'disabledUser';
public const RULE_DISABLED_USER = 'disabledUser';
/**
* Check guest if user is unnapproved
*/
const RULE_UNAPPROVED_USER = 'unapprovedUser';
public const RULE_UNAPPROVED_USER = 'unapprovedUser';
/**
* Check guest if user must change password
* @since 1.8
*/
const RULE_MUST_CHANGE_PASSWORD = 'mustChangePassword';
public const RULE_MUST_CHANGE_PASSWORD = 'mustChangePassword';
/**
* Maintenance mode is active
*/
const RULE_MAINTENANCE_MODE = 'maintenance';
public const RULE_MAINTENANCE_MODE = 'maintenance';
/**
* Check guest if request method is post
*/
const RULE_POST = 'post';
public const RULE_POST = 'post';
/**
* Make sure response type is json
*/
const RULE_JSON = 'json';
public const RULE_JSON = 'json';
/**
* Only AJAX request is allowed for the actions
*/
const RULE_AJAX_ONLY = 'ajax';
public const RULE_AJAX_ONLY = 'ajax';
/**
* @var array fixed rules will always be added to the current rule set

View File

@ -5,7 +5,6 @@
* @license https://www.humhub.com/licences
*/
namespace humhub\components\access;
class DelegateAccessValidator extends ActionAccessValidator
@ -19,7 +18,7 @@ class DelegateAccessValidator extends ActionAccessValidator
* @since 1.8
*/
public $codeCallback;
/**
* @inheritDoc
*/

View File

@ -4,6 +4,7 @@
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\components\access;
class DeprecatedPermissionAccessValidator extends PermissionAccessValidator

View File

@ -4,6 +4,7 @@
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\components\access;
/**

View File

@ -1,6 +1,5 @@
<?php
namespace humhub\components\assets;
use Yii;
@ -10,7 +9,6 @@ use yii\web\AssetBundle as BaseAssetBundle;
use humhub\assets\CoreBundleAsset;
use humhub\modules\ui\view\components\View;
/**
* This base asset bundle class adds some additional properties as well ass default loading behavior for HumHub assets.
*
@ -130,7 +128,7 @@ class AssetBundle extends BaseAssetBundle
if(!$this->isAsync() && $this->isDefer()) {
$this->jsOptions['defer'] = 'defer';
} else if($this->isAsync()) {
} elseif($this->isAsync()) {
$this->jsOptions['async'] = 'async';
}
@ -138,7 +136,7 @@ class AssetBundle extends BaseAssetBundle
if(!$useProdAssets && $this->forceCopy && !isset($this->publishOptions['forceCopy'])) {
$this->publishOptions['forceCopy'] = true;
} else if(!isset($this->publishOptions['forceCopy'])) {
} elseif(!isset($this->publishOptions['forceCopy'])) {
$this->publishOptions['forceCopy'] = false;
}

View File

@ -1,6 +1,5 @@
<?php
namespace humhub\components\assets;
/**

View File

@ -112,7 +112,7 @@ class AccessControl extends ActionFilter
/**
* Only allow admins access to this controller
*
* @var boolean
* @var bool
* @deprecated since 1.2.2 use ['adminOnly'] rule instead
*/
public $adminOnly = false;

View File

@ -40,7 +40,7 @@ class PolymorphicRelation extends Behavior
public string $pkAttribute = 'object_id';
/**
* @var boolean if set to true, an exception is thrown if `object_model` and `object_id` is set but does not exist
* @var bool if set to true, an exception is thrown if `object_model` and `object_id` is set but does not exist
*/
public bool $strict = false;
@ -148,7 +148,7 @@ class PolymorphicRelation extends Behavior
*
* @param mixed $object
*
* @return boolean
* @return bool
*/
private function validateUnderlyingObjectType(?object $object)
{

View File

@ -18,7 +18,6 @@ use yii\base\BootstrapInterface;
*/
class LanguageSelector implements BootstrapInterface
{
/**
* @inheritdoc
*/

View File

@ -8,7 +8,6 @@
namespace humhub\components\db;
use PDOException;
use yii\db\mysql\Schema;
@ -23,7 +22,6 @@ use yii\db\mysql\Schema;
*/
class MysqlSchema extends Schema
{
/**
* Collects the foreign key column details for the given table.
* @param TableSchema $table the table metadata

View File

@ -74,7 +74,7 @@ class DataColumn extends Column
if ($this->label === null) {
if ($provider instanceof ActiveDataProvider && $provider->query instanceof ActiveQueryInterface) {
/* @var $model Model */
$model = new $provider->query->modelClass;
$model = new $provider->query->modelClass();
$label = $model->getAttributeLabel($this->attribute);
} else {
$models = $provider->getModels();
@ -96,7 +96,7 @@ class DataColumn extends Column
* Returns the data cell value.
* @param mixed $model the data model
* @param mixed $key the key associated with the data model
* @param integer $index zero-based index of data model among models array returned by [[GridView::dataProvider]].
* @param int $index zero-based index of data model among models array returned by [[GridView::dataProvider]].
* @return string the data cell value
*/
public function getDataCellValue($model, $key, $index)

View File

@ -25,7 +25,6 @@ use yii\web\Response;
*/
class ExportResult extends BaseObject
{
/**
* @var string base path for the temporary directory and files.
*/
@ -102,7 +101,7 @@ class ExportResult extends BaseObject
/**
* Deletes associated directory with all internal files.
* @return boolean whether file has been deleted.
* @return bool whether file has been deleted.
*/
public function delete()
{

View File

@ -57,7 +57,6 @@ use yii\i18n\Formatter;
*/
class SpreadsheetExport extends Component
{
/**
* @var \yii\data\DataProviderInterface the data provider for the view.
* This property can be omitted in case [[query]] is set.
@ -73,15 +72,15 @@ class SpreadsheetExport extends Component
*/
public $columns = [];
/**
* @var boolean whether to show the header section of the sheet.
* @var bool whether to show the header section of the sheet.
*/
public $showHeader = true;
/**
* @var boolean whether to show the footer section of the sheet.
* @var bool whether to show the footer section of the sheet.
*/
public $showFooter = false;
/**
* @var boolean enable autosize for xlsx/xls export.
* @var bool enable autosize for xlsx/xls export.
*/
public $autoSize = true;
/**

View File

@ -17,7 +17,6 @@ use yii\base\InvalidArgumentException;
*/
class Formatter extends \yii\i18n\Formatter
{
/**
* @inheritdoc
*/

View File

@ -21,7 +21,6 @@ use yii\i18n\I18N as BaseI18N;
*/
class I18N extends BaseI18N
{
/**
* @var string path which contains message overwrites
*/

View File

@ -13,7 +13,6 @@ use humhub\libs\I18NHelper;
use Yii;
use yii\base\InvalidConfigException;
/**
* ModuleMessageSource
*

View File

@ -34,7 +34,6 @@ use humhub\components\rendering\Viewable;
*/
class DefaultViewPathRenderer extends \humhub\components\rendering\ViewPathRenderer
{
/**
* @var string fallback view
*/

View File

@ -30,7 +30,6 @@ use Yii;
*/
class LayoutRenderer extends ViewPathRenderer
{
/**
* @var string layout file path
*/

View File

@ -19,7 +19,6 @@ namespace humhub\components\rendering;
*/
class MailRenderer extends DefaultViewPathRenderer
{
/**
* @inheritdoc
*/

View File

@ -19,7 +19,6 @@ namespace humhub\components\rendering;
*/
interface Renderer
{
/**
* Renders the given $viewable.
*

View File

@ -35,13 +35,12 @@ use Yii;
*/
class ViewPathRenderer extends \yii\base\BaseObject implements Renderer
{
/**
* Can be used to search the parent's view folder (e.g. the modules base view folder) for the view file.
* Otherwise this renderer searches for a direct views subdirectory.
*
* This field is ignored if $viewPath is given.
* @var boolean if set to true the renderer will search in the parents view directory for the view.
* @var bool if set to true the renderer will search in the parents view directory for the view.
*/
public $parent = false;
@ -126,7 +125,7 @@ class ViewPathRenderer extends \yii\base\BaseObject implements Renderer
* The default implementation returns the 'views' subdirectory under the directory containing the notification class file.
*
* @param Viewable $viewable The viewable
* @param boolean $useSubPath use the subpath if provided
* @param bool $useSubPath use the subpath if provided
* @return string the directory containing the view files for this notification.
*/
public function getViewPath(Viewable $viewable, $useSubPath = true)

View File

@ -16,7 +16,6 @@ namespace humhub\components\rendering;
*/
interface Viewable
{
/**
* Returns an array of view parameter, required for rendering.
*

View File

@ -11,7 +11,8 @@
* }
* ```
*/
class Yii {
class Yii
{
/**
* @var \yii\web\Application|\yii\console\Application|\humhub\components\Application|\humhub\components\console\Application|\humhub\interfaces\ApplicationInterface|__Application|__WebApplication
*/
@ -40,7 +41,8 @@ class Yii {
* @property \yii\web\User|__WebUser $user
* @property \yii\caching\ArrayCache $runtimeCache
*/
class __Application {
class __Application
{
}
/**

View File

@ -523,4 +523,4 @@ return [
'defer',
],
],
];
];

View File

@ -64,7 +64,7 @@ $config = [
],
'logVars' => ['_GET', '_SERVER'],
],
\yii\log\DbTarget::class =>[
\yii\log\DbTarget::class => [
'class' => \yii\log\DbTarget::class,
'levels' => ['error', 'warning'],
'except' => [

View File

@ -22,7 +22,6 @@ use humhub\components\Controller;
*/
class ErrorController extends Controller
{
/**
* This is the action to handle external exceptions.
*/

View File

@ -19,7 +19,6 @@ use humhub\components\Controller;
*/
class HomeController extends Controller
{
/**
* Redirects to the home controller/action
*

View File

@ -8,7 +8,6 @@
namespace humhub\controllers;
use humhub\components\Controller;
use humhub\models\UrlOembed;
use Yii;

View File

@ -13,13 +13,12 @@ use yii\db\ActiveQuery;
/**
* ActiveQueryEvent represents the parameter needed by [[ActiveQuery]] events.
*
*
* @since 1.2.3
* @author Luke
*/
class ActiveQueryEvent extends Event
{
/**
* @var ActiveQuery the active query
*/

View File

@ -33,7 +33,7 @@ class OembedFetchEvent extends Event
$urlOembed = UrlOembed::findOne(['url' => $this->url]);
if ($urlOembed !== null) {
$this->result = trim(preg_replace('/\s+/', ' ', $urlOembed->preview));
} else if ($this->providers) {
} elseif ($this->providers) {
$this->result = trim(preg_replace('/\s+/', ' ', UrlOembed::loadUrl($this->url, $this->getProviderUrl())));
}
}

View File

@ -19,7 +19,7 @@ interface ArchiveableInterface
/**
* Checks if the given user can edit/create this element.
*
* @param User|integer|string|null $user user instance or user id
* @param User|int|string|null $user user instance or user id
* @return bool
*/
public function canArchive($user = null): bool;

View File

@ -19,7 +19,7 @@ interface DeletableInterface
/**
* Checks if given item can be deleted.
*
* @param User|integer|string|null $user user instance or user id
* @param User|int|string|null $user user instance or user id
* @return bool
*/
public function canDelete($user = null): bool;

View File

@ -16,11 +16,10 @@ use humhub\modules\user\models\User;
*/
interface EditableInterface
{
/**
* Checks if the given user can edit/create this element.
*
* @param User|integer|string|null $user user instance or user id
* @param User|int|string|null $user user instance or user id
* @return bool
*/
public function canEdit($user = null): bool;

View File

@ -19,7 +19,7 @@ interface ViewableInterface
/**
* Checks if user can view this element.
*
* @param User|integer|string|null $user User instance or user id, null - current user
* @param User|int|string|null $user User instance or user id, null - current user
* @return bool
*/
public function canView($user = null): bool;

View File

@ -20,7 +20,6 @@ use humhub\libs\Html;
*/
class ActionColumn extends Column
{
/**
* @var string the ID attribute of the model, to generate action URLs.
*/

View File

@ -26,14 +26,14 @@ class BasePermission extends BaseObject
/**
* @event Event an event that is triggered when the permission is initialized via [[init()]].
*/
const EVENT_INIT = 'init';
public const EVENT_INIT = 'init';
/**
* Permission States
*/
const STATE_DEFAULT = '';
const STATE_ALLOW = 1;
const STATE_DENY = 0;
public const STATE_DEFAULT = '';
public const STATE_ALLOW = 1;
public const STATE_DENY = 0;
/**
* @var string id of the permission (default is classname)
@ -220,7 +220,7 @@ class BasePermission extends BaseObject
/**
* Checks if permission state can be changed
*
* @return boolean
* @return bool
*/
public function canChangeState($groupId)
{
@ -230,7 +230,7 @@ class BasePermission extends BaseObject
/**
* Checks the given id belongs to this permission
*
* @return boolean
* @return bool
*/
public function hasId($id)
{

View File

@ -17,7 +17,6 @@ use Yii;
*/
class CURLHelper
{
/**
* Returns CURL Default Options
*

View File

@ -19,10 +19,10 @@ use Yii;
*/
class DateHelper
{
const DB_DATE_FORMAT = 'Y-m-d H:i:s';
const DB_DATE_FORMAT_PHP = 'php:Y-m-d H:i:s';
const REGEX_DBFORMAT_DATE = '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/';
const REGEX_DBFORMAT_DATETIME = '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]) (\d{2}):(\d{2}):(\d{2})$/';
public const DB_DATE_FORMAT = 'Y-m-d H:i:s';
public const DB_DATE_FORMAT_PHP = 'php:Y-m-d H:i:s';
public const REGEX_DBFORMAT_DATE = '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/';
public const REGEX_DBFORMAT_DATETIME = '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]) (\d{2}):(\d{2}):(\d{2})$/';
/**
* Returns the user timeZone or app timezone as fallback.
@ -61,12 +61,12 @@ class DateHelper
*
* @param string $value the date value
* @param bool $dateOnly
* @return boolean
* @return bool
* @since v1.4
*/
public static function isInDbFormat($value, $dateOnly = false)
{
return (boolean) ($dateOnly ? preg_match(self::REGEX_DBFORMAT_DATE, $value) : preg_match(self::REGEX_DBFORMAT_DATETIME, $value));
return (bool) ($dateOnly ? preg_match(self::REGEX_DBFORMAT_DATE, $value) : preg_match(self::REGEX_DBFORMAT_DATETIME, $value));
}
/**

View File

@ -18,10 +18,9 @@ use Yii;
*/
class DateTimeHelper
{
/**
* Rounds given DateTime object to the next full hour
*
*
* @param DateTime $dateTime
* @return DateTime
*/
@ -49,7 +48,7 @@ class DateTimeHelper
/**
* Converts two given DateTime instances or strings into a DateInterval
*
*
* @param DateTime|string|null $startDateTime the start date or null for current date time
* @param DateTime $endDateTime the end date time
* @return \DateInterval
@ -57,7 +56,7 @@ class DateTimeHelper
public static function getDateInterval($startDateTime = null, $endDateTime)
{
if ($startDateTime === null) {
$startDateTime = new DateTime;
$startDateTime = new DateTime();
}
if (is_string($startDateTime)) {
@ -73,7 +72,7 @@ class DateTimeHelper
/**
* Converts a DateInterval object into seconds
*
*
* @param \DateInterval $interval
* @return int the seconds
*/

View File

@ -19,12 +19,11 @@ use yii\validators\DateValidator;
*/
class DbDateValidator extends DateValidator
{
/**
* Database Field - Validators
*/
const REGEX_DBFORMAT_DATE = '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/';
const REGEX_DBFORMAT_DATETIME = '/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/';
public const REGEX_DBFORMAT_DATE = '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/';
public const REGEX_DBFORMAT_DATETIME = '/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/';
/**
* @var string the format the value should converted to (database datetime or date format)
@ -121,7 +120,7 @@ class DbDateValidator extends DateValidator
/**
* Checks a time attribute name is given, if empty don't handle time
*
* @return boolean
* @return bool
*/
protected function hasTime()
{

View File

@ -19,7 +19,6 @@ use yii\web\JsExpression;
*/
class DropDownGridColumn extends DataColumn
{
/**
* @var array list of attributes which should be aditionally submitted (e.g. id)
*/

View File

@ -20,7 +20,6 @@ use yii\helpers\ArrayHelper;
*/
class DynamicConfig extends BaseObject
{
/**
* Add an array to the dynamic configuration
*

View File

@ -1,13 +1,11 @@
<?php
namespace humhub\libs;
//https://github.com/discourse/discourse/blob/master/lib/emoji/db.json
class EmojiMap
{
const MAP = [
public const MAP = [
'grinning' => '😀',
'smiley' => '😃',
'smile' => '😄',

View File

@ -81,7 +81,7 @@ class Helpers
* Shorten a text string
*
* @param string $text - Text string you will shorten
* @param integer $length - Count of characters to show
* @param int $length - Count of characters to show
*
* @return string
*/
@ -129,8 +129,8 @@ class Helpers
* @deprecated since 1.11 Use mb_substr() instead.
*
* @param string $str
* @param integer $from
* @param integer $len
* @param int $from
* @param int $len
*
* @return string
*/
@ -189,8 +189,10 @@ class Helpers
switch ($last) {
case 'g':
$val *= 1024;
// no break
case 'm':
$val *= 1024;
// no break
case 'k':
$val *= 1024;
}

Some files were not shown because too many files have changed in this diff Show More