CS: Convert double quotes to single quotes

This commit is contained in:
Dariusz Ruminski 2015-03-21 11:51:07 +01:00
parent d5a8a1009b
commit f99c22c08a
85 changed files with 270 additions and 270 deletions

View File

@ -85,10 +85,10 @@ class EntityUserProvider implements UserProviderInterface
// That's the case when the user has been changed by a form with
// validation errors.
if (!$id = $this->metadata->getIdentifierValues($user)) {
throw new \InvalidArgumentException("You cannot refresh a user ".
"from the EntityUserProvider that does not contain an identifier. ".
"The user object has to be serialized with its own identifier ".
"mapped by Doctrine."
throw new \InvalidArgumentException('You cannot refresh a user '.
'from the EntityUserProvider that does not contain an identifier. '.
'The user object has to be serialized with its own identifier '.
'mapped by Doctrine.'
);
}

View File

@ -39,7 +39,7 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(0, $c->getQueryCount());
$queries = array(
array('sql' => "SELECT * FROM table1", 'params' => array(), 'types' => array(), 'executionMS' => 0),
array('sql' => 'SELECT * FROM table1', 'params' => array(), 'types' => array(), 'executionMS' => 0),
);
$c = $this->createCollector($queries);
$c->collect(new Request(), new Response());
@ -53,15 +53,15 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(0, $c->getTime());
$queries = array(
array('sql' => "SELECT * FROM table1", 'params' => array(), 'types' => array(), 'executionMS' => 1),
array('sql' => 'SELECT * FROM table1', 'params' => array(), 'types' => array(), 'executionMS' => 1),
);
$c = $this->createCollector($queries);
$c->collect(new Request(), new Response());
$this->assertEquals(1, $c->getTime());
$queries = array(
array('sql' => "SELECT * FROM table1", 'params' => array(), 'types' => array(), 'executionMS' => 1),
array('sql' => "SELECT * FROM table2", 'params' => array(), 'types' => array(), 'executionMS' => 2),
array('sql' => 'SELECT * FROM table1', 'params' => array(), 'types' => array(), 'executionMS' => 1),
array('sql' => 'SELECT * FROM table2', 'params' => array(), 'types' => array(), 'executionMS' => 2),
);
$c = $this->createCollector($queries);
$c->collect(new Request(), new Response());
@ -74,7 +74,7 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
public function testCollectQueries($param, $types, $expected, $explainable)
{
$queries = array(
array('sql' => "SELECT * FROM table1 WHERE field1 = ?1", 'params' => array($param), 'types' => $types, 'executionMS' => 1),
array('sql' => 'SELECT * FROM table1 WHERE field1 = ?1', 'params' => array($param), 'types' => $types, 'executionMS' => 1),
);
$c = $this->createCollector($queries);
$c->collect(new Request(), new Response());
@ -90,7 +90,7 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
public function testSerialization($param, $types, $expected, $explainable)
{
$queries = array(
array('sql' => "SELECT * FROM table1 WHERE field1 = ?1", 'params' => array($param), 'types' => $types, 'executionMS' => 1),
array('sql' => 'SELECT * FROM table1 WHERE field1 = ?1', 'params' => array($param), 'types' => $types, 'executionMS' => 1),
);
$c = $this->createCollector($queries);
$c->collect(new Request(), new Response());

View File

@ -244,11 +244,11 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
'message' => 'myMessage',
'fields' => array('name', 'name2'),
'em' => self::EM_NAME,
'errorPath' => "name2",
'errorPath' => 'name2',
));
$entity1 = new DoubleNameEntity(1, 'Foo', "Bar");
$entity2 = new DoubleNameEntity(2, 'Foo', "Bar");
$entity1 = new DoubleNameEntity(1, 'Foo', 'Bar');
$entity2 = new DoubleNameEntity(2, 'Foo', 'Bar');
$this->validator->validate($entity1, $constraint);
@ -399,7 +399,7 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
'em' => self::EM_NAME,
));
$composite = new CompositeIntIdEntity(1, 1, "test");
$composite = new CompositeIntIdEntity(1, 1, 'test');
$associated = new AssociationEntity();
$associated->composite = $composite;

View File

@ -98,8 +98,8 @@ class UniqueEntityValidator extends ConstraintValidator
if (count($relatedId) > 1) {
throw new ConstraintDefinitionException(
"Associated entities are not allowed to have more than one identifier field to be ".
"part of a unique constraint in: ".$class->getName()."#".$fieldName
'Associated entities are not allowed to have more than one identifier field to be '.
'part of a unique constraint in: '.$class->getName().'#'.$fieldName
);
}
$criteria[$fieldName] = array_pop($relatedId);

View File

@ -51,7 +51,7 @@ class PropelDataCollectorTest extends Propel1TestCase
{
$queries = array(
"time: 0.000 sec | mem: 1.4 MB | connection: default | SET NAMES 'utf8'",
"time: 0.012 sec | mem: 2.4 MB | connection: default | SELECT tags.NAME, image.FILENAME FROM tags LEFT JOIN image ON tags.IMAGEID = image.ID WHERE image.ID = 12",
'time: 0.012 sec | mem: 2.4 MB | connection: default | SELECT tags.NAME, image.FILENAME FROM tags LEFT JOIN image ON tags.IMAGEID = image.ID WHERE image.ID = 12',
"time: 0.012 sec | mem: 2.4 MB | connection: default | INSERT INTO `table` (`some_array`) VALUES ('| 1 | 2 | 3 |')",
);
@ -66,7 +66,7 @@ class PropelDataCollectorTest extends Propel1TestCase
'memory' => '1.4 MB',
),
array(
'sql' => "SELECT tags.NAME, image.FILENAME FROM tags LEFT JOIN image ON tags.IMAGEID = image.ID WHERE image.ID = 12",
'sql' => 'SELECT tags.NAME, image.FILENAME FROM tags LEFT JOIN image ON tags.IMAGEID = image.ID WHERE image.ID = 12',
'time' => '0.012 sec',
'connection' => 'default',
'memory' => '2.4 MB',

View File

@ -65,7 +65,7 @@ class CodeExtension extends \Twig_Extension
{
if (false !== strpos($method, '::')) {
list($class, $method) = explode('::', $method, 2);
$result = sprintf("%s::%s()", $this->abbrClass($class), $method);
$result = sprintf('%s::%s()', $this->abbrClass($class), $method);
} elseif ('Closure' === $method) {
$result = sprintf("<abbr title=\"%s\">%s</abbr>", $method, $method);
} else {
@ -91,7 +91,7 @@ class CodeExtension extends \Twig_Extension
$short = array_pop($parts);
$formattedValue = sprintf("<em>object</em>(<abbr title=\"%s\">%s</abbr>)", $item[1], $short);
} elseif ('array' === $item[0]) {
$formattedValue = sprintf("<em>array</em>(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
$formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
} elseif ('string' === $item[0]) {
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->charset));
} elseif ('null' === $item[0]) {

View File

@ -101,6 +101,6 @@ class SearchAndRenderBlockNode extends \Twig_Node_Expression_Function
}
}
$compiler->raw(")");
$compiler->raw(')');
}
}

View File

@ -83,7 +83,7 @@ EOT
$bundlesDir = $targetArg.'/bundles/';
$filesystem->mkdir($bundlesDir, 0777);
$output->writeln(sprintf("Installing assets using the <comment>%s</comment> option", $input->getOption('symlink') ? 'symlink' : 'hard copy'));
$output->writeln(sprintf('Installing assets using the <comment>%s</comment> option', $input->getOption('symlink') ? 'symlink' : 'hard copy'));
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
if (is_dir($originDir = $bundle->getPath().'/Resources/public')) {

View File

@ -207,12 +207,12 @@ EOF
}
}
$format = '%-'.$maxName.'s ';
$format .= implode("", array_map(function ($length) { return "%-{$length}s "; }, $maxTags));
$format .= implode('', array_map(function ($length) { return "%-{$length}s "; }, $maxTags));
$format .= '%-'.$maxScope.'s %s';
// the title field needs extra space to make up for comment tags
$format1 = '%-'.($maxName + 19).'s ';
$format1 .= implode("", array_map(function ($length) { return '%-'.($length + 19).'s '; }, $maxTags));
$format1 .= implode('', array_map(function ($length) { return '%-'.($length + 19).'s '; }, $maxTags));
$format1 .= '%-'.($maxScope + 19).'s %s';
$tags = array();
@ -230,7 +230,7 @@ EOF
foreach ($definition->getTag($showTagAttributes) as $key => $tag) {
$tagValues = array();
foreach (array_keys($maxTags) as $tagName) {
$tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : "";
$tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : '';
}
if (0 === $key) {
$lines[] = $this->buildArgumentsArray($serviceId, $definition->getScope(), $definition->getClass(), $tagValues);
@ -247,11 +247,11 @@ EOF
}
} elseif ($definition instanceof Alias) {
$alias = $definition;
$output->writeln(vsprintf($format, $this->buildArgumentsArray($serviceId, 'n/a', sprintf('<comment>alias for</comment> <info>%s</info>', (string) $alias), count($maxTags) ? array_fill(0, count($maxTags), "") : array())));
$output->writeln(vsprintf($format, $this->buildArgumentsArray($serviceId, 'n/a', sprintf('<comment>alias for</comment> <info>%s</info>', (string) $alias), count($maxTags) ? array_fill(0, count($maxTags), '') : array())));
} else {
// we have no information (happens with "service_container")
$service = $definition;
$output->writeln(vsprintf($format, $this->buildArgumentsArray($serviceId, '', get_class($service), count($maxTags) ? array_fill(0, count($maxTags), "") : array())));
$output->writeln(vsprintf($format, $this->buildArgumentsArray($serviceId, '', get_class($service), count($maxTags) ? array_fill(0, count($maxTags), '') : array())));
}
}
}
@ -281,7 +281,7 @@ EOF
if ($definition instanceof Definition) {
$output->writeln(sprintf('<comment>Service Id</comment> %s', $serviceId));
$output->writeln(sprintf('<comment>Class</comment> %s', $definition->getClass() ?: "-"));
$output->writeln(sprintf('<comment>Class</comment> %s', $definition->getClass() ?: '-'));
$tags = $definition->getTags();
if (count($tags)) {

View File

@ -62,7 +62,7 @@ class CodeHelper extends Helper
{
if (false !== strpos($method, '::')) {
list($class, $method) = explode('::', $method, 2);
$result = sprintf("%s::%s()", $this->abbrClass($class), $method);
$result = sprintf('%s::%s()', $this->abbrClass($class), $method);
} elseif ('Closure' === $method) {
$result = sprintf("<abbr title=\"%s\">%s</abbr>", $method, $method);
} else {
@ -88,7 +88,7 @@ class CodeHelper extends Helper
$short = array_pop($parts);
$formattedValue = sprintf("<em>object</em>(<abbr title=\"%s\">%s</abbr>)", $item[1], $short);
} elseif ('array' === $item[0]) {
$formattedValue = sprintf("<em>array</em>(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
$formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
} elseif ('string' === $item[0]) {
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->getCharset()));
} elseif ('null' === $item[0]) {

View File

@ -66,7 +66,7 @@ class TemplateLocator implements FileLocatorInterface
public function locate($template, $currentPath = null, $first = true)
{
if (!$template instanceof TemplateReferenceInterface) {
throw new \InvalidArgumentException("The template must be an instance of TemplateReferenceInterface.");
throw new \InvalidArgumentException('The template must be an instance of TemplateReferenceInterface.');
}
$key = $this->getCacheKey($template);

View File

@ -155,30 +155,30 @@ class RedirectControllerTest extends TestCase
{
return array(
// Standard ports
array('http', null, null, 'http', 80, ""),
array('http', 80, null, 'http', 80, ""),
array('https', null, null, 'http', 80, ""),
array('https', 80, null, 'http', 80, ""),
array('http', null, null, 'http', 80, ''),
array('http', 80, null, 'http', 80, ''),
array('https', null, null, 'http', 80, ''),
array('https', 80, null, 'http', 80, ''),
array('http', null, null, 'https', 443, ""),
array('http', null, 443, 'https', 443, ""),
array('https', null, null, 'https', 443, ""),
array('https', null, 443, 'https', 443, ""),
array('http', null, null, 'https', 443, ''),
array('http', null, 443, 'https', 443, ''),
array('https', null, null, 'https', 443, ''),
array('https', null, 443, 'https', 443, ''),
// Non-standard ports
array('http', null, null, 'http', 8080, ":8080"),
array('http', 4080, null, 'http', 8080, ":4080"),
array('http', 80, null, 'http', 8080, ""),
array('https', null, null, 'http', 8080, ""),
array('https', null, 8443, 'http', 8080, ":8443"),
array('https', null, 443, 'http', 8080, ""),
array('http', null, null, 'http', 8080, ':8080'),
array('http', 4080, null, 'http', 8080, ':4080'),
array('http', 80, null, 'http', 8080, ''),
array('https', null, null, 'http', 8080, ''),
array('https', null, 8443, 'http', 8080, ':8443'),
array('https', null, 443, 'http', 8080, ''),
array('https', null, null, 'https', 8443, ":8443"),
array('https', null, 4443, 'https', 8443, ":4443"),
array('https', null, 443, 'https', 8443, ""),
array('http', null, null, 'https', 8443, ""),
array('http', 8080, 4443, 'https', 8443, ":8080"),
array('http', 80, 4443, 'https', 8443, ""),
array('https', null, null, 'https', 8443, ':8443'),
array('https', null, 4443, 'https', 8443, ':4443'),
array('https', null, 443, 'https', 8443, ''),
array('http', null, null, 'https', 8443, ''),
array('http', 8080, 4443, 'https', 8443, ':8080'),
array('http', 80, 4443, 'https', 8443, ''),
);
}

View File

@ -273,7 +273,7 @@ abstract class FrameworkExtensionTest extends TestCase
public function testValidationPaths()
{
require_once __DIR__."/Fixtures/TestBundle/TestBundle.php";
require_once __DIR__.'/Fixtures/TestBundle/TestBundle.php';
$container = $this->createContainerFromFile('validation_annotations', array(
'kernel.bundles' => array('TestBundle' => 'Symfony\Bundle\FrameworkBundle\Tests\TestBundle'),

View File

@ -65,7 +65,7 @@ class FormHelperDivLayoutTest extends AbstractDivLayoutTest
protected function renderEnctype(FormView $view)
{
if (!method_exists($form = $this->engine->get('form'), 'enctype')) {
$this->markTestSkipped(sprintf("Deprecated method %s->enctype() is not implemented.", get_class($form)));
$this->markTestSkipped(sprintf('Deprecated method %s->enctype() is not implemented.', get_class($form)));
}
return (string) $form->enctype($view);

View File

@ -66,7 +66,7 @@ class FormHelperTableLayoutTest extends AbstractTableLayoutTest
protected function renderEnctype(FormView $view)
{
if (!method_exists($form = $this->engine->get('form'), 'enctype')) {
$this->markTestSkipped(sprintf("Deprecated method %s->enctype() is not implemented.", get_class($form)));
$this->markTestSkipped(sprintf('Deprecated method %s->enctype() is not implemented.', get_class($form)));
}
return (string) $form->enctype($view);

View File

@ -42,8 +42,8 @@ EOF;
"double-quoted key with whitespace and escaped \$\n\" sequences" => "prefixdouble-quoted key with whitespace and escaped \$\n\" sequences",
'single-quoted key with whitespace and nonescaped \$\n\' sequences' => 'prefixsingle-quoted key with whitespace and nonescaped \$\n\' sequences',
'single-quoted key with "quote mark at the end"' => 'prefixsingle-quoted key with "quote mark at the end"',
$expectedHeredoc => "prefix".$expectedHeredoc,
$expectedNowdoc => "prefix".$expectedNowdoc,
$expectedHeredoc => 'prefix'.$expectedHeredoc,
$expectedNowdoc => 'prefix'.$expectedNowdoc,
'{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples' => 'prefix{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples',
));
$actualCatalogue = $catalogue->all();

View File

@ -69,8 +69,8 @@ class SecurityRoutingIntegrationTest extends WebTestCase
*/
public function testSecurityConfigurationForSingleIPAddress($config)
{
$allowedClient = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config), array("REMOTE_ADDR" => "10.10.10.10"));
$barredClient = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config), array("REMOTE_ADDR" => "10.10.20.10"));
$allowedClient = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config), array('REMOTE_ADDR' => '10.10.10.10'));
$barredClient = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config), array('REMOTE_ADDR' => '10.10.20.10'));
$this->assertAllowed($allowedClient, '/secured-by-one-ip');
$this->assertRestricted($barredClient, '/secured-by-one-ip');
@ -82,9 +82,9 @@ class SecurityRoutingIntegrationTest extends WebTestCase
*/
public function testSecurityConfigurationForMultipleIPAddresses($config)
{
$allowedClientA = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config), array("REMOTE_ADDR" => "1.1.1.1"));
$allowedClientB = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config), array("REMOTE_ADDR" => "2.2.2.2"));
$barredClient = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config), array("REMOTE_ADDR" => "192.168.1.1"));
$allowedClientA = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config), array('REMOTE_ADDR' => '1.1.1.1'));
$allowedClientB = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config), array('REMOTE_ADDR' => '2.2.2.2'));
$barredClient = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config), array('REMOTE_ADDR' => '192.168.1.1'));
$this->assertAllowed($allowedClientA, '/secured-by-two-ips');
$this->assertAllowed($allowedClientB, '/secured-by-two-ips');

View File

@ -63,7 +63,7 @@ EOF
if (!$filename) {
if (0 !== ftell(STDIN)) {
throw new \RuntimeException("Please provide a filename or pipe template content to stdin.");
throw new \RuntimeException('Please provide a filename or pipe template content to stdin.');
}
while (!feof(STDIN)) {
@ -114,14 +114,14 @@ EOF
$lines = $this->getContext($template, $line);
if ($file) {
$output->writeln(sprintf("<error>KO</error> in %s (line %s)", $file, $line));
$output->writeln(sprintf('<error>KO</error> in %s (line %s)', $file, $line));
} else {
$output->writeln(sprintf("<error>KO</error> (line %s)", $line));
$output->writeln(sprintf('<error>KO</error> (line %s)', $line));
}
foreach ($lines as $no => $code) {
$output->writeln(sprintf(
"%s %-6s %s",
'%s %-6s %s',
$no == $line ? '<error>>></error>' : ' ',
$no,
$code

View File

@ -120,7 +120,7 @@ class ReferenceDumper
if ($info = $node->getInfo()) {
$this->writeLine('');
// indenting multi-line info
$info = str_replace("\n", sprintf("\n%".($depth * 4)."s# ", ' '), $info);
$info = str_replace("\n", sprintf("\n%".($depth * 4).'s# ', ' '), $info);
$this->writeLine('# '.$info, $depth * 4);
}

View File

@ -57,7 +57,7 @@ class FileLoaderLoadException extends \Exception
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
}
return sprintf("Array(%s)", implode(', ', $a));
return sprintf('Array(%s)', implode(', ', $a));
}
if (is_resource($var)) {

View File

@ -41,7 +41,7 @@ class ExampleConfiguration implements ConfigurationInterface
->info(
"this is a long\n".
"multi-line info text\n".
"which should be indented"
'which should be indented'
)
->example('example setting')
->end()

View File

@ -769,15 +769,15 @@ class Application
$output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line));
}
$output->writeln("");
$output->writeln("");
$output->writeln('');
$output->writeln('');
}
} while ($e = $e->getPrevious());
if (null !== $this->runningCommand) {
$output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())));
$output->writeln("");
$output->writeln("");
$output->writeln('');
$output->writeln('');
}
}

View File

@ -53,14 +53,14 @@ class DialogHelper extends Helper
$result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
// Collapse all spaces.
$selectedChoices = str_replace(" ", "", $picked);
$selectedChoices = str_replace(' ', '', $picked);
if ($multiselect) {
// Check for a separated comma values
if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
throw new \InvalidArgumentException(sprintf($errorMessage, $picked));
}
$selectedChoices = explode(",", $selectedChoices);
$selectedChoices = explode(',', $selectedChoices);
} else {
$selectedChoices = array($picked);
}

View File

@ -18,12 +18,12 @@ class Foo3Command extends Command
{
try {
try {
throw new \Exception("First exception <p>this is html</p>");
throw new \Exception('First exception <p>this is html</p>');
} catch (\Exception $e) {
throw new \Exception("Second exception <comment>comment</comment>", 0, $e);
throw new \Exception('Second exception <comment>comment</comment>', 0, $e);
}
} catch (\Exception $e) {
throw new \Exception("Third exception <fg=blue;bg=red>comment</>", 0, $e);
throw new \Exception('Third exception <fg=blue;bg=red>comment</>', 0, $e);
}
}
}

View File

@ -19,15 +19,15 @@ class OutputFormatterTest extends \PHPUnit_Framework_TestCase
public function testEmptyTag()
{
$formatter = new OutputFormatter(true);
$this->assertEquals("foo<>bar", $formatter->format('foo<>bar'));
$this->assertEquals('foo<>bar', $formatter->format('foo<>bar'));
}
public function testLGCharEscaping()
{
$formatter = new OutputFormatter(true);
$this->assertEquals("foo<bar", $formatter->format('foo\\<bar'));
$this->assertEquals("<info>some info</info>", $formatter->format('\\<info>some info\\</info>'));
$this->assertEquals('foo<bar', $formatter->format('foo\\<bar'));
$this->assertEquals('<info>some info</info>', $formatter->format('\\<info>some info\\</info>'));
$this->assertEquals("\\<info>some info\\</info>", OutputFormatter::escape('<info>some info</info>'));
$this->assertEquals(
@ -176,16 +176,16 @@ class OutputFormatterTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($formatter->hasStyle('question'));
$this->assertEquals(
"some error", $formatter->format('<error>some error</error>')
'some error', $formatter->format('<error>some error</error>')
);
$this->assertEquals(
"some info", $formatter->format('<info>some info</info>')
'some info', $formatter->format('<info>some info</info>')
);
$this->assertEquals(
"some comment", $formatter->format('<comment>some comment</comment>')
'some comment', $formatter->format('<comment>some comment</comment>')
);
$this->assertEquals(
"some question", $formatter->format('<question>some question</question>')
'some question', $formatter->format('<question>some question</question>')
);
$formatter->setDecorated(true);

View File

@ -157,10 +157,10 @@ TABLE
array(
array('ISBN', 'Title', 'Author'),
array(
array("99921-58-10-7", "Divine\nComedy", "Dante Alighieri"),
array("9971-5-0210-2", "Harry Potter\nand the Chamber of Secrets", "Rowling\nJoanne K."),
array("9971-5-0210-2", "Harry Potter\nand the Chamber of Secrets", "Rowling\nJoanne K."),
array("960-425-059-0", "The Lord of the Rings", "J. R. R.\nTolkien"),
array('99921-58-10-7', "Divine\nComedy", 'Dante Alighieri'),
array('9971-5-0210-2', "Harry Potter\nand the Chamber of Secrets", "Rowling\nJoanne K."),
array('9971-5-0210-2', "Harry Potter\nand the Chamber of Secrets", "Rowling\nJoanne K."),
array('960-425-059-0', 'The Lord of the Rings', "J. R. R.\nTolkien"),
),
TableHelper::LAYOUT_DEFAULT,
<<<TABLE

View File

@ -70,8 +70,8 @@ class StringInputTest extends \PHPUnit_Framework_TestCase
array('--long-option="foo bar"', array('--long-option=foo bar'), '->tokenize() parses long options with a value'),
array('--long-option="foo bar""another"', array('--long-option=foo baranother'), '->tokenize() parses long options with a value'),
array('--long-option=\'foo bar\'', array('--long-option=foo bar'), '->tokenize() parses long options with a value'),
array("--long-option='foo bar''another'", array("--long-option=foo baranother"), '->tokenize() parses long options with a value'),
array("--long-option='foo bar'\"another\"", array("--long-option=foo baranother"), '->tokenize() parses long options with a value'),
array("--long-option='foo bar''another'", array('--long-option=foo baranother'), '->tokenize() parses long options with a value'),
array("--long-option='foo bar'\"another\"", array('--long-option=foo baranother'), '->tokenize() parses long options with a value'),
array('foo -a -ffoo --long bar', array('foo', '-a', '-ffoo', '--long', 'bar'), '->tokenize() parses when several arguments and options'),
);
}

View File

@ -37,23 +37,23 @@ class CssSelectorTest extends \PHPUnit_Framework_TestCase
$this->fail('->parse() throws an Exception if the css selector is not valid');
} catch (\Exception $e) {
$this->assertInstanceOf('\Symfony\Component\CssSelector\Exception\ParseException', $e, '->parse() throws an Exception if the css selector is not valid');
$this->assertEquals("Expected identifier, but <eof at 3> found.", $e->getMessage(), '->parse() throws an Exception if the css selector is not valid');
$this->assertEquals('Expected identifier, but <eof at 3> found.', $e->getMessage(), '->parse() throws an Exception if the css selector is not valid');
}
}
public function getCssToXPathWithoutPrefixTestData()
{
return array(
array('h1', "h1"),
array('foo|h1', "foo:h1"),
array('h1, h2, h3', "h1 | h2 | h3"),
array('h1', 'h1'),
array('foo|h1', 'foo:h1'),
array('h1, h2, h3', 'h1 | h2 | h3'),
array('h1:nth-child(3n+1)', "*/*[name() = 'h1' and (position() - 1 >= 0 and (position() - 1) mod 3 = 0)]"),
array('h1 > p', "h1/p"),
array('h1 > p', 'h1/p'),
array('h1#foo', "h1[@id = 'foo']"),
array('h1.foo', "h1[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"),
array('h1[class*="foo bar"]', "h1[@class and contains(@class, 'foo bar')]"),
array('h1[foo|class*="foo bar"]', "h1[@foo:class and contains(@foo:class, 'foo bar')]"),
array('h1[class]', "h1[@class]"),
array('h1[class]', 'h1[@class]'),
array('h1 .foo', "h1/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"),
array('h1 #foo', "h1/descendant-or-self::*/*[@id = 'foo']"),
array('h1 [class*=foo]', "h1/descendant-or-self::*/*[@class and contains(@class, 'foo')]"),

View File

@ -90,12 +90,12 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
public function getCssToXPathTestData()
{
return array(
array('*', "*"),
array('e', "e"),
array('*|e', "e"),
array('e|f', "e:f"),
array('e[foo]', "e[@foo]"),
array('e[foo|bar]', "e[@foo:bar]"),
array('*', '*'),
array('e', 'e'),
array('*|e', 'e'),
array('e|f', 'e:f'),
array('e[foo]', 'e[@foo]'),
array('e[foo|bar]', 'e[@foo:bar]'),
array('e[foo="bar"]', "e[@foo = 'bar']"),
array('e[foo~="bar"]', "e[@foo and contains(concat(' ', normalize-space(@foo), ' '), ' bar ')]"),
array('e[foo^="bar"]', "e[@foo and starts-with(@foo, 'bar')]"),
@ -105,29 +105,29 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
array('e:nth-child(1)', "*/*[name() = 'e' and (position() = 1)]"),
array('e:nth-last-child(1)', "*/*[name() = 'e' and (position() = last() - 0)]"),
array('e:nth-last-child(2n+2)', "*/*[name() = 'e' and (last() - position() - 1 >= 0 and (last() - position() - 1) mod 2 = 0)]"),
array('e:nth-of-type(1)', "*/e[position() = 1]"),
array('e:nth-last-of-type(1)', "*/e[position() = last() - 0]"),
array('e:nth-of-type(1)', '*/e[position() = 1]'),
array('e:nth-last-of-type(1)', '*/e[position() = last() - 0]'),
array('div e:nth-last-of-type(1) .aclass', "div/descendant-or-self::*/e[position() = last() - 0]/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' aclass ')]"),
array('e:first-child', "*/*[name() = 'e' and (position() = 1)]"),
array('e:last-child', "*/*[name() = 'e' and (position() = last())]"),
array('e:first-of-type', "*/e[position() = 1]"),
array('e:last-of-type', "*/e[position() = last()]"),
array('e:first-of-type', '*/e[position() = 1]'),
array('e:last-of-type', '*/e[position() = last()]'),
array('e:only-child', "*/*[name() = 'e' and (last() = 1)]"),
array('e:only-of-type', "e[last() = 1]"),
array('e:empty', "e[not(*) and not(string-length())]"),
array('e:EmPTY', "e[not(*) and not(string-length())]"),
array('e:root', "e[not(parent::*)]"),
array('e:hover', "e[0]"),
array('e:only-of-type', 'e[last() = 1]'),
array('e:empty', 'e[not(*) and not(string-length())]'),
array('e:EmPTY', 'e[not(*) and not(string-length())]'),
array('e:root', 'e[not(parent::*)]'),
array('e:hover', 'e[0]'),
array('e:contains("foo")', "e[contains(string(.), 'foo')]"),
array('e:ConTains(foo)', "e[contains(string(.), 'foo')]"),
array('e.warning', "e[@class and contains(concat(' ', normalize-space(@class), ' '), ' warning ')]"),
array('e#myid', "e[@id = 'myid']"),
array('e:not(:nth-child(odd))', "e[not(position() - 1 >= 0 and (position() - 1) mod 2 = 0)]"),
array('e:nOT(*)', "e[0]"),
array('e f', "e/descendant-or-self::*/f"),
array('e > f', "e/f"),
array('e:not(:nth-child(odd))', 'e[not(position() - 1 >= 0 and (position() - 1) mod 2 = 0)]'),
array('e:nOT(*)', 'e[0]'),
array('e f', 'e/descendant-or-self::*/f'),
array('e > f', 'e/f'),
array('e + f', "e/following-sibling::*[name() = 'f' and (position() = 1)]"),
array('e ~ f', "e/following-sibling::f"),
array('e ~ f', 'e/following-sibling::f'),
array('div#container p', "div[@id = 'container']/descendant-or-self::*/p"),
);
}

View File

@ -98,9 +98,9 @@ class HtmlExtension extends AbstractExtension
public function translateDisabled(XPathExpr $xpath)
{
return $xpath->addCondition(
"("
."@disabled and"
."("
'('
.'@disabled and'
.'('
."(name(.) = 'input' and @type != 'hidden')"
." or name(.) = 'button'"
." or name(.) = 'select'"
@ -109,14 +109,14 @@ class HtmlExtension extends AbstractExtension
." or name(.) = 'fieldset'"
." or name(.) = 'optgroup'"
." or name(.) = 'option'"
.")"
.") or ("
.')'
.') or ('
."(name(.) = 'input' and @type != 'hidden')"
." or name(.) = 'button'"
." or name(.) = 'select'"
." or name(.) = 'textarea'"
.")"
." and ancestor::fieldset[@disabled]"
.')'
.' and ancestor::fieldset[@disabled]'
);
// todo: in the second half, add "and is not a descendant of that fieldset element's first legend element child, if any."
}
@ -150,10 +150,10 @@ class HtmlExtension extends AbstractExtension
." or name(.) = 'textarea'"
." or name(.) = 'keygen'"
.')'
." and not (@disabled or ancestor::fieldset[@disabled])"
.' and not (@disabled or ancestor::fieldset[@disabled])'
.') or ('
."name(.) = 'option' and not("
."@disabled or ancestor::optgroup[@disabled]"
.'@disabled or ancestor::optgroup[@disabled]'
.')'
.')'
);

View File

@ -298,9 +298,9 @@ EOF;
$result = array();
foreach ($args as $key => $item) {
if ('object' === $item[0]) {
$formattedValue = sprintf("<em>object</em>(%s)", $this->abbrClass($item[1]));
$formattedValue = sprintf('<em>object</em>(%s)', $this->abbrClass($item[1]));
} elseif ('array' === $item[0]) {
$formattedValue = sprintf("<em>array</em>(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
$formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
} elseif ('string' === $item[0]) {
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], $flags, $this->charset));
} elseif ('null' === $item[0]) {

View File

@ -539,7 +539,7 @@ class PhpDumper extends Dumper
if ($definition->isSynthetic()) {
$return[] = '@throws RuntimeException always since this service is expected to be injected dynamically';
} elseif ($class = $definition->getClass()) {
$return[] = sprintf("@return %s A %s instance.", 0 === strpos($class, '%') ? 'object' : "\\".$class, $class);
$return[] = sprintf('@return %s A %s instance.', 0 === strpos($class, '%') ? 'object' : "\\".$class, $class);
} elseif ($definition->getFactoryClass()) {
$return[] = sprintf('@return object An instance returned by %s::%s().', $definition->getFactoryClass(), $definition->getFactoryMethod());
} elseif ($definition->getFactoryService()) {
@ -1225,7 +1225,7 @@ EOF;
} elseif (null !== $value->getFactoryService()) {
$service = $this->dumpValue($value->getFactoryService());
return sprintf("%s->%s(%s)", 0 === strpos($service, '$') ? sprintf('$this->get(%s)', $service) : $this->getServiceCall($value->getFactoryService()), $value->getFactoryMethod(), implode(', ', $arguments));
return sprintf('%s->%s(%s)', 0 === strpos($service, '$') ? sprintf('$this->get(%s)', $service) : $this->getServiceCall($value->getFactoryService()), $value->getFactoryMethod(), implode(', ', $arguments));
} else {
throw new RuntimeException('Cannot dump definitions which have factory method without factory service or factory class.');
}

View File

@ -31,8 +31,8 @@ class DefinitionTest extends \PHPUnit_Framework_TestCase
{
$def = new Definition('stdClass');
$this->assertNull($def->getFactoryClass());
$this->assertSame($def, $def->setFactoryClass('stdClass2'), "->setFactoryClass() implements a fluent interface.");
$this->assertEquals('stdClass2', $def->getFactoryClass(), "->getFactoryClass() returns current class to construct this service.");
$this->assertSame($def, $def->setFactoryClass('stdClass2'), '->setFactoryClass() implements a fluent interface.');
$this->assertEquals('stdClass2', $def->getFactoryClass(), '->getFactoryClass() returns current class to construct this service.');
}
public function testSetGetFactoryMethod()
@ -47,8 +47,8 @@ class DefinitionTest extends \PHPUnit_Framework_TestCase
{
$def = new Definition('stdClass');
$this->assertNull($def->getFactoryService());
$this->assertSame($def, $def->setFactoryService('foo.bar'), "->setFactoryService() implements a fluent interface.");
$this->assertEquals('foo.bar', $def->getFactoryService(), "->getFactoryService() returns current service to construct this service.");
$this->assertSame($def, $def->setFactoryService('foo.bar'), '->setFactoryService() implements a fluent interface.');
$this->assertEquals('foo.bar', $def->getFactoryService(), '->getFactoryService() returns current service to construct this service.');
}
/**

View File

@ -63,8 +63,8 @@ class PhpDumperTest extends \PHPUnit_Framework_TestCase
'.' => 'dot as a key',
'.\'\'.' => 'concatenation as a key',
'\'\'.' => 'concatenation from the start key',
'optimize concatenation' => "string1%some_string%string2",
'optimize concatenation with empty string' => "string1%empty_value%string2",
'optimize concatenation' => 'string1%some_string%string2',
'optimize concatenation with empty string' => 'string1%empty_value%string2',
'optimize concatenation from the start' => '%empty_value%start',
'optimize concatenation at the end' => 'end%empty_value%',
));

View File

@ -210,31 +210,31 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
public function testConvertDomElementToArray()
{
$doc = new \DOMDocument("1.0");
$doc = new \DOMDocument('1.0');
$doc->loadXML('<foo>bar</foo>');
$this->assertEquals('bar', XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array');
$doc = new \DOMDocument("1.0");
$doc = new \DOMDocument('1.0');
$doc->loadXML('<foo foo="bar" />');
$this->assertEquals(array('foo' => 'bar'), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array');
$doc = new \DOMDocument("1.0");
$doc = new \DOMDocument('1.0');
$doc->loadXML('<foo><foo>bar</foo></foo>');
$this->assertEquals(array('foo' => 'bar'), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array');
$doc = new \DOMDocument("1.0");
$doc = new \DOMDocument('1.0');
$doc->loadXML('<foo><foo>bar<foo>bar</foo></foo></foo>');
$this->assertEquals(array('foo' => array('value' => 'bar', 'foo' => 'bar')), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array');
$doc = new \DOMDocument("1.0");
$doc = new \DOMDocument('1.0');
$doc->loadXML('<foo><foo></foo></foo>');
$this->assertEquals(array('foo' => null), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array');
$doc = new \DOMDocument("1.0");
$doc = new \DOMDocument('1.0');
$doc->loadXML('<foo><foo><!-- foo --></foo></foo>');
$this->assertEquals(array('foo' => null), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array');
$doc = new \DOMDocument("1.0");
$doc = new \DOMDocument('1.0');
$doc->loadXML('<foo><foo foo="bar"/><foo foo="bar"/></foo>');
$this->assertEquals(array('foo' => array(array('foo' => 'bar'), array('foo' => 'bar'))), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array');
}

View File

@ -785,7 +785,7 @@ class Crawler extends \SplObjectStorage
}
}
return sprintf("concat(%s)", implode($parts, ', '));
return sprintf('concat(%s)', implode($parts, ', '));
}
/**

View File

@ -176,7 +176,7 @@ class FormFieldRegistry
private function walk(array $array, $base = '', array &$output = array())
{
foreach ($array as $k => $v) {
$path = empty($base) ? $k : sprintf("%s[%s]", $base, $k);
$path = empty($base) ? $k : sprintf('%s[%s]', $base, $k);
if (is_array($v)) {
$this->walk($v, $path, $output);
} else {

View File

@ -397,7 +397,7 @@ class FormTest extends \PHPUnit_Framework_TestCase
public function testMultiselectSetValues()
{
$form = $this->createForm('<form><select multiple="multiple" name="multi"><option value="foo">foo</option><option value="bar">bar</option></select><input type="submit" /></form>');
$form->setValues(array('multi' => array("foo", "bar")));
$form->setValues(array('multi' => array('foo', 'bar')));
$this->assertEquals(array('multi' => array('foo', 'bar')), $form->getValues(), '->setValue() sets the values of select');
}

View File

@ -381,7 +381,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
$paths[] = $file->getRelativePath();
}
$ref = array("", "", "", "", "foo", "");
$ref = array('', '', '', '', 'foo', '');
sort($ref);
sort($paths);
@ -402,7 +402,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
$paths[] = $file->getRelativePathname();
}
$ref = array("test.php", "toto", "test.py", "foo", "foo".DIRECTORY_SEPARATOR."bar.tmp", "foo bar");
$ref = array('test.php', 'toto', 'test.py', 'foo', 'foo'.DIRECTORY_SEPARATOR.'bar.tmp', 'foo bar');
sort($paths);
sort($ref);

View File

@ -18,7 +18,7 @@ class FixUrlProtocolListenerTest extends \PHPUnit_Framework_TestCase
{
public function testFixHttpUrl()
{
$data = "www.symfony.com";
$data = 'www.symfony.com';
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
$event = new FormEvent($form, $data);
@ -30,7 +30,7 @@ class FixUrlProtocolListenerTest extends \PHPUnit_Framework_TestCase
public function testSkipKnownUrl()
{
$data = "http://www.symfony.com";
$data = 'http://www.symfony.com';
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
$event = new FormEvent($form, $data);
@ -42,7 +42,7 @@ class FixUrlProtocolListenerTest extends \PHPUnit_Framework_TestCase
public function testSkipOtherProtocol()
{
$data = "ftp://www.symfony.com";
$data = 'ftp://www.symfony.com';
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
$event = new FormEvent($form, $data);

View File

@ -18,7 +18,7 @@ class TrimListenerTest extends \PHPUnit_Framework_TestCase
{
public function testTrim()
{
$data = " Foo! ";
$data = ' Foo! ';
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
$event = new FormEvent($form, $data);

View File

@ -62,7 +62,7 @@ class CsrfValidationListenerTest extends \PHPUnit_Framework_TestCase
// https://github.com/symfony/symfony/pull/5838
public function testStringFormData()
{
$data = "XP4HUzmHPi";
$data = 'XP4HUzmHPi';
$event = new FormEvent($this->form, $data);
$validation = new CsrfValidationListener('csrf', $this->csrfProvider, 'unknown', 'Invalid.');

View File

@ -84,12 +84,12 @@ class Cookie
$str = urlencode($this->getName()).'=';
if ('' === (string) $this->getValue()) {
$str .= 'deleted; expires='.gmdate("D, d-M-Y H:i:s T", time() - 31536001);
$str .= 'deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001);
} else {
$str .= urlencode($this->getValue());
if ($this->getExpiresTime() !== 0) {
$str .= '; expires='.gmdate("D, d-M-Y H:i:s T", $this->getExpiresTime());
$str .= '; expires='.gmdate('D, d-M-Y H:i:s T', $this->getExpiresTime());
}
}

View File

@ -107,8 +107,8 @@ class IpUtils
$netmask = 128;
}
$bytesAddr = unpack("n*", inet_pton($address));
$bytesTest = unpack("n*", inet_pton($requestIp));
$bytesAddr = unpack('n*', inet_pton($address));
$bytesTest = unpack('n*', inet_pton($requestIp));
for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) {
$left = $netmask - 16 * ($i-1);

View File

@ -1195,7 +1195,7 @@ class Response
protected function ensureIEOverSSLCompatibility(Request $request)
{
if (false !== stripos($this->headers->get('Content-Disposition'), 'attachment') && preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) == 1 && true === $request->isSecure()) {
if ((int) preg_replace("/(MSIE )(.*?);/", "$2", $match[0]) < 9) {
if ((int) preg_replace('/(MSIE )(.*?);/', '$2', $match[0]) < 9) {
$this->headers->remove('Cache-Control');
}
}

View File

@ -159,7 +159,7 @@ class MockArraySessionStorage implements SessionStorageInterface
public function save()
{
if (!$this->started || $this->closed) {
throw new \RuntimeException("Trying to save a session that was not started yet or was already closed");
throw new \RuntimeException('Trying to save a session that was not started yet or was already closed');
}
// nothing to do since we don't persist the session data
$this->closed = false;

View File

@ -93,7 +93,7 @@ class MockFileSessionStorage extends MockArraySessionStorage
public function save()
{
if (!$this->started) {
throw new \RuntimeException("Trying to save a session that was not started yet or was already closed");
throw new \RuntimeException('Trying to save a session that was not started yet or was already closed');
}
file_put_contents($this->getFilePath(), serialize($this->data));

View File

@ -25,9 +25,9 @@ class CookieTest extends \PHPUnit_Framework_TestCase
{
return array(
array(''),
array(",MyName"),
array(";MyName"),
array(" MyName"),
array(',MyName'),
array(';MyName'),
array(' MyName'),
array("\tMyName"),
array("\rMyName"),
array("\nMyName"),
@ -89,7 +89,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase
public function testGetExpiresTimeWithStringValue()
{
$value = "+1 day";
$value = '+1 day';
$cookie = new Cookie('foo', 'bar', $value);
$expire = strtotime($value);
@ -137,7 +137,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly', $cookie->__toString(), '->__toString() returns string representation of the cookie');
$cookie = new Cookie('foo', null, 1, '/admin/', '.myfoodomain.com');
$this->assertEquals('foo=deleted; expires='.gmdate("D, d-M-Y H:i:s T", time()-31536001).'; path=/admin/; domain=.myfoodomain.com; httponly', $cookie->__toString(), '->__toString() returns string representation of a cleared cookie if value is NULL');
$this->assertEquals('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time()-31536001).'; path=/admin/; domain=.myfoodomain.com; httponly', $cookie->__toString(), '->__toString() returns string representation of a cleared cookie if value is NULL');
$cookie = new Cookie('foo', 'bar', 0, '/', '');
$this->assertEquals('foo=bar; path=/; httponly', $cookie->__toString());

View File

@ -40,7 +40,7 @@ class HeaderBagTest extends \PHPUnit_Framework_TestCase
{
$bag = new HeaderBag(array('foo' => 'bar'));
$keys = $bag->keys();
$this->assertEquals("foo", $keys[0]);
$this->assertEquals('foo', $keys[0]);
}
public function testGetDate()

View File

@ -917,7 +917,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$req = new Request();
$retval = $req->getContent(true);
$this->assertInternalType('resource', $retval);
$this->assertEquals("", fread($retval, 1));
$this->assertEquals('', fread($retval, 1));
$this->assertTrue(feof($retval));
}

View File

@ -114,11 +114,11 @@ class ResponseHeaderBagTest extends \PHPUnit_Framework_TestCase
$bag = new ResponseHeaderBag(array());
$bag->setCookie(new Cookie('foo', 'bar'));
$this->assertContains("Set-Cookie: foo=bar; path=/; httponly", explode("\r\n", $bag->__toString()));
$this->assertContains('Set-Cookie: foo=bar; path=/; httponly', explode("\r\n", $bag->__toString()));
$bag->clearCookie('foo');
$this->assertContains("Set-Cookie: foo=deleted; expires=".gmdate("D, d-M-Y H:i:s T", time() - 31536001)."; path=/; httponly", explode("\r\n", $bag->__toString()));
$this->assertContains('Set-Cookie: foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; path=/; httponly', explode("\r\n", $bag->__toString()));
}
public function testReplace()
@ -155,10 +155,10 @@ class ResponseHeaderBagTest extends \PHPUnit_Framework_TestCase
$this->assertCount(4, $bag->getCookies());
$headers = explode("\r\n", $bag->__toString());
$this->assertContains("Set-Cookie: foo=bar; path=/path/foo; domain=foo.bar; httponly", $headers);
$this->assertContains("Set-Cookie: foo=bar; path=/path/foo; domain=foo.bar; httponly", $headers);
$this->assertContains("Set-Cookie: foo=bar; path=/path/bar; domain=bar.foo; httponly", $headers);
$this->assertContains("Set-Cookie: foo=bar; path=/; httponly", $headers);
$this->assertContains('Set-Cookie: foo=bar; path=/path/foo; domain=foo.bar; httponly', $headers);
$this->assertContains('Set-Cookie: foo=bar; path=/path/foo; domain=foo.bar; httponly', $headers);
$this->assertContains('Set-Cookie: foo=bar; path=/path/bar; domain=bar.foo; httponly', $headers);
$this->assertContains('Set-Cookie: foo=bar; path=/; httponly', $headers);
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
$this->assertTrue(isset($cookies['foo.bar']['/path/foo']['foo']));

View File

@ -29,8 +29,8 @@ class ResponseTest extends ResponseTestCase
{
$response = new Response();
$response = explode("\r\n", $response);
$this->assertEquals("HTTP/1.0 200 OK", $response[0]);
$this->assertEquals("Cache-Control: no-cache", $response[1]);
$this->assertEquals('HTTP/1.0 200 OK', $response[0]);
$this->assertEquals('Cache-Control: no-cache', $response[1]);
}
public function testClone()
@ -497,7 +497,7 @@ class ResponseTest extends ResponseTestCase
$response = new Response();
//array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public')
try {
$response->setCache(array("wrong option" => "value"));
$response->setCache(array('wrong option' => 'value'));
$this->fail('->setCache() throws an InvalidArgumentException if an option is not supported');
} catch (\Exception $e) {
$this->assertInstanceOf('InvalidArgumentException', $e, '->setCache() throws an InvalidArgumentException if an option is not supported');

View File

@ -51,7 +51,7 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
}
return sprintf("Array(%s)", implode(', ', $a));
return sprintf('Array(%s)', implode(', ', $a));
}
if (is_resource($var)) {

View File

@ -86,7 +86,7 @@ class FilterControllerEvent extends KernelEvent
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
}
return sprintf("Array(%s)", implode(', ', $a));
return sprintf('Array(%s)', implode(', ', $a));
}
if (is_resource($var)) {

View File

@ -219,7 +219,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
}
return sprintf("Array(%s)", implode(', ', $a));
return sprintf('Array(%s)', implode(', ', $a));
}
if (is_resource($var)) {

View File

@ -1069,7 +1069,7 @@ class HttpCacheTest extends HttpCacheTestCase
$this->setNextResponses($responses);
$this->request('GET', '/', array(), array(), true);
$this->assertEquals("Hello World! My name is Bobby.", $this->response->getContent());
$this->assertEquals('Hello World! My name is Bobby.', $this->response->getContent());
// check for 100 or 99 as the test can be executed after a second change
$this->assertTrue(in_array($this->response->getTtl(), array(99, 100)));

View File

@ -94,7 +94,7 @@ class FileProfilerStorageTest extends AbstractProfilerStorageTest
fwrite($h, "line1\n\n\nline2\n");
fseek($h, 0, SEEK_END);
$this->assertEquals("line2", $r->invoke(self::$storage, $h));
$this->assertEquals("line1", $r->invoke(self::$storage, $h));
$this->assertEquals('line2', $r->invoke(self::$storage, $h));
$this->assertEquals('line1', $r->invoke(self::$storage, $h));
}
}

View File

@ -145,7 +145,7 @@ class TextBundleWriter implements BundleWriterInterface
fprintf($file, "%s%d,\n", str_repeat(' ', $indentation + 1), $int);
}
fprintf($file, "%s}", str_repeat(' ', $indentation));
fprintf($file, '%s}', str_repeat(' ', $indentation));
}
/**
@ -212,7 +212,7 @@ class TextBundleWriter implements BundleWriterInterface
}
if (!$fallback) {
fwrite($file, ":table(nofallback)");
fwrite($file, ':table(nofallback)');
}
fwrite($file, "{\n");

View File

@ -79,11 +79,11 @@ set_exception_handler(function (\Exception $exception) {
echo "Caused by\n";
}
echo get_class($cause).": ".$cause->getMessage()."\n";
echo get_class($cause).': '.$cause->getMessage()."\n";
echo "\n";
echo $cause->getFile().":".$cause->getLine()."\n";
echo $cause->getFile().':'.$cause->getLine()."\n";
foreach ($cause->getTrace() as $trace) {
echo $trace['file'].":".$trace['line']."\n";
echo $trace['file'].':'.$trace['line']."\n";
}
echo "\n";

View File

@ -57,7 +57,7 @@ MESSAGE
}
echo LINE;
echo centered("ICU Resource Bundle Compilation")."\n";
echo centered('ICU Resource Bundle Compilation')."\n";
echo LINE;
if (!Intl::isExtensionLoaded()) {
@ -123,42 +123,42 @@ if ($argc >= 3) {
// will run into problems when building genrb.
$filesystem->mkdir($sourceDir.'/bin');
echo "[1/6] libicudata.so...";
echo '[1/6] libicudata.so...';
cd($sourceDir.'/stubdata');
run('make 2>&1 && make install 2>&1');
echo " ok.\n";
echo "[2/6] libicuuc.so...";
echo '[2/6] libicuuc.so...';
cd($sourceDir.'/common');
run('make 2>&1 && make install 2>&1');
echo " ok.\n";
echo "[3/6] libicui18n.so...";
echo '[3/6] libicui18n.so...';
cd($sourceDir.'/i18n');
run('make 2>&1 && make install 2>&1');
echo " ok.\n";
echo "[4/6] libicutu.so...";
echo '[4/6] libicutu.so...';
cd($sourceDir.'/tools/toolutil');
run('make 2>&1 && make install 2>&1');
echo " ok.\n";
echo "[5/6] libicuio.so...";
echo '[5/6] libicuio.so...';
cd($sourceDir.'/io');
run('make 2>&1 && make install 2>&1');
echo " ok.\n";
echo "[6/6] genrb...";
echo '[6/6] genrb...';
cd($sourceDir.'/tools/genrb');
run('make 2>&1 && make install 2>&1');

View File

@ -668,7 +668,7 @@ class Process
$timeoutMicro = microtime(true) + $timeout;
if ($this->isRunning()) {
if ('\\' === DIRECTORY_SEPARATOR && !$this->isSigchildEnabled()) {
exec(sprintf("taskkill /F /T /PID %d 2>&1", $this->getPid()), $output, $exitCode);
exec(sprintf('taskkill /F /T /PID %d 2>&1', $this->getPid()), $output, $exitCode);
if ($exitCode > 0) {
throw new RuntimeException('Unable to kill the process');
}

View File

@ -117,7 +117,7 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
$proc = $pb->getProcess();
$this->assertContains("second", $proc->getCommandLine());
$this->assertContains('second', $proc->getCommandLine());
}
public function testPrefixIsPrependedToAllGeneratedProcess()

View File

@ -49,8 +49,8 @@ class ProcessFailedExceptionTest extends \PHPUnit_Framework_TestCase
$cmd = 'php';
$exitCode = 1;
$exitText = 'General error';
$output = "Command output";
$errorOutput = "FATAL: Unexpected error";
$output = 'Command output';
$errorOutput = 'FATAL: Unexpected error';
$process = $this->getMock(
'Symfony\Component\Process\Process',

View File

@ -3,7 +3,7 @@
// required for signal handling
declare (ticks = 1);
pcntl_signal(SIGUSR1, function () {echo "Caught SIGUSR1"; exit;});
pcntl_signal(SIGUSR1, function () {echo 'Caught SIGUSR1'; exit;});
$n = 0;

View File

@ -151,18 +151,18 @@ class ApacheMatcherDumper extends MatcherDumper
}
if ($compiledRoute->getHostRegex()) {
$rule[] = sprintf("RewriteCond %%{ENV:__ROUTING_host_%s} =1", $hostRegexUnique);
$rule[] = sprintf('RewriteCond %%{ENV:__ROUTING_host_%s} =1', $hostRegexUnique);
}
$rule[] = "RewriteCond %{REQUEST_URI} $regex";
$rule[] = sprintf("RewriteCond %%{REQUEST_METHOD} !^(%s)$ [NC]", implode('|', $methods));
$rule[] = sprintf('RewriteCond %%{REQUEST_METHOD} !^(%s)$ [NC]', implode('|', $methods));
$rule[] = sprintf('RewriteRule .* - [S=%d,%s]', $hasTrailingSlash ? 2 : 1, implode(',', $allow));
}
// redirect with trailing slash appended
if ($hasTrailingSlash) {
if ($compiledRoute->getHostRegex()) {
$rule[] = sprintf("RewriteCond %%{ENV:__ROUTING_host_%s} =1", $hostRegexUnique);
$rule[] = sprintf('RewriteCond %%{ENV:__ROUTING_host_%s} =1', $hostRegexUnique);
}
$rule[] = 'RewriteCond %{REQUEST_URI} '.substr($regex, 0, -2).'$';
@ -172,7 +172,7 @@ class ApacheMatcherDumper extends MatcherDumper
// the main rule
if ($compiledRoute->getHostRegex()) {
$rule[] = sprintf("RewriteCond %%{ENV:__ROUTING_host_%s} =1", $hostRegexUnique);
$rule[] = sprintf('RewriteCond %%{ENV:__ROUTING_host_%s} =1', $hostRegexUnique);
}
$rule[] = "RewriteCond %{REQUEST_URI} $regex";

View File

@ -75,7 +75,7 @@ class DumperPrefixCollection extends DumperCollection
}
// Reached only if the root has a non empty prefix
throw new \LogicException("The collection root must not have a prefix");
throw new \LogicException('The collection root must not have a prefix');
}
/**

View File

@ -218,7 +218,7 @@ class RouteCompiler implements RouteCompilerInterface
$nbTokens = count($tokens);
if ($nbTokens - 1 == $index) {
// Close the optional subpatterns
$regexp .= str_repeat(")?", $nbTokens - $firstOptional - (0 === $firstOptional ? 1 : 0));
$regexp .= str_repeat(')?', $nbTokens - $firstOptional - (0 === $firstOptional ? 1 : 0));
}
}

View File

@ -59,7 +59,7 @@ class DaoAuthenticationProvider extends UserAuthenticationProvider
throw new BadCredentialsException('The credentials were changed from another session.');
}
} else {
if ("" === ($presentedPassword = $token->getCredentials())) {
if ('' === ($presentedPassword = $token->getCredentials())) {
throw new BadCredentialsException('The presented password cannot be empty.');
}

View File

@ -107,7 +107,7 @@ abstract class AbstractPreAuthenticatedListener implements ListenerInterface
$this->securityContext->setToken(null);
if (null !== $this->logger) {
$this->logger->info(sprintf("Cleared security context due to exception: %s", $exception->getMessage()));
$this->logger->info(sprintf('Cleared security context due to exception: %s', $exception->getMessage()));
}
}
}

View File

@ -56,7 +56,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
// get some random test object identities from the database
$oids = array();
$stmt = $this->con->executeQuery("SELECT object_identifier, class_type FROM acl_object_identities o INNER JOIN acl_classes c ON c.id = o.class_id ORDER BY RAND() LIMIT 25");
$stmt = $this->con->executeQuery('SELECT object_identifier, class_type FROM acl_object_identities o INNER JOIN acl_classes c ON c.id = o.class_id ORDER BY RAND() LIMIT 25');
foreach ($stmt->fetchAll() as $oid) {
$oids[] = new ObjectIdentity($oid['object_identifier'], $oid['class_type']);
}
@ -66,7 +66,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
$start = microtime(true);
$provider->findAcls($oids);
$time = microtime(true) - $start;
echo "Total Time: ".$time."s\n";
echo 'Total Time: '.$time."s\n";
}
/**
@ -77,7 +77,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
{
$sm = $this->con->getSchemaManager();
$sm->dropAndCreateDatabase('testdb');
$this->con->exec("USE testdb");
$this->con->exec('USE testdb');
// import the schema
$schema = new Schema($options = $this->getOptions());

View File

@ -448,7 +448,7 @@ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase
if (isset($aclData['parent_acl'])) {
if (isset($aclIds[$aclData['parent_acl']])) {
$con->executeQuery("UPDATE acl_object_identities SET parent_object_identity_id = ".$aclIds[$aclData['parent_acl']]." WHERE id = ".$aclId);
$con->executeQuery('UPDATE acl_object_identities SET parent_object_identity_id = '.$aclIds[$aclData['parent_acl']].' WHERE id = '.$aclId);
$con->executeQuery($this->callMethod($provider, 'getInsertObjectIdentityRelationSql', array($aclId, $aclIds[$aclData['parent_acl']])));
} else {
$parentAcls[$aclId] = $aclData['parent_acl'];
@ -461,7 +461,7 @@ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase
throw new \InvalidArgumentException(sprintf('"%s" does not exist.', $name));
}
$con->executeQuery(sprintf("UPDATE acl_object_identities SET parent_object_identity_id = %d WHERE id = %d", $aclIds[$name], $aclId));
$con->executeQuery(sprintf('UPDATE acl_object_identities SET parent_object_identity_id = %d WHERE id = %d', $aclIds[$name], $aclId));
$con->executeQuery($this->callMethod($provider, 'getInsertObjectIdentityRelationSql', array($aclId, $aclIds[$name])));
}

View File

@ -99,8 +99,8 @@ class AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase
$voter->expects($this->exactly(2))
->method('vote')
->will($this->returnValueMap(array(
array($token, null, array("ROLE_FOO"), $vote1),
array($token, null, array("ROLE_BAR"), $vote2),
array($token, null, array('ROLE_FOO'), $vote1),
array($token, null, array('ROLE_BAR'), $vote2),
)))
;

View File

@ -277,7 +277,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
} else {
$data['item'][] = $value;
}
} elseif (array_key_exists($key, $data) || $key == "entry") {
} elseif (array_key_exists($key, $data) || $key == 'entry') {
if ((false === is_array($data[$key])) || (false === isset($data[$key][0]))) {
$data[$key] = array($data[$key]);
}
@ -308,7 +308,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
if (is_array($data) || $data instanceof \Traversable) {
foreach ($data as $key => $data) {
//Ah this is the magic @ attribute types.
if (0 === strpos($key, "@") && is_scalar($data) && $this->isElementNameValid($attributeName = substr($key, 1))) {
if (0 === strpos($key, '@') && is_scalar($data) && $this->isElementNameValid($attributeName = substr($key, 1))) {
$parentNode->setAttribute($attributeName, $data);
} elseif ($key === '#') {
$append = $this->selectNodeType($parentNode, $data);
@ -327,7 +327,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
$append = $this->appendNode($parentNode, $data, $key);
}
} elseif (is_numeric($key) || !$this->isElementNameValid($key)) {
$append = $this->appendNode($parentNode, $data, "item", $key);
$append = $this->appendNode($parentNode, $data, 'item', $key);
} else {
$append = $this->appendNode($parentNode, $data, $key);
}

View File

@ -26,7 +26,7 @@ class JsonEncoderTest extends \PHPUnit_Framework_TestCase
public function testEncodeScalar()
{
$obj = new \stdClass();
$obj->foo = "foo";
$obj->foo = 'foo';
$expected = '{"foo":"foo"}';
@ -47,14 +47,14 @@ class JsonEncoderTest extends \PHPUnit_Framework_TestCase
$context = array('json_encode_options' => JSON_NUMERIC_CHECK);
$arr = array();
$arr['foo'] = "3";
$arr['foo'] = '3';
$expected = '{"foo":3}';
$this->assertEquals($expected, $this->serializer->serialize($arr, 'json', $context));
$arr = array();
$arr['foo'] = "3";
$arr['foo'] = '3';
$expected = '{"foo":"3"}';
@ -72,7 +72,7 @@ class JsonEncoderTest extends \PHPUnit_Framework_TestCase
$obj->foo = 'foo';
$obj->bar = array('a', 'b');
$obj->baz = array('key' => 'val', 'key2' => 'val', 'A B' => 'bar', 'item' => array(array('title' => 'title1'), array('title' => 'title2')), 'Barry' => array('FooBar' => array('Baz' => 'Ed', '@id' => 1)));
$obj->qux = "1";
$obj->qux = '1';
return $obj;
}

View File

@ -32,7 +32,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
public function testEncodeScalar()
{
$obj = new ScalarDummy();
$obj->xmlFoo = "foo";
$obj->xmlFoo = 'foo';
$expected = '<?xml version="1.0"?>'."\n".
'<response>foo</response>'."\n";
@ -43,7 +43,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
public function testSetRootNodeName()
{
$obj = new ScalarDummy();
$obj->xmlFoo = "foo";
$obj->xmlFoo = 'foo';
$this->encoder->setRootNodeName('test');
$expected = '<?xml version="1.0"?>'."\n".
@ -70,11 +70,11 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
'@name' => 'Bar',
),
'Foo' => array(
'Bar' => "Test",
'Bar' => 'Test',
'@Type' => 'test',
),
'föo_bär' => 'a',
"Bar" => array(1,2,3),
'Bar' => array(1,2,3),
'a' => 'b',
);
$expected = '<?xml version="1.0"?>'."\n".
@ -275,28 +275,28 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
$obj = new ScalarDummy();
$obj->xmlFoo = array(
'foo-bar' => array(
'@key' => "value",
'item' => array("@key" => 'key', "key-val" => 'val'),
'@key' => 'value',
'item' => array('@key' => 'key', 'key-val' => 'val'),
),
'Foo' => array(
'Bar' => "Test",
'Bar' => 'Test',
'@Type' => 'test',
),
'föo_bär' => 'a',
"Bar" => array(1,2,3),
'Bar' => array(1,2,3),
'a' => 'b',
);
$expected = array(
'foo-bar' => array(
'@key' => "value",
'key' => array('@key' => 'key', "key-val" => 'val'),
'@key' => 'value',
'key' => array('@key' => 'key', 'key-val' => 'val'),
),
'Foo' => array(
'Bar' => "Test",
'Bar' => 'Test',
'@Type' => 'test',
),
'föo_bär' => 'a',
"Bar" => array(1,2,3),
'Bar' => array(1,2,3),
'a' => 'b',
);
$xml = $this->encoder->encode($obj, 'xml');
@ -355,7 +355,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
$obj->foo = 'foo';
$obj->bar = array('a', 'b');
$obj->baz = array('key' => 'val', 'key2' => 'val', 'A B' => 'bar', 'item' => array(array('title' => 'title1'), array('title' => 'title2')), 'Barry' => array('FooBar' => array('Baz' => 'Ed', '@id' => 1)));
$obj->qux = "1";
$obj->qux = '1';
return $obj;
}

View File

@ -275,7 +275,7 @@ class GetSetDummy
public function otherMethod()
{
throw new \RuntimeException("Dummy::otherMethod() should not be called");
throw new \RuntimeException('Dummy::otherMethod() should not be called');
}
}
@ -302,7 +302,7 @@ class GetConstructorDummy
public function otherMethod()
{
throw new \RuntimeException("Dummy::otherMethod() should not be called");
throw new \RuntimeException('Dummy::otherMethod() should not be called');
}
}
@ -336,6 +336,6 @@ class GetConstructorOptionalArgsDummy
public function otherMethod()
{
throw new \RuntimeException("Dummy::otherMethod() should not be called");
throw new \RuntimeException('Dummy::otherMethod() should not be called');
}
}

View File

@ -138,6 +138,6 @@ class StopwatchEventTest extends \PHPUnit_Framework_TestCase
*/
public function testInvalidOriginThrowsAnException()
{
new StopwatchEvent("abc");
new StopwatchEvent('abc');
}
}

View File

@ -88,7 +88,7 @@ class MoFileLoader extends ArrayLoader implements LoaderInterface
$stat = fstat($stream);
if ($stat['size'] < self::MO_HEADER_SIZE) {
throw new InvalidResourceException("MO stream content has an invalid format.");
throw new InvalidResourceException('MO stream content has an invalid format.');
}
$magic = unpack('V1', fread($stream, 4));
$magic = hexdec(substr(dechex(current($magic)), -8));
@ -98,7 +98,7 @@ class MoFileLoader extends ArrayLoader implements LoaderInterface
} elseif ($magic == self::MO_BIG_ENDIAN_MAGIC) {
$isBigEndian = true;
} else {
throw new InvalidResourceException("MO stream content has an invalid format.");
throw new InvalidResourceException('MO stream content has an invalid format.');
}
// formatRevision

View File

@ -31,9 +31,9 @@ class PluralizationRules
*/
public static function get($number, $locale)
{
if ("pt_BR" == $locale) {
if ('pt_BR' == $locale) {
// temporary set a locale for brazilian
$locale = "xbr";
$locale = 'xbr';
}
if (strlen($locale) > 3) {
@ -197,9 +197,9 @@ class PluralizationRules
*/
public static function set($rule, $locale)
{
if ("pt_BR" == $locale) {
if ('pt_BR' == $locale) {
// temporary set a locale for brazilian
$locale = "xbr";
$locale = 'xbr';
}
if (strlen($locale) > 3) {

View File

@ -77,6 +77,6 @@ class EmailValidator extends ConstraintValidator
*/
private function checkHost($host)
{
return $this->checkMX($host) || (checkdnsrr($host, "A") || checkdnsrr($host, "AAAA"));
return $this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA'));
}
}

View File

@ -42,7 +42,7 @@ class IssnValidator extends ConstraintValidator
// Compose regex pattern
$digitsPattern = $constraint->requireHyphen ? '\d{4}-\d{3}' : '\d{4}-?\d{3}';
$checkSumPattern = $constraint->caseSensitive ? '[\d|X]' : '[\d|X|x]';
$pattern = "/^".$digitsPattern.$checkSumPattern."$/";
$pattern = '/^'.$digitsPattern.$checkSumPattern.'$/';
if (!preg_match($pattern, $value)) {
$this->context->addViolation($constraint->message, array(

View File

@ -75,16 +75,16 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
public function testAcceptOptionalConstraintAsOneElementArray()
{
$collection1 = new Collection(array(
"fields" => array(
"alternate_email" => array(
'fields' => array(
'alternate_email' => array(
new Optional(new Email()),
),
),
));
$collection2 = new Collection(array(
"fields" => array(
"alternate_email" => new Optional(new Email()),
'fields' => array(
'alternate_email' => new Optional(new Email()),
),
));
@ -94,16 +94,16 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
public function testAcceptRequiredConstraintAsOneElementArray()
{
$collection1 = new Collection(array(
"fields" => array(
"alternate_email" => array(
'fields' => array(
'alternate_email' => array(
new Required(new Email()),
),
),
));
$collection2 = new Collection(array(
"fields" => array(
"alternate_email" => new Required(new Email()),
'fields' => array(
'alternate_email' => new Required(new Email()),
),
));

View File

@ -96,10 +96,10 @@ class LengthValidatorTest extends AbstractConstraintValidatorTest
}
return array(
array("é", "utf8", true),
array("\xE9", "CP1252", true),
array("\xE9", "XXX", false),
array("\xE9", "utf8", false),
array('é', 'utf8', true),
array("\xE9", 'CP1252', true),
array("\xE9", 'XXX', false),
array("\xE9", 'utf8', false),
);
}

View File

@ -48,7 +48,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase
$required_locales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252');
if (false === setlocale(LC_ALL, $required_locales)) {
$this->markTestSkipped('Could not set any of required locales: '.implode(", ", $required_locales));
$this->markTestSkipped('Could not set any of required locales: '.implode(', ', $required_locales));
}
$this->assertEquals('1.2', Inline::dump(1.2));
@ -219,7 +219,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase
'{foo: \'bar\', bar: \'foo: bar\'}' => array('foo' => 'bar', 'bar' => 'foo: bar'),
'{\'foo\': \'bar\', "bar": \'foo: bar\'}' => array('foo' => 'bar', 'bar' => 'foo: bar'),
'{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}' => array('foo\'' => 'bar', "bar\"" => 'foo: bar'),
'{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}' => array('foo: ' => 'bar', "bar: " => 'foo: bar'),
'{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}' => array('foo: ' => 'bar', 'bar: ' => 'foo: bar'),
// nested sequences and mappings
'[foo, [bar, foo]]' => array('foo', array('bar', 'foo')),

View File

@ -259,8 +259,8 @@ bar: >-
EOF;
$expected = array(
'foo' => "one two",
'bar' => "one two",
'foo' => 'one two',
'bar' => 'one two',
);
$tests['Folded block chomping strip with single trailing newline'] = array($expected, $yaml);
@ -276,8 +276,8 @@ bar: >-
EOF;
$expected = array(
'foo' => "one two",
'bar' => "one two",
'foo' => 'one two',
'bar' => 'one two',
);
$tests['Folded block chomping strip with multiple trailing newlines'] = array($expected, $yaml);
@ -290,8 +290,8 @@ bar: >-
two
EOF;
$expected = array(
'foo' => "one two",
'bar' => "one two",
'foo' => 'one two',
'bar' => 'one two',
);
$tests['Folded block chomping strip without trailing newline'] = array($expected, $yaml);
@ -337,7 +337,7 @@ bar: >
EOF;
$expected = array(
'foo' => "one two\n",
'bar' => "one two",
'bar' => 'one two',
);
$tests['Folded block chomping clip without trailing newline'] = array($expected, $yaml);
@ -383,7 +383,7 @@ bar: >+
EOF;
$expected = array(
'foo' => "one two\n",
'bar' => "one two",
'bar' => 'one two',
);
$tests['Folded block chomping keep without trailing newline'] = array($expected, $yaml);
@ -455,9 +455,9 @@ EOF;
}
$yamls = array(
iconv("UTF-8", "ISO-8859-1", "foo: 'äöüß'"),
iconv("UTF-8", "ISO-8859-15", "euro: '€'"),
iconv("UTF-8", "CP1252", "cp1252: '©ÉÇáñ'"),
iconv('UTF-8', 'ISO-8859-1', "foo: 'äöüß'"),
iconv('UTF-8', 'ISO-8859-15', "euro: '€'"),
iconv('UTF-8', 'CP1252', "cp1252: '©ÉÇáñ'"),
);
foreach ($yamls as $yaml) {