Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable19] Hardcode 19 dependencies #790

Merged
merged 3 commits into from
Sep 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/composer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
uses: shivammathur/setup-php@master
with:
php-version: 7.4
tools: composer:v1
coverage: none
- name: Update composer
run: sudo composer self-update && composer --version
- name: Vendor dependencies
run: composer run vendor
- name: Check vendor changes
run: |
bash -c "[[ ! \"`git status --porcelain `\" ]] || ( echo 'Uncommited vendor changes' && git status && git diff && exit 1 )"
bash -c "[[ ! \"`git status --porcelain . :!composer/installed.json :!composer/installed.php :!composer/package-versions-deprecated/src/PackageVersions/Versions.php `\" ]] || ( echo 'Uncommited vendor changes' && git status && git diff && exit 1 )"

11 changes: 10 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,16 @@
"symfony/routing": "4.4.4",
"symfony/translation": "4.4.4",
"php-http/guzzle6-adapter": "^2.0",
"web-auth/webauthn-lib": "^3.1"
"web-auth/webauthn-lib": "^3.1",
"doctrine/annotations": "1.6.0",
"doctrine/collections": "1.5.0",
"doctrine/common": "2.10.0",
"doctrine/inflector": "1.3.0",
"doctrine/persistence": "1.1.0",
"doctrine/reflection": "1.0.0",
"guzzlehttp/ringphp": "1.1.0",
"guzzlehttp/streams": "3.0.0",
"react/promise": "2.2.1"
},
"scripts": {
"vendor": "composer install --no-dev && git clean -xdf && composer dump-autoload"
Expand Down
40 changes: 38 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 39 additions & 3 deletions composer/ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
private $vendorDir;

// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
Expand All @@ -57,6 +59,13 @@ class ClassLoader
private $missingClasses = array();
private $apcuPrefix;

private static $registeredLoaders = array();

public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
}

public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
Expand Down Expand Up @@ -300,6 +309,17 @@ public function getApcuPrefix()
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);

if (null === $this->vendorDir) {
return;
}

if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else {
unset(self::$registeredLoaders[$this->vendorDir]);
self::$registeredLoaders[$this->vendorDir] = $this;
}
}

/**
Expand All @@ -308,13 +328,17 @@ public function register($prepend = false)
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));

if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}

/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
Expand All @@ -323,6 +347,8 @@ public function loadClass($class)

return true;
}

return null;
}

/**
Expand Down Expand Up @@ -367,6 +393,16 @@ public function findFile($class)
return $file;
}

/**
* Returns the currently registered loaders indexed by their corresponding vendor directories.
*
* @return self[]
*/
public static function getRegisteredLoaders()
{
return self::$registeredLoaders;
}

private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
Expand Down
Loading