minor #14005 CS: Convert double quotes to single quotes (keradus)
This PR was merged into the 2.3 branch.
Discussion
----------
CS: Convert double quotes to single quotes
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
Changes generated automatically by upcoming PHP CS Fixer.
To keep fabbot.io happy ;)
Commits
-------
f99c22c
CS: Convert double quotes to single quotes
This commit is contained in:
commit
052735d948
@ -85,10 +85,10 @@ class EntityUserProvider implements UserProviderInterface
|
|||||||
// That's the case when the user has been changed by a form with
|
// That's the case when the user has been changed by a form with
|
||||||
// validation errors.
|
// validation errors.
|
||||||
if (!$id = $this->metadata->getIdentifierValues($user)) {
|
if (!$id = $this->metadata->getIdentifierValues($user)) {
|
||||||
throw new \InvalidArgumentException("You cannot refresh a user ".
|
throw new \InvalidArgumentException('You cannot refresh a user '.
|
||||||
"from the EntityUserProvider that does not contain an identifier. ".
|
'from the EntityUserProvider that does not contain an identifier. '.
|
||||||
"The user object has to be serialized with its own identifier ".
|
'The user object has to be serialized with its own identifier '.
|
||||||
"mapped by Doctrine."
|
'mapped by Doctrine.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(0, $c->getQueryCount());
|
$this->assertEquals(0, $c->getQueryCount());
|
||||||
|
|
||||||
$queries = array(
|
$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 = $this->createCollector($queries);
|
||||||
$c->collect(new Request(), new Response());
|
$c->collect(new Request(), new Response());
|
||||||
@ -53,15 +53,15 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(0, $c->getTime());
|
$this->assertEquals(0, $c->getTime());
|
||||||
|
|
||||||
$queries = array(
|
$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 = $this->createCollector($queries);
|
||||||
$c->collect(new Request(), new Response());
|
$c->collect(new Request(), new Response());
|
||||||
$this->assertEquals(1, $c->getTime());
|
$this->assertEquals(1, $c->getTime());
|
||||||
|
|
||||||
$queries = array(
|
$queries = array(
|
||||||
array('sql' => "SELECT * FROM table1", 'params' => array(), 'types' => array(), 'executionMS' => 1),
|
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 table2', 'params' => array(), 'types' => array(), 'executionMS' => 2),
|
||||||
);
|
);
|
||||||
$c = $this->createCollector($queries);
|
$c = $this->createCollector($queries);
|
||||||
$c->collect(new Request(), new Response());
|
$c->collect(new Request(), new Response());
|
||||||
@ -74,7 +74,7 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testCollectQueries($param, $types, $expected, $explainable)
|
public function testCollectQueries($param, $types, $expected, $explainable)
|
||||||
{
|
{
|
||||||
$queries = array(
|
$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 = $this->createCollector($queries);
|
||||||
$c->collect(new Request(), new Response());
|
$c->collect(new Request(), new Response());
|
||||||
@ -90,7 +90,7 @@ class DoctrineDataCollectorTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testSerialization($param, $types, $expected, $explainable)
|
public function testSerialization($param, $types, $expected, $explainable)
|
||||||
{
|
{
|
||||||
$queries = array(
|
$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 = $this->createCollector($queries);
|
||||||
$c->collect(new Request(), new Response());
|
$c->collect(new Request(), new Response());
|
||||||
|
@ -244,11 +244,11 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
'message' => 'myMessage',
|
'message' => 'myMessage',
|
||||||
'fields' => array('name', 'name2'),
|
'fields' => array('name', 'name2'),
|
||||||
'em' => self::EM_NAME,
|
'em' => self::EM_NAME,
|
||||||
'errorPath' => "name2",
|
'errorPath' => 'name2',
|
||||||
));
|
));
|
||||||
|
|
||||||
$entity1 = new DoubleNameEntity(1, 'Foo', "Bar");
|
$entity1 = new DoubleNameEntity(1, 'Foo', 'Bar');
|
||||||
$entity2 = new DoubleNameEntity(2, 'Foo', "Bar");
|
$entity2 = new DoubleNameEntity(2, 'Foo', 'Bar');
|
||||||
|
|
||||||
$this->validator->validate($entity1, $constraint);
|
$this->validator->validate($entity1, $constraint);
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
'em' => self::EM_NAME,
|
'em' => self::EM_NAME,
|
||||||
));
|
));
|
||||||
|
|
||||||
$composite = new CompositeIntIdEntity(1, 1, "test");
|
$composite = new CompositeIntIdEntity(1, 1, 'test');
|
||||||
$associated = new AssociationEntity();
|
$associated = new AssociationEntity();
|
||||||
$associated->composite = $composite;
|
$associated->composite = $composite;
|
||||||
|
|
||||||
|
@ -98,8 +98,8 @@ class UniqueEntityValidator extends ConstraintValidator
|
|||||||
|
|
||||||
if (count($relatedId) > 1) {
|
if (count($relatedId) > 1) {
|
||||||
throw new ConstraintDefinitionException(
|
throw new ConstraintDefinitionException(
|
||||||
"Associated entities are not allowed to have more than one identifier field to be ".
|
'Associated entities are not allowed to have more than one identifier field to be '.
|
||||||
"part of a unique constraint in: ".$class->getName()."#".$fieldName
|
'part of a unique constraint in: '.$class->getName().'#'.$fieldName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$criteria[$fieldName] = array_pop($relatedId);
|
$criteria[$fieldName] = array_pop($relatedId);
|
||||||
|
@ -51,7 +51,7 @@ class PropelDataCollectorTest extends Propel1TestCase
|
|||||||
{
|
{
|
||||||
$queries = array(
|
$queries = array(
|
||||||
"time: 0.000 sec | mem: 1.4 MB | connection: default | SET NAMES 'utf8'",
|
"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 |')",
|
"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',
|
'memory' => '1.4 MB',
|
||||||
),
|
),
|
||||||
array(
|
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',
|
'time' => '0.012 sec',
|
||||||
'connection' => 'default',
|
'connection' => 'default',
|
||||||
'memory' => '2.4 MB',
|
'memory' => '2.4 MB',
|
||||||
|
@ -65,7 +65,7 @@ class CodeExtension extends \Twig_Extension
|
|||||||
{
|
{
|
||||||
if (false !== strpos($method, '::')) {
|
if (false !== strpos($method, '::')) {
|
||||||
list($class, $method) = explode('::', $method, 2);
|
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) {
|
} elseif ('Closure' === $method) {
|
||||||
$result = sprintf("<abbr title=\"%s\">%s</abbr>", $method, $method);
|
$result = sprintf("<abbr title=\"%s\">%s</abbr>", $method, $method);
|
||||||
} else {
|
} else {
|
||||||
@ -91,7 +91,7 @@ class CodeExtension extends \Twig_Extension
|
|||||||
$short = array_pop($parts);
|
$short = array_pop($parts);
|
||||||
$formattedValue = sprintf("<em>object</em>(<abbr title=\"%s\">%s</abbr>)", $item[1], $short);
|
$formattedValue = sprintf("<em>object</em>(<abbr title=\"%s\">%s</abbr>)", $item[1], $short);
|
||||||
} elseif ('array' === $item[0]) {
|
} 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]) {
|
} elseif ('string' === $item[0]) {
|
||||||
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->charset));
|
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->charset));
|
||||||
} elseif ('null' === $item[0]) {
|
} elseif ('null' === $item[0]) {
|
||||||
|
@ -101,6 +101,6 @@ class SearchAndRenderBlockNode extends \Twig_Node_Expression_Function
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$compiler->raw(")");
|
$compiler->raw(')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ EOT
|
|||||||
$bundlesDir = $targetArg.'/bundles/';
|
$bundlesDir = $targetArg.'/bundles/';
|
||||||
$filesystem->mkdir($bundlesDir, 0777);
|
$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) {
|
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
|
||||||
if (is_dir($originDir = $bundle->getPath().'/Resources/public')) {
|
if (is_dir($originDir = $bundle->getPath().'/Resources/public')) {
|
||||||
|
@ -207,12 +207,12 @@ EOF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$format = '%-'.$maxName.'s ';
|
$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';
|
$format .= '%-'.$maxScope.'s %s';
|
||||||
|
|
||||||
// the title field needs extra space to make up for comment tags
|
// the title field needs extra space to make up for comment tags
|
||||||
$format1 = '%-'.($maxName + 19).'s ';
|
$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';
|
$format1 .= '%-'.($maxScope + 19).'s %s';
|
||||||
|
|
||||||
$tags = array();
|
$tags = array();
|
||||||
@ -230,7 +230,7 @@ EOF
|
|||||||
foreach ($definition->getTag($showTagAttributes) as $key => $tag) {
|
foreach ($definition->getTag($showTagAttributes) as $key => $tag) {
|
||||||
$tagValues = array();
|
$tagValues = array();
|
||||||
foreach (array_keys($maxTags) as $tagName) {
|
foreach (array_keys($maxTags) as $tagName) {
|
||||||
$tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : "";
|
$tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : '';
|
||||||
}
|
}
|
||||||
if (0 === $key) {
|
if (0 === $key) {
|
||||||
$lines[] = $this->buildArgumentsArray($serviceId, $definition->getScope(), $definition->getClass(), $tagValues);
|
$lines[] = $this->buildArgumentsArray($serviceId, $definition->getScope(), $definition->getClass(), $tagValues);
|
||||||
@ -247,11 +247,11 @@ EOF
|
|||||||
}
|
}
|
||||||
} elseif ($definition instanceof Alias) {
|
} elseif ($definition instanceof Alias) {
|
||||||
$alias = $definition;
|
$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 {
|
} else {
|
||||||
// we have no information (happens with "service_container")
|
// we have no information (happens with "service_container")
|
||||||
$service = $definition;
|
$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) {
|
if ($definition instanceof Definition) {
|
||||||
$output->writeln(sprintf('<comment>Service Id</comment> %s', $serviceId));
|
$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();
|
$tags = $definition->getTags();
|
||||||
if (count($tags)) {
|
if (count($tags)) {
|
||||||
|
@ -62,7 +62,7 @@ class CodeHelper extends Helper
|
|||||||
{
|
{
|
||||||
if (false !== strpos($method, '::')) {
|
if (false !== strpos($method, '::')) {
|
||||||
list($class, $method) = explode('::', $method, 2);
|
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) {
|
} elseif ('Closure' === $method) {
|
||||||
$result = sprintf("<abbr title=\"%s\">%s</abbr>", $method, $method);
|
$result = sprintf("<abbr title=\"%s\">%s</abbr>", $method, $method);
|
||||||
} else {
|
} else {
|
||||||
@ -88,7 +88,7 @@ class CodeHelper extends Helper
|
|||||||
$short = array_pop($parts);
|
$short = array_pop($parts);
|
||||||
$formattedValue = sprintf("<em>object</em>(<abbr title=\"%s\">%s</abbr>)", $item[1], $short);
|
$formattedValue = sprintf("<em>object</em>(<abbr title=\"%s\">%s</abbr>)", $item[1], $short);
|
||||||
} elseif ('array' === $item[0]) {
|
} 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]) {
|
} elseif ('string' === $item[0]) {
|
||||||
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->getCharset()));
|
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->getCharset()));
|
||||||
} elseif ('null' === $item[0]) {
|
} elseif ('null' === $item[0]) {
|
||||||
|
@ -66,7 +66,7 @@ class TemplateLocator implements FileLocatorInterface
|
|||||||
public function locate($template, $currentPath = null, $first = true)
|
public function locate($template, $currentPath = null, $first = true)
|
||||||
{
|
{
|
||||||
if (!$template instanceof TemplateReferenceInterface) {
|
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);
|
$key = $this->getCacheKey($template);
|
||||||
|
@ -155,30 +155,30 @@ class RedirectControllerTest extends TestCase
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
// Standard ports
|
// Standard ports
|
||||||
array('http', null, null, 'http', 80, ""),
|
array('http', null, null, 'http', 80, ''),
|
||||||
array('http', 80, null, 'http', 80, ""),
|
array('http', 80, null, 'http', 80, ''),
|
||||||
array('https', null, null, 'http', 80, ""),
|
array('https', null, null, 'http', 80, ''),
|
||||||
array('https', 80, null, 'http', 80, ""),
|
array('https', 80, null, 'http', 80, ''),
|
||||||
|
|
||||||
array('http', null, null, 'https', 443, ""),
|
array('http', null, null, 'https', 443, ''),
|
||||||
array('http', null, 443, 'https', 443, ""),
|
array('http', null, 443, 'https', 443, ''),
|
||||||
array('https', null, null, 'https', 443, ""),
|
array('https', null, null, 'https', 443, ''),
|
||||||
array('https', null, 443, 'https', 443, ""),
|
array('https', null, 443, 'https', 443, ''),
|
||||||
|
|
||||||
// Non-standard ports
|
// Non-standard ports
|
||||||
array('http', null, null, 'http', 8080, ":8080"),
|
array('http', null, null, 'http', 8080, ':8080'),
|
||||||
array('http', 4080, null, 'http', 8080, ":4080"),
|
array('http', 4080, null, 'http', 8080, ':4080'),
|
||||||
array('http', 80, null, 'http', 8080, ""),
|
array('http', 80, null, 'http', 8080, ''),
|
||||||
array('https', null, null, 'http', 8080, ""),
|
array('https', null, null, 'http', 8080, ''),
|
||||||
array('https', null, 8443, 'http', 8080, ":8443"),
|
array('https', null, 8443, 'http', 8080, ':8443'),
|
||||||
array('https', null, 443, 'http', 8080, ""),
|
array('https', null, 443, 'http', 8080, ''),
|
||||||
|
|
||||||
array('https', null, null, 'https', 8443, ":8443"),
|
array('https', null, null, 'https', 8443, ':8443'),
|
||||||
array('https', null, 4443, 'https', 8443, ":4443"),
|
array('https', null, 4443, 'https', 8443, ':4443'),
|
||||||
array('https', null, 443, 'https', 8443, ""),
|
array('https', null, 443, 'https', 8443, ''),
|
||||||
array('http', null, null, 'https', 8443, ""),
|
array('http', null, null, 'https', 8443, ''),
|
||||||
array('http', 8080, 4443, 'https', 8443, ":8080"),
|
array('http', 8080, 4443, 'https', 8443, ':8080'),
|
||||||
array('http', 80, 4443, 'https', 8443, ""),
|
array('http', 80, 4443, 'https', 8443, ''),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
|
|
||||||
public function testValidationPaths()
|
public function testValidationPaths()
|
||||||
{
|
{
|
||||||
require_once __DIR__."/Fixtures/TestBundle/TestBundle.php";
|
require_once __DIR__.'/Fixtures/TestBundle/TestBundle.php';
|
||||||
|
|
||||||
$container = $this->createContainerFromFile('validation_annotations', array(
|
$container = $this->createContainerFromFile('validation_annotations', array(
|
||||||
'kernel.bundles' => array('TestBundle' => 'Symfony\Bundle\FrameworkBundle\Tests\TestBundle'),
|
'kernel.bundles' => array('TestBundle' => 'Symfony\Bundle\FrameworkBundle\Tests\TestBundle'),
|
||||||
|
@ -65,7 +65,7 @@ class FormHelperDivLayoutTest extends AbstractDivLayoutTest
|
|||||||
protected function renderEnctype(FormView $view)
|
protected function renderEnctype(FormView $view)
|
||||||
{
|
{
|
||||||
if (!method_exists($form = $this->engine->get('form'), 'enctype')) {
|
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);
|
return (string) $form->enctype($view);
|
||||||
|
@ -66,7 +66,7 @@ class FormHelperTableLayoutTest extends AbstractTableLayoutTest
|
|||||||
protected function renderEnctype(FormView $view)
|
protected function renderEnctype(FormView $view)
|
||||||
{
|
{
|
||||||
if (!method_exists($form = $this->engine->get('form'), 'enctype')) {
|
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);
|
return (string) $form->enctype($view);
|
||||||
|
@ -42,8 +42,8 @@ EOF;
|
|||||||
"double-quoted key with whitespace and escaped \$\n\" sequences" => "prefixdouble-quoted key with whitespace and escaped \$\n\" sequences",
|
"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 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"',
|
'single-quoted key with "quote mark at the end"' => 'prefixsingle-quoted key with "quote mark at the end"',
|
||||||
$expectedHeredoc => "prefix".$expectedHeredoc,
|
$expectedHeredoc => 'prefix'.$expectedHeredoc,
|
||||||
$expectedNowdoc => "prefix".$expectedNowdoc,
|
$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',
|
'{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();
|
$actualCatalogue = $catalogue->all();
|
||||||
|
@ -69,8 +69,8 @@ class SecurityRoutingIntegrationTest extends WebTestCase
|
|||||||
*/
|
*/
|
||||||
public function testSecurityConfigurationForSingleIPAddress($config)
|
public function testSecurityConfigurationForSingleIPAddress($config)
|
||||||
{
|
{
|
||||||
$allowedClient = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config), array("REMOTE_ADDR" => "10.10.10.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"));
|
$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->assertAllowed($allowedClient, '/secured-by-one-ip');
|
||||||
$this->assertRestricted($barredClient, '/secured-by-one-ip');
|
$this->assertRestricted($barredClient, '/secured-by-one-ip');
|
||||||
@ -82,9 +82,9 @@ class SecurityRoutingIntegrationTest extends WebTestCase
|
|||||||
*/
|
*/
|
||||||
public function testSecurityConfigurationForMultipleIPAddresses($config)
|
public function testSecurityConfigurationForMultipleIPAddresses($config)
|
||||||
{
|
{
|
||||||
$allowedClientA = $this->createClient(array('test_case' => 'StandardFormLogin', 'root_config' => $config), array("REMOTE_ADDR" => "1.1.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"));
|
$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"));
|
$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($allowedClientA, '/secured-by-two-ips');
|
||||||
$this->assertAllowed($allowedClientB, '/secured-by-two-ips');
|
$this->assertAllowed($allowedClientB, '/secured-by-two-ips');
|
||||||
|
@ -63,7 +63,7 @@ EOF
|
|||||||
|
|
||||||
if (!$filename) {
|
if (!$filename) {
|
||||||
if (0 !== ftell(STDIN)) {
|
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)) {
|
while (!feof(STDIN)) {
|
||||||
@ -114,14 +114,14 @@ EOF
|
|||||||
$lines = $this->getContext($template, $line);
|
$lines = $this->getContext($template, $line);
|
||||||
|
|
||||||
if ($file) {
|
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 {
|
} else {
|
||||||
$output->writeln(sprintf("<error>KO</error> (line %s)", $line));
|
$output->writeln(sprintf('<error>KO</error> (line %s)', $line));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($lines as $no => $code) {
|
foreach ($lines as $no => $code) {
|
||||||
$output->writeln(sprintf(
|
$output->writeln(sprintf(
|
||||||
"%s %-6s %s",
|
'%s %-6s %s',
|
||||||
$no == $line ? '<error>>></error>' : ' ',
|
$no == $line ? '<error>>></error>' : ' ',
|
||||||
$no,
|
$no,
|
||||||
$code
|
$code
|
||||||
|
@ -120,7 +120,7 @@ class ReferenceDumper
|
|||||||
if ($info = $node->getInfo()) {
|
if ($info = $node->getInfo()) {
|
||||||
$this->writeLine('');
|
$this->writeLine('');
|
||||||
// indenting multi-line info
|
// 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);
|
$this->writeLine('# '.$info, $depth * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class FileLoaderLoadException extends \Exception
|
|||||||
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
|
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf("Array(%s)", implode(', ', $a));
|
return sprintf('Array(%s)', implode(', ', $a));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_resource($var)) {
|
if (is_resource($var)) {
|
||||||
|
@ -41,7 +41,7 @@ class ExampleConfiguration implements ConfigurationInterface
|
|||||||
->info(
|
->info(
|
||||||
"this is a long\n".
|
"this is a long\n".
|
||||||
"multi-line info text\n".
|
"multi-line info text\n".
|
||||||
"which should be indented"
|
'which should be indented'
|
||||||
)
|
)
|
||||||
->example('example setting')
|
->example('example setting')
|
||||||
->end()
|
->end()
|
||||||
|
@ -769,15 +769,15 @@ class Application
|
|||||||
$output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line));
|
$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());
|
} while ($e = $e->getPrevious());
|
||||||
|
|
||||||
if (null !== $this->runningCommand) {
|
if (null !== $this->runningCommand) {
|
||||||
$output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())));
|
$output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())));
|
||||||
$output->writeln("");
|
$output->writeln('');
|
||||||
$output->writeln("");
|
$output->writeln('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,14 +53,14 @@ class DialogHelper extends Helper
|
|||||||
|
|
||||||
$result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
|
$result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
|
||||||
// Collapse all spaces.
|
// Collapse all spaces.
|
||||||
$selectedChoices = str_replace(" ", "", $picked);
|
$selectedChoices = str_replace(' ', '', $picked);
|
||||||
|
|
||||||
if ($multiselect) {
|
if ($multiselect) {
|
||||||
// Check for a separated comma values
|
// Check for a separated comma values
|
||||||
if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
|
if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
|
||||||
throw new \InvalidArgumentException(sprintf($errorMessage, $picked));
|
throw new \InvalidArgumentException(sprintf($errorMessage, $picked));
|
||||||
}
|
}
|
||||||
$selectedChoices = explode(",", $selectedChoices);
|
$selectedChoices = explode(',', $selectedChoices);
|
||||||
} else {
|
} else {
|
||||||
$selectedChoices = array($picked);
|
$selectedChoices = array($picked);
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,12 @@ class Foo3Command extends Command
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
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) {
|
} 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) {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,15 +19,15 @@ class OutputFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testEmptyTag()
|
public function testEmptyTag()
|
||||||
{
|
{
|
||||||
$formatter = new OutputFormatter(true);
|
$formatter = new OutputFormatter(true);
|
||||||
$this->assertEquals("foo<>bar", $formatter->format('foo<>bar'));
|
$this->assertEquals('foo<>bar', $formatter->format('foo<>bar'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLGCharEscaping()
|
public function testLGCharEscaping()
|
||||||
{
|
{
|
||||||
$formatter = new OutputFormatter(true);
|
$formatter = new OutputFormatter(true);
|
||||||
|
|
||||||
$this->assertEquals("foo<bar", $formatter->format('foo\\<bar'));
|
$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>', $formatter->format('\\<info>some info\\</info>'));
|
||||||
$this->assertEquals("\\<info>some info\\</info>", OutputFormatter::escape('<info>some info</info>'));
|
$this->assertEquals("\\<info>some info\\</info>", OutputFormatter::escape('<info>some info</info>'));
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
@ -176,16 +176,16 @@ class OutputFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertTrue($formatter->hasStyle('question'));
|
$this->assertTrue($formatter->hasStyle('question'));
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
"some error", $formatter->format('<error>some error</error>')
|
'some error', $formatter->format('<error>some error</error>')
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
"some info", $formatter->format('<info>some info</info>')
|
'some info', $formatter->format('<info>some info</info>')
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
"some comment", $formatter->format('<comment>some comment</comment>')
|
'some comment', $formatter->format('<comment>some comment</comment>')
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
"some question", $formatter->format('<question>some question</question>')
|
'some question', $formatter->format('<question>some question</question>')
|
||||||
);
|
);
|
||||||
|
|
||||||
$formatter->setDecorated(true);
|
$formatter->setDecorated(true);
|
||||||
|
@ -157,10 +157,10 @@ TABLE
|
|||||||
array(
|
array(
|
||||||
array('ISBN', 'Title', 'Author'),
|
array('ISBN', 'Title', 'Author'),
|
||||||
array(
|
array(
|
||||||
array("99921-58-10-7", "Divine\nComedy", "Dante Alighieri"),
|
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("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('960-425-059-0', 'The Lord of the Rings', "J. R. R.\nTolkien"),
|
||||||
),
|
),
|
||||||
TableHelper::LAYOUT_DEFAULT,
|
TableHelper::LAYOUT_DEFAULT,
|
||||||
<<<TABLE
|
<<<TABLE
|
||||||
|
@ -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"', 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\'', array('--long-option=foo bar'), '->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'),
|
array('foo -a -ffoo --long bar', array('foo', '-a', '-ffoo', '--long', 'bar'), '->tokenize() parses when several arguments and options'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -37,23 +37,23 @@ class CssSelectorTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->fail('->parse() throws an Exception if the css selector is not valid');
|
$this->fail('->parse() throws an Exception if the css selector is not valid');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf('\Symfony\Component\CssSelector\Exception\ParseException', $e, '->parse() throws an Exception if the css selector is not valid');
|
$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()
|
public function getCssToXPathWithoutPrefixTestData()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('h1', "h1"),
|
array('h1', 'h1'),
|
||||||
array('foo|h1', "foo:h1"),
|
array('foo|h1', 'foo:h1'),
|
||||||
array('h1, h2, h3', "h1 | h2 | h3"),
|
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: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[@id = 'foo']"),
|
||||||
array('h1.foo', "h1[@class and contains(concat(' ', normalize-space(@class), ' '), ' 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[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[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::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' foo ')]"),
|
||||||
array('h1 #foo', "h1/descendant-or-self::*/*[@id = 'foo']"),
|
array('h1 #foo', "h1/descendant-or-self::*/*[@id = 'foo']"),
|
||||||
array('h1 [class*=foo]', "h1/descendant-or-self::*/*[@class and contains(@class, 'foo')]"),
|
array('h1 [class*=foo]', "h1/descendant-or-self::*/*[@class and contains(@class, 'foo')]"),
|
||||||
|
@ -90,12 +90,12 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function getCssToXPathTestData()
|
public function getCssToXPathTestData()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('*', "*"),
|
array('*', '*'),
|
||||||
array('e', "e"),
|
array('e', 'e'),
|
||||||
array('*|e', "e"),
|
array('*|e', 'e'),
|
||||||
array('e|f', "e:f"),
|
array('e|f', 'e:f'),
|
||||||
array('e[foo]', "e[@foo]"),
|
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 = '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 contains(concat(' ', normalize-space(@foo), ' '), ' bar ')]"),
|
||||||
array('e[foo^="bar"]', "e[@foo and starts-with(@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-child(1)', "*/*[name() = 'e' and (position() = 1)]"),
|
||||||
array('e:nth-last-child(1)', "*/*[name() = 'e' and (position() = last() - 0)]"),
|
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-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-of-type(1)', '*/e[position() = 1]'),
|
||||||
array('e:nth-last-of-type(1)', "*/e[position() = last() - 0]"),
|
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('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:first-child', "*/*[name() = 'e' and (position() = 1)]"),
|
||||||
array('e:last-child', "*/*[name() = 'e' and (position() = last())]"),
|
array('e:last-child', "*/*[name() = 'e' and (position() = last())]"),
|
||||||
array('e:first-of-type', "*/e[position() = 1]"),
|
array('e:first-of-type', '*/e[position() = 1]'),
|
||||||
array('e:last-of-type', "*/e[position() = last()]"),
|
array('e:last-of-type', '*/e[position() = last()]'),
|
||||||
array('e:only-child', "*/*[name() = 'e' and (last() = 1)]"),
|
array('e:only-child', "*/*[name() = 'e' and (last() = 1)]"),
|
||||||
array('e:only-of-type', "e[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:EmPTY', "e[not(*) and not(string-length())]"),
|
array('e:EmPTY', 'e[not(*) and not(string-length())]'),
|
||||||
array('e:root', "e[not(parent::*)]"),
|
array('e:root', 'e[not(parent::*)]'),
|
||||||
array('e:hover', "e[0]"),
|
array('e:hover', 'e[0]'),
|
||||||
array('e:contains("foo")', "e[contains(string(.), 'foo')]"),
|
array('e:contains("foo")', "e[contains(string(.), 'foo')]"),
|
||||||
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.warning', "e[@class and contains(concat(' ', normalize-space(@class), ' '), ' warning ')]"),
|
||||||
array('e#myid', "e[@id = 'myid']"),
|
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(:nth-child(odd))', 'e[not(position() - 1 >= 0 and (position() - 1) mod 2 = 0)]'),
|
||||||
array('e:nOT(*)', "e[0]"),
|
array('e:nOT(*)', 'e[0]'),
|
||||||
array('e f', "e/descendant-or-self::*/f"),
|
array('e f', 'e/descendant-or-self::*/f'),
|
||||||
array('e > f', "e/f"),
|
array('e > f', 'e/f'),
|
||||||
array('e + f', "e/following-sibling::*[name() = 'f' and (position() = 1)]"),
|
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"),
|
array('div#container p', "div[@id = 'container']/descendant-or-self::*/p"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -98,9 +98,9 @@ class HtmlExtension extends AbstractExtension
|
|||||||
public function translateDisabled(XPathExpr $xpath)
|
public function translateDisabled(XPathExpr $xpath)
|
||||||
{
|
{
|
||||||
return $xpath->addCondition(
|
return $xpath->addCondition(
|
||||||
"("
|
'('
|
||||||
."@disabled and"
|
.'@disabled and'
|
||||||
."("
|
.'('
|
||||||
."(name(.) = 'input' and @type != 'hidden')"
|
."(name(.) = 'input' and @type != 'hidden')"
|
||||||
." or name(.) = 'button'"
|
." or name(.) = 'button'"
|
||||||
." or name(.) = 'select'"
|
." or name(.) = 'select'"
|
||||||
@ -109,14 +109,14 @@ class HtmlExtension extends AbstractExtension
|
|||||||
." or name(.) = 'fieldset'"
|
." or name(.) = 'fieldset'"
|
||||||
." or name(.) = 'optgroup'"
|
." or name(.) = 'optgroup'"
|
||||||
." or name(.) = 'option'"
|
." or name(.) = 'option'"
|
||||||
.")"
|
.')'
|
||||||
.") or ("
|
.') or ('
|
||||||
."(name(.) = 'input' and @type != 'hidden')"
|
."(name(.) = 'input' and @type != 'hidden')"
|
||||||
." or name(.) = 'button'"
|
." or name(.) = 'button'"
|
||||||
." or name(.) = 'select'"
|
." or name(.) = 'select'"
|
||||||
." or name(.) = 'textarea'"
|
." 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."
|
// 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(.) = 'textarea'"
|
||||||
." or name(.) = 'keygen'"
|
." or name(.) = 'keygen'"
|
||||||
.')'
|
.')'
|
||||||
." and not (@disabled or ancestor::fieldset[@disabled])"
|
.' and not (@disabled or ancestor::fieldset[@disabled])'
|
||||||
.') or ('
|
.') or ('
|
||||||
."name(.) = 'option' and not("
|
."name(.) = 'option' and not("
|
||||||
."@disabled or ancestor::optgroup[@disabled]"
|
.'@disabled or ancestor::optgroup[@disabled]'
|
||||||
.')'
|
.')'
|
||||||
.')'
|
.')'
|
||||||
);
|
);
|
||||||
|
@ -298,9 +298,9 @@ EOF;
|
|||||||
$result = array();
|
$result = array();
|
||||||
foreach ($args as $key => $item) {
|
foreach ($args as $key => $item) {
|
||||||
if ('object' === $item[0]) {
|
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]) {
|
} 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]) {
|
} elseif ('string' === $item[0]) {
|
||||||
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], $flags, $this->charset));
|
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], $flags, $this->charset));
|
||||||
} elseif ('null' === $item[0]) {
|
} elseif ('null' === $item[0]) {
|
||||||
|
@ -539,7 +539,7 @@ class PhpDumper extends Dumper
|
|||||||
if ($definition->isSynthetic()) {
|
if ($definition->isSynthetic()) {
|
||||||
$return[] = '@throws RuntimeException always since this service is expected to be injected dynamically';
|
$return[] = '@throws RuntimeException always since this service is expected to be injected dynamically';
|
||||||
} elseif ($class = $definition->getClass()) {
|
} 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()) {
|
} elseif ($definition->getFactoryClass()) {
|
||||||
$return[] = sprintf('@return object An instance returned by %s::%s().', $definition->getFactoryClass(), $definition->getFactoryMethod());
|
$return[] = sprintf('@return object An instance returned by %s::%s().', $definition->getFactoryClass(), $definition->getFactoryMethod());
|
||||||
} elseif ($definition->getFactoryService()) {
|
} elseif ($definition->getFactoryService()) {
|
||||||
@ -1225,7 +1225,7 @@ EOF;
|
|||||||
} elseif (null !== $value->getFactoryService()) {
|
} elseif (null !== $value->getFactoryService()) {
|
||||||
$service = $this->dumpValue($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 {
|
} else {
|
||||||
throw new RuntimeException('Cannot dump definitions which have factory method without factory service or factory class.');
|
throw new RuntimeException('Cannot dump definitions which have factory method without factory service or factory class.');
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,8 @@ class DefinitionTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$def = new Definition('stdClass');
|
$def = new Definition('stdClass');
|
||||||
$this->assertNull($def->getFactoryClass());
|
$this->assertNull($def->getFactoryClass());
|
||||||
$this->assertSame($def, $def->setFactoryClass('stdClass2'), "->setFactoryClass() implements a fluent interface.");
|
$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->assertEquals('stdClass2', $def->getFactoryClass(), '->getFactoryClass() returns current class to construct this service.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetGetFactoryMethod()
|
public function testSetGetFactoryMethod()
|
||||||
@ -47,8 +47,8 @@ class DefinitionTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$def = new Definition('stdClass');
|
$def = new Definition('stdClass');
|
||||||
$this->assertNull($def->getFactoryService());
|
$this->assertNull($def->getFactoryService());
|
||||||
$this->assertSame($def, $def->setFactoryService('foo.bar'), "->setFactoryService() implements a fluent interface.");
|
$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->assertEquals('foo.bar', $def->getFactoryService(), '->getFactoryService() returns current service to construct this service.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,8 +63,8 @@ class PhpDumperTest extends \PHPUnit_Framework_TestCase
|
|||||||
'.' => 'dot as a key',
|
'.' => 'dot as a key',
|
||||||
'.\'\'.' => 'concatenation as a key',
|
'.\'\'.' => 'concatenation as a key',
|
||||||
'\'\'.' => 'concatenation from the start key',
|
'\'\'.' => 'concatenation from the start key',
|
||||||
'optimize concatenation' => "string1%some_string%string2",
|
'optimize concatenation' => 'string1%some_string%string2',
|
||||||
'optimize concatenation with empty string' => "string1%empty_value%string2",
|
'optimize concatenation with empty string' => 'string1%empty_value%string2',
|
||||||
'optimize concatenation from the start' => '%empty_value%start',
|
'optimize concatenation from the start' => '%empty_value%start',
|
||||||
'optimize concatenation at the end' => 'end%empty_value%',
|
'optimize concatenation at the end' => 'end%empty_value%',
|
||||||
));
|
));
|
||||||
|
@ -210,31 +210,31 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testConvertDomElementToArray()
|
public function testConvertDomElementToArray()
|
||||||
{
|
{
|
||||||
$doc = new \DOMDocument("1.0");
|
$doc = new \DOMDocument('1.0');
|
||||||
$doc->loadXML('<foo>bar</foo>');
|
$doc->loadXML('<foo>bar</foo>');
|
||||||
$this->assertEquals('bar', XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array');
|
$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" />');
|
$doc->loadXML('<foo foo="bar" />');
|
||||||
$this->assertEquals(array('foo' => 'bar'), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array');
|
$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>');
|
$doc->loadXML('<foo><foo>bar</foo></foo>');
|
||||||
$this->assertEquals(array('foo' => 'bar'), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array');
|
$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>');
|
$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');
|
$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>');
|
$doc->loadXML('<foo><foo></foo></foo>');
|
||||||
$this->assertEquals(array('foo' => null), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array');
|
$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>');
|
$doc->loadXML('<foo><foo><!-- foo --></foo></foo>');
|
||||||
$this->assertEquals(array('foo' => null), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array');
|
$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>');
|
$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');
|
$this->assertEquals(array('foo' => array(array('foo' => 'bar'), array('foo' => 'bar'))), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array');
|
||||||
}
|
}
|
||||||
|
@ -785,7 +785,7 @@ class Crawler extends \SplObjectStorage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf("concat(%s)", implode($parts, ', '));
|
return sprintf('concat(%s)', implode($parts, ', '));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,7 +176,7 @@ class FormFieldRegistry
|
|||||||
private function walk(array $array, $base = '', array &$output = array())
|
private function walk(array $array, $base = '', array &$output = array())
|
||||||
{
|
{
|
||||||
foreach ($array as $k => $v) {
|
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)) {
|
if (is_array($v)) {
|
||||||
$this->walk($v, $path, $output);
|
$this->walk($v, $path, $output);
|
||||||
} else {
|
} else {
|
||||||
|
@ -397,7 +397,7 @@ class FormTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testMultiselectSetValues()
|
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 = $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');
|
$this->assertEquals(array('multi' => array('foo', 'bar')), $form->getValues(), '->setValue() sets the values of select');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||||||
$paths[] = $file->getRelativePath();
|
$paths[] = $file->getRelativePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
$ref = array("", "", "", "", "foo", "");
|
$ref = array('', '', '', '', 'foo', '');
|
||||||
|
|
||||||
sort($ref);
|
sort($ref);
|
||||||
sort($paths);
|
sort($paths);
|
||||||
@ -402,7 +402,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
|||||||
$paths[] = $file->getRelativePathname();
|
$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($paths);
|
||||||
sort($ref);
|
sort($ref);
|
||||||
|
@ -18,7 +18,7 @@ class FixUrlProtocolListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
public function testFixHttpUrl()
|
public function testFixHttpUrl()
|
||||||
{
|
{
|
||||||
$data = "www.symfony.com";
|
$data = 'www.symfony.com';
|
||||||
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
|
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
|
||||||
$event = new FormEvent($form, $data);
|
$event = new FormEvent($form, $data);
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ class FixUrlProtocolListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testSkipKnownUrl()
|
public function testSkipKnownUrl()
|
||||||
{
|
{
|
||||||
$data = "http://www.symfony.com";
|
$data = 'http://www.symfony.com';
|
||||||
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
|
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
|
||||||
$event = new FormEvent($form, $data);
|
$event = new FormEvent($form, $data);
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class FixUrlProtocolListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testSkipOtherProtocol()
|
public function testSkipOtherProtocol()
|
||||||
{
|
{
|
||||||
$data = "ftp://www.symfony.com";
|
$data = 'ftp://www.symfony.com';
|
||||||
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
|
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
|
||||||
$event = new FormEvent($form, $data);
|
$event = new FormEvent($form, $data);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class TrimListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
public function testTrim()
|
public function testTrim()
|
||||||
{
|
{
|
||||||
$data = " Foo! ";
|
$data = ' Foo! ';
|
||||||
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
|
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
|
||||||
$event = new FormEvent($form, $data);
|
$event = new FormEvent($form, $data);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class CsrfValidationListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
// https://github.com/symfony/symfony/pull/5838
|
// https://github.com/symfony/symfony/pull/5838
|
||||||
public function testStringFormData()
|
public function testStringFormData()
|
||||||
{
|
{
|
||||||
$data = "XP4HUzmHPi";
|
$data = 'XP4HUzmHPi';
|
||||||
$event = new FormEvent($this->form, $data);
|
$event = new FormEvent($this->form, $data);
|
||||||
|
|
||||||
$validation = new CsrfValidationListener('csrf', $this->csrfProvider, 'unknown', 'Invalid.');
|
$validation = new CsrfValidationListener('csrf', $this->csrfProvider, 'unknown', 'Invalid.');
|
||||||
|
@ -84,12 +84,12 @@ class Cookie
|
|||||||
$str = urlencode($this->getName()).'=';
|
$str = urlencode($this->getName()).'=';
|
||||||
|
|
||||||
if ('' === (string) $this->getValue()) {
|
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 {
|
} else {
|
||||||
$str .= urlencode($this->getValue());
|
$str .= urlencode($this->getValue());
|
||||||
|
|
||||||
if ($this->getExpiresTime() !== 0) {
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,8 +107,8 @@ class IpUtils
|
|||||||
$netmask = 128;
|
$netmask = 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
$bytesAddr = unpack("n*", inet_pton($address));
|
$bytesAddr = unpack('n*', inet_pton($address));
|
||||||
$bytesTest = unpack("n*", inet_pton($requestIp));
|
$bytesTest = unpack('n*', inet_pton($requestIp));
|
||||||
|
|
||||||
for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) {
|
for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) {
|
||||||
$left = $netmask - 16 * ($i-1);
|
$left = $netmask - 16 * ($i-1);
|
||||||
|
@ -1195,7 +1195,7 @@ class Response
|
|||||||
protected function ensureIEOverSSLCompatibility(Request $request)
|
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 (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');
|
$this->headers->remove('Cache-Control');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ class MockArraySessionStorage implements SessionStorageInterface
|
|||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
if (!$this->started || $this->closed) {
|
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
|
// nothing to do since we don't persist the session data
|
||||||
$this->closed = false;
|
$this->closed = false;
|
||||||
|
@ -93,7 +93,7 @@ class MockFileSessionStorage extends MockArraySessionStorage
|
|||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
if (!$this->started) {
|
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));
|
file_put_contents($this->getFilePath(), serialize($this->data));
|
||||||
|
@ -25,9 +25,9 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array(''),
|
array(''),
|
||||||
array(",MyName"),
|
array(',MyName'),
|
||||||
array(";MyName"),
|
array(';MyName'),
|
||||||
array(" MyName"),
|
array(' MyName'),
|
||||||
array("\tMyName"),
|
array("\tMyName"),
|
||||||
array("\rMyName"),
|
array("\rMyName"),
|
||||||
array("\nMyName"),
|
array("\nMyName"),
|
||||||
@ -89,7 +89,7 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testGetExpiresTimeWithStringValue()
|
public function testGetExpiresTimeWithStringValue()
|
||||||
{
|
{
|
||||||
$value = "+1 day";
|
$value = '+1 day';
|
||||||
$cookie = new Cookie('foo', 'bar', $value);
|
$cookie = new Cookie('foo', 'bar', $value);
|
||||||
$expire = strtotime($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');
|
$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');
|
$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, '/', '');
|
$cookie = new Cookie('foo', 'bar', 0, '/', '');
|
||||||
$this->assertEquals('foo=bar; path=/; httponly', $cookie->__toString());
|
$this->assertEquals('foo=bar; path=/; httponly', $cookie->__toString());
|
||||||
|
@ -40,7 +40,7 @@ class HeaderBagTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$bag = new HeaderBag(array('foo' => 'bar'));
|
$bag = new HeaderBag(array('foo' => 'bar'));
|
||||||
$keys = $bag->keys();
|
$keys = $bag->keys();
|
||||||
$this->assertEquals("foo", $keys[0]);
|
$this->assertEquals('foo', $keys[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetDate()
|
public function testGetDate()
|
||||||
|
@ -917,7 +917,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
|||||||
$req = new Request();
|
$req = new Request();
|
||||||
$retval = $req->getContent(true);
|
$retval = $req->getContent(true);
|
||||||
$this->assertInternalType('resource', $retval);
|
$this->assertInternalType('resource', $retval);
|
||||||
$this->assertEquals("", fread($retval, 1));
|
$this->assertEquals('', fread($retval, 1));
|
||||||
$this->assertTrue(feof($retval));
|
$this->assertTrue(feof($retval));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,11 +114,11 @@ class ResponseHeaderBagTest extends \PHPUnit_Framework_TestCase
|
|||||||
$bag = new ResponseHeaderBag(array());
|
$bag = new ResponseHeaderBag(array());
|
||||||
$bag->setCookie(new Cookie('foo', 'bar'));
|
$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');
|
$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()
|
public function testReplace()
|
||||||
@ -155,10 +155,10 @@ class ResponseHeaderBagTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertCount(4, $bag->getCookies());
|
$this->assertCount(4, $bag->getCookies());
|
||||||
|
|
||||||
$headers = explode("\r\n", $bag->__toString());
|
$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/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=/path/bar; domain=bar.foo; httponly', $headers);
|
||||||
$this->assertContains("Set-Cookie: foo=bar; path=/; httponly", $headers);
|
$this->assertContains('Set-Cookie: foo=bar; path=/; httponly', $headers);
|
||||||
|
|
||||||
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
$cookies = $bag->getCookies(ResponseHeaderBag::COOKIES_ARRAY);
|
||||||
$this->assertTrue(isset($cookies['foo.bar']['/path/foo']['foo']));
|
$this->assertTrue(isset($cookies['foo.bar']['/path/foo']['foo']));
|
||||||
|
@ -29,8 +29,8 @@ class ResponseTest extends ResponseTestCase
|
|||||||
{
|
{
|
||||||
$response = new Response();
|
$response = new Response();
|
||||||
$response = explode("\r\n", $response);
|
$response = explode("\r\n", $response);
|
||||||
$this->assertEquals("HTTP/1.0 200 OK", $response[0]);
|
$this->assertEquals('HTTP/1.0 200 OK', $response[0]);
|
||||||
$this->assertEquals("Cache-Control: no-cache", $response[1]);
|
$this->assertEquals('Cache-Control: no-cache', $response[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testClone()
|
public function testClone()
|
||||||
@ -497,7 +497,7 @@ class ResponseTest extends ResponseTestCase
|
|||||||
$response = new Response();
|
$response = new Response();
|
||||||
//array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public')
|
//array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public')
|
||||||
try {
|
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');
|
$this->fail('->setCache() throws an InvalidArgumentException if an option is not supported');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf('InvalidArgumentException', $e, '->setCache() throws an InvalidArgumentException if an option is not supported');
|
$this->assertInstanceOf('InvalidArgumentException', $e, '->setCache() throws an InvalidArgumentException if an option is not supported');
|
||||||
|
@ -51,7 +51,7 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
|
|||||||
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
|
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf("Array(%s)", implode(', ', $a));
|
return sprintf('Array(%s)', implode(', ', $a));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_resource($var)) {
|
if (is_resource($var)) {
|
||||||
|
@ -86,7 +86,7 @@ class FilterControllerEvent extends KernelEvent
|
|||||||
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
|
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf("Array(%s)", implode(', ', $a));
|
return sprintf('Array(%s)', implode(', ', $a));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_resource($var)) {
|
if (is_resource($var)) {
|
||||||
|
@ -219,7 +219,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
|||||||
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
|
$a[] = sprintf('%s => %s', $k, $this->varToString($v));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf("Array(%s)", implode(', ', $a));
|
return sprintf('Array(%s)', implode(', ', $a));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_resource($var)) {
|
if (is_resource($var)) {
|
||||||
|
@ -1069,7 +1069,7 @@ class HttpCacheTest extends HttpCacheTestCase
|
|||||||
$this->setNextResponses($responses);
|
$this->setNextResponses($responses);
|
||||||
|
|
||||||
$this->request('GET', '/', array(), array(), true);
|
$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
|
// 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)));
|
$this->assertTrue(in_array($this->response->getTtl(), array(99, 100)));
|
||||||
|
@ -94,7 +94,7 @@ class FileProfilerStorageTest extends AbstractProfilerStorageTest
|
|||||||
fwrite($h, "line1\n\n\nline2\n");
|
fwrite($h, "line1\n\n\nline2\n");
|
||||||
fseek($h, 0, SEEK_END);
|
fseek($h, 0, SEEK_END);
|
||||||
|
|
||||||
$this->assertEquals("line2", $r->invoke(self::$storage, $h));
|
$this->assertEquals('line2', $r->invoke(self::$storage, $h));
|
||||||
$this->assertEquals("line1", $r->invoke(self::$storage, $h));
|
$this->assertEquals('line1', $r->invoke(self::$storage, $h));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ class TextBundleWriter implements BundleWriterInterface
|
|||||||
fprintf($file, "%s%d,\n", str_repeat(' ', $indentation + 1), $int);
|
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) {
|
if (!$fallback) {
|
||||||
fwrite($file, ":table(nofallback)");
|
fwrite($file, ':table(nofallback)');
|
||||||
}
|
}
|
||||||
|
|
||||||
fwrite($file, "{\n");
|
fwrite($file, "{\n");
|
||||||
|
@ -79,11 +79,11 @@ set_exception_handler(function (\Exception $exception) {
|
|||||||
echo "Caused by\n";
|
echo "Caused by\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo get_class($cause).": ".$cause->getMessage()."\n";
|
echo get_class($cause).': '.$cause->getMessage()."\n";
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo $cause->getFile().":".$cause->getLine()."\n";
|
echo $cause->getFile().':'.$cause->getLine()."\n";
|
||||||
foreach ($cause->getTrace() as $trace) {
|
foreach ($cause->getTrace() as $trace) {
|
||||||
echo $trace['file'].":".$trace['line']."\n";
|
echo $trace['file'].':'.$trace['line']."\n";
|
||||||
}
|
}
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ MESSAGE
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo LINE;
|
echo LINE;
|
||||||
echo centered("ICU Resource Bundle Compilation")."\n";
|
echo centered('ICU Resource Bundle Compilation')."\n";
|
||||||
echo LINE;
|
echo LINE;
|
||||||
|
|
||||||
if (!Intl::isExtensionLoaded()) {
|
if (!Intl::isExtensionLoaded()) {
|
||||||
@ -123,42 +123,42 @@ if ($argc >= 3) {
|
|||||||
// will run into problems when building genrb.
|
// will run into problems when building genrb.
|
||||||
$filesystem->mkdir($sourceDir.'/bin');
|
$filesystem->mkdir($sourceDir.'/bin');
|
||||||
|
|
||||||
echo "[1/6] libicudata.so...";
|
echo '[1/6] libicudata.so...';
|
||||||
|
|
||||||
cd($sourceDir.'/stubdata');
|
cd($sourceDir.'/stubdata');
|
||||||
run('make 2>&1 && make install 2>&1');
|
run('make 2>&1 && make install 2>&1');
|
||||||
|
|
||||||
echo " ok.\n";
|
echo " ok.\n";
|
||||||
|
|
||||||
echo "[2/6] libicuuc.so...";
|
echo '[2/6] libicuuc.so...';
|
||||||
|
|
||||||
cd($sourceDir.'/common');
|
cd($sourceDir.'/common');
|
||||||
run('make 2>&1 && make install 2>&1');
|
run('make 2>&1 && make install 2>&1');
|
||||||
|
|
||||||
echo " ok.\n";
|
echo " ok.\n";
|
||||||
|
|
||||||
echo "[3/6] libicui18n.so...";
|
echo '[3/6] libicui18n.so...';
|
||||||
|
|
||||||
cd($sourceDir.'/i18n');
|
cd($sourceDir.'/i18n');
|
||||||
run('make 2>&1 && make install 2>&1');
|
run('make 2>&1 && make install 2>&1');
|
||||||
|
|
||||||
echo " ok.\n";
|
echo " ok.\n";
|
||||||
|
|
||||||
echo "[4/6] libicutu.so...";
|
echo '[4/6] libicutu.so...';
|
||||||
|
|
||||||
cd($sourceDir.'/tools/toolutil');
|
cd($sourceDir.'/tools/toolutil');
|
||||||
run('make 2>&1 && make install 2>&1');
|
run('make 2>&1 && make install 2>&1');
|
||||||
|
|
||||||
echo " ok.\n";
|
echo " ok.\n";
|
||||||
|
|
||||||
echo "[5/6] libicuio.so...";
|
echo '[5/6] libicuio.so...';
|
||||||
|
|
||||||
cd($sourceDir.'/io');
|
cd($sourceDir.'/io');
|
||||||
run('make 2>&1 && make install 2>&1');
|
run('make 2>&1 && make install 2>&1');
|
||||||
|
|
||||||
echo " ok.\n";
|
echo " ok.\n";
|
||||||
|
|
||||||
echo "[6/6] genrb...";
|
echo '[6/6] genrb...';
|
||||||
|
|
||||||
cd($sourceDir.'/tools/genrb');
|
cd($sourceDir.'/tools/genrb');
|
||||||
run('make 2>&1 && make install 2>&1');
|
run('make 2>&1 && make install 2>&1');
|
||||||
|
@ -668,7 +668,7 @@ class Process
|
|||||||
$timeoutMicro = microtime(true) + $timeout;
|
$timeoutMicro = microtime(true) + $timeout;
|
||||||
if ($this->isRunning()) {
|
if ($this->isRunning()) {
|
||||||
if ('\\' === DIRECTORY_SEPARATOR && !$this->isSigchildEnabled()) {
|
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) {
|
if ($exitCode > 0) {
|
||||||
throw new RuntimeException('Unable to kill the process');
|
throw new RuntimeException('Unable to kill the process');
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$proc = $pb->getProcess();
|
$proc = $pb->getProcess();
|
||||||
|
|
||||||
$this->assertContains("second", $proc->getCommandLine());
|
$this->assertContains('second', $proc->getCommandLine());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPrefixIsPrependedToAllGeneratedProcess()
|
public function testPrefixIsPrependedToAllGeneratedProcess()
|
||||||
|
@ -49,8 +49,8 @@ class ProcessFailedExceptionTest extends \PHPUnit_Framework_TestCase
|
|||||||
$cmd = 'php';
|
$cmd = 'php';
|
||||||
$exitCode = 1;
|
$exitCode = 1;
|
||||||
$exitText = 'General error';
|
$exitText = 'General error';
|
||||||
$output = "Command output";
|
$output = 'Command output';
|
||||||
$errorOutput = "FATAL: Unexpected error";
|
$errorOutput = 'FATAL: Unexpected error';
|
||||||
|
|
||||||
$process = $this->getMock(
|
$process = $this->getMock(
|
||||||
'Symfony\Component\Process\Process',
|
'Symfony\Component\Process\Process',
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// required for signal handling
|
// required for signal handling
|
||||||
declare (ticks = 1);
|
declare (ticks = 1);
|
||||||
|
|
||||||
pcntl_signal(SIGUSR1, function () {echo "Caught SIGUSR1"; exit;});
|
pcntl_signal(SIGUSR1, function () {echo 'Caught SIGUSR1'; exit;});
|
||||||
|
|
||||||
$n = 0;
|
$n = 0;
|
||||||
|
|
||||||
|
@ -151,18 +151,18 @@ class ApacheMatcherDumper extends MatcherDumper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($compiledRoute->getHostRegex()) {
|
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[] = "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));
|
$rule[] = sprintf('RewriteRule .* - [S=%d,%s]', $hasTrailingSlash ? 2 : 1, implode(',', $allow));
|
||||||
}
|
}
|
||||||
|
|
||||||
// redirect with trailing slash appended
|
// redirect with trailing slash appended
|
||||||
if ($hasTrailingSlash) {
|
if ($hasTrailingSlash) {
|
||||||
if ($compiledRoute->getHostRegex()) {
|
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).'$';
|
$rule[] = 'RewriteCond %{REQUEST_URI} '.substr($regex, 0, -2).'$';
|
||||||
@ -172,7 +172,7 @@ class ApacheMatcherDumper extends MatcherDumper
|
|||||||
// the main rule
|
// the main rule
|
||||||
|
|
||||||
if ($compiledRoute->getHostRegex()) {
|
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[] = "RewriteCond %{REQUEST_URI} $regex";
|
||||||
|
@ -75,7 +75,7 @@ class DumperPrefixCollection extends DumperCollection
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reached only if the root has a non empty prefix
|
// 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');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -218,7 +218,7 @@ class RouteCompiler implements RouteCompilerInterface
|
|||||||
$nbTokens = count($tokens);
|
$nbTokens = count($tokens);
|
||||||
if ($nbTokens - 1 == $index) {
|
if ($nbTokens - 1 == $index) {
|
||||||
// Close the optional subpatterns
|
// Close the optional subpatterns
|
||||||
$regexp .= str_repeat(")?", $nbTokens - $firstOptional - (0 === $firstOptional ? 1 : 0));
|
$regexp .= str_repeat(')?', $nbTokens - $firstOptional - (0 === $firstOptional ? 1 : 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class DaoAuthenticationProvider extends UserAuthenticationProvider
|
|||||||
throw new BadCredentialsException('The credentials were changed from another session.');
|
throw new BadCredentialsException('The credentials were changed from another session.');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ("" === ($presentedPassword = $token->getCredentials())) {
|
if ('' === ($presentedPassword = $token->getCredentials())) {
|
||||||
throw new BadCredentialsException('The presented password cannot be empty.');
|
throw new BadCredentialsException('The presented password cannot be empty.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ abstract class AbstractPreAuthenticatedListener implements ListenerInterface
|
|||||||
$this->securityContext->setToken(null);
|
$this->securityContext->setToken(null);
|
||||||
|
|
||||||
if (null !== $this->logger) {
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
// get some random test object identities from the database
|
// get some random test object identities from the database
|
||||||
$oids = array();
|
$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) {
|
foreach ($stmt->fetchAll() as $oid) {
|
||||||
$oids[] = new ObjectIdentity($oid['object_identifier'], $oid['class_type']);
|
$oids[] = new ObjectIdentity($oid['object_identifier'], $oid['class_type']);
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
|
|||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
$provider->findAcls($oids);
|
$provider->findAcls($oids);
|
||||||
$time = microtime(true) - $start;
|
$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 = $this->con->getSchemaManager();
|
||||||
$sm->dropAndCreateDatabase('testdb');
|
$sm->dropAndCreateDatabase('testdb');
|
||||||
$this->con->exec("USE testdb");
|
$this->con->exec('USE testdb');
|
||||||
|
|
||||||
// import the schema
|
// import the schema
|
||||||
$schema = new Schema($options = $this->getOptions());
|
$schema = new Schema($options = $this->getOptions());
|
||||||
|
@ -448,7 +448,7 @@ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
if (isset($aclData['parent_acl'])) {
|
if (isset($aclData['parent_acl'])) {
|
||||||
if (isset($aclIds[$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']])));
|
$con->executeQuery($this->callMethod($provider, 'getInsertObjectIdentityRelationSql', array($aclId, $aclIds[$aclData['parent_acl']])));
|
||||||
} else {
|
} else {
|
||||||
$parentAcls[$aclId] = $aclData['parent_acl'];
|
$parentAcls[$aclId] = $aclData['parent_acl'];
|
||||||
@ -461,7 +461,7 @@ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
throw new \InvalidArgumentException(sprintf('"%s" does not exist.', $name));
|
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])));
|
$con->executeQuery($this->callMethod($provider, 'getInsertObjectIdentityRelationSql', array($aclId, $aclIds[$name])));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,8 +99,8 @@ class AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$voter->expects($this->exactly(2))
|
$voter->expects($this->exactly(2))
|
||||||
->method('vote')
|
->method('vote')
|
||||||
->will($this->returnValueMap(array(
|
->will($this->returnValueMap(array(
|
||||||
array($token, null, array("ROLE_FOO"), $vote1),
|
array($token, null, array('ROLE_FOO'), $vote1),
|
||||||
array($token, null, array("ROLE_BAR"), $vote2),
|
array($token, null, array('ROLE_BAR'), $vote2),
|
||||||
)))
|
)))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
|
|||||||
} else {
|
} else {
|
||||||
$data['item'][] = $value;
|
$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]))) {
|
if ((false === is_array($data[$key])) || (false === isset($data[$key][0]))) {
|
||||||
$data[$key] = array($data[$key]);
|
$data[$key] = array($data[$key]);
|
||||||
}
|
}
|
||||||
@ -308,7 +308,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
|
|||||||
if (is_array($data) || $data instanceof \Traversable) {
|
if (is_array($data) || $data instanceof \Traversable) {
|
||||||
foreach ($data as $key => $data) {
|
foreach ($data as $key => $data) {
|
||||||
//Ah this is the magic @ attribute types.
|
//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);
|
$parentNode->setAttribute($attributeName, $data);
|
||||||
} elseif ($key === '#') {
|
} elseif ($key === '#') {
|
||||||
$append = $this->selectNodeType($parentNode, $data);
|
$append = $this->selectNodeType($parentNode, $data);
|
||||||
@ -327,7 +327,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
|
|||||||
$append = $this->appendNode($parentNode, $data, $key);
|
$append = $this->appendNode($parentNode, $data, $key);
|
||||||
}
|
}
|
||||||
} elseif (is_numeric($key) || !$this->isElementNameValid($key)) {
|
} elseif (is_numeric($key) || !$this->isElementNameValid($key)) {
|
||||||
$append = $this->appendNode($parentNode, $data, "item", $key);
|
$append = $this->appendNode($parentNode, $data, 'item', $key);
|
||||||
} else {
|
} else {
|
||||||
$append = $this->appendNode($parentNode, $data, $key);
|
$append = $this->appendNode($parentNode, $data, $key);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ class JsonEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testEncodeScalar()
|
public function testEncodeScalar()
|
||||||
{
|
{
|
||||||
$obj = new \stdClass();
|
$obj = new \stdClass();
|
||||||
$obj->foo = "foo";
|
$obj->foo = 'foo';
|
||||||
|
|
||||||
$expected = '{"foo":"foo"}';
|
$expected = '{"foo":"foo"}';
|
||||||
|
|
||||||
@ -47,14 +47,14 @@ class JsonEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$context = array('json_encode_options' => JSON_NUMERIC_CHECK);
|
$context = array('json_encode_options' => JSON_NUMERIC_CHECK);
|
||||||
|
|
||||||
$arr = array();
|
$arr = array();
|
||||||
$arr['foo'] = "3";
|
$arr['foo'] = '3';
|
||||||
|
|
||||||
$expected = '{"foo":3}';
|
$expected = '{"foo":3}';
|
||||||
|
|
||||||
$this->assertEquals($expected, $this->serializer->serialize($arr, 'json', $context));
|
$this->assertEquals($expected, $this->serializer->serialize($arr, 'json', $context));
|
||||||
|
|
||||||
$arr = array();
|
$arr = array();
|
||||||
$arr['foo'] = "3";
|
$arr['foo'] = '3';
|
||||||
|
|
||||||
$expected = '{"foo":"3"}';
|
$expected = '{"foo":"3"}';
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ class JsonEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$obj->foo = 'foo';
|
$obj->foo = 'foo';
|
||||||
$obj->bar = array('a', 'b');
|
$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->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;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testEncodeScalar()
|
public function testEncodeScalar()
|
||||||
{
|
{
|
||||||
$obj = new ScalarDummy();
|
$obj = new ScalarDummy();
|
||||||
$obj->xmlFoo = "foo";
|
$obj->xmlFoo = 'foo';
|
||||||
|
|
||||||
$expected = '<?xml version="1.0"?>'."\n".
|
$expected = '<?xml version="1.0"?>'."\n".
|
||||||
'<response>foo</response>'."\n";
|
'<response>foo</response>'."\n";
|
||||||
@ -43,7 +43,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testSetRootNodeName()
|
public function testSetRootNodeName()
|
||||||
{
|
{
|
||||||
$obj = new ScalarDummy();
|
$obj = new ScalarDummy();
|
||||||
$obj->xmlFoo = "foo";
|
$obj->xmlFoo = 'foo';
|
||||||
|
|
||||||
$this->encoder->setRootNodeName('test');
|
$this->encoder->setRootNodeName('test');
|
||||||
$expected = '<?xml version="1.0"?>'."\n".
|
$expected = '<?xml version="1.0"?>'."\n".
|
||||||
@ -70,11 +70,11 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
'@name' => 'Bar',
|
'@name' => 'Bar',
|
||||||
),
|
),
|
||||||
'Foo' => array(
|
'Foo' => array(
|
||||||
'Bar' => "Test",
|
'Bar' => 'Test',
|
||||||
'@Type' => 'test',
|
'@Type' => 'test',
|
||||||
),
|
),
|
||||||
'föo_bär' => 'a',
|
'föo_bär' => 'a',
|
||||||
"Bar" => array(1,2,3),
|
'Bar' => array(1,2,3),
|
||||||
'a' => 'b',
|
'a' => 'b',
|
||||||
);
|
);
|
||||||
$expected = '<?xml version="1.0"?>'."\n".
|
$expected = '<?xml version="1.0"?>'."\n".
|
||||||
@ -275,28 +275,28 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$obj = new ScalarDummy();
|
$obj = new ScalarDummy();
|
||||||
$obj->xmlFoo = array(
|
$obj->xmlFoo = array(
|
||||||
'foo-bar' => array(
|
'foo-bar' => array(
|
||||||
'@key' => "value",
|
'@key' => 'value',
|
||||||
'item' => array("@key" => 'key', "key-val" => 'val'),
|
'item' => array('@key' => 'key', 'key-val' => 'val'),
|
||||||
),
|
),
|
||||||
'Foo' => array(
|
'Foo' => array(
|
||||||
'Bar' => "Test",
|
'Bar' => 'Test',
|
||||||
'@Type' => 'test',
|
'@Type' => 'test',
|
||||||
),
|
),
|
||||||
'föo_bär' => 'a',
|
'föo_bär' => 'a',
|
||||||
"Bar" => array(1,2,3),
|
'Bar' => array(1,2,3),
|
||||||
'a' => 'b',
|
'a' => 'b',
|
||||||
);
|
);
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'foo-bar' => array(
|
'foo-bar' => array(
|
||||||
'@key' => "value",
|
'@key' => 'value',
|
||||||
'key' => array('@key' => 'key', "key-val" => 'val'),
|
'key' => array('@key' => 'key', 'key-val' => 'val'),
|
||||||
),
|
),
|
||||||
'Foo' => array(
|
'Foo' => array(
|
||||||
'Bar' => "Test",
|
'Bar' => 'Test',
|
||||||
'@Type' => 'test',
|
'@Type' => 'test',
|
||||||
),
|
),
|
||||||
'föo_bär' => 'a',
|
'föo_bär' => 'a',
|
||||||
"Bar" => array(1,2,3),
|
'Bar' => array(1,2,3),
|
||||||
'a' => 'b',
|
'a' => 'b',
|
||||||
);
|
);
|
||||||
$xml = $this->encoder->encode($obj, 'xml');
|
$xml = $this->encoder->encode($obj, 'xml');
|
||||||
@ -355,7 +355,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$obj->foo = 'foo';
|
$obj->foo = 'foo';
|
||||||
$obj->bar = array('a', 'b');
|
$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->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;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ class GetSetDummy
|
|||||||
|
|
||||||
public function otherMethod()
|
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()
|
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()
|
public function otherMethod()
|
||||||
{
|
{
|
||||||
throw new \RuntimeException("Dummy::otherMethod() should not be called");
|
throw new \RuntimeException('Dummy::otherMethod() should not be called');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,6 +138,6 @@ class StopwatchEventTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testInvalidOriginThrowsAnException()
|
public function testInvalidOriginThrowsAnException()
|
||||||
{
|
{
|
||||||
new StopwatchEvent("abc");
|
new StopwatchEvent('abc');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ class MoFileLoader extends ArrayLoader
|
|||||||
$stat = fstat($stream);
|
$stat = fstat($stream);
|
||||||
|
|
||||||
if ($stat['size'] < self::MO_HEADER_SIZE) {
|
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 = unpack('V1', fread($stream, 4));
|
||||||
$magic = hexdec(substr(dechex(current($magic)), -8));
|
$magic = hexdec(substr(dechex(current($magic)), -8));
|
||||||
@ -98,7 +98,7 @@ class MoFileLoader extends ArrayLoader
|
|||||||
} elseif ($magic == self::MO_BIG_ENDIAN_MAGIC) {
|
} elseif ($magic == self::MO_BIG_ENDIAN_MAGIC) {
|
||||||
$isBigEndian = true;
|
$isBigEndian = true;
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidResourceException("MO stream content has an invalid format.");
|
throw new InvalidResourceException('MO stream content has an invalid format.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// formatRevision
|
// formatRevision
|
||||||
|
@ -31,9 +31,9 @@ class PluralizationRules
|
|||||||
*/
|
*/
|
||||||
public static function get($number, $locale)
|
public static function get($number, $locale)
|
||||||
{
|
{
|
||||||
if ("pt_BR" == $locale) {
|
if ('pt_BR' == $locale) {
|
||||||
// temporary set a locale for brazilian
|
// temporary set a locale for brazilian
|
||||||
$locale = "xbr";
|
$locale = 'xbr';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($locale) > 3) {
|
if (strlen($locale) > 3) {
|
||||||
@ -197,9 +197,9 @@ class PluralizationRules
|
|||||||
*/
|
*/
|
||||||
public static function set($rule, $locale)
|
public static function set($rule, $locale)
|
||||||
{
|
{
|
||||||
if ("pt_BR" == $locale) {
|
if ('pt_BR' == $locale) {
|
||||||
// temporary set a locale for brazilian
|
// temporary set a locale for brazilian
|
||||||
$locale = "xbr";
|
$locale = 'xbr';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($locale) > 3) {
|
if (strlen($locale) > 3) {
|
||||||
|
@ -77,6 +77,6 @@ class EmailValidator extends ConstraintValidator
|
|||||||
*/
|
*/
|
||||||
private function checkHost($host)
|
private function checkHost($host)
|
||||||
{
|
{
|
||||||
return $this->checkMX($host) || (checkdnsrr($host, "A") || checkdnsrr($host, "AAAA"));
|
return $this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ class IssnValidator extends ConstraintValidator
|
|||||||
// Compose regex pattern
|
// Compose regex pattern
|
||||||
$digitsPattern = $constraint->requireHyphen ? '\d{4}-\d{3}' : '\d{4}-?\d{3}';
|
$digitsPattern = $constraint->requireHyphen ? '\d{4}-\d{3}' : '\d{4}-?\d{3}';
|
||||||
$checkSumPattern = $constraint->caseSensitive ? '[\d|X]' : '[\d|X|x]';
|
$checkSumPattern = $constraint->caseSensitive ? '[\d|X]' : '[\d|X|x]';
|
||||||
$pattern = "/^".$digitsPattern.$checkSumPattern."$/";
|
$pattern = '/^'.$digitsPattern.$checkSumPattern.'$/';
|
||||||
|
|
||||||
if (!preg_match($pattern, $value)) {
|
if (!preg_match($pattern, $value)) {
|
||||||
$this->context->addViolation($constraint->message, array(
|
$this->context->addViolation($constraint->message, array(
|
||||||
|
@ -75,16 +75,16 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testAcceptOptionalConstraintAsOneElementArray()
|
public function testAcceptOptionalConstraintAsOneElementArray()
|
||||||
{
|
{
|
||||||
$collection1 = new Collection(array(
|
$collection1 = new Collection(array(
|
||||||
"fields" => array(
|
'fields' => array(
|
||||||
"alternate_email" => array(
|
'alternate_email' => array(
|
||||||
new Optional(new Email()),
|
new Optional(new Email()),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
$collection2 = new Collection(array(
|
$collection2 = new Collection(array(
|
||||||
"fields" => array(
|
'fields' => array(
|
||||||
"alternate_email" => new Optional(new Email()),
|
'alternate_email' => new Optional(new Email()),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -94,16 +94,16 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testAcceptRequiredConstraintAsOneElementArray()
|
public function testAcceptRequiredConstraintAsOneElementArray()
|
||||||
{
|
{
|
||||||
$collection1 = new Collection(array(
|
$collection1 = new Collection(array(
|
||||||
"fields" => array(
|
'fields' => array(
|
||||||
"alternate_email" => array(
|
'alternate_email' => array(
|
||||||
new Required(new Email()),
|
new Required(new Email()),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
$collection2 = new Collection(array(
|
$collection2 = new Collection(array(
|
||||||
"fields" => array(
|
'fields' => array(
|
||||||
"alternate_email" => new Required(new Email()),
|
'alternate_email' => new Required(new Email()),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -96,10 +96,10 @@ class LengthValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
array("é", "utf8", true),
|
array('é', 'utf8', true),
|
||||||
array("\xE9", "CP1252", true),
|
array("\xE9", 'CP1252', true),
|
||||||
array("\xE9", "XXX", false),
|
array("\xE9", 'XXX', false),
|
||||||
array("\xE9", "utf8", false),
|
array("\xE9", 'utf8', false),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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');
|
$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)) {
|
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));
|
$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'),
|
'{\'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
|
// nested sequences and mappings
|
||||||
'[foo, [bar, foo]]' => array('foo', array('bar', 'foo')),
|
'[foo, [bar, foo]]' => array('foo', array('bar', 'foo')),
|
||||||
|
@ -259,8 +259,8 @@ bar: >-
|
|||||||
|
|
||||||
EOF;
|
EOF;
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'foo' => "one two",
|
'foo' => 'one two',
|
||||||
'bar' => "one two",
|
'bar' => 'one two',
|
||||||
);
|
);
|
||||||
$tests['Folded block chomping strip with single trailing newline'] = array($expected, $yaml);
|
$tests['Folded block chomping strip with single trailing newline'] = array($expected, $yaml);
|
||||||
|
|
||||||
@ -276,8 +276,8 @@ bar: >-
|
|||||||
|
|
||||||
EOF;
|
EOF;
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'foo' => "one two",
|
'foo' => 'one two',
|
||||||
'bar' => "one two",
|
'bar' => 'one two',
|
||||||
);
|
);
|
||||||
$tests['Folded block chomping strip with multiple trailing newlines'] = array($expected, $yaml);
|
$tests['Folded block chomping strip with multiple trailing newlines'] = array($expected, $yaml);
|
||||||
|
|
||||||
@ -290,8 +290,8 @@ bar: >-
|
|||||||
two
|
two
|
||||||
EOF;
|
EOF;
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'foo' => "one two",
|
'foo' => 'one two',
|
||||||
'bar' => "one two",
|
'bar' => 'one two',
|
||||||
);
|
);
|
||||||
$tests['Folded block chomping strip without trailing newline'] = array($expected, $yaml);
|
$tests['Folded block chomping strip without trailing newline'] = array($expected, $yaml);
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ bar: >
|
|||||||
EOF;
|
EOF;
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'foo' => "one two\n",
|
'foo' => "one two\n",
|
||||||
'bar' => "one two",
|
'bar' => 'one two',
|
||||||
);
|
);
|
||||||
$tests['Folded block chomping clip without trailing newline'] = array($expected, $yaml);
|
$tests['Folded block chomping clip without trailing newline'] = array($expected, $yaml);
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ bar: >+
|
|||||||
EOF;
|
EOF;
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'foo' => "one two\n",
|
'foo' => "one two\n",
|
||||||
'bar' => "one two",
|
'bar' => 'one two',
|
||||||
);
|
);
|
||||||
$tests['Folded block chomping keep without trailing newline'] = array($expected, $yaml);
|
$tests['Folded block chomping keep without trailing newline'] = array($expected, $yaml);
|
||||||
|
|
||||||
@ -455,9 +455,9 @@ EOF;
|
|||||||
}
|
}
|
||||||
|
|
||||||
$yamls = array(
|
$yamls = array(
|
||||||
iconv("UTF-8", "ISO-8859-1", "foo: 'äöüß'"),
|
iconv('UTF-8', 'ISO-8859-1', "foo: 'äöüß'"),
|
||||||
iconv("UTF-8", "ISO-8859-15", "euro: '€'"),
|
iconv('UTF-8', 'ISO-8859-15', "euro: '€'"),
|
||||||
iconv("UTF-8", "CP1252", "cp1252: '©ÉÇáñ'"),
|
iconv('UTF-8', 'CP1252', "cp1252: '©ÉÇáñ'"),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($yamls as $yaml) {
|
foreach ($yamls as $yaml) {
|
||||||
|
Reference in New Issue
Block a user