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)) { if ($this->getElement('resource_validation')->isChecked() && parent::isValid($formData)) {
$inspection = static::inspectResource($this); $inspection = static::inspectResource($this);
if ($inspection !== null) { if ($inspection !== null) {
$join = function ($e) use (& $join) { $join = function ($e) use (&$join) {
return is_string($e) ? $e : join("\n", array_map($join, $e)); return is_string($e) ? $e : join("\n", array_map($join, $e));
}; };
$this->addElement( $this->addElement(

View File

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

View File

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

View File

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

View File

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

View File

@ -297,7 +297,9 @@ class Donut
'r' => sprintf('%F', $this->radius), 'r' => sprintf('%F', $this->radius),
'fill' => 'transparent', 'fill' => 'transparent',
'stroke-width' => $this->getThickness(), '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) '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 * @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) { if (! is_array($config) && !$config instanceof ConfigObject) {
throw new ProgrammingError('$config is neither an array nor a 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); return sprintf('%0.2f d', $value / 86400);
} }
protected static function formatForUnits($value, & $units, $base) protected static function formatForUnits($value, &$units, $base)
{ {
$sign = ''; $sign = '';
if ($value < 0) { if ($value < 0) {

View File

@ -1120,7 +1120,7 @@ class Form extends Zend_Form
* @param Zend_Form $form * @param Zend_Form $form
* @param array $defaults * @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) { foreach ($form->getElements() as $name => $element) {
if ((array_key_exists($name, $defaults) if ((array_key_exists($name, $defaults)

View File

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

View File

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

View File

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

View File

@ -140,7 +140,10 @@ class MonitoringWizard extends Wizard implements SetupWizard
$setup->addStep( $setup->addStep(
new BackendStep(array( new BackendStep(array(
'backendConfig' => $pageData['setup_monitoring_backend'], '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); $inspection = UserBackendConfigForm::inspectUserBackend($self);
if ($inspection !== null) { if ($inspection !== null) {
$join = function ($e) use (& $join) { $join = function ($e) use (&$join) {
return is_string($e) ? $e : join("\n", array_map($join, $e)); return is_string($e) ? $e : join("\n", array_map($join, $e));
}; };
$this->addElement( $this->addElement(

View File

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

View File

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