1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-12 09:19:40 +01:00
psalm/src/Psalm
Anner Visser d10b1f91bb
Allow using imported types in other types within the same file
In the test case (from issue #7116) both the type definition and the
import of the typed lived in the same file. This caused `OpeningTypes`
to be an `InlineTypeAlias` instead of a `LinkableTypeAlias`, in turn
causing an 'Invalid type alias' exception[^1].

By replacing the array union (+) with an array_merge, the import of the
type overrides the initial type declaration within the `Main` class.
This means type imports within one file act more like they would when in
separate files.

Fixes #7116

[^1]: [src/Psalm/Type/Atomic.php:407](1986c8b4a8/src/Psalm/Type/Atomic.php (L407))
2022-11-15 14:46:31 +01:00
..
CodeLocation Immutable unions (#8627) 2022-11-04 19:04:23 +01:00
Config Merge remote-tracking branch 'origin/4.x' into HEAD 2022-10-16 13:41:27 +02:00
Exception
Internal Allow using imported types in other types within the same file 2022-11-15 14:46:31 +01:00
Issue Make array shapes strict by default (#8701) 2022-11-11 20:14:21 -05:00
Node
Plugin Immutable readonly 3 2022-10-03 15:13:47 +02:00
Progress
Report Make array shapes strict by default (#8701) 2022-11-11 20:14:21 -05:00
SourceControl
Storage Make array shapes strict by default (#8701) 2022-11-11 20:14:21 -05:00
Type Make array shapes strict by default (#8701) 2022-11-11 20:14:21 -05:00
Aliases.php Immutable unions (#8627) 2022-11-04 19:04:23 +01:00
Codebase.php Make array shapes strict by default (#8701) 2022-11-11 20:14:21 -05:00
CodeLocation.php Make array shapes strict by default (#8701) 2022-11-11 20:14:21 -05:00
Config.php Make array shapes strict by default (#8701) 2022-11-11 20:14:21 -05:00
Context.php Make array shapes strict by default (#8701) 2022-11-11 20:14:21 -05:00
DocComment.php preg_replace with anchor will always only have 1 replacement, add limit for clarity and performance 2022-09-08 18:51:33 +02:00
ErrorBaseline.php Make array shapes strict by default (#8701) 2022-11-11 20:14:21 -05:00
FileBasedPluginAdapter.php
FileManipulation.php
FileSource.php Immutable unions (#8627) 2022-11-04 19:04:23 +01:00
IssueBuffer.php Make array shapes strict by default (#8701) 2022-11-11 20:14:21 -05:00
NodeTypeProvider.php
PluginFileExtensionsSocket.php
PluginRegistrationSocket.php
Report.php Merge remote-tracking branch 'origin/4.x' into HEAD 2022-10-16 13:41:27 +02:00
StatementsSource.php
Type.php Make array shapes strict by default (#8701) 2022-11-11 20:14:21 -05:00