diff --git a/public/assets/plugins/datatables/extensions/Scroller/examples/data/ssp.php b/public/assets/plugins/datatables/extensions/Scroller/examples/data/ssp.php index 71057e9e..aace9c34 100644 --- a/public/assets/plugins/datatables/extensions/Scroller/examples/data/ssp.php +++ b/public/assets/plugins/datatables/extensions/Scroller/examples/data/ssp.php @@ -28,21 +28,21 @@ $primaryKey = 'id'; // The `db` parameter represents the column name in the database, while the `dt` // parameter represents the DataTables column identifier. In this case simple // indexes -$columns = array( - array( 'db' => 'id', 'dt' => 0 ), - array( 'db' => 'firstname', 'dt' => 1 ), - array( 'db' => 'surname', 'dt' => 2 ), - array( 'db' => 'zip', 'dt' => 3 ), - array( 'db' => 'country', 'dt' => 4 ) -); +$columns = [ + ['db' => 'id', 'dt' => 0], + ['db' => 'firstname', 'dt' => 1], + ['db' => 'surname', 'dt' => 2], + ['db' => 'zip', 'dt' => 3], + ['db' => 'country', 'dt' => 4] +]; // SQL server connection information -$sql_details = array( - 'user' => '', - 'pass' => '', - 'db' => '', - 'host' => '' -); +$sql_details = [ + 'user' => '', + 'pass' => '', + 'db' => '', + 'host' => '' +]; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -50,9 +50,9 @@ $sql_details = array( * server-side, there is no need to edit below this line. */ -require( '../../../../examples/server_side/scripts/ssp.class.php' ); +require('../../../../examples/server_side/scripts/ssp.class.php'); echo json_encode( - SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns ) + SSP::simple($_GET, $sql_details, $table, $primaryKey, $columns) ); diff --git a/src/PHPCI/Model/Base/BuildBase.php b/src/PHPCI/Model/Base/BuildBase.php index 7c0fcdd3..047026c7 100644 --- a/src/PHPCI/Model/Base/BuildBase.php +++ b/src/PHPCI/Model/Base/BuildBase.php @@ -17,7 +17,7 @@ class BuildBase extends Model /** * @var array */ - public static $sleepable = array(); + public static $sleepable = []; /** * @var string @@ -32,155 +32,155 @@ class BuildBase extends Model /** * @var array */ - protected $data = array( - 'id' => null, - 'project_id' => null, - 'commit_id' => null, - 'status' => null, - 'log' => null, - 'branch' => null, - 'created' => null, - 'started' => null, - 'finished' => null, + protected $data = [ + 'id' => null, + 'project_id' => null, + 'commit_id' => null, + 'status' => null, + 'log' => null, + 'branch' => null, + 'created' => null, + 'started' => null, + 'finished' => null, 'committer_email' => null, - 'commit_message' => null, - 'extra' => null, - ); + 'commit_message' => null, + 'extra' => null, + ]; /** * @var array */ - protected $getters = array( + protected $getters = [ // Direct property getters: - 'id' => 'getId', - 'project_id' => 'getProjectId', - 'commit_id' => 'getCommitId', - 'status' => 'getStatus', - 'log' => 'getLog', - 'branch' => 'getBranch', - 'created' => 'getCreated', - 'started' => 'getStarted', - 'finished' => 'getFinished', + 'id' => 'getId', + 'project_id' => 'getProjectId', + 'commit_id' => 'getCommitId', + 'status' => 'getStatus', + 'log' => 'getLog', + 'branch' => 'getBranch', + 'created' => 'getCreated', + 'started' => 'getStarted', + 'finished' => 'getFinished', 'committer_email' => 'getCommitterEmail', - 'commit_message' => 'getCommitMessage', - 'extra' => 'getExtra', + 'commit_message' => 'getCommitMessage', + 'extra' => 'getExtra', // Foreign key getters: 'Project' => 'getProject', - ); + ]; /** * @var array */ - protected $setters = array( + protected $setters = [ // Direct property setters: - 'id' => 'setId', - 'project_id' => 'setProjectId', - 'commit_id' => 'setCommitId', - 'status' => 'setStatus', - 'log' => 'setLog', - 'branch' => 'setBranch', - 'created' => 'setCreated', - 'started' => 'setStarted', - 'finished' => 'setFinished', + 'id' => 'setId', + 'project_id' => 'setProjectId', + 'commit_id' => 'setCommitId', + 'status' => 'setStatus', + 'log' => 'setLog', + 'branch' => 'setBranch', + 'created' => 'setCreated', + 'started' => 'setStarted', + 'finished' => 'setFinished', 'committer_email' => 'setCommitterEmail', - 'commit_message' => 'setCommitMessage', - 'extra' => 'setExtra', + 'commit_message' => 'setCommitMessage', + 'extra' => 'setExtra', // Foreign key setters: 'Project' => 'setProject', - ); + ]; /** * @var array */ - public $columns = array( - 'id' => array( - 'type' => 'int', - 'length' => 11, - 'primary_key' => true, + public $columns = [ + 'id' => [ + 'type' => 'int', + 'length' => 11, + 'primary_key' => true, 'auto_increment' => true, + 'default' => null, + ], + 'project_id' => [ + 'type' => 'int', + 'length' => 11, 'default' => null, - ), - 'project_id' => array( - 'type' => 'int', - 'length' => 11, + ], + 'commit_id' => [ + 'type' => 'varchar', + 'length' => 50, 'default' => null, - ), - 'commit_id' => array( - 'type' => 'varchar', - 'length' => 50, + ], + 'status' => [ + 'type' => 'int', + 'length' => 11, 'default' => null, - ), - 'status' => array( - 'type' => 'int', - 'length' => 11, - 'default' => null, - ), - 'log' => array( - 'type' => 'mediumtext', + ], + 'log' => [ + 'type' => 'mediumtext', 'nullable' => true, - 'default' => null, - ), - 'branch' => array( - 'type' => 'varchar', - 'length' => 50, + 'default' => null, + ], + 'branch' => [ + 'type' => 'varchar', + 'length' => 50, 'default' => 'master', - ), - 'created' => array( - 'type' => 'datetime', + ], + 'created' => [ + 'type' => 'datetime', 'nullable' => true, - 'default' => null, - ), - 'started' => array( - 'type' => 'datetime', + 'default' => null, + ], + 'started' => [ + 'type' => 'datetime', 'nullable' => true, - 'default' => null, - ), - 'finished' => array( - 'type' => 'datetime', + 'default' => null, + ], + 'finished' => [ + 'type' => 'datetime', 'nullable' => true, - 'default' => null, - ), - 'committer_email' => array( - 'type' => 'varchar', - 'length' => 512, + 'default' => null, + ], + 'committer_email' => [ + 'type' => 'varchar', + 'length' => 512, 'nullable' => true, - 'default' => null, - ), - 'commit_message' => array( - 'type' => 'text', + 'default' => null, + ], + 'commit_message' => [ + 'type' => 'text', 'nullable' => true, - 'default' => null, - ), - 'extra' => array( - 'type' => 'text', + 'default' => null, + ], + 'extra' => [ + 'type' => 'text', 'nullable' => true, - 'default' => null, - ), - ); + 'default' => null, + ], + ]; /** * @var array */ - public $indexes = array( - 'PRIMARY' => array('unique' => true, 'columns' => 'id'), - 'project_id' => array('columns' => 'project_id'), - 'idx_status' => array('columns' => 'status'), - ); + public $indexes = [ + 'PRIMARY' => ['unique' => true, 'columns' => 'id'], + 'project_id' => ['columns' => 'project_id'], + 'idx_status' => ['columns' => 'status'], + ]; /** * @var array */ - public $foreignKeys = array( - 'build_ibfk_1' => array( - 'local_col' => 'project_id', - 'update' => 'CASCADE', - 'delete' => 'CASCADE', - 'table' => 'project', - 'col' => 'id' - ), - ); + public $foreignKeys = [ + 'build_ibfk_1' => [ + 'local_col' => 'project_id', + 'update' => 'CASCADE', + 'delete' => 'CASCADE', + 'table' => 'project', + 'col' => 'id' + ], + ]; /** * Get the value of Id / id. diff --git a/src/PHPCI/Model/Base/BuildErrorBase.php b/src/PHPCI/Model/Base/BuildErrorBase.php index 6364bb29..79110499 100644 --- a/src/PHPCI/Model/Base/BuildErrorBase.php +++ b/src/PHPCI/Model/Base/BuildErrorBase.php @@ -17,7 +17,7 @@ class BuildErrorBase extends Model /** * @var array */ - public static $sleepable = array(); + public static $sleepable = []; /** * @var string @@ -32,131 +32,131 @@ class BuildErrorBase extends Model /** * @var array */ - protected $data = array( - 'id' => null, - 'build_id' => null, - 'plugin' => null, - 'file' => null, - 'line_start' => null, - 'line_end' => null, - 'severity' => null, - 'message' => null, + protected $data = [ + 'id' => null, + 'build_id' => null, + 'plugin' => null, + 'file' => null, + 'line_start' => null, + 'line_end' => null, + 'severity' => null, + 'message' => null, 'created_date' => null, - ); + ]; /** * @var array */ - protected $getters = array( + protected $getters = [ // Direct property getters: - 'id' => 'getId', - 'build_id' => 'getBuildId', - 'plugin' => 'getPlugin', - 'file' => 'getFile', - 'line_start' => 'getLineStart', - 'line_end' => 'getLineEnd', - 'severity' => 'getSeverity', - 'message' => 'getMessage', + 'id' => 'getId', + 'build_id' => 'getBuildId', + 'plugin' => 'getPlugin', + 'file' => 'getFile', + 'line_start' => 'getLineStart', + 'line_end' => 'getLineEnd', + 'severity' => 'getSeverity', + 'message' => 'getMessage', 'created_date' => 'getCreatedDate', // Foreign key getters: 'Build' => 'getBuild', - ); + ]; /** * @var array */ - protected $setters = array( + protected $setters = [ // Direct property setters: - 'id' => 'setId', - 'build_id' => 'setBuildId', - 'plugin' => 'setPlugin', - 'file' => 'setFile', - 'line_start' => 'setLineStart', - 'line_end' => 'setLineEnd', - 'severity' => 'setSeverity', - 'message' => 'setMessage', + 'id' => 'setId', + 'build_id' => 'setBuildId', + 'plugin' => 'setPlugin', + 'file' => 'setFile', + 'line_start' => 'setLineStart', + 'line_end' => 'setLineEnd', + 'severity' => 'setSeverity', + 'message' => 'setMessage', 'created_date' => 'setCreatedDate', // Foreign key setters: 'Build' => 'setBuild', - ); + ]; /** * @var array */ - public $columns = array( - 'id' => array( - 'type' => 'int', - 'length' => 11, - 'primary_key' => true, + public $columns = [ + 'id' => [ + 'type' => 'int', + 'length' => 11, + 'primary_key' => true, 'auto_increment' => true, + 'default' => null, + ], + 'build_id' => [ + 'type' => 'int', + 'length' => 11, 'default' => null, - ), - 'build_id' => array( - 'type' => 'int', - 'length' => 11, + ], + 'plugin' => [ + 'type' => 'varchar', + 'length' => 100, 'default' => null, - ), - 'plugin' => array( - 'type' => 'varchar', - 'length' => 100, - 'default' => null, - ), - 'file' => array( - 'type' => 'varchar', - 'length' => 250, + ], + 'file' => [ + 'type' => 'varchar', + 'length' => 250, 'nullable' => true, - 'default' => null, - ), - 'line_start' => array( - 'type' => 'int', - 'length' => 11, + 'default' => null, + ], + 'line_start' => [ + 'type' => 'int', + 'length' => 11, 'nullable' => true, - 'default' => null, - ), - 'line_end' => array( - 'type' => 'int', - 'length' => 11, + 'default' => null, + ], + 'line_end' => [ + 'type' => 'int', + 'length' => 11, 'nullable' => true, + 'default' => null, + ], + 'severity' => [ + 'type' => 'tinyint', + 'length' => 3, 'default' => null, - ), - 'severity' => array( - 'type' => 'tinyint', - 'length' => 3, + ], + 'message' => [ + 'type' => 'varchar', + 'length' => 250, 'default' => null, - ), - 'message' => array( - 'type' => 'varchar', - 'length' => 250, + ], + 'created_date' => [ + 'type' => 'datetime', 'default' => null, - ), - 'created_date' => array( - 'type' => 'datetime', - 'default' => null, - ), - ); + ], + ]; /** * @var array */ - public $indexes = array( - 'PRIMARY' => array('unique' => true, 'columns' => 'id'), - 'build_id' => array('columns' => 'build_id, created_date'), - ); + public $indexes = [ + 'PRIMARY' => ['unique' => true, 'columns' => 'id'], + 'build_id' => ['columns' => 'build_id, created_date'], + ]; /** * @var array */ - public $foreignKeys = array( - 'build_error_ibfk_1' => array( - 'local_col' => 'build_id', - 'update' => 'CASCADE', - 'delete' => 'CASCADE', - 'table' => 'build', - 'col' => 'id' - ), - ); + public $foreignKeys = [ + 'build_error_ibfk_1' => [ + 'local_col' => 'build_id', + 'update' => 'CASCADE', + 'delete' => 'CASCADE', + 'table' => 'build', + 'col' => 'id' + ], + ]; /** * Get the value of Id / id. @@ -165,7 +165,7 @@ class BuildErrorBase extends Model */ public function getId() { - $rtn = $this->data['id']; + $rtn = $this->data['id']; return $rtn; } @@ -177,7 +177,7 @@ class BuildErrorBase extends Model */ public function getBuildId() { - $rtn = $this->data['build_id']; + $rtn = $this->data['build_id']; return $rtn; } @@ -189,7 +189,7 @@ class BuildErrorBase extends Model */ public function getPlugin() { - $rtn = $this->data['plugin']; + $rtn = $this->data['plugin']; return $rtn; } @@ -201,7 +201,7 @@ class BuildErrorBase extends Model */ public function getFile() { - $rtn = $this->data['file']; + $rtn = $this->data['file']; return $rtn; } @@ -213,7 +213,7 @@ class BuildErrorBase extends Model */ public function getLineStart() { - $rtn = $this->data['line_start']; + $rtn = $this->data['line_start']; return $rtn; } @@ -225,7 +225,7 @@ class BuildErrorBase extends Model */ public function getLineEnd() { - $rtn = $this->data['line_end']; + $rtn = $this->data['line_end']; return $rtn; } @@ -237,7 +237,7 @@ class BuildErrorBase extends Model */ public function getSeverity() { - $rtn = $this->data['severity']; + $rtn = $this->data['severity']; return $rtn; } @@ -249,7 +249,7 @@ class BuildErrorBase extends Model */ public function getMessage() { - $rtn = $this->data['message']; + $rtn = $this->data['message']; return $rtn; } @@ -261,10 +261,10 @@ class BuildErrorBase extends Model */ public function getCreatedDate() { - $rtn = $this->data['created_date']; + $rtn = $this->data['created_date']; if (!empty($rtn)) { - $rtn = new \DateTime($rtn); + $rtn = new \DateTime($rtn); } return $rtn; diff --git a/src/PHPCI/Model/Base/BuildMetaBase.php b/src/PHPCI/Model/Base/BuildMetaBase.php index dc018819..be653427 100644 --- a/src/PHPCI/Model/Base/BuildMetaBase.php +++ b/src/PHPCI/Model/Base/BuildMetaBase.php @@ -17,7 +17,7 @@ class BuildMetaBase extends Model /** * @var array */ - public static $sleepable = array(); + public static $sleepable = []; /** * @var string @@ -32,106 +32,104 @@ class BuildMetaBase extends Model /** * @var array */ - protected $data = array( - 'id' => null, + protected $data = [ + 'id' => null, 'project_id' => null, - 'build_id' => null, - 'meta_key' => null, + 'build_id' => null, + 'meta_key' => null, 'meta_value' => null, - ); + ]; /** * @var array */ - protected $getters = array( + protected $getters = [ // Direct property getters: - 'id' => 'getId', + 'id' => 'getId', 'project_id' => 'getProjectId', - 'build_id' => 'getBuildId', - 'meta_key' => 'getMetaKey', + 'build_id' => 'getBuildId', + 'meta_key' => 'getMetaKey', 'meta_value' => 'getMetaValue', - // Foreign key getters: - 'Project' => 'getProject', - 'Build' => 'getBuild', - ); + 'Project' => 'getProject', + 'Build' => 'getBuild', + ]; /** * @var array */ - protected $setters = array( + protected $setters = [ // Direct property setters: - 'id' => 'setId', + 'id' => 'setId', 'project_id' => 'setProjectId', - 'build_id' => 'setBuildId', - 'meta_key' => 'setMetaKey', + 'build_id' => 'setBuildId', + 'meta_key' => 'setMetaKey', 'meta_value' => 'setMetaValue', - // Foreign key setters: - 'Project' => 'setProject', - 'Build' => 'setBuild', - ); + 'Project' => 'setProject', + 'Build' => 'setBuild', + ]; /** * @var array */ - public $columns = array( - 'id' => array( - 'type' => 'int', - 'length' => 10, - 'primary_key' => true, + public $columns = [ + 'id' => [ + 'type' => 'int', + 'length' => 10, + 'primary_key' => true, 'auto_increment' => true, + 'default' => null, + ], + 'project_id' => [ + 'type' => 'int', + 'length' => 11, 'default' => null, - ), - 'project_id' => array( - 'type' => 'int', - 'length' => 11, + ], + 'build_id' => [ + 'type' => 'int', + 'length' => 11, 'default' => null, - ), - 'build_id' => array( - 'type' => 'int', - 'length' => 11, + ], + 'meta_key' => [ + 'type' => 'varchar', + 'length' => 250, 'default' => null, - ), - 'meta_key' => array( - 'type' => 'varchar', - 'length' => 250, + ], + 'meta_value' => [ + 'type' => 'mediumtext', 'default' => null, - ), - 'meta_value' => array( - 'type' => 'mediumtext', - 'default' => null, - ), - ); + ], + ]; /** * @var array */ - public $indexes = array( - 'PRIMARY' => array('unique' => true, 'columns' => 'id'), - 'idx_meta_id' => array('unique' => true, 'columns' => 'build_id, meta_key'), - 'project_id' => array('columns' => 'project_id'), - ); + public $indexes = [ + 'PRIMARY' => ['unique' => true, 'columns' => 'id'], + 'idx_meta_id' => ['unique' => true, 'columns' => 'build_id, meta_key'], + 'project_id' => ['columns' => 'project_id'], + ]; /** * @var array */ - public $foreignKeys = array( - 'build_meta_ibfk_1' => array( - 'local_col' => 'project_id', - 'update' => 'CASCADE', - 'delete' => 'CASCADE', - 'table' => 'project', - 'col' => 'id' - ), - 'fk_meta_build_id' => array( - 'local_col' => 'build_id', - 'update' => 'CASCADE', - 'delete' => 'CASCADE', - 'table' => 'build', - 'col' => 'id' - ), - ); + public $foreignKeys = [ + 'build_meta_ibfk_1' => [ + 'local_col' => 'project_id', + 'update' => 'CASCADE', + 'delete' => 'CASCADE', + 'table' => 'project', + 'col' => 'id' + ], + 'fk_meta_build_id' => [ + 'local_col' => 'build_id', + 'update' => 'CASCADE', + 'delete' => 'CASCADE', + 'table' => 'build', + 'col' => 'id' + ], + ]; /** * Get the value of Id / id. diff --git a/src/PHPCI/Model/Base/ProjectBase.php b/src/PHPCI/Model/Base/ProjectBase.php index 0dc0c0eb..1e1821d7 100644 --- a/src/PHPCI/Model/Base/ProjectBase.php +++ b/src/PHPCI/Model/Base/ProjectBase.php @@ -17,7 +17,7 @@ class ProjectBase extends Model /** * @var array */ - public static $sleepable = array(); + public static $sleepable = []; /** * @var string diff --git a/src/PHPCI/Model/Base/ProjectGroupBase.php b/src/PHPCI/Model/Base/ProjectGroupBase.php index 3b5eed69..dda73df2 100644 --- a/src/PHPCI/Model/Base/ProjectGroupBase.php +++ b/src/PHPCI/Model/Base/ProjectGroupBase.php @@ -17,7 +17,7 @@ class ProjectGroupBase extends Model /** * @var array */ - public static $sleepable = array(); + public static $sleepable = []; /** * @var string diff --git a/src/PHPCI/Model/Base/UserBase.php b/src/PHPCI/Model/Base/UserBase.php index 4de48537..e483a3be 100644 --- a/src/PHPCI/Model/Base/UserBase.php +++ b/src/PHPCI/Model/Base/UserBase.php @@ -17,7 +17,7 @@ class UserBase extends Model /** * @var array */ - public static $sleepable = array(); + public static $sleepable = []; /** * @var string diff --git a/src/PHPCI/Model/Build/GithubBuild.php b/src/PHPCI/Model/Build/GithubBuild.php index a9a18913..7d203b5c 100644 --- a/src/PHPCI/Model/Build/GithubBuild.php +++ b/src/PHPCI/Model/Build/GithubBuild.php @@ -80,17 +80,17 @@ class GithubBuild extends RemoteGitBuild $phpciUrl = \b8\Config::getInstance()->get('phpci.url'); - $params = array( - 'state' => $status, - 'target_url' => $phpciUrl . '/build/view/' . $this->getId(), + $params = [ + 'state' => $status, + 'target_url' => $phpciUrl . '/build/view/' . $this->getId(), 'description' => $description, - 'context' => 'PHPCI', - ); + 'context' => 'PHPCI', + ]; - $headers = array( + $headers = [ 'Authorization: token ' . $token, 'Content-Type: application/x-www-form-urlencoded' - ); + ]; $http->setHeaders($headers); $http->request('POST', $url, json_encode($params)); @@ -141,7 +141,7 @@ class GithubBuild extends RemoteGitBuild $branch = $this->getBranch(); if ($this->getExtra('build_type') == 'pull_request') { - $matches = array(); + $matches = []; preg_match('/[\/:]([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)/', $this->getExtra('remote_url'), $matches); $reference = $matches[1]; diff --git a/src/PHPCI/Plugin/Atoum.php b/src/PHPCI/Plugin/Atoum.php index 877f009b..19033014 100644 --- a/src/PHPCI/Plugin/Atoum.php +++ b/src/PHPCI/Plugin/Atoum.php @@ -29,7 +29,7 @@ class Atoum implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; diff --git a/src/PHPCI/Plugin/Behat.php b/src/PHPCI/Plugin/Behat.php index d63016dc..104174ea 100644 --- a/src/PHPCI/Plugin/Behat.php +++ b/src/PHPCI/Plugin/Behat.php @@ -38,7 +38,7 @@ class Behat implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -94,13 +94,13 @@ class Behat implements \PHPCI\Plugin $parts = explode('---', $output); if (count($parts) <= 1) { - return array(0, array()); + return [0, []]; } $lines = explode(PHP_EOL, $parts[1]); $storeFailures = false; - $data = array(); + $data = []; foreach ($lines as $line) { $line = trim($line); @@ -115,10 +115,10 @@ class Behat implements \PHPCI\Plugin if ($storeFailures) { $lineParts = explode(':', $line); - $data[] = array( + $data[] = [ 'file' => $lineParts[0], 'line' => $lineParts[1] - ); + ]; $this->build->reportError( $this->phpci, @@ -133,6 +133,6 @@ class Behat implements \PHPCI\Plugin $errorCount = count($data); - return array($errorCount, $data); + return [$errorCount, $data]; } } diff --git a/src/PHPCI/Plugin/Campfire.php b/src/PHPCI/Plugin/Campfire.php index 59ab9128..e98a68e0 100644 --- a/src/PHPCI/Plugin/Campfire.php +++ b/src/PHPCI/Plugin/Campfire.php @@ -36,7 +36,7 @@ class Campfire implements \PHPCI\Plugin * @param array $options * @throws \Exception */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -108,7 +108,7 @@ class Campfire implements \PHPCI\Plugin $type = 'TextMessage'; } - return $this->getPageByPost($page, array('message' => array('type' => $type, 'body' => $message))); + return $this->getPageByPost($page, ['message' => ['type' => $type, 'body' => $message]]); } @@ -134,7 +134,7 @@ class Campfire implements \PHPCI\Plugin curl_setopt($handle, CURLOPT_VERBOSE, $this->verbose); curl_setopt($handle, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($handle, CURLOPT_USERPWD, $this->authToken . ':x'); - curl_setopt($handle, CURLOPT_HTTPHEADER, array("Content-type: application/json")); + curl_setopt($handle, CURLOPT_HTTPHEADER, ["Content-type: application/json"]); curl_setopt($handle, CURLOPT_COOKIEFILE, $this->cookie); curl_setopt($handle, CURLOPT_POSTFIELDS, $json); diff --git a/src/PHPCI/Plugin/CleanBuild.php b/src/PHPCI/Plugin/CleanBuild.php index 684e8e7a..12355264 100644 --- a/src/PHPCI/Plugin/CleanBuild.php +++ b/src/PHPCI/Plugin/CleanBuild.php @@ -37,11 +37,11 @@ class CleanBuild implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; - $this->remove = isset($options['remove']) && is_array($options['remove']) ? $options['remove'] : array(); + $this->remove = isset($options['remove']) && is_array($options['remove']) ? $options['remove'] : []; } /** diff --git a/src/PHPCI/Plugin/Codeception.php b/src/PHPCI/Plugin/Codeception.php index c28e3a48..69958e56 100644 --- a/src/PHPCI/Plugin/Codeception.php +++ b/src/PHPCI/Plugin/Codeception.php @@ -79,7 +79,7 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -147,11 +147,11 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin $parser = new Parser($this->phpci, $xml); $output = $parser->parse(); - $meta = array( + $meta = [ 'tests' => $parser->getTotalTests(), 'timetaken' => $parser->getTotalTimeTaken(), 'failures' => $parser->getTotalFailures() - ); + ]; $this->build->storeMeta('codeception-meta', $meta); $this->build->storeMeta('codeception-data', $output); diff --git a/src/PHPCI/Plugin/Composer.php b/src/PHPCI/Plugin/Composer.php index 7bd86ac3..32b2e399 100644 --- a/src/PHPCI/Plugin/Composer.php +++ b/src/PHPCI/Plugin/Composer.php @@ -53,7 +53,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $path = $phpci->buildPath; $this->phpci = $phpci; @@ -91,7 +91,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin */ public function execute() { - $composerLocation = $this->phpci->findBinary(array('composer', 'composer.phar')); + $composerLocation = $this->phpci->findBinary(['composer', 'composer.phar']); $cmd = ''; diff --git a/src/PHPCI/Plugin/CopyBuild.php b/src/PHPCI/Plugin/CopyBuild.php index f9646cac..9474e29a 100644 --- a/src/PHPCI/Plugin/CopyBuild.php +++ b/src/PHPCI/Plugin/CopyBuild.php @@ -33,7 +33,7 @@ class CopyBuild implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $path = $phpci->buildPath; $this->phpci = $phpci; diff --git a/src/PHPCI/Plugin/Deployer.php b/src/PHPCI/Plugin/Deployer.php index 9c56a340..41084d51 100644 --- a/src/PHPCI/Plugin/Deployer.php +++ b/src/PHPCI/Plugin/Deployer.php @@ -31,7 +31,7 @@ class Deployer implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -60,13 +60,13 @@ class Deployer implements \PHPCI\Plugin $http = new HttpClient(); - $response = $http->post($this->webhookUrl, array( - 'reason' => $this->phpci->interpolate($this->reason), - 'source' => 'PHPCI', - 'url' => $this->phpci->interpolate('%BUILD_URI%'), - 'branch' => $this->phpci->interpolate('%BRANCH%'), + $response = $http->post($this->webhookUrl, [ + 'reason' => $this->phpci->interpolate($this->reason), + 'source' => 'PHPCI', + 'url' => $this->phpci->interpolate('%BUILD_URI%'), + 'branch' => $this->phpci->interpolate('%BRANCH%'), 'update_only' => $this->updateOnly - )); + ]); return $response['success']; } diff --git a/src/PHPCI/Plugin/Email.php b/src/PHPCI/Plugin/Email.php index 17e235e2..acc93682 100644 --- a/src/PHPCI/Plugin/Email.php +++ b/src/PHPCI/Plugin/Email.php @@ -50,7 +50,7 @@ class Email implements \PHPCI\Plugin public function __construct( Builder $phpci, Build $build, - array $options = array() + array $options = [] ) { $this->phpci = $phpci; $this->build = $build; @@ -161,7 +161,7 @@ class Email implements \PHPCI\Plugin */ protected function getEmailAddresses() { - $addresses = array(); + $addresses = []; $committer = $this->build->getCommitterEmail(); if (isset($this->options['committer']) && !empty($committer)) { @@ -188,7 +188,7 @@ class Email implements \PHPCI\Plugin */ protected function getCcAddresses() { - $ccAddresses = array(); + $ccAddresses = []; if (isset($this->options['cc'])) { foreach ($this->options['cc'] as $address) { diff --git a/src/PHPCI/Plugin/Env.php b/src/PHPCI/Plugin/Env.php index b89bf67d..c0b4641c 100644 --- a/src/PHPCI/Plugin/Env.php +++ b/src/PHPCI/Plugin/Env.php @@ -31,7 +31,7 @@ class Env implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; diff --git a/src/PHPCI/Plugin/FlowdockNotify.php b/src/PHPCI/Plugin/FlowdockNotify.php index 8ac9f2ab..db9de347 100644 --- a/src/PHPCI/Plugin/FlowdockNotify.php +++ b/src/PHPCI/Plugin/FlowdockNotify.php @@ -33,7 +33,7 @@ class FlowdockNotify implements \PHPCI\Plugin * @param array $options * @throws \Exception */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -65,7 +65,7 @@ class FlowdockNotify implements \PHPCI\Plugin ->setLink($this->build->getBranchLink()) ->setContent($message); - if (!$push->sendTeamInboxMessage($flowMessage, array('connect_timeout' => 5000, 'timeout' => 5000))) { + if (!$push->sendTeamInboxMessage($flowMessage, ['connect_timeout' => 5000, 'timeout' => 5000])) { throw new \Exception(sprintf('Flowdock Failed: %s', $flowMessage->getResponseErrors())); } return true; diff --git a/src/PHPCI/Plugin/Git.php b/src/PHPCI/Plugin/Git.php index 60d6b551..ce058993 100644 --- a/src/PHPCI/Plugin/Git.php +++ b/src/PHPCI/Plugin/Git.php @@ -23,7 +23,7 @@ class Git implements \PHPCI\Plugin { protected $phpci; protected $build; - protected $actions = array(); + protected $actions = []; /** * Set up the plugin, configure options, etc. @@ -31,7 +31,7 @@ class Git implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -74,7 +74,7 @@ class Git implements \PHPCI\Plugin * @param array $options * @return bool */ - protected function runAction($action, array $options = array()) + protected function runAction($action, array $options = []) { switch ($action) { case 'merge': diff --git a/src/PHPCI/Plugin/Grunt.php b/src/PHPCI/Plugin/Grunt.php index 4d62ffd8..8761d8d5 100644 --- a/src/PHPCI/Plugin/Grunt.php +++ b/src/PHPCI/Plugin/Grunt.php @@ -40,7 +40,7 @@ class Grunt implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $path = $phpci->buildPath; $this->build = $build; diff --git a/src/PHPCI/Plugin/Gulp.php b/src/PHPCI/Plugin/Gulp.php index b6c6cab4..d69428bf 100644 --- a/src/PHPCI/Plugin/Gulp.php +++ b/src/PHPCI/Plugin/Gulp.php @@ -40,7 +40,7 @@ class Gulp implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $path = $phpci->buildPath; $this->build = $build; diff --git a/src/PHPCI/Plugin/HipchatNotify.php b/src/PHPCI/Plugin/HipchatNotify.php index a39b94fe..7c93914b 100644 --- a/src/PHPCI/Plugin/HipchatNotify.php +++ b/src/PHPCI/Plugin/HipchatNotify.php @@ -32,7 +32,7 @@ class HipchatNotify implements \PHPCI\Plugin * @param array $options * @throws \Exception */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; diff --git a/src/PHPCI/Plugin/Irc.php b/src/PHPCI/Plugin/Irc.php index a7610a8c..44457f9e 100644 --- a/src/PHPCI/Plugin/Irc.php +++ b/src/PHPCI/Plugin/Irc.php @@ -41,7 +41,7 @@ class Irc implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -79,10 +79,10 @@ class Irc implements \PHPCI\Plugin $sock = fsockopen($this->server, $this->port); stream_set_timeout($sock, 1); - $connectCommands = array( + $connectCommands = [ 'USER ' . $this->nick . ' 0 * :' . $this->nick, 'NICK ' . $this->nick, - ); + ]; $this->executeIrcCommands($sock, $connectCommands); $this->executeIrcCommand($sock, 'JOIN ' . $this->room); $this->executeIrcCommand($sock, 'PRIVMSG ' . $this->room . ' :' . $msg); @@ -107,7 +107,7 @@ class Irc implements \PHPCI\Plugin // almost all servers expect pingback! while ($response = fgets($socket)) { - $matches = array(); + $matches = []; if (preg_match('/^PING \\:([A-Z0-9]+)/', $response, $matches)) { $pingBack = $matches[1]; } @@ -127,6 +127,6 @@ class Irc implements \PHPCI\Plugin */ private function executeIrcCommand($socket, $command) { - return $this->executeIrcCommands($socket, array($command)); + return $this->executeIrcCommands($socket, [$command]); } } diff --git a/src/PHPCI/Plugin/Lint.php b/src/PHPCI/Plugin/Lint.php index a7ddc55c..3948a6dd 100644 --- a/src/PHPCI/Plugin/Lint.php +++ b/src/PHPCI/Plugin/Lint.php @@ -39,11 +39,11 @@ class Lint implements PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; - $this->directories = array(''); + $this->directories = ['']; $this->ignore = $phpci->ignore; if (!empty($options['directory'])) { diff --git a/src/PHPCI/Plugin/Mysql.php b/src/PHPCI/Plugin/Mysql.php index fdb521ef..816e34f8 100644 --- a/src/PHPCI/Plugin/Mysql.php +++ b/src/PHPCI/Plugin/Mysql.php @@ -36,7 +36,7 @@ class Mysql implements \PHPCI\Plugin /** * @var array */ - protected $queries = array(); + protected $queries = []; /** * @var string @@ -58,7 +58,7 @@ class Mysql implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -97,7 +97,7 @@ class Mysql implements \PHPCI\Plugin public function execute() { try { - $opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION); + $opts = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]; $pdo = new PDO('mysql:host=' . $this->host, $this->user, $this->pass, $opts); foreach ($this->queries as $query) { @@ -152,10 +152,10 @@ class Mysql implements \PHPCI\Plugin */ protected function getImportCommand($import_file, $database = null) { - $decompression = array( + $decompression = [ 'bz2' => '| bzip2 --decompress', - 'gz' => '| gzip --decompress', - ); + 'gz' => '| gzip --decompress', + ]; $extension = strtolower(pathinfo($import_file, PATHINFO_EXTENSION)); $decomp_cmd = ''; @@ -163,14 +163,14 @@ class Mysql implements \PHPCI\Plugin $decomp_cmd = $decompression[$extension]; } - $args = array( + $args = [ ':import_file' => escapeshellarg($import_file), - ':decomp_cmd' => $decomp_cmd, - ':host' => escapeshellarg($this->host), - ':user' => escapeshellarg($this->user), - ':pass' => escapeshellarg($this->pass), - ':database' => ($database === null)? '': escapeshellarg($database), - ); + ':decomp_cmd' => $decomp_cmd, + ':host' => escapeshellarg($this->host), + ':user' => escapeshellarg($this->user), + ':pass' => escapeshellarg($this->pass), + ':database' => ($database === null)? '': escapeshellarg($database), + ]; return strtr('cat :import_file :decomp_cmd | mysql -h:host -u:user -p:pass :database', $args); } } diff --git a/src/PHPCI/Plugin/PackageBuild.php b/src/PHPCI/Plugin/PackageBuild.php index fb116640..4db8c67a 100644 --- a/src/PHPCI/Plugin/PackageBuild.php +++ b/src/PHPCI/Plugin/PackageBuild.php @@ -31,7 +31,7 @@ class PackageBuild implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $path = $phpci->buildPath; $this->build = $build; @@ -65,7 +65,7 @@ class PackageBuild implements \PHPCI\Plugin chdir($this->phpci->buildPath); if (!is_array($this->format)) { - $this->format = array($this->format); + $this->format = [$this->format]; } foreach ($this->format as $format) { diff --git a/src/PHPCI/Plugin/Pdepend.php b/src/PHPCI/Plugin/Pdepend.php index faef406d..2c6e28cd 100644 --- a/src/PHPCI/Plugin/Pdepend.php +++ b/src/PHPCI/Plugin/Pdepend.php @@ -54,7 +54,7 @@ class Pdepend implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -126,7 +126,7 @@ class Pdepend implements \PHPCI\Plugin protected function removeBuildArtifacts() { //Remove the created files first - foreach (array($this->summary, $this->chart, $this->pyramid) as $file) { + foreach ([$this->summary, $this->chart, $this->pyramid] as $file) { if (file_exists($this->location . DIRECTORY_SEPARATOR . $file)) { unlink($this->location . DIRECTORY_SEPARATOR . $file); } diff --git a/src/PHPCI/Plugin/Pgsql.php b/src/PHPCI/Plugin/Pgsql.php index 60057464..cad65da0 100644 --- a/src/PHPCI/Plugin/Pgsql.php +++ b/src/PHPCI/Plugin/Pgsql.php @@ -34,7 +34,7 @@ class Pgsql implements \PHPCI\Plugin /** * @var array */ - protected $queries = array(); + protected $queries = []; /** * @var string @@ -56,7 +56,7 @@ class Pgsql implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -79,8 +79,8 @@ class Pgsql implements \PHPCI\Plugin public function execute() { try { - $opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION); - $pdo = new PDO('pgsql:host=' . $this->host, $this->user, $this->pass, $opts); + $opts = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]; + $pdo = new PDO('pgsql:host=' . $this->host, $this->user, $this->pass, $opts); foreach ($this->queries as $query) { $pdo->query($this->phpci->interpolate($query)); diff --git a/src/PHPCI/Plugin/Phar.php b/src/PHPCI/Plugin/Phar.php index c734bb6c..731100cd 100644 --- a/src/PHPCI/Plugin/Phar.php +++ b/src/PHPCI/Plugin/Phar.php @@ -60,7 +60,7 @@ class Phar implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { // Basic $this->phpci = $phpci; diff --git a/src/PHPCI/Plugin/Phing.php b/src/PHPCI/Plugin/Phing.php index e322b72e..a83cd51c 100644 --- a/src/PHPCI/Plugin/Phing.php +++ b/src/PHPCI/Plugin/Phing.php @@ -24,9 +24,9 @@ class Phing implements \PHPCI\Plugin { private $directory; - private $buildFile = 'build.xml'; - private $targets = array('build'); - private $properties = array(); + private $buildFile = 'build.xml'; + private $targets = ['build']; + private $properties = []; private $propertyFile; protected $phpci; @@ -38,7 +38,7 @@ class Phing implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->setPhpci($phpci); $this->build = $build; @@ -157,7 +157,7 @@ class Phing implements \PHPCI\Plugin public function setTargets($targets) { if (is_string($targets)) { - $targets = array($targets); + $targets = [$targets]; } $this->targets = $targets; @@ -216,7 +216,7 @@ class Phing implements \PHPCI\Plugin $this->properties['project.basedir'] = $this->getDirectory(); } - $propertiesString = array(); + $propertiesString = []; foreach ($this->properties as $name => $value) { $propertiesString[] = '-D' . $name . '="' . $value . '"'; @@ -233,7 +233,7 @@ class Phing implements \PHPCI\Plugin public function setProperties($properties) { if (is_string($properties)) { - $properties = array($properties); + $properties = [$properties]; } $this->properties = $properties; diff --git a/src/PHPCI/Plugin/PhpCodeSniffer.php b/src/PHPCI/Plugin/PhpCodeSniffer.php index 6f4ed4e0..b8fde6d8 100644 --- a/src/PHPCI/Plugin/PhpCodeSniffer.php +++ b/src/PHPCI/Plugin/PhpCodeSniffer.php @@ -94,11 +94,11 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin * @param \PHPCI\Model\Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; - $this->suffixes = array('php'); + $this->suffixes = ['php']; $this->directory = $phpci->buildPath; $this->standard = 'PSR2'; $this->tab_width = ''; @@ -134,7 +134,7 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin */ protected function setOptions($options) { - foreach (array('directory', 'standard', 'path', 'ignore', 'allowed_warnings', 'allowed_errors') as $key) { + foreach (['directory', 'standard', 'path', 'ignore', 'allowed_warnings', 'allowed_errors'] as $key) { if (array_key_exists($key, $options)) { $this->{$key} = $options[$key]; } @@ -205,7 +205,7 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin $suffixes = ' --extensions=' . implode(',', $this->suffixes); } - return array($ignore, $standard, $suffixes); + return [$ignore, $standard, $suffixes]; } /** @@ -241,6 +241,6 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } } - return array($errors, $warnings); + return [$errors, $warnings]; } } diff --git a/src/PHPCI/Plugin/PhpCpd.php b/src/PHPCI/Plugin/PhpCpd.php index f14d55f4..e0aed69d 100644 --- a/src/PHPCI/Plugin/PhpCpd.php +++ b/src/PHPCI/Plugin/PhpCpd.php @@ -44,7 +44,7 @@ class PhpCpd implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; diff --git a/src/PHPCI/Plugin/PhpCsFixer.php b/src/PHPCI/Plugin/PhpCsFixer.php index 9aa0d33f..fdf992b3 100644 --- a/src/PHPCI/Plugin/PhpCsFixer.php +++ b/src/PHPCI/Plugin/PhpCsFixer.php @@ -35,7 +35,7 @@ class PhpCsFixer implements \PHPCI\Plugin protected $level = ' --level=psr2'; protected $verbose = ''; protected $diff = ''; - protected $levels = array('psr0', 'psr1', 'psr2', 'symfony'); + protected $levels = ['psr0', 'psr1', 'psr2', 'symfony']; /** * Standard Constructor @@ -49,7 +49,7 @@ class PhpCsFixer implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; diff --git a/src/PHPCI/Plugin/PhpDocblockChecker.php b/src/PHPCI/Plugin/PhpDocblockChecker.php index 2396497c..220acd6c 100644 --- a/src/PHPCI/Plugin/PhpDocblockChecker.php +++ b/src/PHPCI/Plugin/PhpDocblockChecker.php @@ -67,7 +67,7 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; diff --git a/src/PHPCI/Plugin/PhpLoc.php b/src/PHPCI/Plugin/PhpLoc.php index c8dedb91..37b4479c 100644 --- a/src/PHPCI/Plugin/PhpLoc.php +++ b/src/PHPCI/Plugin/PhpLoc.php @@ -52,7 +52,7 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -85,7 +85,7 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin $output = $this->phpci->getLastOutput(); if (preg_match_all('/\((LOC|CLOC|NCLOC|LLOC)\)\s+([0-9]+)/', $output, $matches)) { - $data = array(); + $data = []; foreach ($matches[1] as $k => $v) { $data[$v] = (int)$matches[2][$k]; } diff --git a/src/PHPCI/Plugin/PhpMessDetector.php b/src/PHPCI/Plugin/PhpMessDetector.php index ec92bc61..1174c476 100644 --- a/src/PHPCI/Plugin/PhpMessDetector.php +++ b/src/PHPCI/Plugin/PhpMessDetector.php @@ -83,14 +83,14 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; - $this->suffixes = array('php'); + $this->suffixes = ['php']; $this->ignore = $phpci->ignore; $this->path = ''; - $this->rules = array('codesize', 'unusedcode', 'naming'); + $this->rules = ['codesize', 'unusedcode', 'naming']; $this->allowed_warnings = 0; if (isset($options['zero_config']) && $options['zero_config']) { @@ -105,7 +105,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin $this->allowed_warnings = (int)$options['allowed_warnings']; } - foreach (array('rules', 'ignore', 'suffixes') as $key) { + foreach (['rules', 'ignore', 'suffixes'] as $key) { $this->overrideSetting($options, $key); } } diff --git a/src/PHPCI/Plugin/PhpParallelLint.php b/src/PHPCI/Plugin/PhpParallelLint.php index febed528..e7cbc98a 100644 --- a/src/PHPCI/Plugin/PhpParallelLint.php +++ b/src/PHPCI/Plugin/PhpParallelLint.php @@ -53,7 +53,7 @@ class PhpParallelLint implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -87,7 +87,7 @@ class PhpParallelLint implements \PHPCI\Plugin $output = $this->phpci->getLastOutput(); - $matches = array(); + $matches = []; if (preg_match_all('/Parse error\:/', $output, $matches)) { $this->build->storeMeta('phplint-errors', count($matches[0])); } @@ -101,12 +101,12 @@ class PhpParallelLint implements \PHPCI\Plugin */ protected function getFlags() { - $ignoreFlags = array(); + $ignoreFlags = []; foreach ($this->ignore as $ignoreDir) { $ignoreFlags[] = '--exclude "' . $this->phpci->buildPath . $ignoreDir . '"'; } $ignore = implode(' ', $ignoreFlags); - return array($ignore); + return [$ignore]; } } diff --git a/src/PHPCI/Plugin/PhpSpec.php b/src/PHPCI/Plugin/PhpSpec.php index e468a718..70521bb2 100644 --- a/src/PHPCI/Plugin/PhpSpec.php +++ b/src/PHPCI/Plugin/PhpSpec.php @@ -42,7 +42,7 @@ class PhpSpec implements PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -57,7 +57,7 @@ class PhpSpec implements PHPCI\Plugin $curdir = getcwd(); chdir($this->phpci->buildPath); - $phpspec = $this->phpci->findBinary(array('phpspec', 'phpspec.php')); + $phpspec = $this->phpci->findBinary(['phpspec', 'phpspec.php']); $success = $this->phpci->executeCommand($phpspec . ' --format=junit --no-code-generation run'); $output = $this->phpci->getLastOutput(); @@ -76,47 +76,45 @@ class PhpSpec implements PHPCI\Plugin $xml = new \SimpleXMLElement($output); $attr = $xml->attributes(); - $data = array( - 'time' => (float)$attr['time'], - 'tests' => (int)$attr['tests'], + $data = [ + 'time' => (float)$attr['time'], + 'tests' => (int)$attr['tests'], 'failures' => (int)$attr['failures'], - 'errors' => (int)$attr['errors'], - + 'errors' => (int)$attr['errors'], // now all the tests - 'suites' => array() - ); + 'suites' => [] + ]; /** * @var \SimpleXMLElement $group */ foreach ($xml->xpath('testsuite') as $group) { - $attr = $group->attributes(); - $suite = array( - 'name' => (String)$attr['name'], - 'time' => (float)$attr['time'], - 'tests' => (int)$attr['tests'], + $attr = $group->attributes(); + $suite = [ + 'name' => (String)$attr['name'], + 'time' => (float)$attr['time'], + 'tests' => (int)$attr['tests'], 'failures' => (int)$attr['failures'], - 'errors' => (int)$attr['errors'], - 'skipped' => (int)$attr['skipped'], - + 'errors' => (int)$attr['errors'], + 'skipped' => (int)$attr['skipped'], // now the cases - 'cases' => array() - ); + 'cases' => [] + ]; /** * @var \SimpleXMLElement $child */ foreach ($group->xpath('testcase') as $child) { $attr = $child->attributes(); - $case = array( - 'name' => (String)$attr['name'], + $case = [ + 'name' => (String)$attr['name'], 'classname' => (String)$attr['classname'], - 'time' => (float)$attr['time'], - 'status' => (String)$attr['status'], - ); + 'time' => (float)$attr['time'], + 'status' => (String)$attr['status'], + ]; if ($case['status']=='failed') { - $error = array(); + $error = []; /* * ok, sad, we had an error * diff --git a/src/PHPCI/Plugin/PhpTalLint.php b/src/PHPCI/Plugin/PhpTalLint.php index 8513ec36..fe9fefa1 100644 --- a/src/PHPCI/Plugin/PhpTalLint.php +++ b/src/PHPCI/Plugin/PhpTalLint.php @@ -54,7 +54,7 @@ class PhpTalLint implements PHPCI\Plugin /** * @var array The results of the lint scan */ - protected $failedPaths = array(); + protected $failedPaths = []; /** * Standard Constructor @@ -63,19 +63,19 @@ class PhpTalLint implements PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; - $this->directories = array(''); - $this->suffixes = array('zpt'); + $this->directories = ['']; + $this->suffixes = ['zpt']; $this->ignore = $phpci->ignore; $this->allowed_warnings = 0; $this->allowed_errors = 0; if (!empty($options['directory'])) { - $this->directories = array($options['directory']); + $this->directories = [$options['directory']]; } if (isset($options['suffixes'])) { @@ -91,7 +91,7 @@ class PhpTalLint implements PHPCI\Plugin */ protected function setOptions($options) { - foreach (array('directories', 'tales', 'allowed_warnings', 'allowed_errors') as $key) { + foreach (['directories', 'tales', 'allowed_warnings', 'allowed_errors'] as $key) { if (array_key_exists($key, $options)) { $this->{$key} = $options[$key]; } @@ -230,12 +230,12 @@ class PhpTalLint implements PHPCI\Plugin $message = trim($parts[0]); $line = str_replace(')', '', $parts[1]); - $this->failedPaths[] = array( - 'file' => $path, - 'line' => $line, - 'type' => $matches[2], + $this->failedPaths[] = [ + 'file' => $path, + 'line' => $line, + 'type' => $matches[2], 'message' => $message - ); + ]; } $success = false; @@ -260,6 +260,6 @@ class PhpTalLint implements PHPCI\Plugin $suffixes = ' -e ' . implode(',', $this->suffixes); } - return array($suffixes, $tales); + return [$suffixes, $tales]; } } diff --git a/src/PHPCI/Plugin/PhpUnit.php b/src/PHPCI/Plugin/PhpUnit.php index f716f079..82c77a87 100644 --- a/src/PHPCI/Plugin/PhpUnit.php +++ b/src/PHPCI/Plugin/PhpUnit.php @@ -103,7 +103,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -190,7 +190,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin protected function runConfigFile($configPath) { if (is_array($configPath)) { - return $this->recurseArg($configPath, array($this, "runConfigFile")); + return $this->recurseArg($configPath, [$this, "runConfigFile"]); } else { if ($this->runFrom) { $curdir = getcwd(); @@ -218,7 +218,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin protected function runDir($directory) { if (is_array($directory)) { - return $this->recurseArg($directory, array($this, "runDir")); + return $this->recurseArg($directory, [$this, "runDir"]); } else { $curdir = getcwd(); chdir($this->phpci->buildPath); diff --git a/src/PHPCI/Plugin/Shell.php b/src/PHPCI/Plugin/Shell.php index 5e914f3e..afb2659b 100644 --- a/src/PHPCI/Plugin/Shell.php +++ b/src/PHPCI/Plugin/Shell.php @@ -36,7 +36,7 @@ class Shell implements \PHPCI\Plugin /** * @var string[] $commands The commands to be executed */ - protected $commands = array(); + protected $commands = []; /** * Standard Constructor @@ -50,7 +50,7 @@ class Shell implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -58,7 +58,7 @@ class Shell implements \PHPCI\Plugin if (isset($options['command'])) { // Keeping this for backwards compatibility, new projects should use interpolation vars. $options['command'] = str_replace("%buildpath%", $this->phpci->buildPath, $options['command']); - $this->commands = array($options['command']); + $this->commands = [$options['command']]; return; } diff --git a/src/PHPCI/Plugin/SlackNotify.php b/src/PHPCI/Plugin/SlackNotify.php index 0e8d1cad..e3fd5fdc 100644 --- a/src/PHPCI/Plugin/SlackNotify.php +++ b/src/PHPCI/Plugin/SlackNotify.php @@ -33,7 +33,7 @@ class SlackNotify implements \PHPCI\Plugin * @param array $options * @throws \Exception */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -112,18 +112,18 @@ class SlackNotify implements \PHPCI\Plugin } // Build up the attachment data - $attachment = new \Maknz\Slack\Attachment(array( + $attachment = new \Maknz\Slack\Attachment([ 'fallback' => $body, 'pretext' => $body, 'color' => $color, - 'fields' => array( - new \Maknz\Slack\AttachmentField(array( + 'fields' => [ + new \Maknz\Slack\AttachmentField([ 'title' => 'Status', 'value' => $status, 'short' => false - )) - ) - )); + ]) + ] + ]); $message->attach($attachment); diff --git a/src/PHPCI/Plugin/Sqlite.php b/src/PHPCI/Plugin/Sqlite.php index f80ece3d..3b0c267a 100644 --- a/src/PHPCI/Plugin/Sqlite.php +++ b/src/PHPCI/Plugin/Sqlite.php @@ -34,7 +34,7 @@ class Sqlite implements \PHPCI\Plugin /** * @var array */ - protected $queries = array(); + protected $queries = []; /** * @var string @@ -46,7 +46,7 @@ class Sqlite implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -66,8 +66,8 @@ class Sqlite implements \PHPCI\Plugin public function execute() { try { - $opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION); - $pdo = new PDO('sqlite:' . $this->path, $opts); + $opts = [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]; + $pdo = new PDO('sqlite:' . $this->path, $opts); foreach ($this->queries as $query) { $pdo->query($this->phpci->interpolate($query)); diff --git a/src/PHPCI/Plugin/TechnicalDebt.php b/src/PHPCI/Plugin/TechnicalDebt.php index 6d4711b5..f4f1de36 100755 --- a/src/PHPCI/Plugin/TechnicalDebt.php +++ b/src/PHPCI/Plugin/TechnicalDebt.php @@ -81,16 +81,16 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin * @param \PHPCI\Model\Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; - $this->suffixes = array('php'); + $this->suffixes = ['php']; $this->directory = $phpci->buildPath; $this->path = ''; $this->ignore = $this->phpci->ignore; $this->allowed_errors = 0; - $this->searches = array('TODO', 'FIXME', 'TO DO', 'FIX ME'); + $this->searches = ['TODO', 'FIXME', 'TO DO', 'FIX ME']; if (isset($options['searches']) && is_array($options['searches'])) { $this->searches = $options['searches']; @@ -109,7 +109,7 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin */ protected function setOptions($options) { - foreach (array('directory', 'path', 'ignore', 'allowed_errors') as $key) { + foreach (['directory', 'path', 'ignore', 'allowed_errors'] as $key) { if (array_key_exists($key, $options)) { $this->{$key} = $options[$key]; } @@ -145,10 +145,10 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin public function getErrorList() { $dirIterator = new \RecursiveDirectoryIterator($this->directory); - $iterator = new \RecursiveIteratorIterator($dirIterator, \RecursiveIteratorIterator::SELF_FIRST); - $files = array(); + $iterator = new \RecursiveIteratorIterator($dirIterator, \RecursiveIteratorIterator::SELF_FIRST); + $files = []; - $ignores = $this->ignore; + $ignores = $this->ignore; $ignores[] = 'phpci.yml'; $ignores[] = '.phpci.yml'; diff --git a/src/PHPCI/Plugin/Util/ComposerPluginInformation.php b/src/PHPCI/Plugin/Util/ComposerPluginInformation.php index d8dcc91f..c9383e61 100644 --- a/src/PHPCI/Plugin/Util/ComposerPluginInformation.php +++ b/src/PHPCI/Plugin/Util/ComposerPluginInformation.php @@ -29,7 +29,7 @@ class ComposerPluginInformation implements InstalledPluginInformation if (file_exists($filePath)) { $installed = json_decode(file_get_contents($filePath)); } else { - $installed = array(); + $installed = []; } return new self($installed); } @@ -80,7 +80,7 @@ class ComposerPluginInformation implements InstalledPluginInformation if ($this->pluginInfo !== null) { return; } - $this->pluginInfo = array(); + $this->pluginInfo = []; foreach ($this->composerPackages as $package) { $this->addPluginsFromPackage($package); } diff --git a/src/PHPCI/Plugin/Util/Executor.php b/src/PHPCI/Plugin/Util/Executor.php index bdd06b7e..b4af0765 100644 --- a/src/PHPCI/Plugin/Util/Executor.php +++ b/src/PHPCI/Plugin/Util/Executor.php @@ -49,8 +49,8 @@ class Executor */ public function executePlugins(&$config, $stage) { - $success = true; - $pluginsToExecute = array(); + $success = true; + $pluginsToExecute = []; // If we have global plugins to execute for this stage, add them to the list to be executed: if (array_key_exists($stage, $config) && is_array($config[$stage])) { @@ -99,7 +99,7 @@ class Executor switch ($runOption) { // Replace standard plugin set for this stage with just the branch-specific ones: case 'replace': - $pluginsToExecute = array(); + $pluginsToExecute = []; $pluginsToExecute[] = $plugins; break; @@ -207,7 +207,7 @@ class Executor $summary = $this->getBuildSummary(); if (!isset($summary[$stage][$plugin])) { - $summary[$stage][$plugin] = array(); + $summary[$stage][$plugin] = []; } $summary[$stage][$plugin]['status'] = $status; @@ -230,7 +230,7 @@ class Executor { $build = $this->pluginFactory->getResourceFor('PHPCI\Model\Build'); $metas = $this->store->getMeta('plugin-summary', $build->getProjectId(), $build->getId()); - return isset($metas[0]['meta_value']) ? $metas[0]['meta_value'] : array(); + return isset($metas[0]['meta_value']) ? $metas[0]['meta_value'] : []; } /** diff --git a/src/PHPCI/Plugin/Util/Factory.php b/src/PHPCI/Plugin/Util/Factory.php index 48bc564d..14633bca 100644 --- a/src/PHPCI/Plugin/Util/Factory.php +++ b/src/PHPCI/Plugin/Util/Factory.php @@ -82,7 +82,7 @@ class Factory * @throws \InvalidArgumentException if $className doesn't represent a valid plugin * @return \PHPCI\Plugin */ - public function buildPlugin($className, $options = array()) + public function buildPlugin($className, $options = []) { $this->currentPluginOptions = $options; @@ -97,7 +97,7 @@ class Factory $constructor = $reflectedPlugin->getConstructor(); if ($constructor) { - $argsToUse = array(); + $argsToUse = []; foreach ($constructor->getParameters() as $param) { $argsToUse = $this->addArgFromParam($argsToUse, $param); } diff --git a/src/PHPCI/Plugin/Util/FilesPluginInformation.php b/src/PHPCI/Plugin/Util/FilesPluginInformation.php index 35587283..314eabd8 100644 --- a/src/PHPCI/Plugin/Util/FilesPluginInformation.php +++ b/src/PHPCI/Plugin/Util/FilesPluginInformation.php @@ -81,7 +81,7 @@ class FilesPluginInformation implements InstalledPluginInformation */ protected function loadPluginInfo() { - $this->pluginInfo = array(); + $this->pluginInfo = []; foreach ($this->files as $fileInfo) { if ($fileInfo instanceof \SplFileInfo) { if ($fileInfo->isFile() && $fileInfo->getExtension() == 'php') { @@ -118,14 +118,14 @@ class FilesPluginInformation implements InstalledPluginInformation protected function getFullClassFromFile(\SplFileInfo $fileInfo) { $contents = file_get_contents($fileInfo->getRealPath()); - $matches = array(); + $matches = []; preg_match('#class +([A-Za-z]+) +implements#i', $contents, $matches); if (isset($matches[1])) { $className = $matches[1]; - $matches = array(); + $matches = []; preg_match('#namespace +([A-Za-z\\\\]+);#i', $contents, $matches); $namespace = $matches[1]; diff --git a/src/PHPCI/Plugin/Util/PluginInformationCollection.php b/src/PHPCI/Plugin/Util/PluginInformationCollection.php index 906935e5..b5e5be68 100644 --- a/src/PHPCI/Plugin/Util/PluginInformationCollection.php +++ b/src/PHPCI/Plugin/Util/PluginInformationCollection.php @@ -11,7 +11,7 @@ class PluginInformationCollection implements InstalledPluginInformation /** * @var InstalledPluginInformation[] */ - protected $pluginInformations = array(); + protected $pluginInformations = []; /** * Add a plugin to the collection. @@ -31,7 +31,7 @@ class PluginInformationCollection implements InstalledPluginInformation */ public function getInstalledPlugins() { - $arr = array(); + $arr = []; foreach ($this->pluginInformations as $single) { $arr = array_merge($arr, $single->getInstalledPlugins()); @@ -48,7 +48,7 @@ class PluginInformationCollection implements InstalledPluginInformation */ public function getPluginClasses() { - $arr = array(); + $arr = []; foreach ($this->pluginInformations as $single) { $arr = array_merge($arr, $single->getPluginClasses()); diff --git a/src/PHPCI/Plugin/Util/TapParser.php b/src/PHPCI/Plugin/Util/TapParser.php index 86981566..5b6a49d1 100644 --- a/src/PHPCI/Plugin/Util/TapParser.php +++ b/src/PHPCI/Plugin/Util/TapParser.php @@ -68,7 +68,7 @@ class TapParser $this->lineNumber = 0; $this->testCount = false; - $this->results = array(); + $this->results = []; $header = $this->findTapLog(); @@ -208,11 +208,11 @@ class TapParser */ protected function processTestLine($result, $message, $directive, $reason) { - $test = array( + $test = [ 'pass' => true, 'message' => $message, 'severity' => 'success', - ); + ]; if ($result !== 'ok') { $test['pass'] = false; @@ -237,7 +237,7 @@ class TapParser { $startLine = $this->lineNumber + 1; $endLine = $indent . '...'; - $yamlLines = array(); + $yamlLines = []; do { $line = $this->nextLine(); diff --git a/src/PHPCI/Plugin/Util/TestResultParsers/Codeception.php b/src/PHPCI/Plugin/Util/TestResultParsers/Codeception.php index 24af62e4..efed1833 100644 --- a/src/PHPCI/Plugin/Util/TestResultParsers/Codeception.php +++ b/src/PHPCI/Plugin/Util/TestResultParsers/Codeception.php @@ -38,7 +38,7 @@ class Codeception implements ParserInterface */ public function parse() { - $rtn = array(); + $rtn = []; $this->results = new \SimpleXMLElement($this->resultsXml); @@ -50,14 +50,14 @@ class Codeception implements ParserInterface $this->totalErrors += (int) $testsuite['errors']; foreach ($testsuite->testcase as $testcase) { - $testresult = array( - 'suite' => (string) $testsuite['name'], - 'file' => str_replace($this->phpci->buildPath, '/', (string) $testcase['file']), - 'name' => (string) $testcase['name'], - 'feature' => (string) $testcase['feature'], + $testresult = [ + 'suite' => (string) $testsuite['name'], + 'file' => str_replace($this->phpci->buildPath, '/', (string) $testcase['file']), + 'name' => (string) $testcase['name'], + 'feature' => (string) $testcase['feature'], 'assertions' => (int) $testcase['assertions'], - 'time' => (float) $testcase['time'] - ); + 'time' => (float) $testcase['time'] + ]; if (isset($testcase['class'])) { $testresult['class'] = (string) $testcase['class']; diff --git a/src/PHPCI/Plugin/Wipe.php b/src/PHPCI/Plugin/Wipe.php index e6b619a0..e448a939 100644 --- a/src/PHPCI/Plugin/Wipe.php +++ b/src/PHPCI/Plugin/Wipe.php @@ -38,7 +38,7 @@ class Wipe implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $path = $phpci->buildPath; $this->phpci = $phpci; diff --git a/src/PHPCI/Plugin/Xmpp.php b/src/PHPCI/Plugin/Xmpp.php index ccfc4399..fc702bf8 100644 --- a/src/PHPCI/Plugin/Xmpp.php +++ b/src/PHPCI/Plugin/Xmpp.php @@ -65,7 +65,7 @@ class XMPP implements \PHPCI\Plugin * @param Build $build * @param array $options */ - public function __construct(Builder $phpci, Build $build, array $options = array()) + public function __construct(Builder $phpci, Build $build, array $options = []) { $this->phpci = $phpci; $this->build = $build; @@ -74,7 +74,7 @@ class XMPP implements \PHPCI\Plugin $this->password = ''; $this->server = ''; $this->alias = ''; - $this->recipients = array(); + $this->recipients = []; $this->tls = false; $this->date_format = '%c'; @@ -83,7 +83,7 @@ class XMPP implements \PHPCI\Plugin */ if (!empty($options['recipients'])) { if (is_string($options['recipients'])) { - $this->recipients = array($options['recipients']); + $this->recipients = [$options['recipients']]; } elseif (is_array($options['recipients'])) { $this->recipients = $options['recipients']; } @@ -99,7 +99,7 @@ class XMPP implements \PHPCI\Plugin */ protected function setOptions($options) { - foreach (array('username', 'password', 'alias', 'tls', 'server', 'date_format') as $key) { + foreach (['username', 'password', 'alias', 'tls', 'server', 'date_format'] as $key) { if (array_key_exists($key, $options)) { $this->{$key} = $options[$key]; } diff --git a/src/PHPCI/Service/BuildService.php b/src/PHPCI/Service/BuildService.php index a120a64e..9dff03cf 100644 --- a/src/PHPCI/Service/BuildService.php +++ b/src/PHPCI/Service/BuildService.php @@ -159,15 +159,15 @@ class BuildService return; } - $config = Config::getInstance(); + $config = Config::getInstance(); $settings = $config->get('phpci.worker', []); if (!empty($settings['host']) && !empty($settings['queue'])) { try { - $jobData = array( - 'type' => 'phpci.build', + $jobData = [ + 'type' => 'phpci.build', 'build_id' => $build->getId(), - ); + ]; if ($config->get('using_custom_file')) { $jobData['config'] = $config->getArray(); diff --git a/src/PHPCI/Service/BuildStatusService.php b/src/PHPCI/Service/BuildStatusService.php index b4f3c009..977a7ec0 100644 --- a/src/PHPCI/Service/BuildStatusService.php +++ b/src/PHPCI/Service/BuildStatusService.php @@ -34,10 +34,10 @@ class BuildStatusService protected $url; /** @var array */ - protected $finishedStatusIds = array( + protected $finishedStatusIds = [ Build::STATUS_SUCCESS, Build::STATUS_FAILED, - ); + ]; /** * @param $branch @@ -208,15 +208,15 @@ class BuildStatusService public function toArray() { if (!$this->build) { - return array(); + return []; } - return array( - 'name' => $this->getName(), - 'activity' => $this->getActivity(), - 'lastBuildLabel' => $this->getLastBuildLabel(), + return [ + 'name' => $this->getName(), + 'activity' => $this->getActivity(), + 'lastBuildLabel' => $this->getLastBuildLabel(), 'lastBuildStatus' => $this->getLastBuildStatus(), - 'lastBuildTime' => $this->getLastBuildTime(), - 'webUrl' => $this->getBuildUrl(), - ); + 'lastBuildTime' => $this->getLastBuildTime(), + 'webUrl' => $this->getBuildUrl(), + ]; } } diff --git a/src/PHPCI/Service/ProjectService.php b/src/PHPCI/Service/ProjectService.php index 8b07b0a9..e7d3d4b8 100644 --- a/src/PHPCI/Service/ProjectService.php +++ b/src/PHPCI/Service/ProjectService.php @@ -40,7 +40,7 @@ class ProjectService * @param array $options * @return \PHPCI\Model\Project */ - public function createProject($title, $type, $reference, $options = array()) + public function createProject($title, $type, $reference, $options = []) { // Create base project and use updateProject() to set its properties: $project = new Project(); @@ -56,7 +56,7 @@ class ProjectService * @param array $options * @return \PHPCI\Model\Project */ - public function updateProject(Project $project, $title, $type, $reference, $options = array()) + public function updateProject(Project $project, $title, $type, $reference, $options = []) { // Set basic properties: $project->setTitle($title); @@ -117,11 +117,11 @@ class ProjectService */ protected function processAccessInformation(Project &$project) { - $matches = array(); + $matches = []; $reference = $project->getReference(); if ($project->getType() == 'gitlab') { - $info = array(); + $info = []; if (preg_match('`^(.+)@(.+):([0-9]*)\/?(.+)\.git`', $reference, $matches)) { $info['user'] = $matches[1]; diff --git a/src/PHPCI/Store/Base/BuildErrorStoreBase.php b/src/PHPCI/Store/Base/BuildErrorStoreBase.php index 627b9d54..e1b3c209 100644 --- a/src/PHPCI/Store/Base/BuildErrorStoreBase.php +++ b/src/PHPCI/Store/Base/BuildErrorStoreBase.php @@ -77,9 +77,9 @@ class BuildErrorStoreBase extends Store $count = count($rtn); - return array('items' => $rtn, 'count' => $count); + return ['items' => $rtn, 'count' => $count]; } else { - return array('items' => array(), 'count' => 0); + return ['items' => [], 'count' => 0]; } } } diff --git a/src/PHPCI/Store/Base/BuildMetaStoreBase.php b/src/PHPCI/Store/Base/BuildMetaStoreBase.php index 52665d79..9e610eaa 100644 --- a/src/PHPCI/Store/Base/BuildMetaStoreBase.php +++ b/src/PHPCI/Store/Base/BuildMetaStoreBase.php @@ -77,9 +77,9 @@ class BuildMetaStoreBase extends Store $count = count($rtn); - return array('items' => $rtn, 'count' => $count); + return ['items' => $rtn, 'count' => $count]; } else { - return array('items' => array(), 'count' => 0); + return ['items' => [], 'count' => 0]; } } @@ -109,9 +109,9 @@ class BuildMetaStoreBase extends Store $count = count($rtn); - return array('items' => $rtn, 'count' => $count); + return ['items' => $rtn, 'count' => $count]; } else { - return array('items' => array(), 'count' => 0); + return ['items' => [], 'count' => 0]; } } } diff --git a/src/PHPCI/Store/Base/BuildStoreBase.php b/src/PHPCI/Store/Base/BuildStoreBase.php index b8b49cb7..7bc09b46 100644 --- a/src/PHPCI/Store/Base/BuildStoreBase.php +++ b/src/PHPCI/Store/Base/BuildStoreBase.php @@ -77,9 +77,9 @@ class BuildStoreBase extends Store $count = count($rtn); - return array('items' => $rtn, 'count' => $count); + return ['items' => $rtn, 'count' => $count]; } else { - return array('items' => array(), 'count' => 0); + return ['items' => [], 'count' => 0]; } } @@ -109,9 +109,9 @@ class BuildStoreBase extends Store $count = count($rtn); - return array('items' => $rtn, 'count' => $count); + return ['items' => $rtn, 'count' => $count]; } else { - return array('items' => array(), 'count' => 0); + return ['items' => [], 'count' => 0]; } } } diff --git a/src/PHPCI/Store/Base/ProjectStoreBase.php b/src/PHPCI/Store/Base/ProjectStoreBase.php index 1e2bf65b..8df0e74b 100644 --- a/src/PHPCI/Store/Base/ProjectStoreBase.php +++ b/src/PHPCI/Store/Base/ProjectStoreBase.php @@ -77,9 +77,9 @@ class ProjectStoreBase extends Store $count = count($rtn); - return array('items' => $rtn, 'count' => $count); + return ['items' => $rtn, 'count' => $count]; } else { - return array('items' => array(), 'count' => 0); + return ['items' => [], 'count' => 0]; } } @@ -109,9 +109,9 @@ class ProjectStoreBase extends Store $count = count($rtn); - return array('items' => $rtn, 'count' => $count); + return ['items' => $rtn, 'count' => $count]; } else { - return array('items' => array(), 'count' => 0); + return ['items' => [], 'count' => 0]; } } } diff --git a/src/PHPCI/Store/Base/UserStoreBase.php b/src/PHPCI/Store/Base/UserStoreBase.php index 105ccd3e..724b3dd0 100644 --- a/src/PHPCI/Store/Base/UserStoreBase.php +++ b/src/PHPCI/Store/Base/UserStoreBase.php @@ -100,9 +100,9 @@ class UserStoreBase extends Store $count = count($rtn); - return array('items' => $rtn, 'count' => $count); + return ['items' => $rtn, 'count' => $count]; } else { - return array('items' => array(), 'count' => 0); + return ['items' => [], 'count' => 0]; } } } diff --git a/src/PHPCI/Store/BuildErrorStore.php b/src/PHPCI/Store/BuildErrorStore.php index c2d32468..d8925ac7 100644 --- a/src/PHPCI/Store/BuildErrorStore.php +++ b/src/PHPCI/Store/BuildErrorStore.php @@ -51,7 +51,7 @@ class BuildErrorStore extends BuildErrorStoreBase return $rtn; } else { - return array(); + return []; } } diff --git a/src/PHPCI/Store/BuildMetaStore.php b/src/PHPCI/Store/BuildMetaStore.php index f932bc11..6d9f0293 100644 --- a/src/PHPCI/Store/BuildMetaStore.php +++ b/src/PHPCI/Store/BuildMetaStore.php @@ -45,7 +45,7 @@ class BuildMetaStore extends BuildMetaStoreBase return $rtn; } else { - return array(); + return []; } } } diff --git a/src/PHPCI/Store/BuildStore.php b/src/PHPCI/Store/BuildStore.php index d6feb084..6321ae19 100644 --- a/src/PHPCI/Store/BuildStore.php +++ b/src/PHPCI/Store/BuildStore.php @@ -53,7 +53,7 @@ class BuildStore extends BuildStoreBase return $rtn; } else { - return array(); + return []; } } @@ -75,7 +75,7 @@ class BuildStore extends BuildStoreBase return new Build($data); } } else { - return array(); + return []; } } @@ -101,9 +101,9 @@ class BuildStore extends BuildStoreBase $rtn = array_map($map, $res); - return array('items' => $rtn, 'count' => count($rtn)); + return ['items' => $rtn, 'count' => count($rtn)]; } else { - return array('items' => array(), 'count' => 0); + return ['items' => [], 'count' => 0]; } } @@ -124,7 +124,7 @@ class BuildStore extends BuildStoreBase $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); return $res; } else { - return array(); + return []; } } diff --git a/src/PHPCI/Store/ProjectStore.php b/src/PHPCI/Store/ProjectStore.php index ea46d82b..80fc1485 100644 --- a/src/PHPCI/Store/ProjectStore.php +++ b/src/PHPCI/Store/ProjectStore.php @@ -42,7 +42,7 @@ class ProjectStore extends ProjectStoreBase return $rtn; } else { - return array(); + return []; } } @@ -66,9 +66,9 @@ class ProjectStore extends ProjectStoreBase $count = count($rtn); - return array('items' => $rtn, 'count' => $count); + return ['items' => $rtn, 'count' => $count]; } else { - return array('items' => array(), 'count' => 0); + return ['items' => [], 'count' => 0]; } } @@ -101,9 +101,9 @@ class ProjectStore extends ProjectStoreBase $count = count($rtn); - return array('items' => $rtn, 'count' => $count); + return ['items' => $rtn, 'count' => $count]; } else { - return array('items' => array(), 'count' => 0); + return ['items' => [], 'count' => 0]; } } } diff --git a/src/PHPCI/View/Project/view.phtml b/src/PHPCI/View/Project/view.phtml index 79b7ef0e..8a553b63 100644 --- a/src/PHPCI/View/Project/view.phtml +++ b/src/PHPCI/View/Project/view.phtml @@ -67,7 +67,7 @@
- getType(), array('github', 'gitlab', 'bitbucket'))): ?> + getType(), ['github', 'gitlab', 'bitbucket'])): ?>

diff --git a/src/PHPCI/View/SummaryTable.phtml b/src/PHPCI/View/SummaryTable.phtml index 5e2192b4..c6c84860 100644 --- a/src/PHPCI/View/SummaryTable.phtml +++ b/src/PHPCI/View/SummaryTable.phtml @@ -2,13 +2,12 @@ use PHPCI\Helper\Lang; foreach($projects as $project): - $statuses = array(); + $statuses = []; $failures = 0; - $subcls = 'yellow'; - $cls = ''; - - $success = null; - $failure = null; + $subcls = 'yellow'; + $cls = ''; + $success = null; + $failure = null; if (count($builds[$project->getId()])) { // Get the most recent build status to determine the main block colour. diff --git a/tests/B8Framework/CodeGenerationTest.php b/tests/B8Framework/CodeGenerationTest.php index e15afab4..218662e6 100644 --- a/tests/B8Framework/CodeGenerationTest.php +++ b/tests/B8Framework/CodeGenerationTest.php @@ -383,7 +383,7 @@ class CodeGenerationTest extends \PHPUnit_Framework_TestCase try { - $uno->getWhere(array('invalid_column' => 1)); + $uno->getWhere(['invalid_column' => 1]); } catch(Exception $ex) { @@ -392,24 +392,24 @@ class CodeGenerationTest extends \PHPUnit_Framework_TestCase $this->assertTrue($caught); - $res = $uno->getWhere(array('id' => 1), 1, 0, array(), 'rand', array('LEFT JOIN dos d ON d.id = uno.id')); + $res = $uno->getWhere(['id' => 1], 1, 0, [], 'rand', ['LEFT JOIN dos d ON d.id = uno.id']); $this->assertTrue($res['count'] != 0); - $res = $uno->getWhere(array('id' => 1), 1, 0, array(), 'rand', array(), 'field_varchar'); + $res = $uno->getWhere(['id' => 1], 1, 0, [], 'rand', [], 'field_varchar'); $this->assertTrue($res['count'] != 0); - $res = $uno->getWhere(array(), 1, 0, array(), 'rand', array(), null, array(array('type' => 'AND', 'query' => 'id = 1', 'params' => array()))); + $res = $uno->getWhere([], 1, 0, [], 'rand', [], null, [['type' => 'AND', 'query' => 'id = 1', 'params' => []]]); $this->assertTrue($res['count'] != 0); - $res = $uno->getWhere(array('id' => 2), 1, 0, array(), 'rand', array(), null, array(array('type' => 'AND', 'query' => 'id = ?', 'params' => array('id')))); + $res = $uno->getWhere(['id' => 2], 1, 0, [], 'rand', [], null, [['type' => 'AND', 'query' => 'id = ?', 'params' => ['id']]]); $this->assertTrue($res['count'] == 0); $caught = false; try { - $uno->getWhere(array('' => 1)); + $uno->getWhere(['' => 1]); } catch(Exception $ex) { @@ -610,14 +610,14 @@ class CodeGenerationTest extends \PHPUnit_Framework_TestCase //---- // Tests for _parseWhere() //---- - $uno->setParam('where', array('id' => array(1000))); + $uno->setParam('where', ['id' => [1000]]); $uno->setParam('neq', 'id'); $list = $uno->index(); $this->assertTrue(is_array($list)); $this->assertTrue(count($list['items']) != 0); - $uno->setParam('where', array('id' => 1000)); + $uno->setParam('where', ['id' => 1000]); $uno->setParam('fuzzy', 'id'); $list = $uno->index(); diff --git a/tests/B8Framework/DatabaseGenerationTest.php b/tests/B8Framework/DatabaseGenerationTest.php index 13865ff2..2042dfe3 100644 --- a/tests/B8Framework/DatabaseGenerationTest.php +++ b/tests/B8Framework/DatabaseGenerationTest.php @@ -15,7 +15,7 @@ class DatabaseGenerationTest extends \PHPUnit_Framework_TestCase public function setUp() { Database::setDetails($this->_name, $this->_user, $this->_pass); - Database::setWriteServers(array($this->_host)); + Database::setWriteServers([$this->_host]); $this->_db = Database::getConnection('write'); diff --git a/tests/B8Framework/DatabaseTest.php b/tests/B8Framework/DatabaseTest.php index 575b313a..fb5dfee8 100755 --- a/tests/B8Framework/DatabaseTest.php +++ b/tests/B8Framework/DatabaseTest.php @@ -14,7 +14,7 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase public function testGetReadConnection() { Database::setDetails($this->_name, $this->_user, $this->_pass); - Database::setReadServers(array($this->_host)); + Database::setReadServers([$this->_host]); $connection = Database::getConnection('read'); @@ -24,7 +24,7 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase public function testGetWriteConnection() { Database::setDetails($this->_name, $this->_user, $this->_pass); - Database::setWriteServers(array($this->_host)); + Database::setWriteServers([$this->_host]); $connection = Database::getConnection('write'); @@ -34,7 +34,7 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase public function testGetDetails() { Database::setDetails($this->_name, $this->_user, $this->_pass); - Database::setReadServers(array('localhost')); + Database::setReadServers(['localhost']); $details = Database::getConnection('read')->getDetails(); $this->assertTrue(is_array($details)); @@ -49,7 +49,7 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase public function testConnectionFailure() { Database::setDetails('non_existant', 'invalid_user', 'incorrect_password'); - Database::setReadServers(array('localhost')); + Database::setReadServers(['localhost']); Database::getConnection('read'); } } \ No newline at end of file diff --git a/tests/B8Framework/FormTest.php b/tests/B8Framework/FormTest.php index d113cfe7..6678d42f 100755 --- a/tests/B8Framework/FormTest.php +++ b/tests/B8Framework/FormTest.php @@ -105,7 +105,7 @@ class FormTest extends \PHPUnit_Framework_TestCase $this->assertFalse($f->validate()); - $f->setValues(array('group' => array('one' => 'ONE', 'two' => 'TWO'), 'three' => 'THREE')); + $f->setValues(['group' => ['one' => 'ONE', 'two' => 'TWO'], 'three' => 'THREE']); $values = $f->getValues(); $this->assertTrue(is_array($values)); @@ -153,7 +153,7 @@ class FormTest extends \PHPUnit_Framework_TestCase $this->assertTrue(strpos($e->render(), 'email') !== false); $e = new Form\Element\Select(); - $e->setOptions(array('key' => 'Val')); + $e->setOptions(['key' => 'Val']); $html = $e->render(); $this->assertTrue(strpos($html, 'select') !== false); $this->assertTrue(strpos($html, 'option') !== false); diff --git a/tests/B8Framework/HttpClientTest.php b/tests/B8Framework/HttpClientTest.php index 9918d1c3..bfa03527 100755 --- a/tests/B8Framework/HttpClientTest.php +++ b/tests/B8Framework/HttpClientTest.php @@ -25,7 +25,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase public function testGet() { $http = new HttpClient('https://www.cloudflare.com'); - $html = $http->get('overview', array('x' => 1)); + $html = $http->get('overview', ['x' => 1]); $this->assertContains('CloudFlare', $html['body']); } @@ -41,7 +41,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase public function testPost() { $http = new HttpClient('http://echo.jsontest.com'); - $data = $http->post('/key/value', array('test' => 'x')); + $data = $http->post('/key/value', ['test' => 'x']); $this->assertTrue(is_array($data)); } @@ -49,7 +49,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase public function testPut() { $http = new HttpClient('http://echo.jsontest.com'); - $data = $http->put('/key/value', array('test' => 'x')); + $data = $http->put('/key/value', ['test' => 'x']); $this->assertTrue(is_array($data)); } @@ -57,7 +57,7 @@ class HttpClientTest extends \PHPUnit_Framework_TestCase public function testDelete() { $http = new HttpClient('http://echo.jsontest.com'); - $data = $http->delete('/key/value', array('test' => 'x')); + $data = $http->delete('/key/value', ['test' => 'x']); $this->assertTrue(is_array($data)); } diff --git a/tests/B8Framework/ViewTest.php b/tests/B8Framework/ViewTest.php index e09c8a80..d8dd3900 100755 --- a/tests/B8Framework/ViewTest.php +++ b/tests/B8Framework/ViewTest.php @@ -74,7 +74,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase $this->assertTrue($view->render() == 'Hello '); $view = new UserView('Hello {@who.name}'); - $view->who = array('name' => 'Dan'); + $view->who = ['name' => 'Dan']; $this->assertTrue($view->render() == 'Hello Dan'); $tmp = new UserView('Hello'); @@ -123,7 +123,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase public function testUserViewLoop() { $view = new UserView('Hello {loop who}{@item}{/loop}'); - $view->who = array('W', 'o', 'r', 'l', 'd'); + $view->who = ['W', 'o', 'r', 'l', 'd']; $this->assertTrue($view->render() == 'Hello World'); $view = new UserView('Hello {loop who}{@item}{/loop}'); diff --git a/tests/B8Framework/data/generation/ArrayPropertyModel.php b/tests/B8Framework/data/generation/ArrayPropertyModel.php index a8be40d1..d6237ad3 100755 --- a/tests/B8Framework/data/generation/ArrayPropertyModel.php +++ b/tests/B8Framework/data/generation/ArrayPropertyModel.php @@ -5,7 +5,7 @@ use Generation\Model\Uno; class ArrayPropertyModel extends Uno { - public function __construct($initialData = array()) + public function __construct($initialData = []) { $this->_getters['array_property'] = 'getArrayProperty'; self::$sleepable[] = 'array_property'; @@ -13,6 +13,6 @@ class ArrayPropertyModel extends Uno public function getArrayProperty() { - return array('one' => 'two', 'three' => array('four' => 'five')); + return ['one' => 'two', 'three' => ['four' => 'five']]; } } \ No newline at end of file diff --git a/tests/PHPCI/Command/CreateAdminCommandTest.php b/tests/PHPCI/Command/CreateAdminCommandTest.php index 10b7b7f3..1e4eff8e 100644 --- a/tests/PHPCI/Command/CreateAdminCommandTest.php +++ b/tests/PHPCI/Command/CreateAdminCommandTest.php @@ -72,7 +72,7 @@ class CreateAdminCommandTest extends \PHPUnit_Framework_TestCase $this->dialog->expects($this->at(2))->method('askHiddenResponse')->will($this->returnValue('foobar123')); $commandTester = $this->getCommandTester(); - $commandTester->execute(array()); + $commandTester->execute([]); $this->assertEquals('User account created!' . PHP_EOL, $commandTester->getDisplay()); } diff --git a/tests/PHPCI/Command/InstallCommandTest.php b/tests/PHPCI/Command/InstallCommandTest.php index 5d70f31c..884ed719 100644 --- a/tests/PHPCI/Command/InstallCommandTest.php +++ b/tests/PHPCI/Command/InstallCommandTest.php @@ -120,8 +120,8 @@ class InstallCommandTest extends \PHPUnit_Framework_TestCase protected function executeWithoutParam($param = null, $dialog) { // Clean result variables. - $this->admin = array(); - $this->config = array(); + $this->admin = []; + $this->config = []; // Get tester and execute with extracted parameters. $commandTester = $this->getCommandTester($dialog); diff --git a/tests/PHPCI/Logging/BuildLoggerTest.php b/tests/PHPCI/Logging/BuildLoggerTest.php index 77a1fc22..35504c66 100644 --- a/tests/PHPCI/Logging/BuildLoggerTest.php +++ b/tests/PHPCI/Logging/BuildLoggerTest.php @@ -40,8 +40,8 @@ class BuildLoggerTest extends \PHPUnit_Framework_TestCase public function testLog_CallsWrappedLogger() { $level = LogLevel::NOTICE; - $message = "Testing"; - $contextIn = array(); + $message = "Testing"; + $contextIn = []; $this->mockLogger->log($level, $message, Argument::type('array')) ->shouldBeCalledTimes(1); @@ -51,9 +51,9 @@ class BuildLoggerTest extends \PHPUnit_Framework_TestCase public function testLog_CallsWrappedLoggerForEachMessage() { - $level = LogLevel::NOTICE; - $message = array("One", "Two", "Three"); - $contextIn = array(); + $level = LogLevel::NOTICE; + $message = ["One", "Two", "Three"]; + $contextIn = []; $this->mockLogger->log($level, "One", Argument::type('array')) ->shouldBeCalledTimes(1); @@ -69,13 +69,13 @@ class BuildLoggerTest extends \PHPUnit_Framework_TestCase public function testLog_AddsBuildToContext() { - $level = LogLevel::NOTICE; - $message = "Testing"; - $contextIn = array(); + $level = LogLevel::NOTICE; + $message = "Testing"; + $contextIn = []; - $expectedContext = array( + $expectedContext = [ 'build' => $this->mockBuild->reveal() - ); + ]; $this->mockLogger->log($level, $message, $expectedContext) ->shouldBeCalledTimes(1); diff --git a/tests/PHPCI/Logging/LoggerConfigTest.php b/tests/PHPCI/Logging/LoggerConfigTest.php index 7fb95ef8..9d8acd5a 100644 --- a/tests/PHPCI/Logging/LoggerConfigTest.php +++ b/tests/PHPCI/Logging/LoggerConfigTest.php @@ -16,14 +16,14 @@ class LoggerConfigTest extends \PHPUnit_Framework_TestCase { public function testGetFor_ReturnsPSRLogger() { - $config = new LoggerConfig(array()); + $config = new LoggerConfig([]); $logger = $config->getFor("something"); $this->assertInstanceOf('\Psr\Log\LoggerInterface', $logger); } public function testGetFor_ReturnsMonologInstance() { - $config = new LoggerConfig(array()); + $config = new LoggerConfig([]); $logger = $config->getFor("something"); $this->assertInstanceOf('\Monolog\Logger', $logger); } @@ -84,7 +84,7 @@ class LoggerConfigTest extends \PHPUnit_Framework_TestCase public function testGetFor_SameInstance() { - $config = new LoggerConfig(array()); + $config = new LoggerConfig([]); $logger1 = $config->getFor("something"); $logger2 = $config->getFor("something"); diff --git a/tests/PHPCI/Plugin/EmailTest.php b/tests/PHPCI/Plugin/EmailTest.php index 0787d41d..19b4e12f 100644 --- a/tests/PHPCI/Plugin/EmailTest.php +++ b/tests/PHPCI/Plugin/EmailTest.php @@ -57,14 +57,14 @@ class EmailTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->message = array(); + $this->message = []; $this->mailDelivered = true; - $self = $this; + $self = $this; $this->mockProject = $this->getMock( '\PHPCI\Model\Project', - array('getTitle'), - array(), + ['getTitle'], + [], "mockProject", false ); @@ -75,8 +75,8 @@ class EmailTest extends \PHPUnit_Framework_TestCase $this->mockBuild = $this->getMock( '\PHPCI\Model\Build', - array('getLog', 'getStatus', 'getProject', 'getCommitterEmail'), - array(), + ['getLog', 'getStatus', 'getProject', 'getCommitterEmail'], + [], "mockBuild", false ); @@ -101,12 +101,12 @@ class EmailTest extends \PHPUnit_Framework_TestCase $this->mockCiBuilder = $this->getMock( '\PHPCI\Builder', - array( + [ 'getSystemConfig', 'getBuild', 'log' - ), - array(), + ], + [], "mockBuilder_email", false ); @@ -127,7 +127,7 @@ class EmailTest extends \PHPUnit_Framework_TestCase ); } - protected function loadEmailPluginWithOptions($arrOptions = array(), $buildStatus = null, $mailDelivered = true) + protected function loadEmailPluginWithOptions($arrOptions = [], $buildStatus = null, $mailDelivered = true) { $this->mailDelivered = $mailDelivered; @@ -138,7 +138,7 @@ class EmailTest extends \PHPUnit_Framework_TestCase } // Reset current message. - $this->message = array(); + $this->message = []; $self = $this; diff --git a/tests/PHPCI/Plugin/PharTest.php b/tests/PHPCI/Plugin/PharTest.php index 1ba784dd..7de8c272 100644 --- a/tests/PHPCI/Plugin/PharTest.php +++ b/tests/PHPCI/Plugin/PharTest.php @@ -22,7 +22,7 @@ class PharTest extends \PHPUnit_Framework_TestCase $this->cleanSource(); } - protected function getPlugin(array $options = array()) + protected function getPlugin(array $options = []) { $build = $this ->getMockBuilder('PHPCI\Model\Build') diff --git a/tests/PHPCI/Plugin/Util/ExecutorTest.php b/tests/PHPCI/Plugin/Util/ExecutorTest.php index e9083cec..921fe489 100644 --- a/tests/PHPCI/Plugin/Util/ExecutorTest.php +++ b/tests/PHPCI/Plugin/Util/ExecutorTest.php @@ -41,7 +41,7 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase public function testExecutePlugin_AssumesPHPCINamespaceIfNoneGiven() { - $options = array(); + $options = []; $pluginName = 'PhpUnit'; $pluginNamespace = 'PHPCI\\Plugin\\'; @@ -54,7 +54,7 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase public function testExecutePlugin_KeepsCalledNameSpace() { - $options = array(); + $options = []; $pluginClass = $this->getFakePluginClassName('ExamplePluginFull'); $this->mockFactory->buildPlugin($pluginClass, $options) @@ -66,7 +66,7 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase public function testExecutePlugin_CallsExecuteOnFactoryBuildPlugin() { - $options = array(); + $options = []; $pluginName = 'PhpUnit'; $build = new \PHPCI\Model\Build(); @@ -81,7 +81,7 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase public function testExecutePlugin_ReturnsPluginSuccess() { - $options = array(); + $options = []; $pluginName = 'PhpUnit'; $expectedReturnValue = true; @@ -98,7 +98,7 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase public function testExecutePlugin_LogsFailureForNonExistentClasses() { - $options = array(); + $options = []; $pluginName = 'DOESNTEXIST'; $this->mockBuildLogger->logFailure('Plugin does not exist: ' . $pluginName)->shouldBeCalledTimes(1); @@ -108,7 +108,7 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase public function testExecutePlugin_LogsFailureWhenExceptionsAreThrownByPlugin() { - $options = array(); + $options = []; $pluginName = 'PhpUnit'; $expectedException = new \RuntimeException("Generic Error"); @@ -126,9 +126,9 @@ class ExecutorTest extends \PHPUnit_Framework_TestCase public function testExecutePlugins_CallsEachPluginForStage() { - $phpUnitPluginOptions = array(); - $behatPluginOptions = array(); - $build = new \PHPCI\Model\Build(); + $phpUnitPluginOptions = []; + $behatPluginOptions = []; + $build = new \PHPCI\Model\Build(); $config = array( 'stageOne' => array( diff --git a/tests/PHPCI/Plugin/Util/FactoryTest.php b/tests/PHPCI/Plugin/Util/FactoryTest.php index e609011a..76007a40 100644 --- a/tests/PHPCI/Plugin/Util/FactoryTest.php +++ b/tests/PHPCI/Plugin/Util/FactoryTest.php @@ -184,8 +184,8 @@ class FactoryTest extends \PHPUnit_Framework_TestCase { function () use ($self) { return $self->getMock( 'PHPCI\Builder', - array(), - array(), + [], + [], '', false ); @@ -198,8 +198,8 @@ class FactoryTest extends \PHPUnit_Framework_TestCase { function () use ($self) { return $self->getMock( 'PHPCI\Model\Build', - array(), - array(), + [], + [], '', false ); diff --git a/tests/PHPCI/Plugin/Util/Fake/ExamplePluginFull.php b/tests/PHPCI/Plugin/Util/Fake/ExamplePluginFull.php index fa81a352..d7d11b41 100644 --- a/tests/PHPCI/Plugin/Util/Fake/ExamplePluginFull.php +++ b/tests/PHPCI/Plugin/Util/Fake/ExamplePluginFull.php @@ -23,7 +23,7 @@ class ExamplePluginFull implements Plugin { public function __construct( Builder $phpci, Build $build, - array $options = array() + array $options = [] ) { $this->Options = $options; diff --git a/tests/PHPCI/Plugin/Util/TapParserTest.php b/tests/PHPCI/Plugin/Util/TapParserTest.php index 8d31d7c9..e4ac62c9 100644 --- a/tests/PHPCI/Plugin/Util/TapParserTest.php +++ b/tests/PHPCI/Plugin/Util/TapParserTest.php @@ -81,7 +81,7 @@ TAP; $parser = new TapParser($content); $result = $parser->parse(); - $this->assertEquals(array(), $result); + $this->assertEquals([], $result); } /** diff --git a/tests/PHPCI/ProcessControl/ProcessControlTest.php b/tests/PHPCI/ProcessControl/ProcessControlTest.php index 52022743..b2316c9e 100644 --- a/tests/PHPCI/ProcessControl/ProcessControlTest.php +++ b/tests/PHPCI/ProcessControl/ProcessControlTest.php @@ -28,7 +28,7 @@ abstract class ProcessControlTest extends \PHPUnit_Framework_TestCase protected function startProcess() { $desc = array(array("pipe", "r"), array("pipe", "w"), array("pipe", "w")); - $this->pipes = array(); + $this->pipes = []; $this->process = proc_open($this->getTestCommand(), $desc, $this->pipes); usleep(500); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 51c3db20..46c513df 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -26,10 +26,10 @@ if (!file_exists($configFile)) { } // Load configuration if present: -$conf = array(); -$conf['b8']['app']['namespace'] = 'PHPCI'; +$conf = []; +$conf['b8']['app']['namespace'] = 'PHPCI'; $conf['b8']['app']['default_controller'] = 'Home'; -$conf['b8']['view']['path'] = dirname(__DIR__) . '/src/PHPCI/View/'; +$conf['b8']['view']['path'] = dirname(__DIR__) . '/src/PHPCI/View/'; $config = new b8\Config($conf);