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

Skip to content

Commit cbc72b7

Browse files
authored
Merge branch '4.4' into improved_tagaware_redis_adapter
2 parents b3ea7d9 + a0bbae7 commit cbc72b7

File tree

91 files changed

+665
-163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+665
-163
lines changed

.travis.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ install:
195195
git fetch --depth=2 origin refs/pull/$SYMFONY_PHPUNIT_BRIDGE_PR/head
196196
git rm -rq src/Symfony/Bridge/PhpUnit
197197
git checkout -q FETCH_HEAD -- src/Symfony/Bridge/PhpUnit
198-
SYMFONY_VERSION=$(cat src/Symfony/Bridge/PhpUnit/composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
198+
export SYMFONY_VERSION=$(cat src/Symfony/Bridge/PhpUnit/composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
199199
sed -i 's/"symfony\/phpunit-bridge": ".*"/"symfony\/phpunit-bridge": "'$SYMFONY_VERSION'.x@dev"/' composer.json
200200
rm -rf .phpunit
201201
fi
@@ -208,7 +208,7 @@ install:
208208
export SYMFONY_DEPRECATIONS_HELPER=weak &&
209209
cp composer.json composer.json.orig &&
210210
echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json &&
211-
php .github/build-packages.php HEAD^ $(find src/Symfony -mindepth 3 -type f -name composer.json -printf '%h\n') &&
211+
php .github/build-packages.php HEAD^ $(find src/Symfony -mindepth 3 -type f -name composer.json -printf '%h\n' | sort) &&
212212
mv composer.json composer.json.phpunit &&
213213
mv composer.json.orig composer.json
214214
fi
@@ -221,18 +221,18 @@ install:
221221
# For the master branch, when deps=high, the version before master is checked out and tested with the locally patched components
222222
if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then
223223
export FLIP='🙃'
224-
SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//) &&
224+
export SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//) &&
225225
git fetch --depth=2 origin $SYMFONY_VERSION &&
226226
git checkout -m FETCH_HEAD &&
227-
COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
227+
export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n' | sort)
228228
else
229-
SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
229+
export SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*')
230230
fi
231231
232232
- |
233233
# Skip the phpunit-bridge on not-master branches when $deps is empty
234234
if [[ ! $deps && $TRAVIS_BRANCH != master ]]; then
235-
COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -not -wholename '*/Bridge/PhpUnit/*' -printf '%h\n' | sort)
235+
export COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -not -wholename '*/Bridge/PhpUnit/*' -printf '%h\n' | sort)
236236
fi
237237
238238
- |
@@ -246,7 +246,7 @@ install:
246246
247247
- |
248248
# Legacy tests are skipped when deps=high and when the current branch version has not the same major version number as the next one
249-
[[ $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) ]] && LEGACY=,legacy
249+
[[ $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) ]] && export LEGACY=,legacy
250250
251251
export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev
252252
if [[ $deps ]]; then mv composer.json.phpunit composer.json; fi
@@ -259,7 +259,7 @@ install:
259259
export PHP=$1
260260
if [[ $PHP != 7.4* && $PHP != $TRAVIS_PHP_VERSION && $TRAVIS_PULL_REQUEST != false ]]; then
261261
echo -e "\\n\\e[33;1mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"
262-
break
262+
return
263263
fi
264264
phpenv global $PHP
265265
([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; cp composer.json composer.bak; composer config platform.ext-mongodb 1.6.0; composer require --dev --no-update mongodb/mongodb)
@@ -281,7 +281,7 @@ install:
281281
COMPONENTS=$(echo "$COMPONENTS" | xargs dirname | xargs -n1 -I{} bash -c "[ -e '{}/phpunit.xml.dist' ] && echo '{}'" | sort)
282282
(cd src/Symfony/Component/HttpFoundation; composer config platform.ext-mongodb 1.6.0; composer require --dev --no-update mongodb/mongodb)
283283
[[ ! $COMPONENTS ]] || tfold 'phpunit install' SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1 ./phpunit install
284-
[[ ! $COMPONENTS ]] || echo "$COMPONENTS" | parallel --gnu "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" || X=1
284+
[[ ! $COMPONENTS ]] || echo "$COMPONENTS" | parallel --gnu "tfold {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" || X=1
285285
fi
286286
287287
[[ ! $X ]] || (exit 1)
@@ -300,7 +300,7 @@ install:
300300
composer install --optimize-autoloader
301301
php .github/patch-types.php
302302
php .github/patch-types.php # ensure the script is idempotent
303-
export PHPUNIT_X="$PHPUNIT_X,legacy"
303+
PHPUNIT_X="$PHPUNIT_X,legacy"
304304
fi
305305
306306
echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}"
@@ -311,10 +311,7 @@ install:
311311
fi
312312
fi
313313
}
314+
export -f run_tests
314315
315316
script:
316-
- for PHP in $TRAVIS_PHP_VERSION $php_extra; do
317-
(run_tests $PHP) || X=1;
318-
done
319-
320-
[[ ! $X ]] || (exit 1)
317+
echo $TRAVIS_PHP_VERSION $php_extra | xargs -n1 bash -c '(</dev/tty run_tests $0)' || false

UPGRADE-4.4.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,24 @@ Security
197197
* The `LdapUserProvider` class has been deprecated, use `Symfony\Component\Ldap\Security\LdapUserProvider` instead.
198198
* Implementations of `PasswordEncoderInterface` and `UserPasswordEncoderInterface` should add a new `needsRehash()` method
199199
* Deprecated returning a non-boolean value when implementing `Guard\AuthenticatorInterface::checkCredentials()`. Please explicitly return `false` to indicate invalid credentials.
200+
* Deprecated passing more than one attribute to `AccessDecisionManager::decide()` and `AuthorizationChecker::isGranted()` (and indirectly the `is_granted()` Twig and ExpressionLanguage function)
201+
202+
**Before**
203+
```php
204+
if ($this->authorizationChecker->isGranted(['ROLE_USER', 'ROLE_ADMIN'])) {
205+
// ...
206+
}
207+
```
208+
209+
**After**
210+
```php
211+
if ($this->authorizationChecker->isGranted(new Expression("has_role('ROLE_USER') or has_role('ROLE_ADMIN')"))) {}
212+
213+
// or:
214+
if ($this->authorizationChecker->isGranted('ROLE_USER')
215+
|| $this->authorizationChecker->isGranted('ROLE_ADMIN')
216+
) {}
217+
```
200218

201219
Stopwatch
202220
---------
@@ -323,8 +341,6 @@ WebProfilerBundle
323341

324342
* Deprecated the `ExceptionController` class in favor of `ExceptionErrorController`
325343
* Deprecated the `TemplateManager::templateExists()` method
326-
* Deprecated the `web_profiler.intercept_redirects` config option,
327-
toolbar for the redirected resource contains a link to the redirect response profile instead.
328344

329345
WebServerBundle
330346
---------------

UPGRADE-5.0.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Debug
5656

5757
* Removed the `Debug` class, use the one from the `ErrorRenderer` component instead
5858
* Removed the `FlattenException` class, use the one from the `ErrorRenderer` component instead
59-
* Removed the component component in favor of the `ErrorHandler` component
59+
* Removed the component in favor of the `ErrorHandler` component
6060

6161
DependencyInjection
6262
-------------------
@@ -122,7 +122,7 @@ DoctrineBridge
122122
* Passing an `IdReader` to the `DoctrineChoiceLoader` when the query cannot be optimized with single id field will throw an exception, pass `null` instead
123123
* Not passing an `IdReader` to the `DoctrineChoiceLoader` when the query can be optimized with single id field will not apply any optimization
124124
* The `RegistryInterface` has been removed.
125-
* Added a new `getMetadataDriverClass` method in `AbstractDoctrineExtension` to replace class parameters.
125+
* Added a new `getMetadataDriverClass` method in `AbstractDoctrineExtension` to replace class parameters.
126126

127127
DomCrawler
128128
----------
@@ -332,7 +332,7 @@ HttpKernel
332332
}
333333
```
334334

335-
As many bundles must be compatible with a range of Symfony versions, the current
335+
As many bundles must be compatible with a range of Symfony versions, the current
336336
directory convention is not deprecated yet, but it will be in the future.
337337
* Removed the second and third argument of `KernelInterface::locateResource`
338338
* Removed the second and third argument of `FileLocator::__construct`
@@ -413,6 +413,24 @@ Routing
413413
Security
414414
--------
415415

416+
* Dropped support for passing more than one attribute to `AccessDecisionManager::decide()` and `AuthorizationChecker::isGranted()` (and indirectly the `is_granted()` Twig and ExpressionLanguage function):
417+
418+
**Before**
419+
```php
420+
if ($this->authorizationChecker->isGranted(['ROLE_USER', 'ROLE_ADMIN'])) {
421+
// ...
422+
}
423+
```
424+
425+
**After**
426+
```php
427+
if ($this->authorizationChecker->isGranted(new Expression("has_role('ROLE_USER') or has_role('ROLE_ADMIN')"))) {}
428+
429+
// or:
430+
if ($this->authorizationChecker->isGranted('ROLE_USER')
431+
|| $this->authorizationChecker->isGranted('ROLE_ADMIN')
432+
) {}
433+
```
416434
* The `LdapUserProvider` class has been removed, use `Symfony\Component\Ldap\Security\LdapUserProvider` instead.
417435
* Implementations of `PasswordEncoderInterface` and `UserPasswordEncoderInterface` must have a new `needsRehash()` method
418436
* The `Role` and `SwitchUserRole` classes have been removed.
@@ -577,8 +595,6 @@ WebProfilerBundle
577595

578596
* Removed the `ExceptionController::templateExists()` method
579597
* Removed the `TemplateManager::templateExists()` method
580-
* Removed the `web_profiler.intercept_redirects` config option,
581-
toolbar for the redirected resource contains a link to the redirect response profile instead.
582598

583599
Workflow
584600
--------

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"ext-xml": "*",
2121
"doctrine/event-manager": "~1.0",
2222
"doctrine/persistence": "~1.0",
23-
"twig/twig": "^1.41|^2.10",
23+
"twig/twig": "^1.41|^2.10|^3.0",
2424
"psr/cache": "~1.0",
2525
"psr/container": "^1.0",
2626
"psr/link": "^1.0",

src/Symfony/Bridge/PhpUnit/ClockMock.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,10 @@ public static function sleep($s)
5353
public static function usleep($us)
5454
{
5555
if (null === self::$now) {
56-
return \usleep($us);
56+
\usleep($us);
57+
} else {
58+
self::$now += $us / 1000000;
5759
}
58-
59-
self::$now += $us / 1000000;
60-
61-
return null;
6260
}
6361

6462
public static function microtime($asFloat = false)
@@ -127,7 +125,7 @@ function sleep(\$s)
127125
128126
function usleep(\$us)
129127
{
130-
return \\$self::usleep(\$us);
128+
\\$self::usleep(\$us);
131129
}
132130
133131
function date(\$format, \$timestamp = null)

src/Symfony/Bridge/Twig/Extension/ProfilerExtension.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public function __construct(Profile $profile, Stopwatch $stopwatch = null)
3333
$this->events = new \SplObjectStorage();
3434
}
3535

36+
/**
37+
* @return void
38+
*/
3639
public function enter(Profile $profile)
3740
{
3841
if ($this->stopwatch && $profile->isTemplate()) {
@@ -42,6 +45,9 @@ public function enter(Profile $profile)
4245
parent::enter($profile);
4346
}
4447

48+
/**
49+
* @return void
50+
*/
4551
public function leave(Profile $profile)
4652
{
4753
parent::leave($profile);

src/Symfony/Bridge/Twig/Node/DumpNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct($varPrefix, Node $values = null, int $lineno, string
3535
}
3636

3737
/**
38-
* {@inheritdoc}
38+
* @return void
3939
*/
4040
public function compile(Compiler $compiler)
4141
{

src/Symfony/Bridge/Twig/Node/FormThemeNode.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ public function __construct(Node $form, Node $resources, int $lineno, string $ta
2727
parent::__construct(['form' => $form, 'resources' => $resources], ['only' => $only], $lineno, $tag);
2828
}
2929

30+
/**
31+
* @return void
32+
*/
3033
public function compile(Compiler $compiler)
3134
{
3235
$compiler

src/Symfony/Bridge/Twig/Node/RenderBlockNode.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
*/
2727
class RenderBlockNode extends FunctionExpression
2828
{
29+
/**
30+
* @return void
31+
*/
2932
public function compile(Compiler $compiler)
3033
{
3134
$compiler->addDebugInfo($this);

src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
*/
2424
class SearchAndRenderBlockNode extends FunctionExpression
2525
{
26+
/**
27+
* @return void
28+
*/
2629
public function compile(Compiler $compiler)
2730
{
2831
$compiler->addDebugInfo($this);

0 commit comments

Comments
 (0)