Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some bugfixes and PHPDoc improvements #301

Closed
wants to merge 1 commit into from
Closed

Some bugfixes and PHPDoc improvements #301

wants to merge 1 commit into from

Conversation

mkkeck
Copy link
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
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.

None yet

2 participants