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
15 changes: 15 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,21 @@ jobs:
OUTPUT=$(../bashunit assert exit_code "1" "../../bin/phpstan analyse -vv --error-format raw")
echo "$OUTPUT"
../bashunit assert contains 'register a class in the container; re-analysing everything.' "$OUTPUT"
- script: |
cd e2e/result-cache-collector-sweep
# Two errors: one from an ordinary rule, one from a rule built on collected data.
OUTPUT=$(../bashunit assert exit_code "1" "../../bin/phpstan analyse -vv --error-format raw")
echo "$OUTPUT"
../bashunit assert contains 'PlainCaller.php:8:Method ResultCacheE2ECollectorSweep\PlainCaller::doPlainCaller() has invalid return type ResultCacheE2ECollectorSweep\Missing.' "$OUTPUT"
../bashunit assert contains 'Caller.php:7:Call to function resultCacheE2ECollectorHelper() on a separate line has no effect.' "$OUTPUT"
# One new file defines both missing symbols. The files with errors are re-analysed - but
# the errors of the collector-backed rule are produced after the cache is written, so the
# file holding one is not in the cached error map and never gets swept.
cp appears/nsfns.php src/nsfns.php
OUTPUT=$(../bashunit assert exit_code "0" "../../bin/phpstan analyse -vv --error-format raw")
echo "$OUTPUT"
../bashunit assert not_contains 'has invalid return type' "$OUTPUT"
../bashunit assert not_contains 'on a separate line has no effect' "$OUTPUT"
- script: |
cd e2e/result-cache-extension-update
composer install
Expand Down
15 changes: 15 additions & 0 deletions e2e/result-cache-collector-sweep/appears/nsfns.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php declare(strict_types = 1);

namespace ResultCacheE2ECollectorSweep;

function resultCacheE2ECollectorHelper(): int
{
echo 'side effect';

return 1;
}

class Missing
{

}
5 changes: 5 additions & 0 deletions e2e/result-cache-collector-sweep/phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
level: 4
tmpDir: tmp
paths:
- src
8 changes: 8 additions & 0 deletions e2e/result-cache-collector-sweep/src/Caller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php declare(strict_types = 1);

namespace ResultCacheE2ECollectorSweep;

function caller(): void
{
resultCacheE2ECollectorHelper();
}
13 changes: 13 additions & 0 deletions e2e/result-cache-collector-sweep/src/PlainCaller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php declare(strict_types = 1);

namespace ResultCacheE2ECollectorSweep;

class PlainCaller
{

public function doPlainCaller(): ?Missing
{
return null;
}

}
6 changes: 6 additions & 0 deletions e2e/result-cache-collector-sweep/src/globalfns.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php declare(strict_types = 1);

function resultCacheE2ECollectorHelper(): int
{
return 1;
}
2 changes: 2 additions & 0 deletions e2e/result-cache-collector-sweep/tmp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.*
Loading