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

893 Коммитов

Автор SHA1 Сообщение Дата
Rob Lourens 457738cbec
Merge pull request #410 from TysonAndre/fix-notices
Fix php 8.4 notices about implicitly nullable parameters
2024-09-28 04:58:12 -07:00
Tyson Andre 45291ee33a Fix php 8.4 notices about implicitly nullable parameters
And fix notice about deprecated string encapsulation syntax
2024-08-11 10:20:09 -04:00
Rob Lourens 4fd2db98d6
Merge pull request #409 from phpactor/readonly-attr
bugfix: Support attributes on readonly classes
2024-01-29 11:55:51 -03:00
Rob Lourens 8781df1a47
Merge pull request #405 from sh-cho/patch-1
Replace CI badge
2024-01-29 11:54:37 -03:00
Daniel Leech c660589a7e bugfix: Support attributes on readonly classes 2024-01-06 17:59:11 +00:00
Seonghyeon Cho 67bd085cec
Replace CI badge 2023-12-26 00:15:13 +09:00
Rob Lourens 3ccba9770d
Merge pull request #403 from microsoft/users/GitHubPolicyService/4f20d80b-648a-4e5d-95ca-a6a9b767af94
Adding Microsoft SECURITY.MD
2023-06-07 00:52:01 -07:00
microsoft-github-policy-service[bot] 70a5e4382c
Microsoft mandatory file 2023-06-07 01:14:33 +00:00
Rob Lourens cc6156e04f
Merge pull request #402 from sytranvn/edit-docs
Fix typos
2023-06-06 18:14:27 -07:00
Sy Tran Dung 16c1c13bea
Update Overview.md 2023-05-30 23:31:03 +07:00
Sy Tran Dung 981d92be63
Update HowItWorks.md 2023-05-30 23:27:18 +07:00
Rob Lourens a705c41652
Merge pull request #401 from zobo/resolve-qualifiedname-trait-use
fix: Allow getResolvedName to resolve QualifiedName in TraitUseClause
2023-05-17 18:31:35 -07:00
Damjan Cvetko 57e78ca302
Add tests to check for trait QualifiedName resolving 2023-05-17 01:37:24 +02:00
Damjan Cvetko 0772bfa6d1
fix: Allow getResolvedName to resolve QualifiedName in TraitUseClause 2023-05-16 10:41:43 +02:00
Rob Lourens 84ce745a39
Merge pull request #398 from dantleech/enum-interface-cluase
Support Enum Interface clause
2023-04-20 21:57:45 -07:00
Daniel 1a59cc2ae7 Add interface clause 2023-04-20 21:43:33 +01:00
Daniel 4bbff613ba Add extra nodes 2023-04-20 21:41:50 +01:00
Daniel b53236e60e Add testes 2023-04-20 21:41:43 +01:00
Rob Lourens b443ec8913
Merge pull request #396 from phpactor/phpstan-level-4
Phpstan level 4
2023-01-08 14:13:52 -08:00
Daniel Leech 539b8c3418 Improve comment 2023-01-08 10:06:08 +00:00
Daniel Leech be9371d4ad Remove TODO 2023-01-08 10:00:53 +00:00
Tyson Andre ce5acf3186 Use PHPDoc `@param string ...$classNames`
The `string` is the type of each argument.
The `...` indicates that it is an array of that type, like
`function (string ...$classNames)` also would indicate.

Update code to PHPStan Level 3

Added ReturnTypeWillChange

Fix return type for Expression

Add type hints for returned variables

Add generic parameter for delimted list

Fixing type hints

Ignore co-variance error

Remove TODO - it already must always be a Node

Ignore error

Add missing types

Update phpstan to level 3

Add phpstan to dev reqs

No need to install phpstan independently

Do not override unary expression operand

It seems to me that the operand can be any expression

Added token to operand types -- should this be MissingToken?

Include tokens in return types

ExpressionStatement => EchoStatement

It seems this is always an EchoStatement not an ExpressionStatement

unaryExpressionOrHigher can return a ThrowExpression

Remove overridden property

Add Token to union

Remove QualifiedName and rename local variable

Remove unused import

Add return types

Remove trailing whitespace

Add MissingToken type

Ignore "should not happen" statement

Bump to level 4

Remove !is_null conditional branch - it always returns Node

NamespaceUseDeclaration#useClauses is technically nullable

NamespaceUseGroupCluase#functionOrConst can be NULL

Add TODO

Removed redundant condition (check)

Add return type

Add retutn type, remove inaccurate docblock

Fix bug with get string literal text, as it returned the quotes

Ignore assumed false-positive from PHPStan

If allowEmptyElements if `false`...

... then it MUST be true in the right hand side of ||

backslash can be NULL

BinaryExpresionOrHigher can return MIssingToken

Ignoring error to be safe (as commented) and more type hints

Set level to 4

Add explanation
2023-01-05 23:50:26 +00:00
Rob Lourens 6bd3e3ba00
Merge pull request #385 from dantleech/phpstan-level-3
PHPStan Level 3
2022-11-21 14:14:04 -08:00
Daniel Leech 937564f03f Update code to PHPStan Level 3
Added ReturnTypeWillChange

Fix return type for Expression

Add type hints for returned variables

Add generic parameter for delimted list

Fixing type hints

Ignore co-variance error

Remove TODO - it already must always be a Node

Ignore error

Add missing types

Update phpstan to level 3

Add phpstan to dev reqs

No need to install phpstan independently

Do not override unary expression operand

It seems to me that the operand can be any expression

Added token to operand types -- should this be MissingToken?

Include tokens in return types

ExpressionStatement => EchoStatement

It seems this is always an EchoStatement not an ExpressionStatement

unaryExpressionOrHigher can return a ThrowExpression

Remove overridden property

Add Token to union

Remove QualifiedName and rename local variable

Remove unused import

Add return types

Remove trailing whitespace

Add MissingToken type
2022-10-08 10:49:43 +02:00
Rob Lourens 3eccfd2733
Merge pull request #387 from TysonAndre/exclude-github-directory
Exclude phpstan.neon and .github directories from packages
2022-10-05 10:30:19 -07:00
Rob Lourens 2e6da2eb8a
Merge pull request #389 from TysonAndre/halt-compiler-fix
Fix handling of HaltCompilerStatement
2022-10-05 10:29:34 -07:00
Rob Lourens e966047bed
Merge pull request #391 from dantleech/gh-390
Fix regression with getNamespacedName()
2022-10-05 10:21:19 -07:00
Daniel Leech ec763b3641 Fix regression 2022-10-03 19:06:18 +02:00
Tyson Andre 8d3d0bbf59 Put opening brace on the same line as the method 2022-09-26 09:09:01 -04:00
Tyson Andre d9e3877127 Make HaltCompilerStatement inline html start=fullStart
Include whitespace before the data as part of the data for invalid ASTs.
2022-09-25 19:05:27 -04:00
Tyson Andre 2218a406a9 Add test of invalid __halt_compiler without args
All properties should be MissingTokens and non-null
2022-09-25 15:20:50 -04:00
Tyson Andre 91435773f8 Rename local variable to $haltCompilerStatement 2022-09-25 15:16:12 -04:00
Tyson Andre 525acedf12 Fix handling of HaltCompilerStatement
Make it easier to calculate `__COMPILER_HALT_OFFSET__`.
Related to #381

Address other edge cases
2022-09-25 15:15:27 -04:00
Tyson Andre d0a5548012 Exclude phpstan.neon and .github directories from packages
Exclude these files/directories when publishing releases to composer.
.github only contains files for GitHub workflows (CI) right now.
2022-09-25 09:01:51 -04:00
Rob Lourens a35ec03ed3
Merge pull request #384 from TysonAndre/classNames-nit
Use PHPDoc `@param string ...$classNames`
2022-09-24 19:22:28 -07:00
Rob Lourens 101689060f
Merge pull request #383 from TysonAndre/source-file-node-nit
Change getUri return type to nullable string
2022-09-24 19:17:21 -07:00
Rob Lourens ba1f1e804b
Merge pull request #382 from TysonAndre/halt-compiler-support
Support `__halt_compiler` statement
2022-09-24 19:16:25 -07:00
Rob Lourens 6f49c640c0
Merge pull request #379 from TysonAndre/fix-base-clause
Add MissingToken for missing QualifiedName
2022-09-24 19:03:22 -07:00
Rob Lourens 9d9b602dc0
Merge pull request #380 from TysonAndre/speed-up-validation-suite
Speed up running the framework validation test suite
2022-09-24 18:43:16 -07:00
Rob Lourens 735ce08380
Merge pull request #378 from TysonAndre/update-syntax-visualizer
Update example ast output to latest version's output
2022-09-24 18:35:28 -07:00
Tyson Andre 107ac4aded Use PHPDoc `@param string ...$classNames`
The `string` is the type of each argument.
The `...` indicates that it is an array of that type, like
`function (string ...$classNames)` also would indicate.
2022-09-22 08:52:08 -04:00
Tyson Andre 8ed21ce428 Change getUri return type to nullable string
`Parser::parseSourceFile()` accepts a nullable string $uri.
Avoid a potential type error
2022-09-22 08:44:13 -04:00
Tyson Andre 8e63602b22 Remove unused use statement 2022-09-22 08:40:02 -04:00
Tyson Andre a036846945 Support `__halt_compiler` statement
https://www.php.net/manual/en/function.halt-compiler.php can be used to
embed data in php scripts from the outermost scope.
In inner scope, it is parsed in php-src only for the sake of error
messages about it needing to be in the outermost scope, so treat it as
an unexpected token in other contexts.

(In an inner `{...}` scope, the call to `token_get_all()` will still
stop after `__halt_compiler();`, returning T_INLINE_HTML,
so the remaining statements can't be parsed, anyway)

Additionally, `__halt_compiler` can't be used as a name, a member name
(e.g. method name), etc, so calling it `TokenKind::Name` seems
incorrect. (`__COMPILER_HALT_OFFSET__` is already properly a Name)

Closes #381
2022-08-27 08:41:01 -04:00
Tyson Andre da1f15e5e1 Speed up running the framework validation test suite
1. We're parsing thousands of files and there are many tokens per file.
   The overhead of all the assert statements is noticeable.
   Optimizing out the check speeds this up 3x from 90 seconds to 30 seconds.
2. Don't write files only to unlink them later.
   Instead, save the failed file only on test suite failure
2022-08-26 18:59:33 -04:00
Tyson Andre 7e6cb20fec Add MissingToken for missing QualifiedName
And emit a diagnostic - these would be parse errors in php
2022-08-26 18:37:16 -04:00
Tyson Andre ca842b44ba Update example syntax-visualizer output to latest version 2022-08-25 21:09:24 -04:00
Rob Lourens a60544ed0a
Merge pull request #375 from TysonAndre/8.2-union-of-intersection
Support php 8.2 `A|(B&C)` dnf types
2022-08-25 16:22:39 -05:00
Rob Lourens 49058c4146
Merge pull request #374 from TysonAndre/support-never
Support php 'never' type, change parsing of 'void'
2022-08-25 14:05:12 -05:00
Tyson Andre 15362b1e8f Remove impossible check for empty list
AmpersandToken would only occur on odd numbered offsets
2022-08-23 08:27:01 -04:00