You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 962c833
Browse filesBrowse the repository at this point in the historyBrowse files
$scope->fileDependency() on top of value dependencies
$scope->fileDependency($path) declares that the analysis of the current file
depends on the contents of another file - a data file, a template, a
docblock in a PHP file - that is read without PHPStan knowing about it. It is
a value dependency through FileResultCacheValueExtension: the value is the
hash of the file, or that the file does not exist, so creating, changing or
deleting it re-analyses the files that declared it. The path is stored
relative to the same directory as the other paths in the result cache.
A dependency of the analysed file on itself is dropped, the file is
re-analysed when it changes anyway.
RequireFileExistsRule declares the paths on the scope now, and the paths
from the deprecated RuleErrorBuilder::fileDependency() are declared on the
scope of the rule's node.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GdwtgiEHwkF5BTz73jgHQQ
Copy file name to clipboardExpand all lines: .github/workflows/e2e-tests.yml
+128Lines changed: 128 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -507,6 +507,134 @@ jobs:
507
507
echo "$OUTPUT"
508
508
../bashunit -a contains 'UsesLogger.php:7:Call to an undefined method ResultCacheE2EValueDependency\Mailer::log().' "$OUTPUT"
509
509
../bashunit -a contains 'LoggerTrait.php (in context of class ResultCacheE2EValueDependency\UsesLoggerTrait):10:Call to an undefined method ResultCacheE2EValueDependency\Mailer::log().' "$OUTPUT"
510
+
- script: |
511
+
cd e2e/result-cache-file-dependency
512
+
composer install
513
+
OUTPUT=$(../bashunit -a exit_code "1" "../../bin/phpstan analyse -vv --error-format raw")
514
+
echo "$OUTPUT"
515
+
../bashunit -a contains "UsesFunction.php:10:Function ResultCacheE2EFileDependency\usesFunction() should return 'none' but returns 'function-1'." "$OUTPUT"
516
+
../bashunit -a contains "UsesMethod.php:10:Function ResultCacheE2EFileDependency\usesMethod() should return 'none' but returns 'method-1'." "$OUTPUT"
517
+
../bashunit -a contains "UsesStaticMethod.php:10:Function ResultCacheE2EFileDependency\usesStaticMethod() should return 'none' but returns 'static-method-1'." "$OUTPUT"
518
+
../bashunit -a contains 'Holder.php:17:Method ResultCacheE2EFileDependency\Holder::get() should return int but returns string.' "$OUTPUT"
519
+
../bashunit -a contains 'UsesHolder.php:9:Function ResultCacheE2EFileDependency\usesHolder() should return int but returns string.' "$OUTPUT"
520
+
../bashunit -a contains 'UsesDeprecatedConfig.php:7:Deprecated config asks for an error.' "$OUTPUT"
521
+
../bashunit -a not_contains 'Config asks for an error.' "$OUTPUT"
522
+
# The paths declared with the deprecated RuleErrorBuilder::fileDependency() are declared on the
../bashunit -a equals '1' "$(echo "$INFO" | jq --raw-output '.filesToAnalyseCount')"
558
+
OUTPUT=$(../bashunit -a exit_code "1" "../../bin/phpstan analyse -vv --error-format raw")
559
+
echo "$OUTPUT"
560
+
../bashunit -a contains "UsesFunction.php:10:Function ResultCacheE2EFileDependency\usesFunction() should return 'none' but returns 'function-2'." "$OUTPUT"
../bashunit -a equals '1' "$(echo "$INFO" | jq --raw-output '.filesToAnalyseCount')"
572
+
OUTPUT=$(../bashunit -a exit_code "1" "../../bin/phpstan analyse -vv --error-format raw")
573
+
echo "$OUTPUT"
574
+
../bashunit -a contains "UsesStaticMethod.php:10:Function ResultCacheE2EFileDependency\usesStaticMethod() should return 'none' but returns 'static-method-2'." "$OUTPUT"
575
+
# Scope::getFile() is not the file to re-analyse when the extension runs outside the walk of the
576
+
# analysed file: the type of Holder::$value is inferred from the constructor on a scope of
577
+
# src/Holder.php, whenever the property is first needed - in the analysis of src/Holder.php, or of
578
+
# src/UsesHolder.php reading it - and it is cached. So it is what src/Holder.php declares that
579
+
# depends on data/holder.txt: a change of it re-analyses src/Holder.php and the files depending on it.
../bashunit -a equals '1' "$(echo "$INFO" | jq --raw-output '.filesToAnalyseCount')"
594
+
OUTPUT=$(../bashunit -a exit_code "1" "../../bin/phpstan analyse -vv --error-format raw")
595
+
echo "$OUTPUT"
596
+
../bashunit -a contains "UsesFunction.php:10:Function ResultCacheE2EFileDependency\usesFunction() should return 'none' but returns 'missing'." "$OUTPUT"
../bashunit -a equals '1' "$(echo "$INFO" | jq --raw-output '.filesToAnalyseCount')"
601
+
OUTPUT=$(../bashunit -a exit_code "1" "../../bin/phpstan analyse -vv --error-format raw")
602
+
echo "$OUTPUT"
603
+
../bashunit -a contains "UsesFunction.php:10:Function ResultCacheE2EFileDependency\usesFunction() should return 'none' but returns 'function-3'." "$OUTPUT"
0 commit comments