Skip to content

Commit

Permalink
code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nikow13 committed Feb 7, 2025
1 parent f7a0080 commit 1019429
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 44 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php-versions: [ '8.2', '8.3', '8.4']
php-versions: [ '8.0', '8.1', '8.2', '8.3', '8.4']
coverage-driver: [ 'pcov' ]

steps:
Expand Down Expand Up @@ -58,15 +58,15 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}

phar:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: build
steps:
- uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
php-version: 8.0
tools: composer:v2.8
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
Expand All @@ -92,10 +92,10 @@ jobs:

smoke-test-phar:
needs: phar
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
matrix:
php-versions: [ '8.2', '8.3', '8.4' ]
php-versions: [ '8.0', '8.1', '8.2', '8.3', '8.4' ]

steps:
- name: Install PHP
Expand All @@ -116,7 +116,7 @@ jobs:

publish_phar:
needs: [build, smoke-test-phar]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
if: github.event_name == 'release'
steps:
- name: "Download phar ./phparkitect-${{ github.sha }}.phar"
Expand All @@ -135,7 +135,7 @@ jobs:

publish_docker_images:
needs: [build, smoke-test-phar]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

if: github.ref == 'refs/heads/main' || github.event_name == 'release'
steps:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PHP_VERSION=8.4
ARG PHP_VERSION=8.0

FROM php:${PHP_VERSION}-cli-alpine AS php_build

Expand Down
2 changes: 1 addition & 1 deletion src/CLI/Progress/ProgressBarProgress.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
class ProgressBarProgress implements Progress
{
private \Symfony\Component\Console\Output\NullOutput|OutputInterface $output;
private OutputInterface $output;

private ProgressBar $progress;

Expand Down
4 changes: 0 additions & 4 deletions src/CLI/TargetPhpVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
class TargetPhpVersion
{
public const VALID_PHP_VERSIONS = [
'7.1',
'7.2',
'7.3',
'7.4',
'8.0',
'8.1',
'8.2',
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Analyzer/FileParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function test_parse_file(): void
$traverser->reveal(),
$fileVisitor->reveal(),
$nameResolver->reveal(),
TargetPhpVersion::create('7.4')
TargetPhpVersion::create('8.0')
);

$content = '<?php
Expand Down
46 changes: 23 additions & 23 deletions tests/Unit/Analyzer/FileVisitorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Cat implements AnInterface
EOF;

/** @var FileParser $fp */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down Expand Up @@ -84,7 +84,7 @@ class Cat implements AnInterface
EOF;

/** @var FileParser $fp */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down Expand Up @@ -120,7 +120,7 @@ class Cat extends Animal
EOF;

/** @var FileParser $fp */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');

$cd = $fp->getClassDescriptions()[1];
Expand Down Expand Up @@ -149,7 +149,7 @@ public function methodWithAnonymous(): void
EOF;

/** @var FileParser $fp */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');

$cd = $fp->getClassDescriptions()[1];
Expand Down Expand Up @@ -177,7 +177,7 @@ public function __construct(Request $request)
EOF;

/** @var FileParser $fp */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down Expand Up @@ -212,7 +212,7 @@ public function __construct(Request $request, ?Nullable $nullable)
EOF;

/** @var FileParser $fp */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down Expand Up @@ -248,7 +248,7 @@ public function __construct()
EOF;

/** @var FileParser $fp */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.4'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');

$cd = $fp->getClassDescriptions();
Expand Down Expand Up @@ -278,7 +278,7 @@ public function __construct()
EOF;

/** @var FileParser $fp */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.4'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');

$parsingErrors = $fp->getParsingErrors();
Expand Down Expand Up @@ -308,7 +308,7 @@ public function save(Quote $quote): void;
EOF;

/** @var FileParser $fp */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.4'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');

$violations = new Violations();
Expand Down Expand Up @@ -341,7 +341,7 @@ public function doSomething(self $self, static $static)
EOF;

/** @var FileParser $fp */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.4'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');

$cd = $fp->getClassDescriptions();
Expand Down Expand Up @@ -374,7 +374,7 @@ public function foo()
EOF;

/** @var FileParser $fp */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.4'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');

$cd = $fp->getClassDescriptions();
Expand Down Expand Up @@ -441,7 +441,7 @@ public function getStatic(): self
EOF;

/** @var FileParser $fp */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.4'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');

$cd = $fp->getClassDescriptions();
Expand Down Expand Up @@ -847,7 +847,7 @@ public function getRequest(): Request //the violations is reported here
EOF;

/** @var FileParser $fp */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down Expand Up @@ -935,7 +935,7 @@ class MyClass
EOF;

/** @noinspection PhpUnhandledExceptionInspection */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down Expand Up @@ -965,7 +965,7 @@ class MyClass
EOF;

/** @noinspection PhpUnhandledExceptionInspection */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down Expand Up @@ -995,7 +995,7 @@ class MyClass
EOF;

/** @noinspection PhpUnhandledExceptionInspection */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down Expand Up @@ -1027,7 +1027,7 @@ public function __construct(array $dtoList)
EOF;

/** @noinspection PhpUnhandledExceptionInspection */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down Expand Up @@ -1059,7 +1059,7 @@ public function __construct(array $dtoList)
EOF;

/** @noinspection PhpUnhandledExceptionInspection */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down Expand Up @@ -1091,7 +1091,7 @@ public function __construct(array $dtoList)
EOF;

/** @noinspection PhpUnhandledExceptionInspection */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down Expand Up @@ -1126,7 +1126,7 @@ public function __construct(string $var1, array $dtoList, $var2, array $voList)
EOF;

/** @noinspection PhpUnhandledExceptionInspection */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down Expand Up @@ -1159,7 +1159,7 @@ public function getList(): array
EOF;

/** @noinspection PhpUnhandledExceptionInspection */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down Expand Up @@ -1192,7 +1192,7 @@ public function getList(): array
EOF;

/** @noinspection PhpUnhandledExceptionInspection */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down Expand Up @@ -1225,7 +1225,7 @@ public function getList(): array
EOF;

/** @noinspection PhpUnhandledExceptionInspection */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.1'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('8.0'));
$fp->parse($code, 'relativePathName');
$cd = $fp->getClassDescriptions();

Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/CLI/TargetPhpVersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public function test_it_should_ignore_the_patch_number(): void

public function test_it_should_ignore_extra_informations(): void
{
$targetPhpVersion = TargetPhpVersion::create('7.3.33-14+ubuntu22.04.1+deb.sury.org+1');
$targetPhpVersion = TargetPhpVersion::create('8.0.33-14+ubuntu22.04.1+deb.sury.org+1');

$this->assertEquals('7.3', $targetPhpVersion->get());
$this->assertEquals('8.0', $targetPhpVersion->get());
}

public function test_it_should_throw_exception_if_not_valid_php_version(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ public static function shouldMatchNamespacesProvider(): array

/**
* @dataProvider shouldMatchNamespacesProvider
*
* @param mixed $expectedNamespace
* @param mixed $actualFQCN
* @param mixed $explanation
*/
public function test_it_should_match_namespace_and_descendants(string $expectedNamespace, string $actualFQCN, string $explanation): void
{
Expand Down

0 comments on commit 1019429

Please sign in to comment.