8000 Merge branch '4.0' · symfony/symfony@96e53f8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 96e53f8

Browse files
Merge branch '4.0'
* 4.0: PHP CS Fixer: clean up repo and adjust config use interface_exists instead of class_exists [DX] [DI] Improve exception for invalid setter injection arguments Dumper shouldn't use html format for phpdbg [Validator] Fix access to root object when using composite constraint
2 parents f4b56b3 + dde7381 commit 96e53f8

File tree

21 files changed

+61
-25
lines changed

21 files changed

+61
-25
lines changed

.php_cs.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,9 @@ return PhpCsFixer\Config::create()
3636
->notPath('Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php')
3737
// explicit heredoc test
3838
->notPath('Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php')
39+
// explicit trigger_error tests
40+
->notPath('Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt')
41+
->notPath('Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt')
42+
->notPath('Symfony/Component/Debug/Tests/DebugClassLoaderTest.php')
3943
)
4044
;

src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,35 @@ public function getTransTests()
8888
array('{% trans into "fr"%}Hello{% endtrans %}', 'Hello'),
8989

9090
// transchoice
91-
array('{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
92-
'There is no apples', array('count' => 0)),
93-
array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
94-
'There is 5 apples', array('count' => 5)),
95-
array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}',
96-
'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony')),
97-
array('{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}',
98-
'There is 5 apples (Symfony)', array('count' => 5)),
99-
array('{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
100-
'There is no apples', array('count' => 0)),
101-
array('{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
102-
'There is 5 apples'),
91+
array(
92+
'{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
93+
'There is no apples',
94+
array('count' => 0),
95+
),
96+
array(
97+
'{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
98+
'There is 5 apples',
99+
array('count' => 5),
100+
),
101+
array(
102+
'{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}',
103+
'There is 5 apples (Symfony)',
104+
array('count' => 5, 'name' => 'Symfony'),
105+
),
106+
array(
107+
'{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}',
108+
'There is 5 apples (Symfony)',
109+
array('count' => 5),
110+
),
111+
array(
112+
'{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
113+
'There is no apples',
114+
array('count' => 0),
115+
),
116+
array(
117+
'{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
118+
'There is 5 apples',
119+
),
103120

104121
// trans filter
105122
array('{{ "Hello"|trans }}', 'Hello'),

src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class Translator extends BaseTranslator implements WarmableInterface
4747
private $resources = array();
4848

4949
/**
50+
* Constructor.
51+
*
5052
* Available options:
5153
*
5254
* * cache_dir: The cache directory (or null to disable caching)

src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function isEnabled()
3939
}
4040

4141
// based on a symfony/symfony package, it crashes due a missing FormatterInterface from monolog/monolog
42-
if (!class_exists(FormatterInterface::class)) {
42+
if (!interface_exists(FormatterInterface::class)) {
4343
return false;
4444
}
4545

src/Symfony/Component/Cache/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016-present Fabien Potencier
1+
Copyright (c) 2016-2018 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

src/Symfony/Component/Debug/Tests/phpt/exception_rethrown.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ ErrorHandler::register()->setDefaultLogger(new TestLogger());
2626
ini_set('display_errors', 1);
2727

2828
throw new \Exception('foo');
29-
3029
?>
3130
--EXPECTF--
3231
Uncaught Exception: foo

src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ var_dump(array(
2424
$eHandler[0]->setExceptionHandler('print_r');
2525

2626
if (true) {
27-
class Broken implements \Serializable {};
27+
class Broken implements \Serializable
28+
{
29+
}
2830
}
2931

3032
?>

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,9 @@ private function parseDefinition($id, $service, $file, array $defaults)
454454
$args = isset($call[1]) ? $this->resolveServices($call[1], $file) : array();
455455
}
456456

457+
if (!is_array($args)) {
458+
throw new InvalidArgumentException(sprintf('The second parameter for function call "%s" must be an array of its arguments for service "%s" in %s. Check your YAML syntax.', $method, $id, $file));
459+
}
457460
$definition->addMethodCall($method, $args);
458461
}
459462
}

src/Symfony/Component/Dotenv/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016-present Fabien Potencier
1+
Copyright (c) 2016-2018 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class MemcachedSessionHandler extends AbstractSessionHandler
3434
private $prefix;
3535

3636
/**
37+
* Constructor.
38+
*
3739
* List of available options:
3840
* * prefix: The prefix to use for the memcached keys in order to avoid collision
3941
* * expiretime: The time to live in seconds.

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class MongoDbSessionHandler extends AbstractSessionHandler
3434
private $options;
3535

3636
/**
37+
* Constructor.
38+
*
3739
* List of available options:
3840
* * database: The name of the database [required]
3941
* * collection: The name of the collection [required]

src/Symfony/Component/HttpKernel/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
* @author Fabien Potencier <fabien@symfony.com>
2727
*
28-
* @method Request|null getRequest() A Request instance
28+
* @method Request|null getRequest() A Request instance
2929
* @method Response|null getResponse() A Response instance
3030
*/
3131
class Client extends BaseClient

src/Symfony/Component/Inflector/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2012-present Fabien Potencier
1+
Copyright (c) 2012-2018 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

src/Symfony/Component/Lock/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016-present Fabien Potencier
1+
Copyright (c) 2016-2018 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

src/Symfony/Component/PropertyInfo/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2015-present Fabien Potencier
1+
Copyright (c) 2015-2018 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

src/Symfony/Component/Routing/Route.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class Route implements \Serializable
3434
private $compiled;
3535

3636
/**
37+
* Constructor.
38+
*
3739
* Available options:
3840
*
3941
* * compiler_class: A class name able to compile this route instance (RouteCompiler by default)

src/Symfony/Component/Security/Guard/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2004-present Fabien Potencier
1+
Copyright (c) 2004-2018 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Validator\Constraints\Callback;
1515
use Symfony\Component\Validator\Constraints\Collection;
16+
use Symfony\Component\Validator\Constraints\Expression;
1617
use Symfony\Component\Validator\Constraints\GroupSequence;
1718
use Symfony\Component\Validator\Constraints\NotBlank;
1819
use Symfony\Component\Validator\Constraints\NotNull;
@@ -581,6 +582,7 @@ public function testAccessCurrentObject()
581582
$called = false;
582583
$entity = new Entity();
583584
$entity->firstName = 'Bernhard';
585+
$entity->data = array('firstName' => 'Bernhard');
584586

585587
$callback = function ($value, ExecutionContextInterface $context) use ($entity, &$called) {
586588
$called = true;
@@ -589,6 +591,7 @@ public function testAccessCurrentObject()
589591

590592
$this->metadata->addConstraint(new Callback($callback));
591593
$this->metadata->addPropertyConstraint('firstName', new Callback($callback));
594+
$this->metadata->addPropertyConstraint('data', new Collection(array('firstName' => new Expression('value == this.firstName'))));
592595

593596
$this->validator->validate($entity);
594597

src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function validate($value, $constraints = null, $groups = null)
108108

109109
$this->validateGenericNode(
110110
$value,
111-
null,
111+
$previousObject,
112112
is_object($value) ? spl_object_hash($value) : null,
113113
$metadata,
114114
$this->defaultPropertyPath,

src/Symfony/Component/VarDumper/VarDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static function dump($var)
2929
{
3030
if (null === self::$handler) {
3131
$cloner = new VarCloner();
32-
$dumper = 'cli' === PHP_SAPI ? new CliDumper() : new HtmlDumper();
32+
$dumper = in_array(PHP_SAPI, array('cli', 'phpdbg')) ? new CliDumper() : new HtmlDumper();
3333
self::$handler = function ($var) use ($cloner, $dumper) {
3434
$dumper->dump($cloner->cloneVar($var));
3535
};

src/Symfony/Component/Workflow/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2014-present Fabien Potencier
1+
Copyright (c) 2014-2018 Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)
0