added configuration for PHP Coding Standards Fixer, including its fixes, resolving #47
This commit is contained in:
parent
87926ce157
commit
72aac25f68
17 changed files with 114 additions and 90 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -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
23
.php_cs
Normal 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)
|
||||||
|
;
|
|
@ -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:
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,7 +372,7 @@ class I18n
|
||||||
{
|
{
|
||||||
$a = explode('-', $a);
|
$a = explode('-', $a);
|
||||||
$b = explode('-', $b);
|
$b = explode('-', $b);
|
||||||
for ($i=0, $n = min(count($a), count($b)); $i < $n; ++$i) {
|
for ($i = 0, $n = min(count($a), count($b)); $i < $n; ++$i) {
|
||||||
if ($a[$i] !== $b[$i]) {
|
if ($a[$i] !== $b[$i]) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
{
|
{
|
||||||
|
|
|
@ -168,7 +168,7 @@ class PrivateBin
|
||||||
file_put_contents(
|
file_put_contents(
|
||||||
PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess',
|
PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess',
|
||||||
'Allow from none' . PHP_EOL .
|
'Allow from none' . PHP_EOL .
|
||||||
'Deny from all'. PHP_EOL,
|
'Deny from all' . PHP_EOL,
|
||||||
LOCK_EX
|
LOCK_EX
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ class PrivateBin
|
||||||
// label all the expiration options
|
// label all the expiration options
|
||||||
$expire = array();
|
$expire = array();
|
||||||
foreach ($this->_conf->getSection('expire_options') as $time => $seconds) {
|
foreach ($this->_conf->getSection('expire_options') as $time => $seconds) {
|
||||||
$expire[$time] = ($seconds == 0) ? I18n::_(ucfirst($time)): Filter::formatHumanReadableTime($time);
|
$expire[$time] = ($seconds == 0) ? I18n::_(ucfirst($time)) : Filter::formatHumanReadableTime($time);
|
||||||
}
|
}
|
||||||
|
|
||||||
// translate all the formatter options
|
// translate all the formatter options
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace PrivateBin;
|
||||||
* Request
|
* Request
|
||||||
*
|
*
|
||||||
* parses request parameters and provides helper functions for routing
|
* parses request parameters and provides helper functions for routing
|
||||||
*/
|
*/
|
||||||
class Request
|
class Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -228,7 +228,7 @@ class Vizhash16x16
|
||||||
ImageFilledPolygon($image, $points, 4, $color);
|
ImageFilledPolygon($image, $points, 4, $color);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$start = $this->getInt() * 360 /256;
|
$start = $this->getInt() * 360 / 256;
|
||||||
$end = $start + $this->getInt() * 180 / 256;
|
$end = $start + $this->getInt() * 180 / 256;
|
||||||
ImageFilledArc($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $start, $end, $color, IMG_ARC_PIE);
|
ImageFilledArc($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $start, $end, $color, IMG_ARC_PIE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue