Skip to content
Closed
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
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"hoa/compiler": "3.17.08.08",
"hoa/exception": "^1.0",
"hoa/file": "1.17.07.11",
"jetbrains/phpstorm-stubs": "dev-master#709e512210784a7c0a677b3a89d35def844a59b9",
"jetbrains/phpstorm-stubs": "dev-master#2da66a03e379335dba086b0d493c70185eb01ddd",
"nette/bootstrap": "^3.0",
"nette/di": "^3.1.10",
"nette/neon": "3.3.4",
Expand All @@ -35,7 +35,7 @@
"nette/utils": "^3.2.5",
"nikic/php-parser": "^5.8.0",
"ondram/ci-detector": "^4.0",
"ondrejmirtes/better-reflection": "6.70.0.3",
"ondrejmirtes/better-reflection": "dev-feat/versioned-extension-stubs as 6.70.0.4",
"ondrejmirtes/composer-attribute-collector": "^1.2.0",
"ondrejmirtes/php-merge": "^4.1",
"phpstan/php-8-stubs": "0.4.35",
Expand Down Expand Up @@ -80,6 +80,12 @@
"shipmonk/dead-code-detector": "^1.0.0",
"shipmonk/name-collision-detector": "^2.0"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/simPod/BetterReflection"
}
],
"config": {
"platform": {
"php": "8.2.99"
Expand Down
63 changes: 45 additions & 18 deletions composer.lock

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

1 change: 0 additions & 1 deletion conf/config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ parameters:
- ../stubs/iterable.stub
- ../stubs/ArrayObject.stub
- ../stubs/WeakReference.stub
- ../stubs/ext-ds.stub
- ../stubs/ImagickPixel.stub
- ../stubs/PDOStatement.stub
- ../stubs/date.stub
Expand Down
3 changes: 3 additions & 0 deletions src/Analyser/ResultCache/ResultCacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use PHPStan\Internal\ArrayHelper;
use PHPStan\Internal\ComposerHelper;
use PHPStan\PhpDoc\StubFilesProvider;
use PHPStan\Reflection\BetterReflection\SourceStubber\ExtensionVersionProvider;
use PHPStan\ShouldNotHappenException;
use ReflectionClass;
use ReflectionException;
Expand Down Expand Up @@ -98,6 +99,7 @@ public function __construct(
private StubFilesProvider $stubFilesProvider,
private FileHelper $fileHelper,
private PackageDependencyResolver $packageDependencyResolver,
private ExtensionVersionProvider $extensionVersionProvider,
#[AutowiredParameter(ref: '%resultCachePath%')]
private string $cacheFilePath,
#[AutowiredParameter]
Expand Down Expand Up @@ -1468,6 +1470,7 @@ private function getMeta(array $allAnalysedFiles, ?array $projectConfigArray): a
'composerInstalled' => $this->getComposerInstalled(),
'executedFilesHashes' => $this->getExecutedFileHashes(),
'phpExtensions' => $extensions,
'extensionVersions' => $this->extensionVersionProvider->getExtensionVersions(),
'stubFiles' => $this->getStubFiles(),
'level' => $this->usedLevel,
];
Expand Down
25 changes: 25 additions & 0 deletions src/PhpDoc/ExtDsStubFilesExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php declare(strict_types = 1);

namespace PHPStan\PhpDoc;

use PHPStan\DependencyInjection\AutowiredService;
use PHPStan\Reflection\BetterReflection\SourceStubber\ExtensionVersionProvider;

#[AutowiredService]
final class ExtDsStubFilesExtension implements StubFilesExtension
{

public function __construct(private ExtensionVersionProvider $extensionVersionProvider)
{
}

public function getFiles(): array
{
if (($this->extensionVersionProvider->getExtensionVersions()['ds'] ?? null) === 2) {
return [];
}

return [__DIR__ . '/../../stubs/ext-ds.stub'];
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function __construct(
private Cache $cache,
private PhpVersion $phpVersion,
private PhpStormStubsSourceStubber $phpstormStubsSourceStubber,
private SourceStubber\ExtensionVersionProvider $extensionVersionProvider,
private ReflectionSourceStubber $reflectionSourceStubber,
private OptimizedSingleFileSourceLocatorRepository $optimizedSingleFileSourceLocatorRepository,
private OptimizedDirectorySourceLocatorRepository $optimizedDirectorySourceLocatorRepository,
Expand Down Expand Up @@ -188,6 +189,7 @@ public function create(): SourceLocator
new PhpInternalSourceLocator($astPhp8Locator, $this->phpstormStubsSourceStubber),
$this->cache,
$this->phpVersion,
$this->extensionVersionProvider,
));

// Custom autoloaders registered *after* Composer's class loader are
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use PHPStan\Cache\Cache;
use PHPStan\Internal\ComposerHelper;
use PHPStan\Php\PhpVersion;
use PHPStan\Reflection\BetterReflection\SourceStubber\ExtensionVersionProvider;
use function array_key_exists;
use function is_array;
use function is_file;
Expand Down Expand Up @@ -59,6 +60,7 @@ public function __construct(
private SourceLocator $inner,
private Cache $cache,
private PhpVersion $phpVersion,
private ExtensionVersionProvider $extensionVersionProvider,
)
{
}
Expand Down Expand Up @@ -162,10 +164,11 @@ public function locateIdentifiersByType(Reflector $reflector, IdentifierType $id
private function getVariableCacheKey(): string
{
return $this->variableCacheKey ??= sprintf(
'v2-%s-%s-%s',
'v3-%s-%s-%s-%s',
ComposerHelper::getBetterReflectionVersion(),
ComposerHelper::getPhpStormStubsVersion(),
$this->phpVersion->getVersionString(),
$this->extensionVersionProvider->getCacheKey(),
);
}

Expand Down
Loading
Loading