Skip to content
Open
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
2 changes: 2 additions & 0 deletions bin/phpstan
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use PHPStan\Command\ClearResultCacheCommand;
use PHPStan\Command\DiagnoseCommand;
use PHPStan\Command\DumpParametersCommand;
use PHPStan\Command\FixerWorkerCommand;
use PHPStan\Command\Neon2AttributesCommand;
use PHPStan\Command\WorkerCommand;
use PHPStan\Internal\ComposerHelper;
use PHPStan\Turbo\TurboExtensionEnabler;
Expand Down Expand Up @@ -127,5 +128,6 @@ use Symfony\Component\Console\Helper\ProgressBar;
$application->add(new FixerWorkerCommand($reversedComposerAutoloaderProjectPaths));
$application->add(new DumpParametersCommand($reversedComposerAutoloaderProjectPaths));
$application->add(new DiagnoseCommand($reversedComposerAutoloaderProjectPaths));
$application->add(new Neon2AttributesCommand());
$application->run();
})();
2 changes: 2 additions & 0 deletions conf/parametersSchema.neon
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,14 @@ parametersSchema:
analysedPathsFromConfig: listOf(string())
usedLevel: string()
cliAutoloadFile: schema(string(), nullable())
attributeServicesDirectories: listOf(string())

# internal - editor mode
singleReflectionFile: schema(string(), nullable())
singleReflectionInsteadOfFile: schema(string(), nullable())

expandRelativePaths:
- '[attributeServicesDirectories][]'
- '[parameters][paths][]'
- '[parameters][excludePaths][]'
- '[parameters][excludePaths][analyse][]'
Expand Down
2 changes: 1 addition & 1 deletion phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ parameters:
rawMessage: 'Call to static method escape() of internal class Nette\DI\Helpers from outside its root namespace Nette.'
identifier: staticMethod.internalClass
count: 1
path: src/DependencyInjection/AutowiredAttributeServicesExtension.php
path: src/DependencyInjection/AttributeServices/AttributeServicesRegistrar.php

-
rawMessage: 'Call to static method expand() of internal class Nette\DI\Helpers from outside its root namespace Nette.'
Expand Down
12 changes: 12 additions & 0 deletions src/Analyser/ResultCache/ResultCacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ final class ResultCacheManager
* @param string[] $analysedPaths
* @param string[] $analysedPathsFromConfig
* @param string[] $composerAutoloaderProjectPaths
* @param string[] $attributeServicesDirectories
* @param string[] $bootstrapFiles
* @param string[] $scanFiles
* @param string[] $scanDirectories
Expand All @@ -108,6 +109,8 @@ public function __construct(
#[AutowiredParameter]
private array $composerAutoloaderProjectPaths,
#[AutowiredParameter]
private array $attributeServicesDirectories,
#[AutowiredParameter]
private string $usedLevel,
#[AutowiredParameter]
private ?string $cliAutoloadFile,
Expand Down Expand Up @@ -1367,6 +1370,15 @@ private function streamArrayVarExportToHandle($handle, string $file, array $valu
*/
private function changedPackagesProvideContainerClass(?array $projectConfig, array $changedPackagesLookup): bool
{
// Directories from the attributeServicesDirectories section register services straight from
// their classes, so a changed package owning one of them can affect the analysis of every file.
foreach ($this->attributeServicesDirectories as $attributeServicesDirectory) {
$package = $this->packageDependencyResolver->resolveDirectoryPackage($attributeServicesDirectory);
if ($package !== null && array_key_exists($package, $changedPackagesLookup)) {
return true;
}
}

// Extensions registered directly in the project config (services:/rules:) or via an included
// extension neon file: resolve each service class to the package that owns its file.
if ($projectConfig !== null) {
Expand Down
Loading
Loading