Skip to content
Permalink
Browse files

Tests that callable is not a string

  • Loading branch information...
Walther Lalk
Walther Lalk committed Jul 22, 2014
1 parent 7b0db0b commit 130ad7e9b7118cd6d5227efee6d3ec6a0b071d6b
@@ -293,7 +293,7 @@ public function notIn($field, $values, $type = null) {
* @return \Cake\Database\Expression\QueryExpression
*/
public function and_($conditions, $types = []) {
if (is_callable($conditions)) {
if (!is_string($conditions) && is_callable($conditions)) {
return $conditions(new self([], $this->typeMap()->types($types)));
}
return new self($conditions, $this->typeMap()->types($types));
@@ -309,7 +309,7 @@ public function and_($conditions, $types = []) {
* @return \Cake\Database\Expression\QueryExpression
*/
public function or_($conditions, $types = []) {
if (is_callable($conditions)) {
if (!is_string($conditions) && is_callable($conditions)) {
return $conditions(new self([], $this->typeMap()->types($types), 'OR'));
}
return new self($conditions, $this->typeMap()->types($types), 'OR');
@@ -245,7 +245,7 @@ public function traverse(callable $visitor, array $parts = []) {
* @return $this
*/
public function select($fields = [], $overwrite = false) {
if (is_callable($fields)) {
if (!is_string($fields) && is_callable($fields)) {
$fields = $fields($this);
}
@@ -486,7 +486,7 @@ public function join($tables = null, $types = [], $overwrite = false) {
$t = ['table' => $t, 'conditions' => $this->newExpr()];
}
if (is_callable($t['conditions'])) {
if (!is_string($t['conditions']) && is_callable($t['conditions'])) {
$t['conditions'] = $t['conditions']($this->newExpr(), $this);
}
@@ -1557,7 +1557,7 @@ protected function _decorateStatement($statement) {
protected function _conjugate($part, $append, $conjunction, $types) {
$expression = $this->_parts[$part] ?: $this->newExpr();
if (is_callable($append)) {
if (!is_string($append) && is_callable($append)) {
$append = $append($this->newExpr(), $this);
}
@@ -159,7 +159,7 @@ protected function _processAssociation(Event $event, Entity $entity, Association
$config = [];
}
if (is_callable($config)) {
if (!is_string($config) && is_callable($config)) {
$count = $config($event, $entity, $this->_table);
} else {
$count = $this->_getCount($config, $countConditions);
@@ -155,7 +155,7 @@ public function process($value, array $providers, array $context = []) {
* @return bool True if the ValidationRule should be skipped
*/
protected function _skip($context) {
if (is_callable($this->_on)) {
if (!is_string($this->_on) && is_callable($this->_on)) {
$function = $this->_on;
return !$function($context);
}

0 comments on commit 130ad7e

Please sign in to comment.
You can’t perform that action at this time.