Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vimeo/psalm
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5.6.0
Choose a base ref
...
head repository: vimeo/psalm
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5.7.0
Choose a head ref
Loading
Showing with 2,926 additions and 3,052 deletions.
  1. +2 −2 .github/workflows/bcc.yml
  2. +2 −2 .github/workflows/build-phar.yml
  3. +6 −6 .github/workflows/ci.yml
  4. +3 −0 .github/workflows/shepherd.yml
  5. +6 −4 .github/workflows/windows-ci.yml
  6. +6 −5 composer.json
  7. +4 −1 config.xsd
  8. +181 −1,108 dictionaries/CallMap.php
  9. +4 −4 dictionaries/CallMap_71_delta.php
  10. +7 −7 dictionaries/CallMap_72_delta.php
  11. +44 −0 dictionaries/CallMap_73_delta.php
  12. +16 −0 dictionaries/CallMap_74_delta.php
  13. +308 −78 dictionaries/CallMap_80_delta.php
  14. +35 −31 dictionaries/CallMap_81_delta.php
  15. +9 −1 dictionaries/CallMap_82_delta.php
  16. +129 −1,042 dictionaries/CallMap_historical.php
  17. +4 −4 dictionaries/PropertyMap.php
  18. +7 −0 docs/annotating_code/type_syntax/utility_types.md
  19. +62 −0 docs/contributing/adding_issues.md
  20. +1 −0 docs/contributing/index.md
  21. +3 −0 docs/running_psalm/error_levels.md
  22. +3 −0 docs/running_psalm/issues.md
  23. +12 −0 docs/running_psalm/issues/DirectConstructorCall.md
  24. +15 −0 docs/running_psalm/issues/InvalidInterfaceImplementation.md
  25. +2 −6 docs/running_psalm/issues/ParadoxicalCondition.md
  26. +14 −0 docs/running_psalm/issues/UnusedDocblockParam.md
  27. +2 −0 docs/running_psalm/issues/UnusedProperty.md
  28. +95 −93 psalm-baseline.xml
  29. +4 −5 src/Psalm/Config.php
  30. +7 −1 src/Psalm/ErrorBaseline.php
  31. +7 −12 src/Psalm/Internal/Algebra.php
  32. +31 −1 src/Psalm/Internal/Analyzer/ClassAnalyzer.php
  33. +1 −0 src/Psalm/Internal/Analyzer/ClosureAnalyzer.php
  34. +133 −1 src/Psalm/Internal/Analyzer/CommentAnalyzer.php
  35. +32 −4 src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php
  36. +18 −1 src/Psalm/Internal/Analyzer/MethodAnalyzer.php
  37. +2 −2 src/Psalm/Internal/Analyzer/MethodComparator.php
  38. +2 −2 src/Psalm/Internal/Analyzer/ProjectAnalyzer.php
  39. +3 −0 src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php
  40. +318 −15 src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php
  41. +4 −1 src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/AndAnalyzer.php
  42. +1 −1 src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php
  43. +4 −5 src/Psalm/Internal/Analyzer/Statements/Expression/Call/ClassTemplateParamCollector.php
  44. +1 −0 src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallAnalyzer.php
  45. +1 −1 src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php
  46. +2 −0 src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/ExistingAtomicMethodCallAnalyzer.php
  47. +13 −0 src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php
  48. +36 −0 src/Psalm/Internal/Analyzer/Statements/Expression/Call/NamedFunctionCallHandler.php
  49. +9 −0 src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php
  50. +1 −0 src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php
  51. +13 −0 src/Psalm/Internal/Analyzer/Statements/Expression/ClassConstAnalyzer.php
  52. +73 −49 src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php
  53. +11 −98 src/Psalm/Internal/Analyzer/Statements/StaticAnalyzer.php
  54. +2 −2 src/Psalm/Internal/Analyzer/StatementsAnalyzer.php
  55. +7 −1 src/Psalm/Internal/Cli/LanguageServer.php
  56. +24 −8 src/Psalm/Internal/Cli/Psalm.php
  57. +9 −3 src/Psalm/Internal/Cli/Psalter.php
  58. +55 −8 src/Psalm/Internal/Fork/PsalmRestarter.php
  59. +1 −0 src/Psalm/Internal/LanguageServer/Server/TextDocument.php
  60. +1 −1 src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php
  61. +4 −0 src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php
  62. +35 −0 src/Psalm/Internal/Scanner/PhpStormMetaScanner.php
  63. +7 −0 src/Psalm/Internal/Type/Comparator/AtomicTypeComparator.php
  64. +2 −1 src/Psalm/Internal/Type/SimpleAssertionReconciler.php
  65. +4 −0 src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php
  66. +6 −6 src/Psalm/Internal/Type/TypeCombiner.php
  67. +10 −7 src/Psalm/Internal/Type/TypeParser.php
  68. +9 −0 src/Psalm/Issue/DirectConstructorCall.php
  69. +9 −0 src/Psalm/Issue/InvalidInterfaceImplementation.php
  70. +1 −1 src/Psalm/Issue/MissingThrowsDocblock.php
  71. +9 −0 src/Psalm/Issue/UnusedDocblockParam.php
  72. +3 −1 src/Psalm/Report/EmacsReport.php
  73. +1 −1 src/Psalm/Report/XmlReport.php
  74. +9 −0 src/Psalm/Storage/FunctionLikeStorage.php
  75. +3 −4 src/Psalm/Type.php
  76. +2 −3 stubs/CoreGenericClasses.phpstub
  77. +64 −2 stubs/CoreGenericFunctions.phpstub
  78. +23 −2 stubs/Php80.phpstub
  79. +23 −0 stubs/Php82.phpstub
  80. +18 −0 tests/AnnotationTest.php
  81. +16 −0 tests/AssertAnnotationTest.php
  82. +18 −0 tests/CheckTypeTest.php
  83. +29 −0 tests/ClassTest.php
  84. +32 −0 tests/ClosureTest.php
  85. +12 −0 tests/ConstantTest.php
  86. +2 −0 tests/DocumentationTest.php
  87. +1 −2 tests/EndToEnd/PsalmEndToEndTest.php
  88. +167 −0 tests/EnumTest.php
  89. +54 −0 tests/FunctionCallTest.php
  90. +13 −0 tests/IntRangeTest.php
  91. +2 −2 tests/Internal/CliUtilsTest.php
  92. +34 −209 tests/Internal/Codebase/InternalCallMapHandlerTest.php
  93. +8 −0 tests/MethodCallTest.php
  94. +196 −170 tests/ReportOutputTest.php
  95. +2 −0 tests/ReturnTypeProvider/GetObjectVarsTest.php
  96. +16 −0 tests/StubTest.php
  97. +25 −13 tests/TaintTest.php
  98. +19 −0 tests/TestEnvironmentTest.php
  99. +25 −0 tests/ThrowsAnnotationTest.php
  100. +1 −0 tests/Traits/InvalidCodeAnalysisTestTrait.php
  101. +2 −1 tests/Traits/ValidCodeAnalysisTestTrait.php
  102. +14 −8 tests/TypeParseTest.php
  103. +14 −0 tests/TypeReconciliation/ConditionalTest.php
  104. +119 −0 tests/TypeReconciliation/EmptyTest.php
  105. +37 −2 tests/TypeReconciliation/TypeAlgebraTest.php
  106. +11 −1 tests/UnusedCodeTest.php
  107. +7 −0 tests/fixtures/stubs/phpstorm.meta.php
4 changes: 2 additions & 2 deletions .github/workflows/bcc.yml
Original file line number Diff line number Diff line change
@@ -20,8 +20,8 @@ jobs:
- name: Get Composer Cache Directories
id: composer-cache
run: |
echo "::set-output name=files_cache::$(composer config cache-files-dir)"
echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)"
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
- name: Cache composer cache
uses: actions/cache@v3
4 changes: 2 additions & 2 deletions .github/workflows/build-phar.yml
Original file line number Diff line number Diff line change
@@ -49,8 +49,8 @@ jobs:
- name: Get Composer Cache Directories
id: composer-cache
run: |
echo "::set-output name=files_cache::$(composer config cache-files-dir)"
echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)"
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
- name: Cache composer cache
uses: actions/cache@v3
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -21,8 +21,8 @@ jobs:
- name: Get Composer Cache Directories
id: composer-cache
run: |
echo "::set-output name=files_cache::$(composer config cache-files-dir)"
echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)"
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
- name: Cache composer cache
uses: actions/cache@v3
@@ -58,8 +58,8 @@ jobs:
- id: chunk-matrix
name: Generates the Chunk Matrix
run: |
echo "::set-output name=count::$(php -r 'echo json_encode([ ${{ env.CHUNK_COUNT }} ]);')"
echo "::set-output name=chunks::$(php -r 'echo json_encode(range(1, ${{ env.CHUNK_COUNT }} ));')"
echo "count=$(php -r 'echo json_encode([ ${{ env.CHUNK_COUNT }} ]);')" >> $GITHUB_OUTPUT
echo "chunks=$(php -r 'echo json_encode(range(1, ${{ env.CHUNK_COUNT }} ));')" >> $GITHUB_OUTPUT
tests:
name: "Unit Tests - ${{ matrix.chunk }}"
@@ -94,8 +94,8 @@ jobs:
- name: Get Composer Cache Directories
id: composer-cache
run: |
echo "::set-output name=files_cache::$(composer config cache-files-dir)"
echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)"
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
- name: Cache composer cache
uses: actions/cache@v3
3 changes: 3 additions & 0 deletions .github/workflows/shepherd.yml
Original file line number Diff line number Diff line change
@@ -14,6 +14,9 @@ jobs:
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
ini-values: zend.assertions=1
tools: composer:v2
coverage: none

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
10 changes: 6 additions & 4 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
@@ -23,8 +23,9 @@ jobs:
- id: chunk-matrix
name: Generates the Chunk Matrix
run: |
echo "::set-output name=count::$(php -r 'echo json_encode([ ${{ env.CHUNK_COUNT }} ]);')"
echo "::set-output name=chunks::$(php -r 'echo json_encode(range(1, ${{ env.CHUNK_COUNT }} ));')"
echo "count=$(php -r 'echo json_encode([ ${{ env.CHUNK_COUNT }} ]);')" >> $GITHUB_OUTPUT
echo "chunks=$(php -r 'echo json_encode(range(1, ${{ env.CHUNK_COUNT }} ));')" >> $GITHUB_OUTPUT
shell: bash

tests:
name: "Unit Tests - ${{ matrix.chunk }}"
@@ -64,8 +65,9 @@ jobs:
- name: Get Composer Cache Directories
id: composer-cache
run: |
echo "::set-output name=files_cache::$(composer config cache-files-dir)"
echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)"
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
shell: bash

- name: Cache composer cache
uses: actions/cache@v3
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -5,7 +5,8 @@
"keywords": [
"php",
"code",
"inspection"
"inspection",
"static analysis"
],
"license": "MIT",
"authors": [
@@ -30,11 +31,11 @@
"dnoegel/php-xdg-base-dir": "^0.1.1",
"felixfbecker/advanced-json-rpc": "^3.1",
"felixfbecker/language-server-protocol": "^1.5.2",
"fidry/cpu-core-counter": "^0.4.0",
"fidry/cpu-core-counter": "^0.4.1 || ^0.5.1",
"netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0",
"nikic/php-parser": "^4.13",
"sebastian/diff": "^4.0 || ^5.0",
"spatie/array-to-xml": "^2.17.0",
"spatie/array-to-xml": "^2.17.0 || ^3.0",
"symfony/console": "^4.1.6 || ^5.0 || ^6.0",
"symfony/filesystem": "^5.4 || ^6.0"
},
@@ -44,12 +45,12 @@
"require-dev": {
"ext-curl": "*",
"bamarni/composer-bin-plugin": "^1.4",
"brianium/paratest": "^6.0",
"brianium/paratest": "^6.9",
"mockery/mockery": "^1.5",
"nunomaduro/mock-final-classes": "^1.1",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpdoc-parser": "^1.6",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^9.6",
"psalm/plugin-mockery": "^1.1",
"psalm/plugin-phpunit": "^0.18",
"slevomat/coding-standard": "^8.4",
5 changes: 4 additions & 1 deletion config.xsd
Original file line number Diff line number Diff line change
@@ -218,6 +218,7 @@
<xs:element name="DeprecatedMethod" type="MethodIssueHandlerType" minOccurs="0" />
<xs:element name="DeprecatedProperty" type="PropertyIssueHandlerType" minOccurs="0" />
<xs:element name="DeprecatedTrait" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DirectConstructorCall" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DocblockTypeContradiction" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DuplicateArrayKey" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DuplicateClass" type="IssueHandlerType" minOccurs="0" />
@@ -272,6 +273,7 @@
<xs:element name="InvalidFalsableReturnType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidFunctionCall" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidGlobal" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidInterfaceImplementation" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="InvalidIterator" type="IssueHandlerType" minOccurs="0" />
<xs:element name="InvalidLiteralArgument" type="ArgumentIssueHandlerType" minOccurs="0" />
<xs:element name="InvalidMethodCall" type="IssueHandlerType" minOccurs="0" />
@@ -317,7 +319,7 @@
<xs:element name="MissingPropertyType" type="PropertyIssueHandlerType" minOccurs="0" />
<xs:element name="MissingReturnType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingTemplateParam" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingThrowsDocblock" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MissingThrowsDocblock" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="MixedArgument" type="ArgumentIssueHandlerType" minOccurs="0" />
<xs:element name="MixedArgumentTypeCoercion" type="ArgumentIssueHandlerType" minOccurs="0" />
<xs:element name="MixedArrayAccess" type="IssueHandlerType" minOccurs="0" />
@@ -482,6 +484,7 @@
<xs:element name="UnusedClass" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="UnusedClosureParam" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnusedConstructor" type="MethodIssueHandlerType" minOccurs="0" />
<xs:element name="UnusedDocblockParam" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnusedForeachValue" type="IssueHandlerType" minOccurs="0" />
<xs:element name="UnusedFunctionCall" type="FunctionIssueHandlerType" minOccurs="0" />
<xs:element name="UnusedMethod" type="MethodIssueHandlerType" minOccurs="0" />
Loading