1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00
Commit Graph

3424 Commits

Author SHA1 Message Date
Bruce Weirdan
1cc4715740
Fix windows tests (#4040)
* Fix windows tests by not mangling the expectations

* Use platform-dependent directory separator in expected messages

* fix CS
2021-01-29 11:38:04 +01:00
Bruce Weirdan
78a63ed25a
Resolve typedefs that are used in var docblocks of foreach (#4037)
Fixes vimeo/psalm#4029
2021-01-29 11:38:03 +01:00
Brown
7ac771da48
Fix #4017 - allow float defaults in namespaced classes 2021-01-29 11:37:59 +01:00
Olle
3630b4a2f9 Merge remote-tracking branch 'remotes/upstream/master' 2020-08-18 15:59:46 +00:00
Bauke van der Woude
7ac6d2e5a4
Fix hash_*() signatures (#4014)
Functions can return false when an invalid algorithm is supplied
2020-08-18 09:35:31 -04:00
Brown
1468a28273 Fix #3999 - allow @psalm-type to reference imported type right above 2020-08-18 09:34:07 -04:00
Brown
134955a5f4 Fix #4011 - prevent mixed assignment in loop 2020-08-18 08:51:09 -04:00
Daniel Melchior
17ed440f2e
fix #4013: prevent exception when two mixins declare methods with same name (#4018)
fixes #4013
2020-08-18 08:38:30 -04:00
Brown
de6b354fa0 Fix #4005 - prevent crash when assignment var assertion no longer valid 2020-08-17 15:47:39 -04:00
Brown
11f170acb4 Don’t modify object after unnecessary assertion 2020-08-16 23:38:59 -04:00
Bruce Weirdan
7adc25c421
Improve import errors (#3997)
* Better errors for invalid type imports

Fixes vimeo/psalm#3885

* Finishing touches

Docs, schema, CS

* Drop unused import

* Drop more unused imports
2020-08-16 22:53:53 -04:00
Bruce Weirdan
22d8f5a0bc
Fixed duplicate shortcodes (#3996)
Also added an utility to help assign new shortcodes and a test to
prevent duplicate shortcodes.
2020-08-16 16:26:54 -04:00
Matthew Brown
cb243778d2 Fix #3917 - allow comparisons between classes and interfaces 2020-08-16 16:25:59 -04:00
Matthew Brown
38af5db8f0 Fix #3929 - merge expanded types where necessary 2020-08-16 16:12:29 -04:00
Matthew Brown
5c20a5295e Improve solution to #3964 2020-08-16 13:03:30 -04:00
Matthew Brown
ec2178d14a Fix #3927 - prevent crash with bad type ref 2020-08-16 12:43:46 -04:00
Matthew Brown
a356a43a51 Fix #3964 - prevent incorrect intersection of unions 2020-08-16 12:26:07 -04:00
Matthew Brown
a0bb5ed37d Fix #3991 - fix test 2020-08-15 14:21:24 -04:00
Brown
cdef4ec351 Alter docblock params too 2020-08-14 16:26:55 -04:00
Brown
dbcf154036 Add fixer for mismatching param names 2020-08-14 15:25:21 -04:00
Brown
209d17c868 Fix #2891 - treat autoloaded constants better 2020-08-13 09:14:27 -04:00
Brown
42c3a703b5 Fix #3741 - detect scalar class constants in if-true assertions 2020-08-12 17:03:41 -04:00
Toshiyuki Goto
e0d1655582
Add an unqualified classes in PHPUnit/Framework/Assert/Functions.php to $knownBadClasses (#3985) 2020-08-11 07:33:11 -04:00
m0003r
e81593f359
Localize types on magic properties (#3971)
* Fix #3949 - localize types on magic properties

* fix failing tests

* fix code style

Co-authored-by: m03r <m03r@m03r.net>
2020-08-10 12:45:21 -04:00
Brown
6def99d653 Add ConstructorSignatureMismatch issue distinct from MethodSignatureMismatch 2020-08-10 12:26:25 -04:00
the-toster
5bdc9723ff
fix for DeprecatedClass suppress on property (#3962)
* add test case for DeprecatedClass suppress on property

* fix test case for DeprecatedClass suppress on property - suppress MissingConstructor also

* ugly way to fix - double analyze propery statement to get dockblock + fix in TypeChecker - respect given suppressed_issues in checkNamedObject

* replace double analyze propery with direct DocBlock manipulation

* replace double analyze propery with direct DocBlock manipulation

* add exception handler to keep original addContextProperties behavior

* correct way to unwrap value from array
2020-08-10 10:50:37 -04:00
lhchavez
ab3016af6e
Fix File-related analysis plugin hooks (#3970)
This change does a few things:

* Renames `BeforeAnalyzeFileInterface` to `BeforeFileAnalysisInterface`.
* Adds a few more parameters to `BeforeFileAnalysisInterface`.
* Since the analysis was never called due to a bug, the above two
  changes are safe to do.
* Fix the above-mentioned bug, and now adds the hooks to the config.
* Update the documentation about the File-related analysis plugin hooks.
* Add a test to ensure that this does not break again in the future.

Fixes: #3969
2020-08-10 10:49:53 -04:00
Matthew Brown
6085e42fc1 Detect mismatching param names effectively 2020-08-10 09:58:43 -04:00
Matthew Brown
50cc3a8afa Align paramter names 2020-08-09 23:19:59 -04:00
Matthew Brown
73321339a3 Bump nikic/php-parser 2020-08-09 16:23:43 -04:00
kazusuke sasezaki
90a50be9f0
quit using combineUnionTypes, when specific TSend provided. (#3966) 2020-08-09 08:26:10 -04:00
Tom Klingenberg
9e38933d30
Resolve require_once command_functions.php (#3961)
Considering the test-suite tests the code from src paired with tests,
not the working directory (or even worse the overall include_path runtime
setting) should lead to relative path resolution, but just the relative
location to the path of the test itself.

Fix by making use of the __DIR__ constant to anchor the relative location
turning it into an absolute path.
2020-08-08 17:38:38 -04:00
Tom Klingenberg
04b6dfdc5b
Fix PSR-4 deprecation notices on composer install (#3959)
Previously when checking out the repository and installing the source
package via `$ composer install` composer did spill deprecation notices for
four files not complying with the PSR-4 auto-loading standard.

This is a minor issue, composer install works and can be addressed by
fixing name-spaces (all of those three are in tests).

For the one function test, fixing the directory structure / dirname of the
(single) affected function test (fourth file).
2020-08-07 23:22:30 -04:00
ygottschalk
f831ebdbcf
narrowed reset and end return type (#3950)
* narrowed `reset` return type
BUT psalm seems to ignore the stub

* narrowed `reset` and `end` return type, this time for real

* fixed UnusedVariable Issue

* fixed RedundantCondition Issue
caused by `end`s return type being more precise

* Improve solution slightly

Co-authored-by: Matthew Brown <github@muglug.com>
2020-08-07 12:23:20 -04:00
Brown
e61765ff9b Fix #3954 - catch ComplicatedExpressionException with added workaround 2020-08-07 08:20:35 -04:00
Brown
afce2dc66f Tighten up rules around instantiation a bit more 2020-08-06 10:18:55 -04:00
Brown
bcf0df4170 Fix a bug with lowercase-string unions 2020-08-05 20:05:57 -04:00
Brown
c0b0036109 Fix #3934 - prevent unsafe use of new static 2020-08-05 19:39:27 -04:00
Brown
e0f5595307 Fix #3932 - try to get assertions of negated expression if instant negation fails 2020-08-05 16:53:30 -04:00
Brown
e808391f56 Fix #3943 - understand trait return types a bit better 2020-08-05 15:58:26 -04:00
Daniel Melchior
fa73c7c9d9
Fix #3757 - allow multiple mixins (#3772) 2020-08-05 15:49:19 -04:00
Brown
38bfc12b98 Fix array_shift behaviour to be more accurate with lists
Fixes #3941
2020-08-05 12:43:37 -04:00
Matthew Brown
9dfdcbef31 Fix #3928 - preserve list-ness when assigning with no offset 2020-08-03 12:30:58 -04:00
Brown
7fc4a85534 Fix CI 2020-08-03 02:45:55 -04:00
Brown
b168777236 Fix #3924 - remove descendants after reconciled change 2020-08-03 02:06:42 -04:00
Brown
bc053e5ee8 Fix #3923 - remember class name when appending array with key 2020-08-03 01:34:46 -04:00
Matthew Brown
ab64ccab88 Fix #3913 properly 2020-07-31 14:56:29 -04:00
Brown
fd4ced42a7 Don’t register new assignment inside isset expr 2020-07-31 12:44:01 -04:00
Brown
57cd21346c Fix #3914 - treat $i++ like $i = $i + 1 2020-07-31 11:26:54 -04:00
Brown
ad1920c3a2 Fix #3910 - improve handling of fgetcsv 2020-07-30 14:21:55 -04:00