Skip to content

Commit

Permalink
Update: php-cs-fixer, enable short array syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
thePanz committed Mar 13, 2024
1 parent 5736b60 commit 1ac0672
Show file tree
Hide file tree
Showing 575 changed files with 5,188 additions and 5,188 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'@PhpCsFixer' => true,
'@Symfony' => true,
'array_syntax' => array(
'syntax' => 'long',
'syntax' => 'short',
),
))
->setCacheFile('.php-cs-fixer.cache')
Expand Down
4 changes: 2 additions & 2 deletions data/bin/changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
list($out, $err) = $filesystem->execute('svn info --xml');
$info = new SimpleXMLElement($out);

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

foreach ($log->logentry as $logentry) {
Expand Down
6 changes: 3 additions & 3 deletions data/bin/release.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
// add class files
$finder = sfFinder::type('file')->relative();
$xml_classes = '';
$dirs = array('lib' => 'php', 'data' => 'data');
$dirs = ['lib' => 'php', 'data' => 'data'];
foreach ($dirs as $dir => $role) {
$class_files = $finder->in($dir);
foreach ($class_files as $file) {
Expand All @@ -82,12 +82,12 @@
}

// replace tokens
$filesystem->replaceTokens(getcwd().DIRECTORY_SEPARATOR.'package.xml', '##', '##', array(
$filesystem->replaceTokens(getcwd().DIRECTORY_SEPARATOR.'package.xml', '##', '##', [
'SYMFONY_VERSION' => $version,
'CURRENT_DATE' => date('Y-m-d'),
'CLASS_FILES' => $xml_classes,
'STABILITY' => $stability,
));
]);

list($results) = $filesystem->execute('pear package');
echo $results;
Expand Down
2 changes: 1 addition & 1 deletion data/bin/sandbox_installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
chmod(sfConfig::get('sf_data_dir').'/sandbox.db', 0777);

$this->logSection('install', 'add an empty file in empty directories');
$seen = array();
$seen = [];
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(sfConfig::get('sf_root_dir')), RecursiveIteratorIterator::CHILD_FIRST) as $path => $item) {
if (!isset($seen[$path]) && $item->isDir() && !$item->isLink()) {
touch($item->getRealPath().'/.sf');
Expand Down
14 changes: 7 additions & 7 deletions lib/action/sfAction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
abstract class sfAction extends sfComponent
{
protected $security = array();
protected $security = [];

/**
* Initializes this action.
Expand Down Expand Up @@ -122,7 +122,7 @@ public function redirect404()
public function forward($module, $action)
{
if (sfConfig::get('sf_logging_enabled')) {
$this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Forward to action "%s/%s"', $module, $action))));
$this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Forward to action "%s/%s"', $module, $action)]));
}

$this->getController()->forward($module, $action);
Expand Down Expand Up @@ -184,7 +184,7 @@ public function redirect($url, $statusCode = 302)
{
// compatibility with url_for2() style signature
if (is_object($statusCode) || is_array($statusCode)) {
$url = array_merge(array('sf_route' => $url), is_object($statusCode) ? array('sf_subject' => $statusCode) : $statusCode);
$url = array_merge(['sf_route' => $url], is_object($statusCode) ? ['sf_subject' => $statusCode] : $statusCode);
$statusCode = func_num_args() >= 3 ? func_get_arg(2) : 302;
}

Expand All @@ -211,7 +211,7 @@ public function redirectIf($condition, $url, $statusCode = 302)
if ($condition) {
// compatibility with url_for2() style signature
$arguments = func_get_args();
call_user_func_array(array($this, 'redirect'), array_slice($arguments, 1));
call_user_func_array([$this, 'redirect'], array_slice($arguments, 1));
}
}

Expand All @@ -233,7 +233,7 @@ public function redirectUnless($condition, $url, $statusCode = 302)
if (!$condition) {
// compatibility with url_for2() style signature
$arguments = func_get_args();
call_user_func_array(array($this, 'redirect'), array_slice($arguments, 1));
call_user_func_array([$this, 'redirect'], array_slice($arguments, 1));
}
}

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

if (null !== $module) {
Expand Down Expand Up @@ -468,7 +468,7 @@ public function getTemplate()
public function setLayout($name)
{
if (sfConfig::get('sf_logging_enabled')) {
$this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Change layout to "%s"', $name))));
$this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Change layout to "%s"', $name)]));
}

sfConfig::set('symfony.view.'.$this->getModuleName().'_'.$this->getActionName().'_layout', $name);
Expand Down
2 changes: 1 addition & 1 deletion lib/action/sfActionStack.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class sfActionStack
{
/** @var sfActionStackEntry[] */
protected $stack = array();
protected $stack = [];

/**
* Adds an entry to the action stack.
Expand Down
4 changes: 2 additions & 2 deletions lib/action/sfActions.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ public function execute($request)
throw new sfInitializationException(sprintf('sfAction initialization failed for module "%s". There was no action given.', $this->getModuleName()));
}

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

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

// run action
Expand Down
8 changes: 4 additions & 4 deletions lib/action/sfComponent.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function __construct($context, $moduleName, $actionName)
*
* @return string The translated string
*/
public function __($string, $args = array(), $catalogue = 'messages')
public function __($string, $args = [], $catalogue = 'messages')
{
return $this->context->getI18N()->__($string, $args, $catalogue);
}
Expand Down Expand Up @@ -128,7 +128,7 @@ public function __unset($name)
*/
public function __call($method, $arguments)
{
$event = $this->dispatcher->notifyUntil(new sfEvent($this, 'component.method_not_found', array('method' => $method, 'arguments' => $arguments)));
$event = $this->dispatcher->notifyUntil(new sfEvent($this, 'component.method_not_found', ['method' => $method, 'arguments' => $arguments]));
if (!$event->isProcessed()) {
throw new sfException(sprintf('Call to undefined method %s::%s.', get_class($this), $method));
}
Expand Down Expand Up @@ -247,7 +247,7 @@ final public function getLogger()
public function logMessage($message, $priority = 'info')
{
if (sfConfig::get('sf_logging_enabled')) {
$this->dispatcher->notify(new sfEvent($this, 'application.log', array($message, 'priority' => constant('sfLogger::'.strtoupper($priority)))));
$this->dispatcher->notify(new sfEvent($this, 'application.log', [$message, 'priority' => constant('sfLogger::'.strtoupper($priority))]));
}
}

Expand Down Expand Up @@ -339,7 +339,7 @@ public function getController()
*
* @return string The URL
*/
public function generateUrl($route, $params = array(), $absolute = false)
public function generateUrl($route, $params = [], $absolute = false)
{
return $this->context->getRouting()->generate($route, $params, $absolute);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/addon/sfData.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
abstract class sfData
{
protected $deleteCurrentData = true;
protected $object_references = array();
protected $object_references = [];

/**
* Sets a flag to indicate if the current data in the database
Expand Down Expand Up @@ -66,7 +66,7 @@ public function getFiles($element = null)
$element = sfConfig::get('sf_data_dir').'/fixtures';
}

$files = array();
$files = [];
if (is_array($element)) {
foreach ($element as $e) {
$files = array_merge($files, $this->getFiles($e));
Expand Down Expand Up @@ -106,8 +106,8 @@ protected function doLoadDataFromFile($file)
*/
protected function doLoadData(array $files)
{
$this->object_references = array();
$this->maps = array();
$this->object_references = [];
$this->maps = [];

foreach ($files as $file) {
$this->doLoadDataFromFile($file);
Expand Down
4 changes: 2 additions & 2 deletions lib/addon/sfPager.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class sfPager implements Iterator, Countable
protected $tableName = '';
protected $objects;
protected $cursor = 1;
protected $parameters = array();
protected $parameters = [];
protected $currentMaxLink = 1;
protected $parameterHolder;
protected $maxRecordLimit = false;
Expand Down Expand Up @@ -97,7 +97,7 @@ public function setMaxRecordLimit($limit)
*/
public function getLinks($nb_links = 5)
{
$links = array();
$links = [];
$tmp = $this->page - floor($nb_links / 2);
$check = $this->lastPage - $nb_links + 1;
$limit = $check > 0 ? $check : 1;
Expand Down
8 changes: 4 additions & 4 deletions lib/autoload/sfAutoload.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class sfAutoload
protected static $freshCache = false;
protected static $instance;

protected $overriden = array();
protected $classes = array();
protected $overriden = [];
protected $classes = [];

protected function __construct()
{
Expand Down Expand Up @@ -51,7 +51,7 @@ public static function register()
{
ini_set('unserialize_callback_func', 'spl_autoload_call');

if (false === spl_autoload_register(array(self::getInstance(), 'autoload'))) {
if (false === spl_autoload_register([self::getInstance(), 'autoload'])) {
throw new sfException(sprintf('Unable to register %s::autoload as an autoloading method.', get_class(self::getInstance())));
}
}
Expand All @@ -61,7 +61,7 @@ public static function register()
*/
public static function unregister()
{
spl_autoload_unregister(array(self::getInstance(), 'autoload'));
spl_autoload_unregister([self::getInstance(), 'autoload']);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/autoload/sfAutoloadAgain.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function autoload($class)
}
}
} else {
$position = array_search(array(__CLASS__, 'autoload'), $autoloads, true);
$position = array_search([__CLASS__, 'autoload'], $autoloads, true);
}

if (isset($autoloads[$position + 1])) {
Expand Down Expand Up @@ -102,7 +102,7 @@ public function isRegistered()
public function register()
{
if (!$this->isRegistered()) {
spl_autoload_register(array($this, 'autoload'));
spl_autoload_register([$this, 'autoload']);
$this->registered = true;
}
}
Expand All @@ -112,7 +112,7 @@ public function register()
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'autoload'));
spl_autoload_unregister([$this, 'autoload']);
$this->registered = false;
}
}
8 changes: 4 additions & 4 deletions lib/autoload/sfCoreAutoload.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class sfCoreAutoload

// Don't edit this property by hand.
// To update it, use sfCoreAutoload::make()
protected $classes = array(
protected $classes = [
'sfaction' => 'action/sfAction.class.php',
'sfactionstack' => 'action/sfActionStack.class.php',
'sfactionstackentry' => 'action/sfActionStackEntry.class.php',
Expand Down Expand Up @@ -392,7 +392,7 @@ class sfCoreAutoload
'sfyamldumper' => 'yaml/sfYamlDumper.class.php',
'sfyamlinline' => 'yaml/sfYamlInline.class.php',
'sfyamlparser' => 'yaml/sfYamlParser.class.php',
);
];

protected function __construct()
{
Expand Down Expand Up @@ -425,7 +425,7 @@ public static function register()
}

ini_set('unserialize_callback_func', 'spl_autoload_call');
if (false === spl_autoload_register(array(self::getInstance(), 'autoload'))) {
if (false === spl_autoload_register([self::getInstance(), 'autoload'])) {
throw new sfException(sprintf('Unable to register %s::autoload as an autoloading method.', get_class(self::getInstance())));
}

Expand All @@ -437,7 +437,7 @@ public static function register()
*/
public static function unregister()
{
spl_autoload_unregister(array(self::getInstance(), 'autoload'));
spl_autoload_unregister([self::getInstance(), 'autoload']);
self::$registered = false;
}

Expand Down
18 changes: 9 additions & 9 deletions lib/autoload/sfSimpleAutoload.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class sfSimpleAutoload
protected $cacheFile;
protected $cacheLoaded = false;
protected $cacheChanged = false;
protected $dirs = array();
protected $files = array();
protected $classes = array();
protected $overriden = array();
protected $dirs = [];
protected $files = [];
protected $classes = [];
protected $overriden = [];

protected function __construct($cacheFile = null)
{
Expand Down Expand Up @@ -66,12 +66,12 @@ public static function register()
}

ini_set('unserialize_callback_func', 'spl_autoload_call');
if (false === spl_autoload_register(array(self::getInstance(), 'autoload'))) {
if (false === spl_autoload_register([self::getInstance(), 'autoload'])) {
throw new sfException(sprintf('Unable to register %s::autoload as an autoloading method.', get_class(self::getInstance())));
}

if (self::getInstance()->cacheFile) {
register_shutdown_function(array(self::getInstance(), 'saveCache'));
register_shutdown_function([self::getInstance(), 'saveCache']);
}

self::$registered = true;
Expand All @@ -82,7 +82,7 @@ public static function register()
*/
public static function unregister()
{
spl_autoload_unregister(array(self::getInstance(), 'autoload'));
spl_autoload_unregister([self::getInstance(), 'autoload']);
self::$registered = false;
}

Expand Down Expand Up @@ -140,7 +140,7 @@ public function saveCache()
{
if ($this->cacheChanged) {
if (is_writable(dirname($this->cacheFile))) {
file_put_contents($this->cacheFile, serialize(array($this->classes, $this->dirs, $this->files)));
file_put_contents($this->cacheFile, serialize([$this->classes, $this->dirs, $this->files]));
}

$this->cacheChanged = false;
Expand All @@ -152,7 +152,7 @@ public function saveCache()
*/
public function reload()
{
$this->classes = array();
$this->classes = [];
$this->cacheLoaded = false;

foreach ($this->dirs as $dir) {
Expand Down
2 changes: 1 addition & 1 deletion lib/cache/sfAPCCache.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class sfAPCCache extends sfCache
*
* @see sfCache
*/
public function initialize($options = array())
public function initialize($options = [])
{
parent::initialize($options);

Expand Down
2 changes: 1 addition & 1 deletion lib/cache/sfAPCuCache.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class sfAPCuCache extends sfCache
*
* @see sfCache
*/
public function initialize($options = array())
public function initialize($options = [])
{
parent::initialize($options);

Expand Down
Loading

0 comments on commit 1ac0672

Please sign in to comment.