Merge branch '2.4'

* 2.4:
  fixed typos
  Fixed deprecated method calls
  Add testing against HHVM at Travis-CI
  Fixed typo
  Fixed typo
  Fixed typo
  fixed acronyms
  [Validator] Fixed IBAN validator with 0750447346 value

Conflicts:
	src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php
This commit is contained in:
Fabien Potencier 2013-12-28 22:40:48 +01:00
commit 7d80045b22
35 changed files with 59 additions and 46 deletions

View File

@ -5,12 +5,17 @@ php:
- 5.3
- 5.4
- 5.5
- hhvm
matrix:
allow_failures:
- php: hhvm
services: mongodb
before_script:
- sudo apt-get install parallel
- echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
- sh -c 'if [ $(php -r "echo (int) defined("HHVM_VERSION");") -eq 0 ]; then echo "" >> "~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini"; fi;'
- echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- sh -c 'if [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;'
- echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini

View File

@ -27,7 +27,7 @@ class DoctrineOrmExtension extends AbstractExtension
protected function loadTypes()
{
return array(
new Type\EntityType($this->registry, PropertyAccess::getPropertyAccessor()),
new Type\EntityType($this->registry, PropertyAccess::createPropertyAccessor()),
);
}

View File

@ -45,7 +45,7 @@ abstract class DoctrineType extends AbstractType
public function __construct(ManagerRegistry $registry, PropertyAccessorInterface $propertyAccessor = null)
{
$this->registry = $registry;
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::getPropertyAccessor();
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
}
public function buildForm(FormBuilderInterface $builder, array $options)

View File

@ -24,7 +24,7 @@ class PropelExtension extends AbstractExtension
protected function loadTypes()
{
return array(
new Type\ModelType(PropertyAccess::getPropertyAccessor()),
new Type\ModelType(PropertyAccess::createPropertyAccessor()),
new Type\TranslationCollectionType(),
new Type\TranslationType()
);

View File

@ -57,7 +57,7 @@ class ModelType extends AbstractType
public function __construct(PropertyAccessorInterface $propertyAccessor = null)
{
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::getPropertyAccessor();
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
}
public function buildForm(FormBuilderInterface $builder, array $options)

View File

@ -45,8 +45,8 @@ CHANGELOG
* replaced Symfony\Component\HttpKernel\Debug\ContainerAwareTraceableEventDispatcher by Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher
* added Client::enableProfiler()
* a new parameter has been added to the DIC: `router.request_context.base_url`
You can customize it for your functional tests or for generating urls with
the right base url when your are in the cli context.
You can customize it for your functional tests or for generating URLs with
the right base URL when your are in the CLI context.
* added support for default templates per render tag
2.1.0

View File

@ -57,8 +57,8 @@
<service id="templating.asset.request_aware_package" class="Symfony\Component\Templating\Asset\PackageInterface" factory-service="templating.asset.package_factory" factory-method="getPackage" abstract="true">
<argument type="service" id="request" strict="false" />
<argument /> <!-- http id -->
<argument /> <!-- ssl id -->
<argument /> <!-- HTTP id -->
<argument /> <!-- SSL id -->
</service>
<service id="templating.asset.package_factory" class="%templating.asset.package_factory.class%">

View File

@ -74,7 +74,7 @@ class GlobalVariables
/**
* Returns the current request.
*
* @return Request|null The http request object
* @return Request|null The HTTP request object
*/
public function getRequest()
{

View File

@ -93,7 +93,7 @@ abstract class WebTestCase extends \PHPUnit_Framework_TestCase
* PHPUnit will use the last configuration argument on the command line, so this only returns
* the last configuration argument.
*
* @return string The value of the PHPUnit cli configuration option
* @return string The value of the PHPUnit CLI configuration option
*/
private static function getPhpUnitCliConfigArgument()
{

View File

@ -153,7 +153,7 @@ abstract class FrameworkExtensionTest extends TestCase
$this->assertEquals('request', $container->getDefinition('templating.helper.assets')->getScope(), '->registerTemplatingConfiguration() sets request scope on assets helper if one or more packages are request-scoped');
// default package should have one http base url and path package ssl url
// default package should have one HTTP base URL and path package SSL URL
$this->assertTrue($container->hasDefinition('templating.asset.default_package.http'));
$package = $container->getDefinition('templating.asset.default_package.http');
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\DefinitionDecorator', $package);

View File

@ -45,7 +45,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
{
$translator = $this->getTranslator($this->getLoader());
$translator->setLocale('fr');
$translator->setFallbackLocale(array('en', 'es', 'pt-PT', 'pt_BR'));
$translator->setFallbackLocales(array('en', 'es', 'pt-PT', 'pt_BR'));
$this->assertEquals('foo (FR)', $translator->trans('foo'));
$this->assertEquals('bar (EN)', $translator->trans('bar'));
@ -61,7 +61,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
// prime the cache
$translator = $this->getTranslator($this->getLoader(), array('cache_dir' => $this->tmpDir));
$translator->setLocale('fr');
$translator->setFallbackLocale(array('en', 'es', 'pt-PT', 'pt_BR'));
$translator->setFallbackLocales(array('en', 'es', 'pt-PT', 'pt_BR'));
$this->assertEquals('foo (FR)', $translator->trans('foo'));
$this->assertEquals('bar (EN)', $translator->trans('bar'));
@ -75,7 +75,7 @@ class TranslatorTest extends \PHPUnit_Framework_TestCase
$loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface');
$translator = $this->getTranslator($loader, array('cache_dir' => $this->tmpDir));
$translator->setLocale('fr');
$translator->setFallbackLocale(array('en', 'es', 'pt-PT', 'pt_BR'));
$translator->setFallbackLocales(array('en', 'es', 'pt-PT', 'pt_BR'));
$this->assertEquals('foo (FR)', $translator->trans('foo'));
$this->assertEquals('bar (EN)', $translator->trans('bar'));

View File

@ -37,7 +37,7 @@ class ProfilerController
/**
* Constructor.
*
* @param UrlGeneratorInterface $generator The Url Generator
* @param UrlGeneratorInterface $generator The URL Generator
* @param Profiler $profiler The profiler
* @param \Twig_Environment $twig The twig environment
* @param array $templates The templates

View File

@ -412,7 +412,7 @@ abstract class Client
*
* This method returns null if the DomCrawler component is not available.
*
* @param string $uri A uri
* @param string $uri A URI
* @param string $content Content for the crawler to use
* @param string $type Content type
*
@ -534,9 +534,9 @@ abstract class Client
/**
* Takes a URI and converts it to absolute if it is not already absolute.
*
* @param string $uri A uri
* @param string $uri A URI
*
* @return string An absolute uri
* @return string An absolute URI
*/
protected function getAbsoluteUri($uri)
{

View File

@ -157,7 +157,7 @@ class DialogHelperTest extends \PHPUnit_Framework_TestCase
}
}
public function testNoInteration()
public function testNoInteraction()
{
$dialog = new DialogHelper();

View File

@ -162,10 +162,10 @@ class ErrorHandler
// we must stop the PHP script execution, as the exception has
// already been dealt with, so, let's throw an exception that
// will be catched by a dummy exception handler
// will be caught by a dummy exception handler
set_exception_handler(function (\Exception $e) use ($exceptionHandler) {
if (!$e instanceof DummyException) {
// happens if our dummy exception is catched by a
// happens if our dummy exception is caught by a
// catch-all from user code, in which case, let's the
// current handler handle this "new" exception
call_user_func($exceptionHandler, $e);

View File

@ -112,7 +112,7 @@ class Link
if ('?' === $uri[0]) {
$baseUri = $this->currentUri;
// remove the query string from the current uri
// remove the query string from the current URI
if (false !== $pos = strpos($baseUri, '?')) {
$baseUri = substr($baseUri, 0, $pos);
}
@ -140,7 +140,7 @@ class Link
}
/**
* Returns raw uri data.
* Returns raw URI data.
*
* @return string
*/

View File

@ -712,7 +712,7 @@ EOF
$this->assertEquals('http://base.com/link', $crawler->filterXPath('//a')->link()->getUri());
$crawler = new Crawler('<html><base href="//base.com"><a href="link"></a></html>', 'https://domain.com');
$this->assertEquals('https://base.com/link', $crawler->filterXPath('//a')->link()->getUri(), '<base> tag can use a schema-less url');
$this->assertEquals('https://base.com/link', $crawler->filterXPath('//a')->link()->getUri(), '<base> tag can use a schema-less URL');
$crawler = new Crawler('<html><base href="path/"><a href="link"></a></html>', 'https://domain.com');
$this->assertEquals('https://domain.com/path/link', $crawler->filterXPath('//a')->link()->getUri(), '<base> tag can set a path');

View File

@ -262,7 +262,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
* @param object $listener The listener
* @param string $eventName The event name
*
* @return array Informations about the listener
* @return array Information about the listener
*/
private function getListenerInfo($listener, $eventName)
{

View File

@ -87,7 +87,7 @@ class ObjectChoiceList extends ChoiceList
*/
public function __construct($choices, $labelPath = null, array $preferredChoices = array(), $groupPath = null, $valuePath = null, PropertyAccessorInterface $propertyAccessor = null)
{
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::getPropertyAccessor();
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
$this->labelPath = null !== $labelPath ? new PropertyPath($labelPath) : null;
$this->groupPath = null !== $groupPath ? new PropertyPath($groupPath) : null;
$this->valuePath = null !== $valuePath ? new PropertyPath($valuePath) : null;

View File

@ -24,7 +24,7 @@ class CoreExtension extends AbstractExtension
protected function loadTypes()
{
return array(
new Type\FormType(PropertyAccess::getPropertyAccessor()),
new Type\FormType(PropertyAccess::createPropertyAccessor()),
new Type\BirthdayType(),
new Type\CheckboxType(),
new Type\ChoiceType(),

View File

@ -31,7 +31,7 @@ class FormType extends BaseType
public function __construct(PropertyAccessorInterface $propertyAccessor = null)
{
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::getPropertyAccessor();
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
}
/**

View File

@ -27,7 +27,7 @@ class RedirectResponse extends Response
*
* @param string $url The URL to redirect to
* @param integer $status The status code (302 by default)
* @param array $headers The headers (Location is always set to the given url)
* @param array $headers The headers (Location is always set to the given URL)
*
* @throws \InvalidArgumentException
*

View File

@ -881,14 +881,14 @@ class Request
}
/**
* Returns the root url from which this request is executed.
* Returns the root URL from which this request is executed.
*
* The base URL never ends with a /.
*
* This is similar to getBasePath(), except that it also includes the
* script filename (e.g. index.php) if one exists.
*
* @return string The raw url (i.e. not urldecoded)
* @return string The raw URL (i.e. not urldecoded)
*
* @api
*/
@ -1615,13 +1615,13 @@ class Request
$requestUri = $this->headers->get('X_REWRITE_URL');
$this->headers->remove('X_REWRITE_URL');
} elseif ($this->server->get('IIS_WasUrlRewritten') == '1' && $this->server->get('UNENCODED_URL') != '') {
// IIS7 with URL Rewrite: make sure we get the unencoded url (double slash problem)
// IIS7 with URL Rewrite: make sure we get the unencoded URL (double slash problem)
$requestUri = $this->server->get('UNENCODED_URL');
$this->server->remove('UNENCODED_URL');
$this->server->remove('IIS_WasUrlRewritten');
} elseif ($this->server->has('REQUEST_URI')) {
$requestUri = $this->server->get('REQUEST_URI');
// HTTP proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path
// HTTP proxy reqs setup request URI with scheme and host [and port] + the URL path, only use URL path
$schemeAndHttpHost = $this->getSchemeAndHttpHost();
if (strpos($requestUri, $schemeAndHttpHost) === 0) {
$requestUri = substr($requestUri, strlen($schemeAndHttpHost));

View File

@ -1242,7 +1242,7 @@ class Response
}
/**
* Check if we need to remove Cache-Control for ssl encrypted downloads when using IE < 9
* Check if we need to remove Cache-Control for SSL encrypted downloads when using IE < 9
*
* @link http://support.microsoft.com/kb/323308
*/

View File

@ -205,10 +205,10 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('example@example.com', $bag->filter('email', '', false, FILTER_VALIDATE_EMAIL), '->filter() gets a value of parameter as email');
$this->assertEquals('http://example.com/foo', $bag->filter('url', '', false, FILTER_VALIDATE_URL, array('flags' => FILTER_FLAG_PATH_REQUIRED)), '->filter() gets a value of parameter as url with a path');
$this->assertEquals('http://example.com/foo', $bag->filter('url', '', false, FILTER_VALIDATE_URL, array('flags' => FILTER_FLAG_PATH_REQUIRED)), '->filter() gets a value of parameter as URL with a path');
// This test is repeated for code-coverage
$this->assertEquals('http://example.com/foo', $bag->filter('url', '', false, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED), '->filter() gets a value of parameter as url with a path');
$this->assertEquals('http://example.com/foo', $bag->filter('url', '', false, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED), '->filter() gets a value of parameter as URL with a path');
$this->assertFalse($bag->filter('dec', '', false, FILTER_VALIDATE_INT, array(
'flags' => FILTER_FLAG_ALLOW_HEX,

View File

@ -715,7 +715,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
));
$port = $request->getPort();
$this->assertEquals(80, $port, 'If X_FORWARDED_PROTO is set to http return 80.');
$this->assertEquals(80, $port, 'If X_FORWARDED_PROTO is set to HTTP return 80.');
$request = Request::create('http://example.com', 'GET', array(), array(), array(), array(
'HTTP_X_FORWARDED_PROTO' => 'On'

View File

@ -187,7 +187,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
}
/**
* Gets a http kernel from the container
* Gets a HTTP kernel from the container
*
* @return HttpKernel
*/

View File

@ -1123,7 +1123,7 @@ class Process
}
/**
* Captures the exitcode if mentioned in the process informations.
* Captures the exitcode if mentioned in the process information.
*/
private function captureExitCode()
{

View File

@ -25,7 +25,7 @@ namespace Symfony\Component\Routing\Generator;
* params because they come from third party libs but don't want to have a 404 in
* production environment. It should log the mismatch so one can review it.
* - setStrictRequirements(null): Return the URL with the given parameters without
* checking the requirements at all. When generating an URL you should either trust
* checking the requirements at all. When generating a URL you should either trust
* your params or you validated them beforehand because otherwise it would break your
* link anyway. So in production environment you should know that params always pass
* the requirements. Thus this option allows to disable the check on URL generation for

View File

@ -188,7 +188,7 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
$url = '/';
}
// the contexts base url is already encoded (see Symfony\Component\HttpFoundation\Request)
// the contexts base URL is already encoded (see Symfony\Component\HttpFoundation\Request)
$url = strtr(rawurlencode($url), $this->decodedChars);
// the path segments "." and ".." are interpreted as relative reference when resolving a URI; see http://tools.ietf.org/html/rfc3986#section-3.3

View File

@ -199,7 +199,7 @@ class ExceptionListener
*/
protected function setTargetPath(Request $request)
{
// session isn't required when using http basic authentication mechanism for example
// session isn't required when using HTTP basic authentication mechanism for example
if ($request->hasSession() && $request->isMethodSafe()) {
$request->getSession()->set('_security.'.$this->providerKey.'.target_path', $request->getUri());
}

View File

@ -35,7 +35,7 @@ class HttpUtils
* Constructor.
*
* @param UrlGeneratorInterface $urlGenerator A UrlGeneratorInterface instance
* @param UrlMatcherInterface|RequestMatcherInterface $urlMatcher The Url or Request matcher
* @param UrlMatcherInterface|RequestMatcherInterface $urlMatcher The URL or Request matcher
*
* @throws \InvalidArgumentException
*/
@ -146,7 +146,7 @@ class HttpUtils
$url = $this->urlGenerator->generate($path, $request->attributes->all(), UrlGeneratorInterface::ABSOLUTE_URL);
// unnecessary query string parameters must be removed from url
// unnecessary query string parameters must be removed from URL
// (ie. query parameters that are presents in $attributes)
// fortunately, they all are, so we have to remove entire query string
$position = strpos($url, '?');

View File

@ -146,7 +146,7 @@ class PoFileLoader extends ArrayLoader implements LoaderInterface
}
/**
* Save a translation item to the messeages.
* Save a translation item to the messages.
*
* A .po file could contain by error missing plural indexes. We need to
* fix these before saving them.

View File

@ -30,6 +30,13 @@ class IbanValidator extends ConstraintValidator
return;
}
// An IBAN without a country code is not an IBAN.
if (0 === preg_match('/[A-Za-z]/', $value)) {
$this->context->addViolation($constraint->message, array('{{ value }}' => $value));
return;
}
$teststring = preg_replace('/\s+/', '', $value);
if (strlen($teststring) < 4) {

View File

@ -181,6 +181,7 @@ class IbanValidatorTest extends \PHPUnit_Framework_TestCase
array('CY170020 128 0000 0012 0052 7600'),
array('foo'),
array('123'),
array('0750447346')
);
}
}