Skip to content

Commit 8fa04a0

Browse files
committed
add(phpcs) psr12 and fully_qualified_strict_types
1 parent 7cc4a19 commit 8fa04a0

File tree

845 files changed

+7556
-8303
lines changed

Some content is hidden

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

845 files changed

+7556
-8303
lines changed

.php-cs-fixer.dist.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22

3-
$finder = PhpCsFixer\Finder::create()
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
6+
$finder = Finder::create()
47
->ignoreVCSIgnored(true)
58
->in(__DIR__.'/lib')
69
->in(__DIR__.'/data/bin')
@@ -14,13 +17,18 @@
1417
->notPath('unit/config/fixtures/sfFilterConfigHandler/result.php')
1518
;
1619

17-
$config = new PhpCsFixer\Config();
20+
$config = new Config();
1821
$config->setRules([
1922
'@PhpCsFixer' => true,
2023
'@Symfony' => true,
24+
'@PSR12' => true,
2125
'array_syntax' => [
2226
'syntax' => 'short',
2327
],
28+
'fully_qualified_strict_types' => [
29+
'import_symbols' => true,
30+
'leading_backslash_in_global_namespace' => true,
31+
],
2432
])
2533
->setCacheFile('.php-cs-fixer.cache')
2634
->setFinder($finder)

data/bin/changelog.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@
3131
exit(1);
3232
}
3333

34-
$filesystem = new sfFilesystem();
34+
$filesystem = new \sfFilesystem();
3535

3636
list($out, $err) = $filesystem->execute('svn info --xml');
37-
$info = new SimpleXMLElement($out);
37+
$info = new \SimpleXMLElement($out);
3838

3939
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],
4242
])));
43-
$log = new SimpleXMLElement($out);
43+
$log = new \SimpleXMLElement($out);
4444

4545
foreach ($log->logentry as $logentry) {
4646
echo sprintf(' * [%d] %s', $logentry['revision'], trim(preg_replace('/\s*\[[\d\., ]+\]\s*/', '', (string) $logentry->msg)));

data/bin/check_configuration.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ 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
1510
*/
1611
function check($boolean, $message, $help = '', $fatal = false)
1712
{
@@ -72,7 +67,7 @@ function get_ini_path()
7267
echo "\n** Optional checks **\n\n";
7368
check(class_exists('PDO'), 'PDO is installed', 'Install PDO (mandatory for Doctrine)', false);
7469
if (class_exists('PDO')) {
75-
$drivers = PDO::getAvailableDrivers();
70+
$drivers = \PDO::getAvailableDrivers();
7671
check(count($drivers), 'PDO has some drivers installed: '.implode(', ', $drivers), 'Install PDO drivers (mandatory for Doctrine)');
7772
}
7873
check(function_exists('token_get_all'), 'The token_get_all() function is available', 'Install and enable the Tokenizer extension (highly recommended)', false);

data/bin/release.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626
require_once __DIR__.'/../../lib/vendor/lime/lime.php';
2727

2828
if (!isset($argv[1])) {
29-
throw new Exception('You must provide version prefix.');
29+
throw new \Exception('You must provide version prefix.');
3030
}
3131

3232
if (!isset($argv[2])) {
33-
throw new Exception('You must provide stability status (alpha/beta/stable).');
33+
throw new \Exception('You must provide stability status (alpha/beta/stable).');
3434
}
3535

3636
$stability = $argv[2];
3737

38-
$filesystem = new sfFilesystem();
38+
$filesystem = new \sfFilesystem();
3939

4040
if (('beta' == $stability || 'alpha' == $stability) && count(explode('.', $argv[1])) < 2) {
4141
$version_prefix = $argv[1];
@@ -46,7 +46,7 @@
4646
}
4747

4848
if (!isset($version)) {
49-
throw new Exception('Unable to find last SVN revision.');
49+
throw new \Exception('Unable to find last SVN revision.');
5050
}
5151

5252
// make a PEAR compatible version
@@ -61,7 +61,7 @@
6161
list($result) = $filesystem->execute('php data/bin/symfony symfony:test');
6262

6363
if (0 != $result) {
64-
throw new Exception('Some tests failed. Release process aborted!');
64+
throw new \Exception('Some tests failed. Release process aborted!');
6565
}
6666

6767
if (is_file('package.xml')) {
@@ -71,7 +71,7 @@
7171
$filesystem->copy(getcwd().'/package.xml.tmpl', getcwd().'/package.xml');
7272

7373
// add class files
74-
$finder = sfFinder::type('file')->relative();
74+
$finder = \sfFinder::type('file')->relative();
7575
$xml_classes = '';
7676
$dirs = ['lib' => 'php', 'data' => 'data'];
7777
foreach ($dirs as $dir => $role) {

data/bin/sandbox_installer.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
$this->installDir(__DIR__.'/sandbox_skeleton');
44

55
$this->logSection('install', 'add symfony CLI for Windows users');
6-
$this->getFilesystem()->copy(__DIR__.'/symfony.bat', sfConfig::get('sf_root_dir').'/symfony.bat');
6+
$this->getFilesystem()->copy(__DIR__.'/symfony.bat', \sfConfig::get('sf_root_dir').'/symfony.bat');
77

88
$this->logSection('install', 'add LICENSE');
9-
$this->getFilesystem()->copy(__DIR__.'/../../LICENSE', sfConfig::get('sf_root_dir').'/LICENSE');
9+
$this->getFilesystem()->copy(__DIR__.'/../../LICENSE', \sfConfig::get('sf_root_dir').'/LICENSE');
1010

1111
$this->logSection('install', 'default to sqlite');
12-
$this->runTask('configure:database', sprintf("'sqlite:%s/sandbox.db'", sfConfig::get('sf_data_dir')));
12+
$this->runTask('configure:database', sprintf("'sqlite:%s/sandbox.db'", \sfConfig::get('sf_data_dir')));
1313

1414
$this->logSection('install', 'create an application');
1515
$this->runTask('generate:app', 'frontend');
@@ -18,13 +18,13 @@
1818
$this->runTask('plugin:publish-assets');
1919

2020
$this->logSection('install', 'fix sqlite database permissions');
21-
touch(sfConfig::get('sf_data_dir').'/sandbox.db');
22-
chmod(sfConfig::get('sf_data_dir'), 0777);
23-
chmod(sfConfig::get('sf_data_dir').'/sandbox.db', 0777);
21+
touch(\sfConfig::get('sf_data_dir').'/sandbox.db');
22+
chmod(\sfConfig::get('sf_data_dir'), 0777);
23+
chmod(\sfConfig::get('sf_data_dir').'/sandbox.db', 0777);
2424

2525
$this->logSection('install', 'add an empty file in empty directories');
2626
$seen = [];
27-
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(sfConfig::get('sf_root_dir')), RecursiveIteratorIterator::CHILD_FIRST) as $path => $item) {
27+
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');
3030
}

0 commit comments

Comments
 (0)