Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10855dc

Browse files
committed
Remove functions from TypeSpecifyingFunctionsDynamicReturnTypeExtension
1 parent 819b764 commit 10855dc

5 files changed

Lines changed: 33 additions & 34 deletions

File tree

src/Analyser/NodeScopeResolver.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,11 +2162,7 @@ static function (?Type $offsetType, Type $valueType, bool $optional) use (&$arra
21622162
$className = $scope->resolveName($expr->class);
21632163
if ($this->reflectionProvider->hasClass($className)) {
21642164
$classReflection = $this->reflectionProvider->getClass($className);
2165-
if (is_string($expr->name)) {
2166-
$methodName = $expr->name;
2167-
} else {
2168-
$methodName = $expr->name->name;
2169-
}
2165+
$methodName = $expr->name->name;
21702166
if ($classReflection->hasMethod($methodName)) {
21712167
$methodReflection = $classReflection->getMethod($methodName, $scope);
21722168
$parametersAcceptor = ParametersAcceptorSelector::selectFromArgs(

src/Type/Php/TypeSpecifyingFunctionsDynamicReturnTypeExtension.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,10 @@ public function setTypeSpecifier(TypeSpecifier $typeSpecifier): void
3838
public function isFunctionSupported(FunctionReflection $functionReflection): bool
3939
{
4040
return in_array($functionReflection->getName(), [
41-
'array_is_list',
4241
'array_key_exists',
4342
'key_exists',
4443
'in_array',
45-
'is_numeric',
46-
'is_int',
47-
'is_array',
48-
'is_bool',
49-
'is_callable',
50-
'is_float',
51-
'is_double',
52-
'is_real',
53-
'is_iterable',
54-
'is_null',
55-
'is_object',
56-
'is_scalar',
57-
'is_string',
5844
'is_subclass_of',
59-
'is_countable',
6045
], true);
6146
}
6247

stubs/arrayFunctions.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ function array_udiff(
6767

6868
/**
6969
* @param array<array-key, mixed> $value
70-
* @phpstan-assert-if-true list<mixed> $value
70+
* @return ($value is list ? true : false)
7171
*/
7272
function array_is_list(array $value): bool {}

stubs/core.stub

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,5 +308,6 @@ function headers_sent(string &$filename = null, int &$line = null): bool {}
308308

309309
/**
310310
* @param-out callable-string $callable_name
311+
* @return ($value is callable ? true : false)
311312
*/
312313
function is_callable(mixed $value, bool $syntax_only = false, string &$callable_name = null): bool {}

stubs/typeCheckingFunctions.stub

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,103 @@
11
<?php
22

33
/**
4-
* @phpstan-assert-if-true string $value
4+
* @return ($value is string ? true : false)
55
*/
66
function is_string(mixed $value): bool
77
{
88

99
}
1010

1111
/**
12-
* @phpstan-assert-if-true float $value
12+
* @return ($value is float ? true : false)
1313
*/
1414
function is_float(mixed $value): bool
1515
{
1616

1717
}
1818

1919
/**
20-
* @phpstan-assert-if-true float $value
20+
* @return ($value is float ? true : false)
2121
*/
2222
function is_double(mixed $value): bool
2323
{
2424

2525
}
2626

2727
/**
28-
* @phpstan-assert-if-true float $value
28+
* @return ($value is float ? true : false)
2929
*/
3030
function is_real(mixed $value): bool
3131
{
3232

3333
}
3434

3535
/**
36-
* @phpstan-assert-if-true float|int|numeric-string $value
36+
* @return ($value is float|int|numeric-string ? true : false)
3737
*/
3838
function is_numeric(mixed $value): bool
3939
{
4040

4141
}
4242

4343
/**
44-
* @phpstan-assert-if-true null $value
44+
* @return ($value is null ? true : false)
4545
*/
4646
function is_null(mixed $value): bool
4747
{
4848

4949
}
5050

5151
/**
52-
* @phpstan-assert-if-true bool $value
52+
* @return ($value is bool ? true : false)
5353
*/
5454
function is_bool(mixed $value): bool
5555
{
5656

5757
}
5858

5959
/**
60-
* @phpstan-assert-if-true array<array-key, mixed>|\Countable $value
60+
* @return ($value is array<array-key, mixed>|\Countable ? true : false)
6161
*/
6262
function is_countable(mixed $value): bool
6363
{
6464

6565
}
6666

6767
/**
68-
* @phpstan-assert-if-true object $value
68+
* @return ($value is object ? true : false)
6969
*/
7070
function is_object(mixed $value): bool
7171
{
7272

7373
}
7474

7575
/**
76-
* @phpstan-assert-if-true scalar $value
76+
* @return ($value is scalar ? true : false)
7777
*/
7878
function is_scalar(mixed $value): bool
7979
{
8080

8181
}
8282

8383
/**
84-
* @phpstan-assert-if-true int $value
84+
* @return ($value is int ? true : false)
8585
*/
8686
function is_int(mixed $value): bool
8787
{
8888

8989
}
9090

9191
/**
92-
* @phpstan-assert-if-true int $value
92+
* @return ($value is int ? true : false)
9393
*/
9494
function is_integer(mixed $value): bool
9595
{
9696

9797
}
9898

9999
/**
100-
* @phpstan-assert-if-true int $value
100+
* @return ($value is int ? true : false)
101101
*/
102102
function is_long(mixed $value): bool
103103
{
@@ -106,8 +106,25 @@ function is_long(mixed $value): bool
106106

107107
/**
108108
* @phpstan-assert-if-true resource $value
109+
* @return bool
109110
*/
110111
function is_resource(mixed $value): bool
111112
{
112113

113114
}
115+
116+
/**
117+
* @return ($value is array ? true : false)
118+
*/
119+
function is_array(mixed $value): bool
120+
{
121+
122+
}
123+
124+
/**
125+
* @return ($value is iterable<mixed, mixed> ? true : false)
126+
*/
127+
function is_iterable(mixed $value): bool
128+
{
129+
130+
}

0 commit comments

Comments
 (0)