Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ on:
jobs:
build:
name: Test
runs-on: Ubuntu-20.04
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v6

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.5
coverage: none

- name: Download dependencies
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v4

- name: Run tests
run: ./vendor/bin/phpunit
70 changes: 10 additions & 60 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ on:
jobs:
phpstan:
name: PHPStan
runs-on: Ubuntu-20.04
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v6

- name: Cache PHPStan
uses: actions/cache@v2
uses: actions/cache@v5
with:
path: .github/.cache/phpstan/
key: phpstan-${{ github.sha }}
Expand All @@ -22,11 +22,11 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.5
coverage: none

- name: Download dependencies
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v4
with:
composer-options: --no-interaction --prefer-dist --optimize-autoloader

Expand All @@ -38,14 +38,14 @@ jobs:

php-cs-fixer:
name: PHP-CS-Fixer
runs-on: Ubuntu-20.04
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v6

- name: Cache PhpCsFixer
uses: actions/cache@v2
uses: actions/cache@v5
with:
path: .github/.cache/php-cs-fixer/
key: php-cs-fixer-${{ github.sha }}
Expand All @@ -54,11 +54,11 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.5
coverage: none

- name: Download dependencies
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v4
with:
composer-options: --no-interaction --prefer-dist --optimize-autoloader

Expand All @@ -67,53 +67,3 @@ jobs:

- name: Execute PHP CS Fixer
run: vendor/bin/php-cs-fixer fix --diff-format udiff --dry-run

psalm:
name: Psalm
runs-on: Ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache Psalm
uses: actions/cache@v2
with:
path: .github/.cache/psalm/
key: psalm-${{ github.sha }}
restore-keys: psalm-

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none

- name: Download dependencies
uses: ramsey/composer-install@v1
with:
composer-options: --no-interaction --prefer-dist --optimize-autoloader

- name: Download Psalm
run: composer bin psalm update --no-interaction --no-progress

- name: Execute Psalm
run: vendor/bin/psalm.phar --no-progress --output-format=github

composer-normalize:
name: Composer Normalize
runs-on: Ubuntu-20.04

steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none
tools: composer-normalize

- name: Checkout code
uses: actions/checkout@v2

- name: Normalize
run: composer-normalize --dry-run
36 changes: 20 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
"license": "proprietary",
"type": "project",
"require": {
"php": ">=8.0",
"php": ">=8.5",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-libxml": "*",
"doctrine/rst-parser": "^0.4",
"nikic/php-parser": "^4.10",
"symfony-tools/docs-builder": "^0.15.0",
"symfony/console": "^5.2",
"symfony/dotenv": "^5.2",
"symfony/event-dispatcher": "^5.2",
"symfony/filesystem": "^5.2",
"symfony/finder": "^5.2",
"symfony/flex": "^1.3.1",
"symfony/framework-bundle": "^5.2",
"symfony/process": "^5.2",
"symfony/twig-bridge": "^5.4",
"symfony/yaml": "^5.2",
"doctrine/rst-parser": "^0.5",
"nikic/php-parser": "^5.7",
"symfony-tools/docs-builder": "^0.27.8",
"symfony/console": "^8.1",
"symfony/dotenv": "^8.1",
"symfony/event-dispatcher": "^8.1",
"symfony/filesystem": "^8.1",
"symfony/finder": "^8.1",
"symfony/flex": "^2",
"symfony/framework-bundle": "^8.1",
"symfony/process": "^8.1",
"symfony/twig-bridge": "^8.1",
"symfony/yaml": "^8.1",
"twig/twig": "^3.3"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4.1",
"phpunit/phpunit": "^9.3.10"
"phpunit/phpunit": "^13.0"
},
"replace": {
"symfony/polyfill-ctype": "*",
Expand All @@ -51,7 +51,11 @@
"preferred-install": {
"*": "dist"
},
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"bamarni/composer-bin-plugin": true,
"symfony/flex": true
}
},
"extra": {
"symfony": {
Expand Down
23 changes: 5 additions & 18 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,13 @@
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
<exclude>tests/Service/CodeRunner/BaseCodeRunnerTest.php</exclude>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<source>
<include>
<directory suffix=".php">src</directory>
</whitelist>
</filter>

<!-- Run `composer require symfony/phpunit-bridge` before enabling this extension -->
<!--
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>
-->

<!-- Run `composer require symfony/panther` before enabling this extension -->
<!--
<extensions>
<extension class="Symfony\Component\Panther\ServerExtension" />
</extensions>
-->
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion src/Service/CodeValidator/PhpValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function validate(CodeNode $node, IssueCollection $issues): void
private function getParser(): Parser
{
if (null === $this->parser) {
$this->parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7);
$this->parser = (new ParserFactory())->createForNewestSupportedVersion();
}

return $this->parser;
Expand Down
7 changes: 3 additions & 4 deletions tests/Service/Validator/PhpValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Doctrine\RST\Configuration;
use Doctrine\RST\Environment;
use Doctrine\RST\Nodes\CodeNode;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use SymfonyTools\CodeBlockChecker\Issue\IssueCollection;
use SymfonyTools\CodeBlockChecker\Service\CodeValidator\PhpValidator;
Expand Down Expand Up @@ -53,9 +54,7 @@ public function testLocalLine()
$this->assertEquals(5, $issues->first()->getLocalLine());
}

/**
* @dataProvider getCodeExamples
*/
#[DataProvider('getCodeExamples')]
public function testCodeExamples(int $errors, string $code, ?string $language = null)
{
$node = new CodeNode(explode(PHP_EOL, $code));
Expand All @@ -65,7 +64,7 @@ public function testCodeExamples(int $errors, string $code, ?string $language =
$this->assertCount($errors, $issues);
}

public function getCodeExamples(): iterable
public static function getCodeExamples(): iterable
{
yield [0, '
namespace Symfony\Component\HttpKernel;
Expand Down
4 changes: 2 additions & 2 deletions vendor-bin/php-cs-fixer/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"require": {
"php": "^7.2.5 || ^8.0",
"friendsofphp/php-cs-fixer": "2.18.3"
"php": "^8.5",
"friendsofphp/php-cs-fixer": "3.95.10"
},
"config": {
"preferred-install": "dist"
Expand Down
4 changes: 2 additions & 2 deletions vendor-bin/phpstan/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"require": {
"php": "^7.2.5 || ^8.0",
"phpstan/phpstan": "0.12.81"
"php": "^8.5",
"phpstan/phpstan": "2.2.2"
},
"config": {
"preferred-install": "dist"
Expand Down
9 changes: 0 additions & 9 deletions vendor-bin/psalm/composer.json

This file was deleted.

Loading