Граф коммитов

812 Коммитов

Автор SHA1 Сообщение Дата
Tyson Andre b6fb0236a9 Use callable to be consistent, fix typo in documentation 2017-12-19 21:55:00 -08:00
Tyson Andre c13af9dce1 Initialize tokenKindToText when DiagnosticsProvider is loaded 2017-12-19 21:55:00 -08:00
Tyson Andre f583f4cd2e Optimize getDiagnostics for speed
Add a simple benchmarking script

Extreme optimization, sacrificing code style in some areas.

- This is meant for discussion, since the project is
  in the optimization phase.

This commit reduces the time needed to getDiagnostics
from 0.013 to 0.007 seconds.

Average time to generate diagnostics (before): 0.013...
Average time to generate diagnostics (after):  0.006921
time to parse (Without diagnostics):           0.036374

(E.g. getDiagnostics previously took 36% of the time compared
to generating an AST,
and now it takes 19% of that time.)
2017-12-19 21:55:00 -08:00
Rob Lourens 0e936a121f
Merge pull request #216 from carusogabriel/early-return
Apply Early Return
2017-12-13 09:35:19 -08:00
Rob Lourens d3d1fecc10
Merge pull request #215 from carusogabriel/null-coalesce-operator
Use Null Coalesce Operator
2017-12-13 09:34:02 -08:00
Gabriel Caruso c435c471f6 Refactoring tests (#217) 2017-12-13 01:47:57 -08:00
Gabriel Caruso bee824b040 Use Null Coalesce Operator 2017-12-13 07:30:58 -02:00
Gabriel Caruso 8680f4545f Apply Early Return 2017-12-13 07:29:58 -02:00
Rob Lourens 10e901a608
Merge pull request #210 from MaartenStaa/fix-new-static-and-instanceof-static
Fix #194 - oddities around the static keyword.
2017-11-17 09:06:43 -08:00
Maarten Staa 9382009c22 Fix #194 - oddities around the static keyword.
Previously, all of the following examples would produce parse errors,
while being valid PHP code:

- new static;
- new static::$a;
- if ($a instanceof static) {}

This commit takes care of these edge cases.
2017-11-17 11:43:39 +01:00
Tomáš Votruba c884bce37a ci(travis): add upcoming PHP 7.2 (#204) 2017-11-15 10:40:05 -08:00
Rob Lourens d3202c84ec
Merge pull request #209 from TysonAndre/perf-micro-opt-eat
Minor performance improvement: Add faster variant of eat()
2017-11-11 18:30:17 -07:00
Rob Lourens 9932c87460
Merge pull request #208 from TysonAndre/phan-remove-unused
Remove unreachable statement and unused variable
2017-11-11 18:28:19 -07:00
Rob Lourens e1258a95b2
Merge pull request #207 from TysonAndre/fix-duplicate-arraykey
nit: Remove duplicate array keys
2017-11-11 18:27:19 -07:00
Rob Lourens b5a67169e8
Merge pull request #206 from gabriel-caruso/phpunit
Update to PHPUnit 6
2017-11-11 18:22:35 -07:00
Tyson Andre 3f08e4282c Minor performance improvement: Add faster variant of eat()
and a faster version of eatOptional().

eat() is called frequently when converting lexed tokens to values,
and often with a single token type. Varargs and array counting would
slow that down.

validatiion/ParserPerformance sped up from 0.581 to 0.574 seconds (1%).
(Added a loop to run on 100 files 10 times, divided by 10, took best times)
2017-11-11 12:33:18 -08:00
Tyson Andre a71ab34029 Remove unreachable statement and unused variable 2017-11-11 12:05:24 -08:00
Tyson Andre 26c64778f7 Remove duplicate array keys from PhpTokenizer.php
Detected via static analysis

When there are duplicate array keys, the last entry takes precedence
(e.g. the removed T_EXIT line had the wrong value)
2017-11-11 12:02:58 -08:00
Gabriel Caruso c5b4f3504f Update to PHPUnit 6 2017-11-11 11:51:16 -02:00
Rob Lourens 77579dfa1e Change GettingStarted to match README change with absolute require 2017-10-30 16:14:48 -07:00
Rob Lourens 2c060ce706
Merge pull request #203 from TomasVotruba/patch-1
README: make require use of __DIR__
2017-10-30 16:13:48 -07:00
Tomáš Votruba 8297d216e1
README: make require use of __DIR__
When we now absolute path, it's be
2017-10-31 00:04:10 +01:00
Rob Lourens 03de0ae0b1 Fix #202 - suppress warnings from token_get_all -
It can produce lots of unnecessary warnings when parsing invalid php syntax
2017-10-30 15:39:40 -07:00
Rob Lourens 69ea4ed415 Merge pull request #200 from TysonAndre/fix-phpdoc
Fix resolution of phpdoc for BreakOrContinueStatement
2017-10-14 23:00:08 -07:00
Tyson Andre 1fc2f28135 Fix resolution of phpdoc for BreakOrContinueStatement
Add phpdoc for parsing expressions.
2017-10-14 13:08:46 -07:00
Rob Lourens 41fd99ffb1 Merge pull request #199 from vinkla/patch-1
Exclude more non-essential files
2017-10-03 14:51:16 -07:00
Vincent Klaiber 77f7f45fd1 Update .gitattributes 2017-10-03 21:18:21 +02:00
Vincent Klaiber 3522a523c4 Exclude more non-essential files
This pull request exclude even more non-essential files when installing this package in production.
2017-10-03 09:07:44 +02:00
Rob Lourens 8aa8c0ab56 Merge pull request #198 from MadHed/diag-validation
Add diagnostics test
2017-09-28 12:57:26 -07:00
Stephan Unverwerth 8378884436 Update expected diagnostic results for continue/break statements 2017-09-28 20:55:59 +02:00
Stephan Unverwerth ca875d95ee Add diagnostics test 2017-09-28 20:52:50 +02:00
Rob Lourens fbac533326 Merge pull request #197 from MadHed/fix-breakout-level-diagnostics
Fix breakout level literal parsing
2017-09-28 11:39:11 -07:00
Stephan Unverwerth 75a901bc50 Fix breakout level literal parsing 2017-09-27 23:05:16 +02:00
Rob Lourens 754db66235 Merge pull request #196 from MadHed/master
Handle parenthesized breakout level
2017-09-26 21:00:14 -07:00
Stephan Unverwerth 870c141736 Fix breakout level number parsing 2017-09-26 22:05:10 +02:00
Stephan Unverwerth 6f9946ede1 Handle parenthesized breakout level 2017-09-26 21:28:37 +02:00
Rob Lourens 099d0b17f2 Merge pull request #187 from TysonAndre/speed-up-token
Speed up token value to name lookup
2017-09-20 12:55:18 -07:00
Tyson Andre b98ede743a Speed up token value to name lookup
Grammar test suite sped up from 1.2 seconds to 1.1 seconds.

This went from O(n) (loop over 183 constants) to O(1) (hash lookup)
2017-09-20 12:43:34 -07:00
Rob Lourens fc9882996c Merge pull request #184 from TysonAndre/fix-misc-framework-errors
Stop including non-php files in validation tests.
2017-09-20 11:52:06 -07:00
Tyson Andre d58538447d Use slashes 2017-09-20 09:53:09 -07:00
Tyson Andre 5256703431 Stop including non-php files in validation tests.
Noticed test failures for pgsql.phpunit.xml in the drupal project's test
files. (contains the substring ".php")

Also, do the matching on the path name, not on the object to string
conversion.
2017-09-19 20:30:31 -07:00
Rob Lourens 52cfb00cdb Merge pull request #183 from TysonAndre/remove-unnecessary-reference
Remove an unnecessary reference from parameter.
2017-09-18 20:31:38 -07:00
Tyson Andre 0104e356bb Remove an unnecessary reference from parameter.
The parameter isn't being modified, so having this is unexpected,
and passing params by reference is slower than passing by value.

The reference was part of the initial commit for src/Token.php
2017-09-18 20:22:54 -07:00
Rob Lourens 7acdeebf1d Merge pull request #177 from TysonAndre/Node-parser-partial-nits
Fix incorrect PHPdoc for src/Parser.php, nit on property assignment
2017-09-18 14:03:09 -07:00
Tyson Andre 1f29666335 Fix incorrect PHPdoc for src/Parser.php, nit on property assignment
Clarify phpdoc of parseDelimitedList

Don't assign a DelimitedList to node->nameParts,
it's declared as an array.
(Has no side effects, this is overwritten afterwards unless nameParts was null)
2017-09-18 13:50:41 -07:00
Rob Lourens da02e0687a Merge pull request #176 from TysonAndre/Node-phpdoc-phan-nits
Make phpdoc of Node and its subclasses more accurate
2017-09-18 13:40:44 -07:00
Tyson Andre 3558e79432 Make phpdoc of Node and its subclasses more accurate
- Some node subclasses have `Token` (not an array) as `$this->children`
- Undefined variable in coalesce
- be more specific about getRoot()'s expected value.
- use string ...$classNames (same syntax as a real signature)
  https://github.com/phpDocumentor/fig-standards/pull/87#r37054459
- EchoExpression has ExpressionList (no expressions would be invalid PHP)
2017-09-14 22:57:37 -07:00
Rob Lourens 5bfa8bbffa Merge pull request #174 from TysonAndre/normalize-space
Normalize spaces in union types in comments ("A | B" -> "A|B")
2017-09-13 10:28:32 -07:00
Tyson Andre 2858366310 Normalize spaces in union types in comments ("A | B" -> "A|B")
Mentioned in discussion of
https://github.com/Microsoft/tolerant-php-parser/pull/136/files

Many IDEs and tools don't expect whitespace, and don't handle this.
So, they may act as if only the first type.

- https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md#appendix-a-types
  is a proposal, and is vague about how whitespace is handled
  outside `<>`
- https://github.com/phpDocumentor/phpDocumentor2/blob/develop/docs/references/phpdoc/tags/var.rst
  is vague
- https://github.com/phpDocumentor/ReflectionDocBlock/blob/master/src/DocBlock/Tags/Var_.php
  doesn't expect any whitespace after `@var`

Remove extra space between `@param` and `@return` union types

Fix DiagnosticsProvider phpdoc
2017-09-12 23:48:42 -07:00
Rob Lourens c26f73270c Merge pull request #172 from dantleech/class_like
Introduced ClassLike Interface
2017-09-08 13:57:18 -07:00