Permalink
Browse files

Fix some static analyzer findings

  • Loading branch information...
flack committed Jan 7, 2019
1 parent 81f9741 commit 3141921c2d9272c15783fd9fc3d7546d6ef5323b
@@ -350,8 +350,8 @@ public function finish()
* If the parsing process doesn't find any component that declares to be able to
* handle the request, an HTTP 404 - Not Found error is triggered.
*
* @param Request $request The request object
* @param midcom_core_context $context
* @param Request $request The request object
* @return midcom_response
*/
private function _process(midcom_core_context $context, Request $request)
@@ -724,7 +724,7 @@ public static function get_by_guid(midcom_core_dbaobject $object, $guid)
debug_add("Failed to load object, read privilege on the " . get_class($object) . " {$guid} not granted for the current user.", MIDCOM_LOG_ERROR);
return false;
}
$object->__object->get_by_guid((string) $guid);
$object->__object->get_by_guid($guid);
if ($object->id != 0) {
$object->_on_loaded();
@@ -47,7 +47,7 @@ public function get_parent_guid_uncached()
/**
* @return string Parent GUID
*/
public static function get_parent_guid_uncached_static($guid, $classname = __CLASS__)
public static function get_parent_guid_uncached_static($guid)
{
$mc = new midgard_collector('midgard_attachment', 'guid', $guid);
$mc->set_key_property('parentguid');
@@ -33,9 +33,9 @@ public function get_parent_guid_uncached()
/**
* Returns the Parent of the Parameter.
*
* @return string Parent GUID or null if there is none.
* @return string Parent GUID
*/
public static function get_parent_guid_uncached_static($guid, $classname = __CLASS__)
public static function get_parent_guid_uncached_static($guid)
{
$mc = new midgard_collector('midgard_parameter', 'guid', $guid);
$mc->set_key_property('parentguid');
@@ -352,7 +352,7 @@ private function _get_parent_guid_uncached(midcom_core_dbaobject $object)
private function _get_parent_guid_uncached_static($object_guid, $class_name)
{
if (method_exists($class_name, 'get_parent_guid_uncached_static')) {
return ['', call_user_func([$class_name, 'get_parent_guid_uncached_static'], $object_guid, $class_name)];
return ['', $class_name::get_parent_guid_uncached_static($object_guid)];
}
$class_name = midcom::get()->dbclassloader->get_mgdschema_class_name_for_midcom_class($class_name);
@@ -534,7 +534,7 @@ private function _get_component_snippetdir()
* the end of the styledir queue.
*
* @param string $dirname path of style directory within midcom.
* @throws midcom exception if directory does not exist.
* @throws midcom_error exception if directory does not exist.
*/
function append_styledir($dirname)
{
@@ -564,7 +564,7 @@ function prepend_styledir($dirname)
* Append the styledir of a component to the queue of styledirs.
*
* @param string $component Component name
* @throws midcom exception if directory does not exist.
* @throws midcom_error exception if directory does not exist.
*/
function append_component_styledir($component)
{
@@ -36,6 +36,6 @@ public function get_sorted_list()
*/
private function sort_cmp($a, $b)
{
return (integer) (($a[MIDCOM_NAV_SCORE] < $b[MIDCOM_NAV_SCORE]) ? 1 : -1);
return (($a[MIDCOM_NAV_SCORE] < $b[MIDCOM_NAV_SCORE]) ? 1 : -1);
}
}
@@ -98,7 +98,7 @@ public function _handler_welcome(Request $request, array &$data)
} elseif (class_exists('midcom_helper_activitystream_activity_dba')) {
$objects = $this->_load_activities();
} else {
$data['revised_after'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')));
$data['revised_after'] = date('Y-m-d', strtotime('yesterday'));
$objects = $this->_list_revised($data['revised_after']);
}
@@ -1,11 +1,8 @@
<?php
$label = $data['label_property'];
echo "<h2>";
printf($data['l10n']->get('%s trash'), midgard_admin_asgard_plugin::get_type_label($data['type']));
echo "</h2>";
$shown = [];
function midgard_admin_asgard_trash_type_show($object, $indent = 0, $prefix = '', $enable_undelete = true)
{
static $shown = [];
@@ -16,7 +16,7 @@ class org_openpsa_expenses_handler_index extends midcom_baseclasses_components_h
use org_openpsa_expenses_handler;
/**
* @param array $args The argument list.
* @param string $requested_time
* @param array &$data The local request data.
*/
private function prepare_dates($requested_time, array &$data)
@@ -28,8 +28,6 @@ class org_openpsa_expenses_hour_report_dba extends midcom_core_dbaobject
private function _prepare_save()
{
//Make sure our hours property is a float
$this->hours = (float) $this->hours;
$this->hours = round($this->hours, 2);
//Make sure date is set
@@ -90,7 +90,7 @@ public function validate_code($code)
$qb->add_constraint('id', '<>', $this->id);
}
// Make sure the product is in the same product group
$qb->add_constraint('productGroup', '=', (int)$this->productGroup);
$qb->add_constraint('productGroup', '=', $this->productGroup);
return ($qb->count() == 0);
}

0 comments on commit 3141921

Please sign in to comment.