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

pull/83/head
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
.github export-ignore
.gitignore export-ignore
.php_cs 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)
{
// if needed initialize the singleton
if (!(self::$_instance instanceof Database)) {
if (!(self::$_instance instanceof self)) {
self::$_instance = new self;
}
@ -486,7 +486,7 @@ class Database extends AbstractData
$sql = 'SELECT tabname FROM systables ';
break;
case 'mssql':
$sql = "SELECT name FROM sysobjects "
$sql = 'SELECT name FROM sysobjects '
. "WHERE type = 'U' ORDER BY name";
break;
case 'mysql':
@ -496,22 +496,22 @@ class Database extends AbstractData
$sql = 'SELECT table_name FROM all_tables';
break;
case 'pgsql':
$sql = "SELECT c.relname AS table_name "
. "FROM pg_class c, pg_user u "
$sql = 'SELECT c.relname AS table_name '
. 'FROM pg_class c, pg_user u '
. "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_)' "
. "UNION "
. "SELECT c.relname AS table_name "
. "FROM pg_class c "
. 'UNION '
. 'SELECT c.relname AS table_name '
. 'FROM pg_class c '
. "WHERE c.relkind = 'r' "
. "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_views WHERE viewname = c.relname) '
. 'AND NOT EXISTS (SELECT 1 FROM pg_user WHERE usesysid = c.relowner) '
. "AND c.relname !~ '^pg_'";
break;
case 'sqlite':
$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";
break;
default:

View File

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

View File

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