CS: apply rules
This commit is contained in:
parent
287713fd6a
commit
22d4e15634
@ -138,7 +138,6 @@ abstract class DoctrineType extends AbstractType
|
||||
$type = $this;
|
||||
|
||||
$choiceLoader = function (Options $options) use ($choiceListFactory, &$choiceLoaders, $type) {
|
||||
|
||||
// Unless the choices are given explicitly, load them on demand
|
||||
if (null === $options['choices']) {
|
||||
$hash = null;
|
||||
|
@ -44,7 +44,7 @@ class DoctrineExtensionTest extends \PHPUnit_Framework_TestCase
|
||||
$this->extension->expects($this->any())
|
||||
->method('getObjectManagerElementName')
|
||||
->will($this->returnCallback(function ($name) {
|
||||
return 'doctrine.orm.'.$name;
|
||||
return 'doctrine.orm.'.$name;
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ class DebugCommand extends Command
|
||||
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (text or json)', 'text'),
|
||||
))
|
||||
->setDescription('Shows a list of twig functions, filters, globals and tests')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command outputs a list of twig functions,
|
||||
filters, globals and tests. Output can be filtered with an optional argument.
|
||||
|
||||
|
@ -61,7 +61,7 @@ class LintCommand extends Command
|
||||
->setDescription('Lints a template and outputs encountered errors')
|
||||
->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt')
|
||||
->addArgument('filename', InputArgument::IS_ARRAY)
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command lints a template and outputs to STDOUT
|
||||
the first encountered syntax error.
|
||||
|
||||
|
@ -39,7 +39,7 @@ class ConfigDebugCommand extends AbstractConfigCommand
|
||||
new InputArgument('name', InputArgument::OPTIONAL, 'The bundle name or the extension alias'),
|
||||
))
|
||||
->setDescription('Dumps the current configuration for an extension')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command dumps the current configuration for an
|
||||
extension/bundle.
|
||||
|
||||
|
@ -38,7 +38,7 @@ class EventDispatcherDebugCommand extends ContainerAwareCommand
|
||||
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw description'),
|
||||
))
|
||||
->setDescription('Displays configured listeners for an application')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command displays all configured listeners:
|
||||
|
||||
<info>php %command.full_name%</info>
|
||||
|
@ -39,7 +39,7 @@ class ServerStartCommand extends ServerCommand
|
||||
))
|
||||
->setName('server:start')
|
||||
->setDescription('Starts PHP built-in web server in the background')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> runs PHP's built-in web server:
|
||||
|
||||
<info>php %command.full_name%</info>
|
||||
|
@ -33,7 +33,7 @@ class ServerStopCommand extends ServerCommand
|
||||
))
|
||||
->setName('server:stop')
|
||||
->setDescription('Stops PHP\'s built-in web server that was started with the server:start command')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> stops PHP's built-in web server:
|
||||
|
||||
<info>php %command.full_name%</info>
|
||||
|
@ -50,7 +50,7 @@ class TranslationDebugCommand extends ContainerAwareCommand
|
||||
new InputOption('only-unused', null, InputOption::VALUE_NONE, 'Displays only unused messages'),
|
||||
))
|
||||
->setDescription('Displays translation messages information')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command helps finding unused or missing translation
|
||||
messages and comparing them with the fallback ones by inspecting the
|
||||
templates and translation files of a given bundle or the app folder.
|
||||
|
@ -34,7 +34,7 @@ class YamlLintCommand extends Command
|
||||
->setDescription('Lints a file and outputs encountered errors')
|
||||
->addArgument('filename', null, 'A file or a directory or STDIN')
|
||||
->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt')
|
||||
->setHelp(<<<EOF
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command lints a YAML file and outputs to STDOUT
|
||||
the first encountered syntax error.
|
||||
|
||||
|
@ -1 +1 @@
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?>
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?>
|
||||
|
@ -1 +1 @@
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')) ?>
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')) ?>
|
||||
|
@ -1 +1 @@
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?> %
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?> %
|
||||
|
@ -1 +1 @@
|
||||
<?php echo $view['form']->block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')) ?>
|
||||
<?php echo $view['form']->block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')) ?>
|
||||
|
@ -1 +1 @@
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')) ?>
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')) ?>
|
||||
|
@ -1 +1 @@
|
||||
<?php echo $view['form']->block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')) ?>
|
||||
<?php echo $view['form']->block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')) ?>
|
||||
|
@ -1 +1 @@
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')) ?>
|
||||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')) ?>
|
||||
|
@ -164,7 +164,6 @@ class Router extends BaseRouter implements WarmableInterface
|
||||
gettype($resolved)
|
||||
)
|
||||
);
|
||||
|
||||
}, $value);
|
||||
|
||||
return str_replace('%%', '%', $escapedValue);
|
||||
|
@ -88,7 +88,6 @@ class RouterMatchCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->will($this->returnValueMap(array(
|
||||
array('router', 1, $router),
|
||||
array('controller_name_converter', 1, $loader),
|
||||
|
||||
)));
|
||||
|
||||
return $container;
|
||||
|
@ -136,7 +136,7 @@ class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->method('extract')
|
||||
->will(
|
||||
$this->returnCallback(function ($path, $catalogue) use ($extractedMessages) {
|
||||
$catalogue->add($extractedMessages);
|
||||
$catalogue->add($extractedMessages);
|
||||
})
|
||||
);
|
||||
|
||||
@ -146,7 +146,7 @@ class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->method('loadMessages')
|
||||
->will(
|
||||
$this->returnCallback(function ($path, $catalogue) use ($loadedMessages) {
|
||||
$catalogue->add($loadedMessages);
|
||||
$catalogue->add($loadedMessages);
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -74,7 +74,7 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->method('extract')
|
||||
->will(
|
||||
$this->returnCallback(function ($path, $catalogue) use ($extractedMessages) {
|
||||
$catalogue->add($extractedMessages);
|
||||
$catalogue->add($extractedMessages);
|
||||
})
|
||||
);
|
||||
|
||||
@ -84,7 +84,7 @@ class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
|
||||
->method('loadMessages')
|
||||
->will(
|
||||
$this->returnCallback(function ($path, $catalogue) use ($loadedMessages) {
|
||||
$catalogue->add($loadedMessages);
|
||||
$catalogue->add($loadedMessages);
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -141,6 +141,7 @@ abstract class AbstractDescriptorTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
abstract protected function getDescriptor();
|
||||
|
||||
abstract protected function getFormat();
|
||||
|
||||
private function assertDescription($expectedDescription, $describedObject, array $options = array())
|
||||
|
@ -191,9 +191,11 @@ class CallableClass
|
||||
public function __invoke()
|
||||
{
|
||||
}
|
||||
|
||||
public static function staticMethod()
|
||||
{
|
||||
}
|
||||
|
||||
public function method()
|
||||
{
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
This template is used for translation message extraction tests
|
||||
<?php echo $view['translator']->trans('single-quoted key') ?>
|
||||
<?php echo $view['translator']->trans('double-quoted key') ?>
|
||||
<?php echo $view['translator']->trans(<<<EOF
|
||||
<?php echo $view['translator']->trans(<<<'EOF'
|
||||
heredoc key
|
||||
EOF
|
||||
) ?>
|
||||
|
@ -81,7 +81,7 @@ class SecurityDataCollector extends DataCollector
|
||||
'authenticated' => $token->isAuthenticated(),
|
||||
'token_class' => get_class($token),
|
||||
'user' => $token->getUsername(),
|
||||
'roles' => array_map(function (RoleInterface $role) { return $role->getRole();}, $assignedRoles),
|
||||
'roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $assignedRoles),
|
||||
'inherited_roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $inheritedRoles),
|
||||
'supports_role_hierarchy' => null !== $this->roleHierarchy,
|
||||
);
|
||||
|
@ -25,7 +25,7 @@ interface SecurityFactoryInterface
|
||||
* Configures the container services required to use the authentication listener.
|
||||
*
|
||||
* @param ContainerBuilder $container
|
||||
* @param string $id The unique id of the firewall
|
||||
* @param string $id The unique id of the firewall
|
||||
* @param array $config The options array for the listener
|
||||
* @param string $userProvider The service id of the user provider
|
||||
* @param string $defaultEntryPoint
|
||||
@ -48,7 +48,7 @@ interface SecurityFactoryInterface
|
||||
/**
|
||||
* Defines the configuration key used to reference the provider
|
||||
* in the firewall configuration.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getKey();
|
||||
|
@ -34,7 +34,6 @@ class PreviewErrorControllerTest extends TestCase
|
||||
->method('handle')
|
||||
->with(
|
||||
$this->callback(function (Request $request) use ($self, $logicalControllerName, $code) {
|
||||
|
||||
$self->assertEquals($logicalControllerName, $request->attributes->get('_controller'));
|
||||
|
||||
$exception = $request->attributes->get('exception');
|
||||
|
@ -34,7 +34,7 @@ class XmlReferenceDumperTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function getConfigurationAsString()
|
||||
{
|
||||
return str_replace("\n", PHP_EOL, <<<EOL
|
||||
return str_replace("\n", PHP_EOL, <<<'EOL'
|
||||
<!-- Namespace: http://example.org/schema/dic/acme_root -->
|
||||
<!-- scalar-required: Required -->
|
||||
<!-- enum-with-default: One of "this"; "that" -->
|
||||
|
@ -112,7 +112,7 @@ TABLE
|
||||
array('ISBN', 'Title', 'Author'),
|
||||
$books,
|
||||
TableHelper::LAYOUT_COMPACT,
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
ISBN Title Author
|
||||
99921-58-10-7 Divine Comedy Dante Alighieri
|
||||
9971-5-0210-0 A Tale of Two Cities Charles Dickens
|
||||
@ -125,7 +125,7 @@ TABLE
|
||||
array('ISBN', 'Title', 'Author'),
|
||||
$books,
|
||||
TableHelper::LAYOUT_BORDERLESS,
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
=============== ========================== ==================
|
||||
ISBN Title Author
|
||||
=============== ========================== ==================
|
||||
|
@ -46,35 +46,35 @@ class ProcessHelperTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function provideCommandsAndOutput()
|
||||
{
|
||||
$successOutputVerbose = <<<EOT
|
||||
$successOutputVerbose = <<<'EOT'
|
||||
RUN php -r "echo 42;"
|
||||
RES Command ran successfully
|
||||
|
||||
EOT;
|
||||
$successOutputDebug = <<<EOT
|
||||
$successOutputDebug = <<<'EOT'
|
||||
RUN php -r "echo 42;"
|
||||
OUT 42
|
||||
RES Command ran successfully
|
||||
|
||||
EOT;
|
||||
$successOutputDebugWithTags = <<<EOT
|
||||
$successOutputDebugWithTags = <<<'EOT'
|
||||
RUN php -r "echo '<info>42</info>';"
|
||||
OUT <info>42</info>
|
||||
RES Command ran successfully
|
||||
|
||||
EOT;
|
||||
$successOutputProcessDebug = <<<EOT
|
||||
$successOutputProcessDebug = <<<'EOT'
|
||||
RUN 'php' '-r' 'echo 42;'
|
||||
OUT 42
|
||||
RES Command ran successfully
|
||||
|
||||
EOT;
|
||||
$syntaxErrorOutputVerbose = <<<EOT
|
||||
$syntaxErrorOutputVerbose = <<<'EOT'
|
||||
RUN php -r "fwrite(STDERR, 'error message');usleep(50000);fwrite(STDOUT, 'out message');exit(252);"
|
||||
RES 252 Command did not run successfully
|
||||
|
||||
EOT;
|
||||
$syntaxErrorOutputDebug = <<<EOT
|
||||
$syntaxErrorOutputDebug = <<<'EOT'
|
||||
RUN php -r "fwrite(STDERR, 'error message');usleep(500000);fwrite(STDOUT, 'out message');exit(252);"
|
||||
ERR error message
|
||||
OUT out message
|
||||
|
@ -273,8 +273,6 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function testSetCurrentBeforeStarting()
|
||||
{
|
||||
$bar = new ProgressBar($this->getOutputStream());
|
||||
@ -588,7 +586,6 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals(
|
||||
|
||||
" \033[44;37m Starting the demo... fingers crossed \033[0m\n".
|
||||
' 0/15 '.$progress.str_repeat($empty, 26)." 0%\n".
|
||||
" \xf0\x9f\x8f\x81 < 1 sec \033[44;37m 0 B \033[0m"
|
||||
|
@ -96,7 +96,7 @@ class TableTest extends \PHPUnit_Framework_TestCase
|
||||
array('ISBN', 'Title', 'Author'),
|
||||
$books,
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---------------+--------------------------+------------------+
|
||||
| ISBN | Title | Author |
|
||||
+---------------+--------------------------+------------------+
|
||||
@ -112,7 +112,7 @@ TABLE
|
||||
array('ISBN', 'Title', 'Author'),
|
||||
$books,
|
||||
'compact',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
ISBN Title Author
|
||||
99921-58-10-7 Divine Comedy Dante Alighieri
|
||||
9971-5-0210-0 A Tale of Two Cities Charles Dickens
|
||||
@ -125,7 +125,7 @@ TABLE
|
||||
array('ISBN', 'Title', 'Author'),
|
||||
$books,
|
||||
'borderless',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
=============== ========================== ==================
|
||||
ISBN Title Author
|
||||
=============== ========================== ==================
|
||||
@ -146,7 +146,7 @@ TABLE
|
||||
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---------------+--------------------------+------------------+
|
||||
| ISBN | Title | |
|
||||
+---------------+--------------------------+------------------+
|
||||
@ -167,7 +167,7 @@ TABLE
|
||||
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---------------+--------------------------+------------------+
|
||||
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
|
||||
| 9971-5-0210-0 | | |
|
||||
@ -186,7 +186,7 @@ TABLE
|
||||
array('960-425-059-0', 'The Lord of the Rings', "J. R. R.\nTolkien"),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---------------+----------------------------+-----------------+
|
||||
| ISBN | Title | Author |
|
||||
+---------------+----------------------------+-----------------+
|
||||
@ -206,7 +206,7 @@ TABLE
|
||||
array('ISBN', 'Title'),
|
||||
array(),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+------+-------+
|
||||
| ISBN | Title |
|
||||
+------+-------+
|
||||
@ -226,7 +226,7 @@ TABLE
|
||||
array('9971-5-0210-0', 'A Tale of Two Cities', '<info>Charles Dickens</>'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---------------+----------------------+-----------------+
|
||||
| ISBN | Title | Author |
|
||||
+---------------+----------------------+-----------------+
|
||||
@ -243,7 +243,7 @@ TABLE
|
||||
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+----------------------------------+----------------------+-----------------+
|
||||
| ISBN | Title | Author |
|
||||
+----------------------------------+----------------------+-----------------+
|
||||
@ -275,7 +275,7 @@ TABLE
|
||||
),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+-------------------------------+-------------------------------+-----------------------------+
|
||||
| ISBN | Title | Author |
|
||||
+-------------------------------+-------------------------------+-----------------------------+
|
||||
@ -308,7 +308,7 @@ TABLE
|
||||
array('80-902734-1-7', 'Test'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---------------+----------------------+-----------------+
|
||||
| ISBN | Title | Author |
|
||||
+---------------+----------------------+-----------------+
|
||||
@ -341,7 +341,7 @@ TABLE
|
||||
array('J. R. R'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+------------------+---------+-----------------+
|
||||
| ISBN | Title | Author |
|
||||
+------------------+---------+-----------------+
|
||||
@ -376,7 +376,7 @@ TABLE
|
||||
),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+-----------------+-------+-----------------+
|
||||
| ISBN | Title | Author |
|
||||
+-----------------+-------+-----------------+
|
||||
@ -413,7 +413,7 @@ TABLE
|
||||
array('Charles Dickens'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+-----------------+-------+-----------------+
|
||||
| ISBN | Title | Author |
|
||||
+-----------------+-------+-----------------+
|
||||
@ -440,7 +440,7 @@ TABLE
|
||||
array('Charles Dickens'),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---------------+-----------------+
|
||||
| ISBN | Author |
|
||||
+---------------+-----------------+
|
||||
@ -458,7 +458,7 @@ TABLE
|
||||
),
|
||||
array(),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+------+-------+--------+
|
||||
| Main title |
|
||||
+------+-------+--------+
|
||||
@ -478,7 +478,7 @@ TABLE
|
||||
),
|
||||
),
|
||||
'default',
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+---+--+--+---+--+---+--+---+--+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
+---+--+--+---+--+---+--+---+--+
|
||||
@ -502,7 +502,7 @@ TABLE
|
||||
$table->render();
|
||||
|
||||
$expected =
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+------+
|
||||
| ■■ |
|
||||
+------+
|
||||
@ -532,7 +532,7 @@ TABLE;
|
||||
$table->render();
|
||||
|
||||
$expected =
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
.......
|
||||
. Foo .
|
||||
.......
|
||||
@ -559,7 +559,7 @@ TABLE;
|
||||
$table->render();
|
||||
|
||||
$expected =
|
||||
<<<TABLE
|
||||
<<<'TABLE'
|
||||
+------+
|
||||
| Foo |
|
||||
+------+
|
||||
|
@ -116,8 +116,6 @@ class Reader
|
||||
$this->position += $length;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function moveToEnd()
|
||||
{
|
||||
$this->position = $this->length;
|
||||
|
@ -1,14 +1,14 @@
|
||||
--TEST--
|
||||
Test symfony_zval_info API
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("symfony_debug")) print "skip"; ?>
|
||||
<?php if (!extension_loaded('symfony_debug')) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$int = 42;
|
||||
$float = 42.42;
|
||||
$str = "foobar";
|
||||
$object = new StdClass;
|
||||
$str = 'foobar';
|
||||
$object = new StdClass();
|
||||
$array = array('foo', 'bar');
|
||||
$resource = tmpfile();
|
||||
$null = null;
|
||||
@ -17,15 +17,17 @@ $bool = true;
|
||||
$anotherint = 42;
|
||||
$refcount2 = &$anotherint;
|
||||
|
||||
$var = array('int' => $int,
|
||||
'float' => $float,
|
||||
'str' => $str,
|
||||
'object' => $object,
|
||||
'array' => $array,
|
||||
'resource' => $resource,
|
||||
'null' => $null,
|
||||
'bool' => $bool,
|
||||
'refcount' => &$refcount2);
|
||||
$var = array(
|
||||
'int' => $int,
|
||||
'float' => $float,
|
||||
'str' => $str,
|
||||
'object' => $object,
|
||||
'array' => $array,
|
||||
'resource' => $resource,
|
||||
'null' => $null,
|
||||
'bool' => $bool,
|
||||
'refcount' => &$refcount2,
|
||||
);
|
||||
|
||||
var_dump(symfony_zval_info('int', $var));
|
||||
var_dump(symfony_zval_info('float', $var));
|
||||
|
@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
Test symfony_debug_backtrace in case of fatal error
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("symfony_debug")) print "skip"; ?>
|
||||
<?php if (!extension_loaded('symfony_debug')) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -18,7 +18,6 @@ function foo()
|
||||
function bt()
|
||||
{
|
||||
print_r(symfony_debug_backtrace());
|
||||
|
||||
}
|
||||
|
||||
register_shutdown_function('bt');
|
||||
|
@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
Test symfony_debug_backtrace in case of non fatal error
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("symfony_debug")) print "skip"; ?>
|
||||
<?php if (!extension_loaded('symfony_debug')) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@ -13,7 +13,6 @@ function bar()
|
||||
function bt()
|
||||
{
|
||||
print_r(symfony_debug_backtrace());
|
||||
|
||||
}
|
||||
|
||||
bar();
|
||||
|
@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
Test ErrorHandler in case of fatal error
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("symfony_debug")) print "skip"; ?>
|
||||
<?php if (!extension_loaded('symfony_debug')) print 'skip'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace Symfony\Component\DependencyInjection\Compiler;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* A pass to automatically process extensions if they implement
|
||||
* A pass to automatically process extensions if they implement
|
||||
* CompilerPassInterface.
|
||||
*
|
||||
* @author Wouter J <wouter@wouterj.nl>
|
||||
|
@ -756,12 +756,11 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$loader = new ClosureLoader($container = new ContainerBuilder());
|
||||
$loader->load(function (ContainerBuilder $container) {
|
||||
$container->set('a', new \BazClass());
|
||||
$definition = new Definition('BazClass');
|
||||
$definition->setLazy(true);
|
||||
$container->setDefinition('a', $definition);
|
||||
}
|
||||
);
|
||||
$container->set('a', new \BazClass());
|
||||
$definition = new Definition('BazClass');
|
||||
$definition->setLazy(true);
|
||||
$container->setDefinition('a', $definition);
|
||||
});
|
||||
|
||||
$container->setResourceTracking(true);
|
||||
|
||||
|
@ -6,7 +6,7 @@ if (is_file($file)) {
|
||||
}
|
||||
|
||||
$phar = new Phar($file, 0, 'ProjectWithXsdExtensionInPhar.phar');
|
||||
$phar->addFromString('ProjectWithXsdExtensionInPhar.php', <<<EOT
|
||||
$phar->addFromString('ProjectWithXsdExtensionInPhar.php', <<<'EOT'
|
||||
<?php
|
||||
|
||||
class ProjectWithXsdExtensionInPhar extends ProjectExtension
|
||||
@ -28,7 +28,7 @@ class ProjectWithXsdExtensionInPhar extends ProjectExtension
|
||||
}
|
||||
EOT
|
||||
);
|
||||
$phar->addFromString('schema/project-1.0.xsd', <<<EOT
|
||||
$phar->addFromString('schema/project-1.0.xsd', <<<'EOT'
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<xsd:schema xmlns="http://www.example.com/schema/projectwithxsdinphar"
|
||||
|
@ -175,7 +175,7 @@ class Crawler extends \SplObjectStorage
|
||||
if (0xF0 <= $m[$i]) {
|
||||
$c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
|
||||
} elseif (0xE0 <= $m[$i]) {
|
||||
$c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
|
||||
$c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
|
||||
} else {
|
||||
$c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
|
||||
}
|
||||
|
@ -188,7 +188,8 @@ class FormTest extends \PHPUnit_Framework_TestCase
|
||||
$form = $this->createForm('<form>'.$form.'</form>');
|
||||
$this->assertEquals(
|
||||
$values,
|
||||
array_map(function ($field) {
|
||||
array_map(
|
||||
function ($field) {
|
||||
$class = get_class($field);
|
||||
|
||||
return array(substr($class, strrpos($class, '\\') + 1), $field->getValue());
|
||||
|
@ -25,7 +25,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
$dispatcher = new EventDispatcher();
|
||||
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
|
||||
|
||||
$tdispatcher->addListener('foo', $listener = function () {; });
|
||||
$tdispatcher->addListener('foo', $listener = function () { });
|
||||
$listeners = $dispatcher->getListeners('foo');
|
||||
$this->assertCount(1, $listeners);
|
||||
$this->assertSame($listener, $listeners[0]);
|
||||
@ -39,7 +39,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
$dispatcher = new EventDispatcher();
|
||||
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
|
||||
|
||||
$tdispatcher->addListener('foo', $listener = function () {; });
|
||||
$tdispatcher->addListener('foo', $listener = function () { });
|
||||
$this->assertSame($dispatcher->getListeners('foo'), $tdispatcher->getListeners('foo'));
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertFalse($dispatcher->hasListeners('foo'));
|
||||
$this->assertFalse($tdispatcher->hasListeners('foo'));
|
||||
|
||||
$tdispatcher->addListener('foo', $listener = function () {; });
|
||||
$tdispatcher->addListener('foo', $listener = function () { });
|
||||
$this->assertTrue($dispatcher->hasListeners('foo'));
|
||||
$this->assertTrue($tdispatcher->hasListeners('foo'));
|
||||
}
|
||||
@ -76,7 +76,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$dispatcher = new EventDispatcher();
|
||||
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
|
||||
$tdispatcher->addListener('foo', $listener = function () {; });
|
||||
$tdispatcher->addListener('foo', $listener = function () { });
|
||||
|
||||
$this->assertEquals(array(), $tdispatcher->getCalledListeners());
|
||||
$this->assertEquals(array('foo.closure' => array('event' => 'foo', 'type' => 'Closure', 'pretty' => 'closure')), $tdispatcher->getNotCalledListeners());
|
||||
@ -107,8 +107,8 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$dispatcher = new EventDispatcher();
|
||||
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger);
|
||||
$tdispatcher->addListener('foo', $listener1 = function () {; });
|
||||
$tdispatcher->addListener('foo', $listener2 = function () {; });
|
||||
$tdispatcher->addListener('foo', $listener1 = function () { });
|
||||
$tdispatcher->addListener('foo', $listener2 = function () { });
|
||||
|
||||
$logger->expects($this->at(0))->method('debug')->with('Notified event "foo" to listener "closure".');
|
||||
$logger->expects($this->at(1))->method('debug')->with('Notified event "foo" to listener "closure".');
|
||||
@ -123,7 +123,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
$dispatcher = new EventDispatcher();
|
||||
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger);
|
||||
$tdispatcher->addListener('foo', $listener1 = function (Event $event) { $event->stopPropagation(); });
|
||||
$tdispatcher->addListener('foo', $listener2 = function () {; });
|
||||
$tdispatcher->addListener('foo', $listener2 = function () { });
|
||||
|
||||
$logger->expects($this->at(0))->method('debug')->with('Notified event "foo" to listener "closure".');
|
||||
$logger->expects($this->at(1))->method('debug')->with('Listener "closure" stopped propagation of the event "foo".');
|
||||
|
@ -20,7 +20,7 @@ class NodeTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$node = new Node(array(new ConstantNode('foo')));
|
||||
|
||||
$this->assertEquals(<<<EOF
|
||||
$this->assertEquals(<<<'EOF'
|
||||
Node(
|
||||
ConstantNode(value: 'foo')
|
||||
)
|
||||
|
@ -77,7 +77,6 @@ class PathFilterIteratorTest extends IteratorTestCase
|
||||
array($inner, array('copy/A'), array(), array('abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')),
|
||||
array($inner, array('copy/A/B'), array(), array('abc.dat.copy', 'ab.dat.copy')),
|
||||
array($inner, array('copy/A/B/C'), array(), array('abc.dat.copy')),
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
{
|
||||
if (!is_callable($mode)) {
|
||||
switch ($mode) {
|
||||
case SortableIterator::SORT_BY_ACCESSED_TIME :
|
||||
case SortableIterator::SORT_BY_ACCESSED_TIME:
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
touch(self::toAbsolute('.git'));
|
||||
} else {
|
||||
@ -41,12 +41,12 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
sleep(1);
|
||||
file_get_contents(self::toAbsolute('.bar'));
|
||||
break;
|
||||
case SortableIterator::SORT_BY_CHANGED_TIME :
|
||||
case SortableIterator::SORT_BY_CHANGED_TIME:
|
||||
file_put_contents(self::toAbsolute('test.php'), 'foo');
|
||||
sleep(1);
|
||||
file_put_contents(self::toAbsolute('test.py'), 'foo');
|
||||
break;
|
||||
case SortableIterator::SORT_BY_MODIFIED_TIME :
|
||||
case SortableIterator::SORT_BY_MODIFIED_TIME:
|
||||
file_put_contents(self::toAbsolute('test.php'), 'foo');
|
||||
sleep(1);
|
||||
file_put_contents(self::toAbsolute('test.py'), 'foo');
|
||||
|
@ -436,7 +436,6 @@ class FormTypeTest extends BaseTypeTest
|
||||
$builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer(
|
||||
function () {},
|
||||
function ($value) { // reverseTransform
|
||||
|
||||
return 'foobar';
|
||||
}
|
||||
));
|
||||
@ -462,7 +461,6 @@ class FormTypeTest extends BaseTypeTest
|
||||
$builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer(
|
||||
function () {},
|
||||
function ($value) use ($ref2) { // reverseTransform
|
||||
|
||||
return $ref2;
|
||||
}
|
||||
));
|
||||
|
@ -641,10 +641,10 @@ class SimpleFormTest extends AbstractFormTest
|
||||
$form = $this->getBuilder()
|
||||
->setEmptyData('foo')
|
||||
->addViewTransformer(new FixedDataTransformer(array(
|
||||
'' => '',
|
||||
// direction is reversed!
|
||||
'bar' => 'foo',
|
||||
)))
|
||||
'' => '',
|
||||
// direction is reversed!
|
||||
'bar' => 'foo',
|
||||
)))
|
||||
->getForm();
|
||||
|
||||
$form->submit('');
|
||||
@ -657,17 +657,17 @@ class SimpleFormTest extends AbstractFormTest
|
||||
$test = $this;
|
||||
$form = $this->getBuilder()
|
||||
->setEmptyData(function ($form) use ($test) {
|
||||
// the form instance is passed to the closure to allow use
|
||||
// of form data when creating the empty value
|
||||
$test->assertInstanceOf('Symfony\Component\Form\FormInterface', $form);
|
||||
// the form instance is passed to the closure to allow use
|
||||
// of form data when creating the empty value
|
||||
$test->assertInstanceOf('Symfony\Component\Form\FormInterface', $form);
|
||||
|
||||
return 'foo';
|
||||
})
|
||||
return 'foo';
|
||||
})
|
||||
->addViewTransformer(new FixedDataTransformer(array(
|
||||
'' => '',
|
||||
// direction is reversed!
|
||||
'bar' => 'foo',
|
||||
)))
|
||||
'' => '',
|
||||
// direction is reversed!
|
||||
'bar' => 'foo',
|
||||
)))
|
||||
->getForm();
|
||||
|
||||
$form->submit('');
|
||||
|
@ -1090,7 +1090,6 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
array('put'),
|
||||
array('delete'),
|
||||
array('patch'),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
|
||||
private function notImplemented(array $dataSets)
|
||||
{
|
||||
return array_map(function ($row) {
|
||||
return array($row[0], $row[1], 0);
|
||||
}, $dataSets);
|
||||
return array($row[0], $row[1], 0);
|
||||
}, $dataSets);
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
||||
public function testContext()
|
||||
{
|
||||
$array = array('person' => array('name' => 'George Abitbol'));
|
||||
$expected = <<<XML
|
||||
$expected = <<<'XML'
|
||||
<?xml version="1.0"?>
|
||||
<response>
|
||||
<person>
|
||||
@ -255,7 +255,7 @@ XML;
|
||||
$serializer = new Serializer(array(new CustomNormalizer()), array('xml' => new XmlEncoder()));
|
||||
$this->encoder->setSerializer($serializer);
|
||||
|
||||
$expected = <<<XML
|
||||
$expected = <<<'XML'
|
||||
<?xml version="1.0"?>
|
||||
<response><foo>normalizedFoo</foo><bar>normalizedBar</bar></response>
|
||||
|
||||
@ -366,7 +366,7 @@ XML;
|
||||
|
||||
public function testDecodeIgnoreWhiteSpace()
|
||||
{
|
||||
$source = <<<XML
|
||||
$source = <<<'XML'
|
||||
<?xml version="1.0"?>
|
||||
<people>
|
||||
<person>
|
||||
|
@ -343,8 +343,8 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
array(
|
||||
'bar' => function ($bar) {
|
||||
return 'baz';
|
||||
},
|
||||
return 'baz';
|
||||
},
|
||||
),
|
||||
'baz',
|
||||
array('foo' => '', 'bar' => 'baz', 'baz' => true),
|
||||
@ -353,8 +353,8 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
array(
|
||||
'bar' => function ($bar) {
|
||||
return;
|
||||
},
|
||||
return;
|
||||
},
|
||||
),
|
||||
'baz',
|
||||
array('foo' => '', 'bar' => null, 'baz' => true),
|
||||
@ -363,8 +363,8 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
array(
|
||||
'bar' => function ($bar) {
|
||||
return $bar->format('d-m-Y H:i:s');
|
||||
},
|
||||
return $bar->format('d-m-Y H:i:s');
|
||||
},
|
||||
),
|
||||
new \DateTime('2011-09-10 06:30:00'),
|
||||
array('foo' => '', 'bar' => '10-09-2011 06:30:00', 'baz' => true),
|
||||
@ -373,13 +373,13 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
array(
|
||||
'bar' => function ($bars) {
|
||||
$foos = '';
|
||||
foreach ($bars as $bar) {
|
||||
$foos .= $bar->getFoo();
|
||||
}
|
||||
$foos = '';
|
||||
foreach ($bars as $bar) {
|
||||
$foos .= $bar->getFoo();
|
||||
}
|
||||
|
||||
return $foos;
|
||||
},
|
||||
return $foos;
|
||||
},
|
||||
),
|
||||
array(new ObjectConstructorDummy('baz', '', false), new ObjectConstructorDummy('quux', '', false)),
|
||||
array('foo' => '', 'bar' => 'bazquux', 'baz' => true),
|
||||
@ -388,8 +388,8 @@ class ObjectNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
array(
|
||||
'bar' => function ($bars) {
|
||||
return count($bars);
|
||||
},
|
||||
return count($bars);
|
||||
},
|
||||
),
|
||||
array(new ObjectConstructorDummy('baz', '', false), new ObjectConstructorDummy('quux', '', false)),
|
||||
array('foo' => '', 'bar' => 2, 'baz' => true),
|
||||
|
@ -34,7 +34,7 @@ class IcuResFileDumper extends FileDumper
|
||||
|
||||
foreach ($messages->all($domain) as $source => $target) {
|
||||
$indexes .= pack('v', strlen($data) + 28);
|
||||
$data .= $source."\0";
|
||||
$data .= $source."\0";
|
||||
}
|
||||
|
||||
$data .= $this->writePadding($data);
|
||||
|
@ -376,9 +376,9 @@ EOF
|
||||
$fallbackSuffix = ucfirst(preg_replace($replacementPattern, '_', $fallback));
|
||||
$currentSuffix = ucfirst(preg_replace($replacementPattern, '_', $current));
|
||||
|
||||
$fallbackContent .= sprintf(<<<EOF
|
||||
\$catalogue%s = new MessageCatalogue('%s', %s);
|
||||
\$catalogue%s->addFallbackCatalogue(\$catalogue%s);
|
||||
$fallbackContent .= sprintf(<<<'EOF'
|
||||
$catalogue%s = new MessageCatalogue('%s', %s);
|
||||
$catalogue%s->addFallbackCatalogue($catalogue%s);
|
||||
|
||||
EOF
|
||||
,
|
||||
|
@ -119,7 +119,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface
|
||||
* (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped
|
||||
* in double quotes ("). Objects, arrays and resources are formatted as
|
||||
* "object", "array" and "resource". If the $format bitmask contains
|
||||
* the PRETTY_DATE bit, then {@link \DateTime} objects will be formatted
|
||||
* the PRETTY_DATE bit, then {@link \DateTime} objects will be formatted
|
||||
* as RFC-3339 dates ("Y-m-d H:i:s").
|
||||
*
|
||||
* Be careful when passing message parameters to a constraint violation
|
||||
|
@ -144,14 +144,14 @@ class IsbnValidator extends ConstraintValidator
|
||||
// If we test the length before the loop, we get an ERROR_TOO_SHORT
|
||||
// when actually an ERROR_INVALID_CHARACTERS is wanted, e.g. for
|
||||
// "0-45122_5244" (typo)
|
||||
if (!isset($isbn{$i})) {
|
||||
if (!isset($isbn[$i])) {
|
||||
return Isbn::TOO_SHORT_ERROR;
|
||||
}
|
||||
|
||||
if ('X' === $isbn{$i}) {
|
||||
if ('X' === $isbn[$i]) {
|
||||
$digit = 10;
|
||||
} elseif (ctype_digit($isbn{$i})) {
|
||||
$digit = $isbn{$i};
|
||||
} elseif (ctype_digit($isbn[$i])) {
|
||||
$digit = $isbn[$i];
|
||||
} else {
|
||||
return Isbn::INVALID_CHARACTERS_ERROR;
|
||||
}
|
||||
@ -159,7 +159,7 @@ class IsbnValidator extends ConstraintValidator
|
||||
$checkSum += $digit * (10 - $i);
|
||||
}
|
||||
|
||||
if (isset($isbn{$i})) {
|
||||
if (isset($isbn[$i])) {
|
||||
return Isbn::TOO_LONG_ERROR;
|
||||
}
|
||||
|
||||
@ -190,11 +190,11 @@ class IsbnValidator extends ConstraintValidator
|
||||
$checkSum = 0;
|
||||
|
||||
for ($i = 0; $i < 13; $i += 2) {
|
||||
$checkSum += $isbn{$i};
|
||||
$checkSum += $isbn[$i];
|
||||
}
|
||||
|
||||
for ($i = 1; $i < 12; $i += 2) {
|
||||
$checkSum += $isbn{$i}
|
||||
$checkSum += $isbn[$i]
|
||||
* 3;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ class IssnValidator extends ConstraintValidator
|
||||
|
||||
// 1234-567X
|
||||
// ^
|
||||
if (isset($canonical{4}) && '-' === $canonical{4}) {
|
||||
if (isset($canonical[4]) && '-' === $canonical[4]) {
|
||||
// remove hyphen
|
||||
$canonical = substr($canonical, 0, 4).substr($canonical, 5);
|
||||
} elseif ($constraint->requireHyphen) {
|
||||
@ -121,7 +121,7 @@ class IssnValidator extends ConstraintValidator
|
||||
|
||||
// 1234567X
|
||||
// ^ digit, x or X
|
||||
if (!ctype_digit($canonical{7}) && 'x' !== $canonical{7} && 'X' !== $canonical{7}) {
|
||||
if (!ctype_digit($canonical[7]) && 'x' !== $canonical[7] && 'X' !== $canonical[7]) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -139,7 +139,7 @@ class IssnValidator extends ConstraintValidator
|
||||
|
||||
// 1234567X
|
||||
// ^ case-sensitive?
|
||||
if ($constraint->caseSensitive && 'x' === $canonical{7}) {
|
||||
if ($constraint->caseSensitive && 'x' === $canonical[7]) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -156,14 +156,14 @@ class IssnValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
// Calculate a checksum. "X" equals 10.
|
||||
$checkSum = 'X' === $canonical{7}
|
||||
|| 'x' === $canonical{7}
|
||||
$checkSum = 'X' === $canonical[7]
|
||||
|| 'x' === $canonical[7]
|
||||
? 10
|
||||
: $canonical{7};
|
||||
: $canonical[7];
|
||||
|
||||
for ($i = 0; $i < 7; ++$i) {
|
||||
// Multiply the first digit by 8, the second by 7, etc.
|
||||
$checkSum += (8 - $i) * $canonical{$i};
|
||||
$checkSum += (8 - $i) * $canonical[$i];
|
||||
}
|
||||
|
||||
if (0 !== $checkSum % 11) {
|
||||
|
@ -81,7 +81,7 @@ class LuhnValidator extends ConstraintValidator
|
||||
// ^ ^ ^ ^ ^ ^
|
||||
// = 7 + 9 + 7 + 9 + 7 + 3
|
||||
for ($i = $length - 1; $i >= 0; $i -= 2) {
|
||||
$checkSum += $value{$i};
|
||||
$checkSum += $value[$i];
|
||||
}
|
||||
|
||||
// Starting with the second last digit and walking left, double every
|
||||
@ -91,7 +91,7 @@ class LuhnValidator extends ConstraintValidator
|
||||
// ^ ^ ^ ^ ^
|
||||
// = 1+8 + 4 + 6 + 1+6 + 2
|
||||
for ($i = $length - 2; $i >= 0; $i -= 2) {
|
||||
$checkSum += array_sum(str_split($value{$i} * 2));
|
||||
$checkSum += array_sum(str_split($value[$i] * 2));
|
||||
}
|
||||
|
||||
if (0 === $checkSum || 0 !== $checkSum % 10) {
|
||||
|
@ -118,7 +118,7 @@ class UuidValidator extends ConstraintValidator
|
||||
|
||||
for ($i = 0; $i < $l; ++$i) {
|
||||
// Check length
|
||||
if (!isset($trimmed{$i})) {
|
||||
if (!isset($trimmed[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -137,7 +137,7 @@ class UuidValidator extends ConstraintValidator
|
||||
// Hyphens must occur every fifth position
|
||||
// xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx
|
||||
// ^ ^ ^ ^ ^ ^ ^
|
||||
if ('-' === $trimmed{$i}) {
|
||||
if ('-' === $trimmed[$i]) {
|
||||
if ($i !== $h) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
@ -166,7 +166,7 @@ class UuidValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
// Check characters
|
||||
if (!ctype_xdigit($trimmed{$i})) {
|
||||
if (!ctype_xdigit($trimmed[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -184,7 +184,7 @@ class UuidValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
// Check length again
|
||||
if (isset($trimmed{$i})) {
|
||||
if (isset($trimmed[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -213,7 +213,7 @@ class UuidValidator extends ConstraintValidator
|
||||
|
||||
for ($i = 0; $i < self::STRICT_LENGTH; ++$i) {
|
||||
// Check length
|
||||
if (!isset($value{$i})) {
|
||||
if (!isset($value[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -232,7 +232,7 @@ class UuidValidator extends ConstraintValidator
|
||||
// Check hyphen placement
|
||||
// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
// ^ ^ ^ ^
|
||||
if ('-' === $value{$i}) {
|
||||
if ('-' === $value[$i]) {
|
||||
if ($i !== $h) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
@ -259,7 +259,7 @@ class UuidValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
// Check characters
|
||||
if (!ctype_xdigit($value{$i})) {
|
||||
if (!ctype_xdigit($value[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -294,7 +294,7 @@ class UuidValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
// Check length again
|
||||
if (isset($value{$i})) {
|
||||
if (isset($value[$i])) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -309,7 +309,7 @@ class UuidValidator extends ConstraintValidator
|
||||
}
|
||||
|
||||
// Check version
|
||||
if (!in_array($value{self::STRICT_VERSION_POSITION}, $constraint->versions)) {
|
||||
if (!in_array($value[self::STRICT_VERSION_POSITION], $constraint->versions)) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
@ -327,7 +327,7 @@ class UuidValidator extends ConstraintValidator
|
||||
// 0b10xx
|
||||
// & 0b1100 (12)
|
||||
// = 0b1000 (8)
|
||||
if ((hexdec($value{self::STRICT_VARIANT_POSITION}) & 12) !== 8) {
|
||||
if ((hexdec($value[self::STRICT_VARIANT_POSITION]) & 12) !== 8) {
|
||||
if ($this->context instanceof ExecutionContextInterface) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($value))
|
||||
|
@ -185,7 +185,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
// BC with Symfony < 2.4
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
@ -201,7 +200,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
// BC with Symfony < 2.4
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
@ -217,7 +215,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
// BC with Symfony < 2.4
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
@ -235,7 +232,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
// BC with Symfony < 2.4
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
@ -255,7 +251,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
// BC with Symfony < 2.4
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
@ -273,7 +268,6 @@ class CallbackValidatorTest extends AbstractConstraintValidatorTest
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
// BC with Symfony < 2.4
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
|
@ -37,7 +37,7 @@ class PropertyPath
|
||||
public static function append($basePath, $subPath)
|
||||
{
|
||||
if ('' !== (string) $subPath) {
|
||||
if ('[' === $subPath{0}) {
|
||||
if ('[' === $subPath[0]) {
|
||||
return $basePath.$subPath;
|
||||
}
|
||||
|
||||
|
@ -314,6 +314,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
|
||||
|
||||
return array($groups);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates an object against the constraints defined for its class.
|
||||
*
|
||||
|
@ -59,7 +59,7 @@ class CliDumper extends AbstractDumper
|
||||
parent::__construct($output, $charset);
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR && 'ON' !== @getenv('ConEmuANSI') && 'xterm' !== @getenv('TERM')) {
|
||||
// Use only the base 16 xterm colors when using ANSICON or standard Windows 10 CLI
|
||||
// Use only the base 16 xterm colors when using ANSICON or standard Windows 10 CLI
|
||||
$this->setStyles(array(
|
||||
'default' => '31',
|
||||
'num' => '1;34',
|
||||
|
@ -441,7 +441,7 @@ EOHTML;
|
||||
if (0xF0 <= $m[$i]) {
|
||||
$c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
|
||||
} elseif (0xE0 <= $m[$i]) {
|
||||
$c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
|
||||
$c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
|
||||
} else {
|
||||
$c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ EOTXT
|
||||
$var = xml_parser_create();
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<EOTXT
|
||||
<<<'EOTXT'
|
||||
xml resource {
|
||||
current_byte_index: %i
|
||||
current_column_number: %i
|
||||
@ -142,7 +142,7 @@ EOTXT
|
||||
$var[''] = 2;
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<EOTXT
|
||||
<<<'EOTXT'
|
||||
array:4 [
|
||||
"0" => {}
|
||||
"1" => &1 null
|
||||
@ -161,7 +161,7 @@ EOTXT
|
||||
$var->{1} = 2;
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<EOTXT
|
||||
<<<'EOTXT'
|
||||
{
|
||||
+1: 1
|
||||
+"1": 2
|
||||
@ -296,7 +296,7 @@ EOTXT
|
||||
$var = $this->getSpecialVars();
|
||||
|
||||
$this->assertDumpEquals(
|
||||
<<<EOTXT
|
||||
<<<'EOTXT'
|
||||
array:3 [
|
||||
0 => array:1 [
|
||||
0 => &1 array:1 [
|
||||
@ -342,7 +342,7 @@ EOTXT
|
||||
$dumper->dump($data);
|
||||
|
||||
$this->assertSame(
|
||||
<<<EOTXT
|
||||
<<<'EOTXT'
|
||||
array:2 [
|
||||
1 => array:1 [
|
||||
"GLOBALS" => &1 array:1 [
|
||||
@ -384,7 +384,7 @@ EOTXT
|
||||
});
|
||||
|
||||
$this->assertSame(
|
||||
<<<EOTXT
|
||||
<<<'EOTXT'
|
||||
array:1 [
|
||||
0 => array:1 [
|
||||
0 => array:1 [
|
||||
|
@ -135,7 +135,7 @@ EOTXT
|
||||
$out = stream_get_contents($out, -1, 0);
|
||||
|
||||
$this->assertStringMatchesFormat(
|
||||
<<<EOTXT
|
||||
<<<'EOTXT'
|
||||
<foo></foo><bar>b"<span class=sf-dump-str title="7 binary or non-UTF-8 characters">Словарь</span>"
|
||||
</bar>
|
||||
|
||||
|
@ -444,7 +444,7 @@ EOF;
|
||||
|
||||
public function testObjectForMapEnabledWithMapping()
|
||||
{
|
||||
$yaml = <<<EOF
|
||||
$yaml = <<<'EOF'
|
||||
foo:
|
||||
fiz: [cat]
|
||||
EOF;
|
||||
@ -581,7 +581,7 @@ EOF
|
||||
|
||||
public function testSequenceInMappingStartedBySingleDashLine()
|
||||
{
|
||||
$yaml = <<<EOT
|
||||
$yaml = <<<'EOT'
|
||||
a:
|
||||
-
|
||||
b:
|
||||
@ -609,7 +609,7 @@ EOT;
|
||||
|
||||
public function testSequenceFollowedByCommentEmbeddedInMapping()
|
||||
{
|
||||
$yaml = <<<EOT
|
||||
$yaml = <<<'EOT'
|
||||
a:
|
||||
b:
|
||||
- c
|
||||
@ -645,7 +645,7 @@ EOF
|
||||
*/
|
||||
public function testScalarInSequence()
|
||||
{
|
||||
Yaml::parse(<<<EOF
|
||||
Yaml::parse(<<<'EOF'
|
||||
foo:
|
||||
- bar
|
||||
"missing colon"
|
||||
@ -666,7 +666,7 @@ EOF
|
||||
*/
|
||||
public function testMappingDuplicateKeyBlock()
|
||||
{
|
||||
$input = <<<EOD
|
||||
$input = <<<'EOD'
|
||||
parent:
|
||||
child: first
|
||||
child: duplicate
|
||||
@ -684,7 +684,7 @@ EOD;
|
||||
|
||||
public function testMappingDuplicateKeyFlow()
|
||||
{
|
||||
$input = <<<EOD
|
||||
$input = <<<'EOD'
|
||||
parent: { child: first, child: duplicate }
|
||||
parent: { child: duplicate, child: duplicate }
|
||||
EOD;
|
||||
@ -968,7 +968,7 @@ EOT
|
||||
);
|
||||
$tests[] = array($yaml, $expected);
|
||||
|
||||
$yaml = <<<EOT
|
||||
$yaml = <<<'EOT'
|
||||
foo:
|
||||
bar:
|
||||
scalar-block: >
|
||||
@ -1011,7 +1011,7 @@ EOT;
|
||||
|
||||
public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks()
|
||||
{
|
||||
$yaml = <<<EOT
|
||||
$yaml = <<<'EOT'
|
||||
test: >
|
||||
<h2>A heading</h2>
|
||||
|
||||
@ -1023,7 +1023,7 @@ EOT;
|
||||
|
||||
$this->assertSame(
|
||||
array(
|
||||
'test' => <<<EOT
|
||||
'test' => <<<'EOT'
|
||||
<h2>A heading</h2>
|
||||
<ul> <li>a list</li> <li>may be a good example</li> </ul>
|
||||
EOT
|
||||
@ -1035,7 +1035,7 @@ EOT
|
||||
|
||||
public function testAdditionallyIndentedLinesAreParsedAsNewLinesInFoldedBlocks()
|
||||
{
|
||||
$yaml = <<<EOT
|
||||
$yaml = <<<'EOT'
|
||||
test: >
|
||||
<h2>A heading</h2>
|
||||
|
||||
@ -1047,7 +1047,7 @@ EOT;
|
||||
|
||||
$this->assertSame(
|
||||
array(
|
||||
'test' => <<<EOT
|
||||
'test' => <<<'EOT'
|
||||
<h2>A heading</h2>
|
||||
<ul>
|
||||
<li>a list</li>
|
||||
@ -1080,7 +1080,7 @@ EOT
|
||||
return array(
|
||||
array(
|
||||
4,
|
||||
<<<YAML
|
||||
<<<'YAML'
|
||||
foo:
|
||||
-
|
||||
# bar
|
||||
@ -1089,7 +1089,7 @@ YAML
|
||||
),
|
||||
array(
|
||||
5,
|
||||
<<<YAML
|
||||
<<<'YAML'
|
||||
foo:
|
||||
-
|
||||
# bar
|
||||
@ -1099,7 +1099,7 @@ YAML
|
||||
),
|
||||
array(
|
||||
8,
|
||||
<<<YAML
|
||||
<<<'YAML'
|
||||
foo:
|
||||
-
|
||||
# foobar
|
||||
@ -1112,7 +1112,7 @@ YAML
|
||||
),
|
||||
array(
|
||||
10,
|
||||
<<<YAML
|
||||
<<<'YAML'
|
||||
foo:
|
||||
-
|
||||
# foobar
|
||||
|
@ -73,7 +73,7 @@ class Unescaper
|
||||
*/
|
||||
public function unescapeCharacter($value)
|
||||
{
|
||||
switch ($value{1}) {
|
||||
switch ($value[1]) {
|
||||
case '0':
|
||||
return "\x0";
|
||||
case 'a':
|
||||
|
Reference in New Issue
Block a user