Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3c40825

Browse filesBrowse files
Merge branch '2.8' into 3.0
* 2.8: (22 commits) Fix backport [travis] Upgrade phpunit wrapper & hirak/prestissimo [Bridge\PhpUnit] Workaround old phpunit bug, no colors in weak mode, add tests [PropertyAccess] Fix isPropertyWritable not using the reflection cache [PropertyAccess] Backport fixes from 2.7 [FrameworkBundle][2.8] Add tests for the Controller class [DependencyInjection] Update changelog Added WebProfiler toolbar ajax panel table layout css. [Validator] use correct term for a property in docblock (not "option") [Routing] small refactoring for scheme requirement [PropertyAccess] Remove most ref mismatches to improve perf [PropertyInfo] Support Doctrine custom mapping type in DoctrineExtractor [Validator] EmailValidator cannot extract hostname if email contains multiple @ symbols [NumberFormatter] Fix invalid numeric literal on PHP 7 [Process] fix docblock syntax use the clock mock for progress indicator tests Use XML_ELEMENT_NODE in nodeType check [PropertyAccess] Reduce overhead of UnexpectedTypeException tracking [PropertyAccess] Throw an UnexpectedTypeException when the type do not match [FrameworkBundle] Add tests for the Controller class ... Conflicts: .travis.yml composer.json src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php src/Symfony/Bundle/FrameworkBundle/composer.json src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
2 parents 4af1556 + 4281501 commit 3c40825
Copy full SHA for 3c40825

File tree

Expand file treeCollapse file tree

34 files changed

+1012
-343
lines changed
Filter options
Expand file treeCollapse file tree

34 files changed

+1012
-343
lines changed

‎.composer/composer.lock

Copy file name to clipboardExpand all lines: .composer/composer.lock
+5-5Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.composer/config.json

Copy file name to clipboard
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"config": {
3+
"preferred-install": {
4+
"*": "dist"
5+
}
6+
}
7+
}

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+8-6Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ before_install:
4949
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then echo extension = ldap.so >> $INI_FILE; fi;
5050
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini; fi;
5151
- if [[ $deps != skip ]]; then composer self-update; fi;
52-
- if [[ $deps != skip && $TRAVIS_REPO_SLUG = symfony/symfony ]]; then cp .composer/* ~/.composer/; composer global install --prefer-dist; fi;
52+
- if [[ $deps != skip && $TRAVIS_REPO_SLUG = symfony/symfony ]]; then cp .composer/* ~/.composer/; composer global install; fi;
5353
- if [[ $deps != skip ]]; then ./phpunit install; fi;
5454
- export PHPUNIT=$(readlink -f ./phpunit)
5555

@@ -59,18 +59,20 @@ install:
5959
- if [[ $deps != skip && $deps ]]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $COMPONENTS; fi;
6060
# For the master branch when deps=high, the version before master is checked out and tested with the locally patched components
6161
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi;
62-
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi;
62+
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); ./phpunit install; fi;
6363
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one
6464
- if [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]]; then LEGACY=,legacy; fi;
6565
- export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev;
66-
- if [[ ! $deps ]]; then composer update --prefer-dist; else export SYMFONY_DEPRECATIONS_HELPER=weak; fi;
66+
- if [[ ! $deps ]]; then composer update; else export SYMFONY_DEPRECATIONS_HELPER=weak; fi;
67+
- if [[ $TRAVIS_BRANCH = master ]]; then export SYMFONY_PHPUNIT_OVERLOAD=1; fi;
6768
- if [[ $TRAVIS_PHP_VERSION != hhvm ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi;
6869

6970
script:
7071
- if [[ ! $deps ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'; fi;
7172
- if [[ ! $deps ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi;
7273
- if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'echo "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi;
73-
- if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --prefer-dist; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY; fi;
74-
- if [[ $deps = high ]]; then (cd src/Symfony/Bridge/PhpUnit && phpenv global 5.3 && php --version && $PHPUNIT && find -name '*.php' -not -path './vendor/*' | xargs -n1 php -l); fi;
75-
- if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --prefer-dist --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
74+
- if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY; fi;
75+
- if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data'; fi;
76+
# Test the PhpUnit bridge using the original phpunit script
77+
- if [[ $deps = low ]]; then (cd src/Symfony/Bridge/PhpUnit && phpenv global 5.3 && php --version && composer update && phpunit); fi;
7678
- if [[ $deps = skip ]]; then echo This matrix line is skipped for pull requests.; fi;

‎appveyor.yml

Copy file name to clipboardExpand all lines: appveyor.yml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ install:
5151
- cd c:\projects\symfony
5252
- mkdir %APPDATA%\Composer
5353
- IF %APPVEYOR_REPO_NAME%==symfony/symfony copy /Y .composer\* %APPDATA%\Composer\
54-
- IF %APPVEYOR_REPO_NAME%==symfony/symfony composer global install --prefer-dist --no-progress --ansi || echo curl.cainfo needs PHP 5.3.7
54+
- IF %APPVEYOR_REPO_NAME%==symfony/symfony composer global install --no-progress --ansi || echo curl.cainfo needs PHP 5.3.7
5555
- php phpunit install
5656
- IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev)
57-
- composer update --prefer-dist --no-progress --ansi
57+
- composer update --no-progress --ansi
5858

5959
test_script:
6060
- cd c:\projects\symfony

‎composer.json

Copy file name to clipboardExpand all lines: composer.json
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,7 @@
8989
},
9090
"autoload": {
9191
"psr-4": {
92-
"Symfony\\Bridge\\Doctrine\\": "src/Symfony/Bridge/Doctrine/",
93-
"Symfony\\Bridge\\Monolog\\": "src/Symfony/Bridge/Monolog/",
94-
"Symfony\\Bridge\\ProxyManager\\": "src/Symfony/Bridge/ProxyManager/",
95-
"Symfony\\Bridge\\Twig\\": "src/Symfony/Bridge/Twig/",
92+
"Symfony\\Bridge\\": "src/Symfony/Bridge/",
9693
"Symfony\\Bundle\\": "src/Symfony/Bundle/",
9794
"Symfony\\Component\\": "src/Symfony/Component/"
9895
},

‎phpunit

Copy file name to clipboardExpand all lines: phpunit
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
// Please update when phpunit needs to be reinstalled with fresh deps:
14-
// Cache-Id-Version: 2016-03-16 15:36 UTC
14+
// Cache-Id-Version: 2016-03-22 17:23 UTC
1515

1616
use Symfony\Component\Process\ProcessUtils;
1717

@@ -54,11 +54,17 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
5454
passthru("$COMPOSER remove --no-update symfony/yaml");
5555
passthru("$COMPOSER require --dev --no-update symfony/phpunit-bridge \">=3.1@dev\"");
5656
passthru("$COMPOSER install --prefer-dist --no-progress --ansi");
57-
file_put_contents('phpunit', <<<EOPHP
57+
file_put_contents('phpunit', <<<'EOPHP'
5858
<?php
5959
6060
define('PHPUNIT_COMPOSER_INSTALL', __DIR__.'/vendor/autoload.php');
61-
require PHPUNIT_COMPOSER_INSTALL;
61+
62+
$loader = require PHPUNIT_COMPOSER_INSTALL;
63+
64+
if (getenv('SYMFONY_PHPUNIT_OVERLOAD') && file_exists(__DIR__.'/../../src/Symfony/Bridge/PhpUnit')) {
65+
$loader->addPsr4('Symfony\\Bridge\\PhpUnit\\', array('src/Symfony/Bridge/PhpUnit'), true);
66+
}
67+
unset($loader);
6268
Symfony\Bridge\PhpUnit\TextUI\Command::main();
6369

6470
EOPHP

‎src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php
+27-22Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Doctrine\Common\Persistence\Mapping\ClassMetadataFactory;
1515
use Doctrine\Common\Persistence\Mapping\MappingException;
16+
use Doctrine\DBAL\Types\Type as DBALType;
1617
use Doctrine\ORM\Mapping\ClassMetadataInfo;
1718
use Doctrine\ORM\Mapping\MappingException as OrmMappingException;
1819
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
@@ -93,23 +94,26 @@ public function getTypes($class, $property, array $context = array())
9394
$nullable = $metadata instanceof ClassMetadataInfo && $metadata->isNullable($property);
9495

9596
switch ($typeOfField) {
96-
case 'date':
97-
case 'datetime':
98-
case 'datetimetz':
99-
case 'time':
97+
case DBALType::DATE:
98+
case DBALType::DATETIME:
99+
case DBALType::DATETIMETZ:
100+
case 'vardatetime':
101+
case DBALType::TIME:
100102
return array(new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateTime'));
101103

102-
case 'array':
104+
case DBALType::TARRAY:
103105
return array(new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true));
104106

105-
case 'simple_array':
107+
case DBALType::SIMPLE_ARRAY:
106108
return array(new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING)));
107109

108-
case 'json_array':
110+
case DBALType::JSON_ARRAY:
109111
return array(new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true));
110112

111113
default:
112-
return array(new Type($this->getPhpType($typeOfField), $nullable));
114+
$builtinType = $this->getPhpType($typeOfField);
115+
116+
return $builtinType ? array(new Type($builtinType, $nullable)) : null;
113117
}
114118
}
115119
}
@@ -119,36 +123,37 @@ public function getTypes($class, $property, array $context = array())
119123
*
120124
* @param string $doctrineType
121125
*
122-
* @return string
126+
* @return string|null
123127
*/
124128
private function getPhpType($doctrineType)
125129
{
126130
switch ($doctrineType) {
127-
case 'smallint':
128-
// No break
129-
case 'bigint':
130-
// No break
131-
case 'integer':
131+
case DBALType::SMALLINT:
132+
case DBALType::BIGINT:
133+
case DBALType::INTEGER:
132134
return Type::BUILTIN_TYPE_INT;
133135

134-
case 'decimal':
136+
case DBALType::FLOAT:
137+
case DBALType::DECIMAL:
135138
return Type::BUILTIN_TYPE_FLOAT;
136139

137-
case 'text':
138-
// No break
139-
case 'guid':
140+
case DBALType::STRING:
141+
case DBALType::TEXT:
142+
case DBALType::GUID:
140143
return Type::BUILTIN_TYPE_STRING;
141144

142-
case 'boolean':
145+
case DBALType::BOOLEAN:
143146
return Type::BUILTIN_TYPE_BOOL;
144147

145-
case 'blob':
146-
// No break
148+
case DBALType::BLOB:
147149
case 'binary':
148150
return Type::BUILTIN_TYPE_RESOURCE;
149151

152+
case DBALType::OBJECT:
153+
return Type::BUILTIN_TYPE_OBJECT;
154+
150155
default:
151-
return $doctrineType;
156+
return;
152157
}
153158
}
154159
}

‎src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Doctrine\PropertyInfo\Tests;
1313

14+
use Doctrine\DBAL\Types\Type as DBALType;
1415
use Doctrine\ORM\EntityManager;
1516
use Doctrine\ORM\Tools\Setup;
1617
use Symfony\Bridge\Doctrine\PropertyInfo\DoctrineExtractor;
@@ -31,6 +32,11 @@ protected function setUp()
3132
$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'), true);
3233
$entityManager = EntityManager::create(array('driver' => 'pdo_sqlite'), $config);
3334

35+
if (!DBALType::hasType('foo')) {
36+
DBALType::addType('foo', 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineFooType');
37+
$entityManager->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('custom_foo', 'foo');
38+
}
39+
3440
$this->extractor = new DoctrineExtractor($entityManager->getMetadataFactory());
3541
}
3642

@@ -45,6 +51,7 @@ public function testGetProperties()
4551
'simpleArray',
4652
'bool',
4753
'binary',
54+
'customFoo',
4855
'foo',
4956
'bar',
5057
),
@@ -78,6 +85,7 @@ public function typesProvider()
7885
new Type(Type::BUILTIN_TYPE_OBJECT, false, 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\DoctrineRelation')
7986
))),
8087
array('simpleArray', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_STRING)))),
88+
array('customFoo', null),
8189
array('notMapped', null),
8290
);
8391
}

‎src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineDummy.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,10 @@ class DoctrineDummy
7070
*/
7171
private $binary;
7272

73+
/**
74+
* @Column(type="custom_foo")
75+
*/
76+
private $customFoo;
77+
7378
public $notMapped;
7479
}
+84Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures;
13+
14+
use Doctrine\DBAL\Platforms\AbstractPlatform;
15+
use Doctrine\DBAL\Types\ConversionException;
16+
use Doctrine\DBAL\Types\Type;
17+
18+
/**
19+
* @author Teoh Han Hui <teohhanhui@gmail.com>
20+
*/
21+
class DoctrineFooType extends Type
22+
{
23+
/**
24+
* Type name.
25+
*/
26+
const NAME = 'foo';
27+
28+
/**
29+
* {@inheritdoc}
30+
*/
31+
public function getName()
32+
{
33+
return self::NAME;
34+
}
35+
36+
/**
37+
* {@inheritdoc}
38+
*/
39+
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
40+
{
41+
return $platform->getClobTypeDeclarationSQL(array());
42+
}
43+
44+
/**
45+
* {@inheritdoc}
46+
*/
47+
public function convertToDatabaseValue($value, AbstractPlatform $platform)
48+
{
49+
if (null === $value) {
50+
return;
51+
}
52+
if (!$value instanceof Foo) {
53+
throw new ConversionException(sprintf('Expected %s, got %s', 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\Foo', gettype($value)));
54+
}
55+
56+
return $foo->bar;
57+
}
58+
59+
/**
60+
* {@inheritdoc}
61+
*/
62+
public function convertToPHPValue($value, AbstractPlatform $platform)
63+
{
64+
if (null === $value) {
65+
return;
66+
}
67+
if (!is_string($value)) {
68+
throw ConversionException::conversionFailed($value, self::NAME);
69+
}
70+
71+
$foo = new Foo();
72+
$foo->bar = $value;
73+
74+
return $foo;
75+
}
76+
77+
/**
78+
* {@inheritdoc}
79+
*/
80+
public function requiresSQLCommentHint(AbstractPlatform $platform)
81+
{
82+
return true;
83+
}
84+
}
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures;
13+
14+
/**
15+
* @author Teoh Han Hui <teohhanhui@gmail.com>
16+
*/
17+
class Foo
18+
{
19+
/**
20+
* @var string
21+
*/
22+
public $bar;
23+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.