Skip to content

Commit 7cc4a19

Browse files
committed
fix(cs) convert to short array syntax
1 parent ac7b7af commit 7cc4a19

File tree

585 files changed

+5957
-5199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

585 files changed

+5957
-5199
lines changed

.php-cs-fixer.dist.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
->in(__DIR__.'/lib')
66
->in(__DIR__.'/data/bin')
77
->in(__DIR__.'/test')
8-
->append(array(__FILE__))
8+
->append([__FILE__])
99
// Exclude PHP classes templates/generators, which are not valid PHP files
1010
->exclude('task/generator/skeleton/')
1111
->exclude('plugins/sfDoctrinePlugin/data/generator/')
@@ -15,13 +15,13 @@
1515
;
1616

1717
$config = new PhpCsFixer\Config();
18-
$config->setRules(array(
18+
$config->setRules([
1919
'@PhpCsFixer' => true,
2020
'@Symfony' => true,
21-
'array_syntax' => array(
22-
'syntax' => 'long',
23-
),
24-
))
21+
'array_syntax' => [
22+
'syntax' => 'short',
23+
],
24+
])
2525
->setCacheFile('.php-cs-fixer.cache')
2626
->setFinder($finder)
2727
;

data/bin/changelog.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
list($out, $err) = $filesystem->execute('svn info --xml');
3737
$info = new SimpleXMLElement($out);
3838

39-
list($out, $err) = $filesystem->execute(vsprintf('svn log %s --xml %s', array_map('escapeshellarg', array(
39+
list($out, $err) = $filesystem->execute(vsprintf('svn log %s --xml %s', array_map('escapeshellarg', [
4040
$argv[1],
4141
(string) $info->entry->repository->root.$argv[2],
42-
))));
42+
])));
4343
$log = new SimpleXMLElement($out);
4444

4545
foreach ($log->logentry as $logentry) {

data/bin/check_configuration.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ function is_cli()
77

88
/**
99
* Checks a configuration.
10+
*
11+
* @param mixed $boolean
12+
* @param mixed $message
13+
* @param mixed $help
14+
* @param mixed $fatal
1015
*/
1116
function check($boolean, $message, $help = '', $fatal = false)
1217
{

data/bin/release.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
// add class files
7474
$finder = sfFinder::type('file')->relative();
7575
$xml_classes = '';
76-
$dirs = array('lib' => 'php', 'data' => 'data');
76+
$dirs = ['lib' => 'php', 'data' => 'data'];
7777
foreach ($dirs as $dir => $role) {
7878
$class_files = $finder->in($dir);
7979
foreach ($class_files as $file) {
@@ -82,12 +82,12 @@
8282
}
8383

8484
// replace tokens
85-
$filesystem->replaceTokens(getcwd().DIRECTORY_SEPARATOR.'package.xml', '##', '##', array(
85+
$filesystem->replaceTokens(getcwd().DIRECTORY_SEPARATOR.'package.xml', '##', '##', [
8686
'SYMFONY_VERSION' => $version,
8787
'CURRENT_DATE' => date('Y-m-d'),
8888
'CLASS_FILES' => $xml_classes,
8989
'STABILITY' => $stability,
90-
));
90+
]);
9191

9292
list($results) = $filesystem->execute('pear package');
9393
echo $results;

data/bin/sandbox_installer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
chmod(sfConfig::get('sf_data_dir').'/sandbox.db', 0777);
2424

2525
$this->logSection('install', 'add an empty file in empty directories');
26-
$seen = array();
26+
$seen = [];
2727
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(sfConfig::get('sf_root_dir')), RecursiveIteratorIterator::CHILD_FIRST) as $path => $item) {
2828
if (!isset($seen[$path]) && $item->isDir() && !$item->isLink()) {
2929
touch($item->getRealPath().'/.sf');

lib/action/sfAction.class.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
abstract class sfAction extends sfComponent
2424
{
25-
protected $security = array();
25+
protected $security = [];
2626

2727
/**
2828
* Initializes this action.
@@ -124,7 +124,7 @@ public function redirect404()
124124
public function forward($module, $action)
125125
{
126126
if (sfConfig::get('sf_logging_enabled')) {
127-
$this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Forward to action "%s/%s"', $module, $action))));
127+
$this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Forward to action "%s/%s"', $module, $action)]));
128128
}
129129

130130
$this->getController()->forward($module, $action);
@@ -186,7 +186,7 @@ public function redirect($url, $statusCode = 302)
186186
{
187187
// compatibility with url_for2() style signature
188188
if (is_object($statusCode) || is_array($statusCode)) {
189-
$url = array_merge(array('sf_route' => $url), is_object($statusCode) ? array('sf_subject' => $statusCode) : $statusCode);
189+
$url = array_merge(['sf_route' => $url], is_object($statusCode) ? ['sf_subject' => $statusCode] : $statusCode);
190190
$statusCode = func_num_args() >= 3 ? func_get_arg(2) : 302;
191191
}
192192

@@ -213,7 +213,7 @@ public function redirectIf($condition, $url, $statusCode = 302)
213213
if ($condition) {
214214
// compatibility with url_for2() style signature
215215
$arguments = func_get_args();
216-
call_user_func_array(array($this, 'redirect'), array_slice($arguments, 1));
216+
call_user_func_array([$this, 'redirect'], array_slice($arguments, 1));
217217
}
218218
}
219219

@@ -235,7 +235,7 @@ public function redirectUnless($condition, $url, $statusCode = 302)
235235
if (!$condition) {
236236
// compatibility with url_for2() style signature
237237
$arguments = func_get_args();
238-
call_user_func_array(array($this, 'redirect'), array_slice($arguments, 1));
238+
call_user_func_array([$this, 'redirect'], array_slice($arguments, 1));
239239
}
240240
}
241241

@@ -432,7 +432,7 @@ public function getCredential()
432432
public function setTemplate($name, $module = null)
433433
{
434434
if (sfConfig::get('sf_logging_enabled')) {
435-
$this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Change template to "%s/%s"', null === $module ? 'CURRENT' : $module, $name))));
435+
$this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Change template to "%s/%s"', null === $module ? 'CURRENT' : $module, $name)]));
436436
}
437437

438438
if (null !== $module) {
@@ -470,7 +470,7 @@ public function getTemplate()
470470
public function setLayout($name)
471471
{
472472
if (sfConfig::get('sf_logging_enabled')) {
473-
$this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Change layout to "%s"', $name))));
473+
$this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Change layout to "%s"', $name)]));
474474
}
475475

476476
sfConfig::set('symfony.view.'.$this->getModuleName().'_'.$this->getActionName().'_layout', $name);

lib/action/sfActionStack.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
class sfActionStack
2222
{
2323
/** @var sfActionStackEntry[] */
24-
protected $stack = array();
24+
protected $stack = [];
2525

2626
/**
2727
* Adds an entry to the action stack.

lib/action/sfActions.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ public function execute($request)
4343
throw new sfInitializationException(sprintf('sfAction initialization failed for module "%s". There was no action given.', $this->getModuleName()));
4444
}
4545

46-
if (!is_callable(array($this, $actionToRun))) {
46+
if (!is_callable([$this, $actionToRun])) {
4747
// action not found
4848
throw new sfInitializationException(sprintf('sfAction initialization failed for module "%s", action "%s". You must create a "%s" method.', $this->getModuleName(), $this->getActionName(), $actionToRun));
4949
}
5050

5151
if (sfConfig::get('sf_logging_enabled')) {
52-
$this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Call "%s->%s()"', get_class($this), $actionToRun))));
52+
$this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Call "%s->%s()"', get_class($this), $actionToRun)]));
5353
}
5454

5555
// run action

lib/action/sfComponent.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct($context, $moduleName, $actionName)
6464
*
6565
* @return string The translated string
6666
*/
67-
public function __($string, $args = array(), $catalogue = 'messages')
67+
public function __($string, $args = [], $catalogue = 'messages')
6868
{
6969
return $this->context->getI18N()->__($string, $args, $catalogue);
7070
}
@@ -130,7 +130,7 @@ public function __unset($name)
130130
*/
131131
public function __call($method, $arguments)
132132
{
133-
$event = $this->dispatcher->notifyUntil(new sfEvent($this, 'component.method_not_found', array('method' => $method, 'arguments' => $arguments)));
133+
$event = $this->dispatcher->notifyUntil(new sfEvent($this, 'component.method_not_found', ['method' => $method, 'arguments' => $arguments]));
134134
if (!$event->isProcessed()) {
135135
throw new sfException(sprintf('Call to undefined method %s::%s.', get_class($this), $method));
136136
}
@@ -249,7 +249,7 @@ final public function getLogger()
249249
public function logMessage($message, $priority = 'info')
250250
{
251251
if (sfConfig::get('sf_logging_enabled')) {
252-
$this->dispatcher->notify(new sfEvent($this, 'application.log', array($message, 'priority' => constant('sfLogger::'.strtoupper($priority)))));
252+
$this->dispatcher->notify(new sfEvent($this, 'application.log', [$message, 'priority' => constant('sfLogger::'.strtoupper($priority))]));
253253
}
254254
}
255255

@@ -341,7 +341,7 @@ public function getController()
341341
*
342342
* @return string The URL
343343
*/
344-
public function generateUrl($route, $params = array(), $absolute = false)
344+
public function generateUrl($route, $params = [], $absolute = false)
345345
{
346346
return $this->context->getRouting()->generate($route, $params, $absolute);
347347
}

lib/addon/sfData.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
abstract class sfData
2020
{
2121
protected $deleteCurrentData = true;
22-
protected $object_references = array();
22+
protected $object_references = [];
2323

2424
/**
2525
* Sets a flag to indicate if the current data in the database
@@ -68,7 +68,7 @@ public function getFiles($element = null)
6868
$element = sfConfig::get('sf_data_dir').'/fixtures';
6969
}
7070

71-
$files = array();
71+
$files = [];
7272
if (is_array($element)) {
7373
foreach ($element as $e) {
7474
$files = array_merge($files, $this->getFiles($e));
@@ -108,8 +108,8 @@ protected function doLoadDataFromFile($file)
108108
*/
109109
protected function doLoadData(array $files)
110110
{
111-
$this->object_references = array();
112-
$this->maps = array();
111+
$this->object_references = [];
112+
$this->maps = [];
113113

114114
foreach ($files as $file) {
115115
$this->doLoadDataFromFile($file);

0 commit comments

Comments
 (0)