swag: Fix violations of PSR-12

PSR-2 has been deprecated and phpcs v3.5.3
now checks for the successor PSR-12
This commit is contained in:
Johannes Meyer 2019-12-04 11:01:35 +01:00
parent 8b4d5f37c5
commit 7b488d7f93
16 changed files with 22 additions and 18 deletions

View File

@ -320,7 +320,7 @@ class ResourceConfigForm extends ConfigForm
if ($this->getElement('resource_validation')->isChecked() && parent::isValid($formData)) {
$inspection = static::inspectResource($this);
if ($inspection !== null) {
$join = function ($e) use (& $join) {
$join = function ($e) use (&$join) {
return is_string($e) ? $e : join("\n", array_map($join, $e));
};
$this->addElement(

View File

@ -69,7 +69,7 @@ class UserBackendConfigForm extends ConfigForm
$externalBackends = $this->config->toArray();
array_walk(
$externalBackends,
function (& $authBackendCfg) {
function (&$authBackendCfg) {
if (! isset($authBackendCfg['backend']) || $authBackendCfg['backend'] !== 'external') {
$authBackendCfg = null;
}
@ -397,7 +397,7 @@ class UserBackendConfigForm extends ConfigForm
if ($this->getElement('backend_validation')->isChecked() && parent::isValid($formData)) {
$inspection = static::inspectUserBackend($this);
if ($inspection !== null) {
$join = function ($e) use (& $join) {
$join = function ($e) use (&$join) {
return is_string($e) ? $e : join("\n", array_map($join, $e));
};
$this->addElement(

View File

@ -229,7 +229,7 @@ class UserGroupBackendForm extends ConfigForm
if (isset($formData['backend_validation']) && parent::isValid($formData)) {
$inspection = static::inspectUserBackend($this);
if ($inspection !== null) {
$join = function ($e) use (& $join) {
$join = function ($e) use (&$join) {
return is_string($e) ? $e : join("\n", array_map($join, $e));
};
$this->addElement(

View File

@ -350,7 +350,7 @@ class RoleForm extends RepositoryForm
return $success ? $this->translate('Role removed') : $this->translate('Role removal failed');
}
protected function sortPermissions(& $permissions)
protected function sortPermissions(&$permissions)
{
return uasort($permissions, function ($a, $b) {
if (isset($a['isUsagePerm'])) {

View File

@ -170,7 +170,7 @@ class Web extends EmbeddedWeb
return $this->viewRenderer;
}
private function hasAccessToSharedNavigationItem(& $config, Config $navConfig)
private function hasAccessToSharedNavigationItem(&$config, Config $navConfig)
{
// TODO: Provide a more sophisticated solution

View File

@ -297,7 +297,9 @@ class Donut
'r' => sprintf('%F', $this->radius),
'fill' => 'transparent',
'stroke-width' => $this->getThickness(),
'stroke-dasharray' => sprintf('%F', $slice[0]) . ' ' . sprintf('%F', (99.9 - $slice[0])), // 99.9 prevents gaps (slight overlap)
'stroke-dasharray' => sprintf('%F', $slice[0])
. ' '
. sprintf('%F', (99.9 - $slice[0])), // 99.9 prevents gaps (slight overlap)
'stroke-dashoffset' => sprintf('%F', $offset)
)
);

View File

@ -405,7 +405,7 @@ abstract class IniRepository extends Repository implements Extensible, Updatable
*
* @throws ProgrammingError In case no valid section name is available
*/
protected function extractSectionName(& $config, $keyColumn)
protected function extractSectionName(&$config, $keyColumn)
{
if (! is_array($config) && !$config instanceof ConfigObject) {
throw new ProgrammingError('$config is neither an array nor a ConfigObject');

View File

@ -68,7 +68,7 @@ class Format
return sprintf('%0.2f d', $value / 86400);
}
protected static function formatForUnits($value, & $units, $base)
protected static function formatForUnits($value, &$units, $base)
{
$sign = '';
if ($value < 0) {

View File

@ -1120,7 +1120,7 @@ class Form extends Zend_Form
* @param Zend_Form $form
* @param array $defaults
*/
protected function preserveDefaults(Zend_Form $form, array & $defaults)
protected function preserveDefaults(Zend_Form $form, array &$defaults)
{
foreach ($form->getElements() as $name => $element) {
if ((array_key_exists($name, $defaults)

View File

@ -95,7 +95,7 @@ class FormHints extends Zend_Form_Decorator_Abstract
*
* @return array
*/
protected function recurseForm(Form $form, & $entirelyRequired = null, $elementsPassed = false)
protected function recurseForm(Form $form, &$entirelyRequired = null, $elementsPassed = false)
{
$requiredLabels = array();
if ($form->getRequiredCue() !== null) {

View File

@ -120,7 +120,7 @@ class IdoResourcePage extends Form
$inspection = ResourceConfigForm::inspectResource($this);
if ($inspection !== null) {
if ($showLog) {
$join = function ($e) use (& $join) {
$join = function ($e) use (&$join) {
return is_string($e) ? $e : join("\n", array_map($join, $e));
};
$this->addElement(

View File

@ -94,7 +94,7 @@ class CliUtils
);
}
public function objectStateFlags($type, & $row)
public function objectStateFlags($type, &$row)
{
$extra = array();
if ($row->{$type . '_in_downtime'}) {

View File

@ -140,7 +140,10 @@ class MonitoringWizard extends Wizard implements SetupWizard
$setup->addStep(
new BackendStep(array(
'backendConfig' => $pageData['setup_monitoring_backend'],
'resourceConfig' => array_diff_key($pageData['setup_monitoring_ido'], array('skip_validation' => null)) //TODO: Prefer a new backend once implemented.
'resourceConfig' => array_diff_key(
$pageData['setup_monitoring_ido'], //TODO: Prefer a new backend once implemented.
array('skip_validation' => null)
)
))
);

View File

@ -188,7 +188,7 @@ class AuthBackendPage extends Form
$inspection = UserBackendConfigForm::inspectUserBackend($self);
if ($inspection !== null) {
$join = function ($e) use (& $join) {
$join = function ($e) use (&$join) {
return is_string($e) ? $e : join("\n", array_map($join, $e));
};
$this->addElement(

View File

@ -97,7 +97,7 @@ class LdapResourcePage extends Form
if (isset($formData['backend_validation']) && parent::isValid($formData)) {
$inspection = ResourceConfigForm::inspectResource($this);
if ($inspection !== null) {
$join = function ($e) use (& $join) {
$join = function ($e) use (&$join) {
return is_string($e) ? $e : join("\n", array_map($join, $e));
};
$this->addElement(

View File

@ -127,8 +127,7 @@ class ArrayToTextTableHelper
$this->printHeading();
$rc = count($this->rows);
for ($i = 0; $i < $rc;
$i++) {
for ($i = 0; $i < $rc; $i++) {
$this->printRow($i);
}