Skip to content

Commit

Permalink
Merge branch '2.1.x' into 3.0.x
Browse files Browse the repository at this point in the history
* 2.1.x:
  Bump CI workflows (#113)
  Make data providers static (#114)
  Update branch metadata (#112)
  Fix new Psalm and PHPCS errors (#111)
  Remove obsolete array types
  • Loading branch information
derrabus committed Feb 5, 2024
2 parents 84a527d + 861c870 commit 9a3516d
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 36 deletions.
27 changes: 13 additions & 14 deletions .doctrine-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,34 @@
"docsSlug": "doctrine-lexer",
"versions": [
{
"name": "3.0",
"branchName": "3.0.x",
"name": "3.1",
"branchName": "3.1.x",
"slug": "latest",
"upcoming": true
},
{
"name": "3.0",
"branchName": "3.0.x",
"slug": "3.1",
"current": true
},
{
"name": "2.1",
"branchName": "2.1.x",
"upcoming": true
"slug": "2.1",
"maintained": true
},
{
"name": "2.0",
"branchName": "2.0.x",
"aliases": [
"current",
"stable"
]
},
{
"name": "1.3",
"branchName": "1.3.x",
"upcoming": true
"slug": "2.0",
"maintained": false
},
{
"name": "1.2",
"branchName": "1.2.x",
"slug": "1.2",
"current": true,
"maintained": true
"maintained": false
},
{
"name": "1.1",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ on:
jobs:
coding-standards:
name: "Coding Standards"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@3.0.0"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@4.0.0"
2 changes: 1 addition & 1 deletion .github/workflows/composer-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ on:
jobs:
composer-lint:
name: "Composer Lint"
uses: "doctrine/.github/.github/workflows/composer-lint.yml@3.0.0"
uses: "doctrine/.github/.github/workflows/composer-lint.yml@4.0.0"
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ on:
jobs:
phpunit:
name: "PHPUnit"
uses: "doctrine/.github/.github/workflows/continuous-integration.yml@3.0.0"
uses: "doctrine/.github/.github/workflows/continuous-integration.yml@4.0.0"
with:
php-versions: '["8.1", "8.2"]'
php-versions: '["8.1", "8.2", "8.3"]'
2 changes: 1 addition & 1 deletion .github/workflows/release-on-milestone-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
release:
name: "Git tag, release & create merge-up PR"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@2.1.0"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@4.0.0"
secrets:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ on:
jobs:
static-analysis:
name: "Static Analysis"
uses: "doctrine/.github/.github/workflows/static-analysis.yml@3.0.0"
uses: "doctrine/.github/.github/workflows/static-analysis.yml@4.0.0"
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
"php": "^8.1"
},
"require-dev": {
"doctrine/coding-standard": "^10",
"phpstan/phpstan": "^1.9",
"phpunit/phpunit": "^9.5",
"doctrine/coding-standard": "^12",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.6",
"psalm/plugin-phpunit": "^0.18.3",
"vimeo/psalm": "^5.0"
"vimeo/psalm": "^5.21"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<config name="php_version" value="80100"/>

<!-- Ignore warnings and show progress of the run -->
<arg value="np"/>
<arg value="nps"/>

<file>src</file>
<file>tests</file>
Expand Down
10 changes: 9 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
phpVersion="8.1"
phpVersion="8.3"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="true"
>
<projectFiles>
<directory name="src"/>
Expand Down Expand Up @@ -41,6 +43,12 @@
<file name="src/Token.php" />
</errorLevel>
</MixedReturnStatement>
<PossiblyUnusedProperty>
<errorLevel type="suppress">
<!-- TODO: Cover this property in a test -->
<referencedProperty name="Doctrine\Common\Lexer\Token::$position"/>
</errorLevel>
</PossiblyUnusedProperty>
<ReferenceConstraintViolation>
<errorLevel type="suppress">
<!-- https://github.com/vimeo/psalm/issues/8891 -->
Expand Down
14 changes: 6 additions & 8 deletions src/AbstractLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ abstract class AbstractLexer
/**
* The next token in the input.
*
* @var mixed[]|null
* @psalm-var Token<T, V>|null
* @var Token<T, V>|null
*/
public Token|null $lookahead;

/**
* The last matched/seen token.
*
* @var mixed[]|null
* @psalm-var Token<T, V>|null
* @var Token<T, V>|null
*/
public Token|null $token;

/**
* Composed regex for input parsing.
*
* @var non-empty-string|null
*/
private string|null $regex = null;

Expand Down Expand Up @@ -203,8 +203,7 @@ public function isA(string $value, int|string|UnitEnum $token)
/**
* Moves the lookahead token forward.
*
* @return mixed[]|null The next token or NULL if there are no more tokens ahead.
* @psalm-return Token<T, V>|null
* @return Token<T, V>|null The next token or NULL if there are no more tokens ahead.
*/
public function peek()
{
Expand All @@ -218,8 +217,7 @@ public function peek()
/**
* Peeks at the next token, returns it and immediately resets the peek.
*
* @return mixed[]|null The next token or NULL if there are no more tokens ahead.
* @psalm-return Token<T, V>|null
* @return Token<T, V>|null The next token or NULL if there are no more tokens ahead.
*/
public function glimpse()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/AbstractLexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function tearDown(): void
}

/** @psalm-return list<array{string, list<Token<string, string|int>>}> */
public function dataProvider(): array
public static function dataProvider(): array
{
return [
[
Expand Down Expand Up @@ -170,7 +170,7 @@ public function testGlimpse(string $input, array $expectedTokens): void
}

/** @psalm-return list<array{string, int, string}> */
public function inputUntilPositionDataProvider(): array
public static function inputUntilPositionDataProvider(): array
{
return [
['price=10', 5, 'price'],
Expand Down

0 comments on commit 9a3516d

Please sign in to comment.