Merge branch 'fix/phpcs-3.5.2'

This commit is contained in:
Thomas Gelf 2019-11-28 07:33:35 +01:00
commit 7e248a9968
23 changed files with 41 additions and 38 deletions

View File

@ -26,7 +26,6 @@ matrix:
php: '5.6'
allow_failures:
- php: nightly
- php: '7.3'
env:
- CHECK=phpunit DB=mysql DIRECTOR_TESTDB_RES="Director MySQL TestDB" DIRECTOR_TESTDB="director_test"

View File

@ -57,7 +57,7 @@ class ImportsourcesController extends ActionController
* @param $raw
* @throws \Icinga\Exception\ConfigurationError
*/
protected function acceptImport(& $raw)
protected function acceptImport(&$raw)
{
(new ImportExport($this->db()))->unserializeImportSources(json_decode($raw));
}

View File

@ -336,7 +336,7 @@ class SelfServiceController extends ActionController
* @throws \Zend_Controller_Request_Exception
* @throws \Zend_Controller_Response_Exception
*/
protected function addHostToParams(IcingaHost $host, array & $params)
protected function addHostToParams(IcingaHost $host, array &$params)
{
if (! $host->isObject()) {
return;
@ -391,7 +391,7 @@ class SelfServiceController extends ActionController
$params['accept_config'] = $host->getSingleResolvedProperty('accept_config')=== 'y';
}
protected function addStringSettingsToParams(Settings $settings, array $keys, array & $params)
protected function addStringSettingsToParams(Settings $settings, array $keys, array &$params)
{
foreach ($keys as $key) {
$value = $settings->get("self-service/$key");
@ -401,7 +401,7 @@ class SelfServiceController extends ActionController
}
}
protected function addBooleanSettingsToParams(Settings $settings, array $keys, array & $params)
protected function addBooleanSettingsToParams(Settings $settings, array $keys, array &$params)
{
foreach ($keys as $key) {
$value = $settings->get("self-service/$key");

View File

@ -287,7 +287,7 @@ class IcingaDependencyForm extends DirectorObjectForm
return $this;
}
protected function handleProperties(DbObject $object, & $values)
protected function handleProperties(DbObject $object, &$values)
{
if ($this->hasBeenSent()) {
if (isset($values['parent_host'])

View File

@ -223,7 +223,7 @@ class SyncPropertyForm extends DirectorObjectForm
return $this;
}
protected function addIcingaTempateColumns(& $columns)
protected function addIcingaTempateColumns(&$columns)
{
$funcTemplates = 'enum' . ucfirst($this->rule->get('object_type')) . 'Templates';
if (method_exists($this->db, $funcTemplates)) {
@ -238,7 +238,7 @@ class SyncPropertyForm extends DirectorObjectForm
}
}
protected function addDatalistsColumns(& $columns)
protected function addDatalistsColumns(&$columns)
{
// Clear other columns, we don't allow them right now
$columns = [];

View File

@ -46,7 +46,7 @@ class Zend_View_Helper_FormStoredPassword extends Zend_View_Helper_FormElement
return $res;
}
protected function stripAttribute(& $attribs, $name, $default = null)
protected function stripAttribute(&$attribs, $name, $default = null)
{
if (\array_key_exists($name, $attribs)) {
if (\strlen($attribs[$name])) {

View File

@ -39,7 +39,7 @@ class Check extends CheckResults
return $this;
}
protected function makeBool($check, & $message)
protected function makeBool($check, &$message)
{
if (is_callable($check)) {
try {

View File

@ -172,7 +172,7 @@ class RestApiClient
* @param $data
* @return int
*/
protected function readPart($curl, & $data)
protected function readPart($curl, &$data)
{
$length = strlen($data);
$this->readBuffer .= $data;

View File

@ -109,7 +109,7 @@ abstract class CustomVariable implements IcingaConfigRenderer
));
}
public function flatten(array & $flat, $prefix)
public function flatten(array &$flat, $prefix)
{
$flat[$prefix] = $this->getDbValue();
}

View File

@ -69,7 +69,7 @@ class CustomVariableArray extends CustomVariable
return $this;
}
public function flatten(array & $flat, $prefix)
public function flatten(array &$flat, $prefix)
{
foreach ($this->value as $k => $v) {
$v->flatten($flat, sprintf('%s[%d]', $prefix, $k));

View File

@ -75,7 +75,7 @@ class CustomVariableDictionary extends CustomVariable implements Countable
return $ret;
}
public function flatten(array & $flat, $prefix)
public function flatten(array &$flat, $prefix)
{
foreach ($this->value as $k => $v) {
$v->flatten($flat, sprintf('%s["%s"]', $prefix, $k));

View File

@ -37,7 +37,7 @@ class CustomVariableString extends CustomVariable
return $this;
}
public function flatten(array & $flat, $prefix)
public function flatten(array &$flat, $prefix)
{
// TODO: we should get rid of type=string and always use JSON
$flat[$prefix] = json_encode($this->getValue());

View File

@ -79,7 +79,7 @@ class ProcessList
$timer = $this->loop->addPeriodicTimer($timeout / 20, function () use (
$deferred,
& $timer,
&$timer,
$killTimer
) {
$stopped = [];

View File

@ -258,7 +258,7 @@ class BasketSnapshot extends DbObject
* @throws \Zend_Db_Adapter_Exception
*/
protected function restoreType(
& $all,
&$all,
$typeName,
BasketSnapshotFieldResolver $fieldResolver,
Db $connection,
@ -314,7 +314,7 @@ class BasketSnapshot extends DbObject
* @param $list
* @throws \Icinga\Module\Director\Exception\DuplicateKeyException
*/
protected function recursivelyStore(IcingaObject $object, & $list)
protected function recursivelyStore(IcingaObject $object, &$list)
{
foreach ($object->listImportNames() as $parent) {
if (array_key_exists($parent, $list)) {

View File

@ -120,7 +120,7 @@ class ImportExport
public function unserializeImportSources($objects)
{
$count = 0;
$this->connection->runFailSafeTransaction(function () use ($objects, & $count) {
$this->connection->runFailSafeTransaction(function () use ($objects, &$count) {
foreach ($objects as $object) {
ImportSource::import($object, $this->connection)->store();
$count++;
@ -133,7 +133,7 @@ class ImportExport
public function unserializeSyncRules($objects)
{
$count = 0;
$this->connection->runFailSafeTransaction(function () use ($objects, & $count) {
$this->connection->runFailSafeTransaction(function () use ($objects, &$count) {
foreach ($objects as $object) {
SyncRule::import($object, $this->connection)->store();
}

View File

@ -443,7 +443,7 @@ class Import
*
* @param array $array
*/
protected function sortArrayObject(& $array)
protected function sortArrayObject(&$array)
{
foreach ($array as $key => $val) {
$this->sortElement($val);
@ -455,7 +455,7 @@ class Import
*
* @param mixed $el
*/
protected function sortElement(& $el)
protected function sortElement(&$el)
{
if (is_array($el)) {
$this->sortArrayObject($el);

View File

@ -406,7 +406,7 @@ abstract class GroupMembershipResolver
);
}
protected function getDifference(& $left, & $right)
protected function getDifference(&$left, &$right)
{
$diff = array();
@ -476,7 +476,7 @@ abstract class GroupMembershipResolver
* @param IcingaObject[]|int[] $objects
* @return ZfSelect
*/
protected function addMembershipWhere(ZfSelect $query, $column, & $objects)
protected function addMembershipWhere(ZfSelect $query, $column, &$objects)
{
if (empty($objects)) {
return $query;

View File

@ -300,7 +300,7 @@ class IcingaTemplateResolver
return array_keys($list);
}
protected function assertNotInList($id, & $list)
protected function assertNotInList($id, &$list)
{
if (array_key_exists($id, $list)) {
$list = array_keys($list);

View File

@ -299,7 +299,7 @@ class ImportSource extends DbObjectWithSettings implements ExportInterface
return null;
}
public function applyModifiers(& $data)
public function applyModifiers(&$data)
{
$modifiers = $this->fetchFlatRowModifiers();

View File

@ -215,7 +215,7 @@ class TemplateTree
* @param $list
* @throws NestingError
*/
protected function assertNotInList($id, & $list)
protected function assertNotInList($id, &$list)
{
if (array_key_exists($id, $list)) {
$list = array_keys($list);
@ -265,7 +265,7 @@ class TemplateTree
* @return array
* @throws NestingError
*/
public function getAncestorsById($id, & $ancestors = [], $path = [])
public function getAncestorsById($id, &$ancestors = [], $path = [])
{
$path[$id] = true;
foreach ($this->getParentsById($id) as $pid => $name) {
@ -325,7 +325,7 @@ class TemplateTree
}
}
public function getDescendantsById($id, & $children = [], & $path = [])
public function getDescendantsById($id, &$children = [], &$path = [])
{
$path[$id] = true;
foreach ($this->getChildrenById($id) as $pid => $name) {
@ -359,14 +359,14 @@ class TemplateTree
protected function returnFullTree()
{
$result = $this->rootNodes;
foreach ($result as $id => & $node) {
foreach ($result as $id => &$node) {
$this->addChildrenById($id, $node);
}
return $result;
}
protected function addChildrenById($pid, array & $base)
protected function addChildrenById($pid, array &$base)
{
foreach ($this->getChildrenById($pid) as $id => $name) {
$base['children'][$id] = [

View File

@ -286,7 +286,7 @@ abstract class DirectorObjectForm extends DirectorForm
}
// TODO: move to a subform
protected function handleRanges(IcingaObject $object, & $values)
protected function handleRanges(IcingaObject $object, &$values)
{
if (! $object->supportsRanges()) {
return;
@ -369,7 +369,7 @@ abstract class DirectorObjectForm extends DirectorForm
return $this->displayGroups[$group];
}
protected function handleProperties(DbObject $object, & $values)
protected function handleProperties(DbObject $object, &$values)
{
if ($this->hasBeenSent()) {
foreach ($values as $key => $value) {
@ -752,17 +752,17 @@ abstract class DirectorObjectForm extends DirectorForm
return $this->objectName;
}
protected function removeFromSet(& $set, $key)
protected function removeFromSet(&$set, $key)
{
unset($set[$key]);
}
protected function moveUpInSet(& $set, $key)
protected function moveUpInSet(&$set, $key)
{
list($set[$key - 1], $set[$key]) = array($set[$key], $set[$key - 1]);
}
protected function moveDownInSet(& $set, $key)
protected function moveDownInSet(&$set, $key)
{
list($set[$key + 1], $set[$key]) = array($set[$key], $set[$key + 1]);
}

View File

@ -113,7 +113,7 @@ class ExtensibleSetElement extends BaseHtmlElement
return $this;
}
protected function extractZfInfo(& $attribs = null)
protected function extractZfInfo(&$attribs = null)
{
if ($attribs === null) {
return;

View File

@ -8,7 +8,11 @@ PHP_VERSION="$(php -r 'echo phpversion();')"
ICINGAWEB_VERSION=${ICINGAWEB_VERSION:=2.7.1}
ICINGAWEB_GITREF=${ICINGAWEB_GITREF:=}
PHPCS_VERSION=${PHPCS_VERSION:=3.3.2}
if [ "$PHP_VERSION" '<' 7.1.0 ]; then
PHPCS_VERSION=${PHPCS_VERSION:=3.3.2}
else
PHPCS_VERSION=${PHPCS_VERSION:=3.5.2}
fi
if [ "$PHP_VERSION" '<' 5.6.0 ]; then
PHPUNIT_VERSION=${PHPUNIT_VERSION:=4.8}