Skip to content

Commit

Permalink
[BCB] Removed MissingClosureNativeReturnTypehintRule, no longer neede…
Browse files Browse the repository at this point in the history
…d thanks to type inference
  • Loading branch information
ondrejmirtes committed Sep 12, 2021
1 parent 1baa294 commit 1c34d8d
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 286 deletions.
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions conf/config.level0.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
parameters:
customRulesetUsed: false
missingClosureNativeReturnCheckObjectTypehint: false

conditionalTags:
PHPStan\Rules\Api\ApiInstantiationRule:
Expand All @@ -23,18 +22,13 @@ conditionalTags:
phpstan.rules.rule: %featureToggles.classConstants%
PHPStan\Rules\Functions\ClosureUsesThisRule:
phpstan.rules.rule: %featureToggles.closureUsesThis%
PHPStan\Rules\Missing\MissingClosureNativeReturnTypehintRule:
phpstan.rules.rule: %checkMissingClosureNativeReturnTypehintRule%
PHPStan\Rules\Whitespace\FileWhitespaceRule:
phpstan.rules.rule: %featureToggles.fileWhitespace%
PHPStan\Rules\Properties\UninitializedPropertyRule:
phpstan.rules.rule: %checkUninitializedProperties%
PHPStan\Rules\Properties\OverridingPropertyRule:
phpstan.rules.rule: %featureToggles.overridingProperty%

parametersSchema:
missingClosureNativeReturnCheckObjectTypehint: bool()

rules:
- PHPStan\Rules\Arrays\DuplicateKeysInLiteralArraysRule
- PHPStan\Rules\Arrays\EmptyArrayItemRule
Expand Down Expand Up @@ -162,11 +156,6 @@ services:
tags:
- phpstan.rules.rule

-
class: PHPStan\Rules\Missing\MissingClosureNativeReturnTypehintRule
arguments:
checkObjectTypehint: %missingClosureNativeReturnCheckObjectTypehint%

-
class: PHPStan\Rules\Missing\MissingReturnRule
arguments:
Expand Down
2 changes: 0 additions & 2 deletions conf/config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ parameters:
checkPhpDocMissingReturn: false
checkPhpDocMethodSignatures: false
checkExtraArguments: false
checkMissingClosureNativeReturnTypehintRule: false
checkMissingTypehints: false
checkTooWideReturnTypesInProtectedAndPublicMethods: false
checkUninitializedProperties: false
Expand Down Expand Up @@ -255,7 +254,6 @@ parametersSchema:
checkPhpDocMissingReturn: bool()
checkPhpDocMethodSignatures: bool()
checkExtraArguments: bool()
checkMissingClosureNativeReturnTypehintRule: bool()
checkMissingTypehints: bool()
checkTooWideReturnTypesInProtectedAndPublicMethods: bool()
checkUninitializedProperties: bool()
Expand Down
137 changes: 0 additions & 137 deletions src/Rules/Missing/MissingClosureNativeReturnTypehintRule.php

This file was deleted.

1 change: 1 addition & 0 deletions tests/PHPStan/Analyser/NodeScopeResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ public function dataFileAsserts(): iterable
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5615.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/array_map_multiple.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/range-numeric-string.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/missing-closure-native-return-typehint.php');
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

namespace MissingClosureNativeReturnTypehint;

class Foo
{

public function doFoo()
{
\PHPStan\Testing\assertType('void', (function () {

})());
\PHPStan\Testing\assertType('void', (function () {
return;
})());
\PHPStan\Testing\assertType('Generator<int, 1, mixed, void>', (function (bool $bool) {
if ($bool) {
return;
} else {
yield 1;
}
})());
\PHPStan\Testing\assertType('1|null', (function (bool $bool) {
if ($bool) {
return;
} else {
return 1;
}
})());
\PHPStan\Testing\assertType('1', (function (): int {
return 1;
})());
\PHPStan\Testing\assertType('1|null', (function (bool $bool) {
if ($bool) {
return null;
} else {
return 1;
}
})());
\PHPStan\Testing\assertType('1', (function (bool $bool) {
if ($bool) {
return 1;
}
})());

\PHPStan\Testing\assertType('array(\'foo\' => \'bar\')', (function () {
$array = [
'foo' => 'bar',
];

return $array;
})());
}

}

This file was deleted.

Loading

0 comments on commit 1c34d8d

Please sign in to comment.