added configuration for PHP Coding Standards Fixer, including its fixes, resolving #47

This commit is contained in:
El RIDO 2016-08-15 16:45:47 +02:00
parent 87926ce157
commit 72aac25f68
17 changed files with 114 additions and 90 deletions

1
.gitattributes vendored
View File

@ -8,4 +8,5 @@ tst/ export-ignore
.gitattributes export-ignore .gitattributes export-ignore
.github export-ignore .github export-ignore
.gitignore export-ignore .gitignore export-ignore
.php_cs export-ignore
.travis.yml export-ignore .travis.yml export-ignore

23
.php_cs Normal file
View File

@ -0,0 +1,23 @@
<?php
/**
* Configuration file for PHP Coding Standards Fixer (php-cs-fixer).
*
* On GitHub: https://github.com/FriendsOfPhp/php-cs-fixer
* More information: http://cs.sensiolabs.org/
*/
$finder = Symfony\CS\Finder\DefaultFinder::create()
->in('lib')
;
return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->fixers(['concat_with_spaces', 'long_array_syntax', 'standardize_not_equal',
'operators_spaces', 'duplicate_semicolon',
'remove_leading_slash_use', 'align_equals',
'single_array_no_trailing_comma', 'phpdoc_indent', 'phpdoc_scalar',
'phpdoc_to_comment', 'phpdoc_trim',
'phpdoc_types', 'print_to_echo', 'self_accessor', 'single_quote',
'spaces_cast', 'ternary_spaces', 'phpdoc_order'])
->finder($finder)
;

View File

@ -71,7 +71,7 @@ class Database extends AbstractData
public static function getInstance($options = null) public static function getInstance($options = null)
{ {
// if needed initialize the singleton // if needed initialize the singleton
if (!(self::$_instance instanceof Database)) { if (!(self::$_instance instanceof self)) {
self::$_instance = new self; self::$_instance = new self;
} }
@ -486,7 +486,7 @@ class Database extends AbstractData
$sql = 'SELECT tabname FROM systables '; $sql = 'SELECT tabname FROM systables ';
break; break;
case 'mssql': case 'mssql':
$sql = "SELECT name FROM sysobjects " $sql = 'SELECT name FROM sysobjects '
. "WHERE type = 'U' ORDER BY name"; . "WHERE type = 'U' ORDER BY name";
break; break;
case 'mysql': case 'mysql':
@ -496,22 +496,22 @@ class Database extends AbstractData
$sql = 'SELECT table_name FROM all_tables'; $sql = 'SELECT table_name FROM all_tables';
break; break;
case 'pgsql': case 'pgsql':
$sql = "SELECT c.relname AS table_name " $sql = 'SELECT c.relname AS table_name '
. "FROM pg_class c, pg_user u " . 'FROM pg_class c, pg_user u '
. "WHERE c.relowner = u.usesysid AND c.relkind = 'r' " . "WHERE c.relowner = u.usesysid AND c.relkind = 'r' "
. "AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) " . 'AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) '
. "AND c.relname !~ '^(pg_|sql_)' " . "AND c.relname !~ '^(pg_|sql_)' "
. "UNION " . 'UNION '
. "SELECT c.relname AS table_name " . 'SELECT c.relname AS table_name '
. "FROM pg_class c " . 'FROM pg_class c '
. "WHERE c.relkind = 'r' " . "WHERE c.relkind = 'r' "
. "AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) " . 'AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) '
. "AND NOT EXISTS (SELECT 1 FROM pg_user WHERE usesysid = c.relowner) " . 'AND NOT EXISTS (SELECT 1 FROM pg_user WHERE usesysid = c.relowner) '
. "AND c.relname !~ '^pg_'"; . "AND c.relname !~ '^pg_'";
break; break;
case 'sqlite': case 'sqlite':
$sql = "SELECT name FROM sqlite_master WHERE type='table' " $sql = "SELECT name FROM sqlite_master WHERE type='table' "
. "UNION ALL SELECT name FROM sqlite_temp_master " . 'UNION ALL SELECT name FROM sqlite_temp_master '
. "WHERE type='table' ORDER BY name"; . "WHERE type='table' ORDER BY name";
break; break;
default: default:

View File

@ -49,7 +49,7 @@ class Filesystem extends AbstractData
self::$_dir = $options['dir'] . DIRECTORY_SEPARATOR; self::$_dir = $options['dir'] . DIRECTORY_SEPARATOR;
} }
// if needed initialize the singleton // if needed initialize the singleton
if (!(self::$_instance instanceof Filesystem)) { if (!(self::$_instance instanceof self)) {
self::$_instance = new self; self::$_instance = new self;
self::_init(); self::_init();
} }

View File

@ -296,7 +296,7 @@ class Paste extends AbstractModel
* *
* @access public * @access public
* @throws Exception * @throws Exception
* @return boolean * @return bool
*/ */
public function isBurnafterreading() public function isBurnafterreading()
{ {
@ -313,7 +313,7 @@ class Paste extends AbstractModel
* *
* @access public * @access public
* @throws Exception * @throws Exception
* @return boolean * @return bool
*/ */
public function isOpendiscussion() public function isOpendiscussion()
{ {