Skip to content

Commit c743db0

Browse files
authored
Merge branch '2.1.x' into Assert-and-throws-are-side-effects
2 parents 36f05c7 + 33dc757 commit c743db0

File tree

108 files changed

+1999
-509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+1999
-509
lines changed

Diff for: .github/workflows/e2e-tests.yml

+10
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,16 @@ jobs:
233233
cd e2e/bug-11857
234234
composer install
235235
../../bin/phpstan
236+
- script: |
237+
cd e2e/result-cache-meta-extension
238+
composer install
239+
../../bin/phpstan -vvv
240+
../../bin/phpstan -vvv --fail-without-result-cache
241+
echo 'modified-hash' > hash.txt
242+
OUTPUT=$(../bashunit -a exit_code "2" "../../bin/phpstan -vvv --fail-without-result-cache")
243+
echo "$OUTPUT"
244+
../bashunit -a matches "Note: Using configuration file .+phpstan.neon." "$OUTPUT"
245+
../bashunit -a contains 'Result cache not used because the metadata do not match: metaExtensions' "$OUTPUT"
236246
237247
steps:
238248
- name: "Checkout"

Diff for: composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515
"hoa/compiler": "3.17.08.08",
1616
"hoa/exception": "^1.0",
1717
"hoa/file": "1.17.07.11",
18-
"jetbrains/phpstorm-stubs": "dev-master#db675e059f57071e8209c99075128b92d8a727e7",
18+
"jetbrains/phpstorm-stubs": "dev-master#62a683f61d9ea11ef8caf8b2ad54e59e92b2c670",
1919
"nette/bootstrap": "^3.0",
2020
"nette/di": "^3.1.4",
2121
"nette/neon": "3.3.4",
2222
"nette/php-generator": "3.6.9",
2323
"nette/schema": "^1.2.2",
2424
"nette/utils": "^3.2.5",
25-
"nikic/php-parser": "^5.3.0",
25+
"nikic/php-parser": "^5.4.0",
2626
"ondram/ci-detector": "^3.4.0",
27-
"ondrejmirtes/better-reflection": "6.49.0.0",
27+
"ondrejmirtes/better-reflection": "6.51.0.1",
2828
"phpstan/php-8-stubs": "0.4.9",
2929
"phpstan/phpdoc-parser": "2.0.0",
3030
"psr/http-message": "^1.1",

Diff for: composer.lock

+20-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: conf/config.level0.neon

-12
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
parameters:
22
customRulesetUsed: false
33

4-
conditionalTags:
5-
PHPStan\Rules\Properties\UninitializedPropertyRule:
6-
phpstan.rules.rule: %checkUninitializedProperties%
7-
84
rules:
95
- PHPStan\Rules\Api\ApiInstanceofRule
106
- PHPStan\Rules\Api\ApiInstanceofTypeRule
@@ -218,9 +214,6 @@ services:
218214
tags:
219215
- phpstan.rules.rule
220216

221-
-
222-
class: PHPStan\Rules\Properties\UninitializedPropertyRule
223-
224217
-
225218
class: PHPStan\Rules\Properties\WritingToReadOnlyPropertiesRule
226219
arguments:
@@ -250,11 +243,6 @@ services:
250243
tags:
251244
- phpstan.rules.rule
252245

253-
-
254-
class: PHPStan\Reflection\ConstructorsHelper
255-
arguments:
256-
additionalConstructors: %additionalConstructors%
257-
258246
-
259247
class: PHPStan\Rules\Keywords\RequireFileExistsRule
260248
arguments:

Diff for: conf/config.level3.neon

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ rules:
2222
- PHPStan\Rules\Properties\ReadOnlyPropertyAssignRefRule
2323
- PHPStan\Rules\Properties\ReadOnlyByPhpDocPropertyAssignRefRule
2424
- PHPStan\Rules\Properties\SetNonVirtualPropertyHookAssignRule
25-
- PHPStan\Rules\Properties\ShortGetPropertyHookReturnTypeRule
2625
- PHPStan\Rules\Properties\TypesAssignedToPropertiesRule
2726
- PHPStan\Rules\Variables\ParameterOutAssignedTypeRule
2827
- PHPStan\Rules\Variables\ParameterOutExecutionEndTypeRule

Diff for: conf/config.neon

+13-5
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ conditionalTags:
211211
phpstan.rules.rule: %exceptions.check.missingCheckedExceptionInThrows%
212212
PHPStan\Rules\Exceptions\MissingCheckedExceptionInPropertyHookThrowsRule:
213213
phpstan.rules.rule: %exceptions.check.missingCheckedExceptionInThrows%
214+
PHPStan\Rules\Properties\UninitializedPropertyRule:
215+
phpstan.rules.rule: %checkUninitializedProperties%
214216

215217
services:
216218
-
@@ -320,11 +322,6 @@ services:
320322
tags:
321323
- phpstan.parser.richParserNodeVisitor
322324

323-
-
324-
class: PHPStan\Parser\PropertyHookNameVisitor
325-
tags:
326-
- phpstan.parser.richParserNodeVisitor
327-
328325
-
329326
class: PHPStan\Node\Printer\ExprPrinter
330327

@@ -739,6 +736,11 @@ services:
739736
tags:
740737
- phpstan.broker.dynamicMethodReturnTypeExtension
741738

739+
-
740+
class: PHPStan\Reflection\ConstructorsHelper
741+
arguments:
742+
additionalConstructors: %additionalConstructors%
743+
742744
-
743745
class: PHPStan\Reflection\RequireExtension\RequireExtendsMethodsClassReflectionExtension
744746

@@ -991,6 +993,9 @@ services:
991993
-
992994
class: PHPStan\Rules\Methods\MethodParameterComparisonHelper
993995

996+
-
997+
class: PHPStan\Rules\Methods\MethodVisibilityComparisonHelper
998+
994999
-
9951000
class: PHPStan\Rules\MissingTypehintCheck
9961001
arguments:
@@ -1039,6 +1044,9 @@ services:
10391044
reportMagicProperties: %reportMagicProperties%
10401045
checkDynamicProperties: %checkDynamicProperties%
10411046

1047+
-
1048+
class: PHPStan\Rules\Properties\UninitializedPropertyRule
1049+
10421050
-
10431051
class: PHPStan\Rules\Properties\LazyReadWritePropertiesExtensionProvider
10441052

Diff for: e2e/result-cache-meta-extension/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor

Diff for: e2e/result-cache-meta-extension/composer.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"autoload-dev": {
3+
"classmap": ["src/"]
4+
}
5+
}

Diff for: e2e/result-cache-meta-extension/composer.lock

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: e2e/result-cache-meta-extension/hash.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
initial-hash

Diff for: e2e/result-cache-meta-extension/phpstan.neon

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
parameters:
2+
level: 8
3+
paths:
4+
- src
5+
6+
services:
7+
-
8+
class: ResultCacheE2E\MetaExtension\DummyResultCacheMetaExtension
9+
tags:
10+
- phpstan.resultCacheMetaExtension
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ResultCacheE2E\MetaExtension;
6+
7+
use PHPStan\Analyser\ResultCache\ResultCacheMetaExtension;
8+
9+
final class DummyResultCacheMetaExtension implements ResultCacheMetaExtension
10+
{
11+
public function getKey(): string
12+
{
13+
return 'e2e-dummy-result-cache-meta-extension';
14+
}
15+
16+
public function getHash(): string
17+
{
18+
// @phpstan-ignore argument.type (the file is always present so this won't pass `false` as an argument)
19+
return trim(file_get_contents(__DIR__ . '/../hash.txt'));
20+
}
21+
}

Diff for: issue-bot/playground.neon

+8
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@ rules:
33
- PHPStan\Rules\Playground\MethodNeverRule
44
- PHPStan\Rules\Playground\NotAnalysedTraitRule
55
- PHPStan\Rules\Playground\NoPhpCodeRule
6+
7+
conditionalTags:
8+
PHPStan\Rules\Playground\StaticVarWithoutTypeRule:
9+
phpstan.rules.rule: %checkImplicitMixed%
10+
11+
services:
12+
-
13+
class: PHPStan\Rules\Playground\StaticVarWithoutTypeRule

Diff for: phpstan-baseline.neon

-24
Original file line numberDiff line numberDiff line change
@@ -1455,30 +1455,12 @@ parameters:
14551455
count: 1
14561456
path: src/Type/Php/ArrayCombineFunctionReturnTypeExtension.php
14571457

1458-
-
1459-
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantBooleanType is error\-prone and deprecated\. Use Type\:\:isTrue\(\) or Type\:\:isFalse\(\) instead\.$#'
1460-
identifier: phpstanApi.instanceofType
1461-
count: 1
1462-
path: src/Type/Php/ArrayFilterFunctionReturnTypeHelper.php
1463-
14641458
-
14651459
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantStringType is error\-prone and deprecated\. Use Type\:\:getConstantStrings\(\) instead\.$#'
14661460
identifier: phpstanApi.instanceofType
14671461
count: 1
14681462
path: src/Type/Php/ArrayKeyExistsFunctionTypeSpecifyingExtension.php
14691463

1470-
-
1471-
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantArrayType is error\-prone and deprecated\. Use Type\:\:getConstantArrays\(\) instead\.$#'
1472-
identifier: phpstanApi.instanceofType
1473-
count: 4
1474-
path: src/Type/Php/ArrayMergeFunctionDynamicReturnTypeExtension.php
1475-
1476-
-
1477-
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantBooleanType is error\-prone and deprecated\. Use Type\:\:isTrue\(\) or Type\:\:isFalse\(\) instead\.$#'
1478-
identifier: phpstanApi.instanceofType
1479-
count: 1
1480-
path: src/Type/Php/ArraySearchFunctionDynamicReturnTypeExtension.php
1481-
14821464
-
14831465
message: '#^Doing instanceof PHPStan\\Type\\ConstantScalarType is error\-prone and deprecated\. Use Type\:\:isConstantScalarValue\(\) or Type\:\:getConstantScalarTypes\(\) or Type\:\:getConstantScalarValues\(\) instead\.$#'
14841466
identifier: phpstanApi.instanceofType
@@ -1539,12 +1521,6 @@ parameters:
15391521
count: 1
15401522
path: src/Type/Php/FunctionExistsFunctionTypeSpecifyingExtension.php
15411523

1542-
-
1543-
message: '#^Doing instanceof PHPStan\\Type\\ConstantScalarType is error\-prone and deprecated\. Use Type\:\:isConstantScalarValue\(\) or Type\:\:getConstantScalarTypes\(\) or Type\:\:getConstantScalarValues\(\) instead\.$#'
1544-
identifier: phpstanApi.instanceofType
1545-
count: 1
1546-
path: src/Type/Php/ImplodeFunctionReturnTypeExtension.php
1547-
15481524
-
15491525
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantStringType is error\-prone and deprecated\. Use Type\:\:getConstantStrings\(\) instead\.$#'
15501526
identifier: phpstanApi.instanceofType

Diff for: src/Analyser/DirectInternalScopeFactory.php

-11
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
use PHPStan\Node\Printer\ExprPrinter;
88
use PHPStan\Parser\Parser;
99
use PHPStan\Php\PhpVersion;
10-
use PHPStan\Reflection\FunctionReflection;
1110
use PHPStan\Reflection\InitializerExprTypeResolver;
12-
use PHPStan\Reflection\MethodReflection;
13-
use PHPStan\Reflection\ParameterReflection;
1411
use PHPStan\Reflection\ParametersAcceptor;
1512
use PHPStan\Reflection\Php\PhpFunctionFromParserNodeReflection;
1613
use PHPStan\Reflection\ReflectionProvider;
@@ -40,14 +37,6 @@ public function __construct(
4037
{
4138
}
4239

43-
/**
44-
* @param array<string, ExpressionTypeHolder> $expressionTypes
45-
* @param array<string, ExpressionTypeHolder> $nativeExpressionTypes
46-
* @param array<string, ConditionalExpressionHolder[]> $conditionalExpressions
47-
* @param list<array{FunctionReflection|MethodReflection|null, ParameterReflection|null}> $inFunctionCallsStack
48-
* @param array<string, true> $currentlyAssignedExpressions
49-
* @param array<string, true> $currentlyAllowedUndefinedExpressions
50-
*/
5140
public function create(
5241
ScopeContext $context,
5342
bool $declareStrictTypes = false,

0 commit comments

Comments
 (0)