Skip to content

Commit

Permalink
Merge branch '2.1.x' into Assert-and-throws-are-side-effects
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-worman authored Jan 8, 2025
2 parents 36f05c7 + 33dc757 commit c743db0
Show file tree
Hide file tree
Showing 108 changed files with 1,999 additions and 509 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,16 @@ jobs:
cd e2e/bug-11857
composer install
../../bin/phpstan
- script: |
cd e2e/result-cache-meta-extension
composer install
../../bin/phpstan -vvv
../../bin/phpstan -vvv --fail-without-result-cache
echo 'modified-hash' > hash.txt
OUTPUT=$(../bashunit -a exit_code "2" "../../bin/phpstan -vvv --fail-without-result-cache")
echo "$OUTPUT"
../bashunit -a matches "Note: Using configuration file .+phpstan.neon." "$OUTPUT"
../bashunit -a contains 'Result cache not used because the metadata do not match: metaExtensions' "$OUTPUT"
steps:
- name: "Checkout"
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
"hoa/compiler": "3.17.08.08",
"hoa/exception": "^1.0",
"hoa/file": "1.17.07.11",
"jetbrains/phpstorm-stubs": "dev-master#db675e059f57071e8209c99075128b92d8a727e7",
"jetbrains/phpstorm-stubs": "dev-master#62a683f61d9ea11ef8caf8b2ad54e59e92b2c670",
"nette/bootstrap": "^3.0",
"nette/di": "^3.1.4",
"nette/neon": "3.3.4",
"nette/php-generator": "3.6.9",
"nette/schema": "^1.2.2",
"nette/utils": "^3.2.5",
"nikic/php-parser": "^5.3.0",
"nikic/php-parser": "^5.4.0",
"ondram/ci-detector": "^3.4.0",
"ondrejmirtes/better-reflection": "6.49.0.0",
"ondrejmirtes/better-reflection": "6.51.0.1",
"phpstan/php-8-stubs": "0.4.9",
"phpstan/phpdoc-parser": "2.0.0",
"psr/http-message": "^1.1",
Expand Down
40 changes: 20 additions & 20 deletions composer.lock

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

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

conditionalTags:
PHPStan\Rules\Properties\UninitializedPropertyRule:
phpstan.rules.rule: %checkUninitializedProperties%

rules:
- PHPStan\Rules\Api\ApiInstanceofRule
- PHPStan\Rules\Api\ApiInstanceofTypeRule
Expand Down Expand Up @@ -218,9 +214,6 @@ services:
tags:
- phpstan.rules.rule

-
class: PHPStan\Rules\Properties\UninitializedPropertyRule

-
class: PHPStan\Rules\Properties\WritingToReadOnlyPropertiesRule
arguments:
Expand Down Expand Up @@ -250,11 +243,6 @@ services:
tags:
- phpstan.rules.rule

-
class: PHPStan\Reflection\ConstructorsHelper
arguments:
additionalConstructors: %additionalConstructors%

-
class: PHPStan\Rules\Keywords\RequireFileExistsRule
arguments:
Expand Down
1 change: 0 additions & 1 deletion conf/config.level3.neon
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ rules:
- PHPStan\Rules\Properties\ReadOnlyPropertyAssignRefRule
- PHPStan\Rules\Properties\ReadOnlyByPhpDocPropertyAssignRefRule
- PHPStan\Rules\Properties\SetNonVirtualPropertyHookAssignRule
- PHPStan\Rules\Properties\ShortGetPropertyHookReturnTypeRule
- PHPStan\Rules\Properties\TypesAssignedToPropertiesRule
- PHPStan\Rules\Variables\ParameterOutAssignedTypeRule
- PHPStan\Rules\Variables\ParameterOutExecutionEndTypeRule
Expand Down
18 changes: 13 additions & 5 deletions conf/config.neon
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ conditionalTags:
phpstan.rules.rule: %exceptions.check.missingCheckedExceptionInThrows%
PHPStan\Rules\Exceptions\MissingCheckedExceptionInPropertyHookThrowsRule:
phpstan.rules.rule: %exceptions.check.missingCheckedExceptionInThrows%
PHPStan\Rules\Properties\UninitializedPropertyRule:
phpstan.rules.rule: %checkUninitializedProperties%

services:
-
Expand Down Expand Up @@ -320,11 +322,6 @@ services:
tags:
- phpstan.parser.richParserNodeVisitor

-
class: PHPStan\Parser\PropertyHookNameVisitor
tags:
- phpstan.parser.richParserNodeVisitor

-
class: PHPStan\Node\Printer\ExprPrinter

Expand Down Expand Up @@ -739,6 +736,11 @@ services:
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension

-
class: PHPStan\Reflection\ConstructorsHelper
arguments:
additionalConstructors: %additionalConstructors%

-
class: PHPStan\Reflection\RequireExtension\RequireExtendsMethodsClassReflectionExtension

Expand Down Expand Up @@ -991,6 +993,9 @@ services:
-
class: PHPStan\Rules\Methods\MethodParameterComparisonHelper

-
class: PHPStan\Rules\Methods\MethodVisibilityComparisonHelper

-
class: PHPStan\Rules\MissingTypehintCheck
arguments:
Expand Down Expand Up @@ -1039,6 +1044,9 @@ services:
reportMagicProperties: %reportMagicProperties%
checkDynamicProperties: %checkDynamicProperties%

-
class: PHPStan\Rules\Properties\UninitializedPropertyRule

-
class: PHPStan\Rules\Properties\LazyReadWritePropertiesExtensionProvider

Expand Down
1 change: 1 addition & 0 deletions e2e/result-cache-meta-extension/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor
5 changes: 5 additions & 0 deletions e2e/result-cache-meta-extension/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"autoload-dev": {
"classmap": ["src/"]
}
}
18 changes: 18 additions & 0 deletions e2e/result-cache-meta-extension/composer.lock

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

1 change: 1 addition & 0 deletions e2e/result-cache-meta-extension/hash.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
initial-hash
10 changes: 10 additions & 0 deletions e2e/result-cache-meta-extension/phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
parameters:
level: 8
paths:
- src

services:
-
class: ResultCacheE2E\MetaExtension\DummyResultCacheMetaExtension
tags:
- phpstan.resultCacheMetaExtension
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace ResultCacheE2E\MetaExtension;

use PHPStan\Analyser\ResultCache\ResultCacheMetaExtension;

final class DummyResultCacheMetaExtension implements ResultCacheMetaExtension
{
public function getKey(): string
{
return 'e2e-dummy-result-cache-meta-extension';
}

public function getHash(): string
{
// @phpstan-ignore argument.type (the file is always present so this won't pass `false` as an argument)
return trim(file_get_contents(__DIR__ . '/../hash.txt'));
}
}
8 changes: 8 additions & 0 deletions issue-bot/playground.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ rules:
- PHPStan\Rules\Playground\MethodNeverRule
- PHPStan\Rules\Playground\NotAnalysedTraitRule
- PHPStan\Rules\Playground\NoPhpCodeRule

conditionalTags:
PHPStan\Rules\Playground\StaticVarWithoutTypeRule:
phpstan.rules.rule: %checkImplicitMixed%

services:
-
class: PHPStan\Rules\Playground\StaticVarWithoutTypeRule
24 changes: 0 additions & 24 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1455,30 +1455,12 @@ parameters:
count: 1
path: src/Type/Php/ArrayCombineFunctionReturnTypeExtension.php

-
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantBooleanType is error\-prone and deprecated\. Use Type\:\:isTrue\(\) or Type\:\:isFalse\(\) instead\.$#'
identifier: phpstanApi.instanceofType
count: 1
path: src/Type/Php/ArrayFilterFunctionReturnTypeHelper.php

-
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantStringType is error\-prone and deprecated\. Use Type\:\:getConstantStrings\(\) instead\.$#'
identifier: phpstanApi.instanceofType
count: 1
path: src/Type/Php/ArrayKeyExistsFunctionTypeSpecifyingExtension.php

-
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantArrayType is error\-prone and deprecated\. Use Type\:\:getConstantArrays\(\) instead\.$#'
identifier: phpstanApi.instanceofType
count: 4
path: src/Type/Php/ArrayMergeFunctionDynamicReturnTypeExtension.php

-
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantBooleanType is error\-prone and deprecated\. Use Type\:\:isTrue\(\) or Type\:\:isFalse\(\) instead\.$#'
identifier: phpstanApi.instanceofType
count: 1
path: src/Type/Php/ArraySearchFunctionDynamicReturnTypeExtension.php

-
message: '#^Doing instanceof PHPStan\\Type\\ConstantScalarType is error\-prone and deprecated\. Use Type\:\:isConstantScalarValue\(\) or Type\:\:getConstantScalarTypes\(\) or Type\:\:getConstantScalarValues\(\) instead\.$#'
identifier: phpstanApi.instanceofType
Expand Down Expand Up @@ -1539,12 +1521,6 @@ parameters:
count: 1
path: src/Type/Php/FunctionExistsFunctionTypeSpecifyingExtension.php

-
message: '#^Doing instanceof PHPStan\\Type\\ConstantScalarType is error\-prone and deprecated\. Use Type\:\:isConstantScalarValue\(\) or Type\:\:getConstantScalarTypes\(\) or Type\:\:getConstantScalarValues\(\) instead\.$#'
identifier: phpstanApi.instanceofType
count: 1
path: src/Type/Php/ImplodeFunctionReturnTypeExtension.php

-
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantStringType is error\-prone and deprecated\. Use Type\:\:getConstantStrings\(\) instead\.$#'
identifier: phpstanApi.instanceofType
Expand Down
11 changes: 0 additions & 11 deletions src/Analyser/DirectInternalScopeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
use PHPStan\Node\Printer\ExprPrinter;
use PHPStan\Parser\Parser;
use PHPStan\Php\PhpVersion;
use PHPStan\Reflection\FunctionReflection;
use PHPStan\Reflection\InitializerExprTypeResolver;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\ParameterReflection;
use PHPStan\Reflection\ParametersAcceptor;
use PHPStan\Reflection\Php\PhpFunctionFromParserNodeReflection;
use PHPStan\Reflection\ReflectionProvider;
Expand Down Expand Up @@ -40,14 +37,6 @@ public function __construct(
{
}

/**
* @param array<string, ExpressionTypeHolder> $expressionTypes
* @param array<string, ExpressionTypeHolder> $nativeExpressionTypes
* @param array<string, ConditionalExpressionHolder[]> $conditionalExpressions
* @param list<array{FunctionReflection|MethodReflection|null, ParameterReflection|null}> $inFunctionCallsStack
* @param array<string, true> $currentlyAssignedExpressions
* @param array<string, true> $currentlyAllowedUndefinedExpressions
*/
public function create(
ScopeContext $context,
bool $declareStrictTypes = false,
Expand Down
Loading

0 comments on commit c743db0

Please sign in to comment.