Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make array access tolerant with isset #1789

Closed
wants to merge 59 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
910ae64
Open 1.9.x-dev
ondrejmirtes Sep 30, 2022
71c7bf8
API Reference deploy - allow manual dispatch
ondrejmirtes Sep 30, 2022
9eed156
Merge branch '1.8.x' into 1.9.x
ondrejmirtes Sep 30, 2022
5886120
Preserve non-empty-array type when generalizing arrays
herndlm Sep 23, 2022
cac726c
Merge remote-tracking branch 'origin/1.8.x' into 1.9.x
ondrejmirtes Oct 2, 2022
c7367b3
Merge branch '1.8.x' into 1.9.x
ondrejmirtes Oct 2, 2022
7bc0c81
Implement array list type
rvanvelzen Sep 16, 2022
7f6ae40
Fix array_chunk extension
rvanvelzen Sep 29, 2022
70c91a4
ConstantArrayType::getAllArrays() should only return lists for list
rvanvelzen Sep 29, 2022
599d68b
Fix issues in PHPStan itself
rvanvelzen Sep 29, 2022
b1bc16b
Fix ConstantArrayType::getKeysArray() and ::getValuesArray()
rvanvelzen Sep 29, 2022
8a86431
Fix PHP<8 tests
rvanvelzen Sep 29, 2022
4e61bf6
Always parse list in signature maps as list
rvanvelzen Sep 30, 2022
d1fbda4
Completely disable list type when feature toggle is disabled
rvanvelzen Sep 30, 2022
6175050
Fix new tests
rvanvelzen Oct 1, 2022
39320da
NativeFunctionReflectionProvider - caching array no longer static
ondrejmirtes Oct 2, 2022
e29ffc2
Fix test - container is created by no longer crashes on parse error b…
ondrejmirtes Oct 2, 2022
df10689
TypeUtils::getDirectClassNames() returns a list
ondrejmirtes Oct 2, 2022
3d42a8b
Use ExtendedMethodReflection in more places
ondrejmirtes Oct 3, 2022
f94f576
Use ExtendedMethodReflection even in more places
ondrejmirtes Oct 3, 2022
be82772
TypeSpecifier - unified MethodCall with StaticCall
ondrejmirtes Oct 3, 2022
8b98dfc
Merge branch '1.8.x' into 1.9.x
ondrejmirtes Oct 3, 2022
4251678
Update compiler to v6.1.5
renovate[bot] Oct 3, 2022
5cf39bc
Merge branch '1.8.x' into 1.9.x
ondrejmirtes Oct 3, 2022
2796f8d
There's no valid use-case to implement Scope or FunctionReflection
ondrejmirtes Oct 3, 2022
8c4a541
PoC assertions
rvanvelzen May 1, 2022
ecb8061
Verify templated asserts
rvanvelzen May 16, 2022
283fbfe
Remove useless implementations
rvanvelzen May 16, 2022
57e0a58
Fix always true/false checks
rvanvelzen May 16, 2022
8f39d8e
Test stubs and inheritance
rvanvelzen May 19, 2022
32ebb62
Use only a single array of tags and fix inheritance
rvanvelzen May 19, 2022
62d298b
Add rules and tests
rvanvelzen May 19, 2022
4c3e787
Remove unused 'this' arg
rvanvelzen May 19, 2022
e2dd07b
Prevent errors from class template types
rvanvelzen May 19, 2022
0511e36
Add empty pseudo-type (used by PHPUnit)
rvanvelzen May 19, 2022
5e1055c
Improve unresolved template check
rvanvelzen May 20, 2022
a2f4307
Simplify used expressions
rvanvelzen Sep 30, 2022
5d5999f
Test methods and properties
rvanvelzen Sep 30, 2022
211e331
Remove ParametersAcceptorWithAsserts
ondrejmirtes Oct 3, 2022
1c764c5
TypeSpecifier - solve generics
ondrejmirtes Oct 3, 2022
b5055cf
Prevent always true/false errors for unresolvable template types
rvanvelzen Oct 3, 2022
b60aa97
Fix tests
ondrejmirtes Oct 3, 2022
dae2ff2
Fix generic method asserts
ondrejmirtes Oct 3, 2022
7768b5a
Simplification
ondrejmirtes Oct 3, 2022
b0afb67
Test class-level template type method assert
ondrejmirtes Oct 3, 2022
c21f3e8
Remove unused methods
ondrejmirtes Oct 3, 2022
e86d190
Microoptimization
ondrejmirtes Oct 3, 2022
a339873
More tests - proving bugs in Rector
ondrejmirtes Oct 3, 2022
737d6bf
Backward compatibility - we do not have to do it but we're nice
ondrejmirtes Oct 3, 2022
b9be0f1
Fix
ondrejmirtes Oct 3, 2022
910313d
Fix again
ondrejmirtes Oct 3, 2022
7473a19
Merge branch '1.8.x' into 1.9.x
ondrejmirtes Oct 3, 2022
ace76ce
Get rid of ScopeIsInClassTypeSpecifyingExtension
ondrejmirtes Oct 3, 2022
ce459af
Merge branch '1.8.x' into 1.9.x
ondrejmirtes Oct 3, 2022
af96839
Merge branch '1.8.x' into 1.9.x
ondrejmirtes Oct 3, 2022
c8c600c
Merge branch '1.8.x' into 1.9.x
ondrejmirtes Oct 3, 2022
1210483
Merge branch '1.8.x' into 1.9.x
ondrejmirtes Oct 3, 2022
98ad726
Remove IsStringFunctionTypeSpecifyingExtension
ondrejmirtes Oct 3, 2022
4c3f696
Make array access tolerant with isset
ahmedash95 Oct 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/apiref.yml
Expand Up @@ -3,6 +3,7 @@
name: "API Reference"

on:
workflow_dispatch:
push:
branches:
- "1.9.x"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/backward-compatibility.yml
Expand Up @@ -6,13 +6,13 @@ on:
pull_request:
push:
branches:
- "1.8.x"
- "1.9.x"
paths:
- 'src/**'
- '.github/workflows/backward-compatibility.yml'

env:
COMPOSER_ROOT_VERSION: "1.8.x-dev"
COMPOSER_ROOT_VERSION: "1.9.x-dev"

concurrency:
group: bc-${{ github.head_ref || github.run_id }} # will be canceled on subsequent pushes in pull requests but not branches
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog-generator.yml
Expand Up @@ -9,7 +9,7 @@ on:
- '.github/workflows/changelog-generator.yml'
push:
branches:
- "1.8.x"
- "1.9.x"
paths:
- 'changelog-generator/**'
- '.github/workflows/changelog-generator.yml'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-tests.yml
Expand Up @@ -10,14 +10,14 @@ on:
- 'changelog-generator/**'
push:
branches:
- "1.8.x"
- "1.9.x"
paths-ignore:
- 'compiler/**'
- 'apigen/**'
- 'changelog-generator/**'

env:
COMPOSER_ROOT_VERSION: "1.8.x-dev"
COMPOSER_ROOT_VERSION: "1.9.x-dev"

concurrency:
group: e2e-${{ github.head_ref || github.run_id }} # will be canceled on subsequent pushes in pull requests but not branches
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Expand Up @@ -6,10 +6,10 @@ on:
pull_request:
push:
branches:
- "1.8.x"
- "1.9.x"

env:
COMPOSER_ROOT_VERSION: "1.8.x-dev"
COMPOSER_ROOT_VERSION: "1.9.x-dev"

concurrency:
group: lint-${{ github.head_ref || github.run_id }} # will be canceled on subsequent pushes in pull requests but not branches
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/phar.yml
Expand Up @@ -6,9 +6,9 @@ on:
pull_request:
push:
branches:
- "1.8.x"
- "1.9.x"
tags:
- '1.8.*'
- '1.9.*'

concurrency:
group: phar-${{ github.ref }} # will be canceled on subsequent pushes in both branches and pull requests
Expand Down Expand Up @@ -90,14 +90,14 @@ jobs:
- name: "Composer dump"
run: "composer install --no-interaction --no-progress"
env:
COMPOSER_ROOT_VERSION: "1.8.x-dev"
COMPOSER_ROOT_VERSION: "1.9.x-dev"

- name: "Compile PHAR for checksum"
working-directory: "compiler/build"
run: "php box.phar compile --no-parallel"
env:
PHAR_CHECKSUM: "1"
COMPOSER_ROOT_VERSION: "1.8.x-dev"
COMPOSER_ROOT_VERSION: "1.9.x-dev"

- name: "Re-sign PHAR"
run: "php compiler/build/resign.php tmp/phpstan.phar"
Expand All @@ -120,30 +120,30 @@ jobs:
integration-tests:
if: github.event_name == 'pull_request'
needs: compiler-tests
uses: phpstan/phpstan/.github/workflows/integration-tests.yml@1.8.x
uses: phpstan/phpstan/.github/workflows/integration-tests.yml@1.9.x
with:
ref: 1.8.x
ref: 1.9.x
phar-checksum: ${{needs.compiler-tests.outputs.checksum}}

extension-tests:
if: github.event_name == 'pull_request'
needs: compiler-tests
uses: phpstan/phpstan/.github/workflows/extension-tests.yml@1.8.x
uses: phpstan/phpstan/.github/workflows/extension-tests.yml@1.9.x
with:
ref: 1.8.x
ref: 1.9.x
phar-checksum: ${{needs.compiler-tests.outputs.checksum}}

other-tests:
if: github.event_name == 'pull_request'
needs: compiler-tests
uses: phpstan/phpstan/.github/workflows/other-tests.yml@1.8.x
uses: phpstan/phpstan/.github/workflows/other-tests.yml@1.9.x
with:
ref: 1.8.x
ref: 1.9.x
phar-checksum: ${{needs.compiler-tests.outputs.checksum}}

commit:
name: "Commit PHAR"
if: "github.repository_owner == 'phpstan' && (github.ref == 'refs/heads/1.8.x' || startsWith(github.ref, 'refs/tags/'))"
if: "github.repository_owner == 'phpstan' && (github.ref == 'refs/heads/1.9.x' || startsWith(github.ref, 'refs/tags/'))"
needs: compiler-tests
runs-on: "ubuntu-latest"
timeout-minutes: 60
Expand All @@ -159,7 +159,7 @@ jobs:
repository: phpstan/phpstan
path: phpstan-dist
token: ${{ secrets.PAT }}
ref: 1.8.x
ref: 1.9.x

- name: "Get previous pushed dist commit"
id: previous-commit
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static-analysis.yml
Expand Up @@ -10,14 +10,14 @@ on:
- 'changelog-generator/**'
push:
branches:
- "1.8.x"
- "1.9.x"
paths-ignore:
- 'compiler/**'
- 'apigen/**'
- 'changelog-generator/**'

env:
COMPOSER_ROOT_VERSION: "1.8.x-dev"
COMPOSER_ROOT_VERSION: "1.9.x-dev"

concurrency:
group: sa-${{ github.head_ref || github.run_id }} # will be canceled on subsequent pushes in pull requests but not branches
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Expand Up @@ -10,14 +10,14 @@ on:
- 'changelog-generator/**'
push:
branches:
- "1.8.x"
- "1.9.x"
paths-ignore:
- 'compiler/**'
- 'apigen/**'
- 'changelog-generator/**'

env:
COMPOSER_ROOT_VERSION: "1.8.x-dev"
COMPOSER_ROOT_VERSION: "1.9.x-dev"

concurrency:
group: tests-${{ github.head_ref || github.run_id }} # will be canceled on subsequent pushes in pull requests but not branches
Expand Down
16 changes: 0 additions & 16 deletions build/phpstan.neon
Expand Up @@ -103,19 +103,3 @@ services:
class: PHPStan\Internal\ContainerDynamicReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension

scopeIsInClass:
class: PHPStan\Internal\ScopeIsInClassTypeSpecifyingExtension
arguments:
isInMethodName: isInClass
removeNullMethodName: getClassReflection
tags:
- phpstan.typeSpecifier.methodTypeSpecifyingExtension

scopeIsInTrait:
class: PHPStan\Internal\ScopeIsInClassTypeSpecifyingExtension
arguments:
isInMethodName: isInTrait
removeNullMethodName: getTraitReflection
tags:
- phpstan.typeSpecifier.methodTypeSpecifyingExtension
36 changes: 18 additions & 18 deletions compiler/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 conf/bleedingEdge.neon
Expand Up @@ -19,3 +19,4 @@ parameters:
runtimeReflectionRules: true
notAnalysedTrait: true
curlSetOptTypes: true
listType: true
2 changes: 2 additions & 0 deletions conf/config.level2.neon
Expand Up @@ -33,6 +33,8 @@ rules:
- PHPStan\Rules\Operators\InvalidComparisonOperationRule
- PHPStan\Rules\PhpDoc\FunctionConditionalReturnTypeRule
- PHPStan\Rules\PhpDoc\MethodConditionalReturnTypeRule
- PHPStan\Rules\PhpDoc\FunctionAssertRule
- PHPStan\Rules\PhpDoc\MethodAssertRule
- PHPStan\Rules\PhpDoc\IncompatibleClassConstantPhpDocTypeRule
- PHPStan\Rules\PhpDoc\IncompatiblePhpDocTypeRule
- PHPStan\Rules\PhpDoc\IncompatiblePropertyPhpDocTypeRule
Expand Down
11 changes: 6 additions & 5 deletions conf/config.neon
Expand Up @@ -49,6 +49,7 @@ parameters:
runtimeReflectionRules: false
notAnalysedTrait: false
curlSetOptTypes: false
listType: false
fileExtensions:
- php
checkAdvancedIsset: false
Expand Down Expand Up @@ -136,6 +137,7 @@ parameters:
- ../stubs/Exception.stub
- ../stubs/arrayFunctions.stub
- ../stubs/core.stub
- ../stubs/typeCheckingFunctions.stub
earlyTerminatingMethodCalls: []
earlyTerminatingFunctionCalls: []
memoryLimitFile: %tmpDir%/.memory_limit
Expand Down Expand Up @@ -256,6 +258,7 @@ parametersSchema:
runtimeReflectionRules: bool()
notAnalysedTrait: bool()
curlSetOptTypes: bool()
listType: bool()
])
fileExtensions: listOf(string())
checkAdvancedIsset: bool()
Expand Down Expand Up @@ -1015,6 +1018,9 @@ services:
-
class: PHPStan\Rules\PhpDoc\ConditionalReturnTypeRuleHelper

-
class: PHPStan\Rules\PhpDoc\AssertRuleHelper

-
class: PHPStan\Rules\PhpDoc\UnresolvableTypeHelper

Expand Down Expand Up @@ -1648,11 +1654,6 @@ services:
tags:
- phpstan.typeSpecifier.functionTypeSpecifyingExtension

-
class: PHPStan\Type\Php\IsStringFunctionTypeSpecifyingExtension
tags:
- phpstan.typeSpecifier.functionTypeSpecifyingExtension

-
class: PHPStan\Type\Php\IsSubclassOfFunctionTypeSpecifyingExtension
tags:
Expand Down