Skip to content

Commit

Permalink
Remove unnecessary array initialization
Browse files Browse the repository at this point in the history
`$a[] = 1` will initialize the array, so the if block is not needed.
  • Loading branch information
dregad committed Mar 15, 2020
1 parent cccbf42 commit 50ff4db
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions core/project_hierarchy_api.php
Expand Up @@ -173,14 +173,7 @@ function project_hierarchy_cache( $p_show_disabled = false ) {
$t_project_id = (int)$t_row['id'];
$t_parent_id = ( null === $t_row['parent_id'] ) ? ALL_PROJECTS : (int)$t_row['parent_id'];

if( isset( $g_cache_project_hierarchy[$t_parent_id] ) ) {
$g_cache_project_hierarchy[$t_parent_id][] = $t_project_id;
} else {
$g_cache_project_hierarchy[$t_parent_id] = array(
$t_project_id,
);
}

$g_cache_project_hierarchy[$t_parent_id][] = $t_project_id;

if( !isset( $g_cache_project_inheritance[$t_project_id] ) ) {
$g_cache_project_inheritance[$t_project_id] = array();
Expand Down

0 comments on commit 50ff4db

Please sign in to comment.