Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 346eacd

Browse files
committed
Merge branch '2.8' into 3.2
* 2.8: Revamped the README file Fix missing namespace in AddConstraintValidatorPassTest [ExpressionLanguage] Registering functions after calling evaluate(), compile() or parse() is not supported
2 parents a7db2bb + de95fd5 commit 346eacd

File tree

4 files changed

+124
-44
lines changed

4 files changed

+124
-44
lines changed

README.md

Lines changed: 61 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,74 @@
1-
README
2-
======
1+
<p align="center"><a href="https://symfony.com" target="_blank">
2+
<img src="https://symfony.com/logos/symfony_black_02.svg">
3+
</a></p>
34

4-
What is Symfony?
5-
-----------------
6-
7-
Symfony is a PHP full-stack web framework. It is written with speed and
8-
flexibility in mind. It allows developers to build better and easy to maintain
9-
websites with PHP.
10-
11-
Symfony can be used to develop all kind of websites, from your personal blog
12-
to high traffic ones like Dailymotion or Yahoo! Answers.
5+
[Symfony][1] is a **PHP framework** for web applications and a set of reusable
6+
**PHP components**. Symfony is used by thousands of web applications (including
7+
BlaBlaCar.com and Spotify.com) and most of the [popular PHP projects][2] (including
8+
Drupal and Magento).
139

1410
Installation
1511
------------
1612

17-
The best way to install Symfony is to use the [official Symfony Installer][7].
18-
It allows you to start a new project based on the version you want.
13+
* [Install Symfony][4] with Composer or with our own installer (see
14+
[requirements details][3]).
15+
* Symfony follows the [semantic versioning][5] strictly, publishes "Long Term
16+
Support" (LTS) versions and has a [release process][6] that is predictable and
17+
business-friendly.
1918

2019
Documentation
2120
-------------
2221

23-
The "[Quick Tour][1]" tutorial gives you a first feeling of the framework. If,
24-
like us, you think that Symfony can help speed up your development and take
25-
the quality of your work to the next level, read the official
26-
[Symfony documentation][2].
22+
* Read the [Getting Started guide][7] if you are new to Symfony.
23+
* Try the [Symfony Demo application][23] to learn Symfony in practice.
24+
* Master Symfony with the [Guides and Tutorials][8], the [Components docs][9]
25+
and the [Best Practices][10] reference.
26+
27+
Community
28+
---------
29+
30+
* [Join the Symfony Community][11] and meet other members at the [Symfony events][12].
31+
* [Get Symfony support][13] on StackOverflow, Slack, IRC, etc.
32+
* Follow us on [GitHub][14], [Twitter][15] and [Facebook][16].
2733

2834
Contributing
2935
------------
3036

31-
Symfony is an open source, community-driven project. If you'd like to contribute,
32-
please read the [Contributing Code][3] part of the documentation. If you're submitting
33-
a pull request, please follow the guidelines in the [Submitting a Patch][4] section
34-
and use [Pull Request Template][5].
35-
36-
Community Reviews
37-
-----------------
38-
39-
If you don't feel ready to contribute code or patches, reviewing issues and pull
40-
requests can be a great start to get involved and give back. In fact, people who
41-
"triage" issues are the backbone to Symfony's success!
42-
More information can be found in the [Community Reviews][8] guide.
43-
44-
Running Symfony Tests
45-
----------------------
46-
47-
Information on how to run the Symfony test suite can be found in the
48-
[Running Symfony Tests][6] section.
49-
50-
[1]: https://symfony.com/doc/current/quick_tour/index.html
51-
[2]: https://symfony.com/doc/current/
52-
[3]: https://symfony.com/doc/current/contributing/code/index.html
53-
[4]: https://symfony.com/doc/current/contributing/code/patches.html#check-list
54-
[5]: https://symfony.com/doc/current/contributing/code/patches.html#make-a-pull-request
55-
[6]: https://symfony.com/doc/master/contributing/code/tests.html
56-
[7]: https://symfony.com/doc/current/book/installation.html#installing-the-symfony-installer
57-
[8]: https://symfony.com/doc/current/contributing/community/reviews.html
37+
Symfony is an Open Source, community-driven project with thousands of
38+
[contributors][19]. Join them [contributing code][17] or [contributing documentation][18].
39+
40+
Security Issues
41+
---------------
42+
43+
If you discover a security vulnerability within Symfony, please follow our
44+
[disclosure procedure][20].
45+
46+
About Us
47+
--------
48+
49+
Symfony development is sponsored by [SensioLabs][21], lead by the
50+
[Symfony Core Team][22] and supported by [Symfony contributors][19].
51+
52+
[1]: https://symfony.com
53+
[2]: https://symfony.com/projects
54+
[3]: https://symfony.com/doc/current/reference/requirements.html
55+
[4]: https://symfony.com/doc/current/setup.html
56+
[5]: http://semver.org
57+
[6]: https://symfony.com/doc/current/contributing/community/releases.html
58+
[7]: https://symfony.com/doc/current/page_creation.html
59+
[8]: https://symfony.com/doc/current/index.html
60+
[9]: https://symfony.com/doc/current/components/index.html
61+
[10]: https://symfony.com/doc/current/best_practices/index.html
62+
[11]: https://symfony.com/community
63+
[12]: https://symfony.com/events/
64+
[13]: https://symfony.com/support
65+
[14]: https://github.com/symfony
66+
[15]: https://twitter.com/symfony
67+
[16]: https://www.facebook.com/SymfonyFramework/
68+
[17]: https://symfony.com/doc/current/contributing/code/index.html
69+
[18]: https://symfony.com/doc/current/contributing/documentation/index.html
70+
[19]: https://symfony.com/contributors
71+
[20]: https://symfony.com/security
72+
[21]: https://sensiolabs.com
73+
[22]: https://symfony.com/doc/current/contributing/code/core_team.html
74+
[23]: https://github.com/symfony/symfony-demo

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/AddConstraintValidatorsPassTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* file that was distributed with this source code.
1010
*/
1111

12+
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
13+
1214
use PHPUnit\Framework\TestCase;
1315
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConstraintValidatorsPass;
1416

src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,16 @@ public function parse($expression, $names)
122122
* @param callable $compiler A callable able to compile the function
123123
* @param callable $evaluator A callable able to evaluate the function
124124
*
125+
* @throws \LogicException when registering a function after calling evaluate(), compile() or parse()
126+
*
125127
* @see ExpressionFunction
126128
*/
127129
public function register($name, callable $compiler, callable $evaluator)
128130
{
131+
if (null !== $this->parser) {
132+
throw new \LogicException('Registering functions after calling evaluate(), compile() or parse() is not supported.');
133+
}
134+
129135
$this->functions[$name] = array('compiler' => $compiler, 'evaluator' => $evaluator);
130136
}
131137

src/Symfony/Component/ExpressionLanguage/Tests/ExpressionLanguageTest.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\ExpressionLanguage\Tests;
1313

14+
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
1415
use PHPUnit\Framework\TestCase;
1516
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
1617
use Symfony\Component\ExpressionLanguage\ParsedExpression;
@@ -212,4 +213,58 @@ public function testCachingWithDifferentNamesOrder()
212213
$expressionLanguage->compile($expression, array('a', 'B' => 'b'));
213214
$expressionLanguage->compile($expression, array('B' => 'b', 'a'));
214215
}
216+
217+
/**
218+
* @dataProvider getRegisterCallbacks
219+
* @expectedException \LogicException
220+
*/
221+
public function testRegisterAfterParse($registerCallback)
222+
{
223+
$el = new ExpressionLanguage();
224+
$el->parse('1 + 1', array());
225+
$registerCallback($el);
226+
}
227+
228+
/**
229+
* @dataProvider getRegisterCallbacks
230+
* @expectedException \LogicException
231+
*/
232+
public function testRegisterAfterEval($registerCallback)
233+
{
234+
$el = new ExpressionLanguage();
235+
$el->evaluate('1 + 1');
236+
$registerCallback($el);
237+
}
238+
239+
/**
240+
* @dataProvider getRegisterCallbacks
241+
* @expectedException \LogicException
242+
*/
243+
public function testRegisterAfterCompile($registerCallback)
244+
{
245+
$el = new ExpressionLanguage();
246+
$el->compile('1 + 1');
247+
$registerCallback($el);
248+
}
249+
250+
public function getRegisterCallbacks()
251+
{
252+
return array(
253+
array(
254+
function (ExpressionLanguage $el) {
255+
$el->register('fn', function () {}, function () {});
256+
},
257+
),
258+
array(
259+
function (ExpressionLanguage $el) {
260+
$el->addFunction(new ExpressionFunction('fn', function () {}, function () {}));
261+
},
262+
),
263+
array(
264+
function (ExpressionLanguage $el) {
265+
$el->registerProvider(new TestProvider());
266+
},
267+
),
268+
);
269+
}
215270
}

0 commit comments

Comments
 (0)