Skip to content

Commit 6f744ff

Browse files
Update symfony
1 parent e60dba0 commit 6f744ff

18 files changed

+482
-104
lines changed

composer.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"repositories": [],
33
"require": {
4-
"symfony/var-dumper": "^5.1"
4+
"php": "^7.4.14",
5+
"symfony/polyfill-php74": "^1.17",
6+
"symfony/var-dumper": "^5.2"
57
}
68
}

vendor/bin/var-dump-server

+16-55
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,24 @@
11
#!/usr/bin/env php
22
<?php
33

4-
/*
5-
* This file is part of the Symfony package.
6-
*
7-
* (c) Fabien Potencier <[email protected]>
8-
*
9-
* For the full copyright and license information, please view the LICENSE
10-
* file that was distributed with this source code.
11-
*/
12-
134
/**
14-
* Starts a dump server to collect and output dumps on a single place with multiple formats support.
5+
* Proxy PHP file generated by Composer
156
*
16-
* @author Maxime Steinhausser <[email protected]>
7+
* This file includes the referenced bin path (../symfony/var-dumper/Resources/bin/var-dump-server) using eval to remove the shebang if present
8+
*
9+
* @generated
1710
*/
1811

19-
use Psr\Log\LoggerInterface;
20-
use Symfony\Component\Console\Application;
21-
use Symfony\Component\Console\Input\ArgvInput;
22-
use Symfony\Component\Console\Input\InputOption;
23-
use Symfony\Component\Console\Logger\ConsoleLogger;
24-
use Symfony\Component\Console\Output\ConsoleOutput;
25-
use Symfony\Component\VarDumper\Command\ServerDumpCommand;
26-
use Symfony\Component\VarDumper\Server\DumpServer;
27-
28-
function includeIfExists(string $file): bool
29-
{
30-
return file_exists($file) && include $file;
31-
}
32-
33-
if (
34-
!includeIfExists(__DIR__ . '/../../../../autoload.php') &&
35-
!includeIfExists(__DIR__ . '/../../vendor/autoload.php') &&
36-
!includeIfExists(__DIR__ . '/../../../../../../vendor/autoload.php')
37-
) {
38-
fwrite(STDERR, 'Install dependencies using Composer.'.PHP_EOL);
39-
exit(1);
40-
}
41-
42-
if (!class_exists(Application::class)) {
43-
fwrite(STDERR, 'You need the "symfony/console" component in order to run the VarDumper server.'.PHP_EOL);
44-
exit(1);
12+
$binPath = realpath(__DIR__ . "/" . '../symfony/var-dumper/Resources/bin/var-dump-server');
13+
$contents = file_get_contents($binPath);
14+
$contents = preg_replace('{^#!/.+\r?\n<\?(php)?}', '', $contents, 1, $replaced);
15+
if ($replaced) {
16+
$contents = strtr($contents, array(
17+
'__FILE__' => var_export($binPath, true),
18+
'__DIR__' => var_export(dirname($binPath), true),
19+
));
20+
21+
eval($contents);
22+
exit(0);
4523
}
46-
47-
$input = new ArgvInput();
48-
$output = new ConsoleOutput();
49-
$defaultHost = '127.0.0.1:9912';
50-
$host = $input->getParameterOption(['--host'], $_SERVER['VAR_DUMPER_SERVER'] ?? $defaultHost, true);
51-
$logger = interface_exists(LoggerInterface::class) ? new ConsoleLogger($output->getErrorOutput()) : null;
52-
53-
$app = new Application();
54-
55-
$app->getDefinition()->addOption(
56-
new InputOption('--host', null, InputOption::VALUE_REQUIRED, 'The address the server should listen to', $defaultHost)
57-
);
58-
59-
$app->add($command = new ServerDumpCommand(new DumpServer($host, $logger)))
60-
->getApplication()
61-
->setDefaultCommand($command->getName(), true)
62-
->run($input, $output)
63-
;
24+
include $binPath;

vendor/bin/var-dump-server.bat

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@ECHO OFF
2+
setlocal DISABLEDELAYEDEXPANSION
3+
SET BIN_TARGET=%~dp0/../symfony/var-dumper/Resources/bin/var-dump-server
4+
php "%BIN_TARGET%" %*

vendor/composer/ClassLoader.php

+34
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
*/
4343
class ClassLoader
4444
{
45+
private $vendorDir;
46+
4547
// PSR-4
4648
private $prefixLengthsPsr4 = array();
4749
private $prefixDirsPsr4 = array();
@@ -57,6 +59,13 @@ class ClassLoader
5759
private $missingClasses = array();
5860
private $apcuPrefix;
5961

62+
private static $registeredLoaders = array();
63+
64+
public function __construct($vendorDir = null)
65+
{
66+
$this->vendorDir = $vendorDir;
67+
}
68+
6069
public function getPrefixes()
6170
{
6271
if (!empty($this->prefixesPsr0)) {
@@ -300,6 +309,17 @@ public function getApcuPrefix()
300309
public function register($prepend = false)
301310
{
302311
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
312+
313+
if (null === $this->vendorDir) {
314+
return;
315+
}
316+
317+
if ($prepend) {
318+
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
319+
} else {
320+
unset(self::$registeredLoaders[$this->vendorDir]);
321+
self::$registeredLoaders[$this->vendorDir] = $this;
322+
}
303323
}
304324

305325
/**
@@ -308,6 +328,10 @@ public function register($prepend = false)
308328
public function unregister()
309329
{
310330
spl_autoload_unregister(array($this, 'loadClass'));
331+
332+
if (null !== $this->vendorDir) {
333+
unset(self::$registeredLoaders[$this->vendorDir]);
334+
}
311335
}
312336

313337
/**
@@ -367,6 +391,16 @@ public function findFile($class)
367391
return $file;
368392
}
369393

394+
/**
395+
* Returns the currently registered loaders indexed by their corresponding vendor directories.
396+
*
397+
* @return self[]
398+
*/
399+
public static function getRegisteredLoaders()
400+
{
401+
return self::$registeredLoaders;
402+
}
403+
370404
private function findFileWithExtension($class, $ext)
371405
{
372406
// PSR-4 lookup

0 commit comments

Comments
 (0)