Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue 8467 ShowCommand regression
- Loading branch information
Showing
4 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Bug8467a; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
/** | ||
* @phpstan-type AutoloadRules array{psr-0?: array<string, string|string[]>, psr-4?: array<string, string|string[]>, classmap?: list<string>, files?: list<string>, exclude-from-classmap?: list<string>} | ||
*/ | ||
interface CompletePackageInterface { | ||
/** | ||
* Returns an associative array of autoloading rules | ||
* | ||
* {"<type>": {"<namespace": "<directory>"}} | ||
* | ||
* Type is either "psr-4", "psr-0", "classmap" or "files". Namespaces are mapped to | ||
* directories for autoloading using the type specified. | ||
* | ||
* @return array Mapping of autoloading rules | ||
* @phpstan-return AutoloadRules | ||
*/ | ||
public function getAutoload(): array; | ||
} | ||
|
||
class Test { | ||
public function foo (CompletePackageInterface $package): void { | ||
if (\count($package->getAutoload()) > 0) { | ||
$autoloadConfig = $package->getAutoload(); | ||
foreach ($autoloadConfig as $type => $autoloads) { | ||
assertType('array<int<0, max>|string, array<string>|string>', $autoloadConfig[$type]); | ||
if ($type === 'psr-0' || $type === 'psr-4') { | ||
|
||
} elseif ($type === 'classmap') { | ||
assertType('list<string>', $autoloadConfig[$type]); | ||
implode(', ', $autoloadConfig[$type]); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters