Skip to content

Some bugfixes and PHPDoc improvements#301

Closed
mkkeck wants to merge 1 commit intoj4mie:developfrom
mkkeck:develop
Closed

Some bugfixes and PHPDoc improvements#301
mkkeck wants to merge 1 commit intoj4mie:developfrom
mkkeck:develop

Conversation

@mkkeck
Copy link
Copy Markdown
Contributor

@mkkeck mkkeck commented May 11, 2016

PHPDoc improvements

Undefined variable '$value' (see line #1470):

 public function having_id_is($id) {
  return (is_array($this->_get_id_column_name())) ?
    $this->having($this->_get_compound_id_column_values($value)) :
    $this->having($this->_get_id_column_name(), $id);
  }

Correct

public function having_id_is($id) {
  return (is_array($this->_get_id_column_name())) ?
    $this->having($this->_get_compound_id_column_values($id)) :
    $this->having($this->_get_id_column_name(), $id);
  }

In most cases using the same variable as a key or value both by the onner and outer 'foreach' loop either is an error or may result in an error in future (see line #1254):

  public function where_any_is($values, $operator='=') {
    $data = array();
    $query = array("((");
    $first = true;
    foreach ($values as $item) {
      if ($first) {
        $first = false;
      } else {
        $query[] = ") OR (";
      }
      $firstsub = true;
      foreach($item as $key => $item) {
        $op = is_string($operator) ? $operator : (isset($operator[$key]) ? $operator[$key] : '=');
        if ($firstsub) {
          $firstsub = false;
        } else {
          $query[] = "AND";
        }
        $query[] = $this->_quote_identifier($key);
        $data[] = $item;
        $query[] = $op . " ?";
      }
    }
    $query[] = "))";
    return $this->where_raw(join($query, ' '), $data);
  }

Correct

  public function where_any_is($values, $operator='=') {
    $data = array();
    $query = array("((");
    $first = true;
    foreach ($values as $value) {
      if ($first) {
        $first = false;
      } else {
        $query[] = ") OR (";
      }
      $firstsub = true;
      foreach($value as $key => $item) {
        $op = is_string($operator) ? $operator : (isset($operator[$key]) ? $operator[$key] : '=');
        if ($firstsub) {
          $firstsub = false;
        } else {
          $query[] = "AND";
        }
        $query[] = $this->_quote_identifier($key);
        $data[] = $item;
        $query[] = $op . " ?";
      }
    }
    $query[] = "))";
    return $this->where_raw(join($query, ' '), $data);
  }

Undefined variable '$value' (see line #1470):
```php
 public function having_id_is($id) {
  return (is_array($this->_get_id_column_name())) ?
    $this->having($this->_get_compound_id_column_values($value)) :
    $this->having($this->_get_id_column_name(), $id);
  }
```
Correct
```php
public function having_id_is($id) {
  return (is_array($this->_get_id_column_name())) ?
    $this->having($this->_get_compound_id_column_values($id)) :
    $this->having($this->_get_id_column_name(), $id);
  }
```
In most cases using the same variable as a key or value both by the onner and outer 'foreach' loop either is an error or may result in an error in future (see line #1254):
```php
  public function where_any_is($values, $operator='=') {
    $data = array();
    $query = array("((");
    $first = true;
    foreach ($values as $item) {
      if ($first) {
        $first = false;
      } else {
        $query[] = ") OR (";
      }
      $firstsub = true;
@treffynnon
Copy link
Copy Markdown
Collaborator

Thank you for the pull request. Unfortunately this will not be merged.

@treffynnon treffynnon closed this Dec 14, 2016
Repository owner locked and limited conversation to collaborators Dec 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants