Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
171e2eb
Add php 8.1 support to the type-lang/types package
SerafimArts Sep 6, 2026
3aea6a5
Actualize phpstan configs
SerafimArts Sep 6, 2026
78a560c
Simplify AST nodes
SerafimArts Sep 6, 2026
32817e4
Add more AST tests
SerafimArts Sep 6, 2026
6a5da4f
Lowering type-lang/reader package to PHP 8.1
SerafimArts Sep 6, 2026
e71e517
Lowering type-lang/printer package to PHP 8.1 and remove type-lang/pa…
SerafimArts Sep 6, 2026
b301894
Lowering type-lang/parser package to PHP 8.1
SerafimArts Sep 6, 2026
8c8f789
Improve AST node names (improve BC)
SerafimArts Sep 6, 2026
2b5bcdd
Improve reader behaviour
SerafimArts Sep 6, 2026
a9da7aa
Improve printer behaviour
SerafimArts Sep 6, 2026
07604c0
Fix phpdoc PHP 8.1 compatibility using Rector downgrade
SerafimArts Sep 6, 2026
7a0c4b3
Simplify matcher visitor
SerafimArts Sep 6, 2026
9cd089b
Improve type resolvers
SerafimArts Sep 6, 2026
6fe319f
Fix and rebuild grammar
SerafimArts Sep 6, 2026
459fced
Fix parser tests
SerafimArts Sep 6, 2026
ddf9ddb
Improve Name's node API
SerafimArts Sep 6, 2026
a1eb95f
Fix composer dev-dependencies
SerafimArts Sep 6, 2026
57f0e64
Remove unnecessary __toString() methods from AST
SerafimArts Sep 6, 2026
7a9f383
Fix shape rendering tests
SerafimArts Sep 6, 2026
ab3813e
Add more tests for AST
SerafimArts Sep 6, 2026
83ee79b
Improve AST nodes behaviour
SerafimArts Sep 6, 2026
c44d55a
Fix printer
SerafimArts Sep 6, 2026
5c369d1
Fix doc block comments
SerafimArts Sep 6, 2026
3f4c3ab
Add more Name AST tests
SerafimArts Sep 6, 2026
2b21110
Actualize parser DumperVisitor
SerafimArts Sep 6, 2026
6c68433
Fix tests
SerafimArts Sep 6, 2026
c0fb78e
Fix MatcherVisitor
SerafimArts Sep 6, 2026
a770571
Add node offsets and remove attribute nodes
SerafimArts Sep 6, 2026
5409bb6
Fix UnionTypeNode and IntersectionTypeNode in reader
SerafimArts Sep 6, 2026
1ca6110
Fix LogicalTypeNode and remove attributes from printer component
SerafimArts Sep 6, 2026
b850ec0
Apply phpcs
SerafimArts Sep 6, 2026
bea0e06
Upgrade phplrt version
SerafimArts Sep 6, 2026
fea5535
Upgrade spec (remove attributes and fix callable parameter syntax)
SerafimArts Sep 6, 2026
f68a6d0
Actualize docs (remove attributes and fix callable parameter syntax)
SerafimArts Sep 6, 2026
08732e5
Add wrapping AST type comments with examples
SerafimArts Sep 7, 2026
c0e1623
Add logical AST types comments with examples
SerafimArts Sep 7, 2026
59b60e0
Add name + identifier comments and improve Name constructor
SerafimArts Sep 7, 2026
c2513ea
Add support of non-empty node list
SerafimArts Sep 7, 2026
7ab4386
Add wrapping AST types comments
SerafimArts Sep 7, 2026
8653c02
Add scalar nodes and comments
SerafimArts Sep 7, 2026
af3f8d4
Add variable literal node
SerafimArts Sep 7, 2026
d1a0320
Reorganize shape fields
SerafimArts Sep 7, 2026
4eebfde
Add comments with examples to CallableParameterListNode
SerafimArts Sep 7, 2026
8b3b428
Split `variable` and `this` nodes
SerafimArts Sep 7, 2026
f650303
Add comments to the types list AST node
SerafimArts Sep 7, 2026
61d94b4
Add comments to the type AST node
SerafimArts Sep 7, 2026
348e663
Add example comment to the ternary AST node
SerafimArts Sep 7, 2026
6a4b7e3
Add example comment to the named type AST node
SerafimArts Sep 7, 2026
0a69b18
Add variable AST node with comments and usage examples
SerafimArts Sep 7, 2026
9986f9a
Add mask node and wildcard AST node classes
SerafimArts Sep 7, 2026
00a57ad
Rewrite constants and const mask nodes
SerafimArts Sep 7, 2026
721b777
Fix callable parameter var reference and add comment with example
SerafimArts Sep 7, 2026
cd1ea66
Drop gt, gte, lt and lte conditions
SerafimArts Sep 7, 2026
f9df21d
Improve comparison nodes
SerafimArts Sep 7, 2026
ca68cb3
Remove unnecessary comments from literal nodes
SerafimArts Sep 7, 2026
f678c98
Improve shape field comments
SerafimArts Sep 7, 2026
11e2694
Add template argument list count checks (+ phpstan types)
SerafimArts Sep 7, 2026
6d50ea8
Add AST template argument comments
SerafimArts Sep 7, 2026
b3c32ba
Simplify type offset + this AST nodes comments
SerafimArts Sep 7, 2026
871e69b
Remove useless comments from node list
SerafimArts Sep 7, 2026
d2571f0
Fix typos in named type AST node comments
SerafimArts Sep 7, 2026
c839fd6
Simplify Name::$parts AST node comment
SerafimArts Sep 7, 2026
a743cc7
Improve MaskNode AST node comment
SerafimArts Sep 7, 2026
cb690e3
Fix Identifier comment typo
SerafimArts Sep 7, 2026
f675f8b
Improve ConstMaskNode AST node
SerafimArts Sep 7, 2026
9b92edd
Simplify variable node AST node comment
SerafimArts Sep 7, 2026
f1bf219
Add template parameters to the callable type node
SerafimArts Sep 7, 2026
75fe01a
Fix tests
SerafimArts Sep 7, 2026
1ca8d0d
Actualize printer using the new AST structures
SerafimArts Sep 7, 2026
b41308b
Fix tests
SerafimArts Sep 7, 2026
c424f70
Remove phpstan/phpdoc-parser from phpdoc dev-dependencies
SerafimArts Sep 7, 2026
4a77bf3
Move benchmarks to the root package
SerafimArts Sep 7, 2026
bc732d0
Add ConstMaskNode virtual properties
SerafimArts Sep 7, 2026
1e465f4
Fix ConstMaskNode tests
SerafimArts Sep 7, 2026
539a999
Rewrite parser
SerafimArts Sep 7, 2026
0b0c8d2
Fix type map visitor
SerafimArts Sep 7, 2026
eb583c4
Fix TypeOffsetAccessNode::$access property
SerafimArts Sep 7, 2026
e5a363d
Make of/as/super case sensitive
SerafimArts Sep 7, 2026
53679eb
Split T_EQ + T_NOT and disable lexer's unicode
SerafimArts Sep 7, 2026
118cc16
Rebuild parser
SerafimArts Sep 7, 2026
6437079
Improve string parser tests
SerafimArts Sep 7, 2026
e7044e6
Add more string + int literal tests
SerafimArts Sep 7, 2026
803528a
Improve type map tests
SerafimArts Sep 7, 2026
4eb9060
Fix type resolver tests
SerafimArts Sep 7, 2026
62c0550
Fix syntax tests
SerafimArts Sep 7, 2026
19b15c3
Do not import internal namespace into the parser
SerafimArts Sep 7, 2026
4a9ad6d
Improve exceptions
SerafimArts Sep 7, 2026
ca84baa
Rename Parser::parseTolerant() to Parser::partial() and add Parser::v…
SerafimArts Sep 7, 2026
44103d1
Fix parser tests
SerafimArts Sep 7, 2026
91fe7f9
Fix phpstan errors
SerafimArts Sep 7, 2026
ba8a4e2
Fix phpdoc TypeCombinator compatibility
SerafimArts Sep 7, 2026
784270b
Fix php 8.1 compatibility issues in types
SerafimArts Sep 8, 2026
d34f33d
Fix doc block parser php 8.1 compat
SerafimArts Sep 8, 2026
afd5189
Fix php-cs-fixer config
SerafimArts Sep 8, 2026
48fa907
Fix phpdoc tests
SerafimArts Sep 8, 2026
4542153
Improve and reorganize parser exceptions
SerafimArts Sep 8, 2026
5d64d8f
Fix parser tests
SerafimArts Sep 8, 2026
f252311
Fix reader tests
SerafimArts Sep 8, 2026
c27c9dd
Add missing reader stubs
SerafimArts Sep 8, 2026
220d987
Add missing parser exceptions
SerafimArts Sep 8, 2026
9366213
Fix php-cs-fixer config
SerafimArts Sep 8, 2026
d6ee224
Upgrade parser runtime to v4.1
SerafimArts Sep 11, 2026
7308d71
Actualize phpdoc benchmarks
SerafimArts Sep 11, 2026
04df19f
Optimize grammar rules (union/intersection, variable, name and some o…
SerafimArts Sep 11, 2026
89e6b6c
Actualize phpdoc benchmarks
SerafimArts Sep 12, 2026
f8f2476
Fix variables in conditions
SerafimArts Sep 12, 2026
418d325
Add conditions tests
SerafimArts Sep 12, 2026
0c1e4ee
Upgrade specs
SerafimArts Sep 12, 2026
de14476
Actualize docs
SerafimArts Sep 12, 2026
c11269b
Improve benchmarks
SerafimArts Sep 12, 2026
90547a7
Add assert tags
SerafimArts Sep 12, 2026
c4d3cc7
Add assert combinator
SerafimArts Sep 12, 2026
d71f88c
Add assertions to the tests
SerafimArts Sep 12, 2026
606e310
Add assertions to the docs
SerafimArts Sep 12, 2026
3f4d1af
Add missing assertion tag dependencies
SerafimArts Sep 12, 2026
2c4206f
Actualize benchmarks
SerafimArts Sep 12, 2026
996c760
Apply phpcs
SerafimArts Sep 12, 2026
50cec84
Add in-memory parser reset method
SerafimArts Sep 12, 2026
b802aa7
Improve parser's lex method
SerafimArts Sep 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
* text=auto eol=lf
*.pp eol=lf linguist-language=EBNF
*.pp2 eol=lf linguist-language=EBNF
*.pp3 eol=lf linguist-language=EBNF

# GIT
.editorconfig export-ignore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.4', '8.5' ]
php: [ '8.1', '8.2', '8.3', '8.4', '8.5' ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
stability: [ lowest, stable ]
steps:
Expand Down
4 changes: 2 additions & 2 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
strict: true,
));

return new Config()
return (new Config())
->setUnsupportedPhpVersionAllowed(true)
->setParallelConfig(ParallelConfigFactory::detect())
->setRules([
Expand Down Expand Up @@ -277,7 +277,7 @@
'unary_operator_spaces' => true,
'whitespace_after_comma_in_array' => true,
'yoda_style' => false,
'new_expression_parentheses' => true,
'new_expression_parentheses' => ['use_parentheses' => true],
])
->setCacheFile(__DIR__ . '/vendor/.cache.php-cs-fixer')
->setFinder($files);
23 changes: 23 additions & 0 deletions bench/Parser/StringDecoding/PHPStanStringUnescaperBench.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace TypeLang\Bench\Parser\StringDecoding;

use PhpBench\Attributes\Groups;
use PhpBench\Attributes\Iterations;
use PhpBench\Attributes\ParamProviders;
use PhpBench\Attributes\RetryThreshold;
use PhpBench\Attributes\Revs;
use PhpBench\Attributes\Warmup;
use PHPStan\PhpDocParser\Parser\StringUnescaper;

#[Groups(['phpstan']), Revs(1000), Warmup(50), Iterations(15), RetryThreshold(2)]
final class PHPStanStringUnescaperBench extends StringDecodingBench
{
#[ParamProviders('stringsDataProvider')]
public function benchDecodeString(array $params): void
{
StringUnescaper::unescapeString($params['string']);
}
}
41 changes: 41 additions & 0 deletions bench/Parser/StringDecoding/StringDecodingBench.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

namespace TypeLang\Bench\Parser\StringDecoding;

abstract class StringDecodingBench
{
/**
* @var non-empty-string
*/
private const LOREM = 'lorem ipsum dolor sit amet ';

/**
* @var int<1, max>
*/
private const REPEATS = 16;

/**
* @return iterable<non-empty-string, array{string: non-empty-string, double: bool}>
*/
public static function stringsDataProvider(): iterable
{
yield 'plain' => ['string' => '"example"', 'double' => true];
yield 'plain long' => ['string' => '"' . \str_repeat(self::LOREM, 8) . '"', 'double' => true];
yield 'quote' => ['string' => '"a\"b"', 'double' => true];
yield 'few specials' => ['string' => '"line\nand\ttab"', 'double' => true];
yield 'many specials' => ['string' => '"' . \str_repeat('a\nb\tc\r', self::REPEATS) . '"', 'double' => true];
yield 'many backslashes' => ['string' => '"' . \str_repeat('a\\\\b', self::REPEATS) . '"', 'double' => true];
yield 'one hexadecimal' => ['string' => '"a\x41b"', 'double' => true];
yield 'numeric mix' => ['string' => '"\x41\101\u{1F600}\x42"', 'double' => true];
yield 'many numeric' => ['string' => '"' . \str_repeat('\x41\101\u{48}', self::REPEATS) . '"', 'double' => true];
yield 'single quoted plain' => ['string' => "'" . \str_repeat(self::LOREM, 8) . "'", 'double' => false];
yield 'single quoted escaped' => ['string' => "'" . \str_repeat('a\\\\b\\\'c', self::REPEATS) . "'", 'double' => false];
}

/**
* @param array{string: non-empty-string, double: bool} $params
*/
abstract public function benchDecodeString(array $params): void;
}
23 changes: 23 additions & 0 deletions bench/Parser/StringDecoding/TypeLangStringDecoderBench.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace TypeLang\Bench\Parser\StringDecoding;

use PhpBench\Attributes\Groups;
use PhpBench\Attributes\Iterations;
use PhpBench\Attributes\ParamProviders;
use PhpBench\Attributes\RetryThreshold;
use PhpBench\Attributes\Revs;
use PhpBench\Attributes\Warmup;
use TypeLang\Parser\Internal\StringDecoder;

#[Groups(['typelang', 'baseline']), Revs(1000), Warmup(50), Iterations(15), RetryThreshold(2)]
final class TypeLangStringDecoderBench extends StringDecodingBench
{
#[ParamProviders('stringsDataProvider')]
public function benchDecodeString(array $params): void
{
StringDecoder::unpackAndDecode($params['string'], $params['double']);
}
}
Loading
Loading