Skip to content

Commit 58e3db7

Browse files
committed
Add whitespace around some operators
1 parent 5e0b04a commit 58e3db7

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

LeanMapperQuery/Entity.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static function queryEntityProperty(LeanMapper\Entity $entity, $field, IQ
5757
throw new MemberAccessException("Cannot access undefined property '$field' in entity " . get_called_class() . '.');
5858
}
5959
if (!$property->hasRelationship()) {
60-
throw new InvalidArgumentException("Property '{$property->getName()}' in entity ". get_called_class() . " has no relationship.");
60+
throw new InvalidArgumentException("Property '{$property->getName()}' in entity " . get_called_class() . " has no relationship.");
6161
}
6262
$class = $property->getType();
6363
$filters = $entity->createImplicitFilters($class, new Caller($entity, $property))->getFilters();
@@ -136,12 +136,12 @@ public static function queryEntityProperty(LeanMapper\Entity $entity, $field, IQ
136136

137137
public function __call($name, array $arguments)
138138
{
139-
if (preg_match('#^('.implode('|', static::$magicMethodsPrefixes).')(.+)$#', $name, $matches)) {
139+
if (preg_match('#^(' . implode('|', static::$magicMethodsPrefixes) . ')(.+)$#', $name, $matches)) {
140140
if (count($arguments) !== 1) {
141141
throw new InvalidMethodCallException(get_called_class() . "::$name expects exactly 1 argument. " . count($arguments) . ' given.');
142142
}
143143
list($query) = $arguments;
144-
if (!$query instanceof IQuery) {
144+
if (! $query instanceof IQuery) {
145145
throw new InvalidArgumentException('Argument 1 passed to ' . get_called_class() . "::$name must implement interface LeanMapperQuery\\IQuery. " . gettype($query) . ' given.');
146146
}
147147
list(, $method, $field) = $matches;

LeanMapperQuery/Query.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ protected function parseStatement($statement, $replacePlaceholders = null)
346346
// properties attached to the end of the statement.
347347
$ch = isset($statement[$i]) ? $statement[$i] : '';
348348
if ($switches['@'] === true) {
349-
if (preg_match('#^'.($firstLetter ? self::$variablePatternFirstLetter : self::$variablePatternOtherLetters).'$#', $ch)) {
349+
if (preg_match('#^' . ($firstLetter ? self::$variablePatternFirstLetter : self::$variablePatternOtherLetters) . '$#', $ch)) {
350350
$propertyName .= $ch;
351351
$firstLetter = false;
352352
} else {
@@ -603,7 +603,7 @@ private function commandWhere($cond) // @phpstan-ignore-line
603603
$operators = ['=', '<>', '!=', '<=>', '<', '<=', '>', '>='];
604604
$variablePattern = self::$variablePatternFirstLetter . self::$variablePatternOtherLetters . '*';
605605
if (count($args) === 2
606-
&& preg_match('#^\s*(@(?:'.$variablePattern.'|\.)*'.$variablePattern.')\s*(|'.implode('|', $operators).')\s*(?:\?\s*)?$#', $args[0], $matches)) {
606+
&& preg_match('#^\s*(@(?:' . $variablePattern . '|\.)*' . $variablePattern . ')\s*(|' . implode('|', $operators) . ')\s*(?:\?\s*)?$#', $args[0], $matches)) {
607607
$replacePlaceholders = true;
608608
$field = &$args[0];
609609
list(, $field, $operator) = $matches;

tests/LeanMapperQuery/Entity.strategy.explicit.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,4 @@ Assert::same([
8787

8888
////////////////
8989
// hasMany: TODO
90+

tests/LeanMapperQuery/Entity.strategy.implicit.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,4 @@ Assert::same([
8787

8888
////////////////
8989
// hasMany: TODO
90+

0 commit comments

Comments
 (0)