Merge branch '3.3' into 3.4
* 3.3: [HttpFoundation] Fix bad merge in NativeSessionStorage Bump phpunit-bridge requirement to 3.4|4.0 [Bridge/PhpUnit] Remove trailing "\n" from ClockMock::microtime(false) [Form] Rename `FormConfigBuilder::$nativeRequestProcessor` private variable to `::$nativeRequestHandler` Add a "link" script to ease debugging Flex apps [Form] Add phpdoc to `RequestHandlerInterface::isFileUpload()` method
This commit is contained in:
commit
2c2044b34f
59
link
Executable file
59
link
Executable file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
require __DIR__.'/src/Symfony/Component/Filesystem/Exception/ExceptionInterface.php';
|
||||
require __DIR__.'/src/Symfony/Component/Filesystem/Exception/IOExceptionInterface.php';
|
||||
require __DIR__.'/src/Symfony/Component/Filesystem/Exception/IOException.php';
|
||||
require __DIR__.'/src/Symfony/Component/Filesystem/Filesystem.php';
|
||||
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
/**
|
||||
* Links dependencies to components to a local clone of the main symfony/symfony GitHub repository.
|
||||
*
|
||||
* @author Kévin Dunglas <dunglas@gmail.com>
|
||||
*/
|
||||
|
||||
if (2 !== $argc) {
|
||||
echo 'Link dependencies to components to a local clone of the main symfony/symfony GitHub repository.'.PHP_EOL.PHP_EOL;
|
||||
echo "Usage: $argv[0] /path/to/the/project".PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!is_dir("$argv[1]/vendor/symfony")) {
|
||||
echo "The directory \"$argv[1]\" does not exist or the dependencies are not installed, did you forget to run \"composer install\" in your project?".PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$sfPackages = array('symfony/symfony' => __DIR__);
|
||||
foreach (glob(__DIR__.'/src/Symfony/{Bundle,Bridge,Component,Component/Security}/*', GLOB_BRACE | GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
|
||||
$sfPackages[json_decode(file_get_contents("$dir/composer.json"))->name] = $dir;
|
||||
}
|
||||
|
||||
$filesystem = new Filesystem();
|
||||
foreach (glob("$argv[1]/vendor/symfony/*", GLOB_ONLYDIR | GLOB_NOSORT) as $dir) {
|
||||
$package = 'symfony/'.basename($dir);
|
||||
if (is_link($dir)) {
|
||||
echo "\"$package\" is already a symlink, skipping.".PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($sfPackages[$package])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sfDir = '\\' === DIRECTORY_SEPARATOR ? $sfPackages[$package] : $filesystem->makePathRelative($sfPackages[$package], dirname(realpath($dir)));
|
||||
|
||||
$filesystem->remove($dir);
|
||||
$filesystem->symlink($sfDir, $dir);
|
||||
echo "\"$package\" has been linked to \"$sfPackages[$package]\".".PHP_EOL;
|
||||
}
|
2
phpunit
2
phpunit
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
// Cache-Id: https://github.com/symfony/phpunit-bridge/commit/29fa7b8196870591f35e1554dd69def482e01fb2
|
||||
// Cache-Id: https://github.com/symfony/phpunit-bridge/commit/6d344ad9be7566f875488aa14d905449716c06cf
|
||||
|
||||
if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
|
||||
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\nPlease run `composer update` before running this command.\n";
|
||||
|
@ -66,7 +66,7 @@ class ClockMock
|
||||
return self::$now;
|
||||
}
|
||||
|
||||
return sprintf("%0.6f %d\n", self::$now - (int) self::$now, (int) self::$now);
|
||||
return sprintf('%0.6f %d', self::$now - (int) self::$now, (int) self::$now);
|
||||
}
|
||||
|
||||
public static function register($class)
|
||||
|
@ -108,6 +108,9 @@ class HttpFoundationRequestHandler implements RequestHandlerInterface
|
||||
$form->submit($data, 'PATCH' !== $method);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFileUpload($data)
|
||||
{
|
||||
return $data instanceof File;
|
||||
|
@ -32,7 +32,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
*
|
||||
* @var NativeRequestHandler
|
||||
*/
|
||||
private static $nativeRequestProcessor;
|
||||
private static $nativeRequestHandler;
|
||||
|
||||
/**
|
||||
* The accepted request methods.
|
||||
@ -496,10 +496,10 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
public function getRequestHandler()
|
||||
{
|
||||
if (null === $this->requestHandler) {
|
||||
if (null === self::$nativeRequestProcessor) {
|
||||
self::$nativeRequestProcessor = new NativeRequestHandler();
|
||||
if (null === self::$nativeRequestHandler) {
|
||||
self::$nativeRequestHandler = new NativeRequestHandler();
|
||||
}
|
||||
$this->requestHandler = self::$nativeRequestProcessor;
|
||||
$this->requestHandler = self::$nativeRequestHandler;
|
||||
}
|
||||
|
||||
return $this->requestHandler;
|
||||
|
@ -118,6 +118,9 @@ class NativeRequestHandler implements RequestHandlerInterface
|
||||
$form->submit($data, 'PATCH' !== $method);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFileUpload($data)
|
||||
{
|
||||
// POST data will always be strings or arrays of strings. Thus, we can be sure
|
||||
|
@ -27,7 +27,9 @@ interface RequestHandlerInterface
|
||||
public function handleRequest(FormInterface $form, $request = null);
|
||||
|
||||
/**
|
||||
* @param mixed $data
|
||||
* Returns true if the given data is a file upload.
|
||||
*
|
||||
* @param mixed $data The form field data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
Reference in New Issue
Block a user