Code style fixes

This commit is contained in:
Dmitry Khomutov 2017-01-08 00:55:56 +07:00
commit 4b49c95b20
No known key found for this signature in database
GPG key ID: 7EB36C9576F9ECB9
8 changed files with 121 additions and 121 deletions

View file

@ -14,15 +14,15 @@ class AddUserProviders extends AbstractMigration
$this
->table('user')
// The provider name
->addColumn('provider_key', 'string', array(
->addColumn('provider_key', 'string', [
'default' => 'internal',
'limit' => MysqlAdapter::TEXT_SMALL
))
'limit' => MysqlAdapter::TEXT_SMALL
])
// A data used by the provider
->addColumn('provider_data', 'string', array(
'null' => true,
->addColumn('provider_data', 'string', [
'null' => true,
'limit' => MysqlAdapter::TEXT_SMALL
))
])
->save();
}

View file

@ -20,7 +20,7 @@ namespace PHPCensor\Plugin\Option;
class PhpUnitOptions
{
protected $options;
protected $arguments = array();
protected $arguments = [];
public function __construct($options)
{
@ -52,7 +52,7 @@ class PhpUnitOptions
$prefix = $argumentName[0] == '-' ? '' : '--';
if (!is_array($argumentValues)) {
$argumentValues = array($argumentValues);
$argumentValues = [$argumentValues];
}
foreach ($argumentValues as $argValue) {
@ -139,7 +139,7 @@ class PhpUnitOptions
if (isset($this->arguments[$argumentName])) {
if (!is_array($this->arguments[$argumentName])) {
// Convert existing argument values into an array
$this->arguments[$argumentName] = array($this->arguments[$argumentName]);
$this->arguments[$argumentName] = [$this->arguments[$argumentName]];
}
// Appends the new argument to the list
@ -160,14 +160,14 @@ class PhpUnitOptions
$directories = $this->getOption('directory');
if (is_string($directories)) {
$directories = array($directories);
$directories = [$directories];
} else {
if (is_null($directories)) {
$directories = array();
$directories = [];
}
}
return is_array($directories) ? $directories : array($directories);
return is_array($directories) ? $directories : [$directories];
}
/**
@ -240,10 +240,10 @@ class PhpUnitOptions
if (isset($this->arguments[$argumentName])) {
return is_array(
$this->arguments[$argumentName]
) ? $this->arguments[$argumentName] : array($this->arguments[$argumentName]);
) ? $this->arguments[$argumentName] : [$this->arguments[$argumentName]];
}
return array();
return [];
}
/**
@ -255,12 +255,12 @@ class PhpUnitOptions
*/
public static function findConfigFile($buildPath)
{
$files = array(
$files = [
'phpunit.xml',
'phpunit.xml.dist',
'tests/phpunit.xml',
'tests/phpunit.xml.dist',
);
];
foreach ($files as $file) {
if (file_exists($buildPath . $file)) {

View file

@ -30,7 +30,7 @@ use PHPCensor\ZeroConfigPluginInterface;
class PhpUnit extends Plugin implements ZeroConfigPluginInterface
{
/** @var string[] Raw options from the PHPCI config file */
protected $options = array();
protected $options = [];
/**
* @return string

View file

@ -29,10 +29,10 @@ class PhpUnitResult
const SEVERITY_SKIPPED = 'skipped';
protected $options;
protected $arguments = array();
protected $arguments = [];
protected $results;
protected $failures = 0;
protected $errors = array();
protected $errors = [];
public function __construct($outputFile, $buildPath = '')
{
@ -60,8 +60,8 @@ class PhpUnitResult
}
// Reset the parsing variables
$this->results = array();
$this->errors = array();
$this->results = [];
$this->errors = [];
$this->failures = 0;
if (is_array($events)) {
@ -88,13 +88,13 @@ class PhpUnitResult
{
list($pass, $severity) = $this->getStatus($event);
$data = array(
$data = [
'pass' => $pass,
'severity' => $severity,
'message' => $this->buildMessage($event),
'trace' => $pass ? array() : $this->buildTrace($event),
'trace' => $pass ? [] : $this->buildTrace($event),
'output' => $event['output'],
);
];
if (!$pass) {
$this->failures++;
@ -142,7 +142,7 @@ class PhpUnitResult
break;
}
return array($pass, $severity);
return [$pass, $severity];
}
/**
@ -172,7 +172,7 @@ class PhpUnitResult
*/
protected function buildTrace($event)
{
$formattedTrace = array();
$formattedTrace = [];
if (!empty($event['trace'])) {
foreach ($event['trace'] as $step){
@ -195,12 +195,12 @@ class PhpUnitResult
$firstTrace = end($event['trace']);
reset($event['trace']);
$this->errors[] = array(
$this->errors[] = [
'message' => $data['message'],
'severity' => $data['severity'],
'file' => str_replace($this->buildPath, '', $firstTrace['file']),
'line' => $firstTrace['line'],
);
];
}
/**