1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-04 05:07:36 +02:00

coding style: fixed spaces & use statements order

This commit is contained in:
David Grudl
2017-07-11 12:27:26 +02:00
parent 1278907f39
commit 3b37295e78
61 changed files with 36 additions and 85 deletions

View File

@@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
if (@!include __DIR__ . '/../vendor/autoload.php') { if (@!include __DIR__ . '/../vendor/autoload.php') {

View File

@@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Dibi\Type; use Dibi\Type;

View File

@@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
if (@!include __DIR__ . '/../vendor/autoload.php') { if (@!include __DIR__ . '/../vendor/autoload.php') {

View File

@@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
if (@!include __DIR__ . '/../vendor/autoload.php') { if (@!include __DIR__ . '/../vendor/autoload.php') {

View File

@@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
if (@!include __DIR__ . '/../vendor/autoload.php') { if (@!include __DIR__ . '/../vendor/autoload.php') {

View File

@@ -69,5 +69,4 @@ class DibiExtension22 extends Nette\DI\CompilerExtension
$connection->addSetup([$panel, 'register'], [$connection]); $connection->addSetup([$panel, 'register'], [$connection]);
} }
} }
} }

View File

@@ -149,5 +149,4 @@ class Panel implements Tracy\IBarPanel
</table> </table>
</div>'; </div>';
} }
} }

View File

@@ -50,7 +50,6 @@ class Connection
* - run (bool) => enable profiler? * - run (bool) => enable profiler?
* - file => file to log * - file => file to log
* - substitutes (array) => map of driver specific substitutes (under development) * - substitutes (array) => map of driver specific substitutes (under development)
* @param mixed connection parameters * @param mixed connection parameters
* @param string connection name * @param string connection name
* @throws Exception * @throws Exception
@@ -581,5 +580,4 @@ class Connection
$handler($arg); $handler($arg);
} }
} }
} }

View File

@@ -281,5 +281,4 @@ FROM %SQL', $this->sql, '
} }
return $this->totalCount; return $this->totalCount;
} }
} }

View File

@@ -59,5 +59,4 @@ class DateTime extends \DateTime
{ {
return $this->format('Y-m-d H:i:s.u'); return $this->format('Y-m-d H:i:s.u');
} }
} }

View File

@@ -760,5 +760,4 @@ class FirebirdDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
} }
return $functions; return $functions;
} }
} }

View File

@@ -355,5 +355,4 @@ class MsSqlDriver implements Dibi\Driver, Dibi\ResultDriver
$this->autoFree = FALSE; $this->autoFree = FALSE;
return is_resource($this->resultSet) ? $this->resultSet : NULL; return is_resource($this->resultSet) ? $this->resultSet : NULL;
} }
} }

View File

@@ -205,5 +205,4 @@ class MsSqlReflector implements Dibi\Reflector
} }
return array_values($keys); return array_values($keys);
} }
} }

View File

@@ -126,5 +126,4 @@ class MySqlReflector implements Dibi\Reflector
} }
return array_values($foreignKeys); return array_values($foreignKeys);
} }
} }

View File

@@ -460,5 +460,4 @@ class MySqliDriver implements Dibi\Driver, Dibi\ResultDriver
$this->autoFree = FALSE; $this->autoFree = FALSE;
return $this->resultSet; return $this->resultSet;
} }
} }

View File

@@ -456,5 +456,4 @@ class OdbcDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
{ {
throw new Dibi\NotImplementedException; throw new Dibi\NotImplementedException;
} }
} }

View File

@@ -471,5 +471,4 @@ class OracleDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
{ {
throw new Dibi\NotImplementedException; throw new Dibi\NotImplementedException;
} }
} }

View File

@@ -522,5 +522,4 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver
{ {
return $this->resultSet; return $this->resultSet;
} }
} }

View File

@@ -678,5 +678,4 @@ class PostgreDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
return $fKeys; return $fKeys;
} }
} }

View File

@@ -428,5 +428,4 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver
{ {
$this->connection->createAggregate($name, $rowCallback, $agrCallback, $numArgs); $this->connection->createAggregate($name, $rowCallback, $agrCallback, $numArgs);
} }
} }

View File

@@ -145,5 +145,4 @@ class SqliteReflector implements Dibi\Reflector
} }
return array_values($keys); return array_values($keys);
} }
} }

View File

@@ -382,5 +382,4 @@ class SqlsrvDriver implements Dibi\Driver, Dibi\ResultDriver
$this->autoFree = FALSE; $this->autoFree = FALSE;
return is_resource($this->resultSet) ? $this->resultSet : NULL; return is_resource($this->resultSet) ? $this->resultSet : NULL;
} }
} }

View File

@@ -127,5 +127,4 @@ class SqlsrvReflector implements Dibi\Reflector
{ {
throw new Dibi\NotImplementedException; throw new Dibi\NotImplementedException;
} }
} }

View File

@@ -96,5 +96,4 @@ class Event
\dibi::$totalTime += $this->time; \dibi::$totalTime += $this->time;
return $this; return $this;
} }
} }

View File

@@ -478,5 +478,4 @@ class Fluent implements IDataSource
} }
$this->cursor = &$foo; $this->cursor = &$foo;
} }
} }

View File

@@ -35,7 +35,6 @@ abstract class HashMapBase
{ {
return $this->callback; return $this->callback;
} }
} }
@@ -46,7 +45,6 @@ abstract class HashMapBase
*/ */
final class HashMap extends HashMapBase final class HashMap extends HashMapBase
{ {
public function __set($nm, $val) public function __set($nm, $val)
{ {
if ($nm == '') { if ($nm == '') {
@@ -65,5 +63,4 @@ final class HashMap extends HashMapBase
return $this->$nm = $this->getCallback()($nm); return $this->$nm = $this->getCallback()($nm);
} }
} }
} }

View File

@@ -17,6 +17,7 @@ class Helpers
/** @var array */ /** @var array */
private static $types; private static $types;
/** /**
* Prints out a syntax highlighted version of the SQL command or Result. * Prints out a syntax highlighted version of the SQL command or Result.
* @param string|Result * @param string|Result
@@ -283,5 +284,4 @@ class Helpers
{ {
return $val === FALSE ? NULL : $val; return $val === FALSE ? NULL : $val;
} }
} }

View File

@@ -31,5 +31,4 @@ class Literal
{ {
return $this->value; return $this->value;
} }
} }

View File

@@ -73,5 +73,4 @@ class FileLogger
} }
fclose($handle); fclose($handle);
} }
} }

View File

@@ -89,5 +89,4 @@ class FirePhpLogger
} }
header("X-Wf-dibi-1-1-d$num: |$s|"); header("X-Wf-dibi-1-1-d$num: |$s|");
} }
} }

View File

@@ -130,5 +130,4 @@ class Column
{ {
return $this->info['vendor'][$key] ?? NULL; return $this->info['vendor'][$key] ?? NULL;
} }
} }

View File

@@ -99,5 +99,4 @@ class Database
} }
} }
} }
} }

View File

@@ -46,5 +46,4 @@ class ForeignKey
{ {
return $this->references; return $this->references;
} }
} }

View File

@@ -56,5 +56,4 @@ class Index
{ {
return !empty($this->info['primary']); return !empty($this->info['primary']);
} }
} }

View File

@@ -92,5 +92,4 @@ class Result
} }
} }
} }
} }

View File

@@ -173,5 +173,4 @@ class Table
{ {
throw new Dibi\NotImplementedException; throw new Dibi\NotImplementedException;
} }
} }

View File

@@ -292,7 +292,6 @@ class Result implements IDataSource
if ($x === NULL) { // build leaf if ($x === NULL) { // build leaf
$x = $row; $x = $row;
} }
} while ($row = $this->fetch()); } while ($row = $this->fetch());
unset($x); unset($x);
@@ -365,7 +364,6 @@ class Result implements IDataSource
$x = $row; $x = $row;
} }
} }
} while ($row = $this->fetch()); } while ($row = $this->fetch());
unset($x); unset($x);
@@ -574,5 +572,4 @@ class Result implements IDataSource
{ {
echo Helpers::dump($this); echo Helpers::dump($this);
} }
} }

View File

@@ -99,5 +99,4 @@ class ResultIterator implements \Iterator, \Countable
{ {
return $this->result->getRowCount(); return $this->result->getRowCount();
} }
} }

View File

@@ -15,7 +15,6 @@ namespace Dibi;
*/ */
class Row implements \ArrayAccess, \IteratorAggregate, \Countable class Row implements \ArrayAccess, \IteratorAggregate, \Countable
{ {
public function __construct($arr) public function __construct($arr)
{ {
foreach ($arr as $k => $v) { foreach ($arr as $k => $v) {
@@ -90,5 +89,4 @@ class Row implements \ArrayAccess, \IteratorAggregate, \Countable
{ {
unset($this->$nm); unset($this->$nm);
} }
} }

View File

@@ -133,5 +133,4 @@ trait Strict
$list[''] = NULL; $list[''] = NULL;
} }
} }
} }

View File

@@ -594,5 +594,4 @@ final class Translator
} }
return implode('.', $parts); return implode('.', $parts);
} }
} }

View File

@@ -26,9 +26,9 @@ class Type
TIME = 't', TIME = 't',
TIME_INTERVAL = 'ti'; TIME_INTERVAL = 'ti';
final public function __construct() final public function __construct()
{ {
throw new \LogicException('Cannot instantiate static class ' . __CLASS__); throw new \LogicException('Cannot instantiate static class ' . __CLASS__);
} }
} }

View File

@@ -7,8 +7,6 @@
declare(strict_types=1); declare(strict_types=1);
use Dibi\Type;
/** /**
* This class is static container class for creating DB objects and * This class is static container class for creating DB objects and
@@ -364,5 +362,4 @@ class dibi
{ {
return Dibi\Helpers::dump($sql, $return); return Dibi\Helpers::dump($sql, $return);
} }
} }

View File

@@ -40,7 +40,6 @@ class Exception extends \Exception
{ {
return parent::__toString() . ($this->sql ? "\nSQL: " . $this->sql : ''); return parent::__toString() . ($this->sql ? "\nSQL: " . $this->sql : '');
} }
} }
@@ -57,7 +56,6 @@ class DriverException extends Exception
*/ */
class PcreException extends Exception class PcreException extends Exception
{ {
public function __construct(string $message = '%msg.') public function __construct(string $message = '%msg.')
{ {
static $messages = [ static $messages = [
@@ -109,7 +107,6 @@ class ProcedureException extends Exception
{ {
$this->severity; $this->severity;
} }
} }

View File

@@ -113,7 +113,6 @@ interface Driver
* Injects LIMIT/OFFSET to the SQL query. * Injects LIMIT/OFFSET to the SQL query.
*/ */
function applyLimit(string &$sql, ?int $limit, ?int $offset): void; function applyLimit(string &$sql, ?int $limit, ?int $offset): void;
} }
@@ -164,7 +163,6 @@ interface ResultDriver
* Decodes data from result set. * Decodes data from result set.
*/ */
function unescapeBinary(string $value): string; function unescapeBinary(string $value): string;
} }
@@ -196,5 +194,4 @@ interface Reflector
* Returns metadata for all foreign keys in a table. * Returns metadata for all foreign keys in a table.
*/ */
function getForeignKeys(string $table): array; function getForeignKeys(string $table): array;
} }

View File

@@ -6,8 +6,8 @@
declare(strict_types=1); declare(strict_types=1);
use Tester\Assert;
use Dibi\Connection; use Dibi\Connection;
use Tester\Assert;
require __DIR__ . '/bootstrap.php'; require __DIR__ . '/bootstrap.php';

View File

@@ -6,8 +6,8 @@
declare(strict_types=1); declare(strict_types=1);
use Tester\Assert;
use Dibi\Row; use Dibi\Row;
use Tester\Assert;
require __DIR__ . '/bootstrap.php'; require __DIR__ . '/bootstrap.php';
@@ -63,8 +63,8 @@ Assert::equal([
// more complex association array // more complex association array
function query($conn) { function query($conn)
{
return $conn->query(in_array($conn->getConfig('system'), ['odbc', 'sqlsrv']) ? ' return $conn->query(in_array($conn->getConfig('system'), ['odbc', 'sqlsrv']) ? '
SELECT products.title, customers.name, orders.amount SELECT products.title, customers.name, orders.amount
FROM ([products] FROM ([products]

View File

@@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Tester\Assert; use Tester\Assert;

View File

@@ -1,9 +1,8 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Tester\Assert;
use Dibi\Row; use Dibi\Row;
use Tester\Assert;
require __DIR__ . '/bootstrap.php'; require __DIR__ . '/bootstrap.php';

View File

@@ -1,9 +1,8 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Tester\Assert;
use Dibi\Fluent; use Dibi\Fluent;
use Tester\Assert;
require __DIR__ . '/bootstrap.php'; require __DIR__ . '/bootstrap.php';

View File

@@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Tester\Assert; use Tester\Assert;

View File

@@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Tester\Assert; use Tester\Assert;
@@ -10,21 +9,27 @@ require __DIR__ . '/bootstrap.php';
class MockDriver extends Dibi\Drivers\SqlsrvDriver class MockDriver extends Dibi\Drivers\SqlsrvDriver
{ {
function __construct() function __construct()
{} {
}
function connect(array & $config): void function connect(array & $config): void
{} {
}
function query(string $sql): ?Dibi\ResultDriver function query(string $sql): ?Dibi\ResultDriver
{ {
return $this; return $this;
} }
function getResultColumns(): array function getResultColumns(): array
{ {
return []; return [];
} }
function fetch(bool $type): ?array function fetch(bool $type): ?array
{ {
return NULL; return NULL;

View File

@@ -6,8 +6,8 @@
declare(strict_types=1); declare(strict_types=1);
use Tester\Assert;
use Dibi\Row; use Dibi\Row;
use Tester\Assert;
require __DIR__ . '/bootstrap.php'; require __DIR__ . '/bootstrap.php';

View File

@@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Tester\Assert; use Tester\Assert;

View File

@@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Tester\Assert; use Tester\Assert;

View File

@@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Dibi\Helpers; use Dibi\Helpers;

View File

@@ -1,9 +1,8 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Tester\Assert;
use Dibi\Type; use Dibi\Type;
use Tester\Assert;
require __DIR__ . '/bootstrap.php'; require __DIR__ . '/bootstrap.php';
@@ -11,7 +10,9 @@ require __DIR__ . '/bootstrap.php';
class MockResult extends Dibi\Result class MockResult extends Dibi\Result
{ {
function __construct() function __construct()
{} {
}
function test($row) function test($row)
{ {

View File

@@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Tester\Assert; use Tester\Assert;

View File

@@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Tester\Assert; use Tester\Assert;
@@ -17,23 +16,33 @@ class TestClass
public static $publicStatic; public static $publicStatic;
public function publicMethod() public function publicMethod()
{} {
}
public static function publicMethodStatic() public static function publicMethodStatic()
{} {
}
protected function protectedMethod() protected function protectedMethod()
{} {
}
protected static function protectedMethodS() protected static function protectedMethodS()
{} {
}
public function getBar() public function getBar()
{ {
return 123; return 123;
} }
public function isFoo() public function isFoo()
{ {
return 456; return 456;

View File

@@ -6,8 +6,8 @@
declare(strict_types=1); declare(strict_types=1);
use Tester\Assert;
use Dibi\DateTime; use Dibi\DateTime;
use Tester\Assert;
require __DIR__ . '/bootstrap.php'; require __DIR__ . '/bootstrap.php';

View File

@@ -1,5 +1,4 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
// The Nette Tester command-line runner can be // The Nette Tester command-line runner can be