Skip to content

Commit

Permalink
Fix(php-cs) Fix php-cs styles according to configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
thePanz committed Feb 22, 2023
1 parent ffbbce6 commit 2cbd557
Show file tree
Hide file tree
Showing 907 changed files with 67,547 additions and 73,034 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ root = true

[*]
indent_style = space
indent_size = 2
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
Expand Down
31 changes: 15 additions & 16 deletions data/bin/changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of the symfony package.
* (c) Fabien Potencier <[email protected]>
*
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Expand All @@ -13,22 +13,22 @@
*
* Usage: php data/bin/changelog.php -r12345:67890 /branches/1.3
*
* @package symfony
* @author Fabien Potencier <[email protected]>
*
* @version SVN: $Id$
*/
require_once __DIR__.'/../../lib/task/sfFilesystem.class.php';

if (!isset($argv[1]))
{
echo "You must provide a revision range (-r123:456)\n";
exit(1);
if (!isset($argv[1])) {
echo "You must provide a revision range (-r123:456)\n";

exit(1);
}

if (!isset($argv[2]))
{
echo "You must provide a repository path (/branches/1.4)\n";
exit(1);
if (!isset($argv[2])) {
echo "You must provide a repository path (/branches/1.4)\n";

exit(1);
}

$filesystem = new sfFilesystem();
Expand All @@ -37,13 +37,12 @@
$info = new SimpleXMLElement($out);

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

foreach ($log->logentry as $logentry)
{
echo sprintf(' * [%d] %s', $logentry['revision'], trim(preg_replace('/\s*\[[\d\., ]+\]\s*/', '', (string) $logentry->msg)));
echo PHP_EOL;
foreach ($log->logentry as $logentry) {
echo sprintf(' * [%d] %s', $logentry['revision'], trim(preg_replace('/\s*\[[\d\., ]+\]\s*/', '', (string) $logentry->msg)));
echo PHP_EOL;
}
77 changes: 36 additions & 41 deletions data/bin/check_configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,28 @@

function is_cli()
{
return !isset($_SERVER['HTTP_HOST']);
return !isset($_SERVER['HTTP_HOST']);
}

/**
* Checks a configuration.
*
* @param mixed $boolean
* @param mixed $message
* @param mixed $help
* @param mixed $fatal
*/
function check($boolean, $message, $help = '', $fatal = false)
{
echo $boolean ? " OK " : sprintf("[[%s]] ", $fatal ? ' ERROR ' : 'WARNING');
echo sprintf("$message%s\n", $boolean ? '' : ': FAILED');
echo $boolean ? ' OK ' : sprintf('[[%s]] ', $fatal ? ' ERROR ' : 'WARNING');
echo sprintf("{$message}%s\n", $boolean ? '' : ': FAILED');

if (!$boolean)
{
echo " *** $help ***\n";
if ($fatal)
{
die("You must fix this problem before resuming the check.\n");
if (!$boolean) {
echo " *** {$help} ***\n";
if ($fatal) {
exit("You must fix this problem before resuming the check.\n");
}
}
}
}

/**
Expand All @@ -30,17 +33,15 @@ function check($boolean, $message, $help = '', $fatal = false)
*/
function get_ini_path()
{
if ($path = get_cfg_var('cfg_file_path'))
{
return $path;
}
if ($path = get_cfg_var('cfg_file_path')) {
return $path;
}

return 'WARNING: not using a php.ini file';
return 'WARNING: not using a php.ini file';
}

if (!is_cli())
{
echo '<html><body><pre>';
if (!is_cli()) {
echo '<html><body><pre>';
}

echo "********************************\n";
Expand All @@ -51,18 +52,16 @@ function get_ini_path()

echo sprintf("php.ini used by PHP: %s\n\n", get_ini_path());

if (is_cli())
{
echo "** WARNING **\n";
echo "* The PHP CLI can use a different php.ini file\n";
echo "* than the one used with your web server.\n";
if ('\\' == DIRECTORY_SEPARATOR)
{
echo "* (especially on the Windows platform)\n";
}
echo "* If this is the case, please launch this\n";
echo "* utility from your web server.\n";
echo "** WARNING **\n";
if (is_cli()) {
echo "** WARNING **\n";
echo "* The PHP CLI can use a different php.ini file\n";
echo "* than the one used with your web server.\n";
if ('\\' == DIRECTORY_SEPARATOR) {
echo "* (especially on the Windows platform)\n";
}
echo "* If this is the case, please launch this\n";
echo "* utility from your web server.\n";
echo "** WARNING **\n";
}

// mandatory
Expand All @@ -72,10 +71,9 @@ function get_ini_path()
// warnings
echo "\n** Optional checks **\n\n";
check(class_exists('PDO'), 'PDO is installed', 'Install PDO (mandatory for Doctrine)', false);
if (class_exists('PDO'))
{
$drivers = PDO::getAvailableDrivers();
check(count($drivers), 'PDO has some drivers installed: '.implode(', ', $drivers), 'Install PDO drivers (mandatory for Doctrine)');
if (class_exists('PDO')) {
$drivers = PDO::getAvailableDrivers();
check(count($drivers), 'PDO has some drivers installed: '.implode(', ', $drivers), 'Install PDO drivers (mandatory for Doctrine)');
}
check(function_exists('token_get_all'), 'The token_get_all() function is available', 'Install and enable the Tokenizer extension (highly recommended)', false);
check(function_exists('mb_strlen'), 'The mb_strlen() function is available', 'Install and enable the mbstring extension', false);
Expand All @@ -85,10 +83,8 @@ function get_ini_path()

$accelerator =
(function_exists('apc_store') && ini_get('apc.enabled'))
||
function_exists('eaccelerator_put') && ini_get('eaccelerator.enable')
||
function_exists('xcache_set')
|| function_exists('eaccelerator_put') && ini_get('eaccelerator.enable')
|| function_exists('xcache_set')
;
check($accelerator, 'A PHP accelerator is installed', 'Install a PHP accelerator like APC (highly recommended)', false);

Expand All @@ -99,7 +95,6 @@ function_exists('xcache_set')

check(class_exists('Memcache'), 'Memcache is available', 'You must have memcache installed and enabled to use sfMemcacheCache class.', false);

if (!is_cli())
{
echo '</pre></body></html>';
if (!is_cli()) {
echo '</pre></body></html>';
}
90 changes: 41 additions & 49 deletions data/bin/release.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of the symfony package.
* (c) 2004-2007 Fabien Potencier <[email protected]>
*
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Expand All @@ -13,65 +13,59 @@
*
* Usage: php data/bin/release.php 1.3.0 stable
*
* @package symfony
* @author Fabien Potencier <[email protected]>
*
* @version SVN: $Id$
*/
require_once(__DIR__.'/../../lib/exception/sfException.class.php');
require_once(__DIR__.'/../../lib/task/sfFilesystem.class.php');
require_once(__DIR__.'/../../lib/util/sfFinder.class.php');
require_once(__DIR__.'/../../lib/vendor/lime/lime.php');

if (!isset($argv[1]))
{
throw new Exception('You must provide version prefix.');
require_once __DIR__.'/../../lib/exception/sfException.class.php';

require_once __DIR__.'/../../lib/task/sfFilesystem.class.php';

require_once __DIR__.'/../../lib/util/sfFinder.class.php';

require_once __DIR__.'/../../lib/vendor/lime/lime.php';

if (!isset($argv[1])) {
throw new Exception('You must provide version prefix.');
}

if (!isset($argv[2]))
{
throw new Exception('You must provide stability status (alpha/beta/stable).');
if (!isset($argv[2])) {
throw new Exception('You must provide stability status (alpha/beta/stable).');
}

$stability = $argv[2];

$filesystem = new sfFilesystem();

if (($stability == 'beta' || $stability == 'alpha') && count(explode('.', $argv[1])) < 2)
{
$version_prefix = $argv[1];
if (('beta' == $stability || 'alpha' == $stability) && count(explode('.', $argv[1])) < 2) {
$version_prefix = $argv[1];

list($result) = $filesystem->execute('svn status -u '.getcwd());
if (preg_match('/Status against revision\:\s+(\d+)\s*$/im', $result, $match))
{
$version = $match[1];
}
list($result) = $filesystem->execute('svn status -u '.getcwd());
if (preg_match('/Status against revision\:\s+(\d+)\s*$/im', $result, $match)) {
$version = $match[1];
}

if (!isset($version))
{
throw new Exception('Unable to find last SVN revision.');
}
if (!isset($version)) {
throw new Exception('Unable to find last SVN revision.');
}

// make a PEAR compatible version
$version = $version_prefix.'.'.$version;
}
else
{
$version = $argv[1];
// make a PEAR compatible version
$version = $version_prefix.'.'.$version;
} else {
$version = $argv[1];
}

print sprintf("Releasing symfony version \"%s\".\n", $version);
echo sprintf("Releasing symfony version \"%s\".\n", $version);

// tests
list($result) = $filesystem->execute('php data/bin/symfony symfony:test');

if (0 != $result)
{
throw new Exception('Some tests failed. Release process aborted!');
if (0 != $result) {
throw new Exception('Some tests failed. Release process aborted!');
}

if (is_file('package.xml'))
{
$filesystem->remove(getcwd().DIRECTORY_SEPARATOR.'package.xml');
if (is_file('package.xml')) {
$filesystem->remove(getcwd().DIRECTORY_SEPARATOR.'package.xml');
}

$filesystem->copy(getcwd().'/package.xml.tmpl', getcwd().'/package.xml');
Expand All @@ -80,21 +74,19 @@
$finder = sfFinder::type('file')->relative();
$xml_classes = '';
$dirs = array('lib' => 'php', 'data' => 'data');
foreach ($dirs as $dir => $role)
{
$class_files = $finder->in($dir);
foreach ($class_files as $file)
{
$xml_classes .= '<file role="'.$role.'" baseinstalldir="symfony" install-as="'.$file.'" name="'.$dir.'/'.$file.'" />'."\n";
}
foreach ($dirs as $dir => $role) {
$class_files = $finder->in($dir);
foreach ($class_files as $file) {
$xml_classes .= '<file role="'.$role.'" baseinstalldir="symfony" install-as="'.$file.'" name="'.$dir.'/'.$file.'" />'."\n";
}
}

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

list($results) = $filesystem->execute('pear package');
Expand Down
14 changes: 6 additions & 8 deletions data/bin/sandbox_installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@

$this->logSection('install', 'add an empty file in empty directories');
$seen = array();
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');
}

$seen[$item->getPath()] = true;
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');
}

$seen[$item->getPath()] = true;
}
Loading

0 comments on commit 2cbd557

Please sign in to comment.