Skip to content

Commit

Permalink
Update build-cs
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 6, 2024
1 parent d1f1d46 commit 07ddbb5
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
with:
repository: "phpstan/build-cs"
path: "build-cs"
ref: "1.x"
ref: "2.x"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ lint:
.PHONY: cs-install
cs-install:
git clone https://github.com/phpstan/build-cs.git || true
git -C build-cs fetch origin && git -C build-cs reset --hard origin/1.x
git -C build-cs fetch origin && git -C build-cs reset --hard origin/2.x
composer install --working-dir build-cs

.PHONY: cs
Expand Down
3 changes: 1 addition & 2 deletions src/Mockery/PhpDoc/TypeNodeResolverExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
class TypeNodeResolverExtension implements \PHPStan\PhpDoc\TypeNodeResolverExtension, TypeNodeResolverAwareExtension
{

/** @var TypeNodeResolver */
private $typeNodeResolver;
private TypeNodeResolver $typeNodeResolver;

public function setTypeNodeResolver(TypeNodeResolver $typeNodeResolver): void
{
Expand Down
8 changes: 3 additions & 5 deletions src/Mockery/Reflection/StubMethodReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
class StubMethodReflection implements MethodReflection
{

/** @var ClassReflection */
private $declaringClass;
private ClassReflection $declaringClass;

/** @var string */
private $name;
private string $name;

public function __construct(ClassReflection $declaringClass, string $name)
{
Expand Down Expand Up @@ -68,7 +66,7 @@ public function getVariants(): array
TemplateTypeMap::createEmpty(),
[],
true,
new ObjectType('Mockery\\Expectation')
new ObjectType('Mockery\\Expectation'),
),
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@
class StubMethodsClassReflectionExtension implements MethodsClassReflectionExtension
{

/** @var ReflectionProvider */
private $reflectionProvider;
private ReflectionProvider $reflectionProvider;

/** @var string */
private $stubInterfaceName;
private string $stubInterfaceName;

public function __construct(ReflectionProvider $reflectionProvider, string $stubInterfaceName)
{
Expand Down
10 changes: 3 additions & 7 deletions src/Mockery/Type/StubDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
class StubDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
{

/** @var string */
private $stubInterfaceName;
private string $stubInterfaceName;

/** @var string */
private $stubMethodName;
private string $stubMethodName;

public function __construct(string $stubInterfaceName, string $stubMethodName)
{
Expand All @@ -40,9 +38,7 @@ public function isMethodSupported(MethodReflection $methodReflection): bool
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): ?Type
{
$calledOnType = $scope->getType($methodCall->var)->getObjectClassNames();
$names = array_values(array_filter($calledOnType, static function (string $name) {
return $name !== 'Mockery\\MockInterface';
}));
$names = array_values(array_filter($calledOnType, static fn (string $name) => $name !== 'Mockery\\MockInterface'));
if (count($names) !== 1) {
return null;
}
Expand Down
8 changes: 2 additions & 6 deletions tests/Mockery/MockeryBarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ public function testShouldNotHaveReceived(): void
$this->fooSpy->shouldNotHaveReceived(null)->withArgs(['bar']);
$this->fooSpy->doBar('ccc');
$this->fooSpy->shouldNotHaveReceived('doBar', ['ddd']);
$this->fooSpy->shouldNotHaveReceived('doBar', static function (string $arg): bool {
return $arg !== 'ccc';
});
$this->fooSpy->shouldNotHaveReceived('doBar', static fn (string $arg): bool => $arg !== 'ccc');
}

public function testShouldHaveReceived(): void
Expand All @@ -72,9 +70,7 @@ public function testShouldHaveReceived(): void
$this->fooSpy->shouldHaveReceived('doFoo')->once();
$this->fooSpy->doBar('ccc');
$this->fooSpy->shouldHaveReceived('doBar', ['ccc']);
$this->fooSpy->shouldHaveReceived('doBar', static function (string $arg): bool {
return $arg === 'ccc';
});
$this->fooSpy->shouldHaveReceived('doBar', static fn (string $arg): bool => $arg === 'ccc');
}

}

0 comments on commit 07ddbb5

Please sign in to comment.