From 3b37295e78bfa90616bb25f27f72bcb21a199706 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 11 Jul 2017 12:27:26 +0200 Subject: [PATCH] coding style: fixed spaces & use statements order --- examples/fetching-examples.php | 1 - examples/result-set-data-types.php | 1 - examples/tracy-and-exceptions.php | 1 - examples/tracy.php | 1 - examples/using-extension-methods.php | 1 - src/Dibi/Bridges/Nette/DibiExtension22.php | 1 - src/Dibi/Bridges/Tracy/Panel.php | 1 - src/Dibi/Connection.php | 2 -- src/Dibi/DataSource.php | 1 - src/Dibi/DateTime.php | 1 - src/Dibi/Drivers/FirebirdDriver.php | 1 - src/Dibi/Drivers/MsSqlDriver.php | 1 - src/Dibi/Drivers/MsSqlReflector.php | 1 - src/Dibi/Drivers/MySqlReflector.php | 1 - src/Dibi/Drivers/MySqliDriver.php | 1 - src/Dibi/Drivers/OdbcDriver.php | 1 - src/Dibi/Drivers/OracleDriver.php | 1 - src/Dibi/Drivers/PdoDriver.php | 1 - src/Dibi/Drivers/PostgreDriver.php | 1 - src/Dibi/Drivers/Sqlite3Driver.php | 1 - src/Dibi/Drivers/SqliteReflector.php | 1 - src/Dibi/Drivers/SqlsrvDriver.php | 1 - src/Dibi/Drivers/SqlsrvReflector.php | 1 - src/Dibi/Event.php | 1 - src/Dibi/Fluent.php | 1 - src/Dibi/HashMap.php | 3 --- src/Dibi/Helpers.php | 2 +- src/Dibi/Literal.php | 1 - src/Dibi/Loggers/FileLogger.php | 1 - src/Dibi/Loggers/FirePhpLogger.php | 1 - src/Dibi/Reflection/Column.php | 1 - src/Dibi/Reflection/Database.php | 1 - src/Dibi/Reflection/ForeignKey.php | 1 - src/Dibi/Reflection/Index.php | 1 - src/Dibi/Reflection/Result.php | 1 - src/Dibi/Reflection/Table.php | 1 - src/Dibi/Result.php | 3 --- src/Dibi/ResultIterator.php | 1 - src/Dibi/Row.php | 2 -- src/Dibi/Strict.php | 1 - src/Dibi/Translator.php | 1 - src/Dibi/Type.php | 2 +- src/Dibi/dibi.php | 3 --- src/Dibi/exceptions.php | 3 --- src/Dibi/interfaces.php | 3 --- tests/dibi/Connection.connect.phpt | 2 +- tests/dibi/Connection.fetch.phpt | 6 +++--- tests/dibi/Connection.substitutions.phpt | 1 - tests/dibi/DataSource.phpt | 3 +-- tests/dibi/Fluent.cloning.phpt | 3 +-- tests/dibi/Fluent.delete.phpt | 1 - tests/dibi/Fluent.fetch.limit.mssql.phpt | 11 ++++++++--- tests/dibi/Fluent.fetch.phpt | 2 +- tests/dibi/Fluent.insert.phpt | 1 - tests/dibi/Fluent.update.phpt | 1 - tests/dibi/Helpers.getSuggestion().phpt | 1 - tests/dibi/Result.normalize.phpt | 7 ++++--- tests/dibi/Result.types.phpt | 1 - tests/dibi/Strict.phpt | 19 ++++++++++++++----- tests/dibi/Translator.phpt | 2 +- tests/dibi/bootstrap.php | 1 - 61 files changed, 36 insertions(+), 85 deletions(-) diff --git a/examples/fetching-examples.php b/examples/fetching-examples.php index 753738d0..582484f7 100644 --- a/examples/fetching-examples.php +++ b/examples/fetching-examples.php @@ -1,5 +1,4 @@ addSetup([$panel, 'register'], [$connection]); } } - } diff --git a/src/Dibi/Bridges/Tracy/Panel.php b/src/Dibi/Bridges/Tracy/Panel.php index 1f10c05a..760c6d45 100644 --- a/src/Dibi/Bridges/Tracy/Panel.php +++ b/src/Dibi/Bridges/Tracy/Panel.php @@ -149,5 +149,4 @@ class Panel implements Tracy\IBarPanel '; } - } diff --git a/src/Dibi/Connection.php b/src/Dibi/Connection.php index 87f11b77..f22ed123 100644 --- a/src/Dibi/Connection.php +++ b/src/Dibi/Connection.php @@ -50,7 +50,6 @@ class Connection * - run (bool) => enable profiler? * - file => file to log * - substitutes (array) => map of driver specific substitutes (under development) - * @param mixed connection parameters * @param string connection name * @throws Exception @@ -581,5 +580,4 @@ class Connection $handler($arg); } } - } diff --git a/src/Dibi/DataSource.php b/src/Dibi/DataSource.php index 418a4acb..3872d975 100644 --- a/src/Dibi/DataSource.php +++ b/src/Dibi/DataSource.php @@ -281,5 +281,4 @@ FROM %SQL', $this->sql, ' } return $this->totalCount; } - } diff --git a/src/Dibi/DateTime.php b/src/Dibi/DateTime.php index 2b26341d..e639f8b9 100644 --- a/src/Dibi/DateTime.php +++ b/src/Dibi/DateTime.php @@ -59,5 +59,4 @@ class DateTime extends \DateTime { return $this->format('Y-m-d H:i:s.u'); } - } diff --git a/src/Dibi/Drivers/FirebirdDriver.php b/src/Dibi/Drivers/FirebirdDriver.php index 1375727f..19c0c7f2 100644 --- a/src/Dibi/Drivers/FirebirdDriver.php +++ b/src/Dibi/Drivers/FirebirdDriver.php @@ -760,5 +760,4 @@ class FirebirdDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector } return $functions; } - } diff --git a/src/Dibi/Drivers/MsSqlDriver.php b/src/Dibi/Drivers/MsSqlDriver.php index dfe4cf5d..f59ecdaa 100644 --- a/src/Dibi/Drivers/MsSqlDriver.php +++ b/src/Dibi/Drivers/MsSqlDriver.php @@ -355,5 +355,4 @@ class MsSqlDriver implements Dibi\Driver, Dibi\ResultDriver $this->autoFree = FALSE; return is_resource($this->resultSet) ? $this->resultSet : NULL; } - } diff --git a/src/Dibi/Drivers/MsSqlReflector.php b/src/Dibi/Drivers/MsSqlReflector.php index 71576bfb..c7dc1618 100644 --- a/src/Dibi/Drivers/MsSqlReflector.php +++ b/src/Dibi/Drivers/MsSqlReflector.php @@ -205,5 +205,4 @@ class MsSqlReflector implements Dibi\Reflector } return array_values($keys); } - } diff --git a/src/Dibi/Drivers/MySqlReflector.php b/src/Dibi/Drivers/MySqlReflector.php index c5b73198..78a7adf5 100644 --- a/src/Dibi/Drivers/MySqlReflector.php +++ b/src/Dibi/Drivers/MySqlReflector.php @@ -126,5 +126,4 @@ class MySqlReflector implements Dibi\Reflector } return array_values($foreignKeys); } - } diff --git a/src/Dibi/Drivers/MySqliDriver.php b/src/Dibi/Drivers/MySqliDriver.php index e261b790..3e6545a1 100644 --- a/src/Dibi/Drivers/MySqliDriver.php +++ b/src/Dibi/Drivers/MySqliDriver.php @@ -460,5 +460,4 @@ class MySqliDriver implements Dibi\Driver, Dibi\ResultDriver $this->autoFree = FALSE; return $this->resultSet; } - } diff --git a/src/Dibi/Drivers/OdbcDriver.php b/src/Dibi/Drivers/OdbcDriver.php index 2e0141b3..dbc73928 100644 --- a/src/Dibi/Drivers/OdbcDriver.php +++ b/src/Dibi/Drivers/OdbcDriver.php @@ -456,5 +456,4 @@ class OdbcDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector { throw new Dibi\NotImplementedException; } - } diff --git a/src/Dibi/Drivers/OracleDriver.php b/src/Dibi/Drivers/OracleDriver.php index ffe42879..7bfbab3a 100644 --- a/src/Dibi/Drivers/OracleDriver.php +++ b/src/Dibi/Drivers/OracleDriver.php @@ -471,5 +471,4 @@ class OracleDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector { throw new Dibi\NotImplementedException; } - } diff --git a/src/Dibi/Drivers/PdoDriver.php b/src/Dibi/Drivers/PdoDriver.php index a4892550..d60dca0f 100644 --- a/src/Dibi/Drivers/PdoDriver.php +++ b/src/Dibi/Drivers/PdoDriver.php @@ -522,5 +522,4 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver { return $this->resultSet; } - } diff --git a/src/Dibi/Drivers/PostgreDriver.php b/src/Dibi/Drivers/PostgreDriver.php index ac8fe54f..088cc2fb 100644 --- a/src/Dibi/Drivers/PostgreDriver.php +++ b/src/Dibi/Drivers/PostgreDriver.php @@ -678,5 +678,4 @@ class PostgreDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector return $fKeys; } - } diff --git a/src/Dibi/Drivers/Sqlite3Driver.php b/src/Dibi/Drivers/Sqlite3Driver.php index 573a0a72..fc0461d6 100644 --- a/src/Dibi/Drivers/Sqlite3Driver.php +++ b/src/Dibi/Drivers/Sqlite3Driver.php @@ -428,5 +428,4 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver { $this->connection->createAggregate($name, $rowCallback, $agrCallback, $numArgs); } - } diff --git a/src/Dibi/Drivers/SqliteReflector.php b/src/Dibi/Drivers/SqliteReflector.php index 6072a562..dd8e37d7 100644 --- a/src/Dibi/Drivers/SqliteReflector.php +++ b/src/Dibi/Drivers/SqliteReflector.php @@ -145,5 +145,4 @@ class SqliteReflector implements Dibi\Reflector } return array_values($keys); } - } diff --git a/src/Dibi/Drivers/SqlsrvDriver.php b/src/Dibi/Drivers/SqlsrvDriver.php index eb11418f..b536da11 100644 --- a/src/Dibi/Drivers/SqlsrvDriver.php +++ b/src/Dibi/Drivers/SqlsrvDriver.php @@ -382,5 +382,4 @@ class SqlsrvDriver implements Dibi\Driver, Dibi\ResultDriver $this->autoFree = FALSE; return is_resource($this->resultSet) ? $this->resultSet : NULL; } - } diff --git a/src/Dibi/Drivers/SqlsrvReflector.php b/src/Dibi/Drivers/SqlsrvReflector.php index 7893de72..ac83b130 100644 --- a/src/Dibi/Drivers/SqlsrvReflector.php +++ b/src/Dibi/Drivers/SqlsrvReflector.php @@ -127,5 +127,4 @@ class SqlsrvReflector implements Dibi\Reflector { throw new Dibi\NotImplementedException; } - } diff --git a/src/Dibi/Event.php b/src/Dibi/Event.php index 8bedca6c..13111cac 100644 --- a/src/Dibi/Event.php +++ b/src/Dibi/Event.php @@ -96,5 +96,4 @@ class Event \dibi::$totalTime += $this->time; return $this; } - } diff --git a/src/Dibi/Fluent.php b/src/Dibi/Fluent.php index f5e4cce8..0c0ba67b 100644 --- a/src/Dibi/Fluent.php +++ b/src/Dibi/Fluent.php @@ -478,5 +478,4 @@ class Fluent implements IDataSource } $this->cursor = &$foo; } - } diff --git a/src/Dibi/HashMap.php b/src/Dibi/HashMap.php index f7607d82..eef445f1 100644 --- a/src/Dibi/HashMap.php +++ b/src/Dibi/HashMap.php @@ -35,7 +35,6 @@ abstract class HashMapBase { return $this->callback; } - } @@ -46,7 +45,6 @@ abstract class HashMapBase */ final class HashMap extends HashMapBase { - public function __set($nm, $val) { if ($nm == '') { @@ -65,5 +63,4 @@ final class HashMap extends HashMapBase return $this->$nm = $this->getCallback()($nm); } } - } diff --git a/src/Dibi/Helpers.php b/src/Dibi/Helpers.php index cb081199..539b769b 100644 --- a/src/Dibi/Helpers.php +++ b/src/Dibi/Helpers.php @@ -17,6 +17,7 @@ class Helpers /** @var array */ private static $types; + /** * Prints out a syntax highlighted version of the SQL command or Result. * @param string|Result @@ -283,5 +284,4 @@ class Helpers { return $val === FALSE ? NULL : $val; } - } diff --git a/src/Dibi/Literal.php b/src/Dibi/Literal.php index ba7844fc..3c7817e9 100644 --- a/src/Dibi/Literal.php +++ b/src/Dibi/Literal.php @@ -31,5 +31,4 @@ class Literal { return $this->value; } - } diff --git a/src/Dibi/Loggers/FileLogger.php b/src/Dibi/Loggers/FileLogger.php index 3f70f9b8..cdb50f0e 100644 --- a/src/Dibi/Loggers/FileLogger.php +++ b/src/Dibi/Loggers/FileLogger.php @@ -73,5 +73,4 @@ class FileLogger } fclose($handle); } - } diff --git a/src/Dibi/Loggers/FirePhpLogger.php b/src/Dibi/Loggers/FirePhpLogger.php index 48c9c64c..02ed083a 100644 --- a/src/Dibi/Loggers/FirePhpLogger.php +++ b/src/Dibi/Loggers/FirePhpLogger.php @@ -89,5 +89,4 @@ class FirePhpLogger } header("X-Wf-dibi-1-1-d$num: |$s|"); } - } diff --git a/src/Dibi/Reflection/Column.php b/src/Dibi/Reflection/Column.php index 2213b49a..29e7a935 100644 --- a/src/Dibi/Reflection/Column.php +++ b/src/Dibi/Reflection/Column.php @@ -130,5 +130,4 @@ class Column { return $this->info['vendor'][$key] ?? NULL; } - } diff --git a/src/Dibi/Reflection/Database.php b/src/Dibi/Reflection/Database.php index be7f6821..83422411 100644 --- a/src/Dibi/Reflection/Database.php +++ b/src/Dibi/Reflection/Database.php @@ -99,5 +99,4 @@ class Database } } } - } diff --git a/src/Dibi/Reflection/ForeignKey.php b/src/Dibi/Reflection/ForeignKey.php index ad267d2c..71b49d18 100644 --- a/src/Dibi/Reflection/ForeignKey.php +++ b/src/Dibi/Reflection/ForeignKey.php @@ -46,5 +46,4 @@ class ForeignKey { return $this->references; } - } diff --git a/src/Dibi/Reflection/Index.php b/src/Dibi/Reflection/Index.php index ac98acfe..84509769 100644 --- a/src/Dibi/Reflection/Index.php +++ b/src/Dibi/Reflection/Index.php @@ -56,5 +56,4 @@ class Index { return !empty($this->info['primary']); } - } diff --git a/src/Dibi/Reflection/Result.php b/src/Dibi/Reflection/Result.php index 44e90629..f7ca85b5 100644 --- a/src/Dibi/Reflection/Result.php +++ b/src/Dibi/Reflection/Result.php @@ -92,5 +92,4 @@ class Result } } } - } diff --git a/src/Dibi/Reflection/Table.php b/src/Dibi/Reflection/Table.php index 5456a5c9..e0cea327 100644 --- a/src/Dibi/Reflection/Table.php +++ b/src/Dibi/Reflection/Table.php @@ -173,5 +173,4 @@ class Table { throw new Dibi\NotImplementedException; } - } diff --git a/src/Dibi/Result.php b/src/Dibi/Result.php index 8214879a..b7732368 100644 --- a/src/Dibi/Result.php +++ b/src/Dibi/Result.php @@ -292,7 +292,6 @@ class Result implements IDataSource if ($x === NULL) { // build leaf $x = $row; } - } while ($row = $this->fetch()); unset($x); @@ -365,7 +364,6 @@ class Result implements IDataSource $x = $row; } } - } while ($row = $this->fetch()); unset($x); @@ -574,5 +572,4 @@ class Result implements IDataSource { echo Helpers::dump($this); } - } diff --git a/src/Dibi/ResultIterator.php b/src/Dibi/ResultIterator.php index cfc5c90a..80810cfd 100644 --- a/src/Dibi/ResultIterator.php +++ b/src/Dibi/ResultIterator.php @@ -99,5 +99,4 @@ class ResultIterator implements \Iterator, \Countable { return $this->result->getRowCount(); } - } diff --git a/src/Dibi/Row.php b/src/Dibi/Row.php index 881daf7b..fbff6b5e 100644 --- a/src/Dibi/Row.php +++ b/src/Dibi/Row.php @@ -15,7 +15,6 @@ namespace Dibi; */ class Row implements \ArrayAccess, \IteratorAggregate, \Countable { - public function __construct($arr) { foreach ($arr as $k => $v) { @@ -90,5 +89,4 @@ class Row implements \ArrayAccess, \IteratorAggregate, \Countable { unset($this->$nm); } - } diff --git a/src/Dibi/Strict.php b/src/Dibi/Strict.php index 34db31ec..05b1cd6b 100644 --- a/src/Dibi/Strict.php +++ b/src/Dibi/Strict.php @@ -133,5 +133,4 @@ trait Strict $list[''] = NULL; } } - } diff --git a/src/Dibi/Translator.php b/src/Dibi/Translator.php index 95565548..0aee2efd 100644 --- a/src/Dibi/Translator.php +++ b/src/Dibi/Translator.php @@ -594,5 +594,4 @@ final class Translator } return implode('.', $parts); } - } diff --git a/src/Dibi/Type.php b/src/Dibi/Type.php index a2cc9a07..a305f58f 100644 --- a/src/Dibi/Type.php +++ b/src/Dibi/Type.php @@ -26,9 +26,9 @@ class Type TIME = 't', TIME_INTERVAL = 'ti'; + final public function __construct() { throw new \LogicException('Cannot instantiate static class ' . __CLASS__); } - } diff --git a/src/Dibi/dibi.php b/src/Dibi/dibi.php index 2fab42f8..d38271d5 100644 --- a/src/Dibi/dibi.php +++ b/src/Dibi/dibi.php @@ -7,8 +7,6 @@ declare(strict_types=1); -use Dibi\Type; - /** * This class is static container class for creating DB objects and @@ -364,5 +362,4 @@ class dibi { return Dibi\Helpers::dump($sql, $return); } - } diff --git a/src/Dibi/exceptions.php b/src/Dibi/exceptions.php index b9a7b686..4ad6644d 100644 --- a/src/Dibi/exceptions.php +++ b/src/Dibi/exceptions.php @@ -40,7 +40,6 @@ class Exception extends \Exception { return parent::__toString() . ($this->sql ? "\nSQL: " . $this->sql : ''); } - } @@ -57,7 +56,6 @@ class DriverException extends Exception */ class PcreException extends Exception { - public function __construct(string $message = '%msg.') { static $messages = [ @@ -109,7 +107,6 @@ class ProcedureException extends Exception { $this->severity; } - } diff --git a/src/Dibi/interfaces.php b/src/Dibi/interfaces.php index 243aa953..0363507c 100644 --- a/src/Dibi/interfaces.php +++ b/src/Dibi/interfaces.php @@ -113,7 +113,6 @@ interface Driver * Injects LIMIT/OFFSET to the SQL query. */ function applyLimit(string &$sql, ?int $limit, ?int $offset): void; - } @@ -164,7 +163,6 @@ interface ResultDriver * Decodes data from result set. */ function unescapeBinary(string $value): string; - } @@ -196,5 +194,4 @@ interface Reflector * Returns metadata for all foreign keys in a table. */ function getForeignKeys(string $table): array; - } diff --git a/tests/dibi/Connection.connect.phpt b/tests/dibi/Connection.connect.phpt index 54a5f27a..36238565 100644 --- a/tests/dibi/Connection.connect.phpt +++ b/tests/dibi/Connection.connect.phpt @@ -6,8 +6,8 @@ declare(strict_types=1); -use Tester\Assert; use Dibi\Connection; +use Tester\Assert; require __DIR__ . '/bootstrap.php'; diff --git a/tests/dibi/Connection.fetch.phpt b/tests/dibi/Connection.fetch.phpt index d7b2b1f7..5948aafc 100644 --- a/tests/dibi/Connection.fetch.phpt +++ b/tests/dibi/Connection.fetch.phpt @@ -6,8 +6,8 @@ declare(strict_types=1); -use Tester\Assert; use Dibi\Row; +use Tester\Assert; require __DIR__ . '/bootstrap.php'; @@ -63,8 +63,8 @@ Assert::equal([ // more complex association array -function query($conn) { - +function query($conn) +{ return $conn->query(in_array($conn->getConfig('system'), ['odbc', 'sqlsrv']) ? ' SELECT products.title, customers.name, orders.amount FROM ([products] diff --git a/tests/dibi/Connection.substitutions.phpt b/tests/dibi/Connection.substitutions.phpt index 2c1a98f2..d2155082 100644 --- a/tests/dibi/Connection.substitutions.phpt +++ b/tests/dibi/Connection.substitutions.phpt @@ -1,5 +1,4 @@