Skip to content

Commit 850fc5f

Browse files
-
1 parent 4720310 commit 850fc5f

28 files changed

+85
-44
lines changed

.github/patch-types.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
if (false === getenv('SYMFONY_PATCH_TYPE_DECLARATIONS')) {
4+
putenv('SYMFONY_PATCH_TYPE_DECLARATIONS=force=1&php71-compat=0');
5+
}
6+
7+
require __DIR__.'/../.phpunit/phpunit-8.3-0/vendor/autoload.php';
8+
9+
file_put_contents(__DIR__.'/../vendor/autoload.php', preg_replace('/^return (Composer.*);/m', <<<'EOTXT'
10+
$loader = \1;
11+
$loader->addClassMap(['Symfony\Component\Debug\Exception\FlattenException' => \dirname(__DIR__).'/src/Symfony/Component/Debug/Exception/FlattenException.php']);
12+
13+
return $loader;
14+
15+
EOTXT
16+
, file_get_contents(__DIR__.'/../vendor/autoload.php')));
17+
18+
$loader = require __DIR__.'/../vendor/autoload.php';
19+
20+
Symfony\Component\ErrorHandler\DebugClassLoader::enable();
21+
22+
foreach ($loader->getClassMap() as $class => $file) {
23+
switch (true) {
24+
case false !== strpos(realpath($file), '/vendor/');
25+
case false !== strpos($file, '/src/Symfony/Bridge/PhpUnit/'):
26+
case false !== strpos($file, '/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Article.php'):
27+
case false !== strpos($file, '/src/Symfony/Component/Config/Tests/Fixtures/BadParent.php'):
28+
case false !== strpos($file, '/src/Symfony/Component/Debug/Tests/Fixtures/'):
29+
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Compiler/OptionalServiceClass.php'):
30+
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ParentNotExists.php'):
31+
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/BadClasses/MissingParent.php'):
32+
case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/'):
33+
case false !== strpos($file, '/src/Symfony/Component/ErrorHandler/Tests/Fixtures/'):
34+
case false !== strpos($file, '/src/Symfony/Component/PropertyInfo/Tests/Fixtures/'):
35+
case false !== strpos($file, '/src/Symfony/Component/Serializer/Tests/Normalizer/Features/ObjectOuter.php'):
36+
case false !== strpos($file, '/src/Symfony/Component/VarDumper/Tests/Fixtures/NotLoadableClass.php'):
37+
continue 2;
38+
}
39+
40+
class_exists($class);
41+
}
42+
43+
Symfony\Component\ErrorHandler\DebugClassLoader::disable();

.travis.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ env:
2525

2626
matrix:
2727
include:
28-
- php: 7.1
29-
env: php_extra="7.2"
30-
- php: 7.3
31-
env: deps=high
3228
- php: 7.4snapshot
33-
env: deps=low
3429
fast_finish: true
3530

3631
cache:
@@ -75,14 +70,12 @@ before_install:
7570
cp .composer/* ~/.composer/
7671
export PHPUNIT=$(readlink -f ./phpunit)
7772
export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data"
78-
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi'
73+
export COMPOSER_UP='composer update --no-progress --no-suggest --ansi --optimize-autoloader'
7974
export COMPONENTS=$(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n')
8075
find ~/.phpenv -name xdebug.ini -delete
8176
82-
if [[ $TRAVIS_PHP_VERSION = 7.4* && $deps ]]; then
83-
export PHPUNIT_X="$PHPUNIT_X,issue-32995"
84-
elif [[ $TRAVIS_PHP_VERSION = 7.4* ]]; then
85-
export PHPUNIT_X="$PHPUNIT --group issue-32995"
77+
if [[ $TRAVIS_PHP_VERSION = 7.4* ]]; then
78+
export PHPUNIT_X="$PHPUNIT_X,issue-32995,legacy"
8679
fi
8780
8881
nanoseconds () {
@@ -163,6 +156,7 @@ before_install:
163156
- |
164157
# Install extra PHP extensions
165158
for PHP in $TRAVIS_PHP_VERSION $php_extra; do
159+
continue
166160
export PHP=$PHP
167161
phpenv global $PHP
168162
INI=~/.phpenv/versions/$PHP/etc/conf.d/travis.ini
@@ -270,6 +264,9 @@ install:
270264
([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; composer config platform.ext-mongodb 1.6.0; composer require --dev --no-update mongodb/mongodb)
271265
tfold 'composer update' $COMPOSER_UP
272266
tfold 'phpunit install' ./phpunit install
267+
268+
php .github/patch-types.php
269+
273270
if [[ $deps = high ]]; then
274271
echo "$COMPONENTS" | parallel --gnu "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'"
275272
elif [[ $deps = low ]]; then

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@
142142
"src/Symfony/Bridge/ProxyManager/Legacy/ProxiedMethodReturnExpression.php"
143143
],
144144
"exclude-from-classmap": [
145-
"**/Tests/"
146145
]
147146
},
148147
"autoload-dev": {

src/Symfony/Component/ErrorHandler/DebugClassLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class DebugClassLoader
113113
'read' => 'string',
114114
'write' => 'bool',
115115
'destroy' => 'bool',
116-
'gc' => 'int',
116+
'gc' => 'bool',
117117
],
118118
'SessionIdInterface' => [
119119
'create_sid' => 'string',

src/Symfony/Component/HttpFoundation/BinaryFileResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,16 +322,16 @@ public function setContent($content)
322322
if (null !== $content) {
323323
throw new \LogicException('The content cannot be set on a BinaryFileResponse instance.');
324324
}
325+
326+
return $this;
325327
}
326328

327329
/**
328330
* {@inheritdoc}
329-
*
330-
* @return false
331331
*/
332332
public function getContent()
333333
{
334-
return false;
334+
return null;
335335
}
336336

337337
/**

src/Symfony/Component/HttpFoundation/FileBag.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ protected function convertFileInformation($file)
7575
return $file;
7676
}
7777

78-
$file = $this->fixPhpFilesArray($file);
7978
if (\is_array($file)) {
79+
$file = $this->fixPhpFilesArray($file);
8080
$keys = array_keys($file);
8181
sort($keys);
8282

@@ -109,14 +109,12 @@ protected function convertFileInformation($file)
109109
* It's safe to pass an already converted array, in which case this method
110110
* just returns the original array unmodified.
111111
*
112+
* @param array $data
113+
*
112114
* @return array
113115
*/
114116
protected function fixPhpFilesArray($data)
115117
{
116-
if (!\is_array($data)) {
117-
return $data;
118-
}
119-
120118
$keys = array_keys($data);
121119
sort($keys);
122120

src/Symfony/Component/HttpFoundation/HeaderBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function get($key, $default = null)
118118
}
119119
}
120120

121-
return $headers[0] ?? $default;
121+
return isset($headers[0]) ? (string) $headers[0] : $default;
122122
}
123123

124124
/**

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,10 @@ public function __toString()
499499
try {
500500
$content = $this->getContent();
501501
} catch (\LogicException $e) {
502+
if (\PHP_VERSION_ID >= 70400) {
503+
throw $e;
504+
}
505+
502506
return trigger_error($e, E_USER_ERROR);
503507
}
504508

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ public function setContent($content)
409409
/**
410410
* Gets the current response content.
411411
*
412-
* @return string Content
412+
* @return string|null
413413
*/
414414
public function getContent()
415415
{

src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function remove($name)
9797
* @param string $name Key name
9898
* @param bool $writeContext Write context, default false
9999
*
100-
* @return array
100+
* @return array|null
101101
*/
102102
protected function &resolveAttributePath($name, $writeContext = false)
103103
{

0 commit comments

Comments
 (0)