Skip to content

Commit

Permalink
load the ReturnTypeWillChange stubs for all versions to allow using i…
Browse files Browse the repository at this point in the history
…t on every PHP version
  • Loading branch information
orklah committed Nov 9, 2021
1 parent f327c98 commit b7e70f3
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 6 deletions.
7 changes: 7 additions & 0 deletions stubs/CoreGenericClasses.phpstub
Expand Up @@ -494,3 +494,10 @@ final class WeakMap implements ArrayAccess, Countable, IteratorAggregate, Traver
*/
public function offsetUnset($offset) {}
}


#[Attribute]
final class ReturnTypeWillChange
{
public function __construct() {}
}
6 changes: 0 additions & 6 deletions stubs/Php81.phpstub
Expand Up @@ -4,12 +4,6 @@ namespace {
/** @return non-empty-list<static> */
public static function cases(): array;
}

#[Attribute]
final class ReturnTypeWillChange
{
public function __construct() {}
}
}

namespace FTP {
Expand Down
42 changes: 42 additions & 0 deletions tests/AttributeTest.php
Expand Up @@ -180,6 +180,48 @@ class Bar implements FoobarInterface {}
class Baz {}
}
'
],
'returnTypeWillChange7.1' => [
'<?php
namespace Rabus\PsalmReturnTypeWillChange;
use EmptyIterator;
use IteratorAggregate;
use ReturnTypeWillChange;
final class EmptyCollection implements IteratorAggregate
{
#[ReturnTypeWillChange]
public function getIterator()
{
return new EmptyIterator();
}
}',
[],
[],
'7.1'
],
'returnTypeWillChange8.1' => [
'<?php
namespace Rabus\PsalmReturnTypeWillChange;
use EmptyIterator;
use IteratorAggregate;
use ReturnTypeWillChange;
final class EmptyCollection implements IteratorAggregate
{
#[ReturnTypeWillChange]
public function getIterator()
{
return new EmptyIterator();
}
}',
[],
[],
'8.1'
]
];
}
Expand Down

0 comments on commit b7e70f3

Please sign in to comment.