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

130 Commits

Author SHA1 Message Date
Brown
2c8688dd97 Don’t crash when conditionally defining classes with properties 2020-03-09 14:24:19 -04:00
Matthew Brown
aea33824e6 Fix #1555 - allow phantom class constants 2020-02-18 19:46:05 -05:00
Brown
8989737e51 Fix #2775 - use lowercase strings in a couple more places 2020-02-13 17:44:16 -05:00
Matthew Brown
07a53f6b81 Fix #2789 - Numeric should not be a reserved class name 2020-02-11 22:34:34 -05:00
Matthew Brown
872365f444 Fix #2539 - use unaliased parent class name 2020-01-01 17:23:13 -05:00
Bruce Weirdan
33142e7637 Use unalised trait name when importing aliased trait (#2393)
Fixes vimeo/psalm#2392
Refs vimeo/psalm#2278
2019-11-29 01:21:00 -05:00
lhchavez
216f991b0c Normalize stringified type names (#2239)
This change makes stringified types more normalized. Concretely it sorts
all union types, reconciled types, and sorts the keys within object-like
types.
2019-10-17 01:14:33 -04:00
Matthew Brown
f8a2eae0e2 Fix #2186 - use expanded class name for aliased class 2019-09-30 22:15:48 -04:00
Matthew Brown
5d94e340ee Remove unused suppressions in tests 2019-08-18 15:34:32 -04:00
Brown
a4d57e5524 Fix #2018 - prevent fatal error on class_aliased class reference 2019-08-15 10:17:27 -04:00
Matthew Brown
90854c4094 Fix broken behaviour when analysing interface test methods 2019-07-28 19:44:36 -04:00
Matthew Brown
ab50c6ce2e Fix #1949 - check that aliased name doesn’t exist before transforming 2019-07-17 20:33:44 -04:00
Matthew Brown
da42be175f Apply PHPCS fixes
Fixes #1880
2019-07-05 16:27:53 -04:00
Matthew Brown
802016757c Fix #1891 - don’t enter class_alias if the class doesn’t exist 2019-07-04 15:46:24 -04:00
LeSuisse
f29826b958 Fully qualify constants and function calls (#1849)
This should give a small performance boost.
Part of #1837.

The change is enforced via phpcs and can be autofixed
with phpcbf.
2019-06-26 16:52:29 -04:00
Brown
602bae3bb3 Allow class_exists(..., false) to inform class-string type 2019-05-28 13:16:09 -04:00
Matthew Brown
69150d503a Fix #1682 - correct arg check 2019-05-26 16:26:47 -04:00
Matthew Brown
d51ee033ce
Skip broken test 2019-05-26 14:22:28 -04:00
Matthew Brown
720ad42ab9
Fix test 2019-05-26 13:34:07 -04:00
Matthew Brown
8b9de8bba6 class_esists check with false arg shouldn’t count
Fixes #1682
2019-05-26 13:16:44 -04:00
Matthew Brown
ea930b8875 Fix interface_exists after class_exists check 2019-05-20 20:57:59 -04:00
Matthew Brown
1e853800a3 Fix #1657 - allow interface_exists to generate class-string assertion 2019-05-19 15:56:04 -04:00
Matthew Brown
c772914910 Add some formatting 2019-03-23 14:27:54 -04:00
Brown
b3a59d2638 Fix #1435 - prevent classes extending interfaces 2019-03-07 11:16:40 -05:00
Bruce Weirdan
9bdc9f774f More provider typing 2019-03-02 08:43:19 -05:00
Matthew Brown
17541b415f Fix #1191 - allow Psalm to check against different versions of PHP 2019-02-07 12:25:57 -05:00
Matthew Brown
bf8f76671b Don’t crash when suppressing UndefinedClass with bad params 2019-01-05 12:59:12 -05:00
Matthew Brown
87052537cf Fix #1167 - don’t worry about AbstractInstantiation when it could be a descendant 2019-01-04 12:28:00 -05:00
Matthew Brown
0f6ce983f4 Fix #1154 - parent::foo() calls should not cause exception when parent does not exist 2018-12-30 18:28:15 +01:00
Matthew Brown
4688b25fd9 Move internal classes to own namespace 2018-11-12 11:20:59 -05:00
Matthew Brown
9056353b7f Fix #1065 - allow interface methods to be used in abstract classes 2018-11-10 19:05:51 -05:00
Matthew Brown
200ea70334 Check that non-user-defined abstract methods are implemented, too 2018-07-21 20:50:42 -04:00
Matthew Brown
2af7ea05da Fix #897 - understand static class comparisons in is_a 2018-07-17 22:50:30 -04:00
Matthew Brown
0fa7cbeb02 Fix #895 - check __call magic method args 2018-07-16 22:48:53 -04:00
Matthew Brown
6f96c661ef Fix #881 - skip tests if necessary test classes are missing 2018-07-16 20:52:58 -04:00
Matthew Brown
3a235ad757 Fix #887 - resolve get_class($c) === self::class to current class name 2018-07-13 09:52:15 -04:00
Matt Brown
7c2ec06de8 Fix #795 - don’t use colons in generated anonymous class name 2018-06-06 15:32:03 -04:00
Matt Brown
564cebbaad Fix #669 - improve signatures of mysql 2018-04-13 10:51:18 -04:00
Matt Brown
24f307d568 Fix #645 - add isa- prefix for strings as well as class constants 2018-04-05 12:03:36 -04:00
Matthew Brown
03b3a764e3 Fix #641 - allow is_a to operate on strings as well 2018-04-03 23:14:23 -04:00
Matthew Brown
a0ce8791d3 Detect fatal issues where property access is overridden
Fixes #547
2018-03-04 12:24:50 -05:00
Matt Brown
2120d258a4 Fix formatting of return type adder 2018-01-11 15:50:58 -05:00
Matthew Brown
2f5b05887b Promote CircularReference from exception to issue 2017-12-22 18:56:59 +01:00
Matt Brown
eca7351472 Add return-level issues as well as function-level ones
Fixes #379
2017-12-07 15:50:25 -05:00
Matthew Brown
d455e24958 Make shallow type comparison case insensitive ref #240 2017-10-12 19:46:00 -04:00
Matthew Brown
e29dd140e3 Refactor scanning and analysis, introducing multithreading (#191)
* Add failing test

* Add visitor to soup up classlike references

* Move a whole bunch of code into the visitor

* Move some methods back, move onto analysis stage

* Use the getAliases method everywhere

* Fix refs

* Fix more refs

* Fix some tests

* Fix more tests

* Fix include tests

* Shift config class finding to project checker and fix bugs

* Fix a few more tests

* transition test to new syntax

* Remove var_dump

* Delete a bunch of code and fix mutation test

* Remove unnecessary visitation

* Transition to better mocked out file provider, breaking some cached statement loading

* Use different scheme for naming anonymous classes

* Fix anonymous class issues

* Refactor file/statement loading

* Add specific property types

* Fix mapped property assignment

* Improve how we deal with traits

* Fix trait checking

* Pass Psalm checks

* Add multi-process support

* Delay console output until the end

* Remove PHP 7 syntax

* Update file storage with classes

* Fix scanning individual files and add reflection return types

* Always turn XDebug off

* Add quicker method of getting method mutations

* Queue return types for crawling

* Interpret all strings as possible classes once we see a `get_class` call

* Check invalid return types again

* Fix template namespacing issues

* Default to class-insensitive file names for includes

* Don’t overwrite existing issues data

* Add var docblocks for scanning

* Add null check

* Fix loading of external classes in templates

* Only try to populate class when we haven’t yet seen it’s not a class

* Fix trait property accessibility

* Only ever improve docblock param type

* Make param replacement more robust

* Fix static const missing inferred type

* Fix a few more tests

* Register constant definitions

* Fix trait aliasing

* Skip constant type tests for now

* Fix linting issues

* Make sure caching is off for tests

* Remove unnecessary return

* Use emulative parser if on PHP 5.6

* Cache parser for faster first-time parse

* Fix constant resolution when scanning classes

* Remove test that’s beyond a practical scope

* Add back --diff support

* Add --help for --threads

* Remove unused vars
2017-07-25 16:11:02 -04:00
Matthew Brown
91bdd65588 Fix #179 - check for abstract method instantiations 2017-06-30 10:24:47 -04:00
Matt Brown
ac70ea31b2 Change test assertion keying 2017-06-29 10:22:49 -04:00
Matthew Brown
d6909193ea Add additional formatting changes 2017-05-26 20:05:57 -04:00
Jon Ursenbach
11bc153deb Rewriting and streamlining every unit test with data providers. (#147)
* Rewriting and streamlining every unit test with data providers.

All unit tests have been rewritten into PHPUnit data providers
to reduce the amount of unnecessary code-reuse through out the
test suite.
2017-04-24 23:45:02 -04:00
Matt Brown
a4be86865d Skip Throwable in PHP < 7 2017-03-30 12:12:46 -04:00
Matt Brown
d06a199d25 Fix #121 - simplify all parameter types 2017-03-30 11:44:38 -04:00
Matthew Brown
47de866601 Fix issue using abstract methods from traits 2017-02-22 01:25:51 -05:00
Matthew Brown
5ec2a9742b Fix union type simplification of float|int eradicating int 2017-02-01 19:39:40 -05:00
Matthew Brown
2852eeebad Add return types to tests 2017-02-01 18:11:50 -05:00
Matthew Brown
76b6bc9b3d Prevent Psalm from storing unnecessary checkers 2017-02-01 18:11:00 -05:00
Matt Brown
a7872472be Add stubbing tests and modify config initialisation 2017-01-31 19:22:05 -05:00
Matt Brown
8c68861cc3 Fix #81 - interface inheritance checks were broken 2017-01-30 18:38:23 -05:00
Matthew Brown
daa923e243 Stop analysis if parent class cannot be located 2017-01-23 13:36:06 -07:00
Matthew Brown
3ad6ec2e34 Be more resilient if we ignore that parent class does not exist 2017-01-23 13:21:40 -07:00
Matthew Brown
894b25487f Fix #71 - prevent instantiation of abstract classes 2017-01-20 00:10:10 -05:00
Matthew Brown
9d1b382820 Fix #48 by recording class definition line number & file path 2017-01-19 23:45:21 -05:00
Matthew Brown
b3726c9de5 Use getcwd() for the project’s base, not the config file parent directory 2017-01-16 18:33:04 -05:00
Matthew Brown
5315fd15ad Fix namespaced functions in regular use statements 2017-01-16 00:49:12 -05:00
Matthew Brown
78c1138a94 Fix #53 - add back extends checks for reflected classes 2017-01-14 19:34:10 -05:00
Matt Brown
6e6106c080 Add docblocks to tests 2017-01-13 14:07:23 -05:00
Matt Brown
c181f47364 Fix #35 and #40 by improving method signature checks 2017-01-13 12:03:22 -05:00
Matthew Brown
c90a479b15 Fix self-referential issue 2017-01-08 13:53:40 -05:00
Matthew Brown
5cc97e380d Fix issue evaluating Foo::class 2017-01-07 17:24:43 -05:00
Matthew Brown
17329015dc Discriminate between checking, visiting and analyzing in method names 2017-01-07 15:09:47 -05:00
Matthew Brown
7609ca02c0 Fix #32 by evaluating all class references in files lazily 2017-01-04 23:42:58 -05:00
Matthew Brown
b529fa4877 Move static method arrays into MethodStorage classes 2016-12-30 15:53:35 -05:00
Matthew Brown
23a414a2b3 Fix test failures 2016-12-30 13:14:17 -05:00
Matthew Brown
8b5e066ba6 Add case-sensitive function names 2016-12-30 13:09:00 -05:00
Matthew Brown
a91fc2d3dc Add pre-run step so all class declarations in a given file can be dealt with 2016-12-28 22:11:50 -05:00
Matthew Brown
52b3e1ba8c Simplify test config setup; 2016-12-18 19:00:32 -05:00
Matthew Brown
d88bb4e135 Finish adding tests for all issues 2016-12-16 22:16:29 -05:00
Matt Brown
c91e457c28 Add psalm.xml support for checking tests 2016-12-14 12:55:23 -05:00
Matt Brown
154d023a9d Add more robust config testing 2016-12-14 12:28:38 -05:00
Matthew Brown
4c21a5af7c Add so many new tests 2016-12-11 23:41:11 -05:00