Skip to content

Commit

Permalink
Merge branch '2.7' into 2.8
Browse files Browse the repository at this point in the history
* 2.7:
  Revamped the README file
  Fix missing namespace in AddConstraintValidatorPassTest
  [ExpressionLanguage] Registering functions after calling evaluate(), compile() or parse() is not supported
  • Loading branch information
fabpot committed Feb 24, 2017
2 parents 8201e47 + ffe3ab1 commit de95fd5
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 52 deletions.
113 changes: 61 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,74 @@
README
======
<p align="center"><a href="https://symfony.com" target="_blank">
<img src="https://symfony.com/logos/symfony_black_02.svg">
</a></p>

What is Symfony?
-----------------

Symfony is a PHP 5.3 full-stack web framework. It is written with speed and
flexibility in mind. It allows developers to build better and easy to maintain
websites with PHP.

Symfony can be used to develop all kind of websites, from your personal blog
to high traffic ones like Dailymotion or Yahoo! Answers.

Requirements
------------

Symfony is only supported on PHP 5.3.9 and up.

Be warned that PHP 5.3.16 has a major bug in the Reflection subsystem and is
not suitable to run Symfony (https://bugs.php.net/bug.php?id=62715)
[Symfony][1] is a **PHP framework** for web applications and a set of reusable
**PHP components**. Symfony is used by thousands of web applications (including
BlaBlaCar.com and Spotify.com) and most of the [popular PHP projects][2] (including
Drupal and Magento).

Installation
------------

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

Documentation
-------------

The "[Quick Tour][1]" tutorial gives you a first feeling of the framework. If,
like us, you think that Symfony can help speed up your development and take
the quality of your work to the next level, read the official
[Symfony documentation][2].
* Read the [Getting Started guide][7] if you are new to Symfony.
* Try the [Symfony Demo application][23] to learn Symfony in practice.
* Master Symfony with the [Guides and Tutorials][8], the [Components docs][9]
and the [Best Practices][10] reference.

Contributing
------------

Symfony is an open source, community-driven project. If you'd like to contribute,
please read the [Contributing Code][3] part of the documentation. If you're submitting
a pull request, please follow the guidelines in the [Submitting a Patch][4] section
and use [Pull Request Template][5].

Community Reviews
-----------------
Community
---------

If you don't feel ready to contribute code or patches, reviewing issues and pull
requests can be a great start to get involved and give back. In fact, people who
"triage" issues are the backbone to Symfony's success!
More information can be found in the [Community Reviews][8] guide.
* [Join the Symfony Community][11] and meet other members at the [Symfony events][12].
* [Get Symfony support][13] on StackOverflow, Slack, IRC, etc.
* Follow us on [GitHub][14], [Twitter][15] and [Facebook][16].

Running Symfony Tests
----------------------

Information on how to run the Symfony test suite can be found in the
[Running Symfony Tests][6] section.
Contributing
------------

[1]: https://symfony.com/doc/current/quick_tour/index.html
[2]: https://symfony.com/doc/current/
[3]: https://symfony.com/doc/current/contributing/code/index.html
[4]: https://symfony.com/doc/current/contributing/code/patches.html#check-list
[5]: https://symfony.com/doc/current/contributing/code/patches.html#make-a-pull-request
[6]: https://symfony.com/doc/master/contributing/code/tests.html
[7]: https://symfony.com/doc/current/book/installation.html#installing-the-symfony-installer
[8]: https://symfony.com/doc/current/contributing/community/reviews.html
Symfony is an Open Source, community-driven project with thousands of
[contributors][19]. Join them [contributing code][17] or [contributing documentation][18].

Security Issues
---------------

If you discover a security vulnerability within Symfony, please follow our
[disclosure procedure][20].

About Us
--------

Symfony development is sponsored by [SensioLabs][21], lead by the
[Symfony Core Team][22] and supported by [Symfony contributors][19].

[1]: https://symfony.com
[2]: https://symfony.com/projects
[3]: https://symfony.com/doc/current/reference/requirements.html
[4]: https://symfony.com/doc/current/setup.html
[5]: http://semver.org
[6]: https://symfony.com/doc/current/contributing/community/releases.html
[7]: https://symfony.com/doc/current/page_creation.html
[8]: https://symfony.com/doc/current/index.html
[9]: https://symfony.com/doc/current/components/index.html
[10]: https://symfony.com/doc/current/best_practices/index.html
[11]: https://symfony.com/community
[12]: https://symfony.com/events/
[13]: https://symfony.com/support
[14]: https://github.com/symfony
[15]: https://twitter.com/symfony
[16]: https://www.facebook.com/SymfonyFramework/
[17]: https://symfony.com/doc/current/contributing/code/index.html
[18]: https://symfony.com/doc/current/contributing/documentation/index.html
[19]: https://symfony.com/contributors
[20]: https://symfony.com/security
[21]: https://sensiolabs.com
[22]: https://symfony.com/doc/current/contributing/code/core_team.html
[23]: https://github.com/symfony/symfony-demo
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/

namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;

use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConstraintValidatorsPass;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,16 @@ public function parse($expression, $names)
* @param callable $compiler A callable able to compile the function
* @param callable $evaluator A callable able to evaluate the function
*
* @throws \LogicException when registering a function after calling evaluate(), compile() or parse()
*
* @see ExpressionFunction
*/
public function register($name, $compiler, $evaluator)
{
if (null !== $this->parser) {
throw new \LogicException('Registering functions after calling evaluate(), compile() or parse() is not supported.');
}

$this->functions[$name] = array('compiler' => $compiler, 'evaluator' => $evaluator);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\ExpressionLanguage\Tests;

use Symfony\Component\ExpressionLanguage\ExpressionFunction;
use PHPUnit\Framework\TestCase;
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\ExpressionLanguage\Tests\Fixtures\TestProvider;
Expand Down Expand Up @@ -139,4 +140,58 @@ public function testCachingWithDifferentNamesOrder()
$expressionLanguage->compile($expression, array('a', 'B' => 'b'));
$expressionLanguage->compile($expression, array('B' => 'b', 'a'));
}

/**
* @dataProvider getRegisterCallbacks
* @expectedException \LogicException
*/
public function testRegisterAfterParse($registerCallback)
{
$el = new ExpressionLanguage();
$el->parse('1 + 1', array());
$registerCallback($el);
}

/**
* @dataProvider getRegisterCallbacks
* @expectedException \LogicException
*/
public function testRegisterAfterEval($registerCallback)
{
$el = new ExpressionLanguage();
$el->evaluate('1 + 1');
$registerCallback($el);
}

/**
* @dataProvider getRegisterCallbacks
* @expectedException \LogicException
*/
public function testRegisterAfterCompile($registerCallback)
{
$el = new ExpressionLanguage();
$el->compile('1 + 1');
$registerCallback($el);
}

public function getRegisterCallbacks()
{
return array(
array(
function (ExpressionLanguage $el) {
$el->register('fn', function () {}, function () {});
},
),
array(
function (ExpressionLanguage $el) {
$el->addFunction(new ExpressionFunction('fn', function () {}, function () {}));
},
),
array(
function (ExpressionLanguage $el) {
$el->registerProvider(new TestProvider());
},
),
);
}
}

0 comments on commit de95fd5

Please sign in to comment.