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

Fix crash in code action #7367

Closed
wants to merge 121 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
2c70a1a
Use flag instead of `DirectoryIterator::isDot()`
dvz Dec 14, 2021
1da6893
Add `resolveSymlinks` condition for project directories
dvz Dec 14, 2021
daaa74c
Merge branch 'master' into explicit-symlink-resolution
dvz Dec 22, 2021
0f2ae28
Merge branch '4.x' into master
weirdan Jan 2, 2022
8d6b781
use consistent way to compare php version
orklah Nov 12, 2021
b41722e
Added 'release:removed' as a valid PR label
weirdan Jan 2, 2022
d3729c0
Document BC breaks
weirdan Jan 2, 2022
ba4a25b
Drop superfluous import
weirdan Jan 2, 2022
b419c29
Use InvalidScalarArgument only when we can be sure PHP attempts coercion
muglug Dec 19, 2021
ae00630
Add better documentation
muglug Dec 19, 2021
1e115da
Add better docs to TypeComparisonResult
muglug Dec 19, 2021
4f7c1d0
remove support for allowPhpstormGenerics
orklah Oct 20, 2021
48de574
remove support for allowPhpstormGenerics
orklah Oct 20, 2021
b658b27
remove exitFunctions
orklah Nov 3, 2021
3366eef
Merge branch '4.x' into master
weirdan Jan 2, 2022
2f50070
Merge pull request #6898 from orklah/php-version-consistency
weirdan Jan 3, 2022
0747b48
remove TEmpty
orklah Oct 13, 2021
2358b96
Fix merge errors
muglug Dec 15, 2021
83911c7
Remove unnecessary references to empty in TypeCombiner
muglug Dec 15, 2021
d912663
remove isEmpty
orklah Dec 16, 2021
13bb638
Drop remaining `Type::getEmpty()` references
weirdan Jan 2, 2022
44fbb9f
s/array<empty, empty>/array<never, never>/g
weirdan Jan 3, 2022
1bb2661
Update TAssertionEmpty signatures
weirdan Jan 3, 2022
fe02697
Merge pull request #6662 from orklah/remove-empty
weirdan Jan 3, 2022
f19e4ce
Merge pull request #6705 from orklah/phpstorm-generics-removal
weirdan Jan 3, 2022
966b6ae
Merge pull request #6808 from orklah/exitFunctions3
weirdan Jan 3, 2022
ab60d31
Merge pull request #7188 from vimeo/muglug-use-invalidscalarargument-…
weirdan Jan 3, 2022
c3700e1
Updated UPGRADING.md
weirdan Jan 3, 2022
1c15a6a
Disable PSL as not yet compatible with Psalm 5
weirdan Jan 3, 2022
ec023f4
Merge pull request #7269 from weirdan/disable-psl
weirdan Jan 3, 2022
b54ab67
Require `@internal` annotation on `Psalm\Internal` symbols
weirdan Jan 3, 2022
b924032
Mark internal classes `@internal`
weirdan Jan 3, 2022
2066a21
Documented addition of `@internal` annotations
weirdan Jan 3, 2022
e157a6e
Merge pull request #7268 from weirdan/internal-is-internal
weirdan Jan 3, 2022
706f2a7
Drop legacy procedural files
weirdan Jan 3, 2022
b8bad62
Merge pull request #7270 from weirdan/drop-legacy-binaries
weirdan Jan 3, 2022
55eb4b0
Dropped removed config entries
weirdan Jan 3, 2022
0dba2a6
Merge pull request #7272 from weirdan/drop-deprecated-config-entries
weirdan Jan 3, 2022
2e24a16
Dropped legacy plugin API
weirdan Jan 3, 2022
0a991e3
Documented removal of legacy hook interfaces
weirdan Jan 3, 2022
bcff8d9
Merge pull request #7275 from weirdan/drop-legacy-api
weirdan Jan 3, 2022
ba69f4f
Dropped deprecated `CodeIssue` methods
weirdan Jan 3, 2022
0866866
Document CodeIssue methods removal
weirdan Jan 3, 2022
af7501f
Merge pull request #7276 from weirdan/drop-deprecated-codeissue-methods
weirdan Jan 3, 2022
401c2e9
Dropped deprecated TypeAnalyzer methods
weirdan Jan 3, 2022
dd0765a
Merge pull request #7277 from weirdan/drop-deprecated-typeanalyzer-me…
weirdan Jan 3, 2022
e04d545
Dropped deprecated `DocComment` methods
weirdan Jan 3, 2022
804d0c6
Documented DocComment methods removal
weirdan Jan 3, 2022
21fc7a7
Merge pull request #7278 from weirdan/drop-deprecated-doccomment-methods
weirdan Jan 3, 2022
988ae94
Trim baseline selection
weirdan Jan 3, 2022
4c84745
Merge pull request #7279 from weirdan/trim-existing-issue-selections
weirdan Jan 3, 2022
dbee118
Moved `getPsalmHelpText()` to `Cli\Psalm`
weirdan Jan 3, 2022
7d6324a
Merge pull request #7280 from weirdan/move-help-text
weirdan Jan 3, 2022
e6472de
Dropped `html-escaped-string` docs
weirdan Jan 3, 2022
87977e4
Merge pull request #7281 from weirdan/drop-htl-escaped-string-docs
weirdan Jan 3, 2022
c1acab4
Merge branch '4.x' into upstream-master
weirdan Jan 3, 2022
afa6497
Dropped `THtmlEscapedString`
weirdan Jan 3, 2022
f09814a
Documented THtmlEscapedString removal
weirdan Jan 3, 2022
c2c3247
Merge pull request #7285 from weirdan/drop-html-escaped-string
weirdan Jan 3, 2022
ff9b214
Merge branch '4.x' into upstream-master
weirdan Jan 4, 2022
30013cb
Drop orphaned token
weirdan Jan 4, 2022
3869d83
Merge pull request #7290 from weirdan/drop-mysql-escaped-string
weirdan Jan 4, 2022
fa33632
Bump PHP version to 7.4
weirdan Jan 4, 2022
20567ff
Remove the polyfill we no longer need
weirdan Jan 4, 2022
cf962ee
Promote conditional tests to always-running
weirdan Jan 4, 2022
d227cb5
Tighten dependency ranges
weirdan Jan 4, 2022
c844079
Merge pull request #7291 from weirdan/bump-php-version
weirdan Jan 4, 2022
02b91cc
Replaced deprecated webmozart/path-util
weirdan Jan 4, 2022
f40e6df
Merge pull request #7292 from weirdan/replace-webmozart-pathutils
weirdan Jan 4, 2022
2c6d4f8
Fix erroneous intersection
muglug Jan 4, 2022
0fffb55
Simplify some logic around negations to prevent unecessary looping
muglug Jan 4, 2022
4e81d0c
Remove an untested chunk of issue-triggering code that has only ever …
muglug Jan 4, 2022
63f3460
Make clear that class string check for trait $this key only applies t…
muglug Jan 4, 2022
f5dc2ee
Merge branch '4.x' into upstream-master
weirdan Jan 4, 2022
0c13d8e
Indent heredoc
weirdan Jan 4, 2022
0cbce39
Merge pull request #7294 from weirdan/indent-heredoc
weirdan Jan 4, 2022
5758d31
Apply literal number separator rector
weirdan Jan 4, 2022
9e64375
Break up two intersection methods
muglug Jan 4, 2022
0a78b32
Remove commas for now
muglug Jan 4, 2022
5e22026
Fix version id for the callable object typehint
weirdan Jan 4, 2022
c81c5fa
Drop dead code based on PHP_VERSION_ID
weirdan Jan 4, 2022
26de4fa
Unify names with intersection creation
muglug Jan 5, 2022
31dd30f
Reduce by-ref args
muglug Jan 5, 2022
7595a3c
Make treatment of interfaces and classes more symmetrical
muglug Jan 5, 2022
f5d6d23
Remove now-unnecessary code
muglug Jan 5, 2022
d30d527
Ensure separator is used for long numbers
weirdan Jan 5, 2022
9b488e6
Merge pull request #7300 from weirdan/dead-code-phpversion
weirdan Jan 5, 2022
758e0af
Merge branch 'master' into rector-literal-number-separator
weirdan Jan 5, 2022
0f84dd3
Merge pull request #7299 from weirdan/rector-literal-number-separator
weirdan Jan 5, 2022
dd09450
Applied NullCoalescingOperatorRector
weirdan Jan 5, 2022
dfb14cb
Enforce null-coalesce operators
weirdan Jan 5, 2022
2bc7b9b
Merge pull request #7302 from weirdan/rector-null-coalescing-operator
weirdan Jan 5, 2022
94395f1
Applied JsonThrowOnErrorRector
weirdan Jan 5, 2022
b8240e2
Merge pull request #7303 from weirdan/rector-json-exceptions
weirdan Jan 5, 2022
83f1d52
Applied ListToArrayDestructRector
weirdan Jan 5, 2022
e4c16c1
Enforce `[...]` usage instead of `list(...)`
weirdan Jan 5, 2022
17793d1
Merge pull request #7310 from weirdan/rector-ListToArrayDestructRector
weirdan Jan 5, 2022
030195a
parse array{} into an empty array
orklah Jan 4, 2022
9d3a51d
remove obsolete test and fix a missing exception
orklah Jan 5, 2022
3c468b3
replace `array<never, never>` as a way to detect empty arrays by a de…
orklah Jan 5, 2022
ee99dea
fix a case not always on TArray
orklah Jan 5, 2022
7f40489
fix inverted condition
orklah Jan 5, 2022
8726065
Applied ClosureToArrowFunctionRector
weirdan Jan 5, 2022
bf4bf92
Merge pull request #7313 from orklah/empty-arrays
orklah Jan 5, 2022
638a10d
Restore return docblock
weirdan Jan 5, 2022
b6559dc
Merge pull request #7315 from weirdan/rector-ClosureToArrowFunctionRe…
weirdan Jan 6, 2022
f3bc55e
Merge pull request #7312 from orklah/empty-array
orklah Jan 6, 2022
3fb3db3
Merge branch '4.x' into upstream-master
weirdan Jan 6, 2022
762ef8d
Merge branch '4.x' into upstream-master
weirdan Jan 7, 2022
4abbd9c
Simplify object comparison
muglug Jan 7, 2022
b941078
Merge pull request #7340 from vimeo/muglug-simplify-object-comparison
orklah Jan 8, 2022
1a1b5a9
Merge branch '4.x' into upstream-master
weirdan Jan 8, 2022
6f513df
Fix empty class
muglug Jan 9, 2022
a435bc5
Rename was_static property to is_static to be more accurate
muglug Jan 9, 2022
e1e3839
Merge pull request #7358 from vimeo/muglug-what-was-is-is
orklah Jan 9, 2022
7dc1c45
Don’t perform containedness check twice
muglug Jan 9, 2022
6589ad1
Document BC breaks in #7358
weirdan Jan 9, 2022
72fd3de
Simplify return type for TypeExpander::expandAtomic
muglug Jan 9, 2022
206332b
Merge pull request #7360 from weirdan/document-7358
weirdan Jan 9, 2022
d52c3f0
Merge pull request #7163 from dvz/explicit-symlink-resolution
orklah Jan 10, 2022
7f86014
Fix closure to have storage bug in codeAction
tm1000 Jan 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 4 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ jobs:
- run:
name: Analyse PHPUnit
command: bin/test-with-real-projects.sh phpunit
- run:
name: Analyse Psl
command: bin/test-with-real-projects.sh psl
# PSL requires its own plugin that is not yet compatible with Psalm 5
# - run:
# name: Analyse Psl
# command: bin/test-with-real-projects.sh psl
- run:
name: Analyse Collections
command: bin/test-with-real-projects.sh collections
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.1'
php-version: '7.4'
tools: composer:v2
coverage: none

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
with:
mode: minimum
count: 1
labels: "release:typo, release:fix, release:feature, release:deprecation, release:internal, release:docs"
labels: "release:typo, release:fix, release:feature, release:deprecation, release:internal, release:docs, release:removed"
164 changes: 164 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Upgrading from Psalm 4 to Psalm 5
## Changed
- [BC] The parameter `$php_version` of `Psalm\Type\Atomic::create()` renamed
to `$analysis_php_version_id` and changed from `array|null` to `int|null`.
Previously it accepted PHP version as `array{major_version, minor_version}`
while now it accepts version ID, similar to how [`PHP_VERSION_ID` is
calculated](https://www.php.net/manual/en/reserved.constants.php#constant.php-version-id).

- [BC] The parameter `$php_version` of `Psalm\Type::parseString()` renamed to
`$analysis_php_version_id` and changed from `array|null` to `int|null`.
Previously it accepted PHP version as `array{major_version, minor_version}`
while now it accepts version ID.

- [BC] Parameter 0 of `canBeFullyExpressedInPhp()` of the classes listed below
changed name from `php_major_version` to `analysis_php_version_id`.
Previously it accepted major PHP version as int (e.g. `7`), while now it
accepts version ID. Classes affected:
- `Psalm\Type\Atomic`
- `Psalm\Type\Atomic\Scalar`
- `Psalm\Type\Atomic\TArray`
- `Psalm\Type\Atomic\TArrayKey`
- `Psalm\Type\Atomic\TAssertionFalsy`
- `Psalm\Type\Atomic\TCallable`
- `Psalm\Type\Atomic\TCallableObject`
- `Psalm\Type\Atomic\TCallableString`
- `Psalm\Type\Atomic\TClassConstant`
- `Psalm\Type\Atomic\TClassString`
- `Psalm\Type\Atomic\TClassStringMap`
- `Psalm\Type\Atomic\TClosedResource`
- `Psalm\Type\Atomic\TClosure`
- `Psalm\Type\Atomic\TConditional`
- `Psalm\Type\Atomic\TDependentGetClass`
- `Psalm\Type\Atomic\TDependentGetDebugType`
- `Psalm\Type\Atomic\TDependentGetType`
- `Psalm\Type\Atomic\TDependentListKey`
- `Psalm\Type\Atomic\TEnumCase`
- `Psalm\Type\Atomic\TFalse`
- `Psalm\Type\Atomic\TGenericObject`
- `Psalm\Type\Atomic\TIntMask`
- `Psalm\Type\Atomic\TIntMaskOf`
- `Psalm\Type\Atomic\TIntRange`
- `Psalm\Type\Atomic\TIterable`
- `Psalm\Type\Atomic\TKeyedArray`
- `Psalm\Type\Atomic\TKeyOfClassConstant`
- `Psalm\Type\Atomic\TList`
- `Psalm\Type\Atomic\TLiteralClassString`
- `Psalm\Type\Atomic\TLowercaseString`
- `Psalm\Type\Atomic\TMixed`
- `Psalm\Type\Atomic\TNamedObject`
- `Psalm\Type\Atomic\TNever`
- `Psalm\Type\Atomic\TNonEmptyLowercaseString`
- `Psalm\Type\Atomic\TNonspecificLiteralInt`
- `Psalm\Type\Atomic\TNonspecificLiteralString`
- `Psalm\Type\Atomic\TNull`
- `Psalm\Type\Atomic\TNumeric`
- `Psalm\Type\Atomic\TNumericString`
- `Psalm\Type\Atomic\TObject`
- `Psalm\Type\Atomic\TObjectWithProperties`
- `Psalm\Type\Atomic\TPositiveInt`
- `Psalm\Type\Atomic\TResource`
- `Psalm\Type\Atomic\TScalar`
- `Psalm\Type\Atomic\TTemplateIndexedAccess`
- `Psalm\Type\Atomic\TTemplateParam`
- `Psalm\Type\Atomic\TTraitString`
- `Psalm\Type\Atomic\TTrue`
- `Psalm\Type\Atomic\TTypeAlias`
- `Psalm\Type\Atomic\TValueOfClassConstant`
- `Psalm\Type\Atomic\TVoid`
- `Psalm\Type\Union`

- [BC] Parameter 3 of `toPhpString()` of methods listed below changed name
from `php_major_version` to `analysis_php_version_id`. Previously it
accepted major PHP version as int (e.g. `7`), while now it accepts version
ID. Classes affected:
- `Psalm\Type\Atomic`
- `Psalm\Type\Atomic\CallableTrait`
- `Psalm\Type\Atomic\TAnonymousClassInstance`
- `Psalm\Type\Atomic\TArray`
- `Psalm\Type\Atomic\TArrayKey`
- `Psalm\Type\Atomic\TAssertionFalsy`
- `Psalm\Type\Atomic\TBool`
- `Psalm\Type\Atomic\TCallable`
- `Psalm\Type\Atomic\TCallableObject`
- `Psalm\Type\Atomic\TClassConstant`
- `Psalm\Type\Atomic\TClassString`
- `Psalm\Type\Atomic\TClassStringMap`
- `Psalm\Type\Atomic\TClosedResource`
- `Psalm\Type\Atomic\TConditional`
- `Psalm\Type\Atomic\TEmpty`
- `Psalm\Type\Atomic\TEnumCase`
- `Psalm\Type\Atomic\TFloat`
- `Psalm\Type\Atomic\TGenericObject`
- `Psalm\Type\Atomic\TInt`
- `Psalm\Type\Atomic\TIterable`
- `Psalm\Type\Atomic\TKeyedArray`
- `Psalm\Type\Atomic\TKeyOfClassConstant`
- `Psalm\Type\Atomic\TList`
- `Psalm\Type\Atomic\TLiteralClassString`
- `Psalm\Type\Atomic\TMixed`
- `Psalm\Type\Atomic\TNamedObject`
- `Psalm\Type\Atomic\TNever`
- `Psalm\Type\Atomic\TNull`
- `Psalm\Type\Atomic\TNumeric`
- `Psalm\Type\Atomic\TObject`
- `Psalm\Type\Atomic\TObjectWithProperties`
- `Psalm\Type\Atomic\TResource`
- `Psalm\Type\Atomic\TScalar`
- `Psalm\Type\Atomic\TString`
- `Psalm\Type\Atomic\TTemplateIndexedAccess`
- `Psalm\Type\Atomic\TTemplateParam`
- `Psalm\Type\Atomic\TTraitString`
- `Psalm\Type\Atomic\TTypeAlias`
- `Psalm\Type\Atomic\TValueOfClassConstant`
- `Psalm\Type\Atomic\TVoid`
- `Psalm\Type\Union`
- While not a BC break per se, all classes / interfaces / traits / enums under
`Psalm\Internal` namespace are now marked `@internal`.
- [BC] Parameter 1 of `Psalm\Type\Atomic\TNamedObject::__construct()` changed name from `was_static` to `is_static`
- [BC] Parameter 1 of `Psalm\Type\Atomic\TAnonymousClassInstance::__construct()` changed name from `was_static` to `is_static`
- [BC] Parameter 5 of `Psalm\Type::getStringFromFQCLN()` changed name from `was_static` to `is_static`
- [BC] Property `Psalm\Type\Atomic\TNamedObject::$was_static` was renamed to `$is_static`
- [BC] Method `Psalm\Type\Union::isFormerStaticObject()` was renamed to `isStaticObject()`
- [BC] Method `Psalm\Type\Union::hasFormerStaticObject()` was renamed to `hasStaticObject()`

## Removed
- [BC] Property `Psalm\Codebase::$php_major_version` was removed, use
`Psalm\Codebase::$analysis_php_version_id`.
- [BC] Property `Psalm\Codebase::$php_minor_version` was removed, use
`Psalm\Codebase::$analysis_php_version_id`.
- [BC] Class `Psalm\Type\Atomic\TEmpty` was removed
- [BC] Method `Psalm\Type\Union::isEmpty()` was removed
- [BC] Property `Psalm\Config::$allow_phpstorm_generics` was removed
- [BC] Property `Psalm\Config::$exit_functions` was removed
- [BC] Method `Psalm\Type::getEmpty()` was removed
- [BC] Legacy hook interfaces have been removed:
- `Psalm\Plugin\Hook\MethodReturnTypeProviderInterface`
- `Psalm\Plugin\Hook\BeforeFileAnalysisInterface`
- `Psalm\Plugin\Hook\AfterFileAnalysisInterface`
- `Psalm\Plugin\Hook\AfterMethodCallAnalysisInterface`
- `Psalm\Plugin\Hook\AfterClassLikeVisitInterface`
- `Psalm\Plugin\Hook\StringInterpreterInterface`
- `Psalm\Plugin\Hook\AfterExpressionAnalysisInterface`
- `Psalm\Plugin\Hook\AfterEveryFunctionCallAnalysisInterface`
- `Psalm\Plugin\Hook\PropertyExistenceProviderInterface`
- `Psalm\Plugin\Hook\AfterFunctionLikeAnalysisInterface`
- `Psalm\Plugin\Hook\FunctionParamsProviderInterface`
- `Psalm\Plugin\Hook\FunctionReturnTypeProviderInterface`
- `Psalm\Plugin\Hook\FunctionExistenceProviderInterface`
- `Psalm\Plugin\Hook\AfterAnalysisInterface`
- `Psalm\Plugin\Hook\MethodVisibilityProviderInterface`
- `Psalm\Plugin\Hook\MethodParamsProviderInterface`
- `Psalm\Plugin\Hook\AfterClassLikeExistenceCheckInterface`
- `Psalm\Plugin\Hook\PropertyTypeProviderInterface`
- `Psalm\Plugin\Hook\AfterFunctionCallAnalysisInterface`
- `Psalm\Plugin\Hook\MethodExistenceProviderInterface`
- `Psalm\Plugin\Hook\AfterCodebasePopulatedInterface`
- `Psalm\Plugin\Hook\AfterClassLikeAnalysisInterface`
- `Psalm\Plugin\Hook\PropertyVisibilityProviderInterface`
- `Psalm\Plugin\Hook\AfterStatementAnalysisInterface`
- [BC] Method `Psalm\Issue\CodeIssue::getLocation()` was removed
- [BC] Method `Psalm\Issue\CodeIssue::getFileName()` was removed
- [BC] Method `Psalm\Issue\CodeIssue::getMessage()` was removed
- [BC] Method `Psalm\DocComment::parse()` was removed
- [BC] Class `Psalm\Type\Atomic\THtmlEscapedString` has been removed
20 changes: 8 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.1|^8",
"php": "^7.4 || ~8.0.0 || ~8.1.0",
"ext-SimpleXML": "*",
"ext-ctype": "*",
"ext-dom": "*",
Expand All @@ -28,30 +28,30 @@
"composer/semver": "^1.4 || ^2.0 || ^3.0",
"composer/xdebug-handler": "^1.1 || ^2.0 || ^3.0",
"dnoegel/php-xdg-base-dir": "^0.1.1",
"felixfbecker/advanced-json-rpc": "^3.0.3",
"felixfbecker/advanced-json-rpc": "^3.1",
"felixfbecker/language-server-protocol": "^1.5",
"netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0",
"nikic/php-parser": "^4.13",
"openlss/lib-array2xml": "^1.0",
"sebastian/diff": "^3.0 || ^4.0",
"sebastian/diff": "^4.0",
"symfony/console": "^3.4.17 || ^4.1.6 || ^5.0 || ^6.0",
"webmozart/path-util": "^2.3"
"symfony/filesystem": "^5.4 || ^6.0"
},
"provide": {
"psalm/psalm": "self.version"
},
"require-dev": {
"ext-curl": "*",
"bamarni/composer-bin-plugin": "^1.2",
"bamarni/composer-bin-plugin": "^1.4",
"brianium/paratest": "^4.0||^6.0",
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpdocumentor/reflection-docblock": "^5",
"phpmyadmin/sql-parser": "5.1.0||dev-master",
"phpspec/prophecy": ">=1.9.0",
"phpspec/prophecy": ">=1.10.2",
"phpunit/phpunit": "^9.0",
"psalm/plugin-phpunit": "^0.16",
"slevomat/coding-standard": "^7.0",
"squizlabs/php_codesniffer": "^3.5",
"squizlabs/php_codesniffer": "^3.6",
"symfony/process": "^4.3 || ^5.0 || ^6.0",
"weirdan/prophecy-shim": "^1.0 || ^2.0"
},
Expand Down Expand Up @@ -80,11 +80,7 @@
"autoload": {
"psr-4": {
"Psalm\\": "src/Psalm/"
},
"files": [
"src/functions.php",
"src/spl_object_id.php"
]
}
},
"autoload-dev": {
"psr-4": {
Expand Down
27 changes: 1 addition & 26 deletions config.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
<xs:element name="mockClasses" type="MockClassesType" minOccurs="0" maxOccurs="1" />
<xs:element name="stubs" type="StubsType" minOccurs="0" maxOccurs="1" />
<xs:element name="plugins" type="PluginsType" minOccurs="0" maxOccurs="1" />
<xs:element name="exitFunctions" type="ExitFunctionsType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<!-- note: for PHPStorm to mark the attribute as deprecated the doc entry has to be *single line* and start with the word `deprecated` -->
<xs:documentation xml:lang="en">
Deprecated. Replaced by documenting never as a return type. It is going to be removed in Psalm 5.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="forbiddenFunctions" type="ExitFunctionsType" minOccurs="0" maxOccurs="1" />
<xs:element name="issueHandlers" type="IssueHandlersType" minOccurs="0" maxOccurs="1" />
<xs:element name="ignoreExceptions" type="ExceptionsType" minOccurs="0" maxOccurs="1" />
Expand All @@ -40,25 +32,7 @@
<xs:attribute name="serializer" type="xs:string" />

<xs:attribute name="addParamDefaultToDocblockType" type="xs:boolean" default="false" />

<xs:attribute name="allowCoercionFromStringToClassConst" type="xs:boolean" default="false">
<xs:annotation>
<!-- note: for PHPStorm to mark the attribute as deprecated the doc entry has to be *single line* and start with the word `deprecated` -->
<xs:documentation xml:lang="en">
Deprecated. Has no effect since Psalm 3 and is going to be removed in Psalm 5.
</xs:documentation>
</xs:annotation>
</xs:attribute>

<xs:attribute name="allowFileIncludes" type="xs:boolean" default="true" />
<xs:attribute name="allowPhpStormGenerics" type="xs:boolean" default="false">
<xs:annotation>
<!-- note: for PHPStorm to mark the attribute as deprecated the doc entry has to be *single line* and start with the word `deprecated` -->
<xs:documentation xml:lang="en">
Deprecated. PHPStorm now supports generics for the most part and @psalm- annotations can be used
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="allowStringToStandInForClass" type="xs:boolean" default="false" />
<xs:attribute name="checkForThrowsDocblock" type="xs:boolean" default="false" />
<xs:attribute name="checkForThrowsInGlobalScope" type="xs:boolean" default="false" />
Expand Down Expand Up @@ -144,6 +118,7 @@
<xs:complexType name="ProjectDirectoryAttributeType">
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="ignoreTypeStats" type="xs:string" />
<xs:attribute name="resolveSymlinks" type="xs:boolean" />
<xs:attribute name="useStrictTypes" type="xs:string" />
<xs:anyAttribute processContents="skip"/>
</xs:complexType>
Expand Down
13 changes: 7 additions & 6 deletions docs/annotating_code/type_syntax/atomic_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,20 @@ Atomic types are the basic building block of all type information used in Psalm.
- `value-of<Foo\Bar::ARRAY_CONST>`
- `T[K]`

## Top types, bottom types and empty
## Top types, bottom types

### `mixed`

This is the _top type_ in PHP's type system, and represents a lack of type information. Psalm warns about `mixed` types when the `totallyTyped` flag is turned on, or when you're on level 1.

### `never`
It can be aliased to `no-return` or `never-return` in docblocks. Note: it replaced the old `empty` type that used to exist in Psalm

This is the _bottom type_ in PHP's type system, and usually represents a return type for a function that can never actually return, such as `die()`, `exit()`, or a function that always throws an exception. It may also be written in docblocks as `no-return` or `never-return`.

### `empty`

A type that's equivalent to a "coming soon" sign. Psalm uses this type when it’s awaiting more information — a good example is the type of the empty array `[]`, which Psalm types as `array<empty, empty>`. Psalm treats `empty` in a somewhat similar fashion to `never` when combining types together — `empty|int` becomes `int`, just as `never|string` becomes `string`.
This is the _bottom type_ in PHP's type system. It's used to describe a type that has no possible value. It can happen in multiple cases:
- the actual `never` type from PHP 8.1 (can be used in docblocks for older versions). This type can be used as a return type for functions that will never return, either because they always throw exceptions or always exit()
- an union type that have been stripped for all its possible types. (For example, if a variable is `string|int` and we perform a is_bool() check in a condition, the type of the variable in the condition will be `never` as the condition will never be entered)
- it can represent a placeholder for types yet to come — a good example is the type of the empty array `[]`, which Psalm types as `array<never, never>`, the content of the array is void so it can accept any content
- it can also happen in the same context as the line above for templates that have yet to be defined

## Other

Expand Down
6 changes: 0 additions & 6 deletions docs/annotating_code/type_syntax/scalar_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,3 @@ Strings that don't pass this type check:
A non empty string, lowercased or both at once.

`empty` here is defined as all strings except the empty string `''`. Another type `non-falsy-string` is effectively a subtype of `non-empty-string`, and also precludes the string value `'0'`.

### html-escaped-string (deprecated)

A string which can safely be used in a html context.

_This type will be removed in Psalm 5.x._
11 changes: 0 additions & 11 deletions docs/running_psalm/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,6 @@ If true we force strict typing on numerical and string operations (see https://g
```
Setting this to `false` means that any function calls will cause Psalm to forget anything it knew about object properties within the scope of the function it's currently analysing. This duplicates functionality that Hack has. Defaults to `true`.

#### allowPhpStormGenerics

```xml
<psalm
allowPhpStormGenerics="[bool]"
>
```
Allows you to specify whether or not to use the typed iterator docblock format supported by PHP Storm e.g. `ArrayIterator|string[]`, which Psalm transforms to `ArrayIterator<string>`. Defaults to `false`.

This flag is deprecated and will be removed in Psalm 5

#### allowStringToStandInForClass

```xml
Expand Down
6 changes: 5 additions & 1 deletion docs/running_psalm/issues/InvalidScalarArgument.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# InvalidScalarArgument

Emitted when a scalar value is passed to a method that expected another scalar type
Emitted when a scalar value is passed to a method that expected another scalar type.

This is only emitted in situations where Psalm can be sure that PHP tries to coerce one scalar type to another.

In all other cases `InvalidArgument` is emitted.

```php
<?php
Expand Down
6 changes: 2 additions & 4 deletions docs/running_psalm/plugins/plugins_type_system.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,14 @@ The classes are as follows:

`TNull` - denotes the `null` type

`TNever` - denotes the `no-return`/`never-return` type for functions that never return, either throwing an exception or terminating (like the builtin `exit()`).
`TNever` - denotes the `no-return`/`never-return` type for functions that never return, either throwing an exception or terminating (like the builtin `exit()`). Also used for union types that can have no possible types (impossible intersections for example). Empty arrays `[]` have the type `array<never, never>`.

`TMixed` - denotes the `mixed` type, used when you don’t know the type of an expression.

`TNonEmptyMixed `- as above, but not empty. Generated for `$x` inside the `if` statement `if ($x) {...}` when `$x` is `mixed` outside.

`TEmptyMixed` - as above, but empty. Generated for `$x` inside the `if` statement `if (!$x) {...}` when `$x` is `mixed` outside.

`TEmpty` - denotes the `empty` type, used to describe a type corresponding to no value whatsoever. Empty arrays `[]` have the type `array<empty, empty>`.

`TIterable` - denotes the [`iterable` type](https://www.php.net/manual/en/language.types.iterable.php) (which can also result from an `is_iterable` check).

`TResource` - denotes the `resource` type (e.g. a file handle).
Expand Down Expand Up @@ -141,7 +139,7 @@ if (true === $first) {

`TCallableString` - denotes the `callable-string` type, used to represent an unknown string that is also `callable`.

`THtmlEscapedString`, `TSqlSelectString` - these are special types, specifically for consumption by plugins.
`TSqlSelectString` - this is a special type, specifically for consumption by plugins.

`TLowercaseString` - denotes a string where every character is lowercased. (which can also result from a `strtolower` call).

Expand Down