Skip to content

Commit aec1a09

Browse files
committed
updated dependencies
1 parent 1fad698 commit aec1a09

10 files changed

+641
-89
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"type": "project",
55
"license": "GPL2",
66
"require": {
7-
"lusitanian/oauth": "^0.8.11"
7+
"lusitanian/oauth": "0.8.*"
88
}
99
}

composer.lock

+6-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/composer/ClassLoader.php

+142-15
Original file line numberDiff line numberDiff line change
@@ -37,57 +37,130 @@
3737
*
3838
* @author Fabien Potencier <fabien@symfony.com>
3939
* @author Jordi Boggiano <j.boggiano@seld.be>
40-
* @see http://www.php-fig.org/psr/psr-0/
41-
* @see http://www.php-fig.org/psr/psr-4/
40+
* @see https://www.php-fig.org/psr/psr-0/
41+
* @see https://www.php-fig.org/psr/psr-4/
4242
*/
4343
class ClassLoader
4444
{
45+
/** @var ?string */
46+
private $vendorDir;
47+
4548
// PSR-4
49+
/**
50+
* @var array[]
51+
* @psalm-var array<string, array<string, int>>
52+
*/
4653
private $prefixLengthsPsr4 = array();
54+
/**
55+
* @var array[]
56+
* @psalm-var array<string, array<int, string>>
57+
*/
4758
private $prefixDirsPsr4 = array();
59+
/**
60+
* @var array[]
61+
* @psalm-var array<string, string>
62+
*/
4863
private $fallbackDirsPsr4 = array();
4964

5065
// PSR-0
66+
/**
67+
* @var array[]
68+
* @psalm-var array<string, array<string, string[]>>
69+
*/
5170
private $prefixesPsr0 = array();
71+
/**
72+
* @var array[]
73+
* @psalm-var array<string, string>
74+
*/
5275
private $fallbackDirsPsr0 = array();
5376

77+
/** @var bool */
5478
private $useIncludePath = false;
79+
80+
/**
81+
* @var string[]
82+
* @psalm-var array<string, string>
83+
*/
5584
private $classMap = array();
85+
86+
/** @var bool */
5687
private $classMapAuthoritative = false;
88+
89+
/**
90+
* @var bool[]
91+
* @psalm-var array<string, bool>
92+
*/
5793
private $missingClasses = array();
94+
95+
/** @var ?string */
5896
private $apcuPrefix;
5997

98+
/**
99+
* @var self[]
100+
*/
101+
private static $registeredLoaders = array();
102+
103+
/**
104+
* @param ?string $vendorDir
105+
*/
106+
public function __construct($vendorDir = null)
107+
{
108+
$this->vendorDir = $vendorDir;
109+
}
110+
111+
/**
112+
* @return string[]
113+
*/
60114
public function getPrefixes()
61115
{
62116
if (!empty($this->prefixesPsr0)) {
63-
return call_user_func_array('array_merge', $this->prefixesPsr0);
117+
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
64118
}
65119

66120
return array();
67121
}
68122

123+
/**
124+
* @return array[]
125+
* @psalm-return array<string, array<int, string>>
126+
*/
69127
public function getPrefixesPsr4()
70128
{
71129
return $this->prefixDirsPsr4;
72130
}
73131

132+
/**
133+
* @return array[]
134+
* @psalm-return array<string, string>
135+
*/
74136
public function getFallbackDirs()
75137
{
76138
return $this->fallbackDirsPsr0;
77139
}
78140

141+
/**
142+
* @return array[]
143+
* @psalm-return array<string, string>
144+
*/
79145
public function getFallbackDirsPsr4()
80146
{
81147
return $this->fallbackDirsPsr4;
82148
}
83149

150+
/**
151+
* @return string[] Array of classname => path
152+
* @psalm-var array<string, string>
153+
*/
84154
public function getClassMap()
85155
{
86156
return $this->classMap;
87157
}
88158

89159
/**
90-
* @param array $classMap Class to filename map
160+
* @param string[] $classMap Class to filename map
161+
* @psalm-param array<string, string> $classMap
162+
*
163+
* @return void
91164
*/
92165
public function addClassMap(array $classMap)
93166
{
@@ -102,9 +175,11 @@ public function addClassMap(array $classMap)
102175
* Registers a set of PSR-0 directories for a given prefix, either
103176
* appending or prepending to the ones previously set for this prefix.
104177
*
105-
* @param string $prefix The prefix
106-
* @param array|string $paths The PSR-0 root directories
107-
* @param bool $prepend Whether to prepend the directories
178+
* @param string $prefix The prefix
179+
* @param string[]|string $paths The PSR-0 root directories
180+
* @param bool $prepend Whether to prepend the directories
181+
*
182+
* @return void
108183
*/
109184
public function add($prefix, $paths, $prepend = false)
110185
{
@@ -147,11 +222,13 @@ public function add($prefix, $paths, $prepend = false)
147222
* Registers a set of PSR-4 directories for a given namespace, either
148223
* appending or prepending to the ones previously set for this namespace.
149224
*
150-
* @param string $prefix The prefix/namespace, with trailing '\\'
151-
* @param array|string $paths The PSR-4 base directories
152-
* @param bool $prepend Whether to prepend the directories
225+
* @param string $prefix The prefix/namespace, with trailing '\\'
226+
* @param string[]|string $paths The PSR-4 base directories
227+
* @param bool $prepend Whether to prepend the directories
153228
*
154229
* @throws \InvalidArgumentException
230+
*
231+
* @return void
155232
*/
156233
public function addPsr4($prefix, $paths, $prepend = false)
157234
{
@@ -195,8 +272,10 @@ public function addPsr4($prefix, $paths, $prepend = false)
195272
* Registers a set of PSR-0 directories for a given prefix,
196273
* replacing any others previously set for this prefix.
197274
*
198-
* @param string $prefix The prefix
199-
* @param array|string $paths The PSR-0 base directories
275+
* @param string $prefix The prefix
276+
* @param string[]|string $paths The PSR-0 base directories
277+
*
278+
* @return void
200279
*/
201280
public function set($prefix, $paths)
202281
{
@@ -211,10 +290,12 @@ public function set($prefix, $paths)
211290
* Registers a set of PSR-4 directories for a given namespace,
212291
* replacing any others previously set for this namespace.
213292
*
214-
* @param string $prefix The prefix/namespace, with trailing '\\'
215-
* @param array|string $paths The PSR-4 base directories
293+
* @param string $prefix The prefix/namespace, with trailing '\\'
294+
* @param string[]|string $paths The PSR-4 base directories
216295
*
217296
* @throws \InvalidArgumentException
297+
*
298+
* @return void
218299
*/
219300
public function setPsr4($prefix, $paths)
220301
{
@@ -234,6 +315,8 @@ public function setPsr4($prefix, $paths)
234315
* Turns on searching the include path for class files.
235316
*
236317
* @param bool $useIncludePath
318+
*
319+
* @return void
237320
*/
238321
public function setUseIncludePath($useIncludePath)
239322
{
@@ -256,6 +339,8 @@ public function getUseIncludePath()
256339
* that have not been registered with the class map.
257340
*
258341
* @param bool $classMapAuthoritative
342+
*
343+
* @return void
259344
*/
260345
public function setClassMapAuthoritative($classMapAuthoritative)
261346
{
@@ -276,6 +361,8 @@ public function isClassMapAuthoritative()
276361
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277362
*
278363
* @param string|null $apcuPrefix
364+
*
365+
* @return void
279366
*/
280367
public function setApcuPrefix($apcuPrefix)
281368
{
@@ -296,25 +383,44 @@ public function getApcuPrefix()
296383
* Registers this instance as an autoloader.
297384
*
298385
* @param bool $prepend Whether to prepend the autoloader or not
386+
*
387+
* @return void
299388
*/
300389
public function register($prepend = false)
301390
{
302391
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
392+
393+
if (null === $this->vendorDir) {
394+
return;
395+
}
396+
397+
if ($prepend) {
398+
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
399+
} else {
400+
unset(self::$registeredLoaders[$this->vendorDir]);
401+
self::$registeredLoaders[$this->vendorDir] = $this;
402+
}
303403
}
304404

305405
/**
306406
* Unregisters this instance as an autoloader.
407+
*
408+
* @return void
307409
*/
308410
public function unregister()
309411
{
310412
spl_autoload_unregister(array($this, 'loadClass'));
413+
414+
if (null !== $this->vendorDir) {
415+
unset(self::$registeredLoaders[$this->vendorDir]);
416+
}
311417
}
312418

313419
/**
314420
* Loads the given class or interface.
315421
*
316422
* @param string $class The name of the class
317-
* @return bool|null True if loaded, null otherwise
423+
* @return true|null True if loaded, null otherwise
318424
*/
319425
public function loadClass($class)
320426
{
@@ -323,6 +429,8 @@ public function loadClass($class)
323429

324430
return true;
325431
}
432+
433+
return null;
326434
}
327435

328436
/**
@@ -367,6 +475,21 @@ public function findFile($class)
367475
return $file;
368476
}
369477

478+
/**
479+
* Returns the currently registered loaders indexed by their corresponding vendor directories.
480+
*
481+
* @return self[]
482+
*/
483+
public static function getRegisteredLoaders()
484+
{
485+
return self::$registeredLoaders;
486+
}
487+
488+
/**
489+
* @param string $class
490+
* @param string $ext
491+
* @return string|false
492+
*/
370493
private function findFileWithExtension($class, $ext)
371494
{
372495
// PSR-4 lookup
@@ -438,6 +561,10 @@ private function findFileWithExtension($class, $ext)
438561
* Scope isolated include.
439562
*
440563
* Prevents access to $this/self from included files.
564+
*
565+
* @param string $file
566+
* @return void
567+
* @private
441568
*/
442569
function includeFile($file)
443570
{

0 commit comments

Comments
 (0)