CS: apply rules

This commit is contained in:
Dariusz Ruminski 2016-10-30 10:34:06 +01:00 committed by Nicolas Grekas
parent 287713fd6a
commit 22d4e15634
68 changed files with 185 additions and 200 deletions

View File

@ -138,7 +138,6 @@ abstract class DoctrineType extends AbstractType
$type = $this; $type = $this;
$choiceLoader = function (Options $options) use ($choiceListFactory, &$choiceLoaders, $type) { $choiceLoader = function (Options $options) use ($choiceListFactory, &$choiceLoaders, $type) {
// Unless the choices are given explicitly, load them on demand // Unless the choices are given explicitly, load them on demand
if (null === $options['choices']) { if (null === $options['choices']) {
$hash = null; $hash = null;

View File

@ -44,7 +44,7 @@ class DoctrineExtensionTest extends \PHPUnit_Framework_TestCase
$this->extension->expects($this->any()) $this->extension->expects($this->any())
->method('getObjectManagerElementName') ->method('getObjectManagerElementName')
->will($this->returnCallback(function ($name) { ->will($this->returnCallback(function ($name) {
return 'doctrine.orm.'.$name; return 'doctrine.orm.'.$name;
})); }));
} }

View File

@ -60,7 +60,7 @@ class DebugCommand extends Command
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (text or json)', 'text'), new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (text or json)', 'text'),
)) ))
->setDescription('Shows a list of twig functions, filters, globals and tests') ->setDescription('Shows a list of twig functions, filters, globals and tests')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command outputs a list of twig functions, The <info>%command.name%</info> command outputs a list of twig functions,
filters, globals and tests. Output can be filtered with an optional argument. filters, globals and tests. Output can be filtered with an optional argument.

View File

@ -61,7 +61,7 @@ class LintCommand extends Command
->setDescription('Lints a template and outputs encountered errors') ->setDescription('Lints a template and outputs encountered errors')
->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt') ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt')
->addArgument('filename', InputArgument::IS_ARRAY) ->addArgument('filename', InputArgument::IS_ARRAY)
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command lints a template and outputs to STDOUT The <info>%command.name%</info> command lints a template and outputs to STDOUT
the first encountered syntax error. the first encountered syntax error.

View File

@ -39,7 +39,7 @@ class ConfigDebugCommand extends AbstractConfigCommand
new InputArgument('name', InputArgument::OPTIONAL, 'The bundle name or the extension alias'), new InputArgument('name', InputArgument::OPTIONAL, 'The bundle name or the extension alias'),
)) ))
->setDescription('Dumps the current configuration for an extension') ->setDescription('Dumps the current configuration for an extension')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command dumps the current configuration for an The <info>%command.name%</info> command dumps the current configuration for an
extension/bundle. extension/bundle.

View File

@ -38,7 +38,7 @@ class EventDispatcherDebugCommand extends ContainerAwareCommand
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw description'), new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw description'),
)) ))
->setDescription('Displays configured listeners for an application') ->setDescription('Displays configured listeners for an application')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command displays all configured listeners: The <info>%command.name%</info> command displays all configured listeners:
<info>php %command.full_name%</info> <info>php %command.full_name%</info>

View File

@ -39,7 +39,7 @@ class ServerStartCommand extends ServerCommand
)) ))
->setName('server:start') ->setName('server:start')
->setDescription('Starts PHP built-in web server in the background') ->setDescription('Starts PHP built-in web server in the background')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> runs PHP's built-in web server: The <info>%command.name%</info> runs PHP's built-in web server:
<info>php %command.full_name%</info> <info>php %command.full_name%</info>

View File

@ -33,7 +33,7 @@ class ServerStopCommand extends ServerCommand
)) ))
->setName('server:stop') ->setName('server:stop')
->setDescription('Stops PHP\'s built-in web server that was started with the server:start command') ->setDescription('Stops PHP\'s built-in web server that was started with the server:start command')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> stops PHP's built-in web server: The <info>%command.name%</info> stops PHP's built-in web server:
<info>php %command.full_name%</info> <info>php %command.full_name%</info>

View File

@ -50,7 +50,7 @@ class TranslationDebugCommand extends ContainerAwareCommand
new InputOption('only-unused', null, InputOption::VALUE_NONE, 'Displays only unused messages'), new InputOption('only-unused', null, InputOption::VALUE_NONE, 'Displays only unused messages'),
)) ))
->setDescription('Displays translation messages information') ->setDescription('Displays translation messages information')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command helps finding unused or missing translation The <info>%command.name%</info> command helps finding unused or missing translation
messages and comparing them with the fallback ones by inspecting the messages and comparing them with the fallback ones by inspecting the
templates and translation files of a given bundle or the app folder. templates and translation files of a given bundle or the app folder.

View File

@ -34,7 +34,7 @@ class YamlLintCommand extends Command
->setDescription('Lints a file and outputs encountered errors') ->setDescription('Lints a file and outputs encountered errors')
->addArgument('filename', null, 'A file or a directory or STDIN') ->addArgument('filename', null, 'A file or a directory or STDIN')
->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt') ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt')
->setHelp(<<<EOF ->setHelp(<<<'EOF'
The <info>%command.name%</info> command lints a YAML file and outputs to STDOUT The <info>%command.name%</info> command lints a YAML file and outputs to STDOUT
the first encountered syntax error. the first encountered syntax error.

View File

@ -1 +1 @@
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?> <?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?>

View File

@ -1 +1 @@
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')) ?> <?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')) ?>

View File

@ -1 +1 @@
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?> % <?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?> %

View File

@ -1 +1 @@
<?php echo $view['form']->block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')) ?> <?php echo $view['form']->block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')) ?>

View File

@ -1 +1 @@
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')) ?> <?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')) ?>

View File

@ -1 +1 @@
<?php echo $view['form']->block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')) ?> <?php echo $view['form']->block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')) ?>

View File

@ -1 +1 @@
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')) ?> <?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')) ?>

View File

@ -164,7 +164,6 @@ class Router extends BaseRouter implements WarmableInterface
gettype($resolved) gettype($resolved)
) )
); );
}, $value); }, $value);
return str_replace('%%', '%', $escapedValue); return str_replace('%%', '%', $escapedValue);

View File

@ -88,7 +88,6 @@ class RouterMatchCommandTest extends \PHPUnit_Framework_TestCase
->will($this->returnValueMap(array( ->will($this->returnValueMap(array(
array('router', 1, $router), array('router', 1, $router),
array('controller_name_converter', 1, $loader), array('controller_name_converter', 1, $loader),
))); )));
return $container; return $container;

View File

@ -136,7 +136,7 @@ class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
->method('extract') ->method('extract')
->will( ->will(
$this->returnCallback(function ($path, $catalogue) use ($extractedMessages) { $this->returnCallback(function ($path, $catalogue) use ($extractedMessages) {
$catalogue->add($extractedMessages); $catalogue->add($extractedMessages);
}) })
); );
@ -146,7 +146,7 @@ class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
->method('loadMessages') ->method('loadMessages')
->will( ->will(
$this->returnCallback(function ($path, $catalogue) use ($loadedMessages) { $this->returnCallback(function ($path, $catalogue) use ($loadedMessages) {
$catalogue->add($loadedMessages); $catalogue->add($loadedMessages);
}) })
); );

View File

@ -74,7 +74,7 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
->method('extract') ->method('extract')
->will( ->will(
$this->returnCallback(function ($path, $catalogue) use ($extractedMessages) { $this->returnCallback(function ($path, $catalogue) use ($extractedMessages) {
$catalogue->add($extractedMessages); $catalogue->add($extractedMessages);
}) })
); );
@ -84,7 +84,7 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
->method('loadMessages') ->method('loadMessages')
->will( ->will(
$this->returnCallback(function ($path, $catalogue) use ($loadedMessages) { $this->returnCallback(function ($path, $catalogue) use ($loadedMessages) {
$catalogue->add($loadedMessages); $catalogue->add($loadedMessages);
}) })
); );

View File

@ -141,6 +141,7 @@ abstract class AbstractDescriptorTest extends \PHPUnit_Framework_TestCase
} }
abstract protected function getDescriptor(); abstract protected function getDescriptor();
abstract protected function getFormat(); abstract protected function getFormat();
private function assertDescription($expectedDescription, $describedObject, array $options = array()) private function assertDescription($expectedDescription, $describedObject, array $options = array())

View File

@ -191,9 +191,11 @@ class CallableClass
public function __invoke() public function __invoke()
{ {
} }
public static function staticMethod() public static function staticMethod()
{ {
} }
public function method() public function method()
{ {
} }

View File

@ -1,7 +1,7 @@
This template is used for translation message extraction tests This template is used for translation message extraction tests
<?php echo $view['translator']->trans('single-quoted key') ?> <?php echo $view['translator']->trans('single-quoted key') ?>
<?php echo $view['translator']->trans('double-quoted key') ?> <?php echo $view['translator']->trans('double-quoted key') ?>
<?php echo $view['translator']->trans(<<<EOF <?php echo $view['translator']->trans(<<<'EOF'
heredoc key heredoc key
EOF EOF
) ?> ) ?>

View File

@ -81,7 +81,7 @@ class SecurityDataCollector extends DataCollector
'authenticated' => $token->isAuthenticated(), 'authenticated' => $token->isAuthenticated(),
'token_class' => get_class($token), 'token_class' => get_class($token),
'user' => $token->getUsername(), 'user' => $token->getUsername(),
'roles' => array_map(function (RoleInterface $role) { return $role->getRole();}, $assignedRoles), 'roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $assignedRoles),
'inherited_roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $inheritedRoles), 'inherited_roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $inheritedRoles),
'supports_role_hierarchy' => null !== $this->roleHierarchy, 'supports_role_hierarchy' => null !== $this->roleHierarchy,
); );

View File

@ -25,7 +25,7 @@ interface SecurityFactoryInterface
* Configures the container services required to use the authentication listener. * Configures the container services required to use the authentication listener.
* *
* @param ContainerBuilder $container * @param ContainerBuilder $container
* @param string $id The unique id of the firewall * @param string $id The unique id of the firewall
* @param array $config The options array for the listener * @param array $config The options array for the listener
* @param string $userProvider The service id of the user provider * @param string $userProvider The service id of the user provider
* @param string $defaultEntryPoint * @param string $defaultEntryPoint
@ -48,7 +48,7 @@ interface SecurityFactoryInterface
/** /**
* Defines the configuration key used to reference the provider * Defines the configuration key used to reference the provider
* in the firewall configuration. * in the firewall configuration.
* *
* @return string * @return string
*/ */
public function getKey(); public function getKey();

View File

@ -34,7 +34,6 @@ class PreviewErrorControllerTest extends TestCase
->method('handle') ->method('handle')
->with( ->with(
$this->callback(function (Request $request) use ($self, $logicalControllerName, $code) { $this->callback(function (Request $request) use ($self, $logicalControllerName, $code) {
$self->assertEquals($logicalControllerName, $request->attributes->get('_controller')); $self->assertEquals($logicalControllerName, $request->attributes->get('_controller'));
$exception = $request->attributes->get('exception'); $exception = $request->attributes->get('exception');

View File

@ -34,7 +34,7 @@ class XmlReferenceDumperTest extends \PHPUnit_Framework_TestCase
private function getConfigurationAsString() private function getConfigurationAsString()
{ {
return str_replace("\n", PHP_EOL, <<<EOL return str_replace("\n", PHP_EOL, <<<'EOL'
<!-- Namespace: http://example.org/schema/dic/acme_root --> <!-- Namespace: http://example.org/schema/dic/acme_root -->
<!-- scalar-required: Required --> <!-- scalar-required: Required -->
<!-- enum-with-default: One of "this"; "that" --> <!-- enum-with-default: One of "this"; "that" -->

View File

@ -112,7 +112,7 @@ TABLE
array('ISBN', 'Title', 'Author'), array('ISBN', 'Title', 'Author'),
$books, $books,
TableHelper::LAYOUT_COMPACT, TableHelper::LAYOUT_COMPACT,
<<<TABLE <<<'TABLE'
ISBN Title Author ISBN Title Author
99921-58-10-7 Divine Comedy Dante Alighieri 99921-58-10-7 Divine Comedy Dante Alighieri
9971-5-0210-0 A Tale of Two Cities Charles Dickens 9971-5-0210-0 A Tale of Two Cities Charles Dickens
@ -125,7 +125,7 @@ TABLE
array('ISBN', 'Title', 'Author'), array('ISBN', 'Title', 'Author'),
$books, $books,
TableHelper::LAYOUT_BORDERLESS, TableHelper::LAYOUT_BORDERLESS,
<<<TABLE <<<'TABLE'
=============== ========================== ================== =============== ========================== ==================
ISBN Title Author ISBN Title Author
=============== ========================== ================== =============== ========================== ==================

View File

@ -46,35 +46,35 @@ class ProcessHelperTest extends \PHPUnit_Framework_TestCase
public function provideCommandsAndOutput() public function provideCommandsAndOutput()
{ {
$successOutputVerbose = <<<EOT $successOutputVerbose = <<<'EOT'
RUN php -r "echo 42;" RUN php -r "echo 42;"
RES Command ran successfully RES Command ran successfully
EOT; EOT;
$successOutputDebug = <<<EOT $successOutputDebug = <<<'EOT'
RUN php -r "echo 42;" RUN php -r "echo 42;"
OUT 42 OUT 42
RES Command ran successfully RES Command ran successfully
EOT; EOT;
$successOutputDebugWithTags = <<<EOT $successOutputDebugWithTags = <<<'EOT'
RUN php -r "echo '<info>42</info>';" RUN php -r "echo '<info>42</info>';"
OUT <info>42</info> OUT <info>42</info>
RES Command ran successfully RES Command ran successfully
EOT; EOT;
$successOutputProcessDebug = <<<EOT $successOutputProcessDebug = <<<'EOT'
RUN 'php' '-r' 'echo 42;' RUN 'php' '-r' 'echo 42;'
OUT 42 OUT 42
RES Command ran successfully RES Command ran successfully
EOT; EOT;
$syntaxErrorOutputVerbose = <<<EOT $syntaxErrorOutputVerbose = <<<'EOT'
RUN php -r "fwrite(STDERR, 'error message');usleep(50000);fwrite(STDOUT, 'out message');exit(252);" RUN php -r "fwrite(STDERR, 'error message');usleep(50000);fwrite(STDOUT, 'out message');exit(252);"
RES 252 Command did not run successfully RES 252 Command did not run successfully
EOT; EOT;
$syntaxErrorOutputDebug = <<<EOT $syntaxErrorOutputDebug = <<<'EOT'
RUN php -r "fwrite(STDERR, 'error message');usleep(500000);fwrite(STDOUT, 'out message');exit(252);" RUN php -r "fwrite(STDERR, 'error message');usleep(500000);fwrite(STDOUT, 'out message');exit(252);"
ERR error message ERR error message
OUT out message OUT out message

View File

@ -273,8 +273,6 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
); );
} }
/**
*/
public function testSetCurrentBeforeStarting() public function testSetCurrentBeforeStarting()
{ {
$bar = new ProgressBar($this->getOutputStream()); $bar = new ProgressBar($this->getOutputStream());
@ -588,7 +586,6 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
rewind($output->getStream()); rewind($output->getStream());
$this->assertEquals( $this->assertEquals(
" \033[44;37m Starting the demo... fingers crossed \033[0m\n". " \033[44;37m Starting the demo... fingers crossed \033[0m\n".
' 0/15 '.$progress.str_repeat($empty, 26)." 0%\n". ' 0/15 '.$progress.str_repeat($empty, 26)." 0%\n".
" \xf0\x9f\x8f\x81 < 1 sec \033[44;37m 0 B \033[0m" " \xf0\x9f\x8f\x81 < 1 sec \033[44;37m 0 B \033[0m"

View File

@ -96,7 +96,7 @@ class TableTest extends \PHPUnit_Framework_TestCase
array('ISBN', 'Title', 'Author'), array('ISBN', 'Title', 'Author'),
$books, $books,
'default', 'default',
<<<TABLE <<<'TABLE'
+---------------+--------------------------+------------------+ +---------------+--------------------------+------------------+
| ISBN | Title | Author | | ISBN | Title | Author |
+---------------+--------------------------+------------------+ +---------------+--------------------------+------------------+
@ -112,7 +112,7 @@ TABLE
array('ISBN', 'Title', 'Author'), array('ISBN', 'Title', 'Author'),
$books, $books,
'compact', 'compact',
<<<TABLE <<<'TABLE'
ISBN Title Author ISBN Title Author
99921-58-10-7 Divine Comedy Dante Alighieri 99921-58-10-7 Divine Comedy Dante Alighieri
9971-5-0210-0 A Tale of Two Cities Charles Dickens 9971-5-0210-0 A Tale of Two Cities Charles Dickens
@ -125,7 +125,7 @@ TABLE
array('ISBN', 'Title', 'Author'), array('ISBN', 'Title', 'Author'),
$books, $books,
'borderless', 'borderless',
<<<TABLE <<<'TABLE'
=============== ========================== ================== =============== ========================== ==================
ISBN Title Author ISBN Title Author
=============== ========================== ================== =============== ========================== ==================
@ -146,7 +146,7 @@ TABLE
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
), ),
'default', 'default',
<<<TABLE <<<'TABLE'
+---------------+--------------------------+------------------+ +---------------+--------------------------+------------------+
| ISBN | Title | | | ISBN | Title | |
+---------------+--------------------------+------------------+ +---------------+--------------------------+------------------+
@ -167,7 +167,7 @@ TABLE
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
), ),
'default', 'default',
<<<TABLE <<<'TABLE'
+---------------+--------------------------+------------------+ +---------------+--------------------------+------------------+
| 99921-58-10-7 | Divine Comedy | Dante Alighieri | | 99921-58-10-7 | Divine Comedy | Dante Alighieri |
| 9971-5-0210-0 | | | | 9971-5-0210-0 | | |
@ -186,7 +186,7 @@ TABLE
array('960-425-059-0', 'The Lord of the Rings', "J. R. R.\nTolkien"), array('960-425-059-0', 'The Lord of the Rings', "J. R. R.\nTolkien"),
), ),
'default', 'default',
<<<TABLE <<<'TABLE'
+---------------+----------------------------+-----------------+ +---------------+----------------------------+-----------------+
| ISBN | Title | Author | | ISBN | Title | Author |
+---------------+----------------------------+-----------------+ +---------------+----------------------------+-----------------+
@ -206,7 +206,7 @@ TABLE
array('ISBN', 'Title'), array('ISBN', 'Title'),
array(), array(),
'default', 'default',
<<<TABLE <<<'TABLE'
+------+-------+ +------+-------+
| ISBN | Title | | ISBN | Title |
+------+-------+ +------+-------+
@ -226,7 +226,7 @@ TABLE
array('9971-5-0210-0', 'A Tale of Two Cities', '<info>Charles Dickens</>'), array('9971-5-0210-0', 'A Tale of Two Cities', '<info>Charles Dickens</>'),
), ),
'default', 'default',
<<<TABLE <<<'TABLE'
+---------------+----------------------+-----------------+ +---------------+----------------------+-----------------+
| ISBN | Title | Author | | ISBN | Title | Author |
+---------------+----------------------+-----------------+ +---------------+----------------------+-----------------+
@ -243,7 +243,7 @@ TABLE
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
), ),
'default', 'default',
<<<TABLE <<<'TABLE'
+----------------------------------+----------------------+-----------------+ +----------------------------------+----------------------+-----------------+
| ISBN | Title | Author | | ISBN | Title | Author |
+----------------------------------+----------------------+-----------------+ +----------------------------------+----------------------+-----------------+
@ -275,7 +275,7 @@ TABLE
), ),
), ),
'default', 'default',
<<<TABLE <<<'TABLE'
+-------------------------------+-------------------------------+-----------------------------+ +-------------------------------+-------------------------------+-----------------------------+
| ISBN | Title | Author | | ISBN | Title | Author |
+-------------------------------+-------------------------------+-----------------------------+ +-------------------------------+-------------------------------+-----------------------------+
@ -308,7 +308,7 @@ TABLE
array('80-902734-1-7', 'Test'), array('80-902734-1-7', 'Test'),
), ),
'default', 'default',
<<<TABLE <<<'TABLE'
+---------------+----------------------+-----------------+ +---------------+----------------------+-----------------+
| ISBN | Title | Author | | ISBN | Title | Author |
+---------------+----------------------+-----------------+ +---------------+----------------------+-----------------+
@ -341,7 +341,7 @@ TABLE
array('J. R. R'), array('J. R. R'),
), ),
'default', 'default',
<<<TABLE <<<'TABLE'
+------------------+---------+-----------------+ +------------------+---------+-----------------+
| ISBN | Title | Author | | ISBN | Title | Author |
+------------------+---------+-----------------+ +------------------+---------+-----------------+
@ -376,7 +376,7 @@ TABLE
), ),
), ),
'default', 'default',
<<<TABLE <<<'TABLE'
+-----------------+-------+-----------------+ +-----------------+-------+-----------------+
| ISBN | Title | Author | | ISBN | Title | Author |
+-----------------+-------+-----------------+ +-----------------+-------+-----------------+
@ -413,7 +413,7 @@ TABLE
array('Charles Dickens'), array('Charles Dickens'),
), ),
'default', 'default',
<<<TABLE <<<'TABLE'
+-----------------+-------+-----------------+ +-----------------+-------+-----------------+
| ISBN | Title | Author | | ISBN | Title | Author |
+-----------------+-------+-----------------+ +-----------------+-------+-----------------+
@ -440,7 +440,7 @@ TABLE
array('Charles Dickens'), array('Charles Dickens'),
), ),
'default', 'default',
<<<TABLE <<<'TABLE'
+---------------+-----------------+ +---------------+-----------------+
| ISBN | Author | | ISBN | Author |
+---------------+-----------------+ +---------------+-----------------+
@ -458,7 +458,7 @@ TABLE
), ),
array(), array(),
'default', 'default',
<<<TABLE <<<'TABLE'
+------+-------+--------+ +------+-------+--------+
| Main title | | Main title |
+------+-------+--------+ +------+-------+--------+
@ -478,7 +478,7 @@ TABLE
), ),
), ),
'default', 'default',
<<<TABLE <<<'TABLE'
+---+--+--+---+--+---+--+---+--+ +---+--+--+---+--+---+--+---+--+
| 1 | 2 | 3 | 4 | | 1 | 2 | 3 | 4 |
+---+--+--+---+--+---+--+---+--+ +---+--+--+---+--+---+--+---+--+
@ -502,7 +502,7 @@ TABLE
$table->render(); $table->render();
$expected = $expected =
<<<TABLE <<<'TABLE'
+------+ +------+
| ■■ | | ■■ |
+------+ +------+
@ -532,7 +532,7 @@ TABLE;
$table->render(); $table->render();
$expected = $expected =
<<<TABLE <<<'TABLE'
....... .......
. Foo . . Foo .
....... .......
@ -559,7 +559,7 @@ TABLE;
$table->render(); $table->render();
$expected = $expected =
<<<TABLE <<<'TABLE'
+------+ +------+
| Foo | | Foo |
+------+ +------+

View File

@ -116,8 +116,6 @@ class Reader
$this->position += $length; $this->position += $length;
} }
/**
*/
public function moveToEnd() public function moveToEnd()
{ {
$this->position = $this->length; $this->position = $this->length;

View File

@ -1,14 +1,14 @@
--TEST-- --TEST--
Test symfony_zval_info API Test symfony_zval_info API
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("symfony_debug")) print "skip"; ?> <?php if (!extension_loaded('symfony_debug')) print 'skip'; ?>
--FILE-- --FILE--
<?php <?php
$int = 42; $int = 42;
$float = 42.42; $float = 42.42;
$str = "foobar"; $str = 'foobar';
$object = new StdClass; $object = new StdClass();
$array = array('foo', 'bar'); $array = array('foo', 'bar');
$resource = tmpfile(); $resource = tmpfile();
$null = null; $null = null;
@ -17,15 +17,17 @@ $bool = true;
$anotherint = 42; $anotherint = 42;
$refcount2 = &$anotherint; $refcount2 = &$anotherint;
$var = array('int' => $int, $var = array(
'float' => $float, 'int' => $int,
'str' => $str, 'float' => $float,
'object' => $object, 'str' => $str,
'array' => $array, 'object' => $object,
'resource' => $resource, 'array' => $array,
'null' => $null, 'resource' => $resource,
'bool' => $bool, 'null' => $null,
'refcount' => &$refcount2); 'bool' => $bool,
'refcount' => &$refcount2,
);
var_dump(symfony_zval_info('int', $var)); var_dump(symfony_zval_info('int', $var));
var_dump(symfony_zval_info('float', $var)); var_dump(symfony_zval_info('float', $var));

View File

@ -1,7 +1,7 @@
--TEST-- --TEST--
Test symfony_debug_backtrace in case of fatal error Test symfony_debug_backtrace in case of fatal error
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("symfony_debug")) print "skip"; ?> <?php if (!extension_loaded('symfony_debug')) print 'skip'; ?>
--FILE-- --FILE--
<?php <?php
@ -18,7 +18,6 @@ function foo()
function bt() function bt()
{ {
print_r(symfony_debug_backtrace()); print_r(symfony_debug_backtrace());
} }
register_shutdown_function('bt'); register_shutdown_function('bt');

View File

@ -1,7 +1,7 @@
--TEST-- --TEST--
Test symfony_debug_backtrace in case of non fatal error Test symfony_debug_backtrace in case of non fatal error
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("symfony_debug")) print "skip"; ?> <?php if (!extension_loaded('symfony_debug')) print 'skip'; ?>
--FILE-- --FILE--
<?php <?php
@ -13,7 +13,6 @@ function bar()
function bt() function bt()
{ {
print_r(symfony_debug_backtrace()); print_r(symfony_debug_backtrace());
} }
bar(); bar();

View File

@ -1,7 +1,7 @@
--TEST-- --TEST--
Test ErrorHandler in case of fatal error Test ErrorHandler in case of fatal error
--SKIPIF-- --SKIPIF--
<?php if (!extension_loaded("symfony_debug")) print "skip"; ?> <?php if (!extension_loaded('symfony_debug')) print 'skip'; ?>
--FILE-- --FILE--
<?php <?php

View File

@ -14,7 +14,7 @@ namespace Symfony\Component\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
/** /**
* A pass to automatically process extensions if they implement * A pass to automatically process extensions if they implement
* CompilerPassInterface. * CompilerPassInterface.
* *
* @author Wouter J <wouter@wouterj.nl> * @author Wouter J <wouter@wouterj.nl>

View File

@ -756,12 +756,11 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
{ {
$loader = new ClosureLoader($container = new ContainerBuilder()); $loader = new ClosureLoader($container = new ContainerBuilder());
$loader->load(function (ContainerBuilder $container) { $loader->load(function (ContainerBuilder $container) {
$container->set('a', new \BazClass()); $container->set('a', new \BazClass());
$definition = new Definition('BazClass'); $definition = new Definition('BazClass');
$definition->setLazy(true); $definition->setLazy(true);
$container->setDefinition('a', $definition); $container->setDefinition('a', $definition);
} });
);
$container->setResourceTracking(true); $container->setResourceTracking(true);

View File

@ -6,7 +6,7 @@ if (is_file($file)) {
} }
$phar = new Phar($file, 0, 'ProjectWithXsdExtensionInPhar.phar'); $phar = new Phar($file, 0, 'ProjectWithXsdExtensionInPhar.phar');
$phar->addFromString('ProjectWithXsdExtensionInPhar.php', <<<EOT $phar->addFromString('ProjectWithXsdExtensionInPhar.php', <<<'EOT'
<?php <?php
class ProjectWithXsdExtensionInPhar extends ProjectExtension class ProjectWithXsdExtensionInPhar extends ProjectExtension
@ -28,7 +28,7 @@ class ProjectWithXsdExtensionInPhar extends ProjectExtension
} }
EOT EOT
); );
$phar->addFromString('schema/project-1.0.xsd', <<<EOT $phar->addFromString('schema/project-1.0.xsd', <<<'EOT'
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns="http://www.example.com/schema/projectwithxsdinphar" <xsd:schema xmlns="http://www.example.com/schema/projectwithxsdinphar"

View File

@ -175,7 +175,7 @@ class Crawler extends \SplObjectStorage
if (0xF0 <= $m[$i]) { if (0xF0 <= $m[$i]) {
$c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
} elseif (0xE0 <= $m[$i]) { } elseif (0xE0 <= $m[$i]) {
$c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
} else { } else {
$c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80; $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
} }

View File

@ -188,7 +188,8 @@ class FormTest extends \PHPUnit_Framework_TestCase
$form = $this->createForm('<form>'.$form.'</form>'); $form = $this->createForm('<form>'.$form.'</form>');
$this->assertEquals( $this->assertEquals(
$values, $values,
array_map(function ($field) { array_map(
function ($field) {
$class = get_class($field); $class = get_class($field);
return array(substr($class, strrpos($class, '\\') + 1), $field->getValue()); return array(substr($class, strrpos($class, '\\') + 1), $field->getValue());

View File

@ -25,7 +25,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
$dispatcher = new EventDispatcher(); $dispatcher = new EventDispatcher();
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
$tdispatcher->addListener('foo', $listener = function () {; }); $tdispatcher->addListener('foo', $listener = function () { });
$listeners = $dispatcher->getListeners('foo'); $listeners = $dispatcher->getListeners('foo');
$this->assertCount(1, $listeners); $this->assertCount(1, $listeners);
$this->assertSame($listener, $listeners[0]); $this->assertSame($listener, $listeners[0]);
@ -39,7 +39,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
$dispatcher = new EventDispatcher(); $dispatcher = new EventDispatcher();
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
$tdispatcher->addListener('foo', $listener = function () {; }); $tdispatcher->addListener('foo', $listener = function () { });
$this->assertSame($dispatcher->getListeners('foo'), $tdispatcher->getListeners('foo')); $this->assertSame($dispatcher->getListeners('foo'), $tdispatcher->getListeners('foo'));
} }
@ -51,7 +51,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($dispatcher->hasListeners('foo')); $this->assertFalse($dispatcher->hasListeners('foo'));
$this->assertFalse($tdispatcher->hasListeners('foo')); $this->assertFalse($tdispatcher->hasListeners('foo'));
$tdispatcher->addListener('foo', $listener = function () {; }); $tdispatcher->addListener('foo', $listener = function () { });
$this->assertTrue($dispatcher->hasListeners('foo')); $this->assertTrue($dispatcher->hasListeners('foo'));
$this->assertTrue($tdispatcher->hasListeners('foo')); $this->assertTrue($tdispatcher->hasListeners('foo'));
} }
@ -76,7 +76,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
{ {
$dispatcher = new EventDispatcher(); $dispatcher = new EventDispatcher();
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
$tdispatcher->addListener('foo', $listener = function () {; }); $tdispatcher->addListener('foo', $listener = function () { });
$this->assertEquals(array(), $tdispatcher->getCalledListeners()); $this->assertEquals(array(), $tdispatcher->getCalledListeners());
$this->assertEquals(array('foo.closure' => array('event' => 'foo', 'type' => 'Closure', 'pretty' => 'closure')), $tdispatcher->getNotCalledListeners()); $this->assertEquals(array('foo.closure' => array('event' => 'foo', 'type' => 'Closure', 'pretty' => 'closure')), $tdispatcher->getNotCalledListeners());
@ -107,8 +107,8 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
$dispatcher = new EventDispatcher(); $dispatcher = new EventDispatcher();
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger); $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger);
$tdispatcher->addListener('foo', $listener1 = function () {; }); $tdispatcher->addListener('foo', $listener1 = function () { });
$tdispatcher->addListener('foo', $listener2 = function () {; }); $tdispatcher->addListener('foo', $listener2 = function () { });
$logger->expects($this->at(0))->method('debug')->with('Notified event "foo" to listener "closure".'); $logger->expects($this->at(0))->method('debug')->with('Notified event "foo" to listener "closure".');
$logger->expects($this->at(1))->method('debug')->with('Notified event "foo" to listener "closure".'); $logger->expects($this->at(1))->method('debug')->with('Notified event "foo" to listener "closure".');
@ -123,7 +123,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
$dispatcher = new EventDispatcher(); $dispatcher = new EventDispatcher();
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger); $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger);
$tdispatcher->addListener('foo', $listener1 = function (Event $event) { $event->stopPropagation(); }); $tdispatcher->addListener('foo', $listener1 = function (Event $event) { $event->stopPropagation(); });
$tdispatcher->addListener('foo', $listener2 = function () {; }); $tdispatcher->addListener('foo', $listener2 = function () { });
$logger->expects($this->at(0))->method('debug')->with('Notified event "foo" to listener "closure".'); $logger->expects($this->at(0))->method('debug')->with('Notified event "foo" to listener "closure".');
$logger->expects($this->at(1))->method('debug')->with('Listener "closure" stopped propagation of the event "foo".'); $logger->expects($this->at(1))->method('debug')->with('Listener "closure" stopped propagation of the event "foo".');

View File

@ -20,7 +20,7 @@ class NodeTest extends \PHPUnit_Framework_TestCase
{ {
$node = new Node(array(new ConstantNode('foo'))); $node = new Node(array(new ConstantNode('foo')));
$this->assertEquals(<<<EOF $this->assertEquals(<<<'EOF'
Node( Node(
ConstantNode(value: 'foo') ConstantNode(value: 'foo')
) )

View File

@ -77,7 +77,6 @@ class PathFilterIteratorTest extends IteratorTestCase
array($inner, array('copy/A'), array(), array('abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')), array($inner, array('copy/A'), array(), array('abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')),
array($inner, array('copy/A/B'), array(), array('abc.dat.copy', 'ab.dat.copy')), array($inner, array('copy/A/B'), array(), array('abc.dat.copy', 'ab.dat.copy')),
array($inner, array('copy/A/B/C'), array(), array('abc.dat.copy')), array($inner, array('copy/A/B/C'), array(), array('abc.dat.copy')),
); );
} }
} }

View File

@ -32,7 +32,7 @@ class SortableIteratorTest extends RealIteratorTestCase
{ {
if (!is_callable($mode)) { if (!is_callable($mode)) {
switch ($mode) { switch ($mode) {
case SortableIterator::SORT_BY_ACCESSED_TIME : case SortableIterator::SORT_BY_ACCESSED_TIME:
if ('\\' === DIRECTORY_SEPARATOR) { if ('\\' === DIRECTORY_SEPARATOR) {
touch(self::toAbsolute('.git')); touch(self::toAbsolute('.git'));
} else { } else {
@ -41,12 +41,12 @@ class SortableIteratorTest extends RealIteratorTestCase
sleep(1); sleep(1);
file_get_contents(self::toAbsolute('.bar')); file_get_contents(self::toAbsolute('.bar'));
break; break;
case SortableIterator::SORT_BY_CHANGED_TIME : case SortableIterator::SORT_BY_CHANGED_TIME:
file_put_contents(self::toAbsolute('test.php'), 'foo'); file_put_contents(self::toAbsolute('test.php'), 'foo');
sleep(1); sleep(1);
file_put_contents(self::toAbsolute('test.py'), 'foo'); file_put_contents(self::toAbsolute('test.py'), 'foo');
break; break;
case SortableIterator::SORT_BY_MODIFIED_TIME : case SortableIterator::SORT_BY_MODIFIED_TIME:
file_put_contents(self::toAbsolute('test.php'), 'foo'); file_put_contents(self::toAbsolute('test.php'), 'foo');
sleep(1); sleep(1);
file_put_contents(self::toAbsolute('test.py'), 'foo'); file_put_contents(self::toAbsolute('test.py'), 'foo');

View File

@ -436,7 +436,6 @@ class FormTypeTest extends BaseTypeTest
$builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer( $builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer(
function () {}, function () {},
function ($value) { // reverseTransform function ($value) { // reverseTransform
return 'foobar'; return 'foobar';
} }
)); ));
@ -462,7 +461,6 @@ class FormTypeTest extends BaseTypeTest
$builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer( $builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer(
function () {}, function () {},
function ($value) use ($ref2) { // reverseTransform function ($value) use ($ref2) { // reverseTransform
return $ref2; return $ref2;
} }
)); ));

View File

@ -641,10 +641,10 @@ class SimpleFormTest extends AbstractFormTest
$form = $this->getBuilder() $form = $this->getBuilder()
->setEmptyData('foo') ->setEmptyData('foo')
->addViewTransformer(new FixedDataTransformer(array( ->addViewTransformer(new FixedDataTransformer(array(
'' => '', '' => '',
// direction is reversed! // direction is reversed!
'bar' => 'foo', 'bar' => 'foo',
))) )))
->getForm(); ->getForm();
$form->submit(''); $form->submit('');
@ -657,17 +657,17 @@ class SimpleFormTest extends AbstractFormTest
$test = $this; $test = $this;
$form = $this->getBuilder() $form = $this->getBuilder()
->setEmptyData(function ($form) use ($test) { ->setEmptyData(function ($form) use ($test) {
// the form instance is passed to the closure to allow use // the form instance is passed to the closure to allow use
// of form data when creating the empty value // of form data when creating the empty value
$test->assertInstanceOf('Symfony\Component\Form\FormInterface', $form); $test->assertInstanceOf('Symfony\Component\Form\FormInterface', $form);
return 'foo'; return 'foo';
}) })
->addViewTransformer(new FixedDataTransformer(array( ->addViewTransformer(new FixedDataTransformer(array(
'' => '', '' => '',
// direction is reversed! // direction is reversed!
'bar' => 'foo', 'bar' => 'foo',
))) )))
->getForm(); ->getForm();
$form->submit(''); $form->submit('');

View File

@ -1090,7 +1090,6 @@ class RequestTest extends \PHPUnit_Framework_TestCase
array('put'), array('put'),
array('delete'), array('delete'),
array('patch'), array('patch'),
); );
} }

View File

@ -222,7 +222,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
private function notImplemented(array $dataSets) private function notImplemented(array $dataSets)
{ {
return array_map(function ($row) { return array_map(function ($row) {
return array($row[0], $row[1], 0); return array($row[0], $row[1], 0);
}, $dataSets); }, $dataSets);
} }
} }

View File

@ -141,7 +141,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
public function testContext() public function testContext()
{ {
$array = array('person' => array('name' => 'George Abitbol')); $array = array('person' => array('name' => 'George Abitbol'));
$expected = <<<XML $expected = <<<'XML'
<?xml version="1.0"?> <?xml version="1.0"?>
<response> <response>
<person> <person>
@ -255,7 +255,7 @@ XML;
$serializer = new Serializer(array(new CustomNormalizer()), array('xml' => new XmlEncoder())); $serializer = new Serializer(array(new CustomNormalizer()), array('xml' => new XmlEncoder()));
$this->encoder->setSerializer($serializer); $this->encoder->setSerializer($serializer);
$expected = <<<XML $expected = <<<'XML'
<?xml version="1.0"?> <?xml version="1.0"?>
<response><foo>normalizedFoo</foo><bar>normalizedBar</bar></response> <response><foo>normalizedFoo</foo><bar>normalizedBar</bar></response>
@ -366,7 +366,7 @@ XML;
public function testDecodeIgnoreWhiteSpace() public function testDecodeIgnoreWhiteSpace()
{ {
$source = <<<XML $source = <<<'XML'
<?xml version="1.0"?> <?xml version="1.0"?>
<people> <people>
<person> <person>

View File

@ -343,8 +343,8 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
array( array(
array( array(
'bar' => function ($bar) { 'bar' => function ($bar) {
return 'baz'; return 'baz';
}, },
), ),
'baz', 'baz',
array('foo' => '', 'bar' => 'baz', 'baz' => true), array('foo' => '', 'bar' => 'baz', 'baz' => true),
@ -353,8 +353,8 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
array( array(
array( array(
'bar' => function ($bar) { 'bar' => function ($bar) {
return; return;
}, },
), ),
'baz', 'baz',
array('foo' => '', 'bar' => null, 'baz' => true), array('foo' => '', 'bar' => null, 'baz' => true),
@ -363,8 +363,8 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
array( array(
array( array(
'bar' => function ($bar) { 'bar' => function ($bar) {
return $bar->format('d-m-Y H:i:s'); return $bar->format('d-m-Y H:i:s');
}, },
), ),
new \DateTime('2011-09-10 06:30:00'), new \DateTime('2011-09-10 06:30:00'),
array('foo' => '', 'bar' => '10-09-2011 06:30:00', 'baz' => true), array('foo' => '', 'bar' => '10-09-2011 06:30:00', 'baz' => true),
@ -373,13 +373,13 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
array( array(
array( array(
'bar' => function ($bars) { 'bar' => function ($bars) {
$foos = ''; $foos = '';
foreach ($bars as $bar) { foreach ($bars as $bar) {
$foos .= $bar->getFoo(); $foos .= $bar->getFoo();
} }
return $foos; return $foos;
}, },
), ),
array(new ObjectConstructorDummy('baz', '', false), new ObjectConstructorDummy('quux', '', false)), array(new ObjectConstructorDummy('baz', '', false), new ObjectConstructorDummy('quux', '', false)),
array('foo' => '', 'bar' => 'bazquux', 'baz' => true), array('foo' => '', 'bar' => 'bazquux', 'baz' => true),
@ -388,8 +388,8 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
array( array(
array( array(
'bar' => function ($bars) { 'bar' => function ($bars) {
return count($bars); return count($bars);
}, },
), ),
array(new ObjectConstructorDummy('baz', '', false), new ObjectConstructorDummy('quux', '', false)), array(new ObjectConstructorDummy('baz', '', false), new ObjectConstructorDummy('quux', '', false)),
array('foo' => '', 'bar' => 2, 'baz' => true), array('foo' => '', 'bar' => 2, 'baz' => true),

View File

@ -34,7 +34,7 @@ class IcuResFileDumper extends FileDumper
foreach ($messages->all($domain) as $source => $target) { foreach ($messages->all($domain) as $source => $target) {
$indexes .= pack('v', strlen($data) + 28); $indexes .= pack('v', strlen($data) + 28);
$data .= $source."\0"; $data .= $source."\0";
} }
$data .= $this->writePadding($data); $data .= $this->writePadding($data);

View File

@ -376,9 +376,9 @@ EOF
$fallbackSuffix = ucfirst(preg_replace($replacementPattern, '_', $fallback)); $fallbackSuffix = ucfirst(preg_replace($replacementPattern, '_', $fallback));
$currentSuffix = ucfirst(preg_replace($replacementPattern, '_', $current)); $currentSuffix = ucfirst(preg_replace($replacementPattern, '_', $current));
$fallbackContent .= sprintf(<<<EOF $fallbackContent .= sprintf(<<<'EOF'
\$catalogue%s = new MessageCatalogue('%s', %s); $catalogue%s = new MessageCatalogue('%s', %s);
\$catalogue%s->addFallbackCatalogue(\$catalogue%s); $catalogue%s->addFallbackCatalogue($catalogue%s);
EOF EOF
, ,

View File

@ -119,7 +119,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface
* (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped * (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped
* in double quotes ("). Objects, arrays and resources are formatted as * in double quotes ("). Objects, arrays and resources are formatted as
* "object", "array" and "resource". If the $format bitmask contains * "object", "array" and "resource". If the $format bitmask contains
* the PRETTY_DATE bit, then {@link \DateTime} objects will be formatted * the PRETTY_DATE bit, then {@link \DateTime} objects will be formatted
* as RFC-3339 dates ("Y-m-d H:i:s"). * as RFC-3339 dates ("Y-m-d H:i:s").
* *
* Be careful when passing message parameters to a constraint violation * Be careful when passing message parameters to a constraint violation

View File

@ -144,14 +144,14 @@ class IsbnValidator extends ConstraintValidator
// If we test the length before the loop, we get an ERROR_TOO_SHORT // If we test the length before the loop, we get an ERROR_TOO_SHORT
// when actually an ERROR_INVALID_CHARACTERS is wanted, e.g. for // when actually an ERROR_INVALID_CHARACTERS is wanted, e.g. for
// "0-45122_5244" (typo) // "0-45122_5244" (typo)
if (!isset($isbn{$i})) { if (!isset($isbn[$i])) {
return Isbn::TOO_SHORT_ERROR; return Isbn::TOO_SHORT_ERROR;
} }
if ('X' === $isbn{$i}) { if ('X' === $isbn[$i]) {
$digit = 10; $digit = 10;
} elseif (ctype_digit($isbn{$i})) { } elseif (ctype_digit($isbn[$i])) {
$digit = $isbn{$i}; $digit = $isbn[$i];
} else { } else {
return Isbn::INVALID_CHARACTERS_ERROR; return Isbn::INVALID_CHARACTERS_ERROR;
} }
@ -159,7 +159,7 @@ class IsbnValidator extends ConstraintValidator
$checkSum += $digit * (10 - $i); $checkSum += $digit * (10 - $i);
} }
if (isset($isbn{$i})) { if (isset($isbn[$i])) {
return Isbn::TOO_LONG_ERROR; return Isbn::TOO_LONG_ERROR;
} }
@ -190,11 +190,11 @@ class IsbnValidator extends ConstraintValidator
$checkSum = 0; $checkSum = 0;
for ($i = 0; $i < 13; $i += 2) { for ($i = 0; $i < 13; $i += 2) {
$checkSum += $isbn{$i}; $checkSum += $isbn[$i];
} }
for ($i = 1; $i < 12; $i += 2) { for ($i = 1; $i < 12; $i += 2) {
$checkSum += $isbn{$i} $checkSum += $isbn[$i]
* 3; * 3;
} }

View File

@ -48,7 +48,7 @@ class IssnValidator extends ConstraintValidator
// 1234-567X // 1234-567X
// ^ // ^
if (isset($canonical{4}) && '-' === $canonical{4}) { if (isset($canonical[4]) && '-' === $canonical[4]) {
// remove hyphen // remove hyphen
$canonical = substr($canonical, 0, 4).substr($canonical, 5); $canonical = substr($canonical, 0, 4).substr($canonical, 5);
} elseif ($constraint->requireHyphen) { } elseif ($constraint->requireHyphen) {
@ -121,7 +121,7 @@ class IssnValidator extends ConstraintValidator
// 1234567X // 1234567X
// ^ digit, x or X // ^ digit, x or X
if (!ctype_digit($canonical{7}) && 'x' !== $canonical{7} && 'X' !== $canonical{7}) { if (!ctype_digit($canonical[7]) && 'x' !== $canonical[7] && 'X' !== $canonical[7]) {
if ($this->context instanceof ExecutionContextInterface) { if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value)) ->setParameter('{{ value }}', $this->formatValue($value))
@ -139,7 +139,7 @@ class IssnValidator extends ConstraintValidator
// 1234567X // 1234567X
// ^ case-sensitive? // ^ case-sensitive?
if ($constraint->caseSensitive && 'x' === $canonical{7}) { if ($constraint->caseSensitive && 'x' === $canonical[7]) {
if ($this->context instanceof ExecutionContextInterface) { if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value)) ->setParameter('{{ value }}', $this->formatValue($value))
@ -156,14 +156,14 @@ class IssnValidator extends ConstraintValidator
} }
// Calculate a checksum. "X" equals 10. // Calculate a checksum. "X" equals 10.
$checkSum = 'X' === $canonical{7} $checkSum = 'X' === $canonical[7]
|| 'x' === $canonical{7} || 'x' === $canonical[7]
? 10 ? 10
: $canonical{7}; : $canonical[7];
for ($i = 0; $i < 7; ++$i) { for ($i = 0; $i < 7; ++$i) {
// Multiply the first digit by 8, the second by 7, etc. // Multiply the first digit by 8, the second by 7, etc.
$checkSum += (8 - $i) * $canonical{$i}; $checkSum += (8 - $i) * $canonical[$i];
} }
if (0 !== $checkSum % 11) { if (0 !== $checkSum % 11) {

View File

@ -81,7 +81,7 @@ class LuhnValidator extends ConstraintValidator
// ^ ^ ^ ^ ^ ^ // ^ ^ ^ ^ ^ ^
// = 7 + 9 + 7 + 9 + 7 + 3 // = 7 + 9 + 7 + 9 + 7 + 3
for ($i = $length - 1; $i >= 0; $i -= 2) { for ($i = $length - 1; $i >= 0; $i -= 2) {
$checkSum += $value{$i}; $checkSum += $value[$i];
} }
// Starting with the second last digit and walking left, double every // Starting with the second last digit and walking left, double every
@ -91,7 +91,7 @@ class LuhnValidator extends ConstraintValidator
// ^ ^ ^ ^ ^ // ^ ^ ^ ^ ^
// = 1+8 + 4 + 6 + 1+6 + 2 // = 1+8 + 4 + 6 + 1+6 + 2
for ($i = $length - 2; $i >= 0; $i -= 2) { for ($i = $length - 2; $i >= 0; $i -= 2) {
$checkSum += array_sum(str_split($value{$i} * 2)); $checkSum += array_sum(str_split($value[$i] * 2));
} }
if (0 === $checkSum || 0 !== $checkSum % 10) { if (0 === $checkSum || 0 !== $checkSum % 10) {

View File

@ -118,7 +118,7 @@ class UuidValidator extends ConstraintValidator
for ($i = 0; $i < $l; ++$i) { for ($i = 0; $i < $l; ++$i) {
// Check length // Check length
if (!isset($trimmed{$i})) { if (!isset($trimmed[$i])) {
if ($this->context instanceof ExecutionContextInterface) { if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value)) ->setParameter('{{ value }}', $this->formatValue($value))
@ -137,7 +137,7 @@ class UuidValidator extends ConstraintValidator
// Hyphens must occur every fifth position // Hyphens must occur every fifth position
// xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx // xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx
// ^ ^ ^ ^ ^ ^ ^ // ^ ^ ^ ^ ^ ^ ^
if ('-' === $trimmed{$i}) { if ('-' === $trimmed[$i]) {
if ($i !== $h) { if ($i !== $h) {
if ($this->context instanceof ExecutionContextInterface) { if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
@ -166,7 +166,7 @@ class UuidValidator extends ConstraintValidator
} }
// Check characters // Check characters
if (!ctype_xdigit($trimmed{$i})) { if (!ctype_xdigit($trimmed[$i])) {
if ($this->context instanceof ExecutionContextInterface) { if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value)) ->setParameter('{{ value }}', $this->formatValue($value))
@ -184,7 +184,7 @@ class UuidValidator extends ConstraintValidator
} }
// Check length again // Check length again
if (isset($trimmed{$i})) { if (isset($trimmed[$i])) {
if ($this->context instanceof ExecutionContextInterface) { if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value)) ->setParameter('{{ value }}', $this->formatValue($value))
@ -213,7 +213,7 @@ class UuidValidator extends ConstraintValidator
for ($i = 0; $i < self::STRICT_LENGTH; ++$i) { for ($i = 0; $i < self::STRICT_LENGTH; ++$i) {
// Check length // Check length
if (!isset($value{$i})) { if (!isset($value[$i])) {
if ($this->context instanceof ExecutionContextInterface) { if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value)) ->setParameter('{{ value }}', $this->formatValue($value))
@ -232,7 +232,7 @@ class UuidValidator extends ConstraintValidator
// Check hyphen placement // Check hyphen placement
// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
// ^ ^ ^ ^ // ^ ^ ^ ^
if ('-' === $value{$i}) { if ('-' === $value[$i]) {
if ($i !== $h) { if ($i !== $h) {
if ($this->context instanceof ExecutionContextInterface) { if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
@ -259,7 +259,7 @@ class UuidValidator extends ConstraintValidator
} }
// Check characters // Check characters
if (!ctype_xdigit($value{$i})) { if (!ctype_xdigit($value[$i])) {
if ($this->context instanceof ExecutionContextInterface) { if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value)) ->setParameter('{{ value }}', $this->formatValue($value))
@ -294,7 +294,7 @@ class UuidValidator extends ConstraintValidator
} }
// Check length again // Check length again
if (isset($value{$i})) { if (isset($value[$i])) {
if ($this->context instanceof ExecutionContextInterface) { if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value)) ->setParameter('{{ value }}', $this->formatValue($value))
@ -309,7 +309,7 @@ class UuidValidator extends ConstraintValidator
} }
// Check version // Check version
if (!in_array($value{self::STRICT_VERSION_POSITION}, $constraint->versions)) { if (!in_array($value[self::STRICT_VERSION_POSITION], $constraint->versions)) {
if ($this->context instanceof ExecutionContextInterface) { if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value)) ->setParameter('{{ value }}', $this->formatValue($value))
@ -327,7 +327,7 @@ class UuidValidator extends ConstraintValidator
// 0b10xx // 0b10xx
// & 0b1100 (12) // & 0b1100 (12)
// = 0b1000 (8) // = 0b1000 (8)
if ((hexdec($value{self::STRICT_VARIANT_POSITION}) & 12) !== 8) { if ((hexdec($value[self::STRICT_VARIANT_POSITION]) & 12) !== 8) {
if ($this->context instanceof ExecutionContextInterface) { if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value)) ->setParameter('{{ value }}', $this->formatValue($value))

View File

@ -185,7 +185,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
->assertRaised(); ->assertRaised();
} }
// BC with Symfony < 2.4
/** /**
* @group legacy * @group legacy
*/ */
@ -201,7 +200,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
->assertRaised(); ->assertRaised();
} }
// BC with Symfony < 2.4
/** /**
* @group legacy * @group legacy
*/ */
@ -217,7 +215,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
->assertRaised(); ->assertRaised();
} }
// BC with Symfony < 2.4
/** /**
* @group legacy * @group legacy
*/ */
@ -235,7 +232,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
->assertRaised(); ->assertRaised();
} }
// BC with Symfony < 2.4
/** /**
* @group legacy * @group legacy
*/ */
@ -255,7 +251,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
->assertRaised(); ->assertRaised();
} }
// BC with Symfony < 2.4
/** /**
* @group legacy * @group legacy
*/ */
@ -273,7 +268,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
->assertRaised(); ->assertRaised();
} }
// BC with Symfony < 2.4
/** /**
* @group legacy * @group legacy
*/ */

View File

@ -37,7 +37,7 @@ class PropertyPath
public static function append($basePath, $subPath) public static function append($basePath, $subPath)
{ {
if ('' !== (string) $subPath) { if ('' !== (string) $subPath) {
if ('[' === $subPath{0}) { if ('[' === $subPath[0]) {
return $basePath.$subPath; return $basePath.$subPath;
} }

View File

@ -314,6 +314,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
return array($groups); return array($groups);
} }
/** /**
* Validates an object against the constraints defined for its class. * Validates an object against the constraints defined for its class.
* *

View File

@ -59,7 +59,7 @@ class CliDumper extends AbstractDumper
parent::__construct($output, $charset); parent::__construct($output, $charset);
if ('\\' === DIRECTORY_SEPARATOR && 'ON' !== @getenv('ConEmuANSI') && 'xterm' !== @getenv('TERM')) { if ('\\' === DIRECTORY_SEPARATOR && 'ON' !== @getenv('ConEmuANSI') && 'xterm' !== @getenv('TERM')) {
// Use only the base 16 xterm colors when using ANSICON or standard Windows 10 CLI // Use only the base 16 xterm colors when using ANSICON or standard Windows 10 CLI
$this->setStyles(array( $this->setStyles(array(
'default' => '31', 'default' => '31',
'num' => '1;34', 'num' => '1;34',

View File

@ -441,7 +441,7 @@ EOHTML;
if (0xF0 <= $m[$i]) { if (0xF0 <= $m[$i]) {
$c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
} elseif (0xE0 <= $m[$i]) { } elseif (0xE0 <= $m[$i]) {
$c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80; $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
} else { } else {
$c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80; $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
} }

View File

@ -120,7 +120,7 @@ EOTXT
$var = xml_parser_create(); $var = xml_parser_create();
$this->assertDumpMatchesFormat( $this->assertDumpMatchesFormat(
<<<EOTXT <<<'EOTXT'
xml resource { xml resource {
current_byte_index: %i current_byte_index: %i
current_column_number: %i current_column_number: %i
@ -142,7 +142,7 @@ EOTXT
$var[''] = 2; $var[''] = 2;
$this->assertDumpMatchesFormat( $this->assertDumpMatchesFormat(
<<<EOTXT <<<'EOTXT'
array:4 [ array:4 [
"0" => {} "0" => {}
"1" => &1 null "1" => &1 null
@ -161,7 +161,7 @@ EOTXT
$var->{1} = 2; $var->{1} = 2;
$this->assertDumpMatchesFormat( $this->assertDumpMatchesFormat(
<<<EOTXT <<<'EOTXT'
{ {
+1: 1 +1: 1
+"1": 2 +"1": 2
@ -296,7 +296,7 @@ EOTXT
$var = $this->getSpecialVars(); $var = $this->getSpecialVars();
$this->assertDumpEquals( $this->assertDumpEquals(
<<<EOTXT <<<'EOTXT'
array:3 [ array:3 [
0 => array:1 [ 0 => array:1 [
0 => &1 array:1 [ 0 => &1 array:1 [
@ -342,7 +342,7 @@ EOTXT
$dumper->dump($data); $dumper->dump($data);
$this->assertSame( $this->assertSame(
<<<EOTXT <<<'EOTXT'
array:2 [ array:2 [
1 => array:1 [ 1 => array:1 [
"GLOBALS" => &1 array:1 [ "GLOBALS" => &1 array:1 [
@ -384,7 +384,7 @@ EOTXT
}); });
$this->assertSame( $this->assertSame(
<<<EOTXT <<<'EOTXT'
array:1 [ array:1 [
0 => array:1 [ 0 => array:1 [
0 => array:1 [ 0 => array:1 [

View File

@ -135,7 +135,7 @@ EOTXT
$out = stream_get_contents($out, -1, 0); $out = stream_get_contents($out, -1, 0);
$this->assertStringMatchesFormat( $this->assertStringMatchesFormat(
<<<EOTXT <<<'EOTXT'
<foo></foo><bar>b"<span class=sf-dump-str title="7 binary or non-UTF-8 characters">&#1057;&#1083;&#1086;&#1074;&#1072;&#1088;&#1100;</span>" <foo></foo><bar>b"<span class=sf-dump-str title="7 binary or non-UTF-8 characters">&#1057;&#1083;&#1086;&#1074;&#1072;&#1088;&#1100;</span>"
</bar> </bar>

View File

@ -444,7 +444,7 @@ EOF;
public function testObjectForMapEnabledWithMapping() public function testObjectForMapEnabledWithMapping()
{ {
$yaml = <<<EOF $yaml = <<<'EOF'
foo: foo:
fiz: [cat] fiz: [cat]
EOF; EOF;
@ -581,7 +581,7 @@ EOF
public function testSequenceInMappingStartedBySingleDashLine() public function testSequenceInMappingStartedBySingleDashLine()
{ {
$yaml = <<<EOT $yaml = <<<'EOT'
a: a:
- -
b: b:
@ -609,7 +609,7 @@ EOT;
public function testSequenceFollowedByCommentEmbeddedInMapping() public function testSequenceFollowedByCommentEmbeddedInMapping()
{ {
$yaml = <<<EOT $yaml = <<<'EOT'
a: a:
b: b:
- c - c
@ -645,7 +645,7 @@ EOF
*/ */
public function testScalarInSequence() public function testScalarInSequence()
{ {
Yaml::parse(<<<EOF Yaml::parse(<<<'EOF'
foo: foo:
- bar - bar
"missing colon" "missing colon"
@ -666,7 +666,7 @@ EOF
*/ */
public function testMappingDuplicateKeyBlock() public function testMappingDuplicateKeyBlock()
{ {
$input = <<<EOD $input = <<<'EOD'
parent: parent:
child: first child: first
child: duplicate child: duplicate
@ -684,7 +684,7 @@ EOD;
public function testMappingDuplicateKeyFlow() public function testMappingDuplicateKeyFlow()
{ {
$input = <<<EOD $input = <<<'EOD'
parent: { child: first, child: duplicate } parent: { child: first, child: duplicate }
parent: { child: duplicate, child: duplicate } parent: { child: duplicate, child: duplicate }
EOD; EOD;
@ -968,7 +968,7 @@ EOT
); );
$tests[] = array($yaml, $expected); $tests[] = array($yaml, $expected);
$yaml = <<<EOT $yaml = <<<'EOT'
foo: foo:
bar: bar:
scalar-block: > scalar-block: >
@ -1011,7 +1011,7 @@ EOT;
public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks() public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks()
{ {
$yaml = <<<EOT $yaml = <<<'EOT'
test: > test: >
<h2>A heading</h2> <h2>A heading</h2>
@ -1023,7 +1023,7 @@ EOT;
$this->assertSame( $this->assertSame(
array( array(
'test' => <<<EOT 'test' => <<<'EOT'
<h2>A heading</h2> <h2>A heading</h2>
<ul> <li>a list</li> <li>may be a good example</li> </ul> <ul> <li>a list</li> <li>may be a good example</li> </ul>
EOT EOT
@ -1035,7 +1035,7 @@ EOT
public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks() public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks()
{ {
$yaml = <<<EOT $yaml = <<<'EOT'
test: > test: >
<h2>A heading</h2> <h2>A heading</h2>
@ -1047,7 +1047,7 @@ EOT;
$this->assertSame( $this->assertSame(
array( array(
'test' => <<<EOT 'test' => <<<'EOT'
<h2>A heading</h2> <h2>A heading</h2>
<ul> <ul>
<li>a list</li> <li>a list</li>
@ -1080,7 +1080,7 @@ EOT
return array( return array(
array( array(
4, 4,
<<<YAML <<<'YAML'
foo: foo:
- -
# bar # bar
@ -1089,7 +1089,7 @@ YAML
), ),
array( array(
5, 5,
<<<YAML <<<'YAML'
foo: foo:
- -
# bar # bar
@ -1099,7 +1099,7 @@ YAML
), ),
array( array(
8, 8,
<<<YAML <<<'YAML'
foo: foo:
- -
# foobar # foobar
@ -1112,7 +1112,7 @@ YAML
), ),
array( array(
10, 10,
<<<YAML <<<'YAML'
foo: foo:
- -
# foobar # foobar

View File

@ -73,7 +73,7 @@ class Unescaper
*/ */
public function unescapeCharacter($value) public function unescapeCharacter($value)
{ {
switch ($value{1}) { switch ($value[1]) {
case '0': case '0':
return "\x0"; return "\x0";
case 'a': case 'a':