Skip to content

Commit

Permalink
Reproduce result cache bug with type aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jul 13, 2023
1 parent 83bfbdf commit 0fa6903
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ jobs:
mv src/Baz.php.orig src/Baz.php
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
- script: |
cd e2e/bug-9622
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
patch -b src/Foo.php < patch-1.patch
cat baseline-1.neon > phpstan-baseline.neon
../../bin/phpstan -vvv
mv src/Foo.php.orig src/Foo.php
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
steps:
- name: "Checkout"
Expand Down
6 changes: 6 additions & 0 deletions e2e/bug-9622/baseline-1.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
ignoreErrors:
-
message: "#^Offset 'foo' does not exist on array\\{foo\\?\\: int\\}\\.$#"
count: 1
path: src/Bar.php
11 changes: 11 additions & 0 deletions e2e/bug-9622/patch-1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- src/Foo.php 2023-07-13 09:01:37
+++ src/Foo.php 2023-07-13 09:02:20
@@ -3,7 +3,7 @@
namespace Bug9622;

/**
- * @phpstan-type AnArray array{foo: int}
+ * @phpstan-type AnArray array{foo?: int}
*/
class Foo
{
Empty file.
7 changes: 7 additions & 0 deletions e2e/bug-9622/phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
includes:
- phpstan-baseline.neon

parameters:
level: 8
paths:
- src
19 changes: 19 additions & 0 deletions e2e/bug-9622/src/Bar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Bug9622;

/**
* @phpstan-import-type AnArray from Foo
*/
class Bar
{

/**
* @param AnArray $a
*/
public function doFoo(array $a): void
{
echo 1 + $a['foo'];
}

}
11 changes: 11 additions & 0 deletions e2e/bug-9622/src/Foo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Bug9622;

/**
* @phpstan-type AnArray array{foo: int}
*/
class Foo
{

}

0 comments on commit 0fa6903

Please sign in to comment.