From b14cbc1845eda45d780e1f74f8245cfc118442ad Mon Sep 17 00:00:00 2001 From: Dariusz Date: Mon, 1 Jan 2018 23:05:14 +0100 Subject: [PATCH] PHP CS Fixer: clean up repo and adjust config --- .php_cs.dist | 7 ++++ .../Extension/TranslationExtensionTest.php | 41 +++++++++++++------ .../Translation/Translator.php | 2 + .../Debug/Resources/ext/tests/001.phpt | 4 +- .../Debug/Resources/ext/tests/002.phpt | 4 +- .../Debug/Resources/ext/tests/002_1.phpt | 4 +- .../Debug/Resources/ext/tests/003.phpt | 4 +- .../Debug/Tests/phpt/exception_rethrown.phpt | 1 - .../phpt/fatal_with_nested_handlers.phpt | 4 +- .../Handler/LegacyPdoSessionHandler.php | 2 + .../Handler/MemcacheSessionHandler.php | 2 + .../Handler/MemcachedSessionHandler.php | 2 + .../Storage/Handler/MongoDbSessionHandler.php | 2 + src/Symfony/Component/HttpKernel/Client.php | 2 +- .../HttpKernel/HttpCache/HttpCache.php | 2 + src/Symfony/Component/Routing/Route.php | 2 + 16 files changed, 66 insertions(+), 19 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index 27b38a4dae..e47c539616 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -12,6 +12,9 @@ return PhpCsFixer\Config::create() 'php_unit_no_expectation_annotation' => false, // part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice 'array_syntax' => array('syntax' => 'long'), 'protected_to_private' => false, + // rule disabled due to https://bugs.php.net/bug.php?id=60573 bug; + // to be re-enabled (by dropping next line, rule is part of @Symfony already) on branch that requires PHP 5.4+ + 'self_accessor' => false, )) ->setRiskyAllowed(true) ->setFinder( @@ -39,5 +42,9 @@ return PhpCsFixer\Config::create() ->notPath('Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php') // explicit heredoc test ->notPath('Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php') + // explicit trigger_error tests + ->notPath('Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt') + ->notPath('Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt') + ->notPath('Symfony/Component/Debug/Tests/DebugClassLoaderTest.php') ) ; diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php index 36016d7f49..19f219b696 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php @@ -89,18 +89,35 @@ class TranslationExtensionTest extends TestCase array('{% trans into "fr"%}Hello{% endtrans %}', 'Hello'), // transchoice - array('{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0)), - array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples', array('count' => 5)), - array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony')), - array('{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5)), - array('{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0)), - array('{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples'), + array( + '{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', + 'There is no apples', + array('count' => 0), + ), + array( + '{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', + 'There is 5 apples', + array('count' => 5), + ), + array( + '{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', + 'There is 5 apples (Symfony)', + array('count' => 5, 'name' => 'Symfony'), + ), + array( + '{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', + 'There is 5 apples (Symfony)', + array('count' => 5), + ), + array( + '{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', + 'There is no apples', + array('count' => 0), + ), + array( + '{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', + 'There is 5 apples', + ), // trans filter array('{{ "Hello"|trans }}', 'Hello'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php index 3b68fda38c..9fdfb645d3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php @@ -46,6 +46,8 @@ class Translator extends BaseTranslator implements WarmableInterface private $resources = array(); /** + * Constructor. + * * Available options: * * * cache_dir: The cache directory (or null to disable caching) diff --git a/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt b/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt index 15e183a706..4a87cd3180 100644 --- a/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt +++ b/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt @@ -1,7 +1,9 @@ --TEST-- Test symfony_zval_info API --SKIPIF-- - + --FILE-- + --FILE-- + --FILE-- + --FILE-- setDefaultLogger(new TestLogger()); ini_set('display_errors', 1); throw new \Exception('foo'); - ?> --EXPECTF-- Uncaught Exception: foo diff --git a/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt b/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt index 2a9bcf9b0a..6a17648a2a 100644 --- a/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt +++ b/src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt @@ -24,7 +24,9 @@ var_dump(array( $eHandler[0]->setExceptionHandler('print_r'); if (true) { - class Broken implements \Serializable {}; + class Broken implements \Serializable + { + } } ?> diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php index d8af869f61..194c9cd779 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/LegacyPdoSessionHandler.php @@ -54,6 +54,8 @@ class LegacyPdoSessionHandler implements \SessionHandlerInterface private $timeCol; /** + * Construct new legacy PDO session handler. + * * List of available options: * * db_table: The name of the table [required] * * db_id_col: The column where to store the session id [default: sess_id] diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php index 89b4dac2c6..9575e4e9a7 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php @@ -29,6 +29,8 @@ class MemcacheSessionHandler implements \SessionHandlerInterface private $prefix; /** + * Constructor. + * * List of available options: * * prefix: The prefix to use for the memcache keys in order to avoid collision * * expiretime: The time to live in seconds diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php index 6e2c2ee306..2c45face4d 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -34,6 +34,8 @@ class MemcachedSessionHandler implements \SessionHandlerInterface private $prefix; /** + * Constructor. + * * List of available options: * * prefix: The prefix to use for the memcached keys in order to avoid collision * * expiretime: The time to live in seconds diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index 29fc3f529b..0d8e2dd0ab 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -29,6 +29,8 @@ class MongoDbSessionHandler implements \SessionHandlerInterface private $options; /** + * Constructor. + * * List of available options: * * database: The name of the database [required] * * collection: The name of the collection [required] diff --git a/src/Symfony/Component/HttpKernel/Client.php b/src/Symfony/Component/HttpKernel/Client.php index 05fb6e8de0..c19b6ade76 100644 --- a/src/Symfony/Component/HttpKernel/Client.php +++ b/src/Symfony/Component/HttpKernel/Client.php @@ -26,7 +26,7 @@ use Symfony\Component\HttpFoundation\Response; * * @author Fabien Potencier * - * @method Request|null getRequest() A Request instance + * @method Request|null getRequest() A Request instance * @method Response|null getResponse() A Response instance */ class Client extends BaseClient diff --git a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php index 0bcb84ea5f..81c75ff740 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php @@ -36,6 +36,8 @@ class HttpCache implements HttpKernelInterface, TerminableInterface private $traces = array(); /** + * Constructor. + * * The available options are: * * * debug: If true, the traces are added as a HTTP header to ease debugging diff --git a/src/Symfony/Component/Routing/Route.php b/src/Symfony/Component/Routing/Route.php index 0eca3f8c8f..41525e0d81 100644 --- a/src/Symfony/Component/Routing/Route.php +++ b/src/Symfony/Component/Routing/Route.php @@ -34,6 +34,8 @@ class Route implements \Serializable private $compiled; /** + * Constructor. + * * Available options: * * * compiler_class: A class name able to compile this route instance (RouteCompiler by default)