Skip to content

Commit d0abc77

Browse files
committed
feat: override
Signed-off-by: Julien Guittard <julien.guittard@me.com>
1 parent 058a883 commit d0abc77

14 files changed

+96
-0
lines changed

.github/workflows/ci.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
on:
2+
- push
3+
4+
name: Continuous Integration
5+
jobs:
6+
tests:
7+
name: Run tests
8+
runs-on: ubuntu-22.04
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Install PHP
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: 8.4
17+
coverage: xdebug
18+
tools: composer:v2
19+
env:
20+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Get Composer Cache Directory
23+
id: composer-cache
24+
run: echo "{cache_dir}={$(composer config cache-files-dir)}" >> $GITHUB_OUTPUT
25+
26+
- name: Cache PHP dependencies
27+
uses: actions/cache@v4
28+
id: vendor-cache
29+
with:
30+
path: vendor
31+
key: ${{ runner.os }}-build-${{ hashFiles('**/composer.lock') }}
32+
33+
- name: Install Composer dependencies
34+
if: steps.composer-cache.outputs.cache-hit != 'true'
35+
uses: php-actions/composer@v6
36+
with:
37+
php_version: 8.4
38+
version: 2
39+
args: --ignore-platform-reqs
40+
env:
41+
ACTION_PHP_VERSION: 8.4
42+
43+
- name: Run code styling with phpcs
44+
run: ./vendor/bin/phpcs
45+
46+
- name: Run header check with docheader
47+
run: ./vendor/bin/docheader check src/ test/
48+
49+
- name: Run static code analysis with psalm
50+
run: ./vendor/bin/psalm --config=psalm.xml
51+
52+
# - name: Run unit tests with phpunit
53+
# run: ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml
54+
55+
# - name: Run coverage
56+
# env:
57+
# COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
# run: ./vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v

src/Command/ConvertCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
namespace Phayne\UAParser\Command;
1414

15+
use Override;
1516
use Phayne\UAParser\Util\Converter;
1617
use Symfony\Component\Console\Command\Command;
1718
use Symfony\Component\Console\Input\InputArgument;
@@ -31,6 +32,7 @@ public function __construct(private readonly string $resourceDirectory, private
3132
parent::__construct('ua-parser:convert');
3233
}
3334

35+
#[Override]
3436
protected function configure(): void
3537
{
3638
$this
@@ -51,6 +53,7 @@ protected function configure(): void
5153
;
5254
}
5355

56+
#[Override]
5457
protected function execute(InputInterface $input, OutputInterface $output): int
5558
{
5659
$file = $input->getArgument('file');

src/Command/FetchCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
namespace Phayne\UAParser\Command;
1414

15+
use Override;
1516
use Phayne\UAParser\Util\Fetcher;
1617
use Symfony\Component\Console\Command\Command;
1718
use Symfony\Component\Console\Input\InputArgument;
@@ -33,6 +34,7 @@ public function __construct(private readonly string $defaultYamlFile)
3334
parent::__construct('ua-parser:fetch');
3435
}
3536

37+
#[Override]
3638
protected function configure(): void
3739
{
3840
$this
@@ -47,6 +49,7 @@ protected function configure(): void
4749
;
4850
}
4951

52+
#[Override]
5053
protected function execute(InputInterface $input, OutputInterface $output): int
5154
{
5255
$file = $input->getArgument('file');

src/Command/LogfileCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
namespace Phayne\UAParser\Command;
1414

15+
use Override;
1516
use Phayne\UAParser\Exception\InvalidArgumentException;
1617
use Phayne\UAParser\Exception\ReaderException;
1718
use Phayne\UAParser\Parser;
@@ -46,6 +47,7 @@
4647
*/
4748
class LogfileCommand extends Command
4849
{
50+
#[Override]
4951
protected function configure(): void
5052
{
5153
$this
@@ -84,6 +86,7 @@ protected function configure(): void
8486
);
8587
}
8688

89+
#[Override]
8790
protected function execute(InputInterface $input, OutputInterface $output): int
8891
{
8992
if (!$input->getOption('log-file') && !$input->getOption('log-dir')) {

src/Command/ParserCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
namespace Phayne\UAParser\Command;
1414

15+
use Override;
1516
use Phayne\UAParser\Parser;
1617
use Symfony\Component\Console\Command\Command;
1718
use Symfony\Component\Console\Input\InputArgument;
@@ -25,6 +26,7 @@
2526
*/
2627
class ParserCommand extends Command
2728
{
29+
#[Override]
2830
protected function configure(): void
2931
{
3032
$this
@@ -38,6 +40,7 @@ protected function configure(): void
3840
;
3941
}
4042

43+
#[Override]
4144
protected function execute(InputInterface $input, OutputInterface $output): int
4245
{
4346
$userAgent = $input->getArgument('user-agent');

src/Command/UpdateCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
namespace Phayne\UAParser\Command;
1414

15+
use Override;
1516
use Phayne\UAParser\Util\Converter;
1617
use Phayne\UAParser\Util\Fetcher;
1718
use Symfony\Component\Console\Command\Command;
@@ -31,6 +32,7 @@ public function __construct(private readonly string $resourceDirectory)
3132
parent::__construct('ua-parser:update');
3233
}
3334

35+
#[Override]
3436
protected function configure(): void
3537
{
3638
$this
@@ -45,6 +47,7 @@ protected function configure(): void
4547
;
4648
}
4749

50+
#[Override]
4851
protected function execute(InputInterface $input, OutputInterface $output): int
4952
{
5053
$fetcher = new Fetcher();

src/Result/AbstractClient.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
namespace Phayne\UAParser\Result;
1414

15+
use Override;
1516
use Stringable;
1617

1718
/**
@@ -23,6 +24,7 @@ abstract class AbstractClient implements Stringable
2324
{
2425
abstract public function toString(): string;
2526

27+
#[Override]
2628
public function __toString(): string
2729
{
2830
return $this->toString();

src/Result/AbstractSoftware.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
namespace Phayne\UAParser\Result;
1414

15+
use Override;
16+
1517
/**
1618
* Class AbstractSoftware
1719
*
@@ -21,6 +23,7 @@ abstract class AbstractSoftware extends AbstractClient
2123
{
2224
public string $family = 'Other';
2325

26+
#[Override]
2427
public function toString(): string
2528
{
2629
return $this->family;

src/Result/AbstractVersionedSoftware.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
namespace Phayne\UAParser\Result;
1414

15+
use Override;
16+
1517
use function array_filter;
1618
use function implode;
1719

@@ -24,6 +26,7 @@ abstract class AbstractVersionedSoftware extends AbstractSoftware
2426
{
2527
abstract public function toVersion(): string;
2628

29+
#[Override]
2730
public function toString(): string
2831
{
2932
return implode(' ', array_filter([$this->family, $this->toVersion()]));

src/Result/Client.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
namespace Phayne\UAParser\Result;
1414

15+
use Override;
16+
1517
/**
1618
* Class Client
1719
*
@@ -29,6 +31,7 @@ public function __construct(public string $originalUserAgent)
2931
{
3032
}
3133

34+
#[Override]
3235
public function toString(): string
3336
{
3437
return sprintf('%s / %s', $this->ua->toString(), $this->os->toString());

0 commit comments

Comments
 (0)