Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Jan 13, 2026

Most errors in the resultCache.php contain the same path and filePath, see e.g.

...
\PHPStan\Analyser\Error::__set_state(array(
       'message' => 'Doing instanceof PHPStan\\Type\\FloatType is error-prone and deprecated. Use Type::isFloat() instead.',
       'file' => '/Users/m.staab/dvl/phpstan-src/src/Type/Generic/TemplateTypeFactory.php',
       'line' => 82,
       'canBeIgnored' => true,
       'filePath' => '/Users/m.staab/dvl/phpstan-src/src/Type/Generic/TemplateTypeFactory.php',
       'traitFilePath' => NULL,
       'tip' => 'Learn more: <fg=cyan>https://phpstan.org/blog/why-is-instanceof-type-wrong-and-getting-deprecated</>',
       'nodeLine' => 82,
       'nodeType' => 'PhpParser\\Node\\Expr\\Instanceof_',
       'identifier' => 'phpstanApi.instanceofType',
       'metadata' => 
      array (
      ),
       'fixedErrorDiff' => NULL,
    )),
...

since we already have a fallback logic like

	public function getFilePath(): string
	{
		if ($this->filePath === null) {
			return $this->file;
		}

		return $this->filePath;
	}

we can just assign null to filePath and save 1% of result-cache size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant