Skip to content

Commit

Permalink
Use short array syntax (available since PHP 5.4.0, done w/ thomasbach…
Browse files Browse the repository at this point in the history
…em/php-short-array-syntax-converter)
  • Loading branch information
kay.stenschke committed Sep 1, 2020
1 parent 4eaef75 commit 31ba050
Show file tree
Hide file tree
Showing 2,194 changed files with 72,541 additions and 72,544 deletions.
8 changes: 4 additions & 4 deletions bin/classmap_generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@
$libraryPath = getcwd();

// Setup autoloading
$loader = new Zend_Loader_StandardAutoloader(array('autoregister_zf' => true));
$loader = new Zend_Loader_StandardAutoloader(['autoregister_zf' => true]);
$loader->setFallbackAutoloader(true);
$loader->register();

$rules = array(
$rules = [
'help|h' => 'Get usage message',
'library|l-s' => 'Library to parse; if none provided, assumes current directory',
'output|o-s' => 'Where to write autoload file; if not provided, assumes "autoload_classmap.php" in library directory',
'append|a' => 'Append to autoload file if it exists',
'overwrite|w' => 'Whether or not to overwrite existing autoload file',
'ignore|i-s' => 'Comma-separated namespaces to ignore',
);
];

try {
$opts = new Zend_Console_Getopt($rules);
Expand All @@ -78,7 +78,7 @@
exit(0);
}

$ignoreNamespaces = array();
$ignoreNamespaces = [];
if (isset($opts->i)) {
$ignoreNamespaces = explode(',', $opts->i);
}
Expand Down
4 changes: 2 additions & 2 deletions bin/zf.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ZF
/**
* @var array of messages
*/
protected $_messages = array();
protected $_messages = [];

/**
* @var string
Expand Down Expand Up @@ -585,7 +585,7 @@ protected function _runSetupMoreInfo()
protected function _runTool()
{

$configOptions = array();
$configOptions = [];
if (isset($this->_configFile) && $this->_configFile) {
$configOptions['configOptions']['configFilepath'] = $this->_configFile;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class DocumentController extends Zend_Controller_Action
{

public $dependencies = array('config');
public $dependencies = ['config'];

/**
* @var Zend_Cloud_DocumentService_Adapter
Expand All @@ -55,9 +55,9 @@ public function showAction()
return;
}
$q = $this->_doc->select("*");
$this->view->data = $this->_doc->query($name, $q, array(
$this->view->data = $this->_doc->query($name, $q, [
Zend_Cloud_DocumentService_Adapter_SimpleDB::RETURN_DOCUMENTS => true
));
]);
}

public function createAction()
Expand Down Expand Up @@ -87,8 +87,8 @@ public function addDocumentAction()
if (!$id = $this->_getParam('id', false)) {
return;
}
$fields = array();
foreach ($this->_getParam('field', array()) as $field) {
$fields = [];
foreach ($this->_getParam('field', []) as $field) {
if (!$field["name"]) {
continue;
}
Expand All @@ -99,7 +99,7 @@ public function addDocumentAction()
}
$document = new Zend_Cloud_DocumentService_Document($id, $fields);
$this->_doc->insertDocument($name, $document);
return $this->_helper->redirector('show', null, null, array("collection" => $name));
return $this->_helper->redirector('show', null, null, ["collection" => $name]);
}

public function deleteDocumentAction()
Expand All @@ -115,6 +115,6 @@ public function deleteDocumentAction()
return;
}
$this->_doc->deleteDocument($name, $id);
return $this->_helper->redirector('show', null, null, array("collection" => $name));
return $this->_helper->redirector('show', null, null, ["collection" => $name]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class QueueController extends Zend_Controller_Action
{

public $dependencies = array('config');
public $dependencies = ['config'];

/**
* @var Zend_Cloud_QueueService_Adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class StorageController extends Zend_Controller_Action
{

public $dependencies = array('config');
public $dependencies = ['config'];

/**
* @var Zend_Cloud_StorageService_Adapter
Expand All @@ -52,10 +52,10 @@ public function getAction()
return $this->_helper->redirector('index');
}

$item = $this->_storage->fetchItem($name, array(
$item = $this->_storage->fetchItem($name, [
Zend_Cloud_StorageService_Adapter_S3::FETCH_STREAM => true,
Zend_Cloud_StorageService_Adapter_WindowsAzure::RETURN_TYPE => Zend_Cloud_StorageService_Adapter_WindowsAzure::RETURN_STREAM
));
]);

if (!$item) {
$this->getResponse()->setHttpResponseCode(404);
Expand Down Expand Up @@ -103,11 +103,11 @@ public function uploadAction()
$name = $upload->getFileName(null, false);
}

$this->_storage->storeItem($name, $fp, array(
Zend_Cloud_StorageService_Adapter_S3::METADATA => array("type" => $mime)
));
$this->_storage->storeItem($name, $fp, [
Zend_Cloud_StorageService_Adapter_S3::METADATA => ["type" => $mime]
]);
try {
$this->_storage->storeMetadata($name, array("type" => $mime));
$this->_storage->storeMetadata($name, ["type" => $mime]);
} catch(Zend_Cloud_OperationNotAvailableException $e) {
// ignore it
}
Expand Down
4 changes: 2 additions & 2 deletions demos/Zend/Cloud/cloudexp/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
set_include_path(implode(PATH_SEPARATOR, [
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
]));

/** Zend_Application */
require_once 'Zend/Application.php';
Expand Down
10 changes: 5 additions & 5 deletions demos/Zend/Gdata/3LeggedOAuth/Gdata_OAuth_Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

class Gdata_OAuth_Helper extends Zend_Oauth_Consumer {
// Google's default oauth parameters/constants.
private $_defaultOptions = array(
private $_defaultOptions = [
'requestScheme' => Zend_Oauth::REQUEST_SCHEME_HEADER,
'version' => '1.0',
'requestTokenUrl' => 'https://www.google.com/accounts/OAuthGetRequestToken',
'userAuthorizationUrl' => 'https://www.google.com/accounts/OAuthAuthorizeToken',
'accessTokenUrl' => 'https://www.google.com/accounts/OAuthGetAccessToken'
);
];

/**
* Create Gdata_OAuth_Helper object
Expand Down Expand Up @@ -70,7 +70,7 @@ public function fetchRequestToken($scope, $callback) {
$this->_defaultOptions['callbackUrl'] = $uri;
$this->_config->setCallbackUrl($uri);
if (!isset($_SESSION['ACCESS_TOKEN'])) {
return parent::getRequestToken(array('scope' => $scope));
return parent::getRequestToken(['scope' => $scope]);
}
return null;
}
Expand All @@ -85,9 +85,9 @@ public function fetchRequestToken($scope, $callback) {
* @return void
*/
public function authorizeRequestToken($domain=null) {
$params = array();
$params = [];
if ($domain != null) {
$params = array('hd' => $domain);
$params = ['hd' => $domain];
}
$this->redirect($params);
}
Expand Down
6 changes: 3 additions & 3 deletions demos/Zend/Gdata/3LeggedOAuth/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
// Application constants. Replace these values with your own.
$APP_NAME = 'google-ZendGData3LOSample-1.0';
$APP_URL = getAppURL();
$scopes = array(
$scopes = [
'https://docs.google.com/feeds/',
'http://spreadsheets.google.com/feeds/'
);
];

// Setup OAuth consumer. Thes values should be replaced with your registered
// app's consumer key/secret.
Expand Down Expand Up @@ -78,7 +78,7 @@
$spreadsheetFeed = $spreadsheetsService->getSpreadsheetFeed(
'http://spreadsheets.google.com/feeds/spreadsheets/private/full?max-results=100');

renderHTML($accessToken, array($docsFeed, $spreadsheetFeed));
renderHTML($accessToken, [$docsFeed, $spreadsheetFeed]);
} else {
renderHTML();
}
Expand Down
14 changes: 7 additions & 7 deletions demos/Zend/Gdata/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,15 +396,15 @@ function createEvent ($client, $title = 'Tennis with Beth',
$gc = new Zend_Gdata_Calendar($client);
$newEntry = $gc->newEventEntry();
$newEntry->title = $gc->newTitle(trim($title));
$newEntry->where = array($gc->newWhere($where));
$newEntry->where = [$gc->newWhere($where)];

$newEntry->content = $gc->newContent($desc);
$newEntry->content->type = 'text';

$when = $gc->newWhen();
$when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00";
$when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";
$newEntry->when = array($when);
$newEntry->when = [$when];

$createdEntry = $gc->insertEvent($newEntry);
return $createdEntry->id->text;
Expand Down Expand Up @@ -458,7 +458,7 @@ function createWebContentEvent ($client, $title = 'World Cup 2006',
$when = $gc->newWhen();
$when->startTime = $startDate;
$when->endTime = $endDate;
$newEntry->when = array($when);
$newEntry->when = [$when];

$wc = $gc->newWebContent();
$wc->url = $url;
Expand All @@ -472,7 +472,7 @@ function createWebContentEvent ($client, $title = 'World Cup 2006',
$wcLink->href = $icon;

$wcLink->webContent = $wc;
$newEntry->link = array($wcLink);
$newEntry->link = [$wcLink];

$createdEntry = $gc->insertEvent($newEntry);
return $createdEntry->id->text;
Expand All @@ -496,7 +496,7 @@ function createRecurringEvent ($client, $title = 'Tennis with Beth',
$gc = new Zend_Gdata_Calendar($client);
$newEntry = $gc->newEventEntry();
$newEntry->title = $gc->newTitle(trim($title));
$newEntry->where = array($gc->newWhere($where));
$newEntry->where = [$gc->newWhere($where)];

$newEntry->content = $gc->newContent($desc);
$newEntry->content->type = 'text';
Expand Down Expand Up @@ -590,7 +590,7 @@ function addExtendedProperty ($client, $eventId,
$gc = new Zend_Gdata_Calendar($client);
if ($event = getEvent($client, $eventId)) {
$extProp = $gc->newExtendedProperty($name, $value);
$extProps = array_merge($event->extendedProperty, array($extProp));
$extProps = array_merge($event->extendedProperty, [$extProp]);
$event->extendedProperty = $extProps;
$eventNew = $event->save();
return $eventNew;
Expand Down Expand Up @@ -618,7 +618,7 @@ function setReminder($client, $eventId, $minutes=15)
$reminder = $gc->newReminder();
$reminder->setMinutes($minutes);
$reminder->setMethod($method);
$when->reminders = array($reminder);
$when->reminders = [$reminder];
}
$eventNew = $event->save();
return $eventNew;
Expand Down
32 changes: 16 additions & 16 deletions demos/Zend/Gdata/InstallationChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ class InstallationChecker {
const ZEND_GDATA_INSTALL_ERRORS = 'Zend Framework Installation Errors';
const ZEND_SUBVERSION_URI = 'http://framework.zend.com/download/subversion';

private static $REQUIRED_EXTENSIONS = array(
'ctype', 'dom', 'libxml', 'spl', 'standard', 'openssl');
private static $REQUIRED_EXTENSIONS = [
'ctype', 'dom', 'libxml', 'spl', 'standard', 'openssl'];

private $_allErrors = array(
self::PHP_EXTENSION_ERRORS => array(
'tested' => false, 'errors' => null),
self::ZEND_GDATA_INSTALL_ERRORS => array(
'tested' => false, 'errors' => null),
self::SSL_CAPABILITIES_ERRORS => array(
'tested' => false, 'errors' => null),
self::YOUTUBE_API_CONNECTIVITY_ERRORS => array(
'tested' => false, 'errors' => null)
);
private $_allErrors = [
self::PHP_EXTENSION_ERRORS => [
'tested' => false, 'errors' => null],
self::ZEND_GDATA_INSTALL_ERRORS => [
'tested' => false, 'errors' => null],
self::SSL_CAPABILITIES_ERRORS => [
'tested' => false, 'errors' => null],
self::YOUTUBE_API_CONNECTIVITY_ERRORS => [
'tested' => false, 'errors' => null]
];

private $_sapiModeCLI = null;

Expand Down Expand Up @@ -117,7 +117,7 @@ public function runAllVerifications()
*/
private function validatePHPExtensions()
{
$phpExtensionErrors = array();
$phpExtensionErrors = [];
foreach (self::$REQUIRED_EXTENSIONS as $requiredExtension) {
if (!extension_loaded($requiredExtension)) {
$requiredExtensionError = $requiredExtension .
Expand Down Expand Up @@ -159,7 +159,7 @@ private function validatePHPExtensions()
*/
private function validateZendFrameworkInstallation()
{
$zendFrameworkInstallationErrors = array();
$zendFrameworkInstallationErrors = [];
$zendLoaderPresent = false;
try {
$zendLoaderPresent = @fopen('Zend/Loader.php', 'r', true);
Expand Down Expand Up @@ -241,7 +241,7 @@ private function makeHTMLLink($inputString)
*/
private function testSSLCapabilities()
{
$sslCapabilitiesErrors = array();
$sslCapabilitiesErrors = [];
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Http_Client');

Expand Down Expand Up @@ -271,7 +271,7 @@ private function testSSLCapabilities()
*/
private function validateYouTubeAPIConnectivity()
{
$connectivityErrors = array();
$connectivityErrors = [];
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');
$yt = new Zend_Gdata_YouTube();
Expand Down
2 changes: 1 addition & 1 deletion demos/Zend/Gdata/Spreadsheet-ClientLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public function listDeleteAction($index)
*/
public function stringToArray($rowData)
{
$arr = array();
$arr = [];
foreach ($rowData as $row) {
$temp = explode('=', $row);
$arr[$temp[0]] = $temp[1];
Expand Down
Loading

0 comments on commit 31ba050

Please sign in to comment.