Skip to content

Commit

Permalink
Fix some static analyzer findings
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed Jan 7, 2019
1 parent 81f9741 commit 3141921
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/midcom/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/baseclasses/core/dbobject.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/db/attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions lib/midcom/db/parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/helper/_dbfactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions lib/midcom/helper/_styleloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/midcom/helper/nav/itemlist/score.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
2 changes: 1 addition & 1 deletion lib/midgard/admin/asgard/handler/welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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 = [];
Expand Down
2 changes: 1 addition & 1 deletion lib/org/openpsa/expenses/handler/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions lib/org/openpsa/expenses/hour/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/org/openpsa/products/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 3141921

Please sign in to comment.