Skip to content

Commit

Permalink
Bump min php version to php 7.4 (#448)
Browse files Browse the repository at this point in the history
* bump min php version to php 7.4
* bump ubuntu min verions; adds php 8.2 and 8.3 on smoke test phar step
* bump box version
* specify php version for scrutinizer using a config file
  • Loading branch information
micheleorselli authored Feb 11, 2025
1 parent e162c85 commit 62bcc37
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 32 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
coverage-driver: [ 'pcov' ]

steps:
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
run: ./bin/phpunit -d memory_limit=-1 --coverage-clover clover.xml

- name: Upload coverage to Codecov
if: ${{ matrix.php-versions == '7.2' }}
if: ${{ matrix.php-versions == '7.4' }}
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -66,7 +66,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
php-version: 7.4
tools: composer:v2.2
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
Expand All @@ -92,11 +92,10 @@ jobs:

smoke-test-phar:
needs: phar
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
strategy:
matrix:
php-versions: [ '7.2', '7.3', '7.4', '8.0', '8.1' ]
coverage-driver: [ 'pcov' ]
php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]

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

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

publish_docker_images:
needs: [build, smoke-test-phar]
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"

if: github.ref == 'refs/heads/main' || github.event_name == 'release'
steps:
Expand Down
4 changes: 4 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build:
environment:
php: 7.4

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PHP_VERSION=7.2
ARG PHP_VERSION=7.4

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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ You can add parameters when you launch the tool. At the moment you can add these
phparkitect check --config=/project/yourConfigFile.php
```
* `--target-php-version`: With this parameter, you can specify which PHP version should use the parser. This can be useful to debug problems and to understand if there are problems with a different PHP version.
Supported PHP versions are: 7.2, 7.3, 7.4, 8.0, 8.1, 8.2
Supported PHP versions are: 7.4, 8.0, 8.1, 8.2 8.3
* `--stop-on-failure`: With this option the process will end immediately after the first violation.

## Run only a specific rule
Expand Down
Binary file modified bin/box.phar
Binary file not shown.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}
],
"require": {
"php": "^7.2|^8",
"php": "^7.4|^8",
"symfony/finder": "^3.0|^4.0|^5.0|^6.0|^7.0",
"symfony/event-dispatcher": "^3.0|^4.0|^5.0|^6.0|^7.0",
"symfony/console": "^3.0|^4.0|^5.0|^6.0|^7.0",
Expand Down
2 changes: 0 additions & 2 deletions src/CLI/TargetPhpVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
class TargetPhpVersion
{
public const VALID_PHP_VERSIONS = [
'7.2',
'7.3',
'7.4',
'8.0',
'8.1',
Expand Down
34 changes: 17 additions & 17 deletions tests/Unit/Analyzer/FileVisitorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Cat implements AnInterface
EOF;

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

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

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

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

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

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

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

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

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

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

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

Expand Down Expand Up @@ -848,7 +848,7 @@ public function getRequest(): Request //the violations is reported here
EOF;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/** @noinspection PhpUnhandledExceptionInspection */
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.2'));
$fp = FileParserFactory::createFileParser(TargetPhpVersion::create('7.4'));
$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('7.4.10-14+ubuntu22.04.1+deb.sury.org+1');

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

public function test_it_should_throw_exception_if_not_valid_php_version(): void
Expand Down

0 comments on commit 62bcc37

Please sign in to comment.