Skip to content

Commit 6e38e91

Browse files
authored
Merge pull request #4 from pongee/php81
Switch to Php8.1
2 parents 28eb2b3 + a78799e commit 6e38e91

File tree

106 files changed

+420
-215
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+420
-215
lines changed

.github/workflows/tests.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ jobs:
1212
fail-fast: true
1313
matrix:
1414
php:
15-
- '8.0'
1615
- '8.1'
16+
- '8.2'
17+
- '8.3'
18+
- '8.4'
1719

1820
name: PHP ${{ matrix.php }}
1921

@@ -38,3 +40,9 @@ jobs:
3840

3941
- name: Run static analysis
4042
run: composer run-script phpstan
43+
44+
- name: Run rector
45+
run: composer run-script rector-dry-run
46+
47+
- name: Run phpcs analysis
48+
run: composer run-script phpcs

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [4.0.0] - 2024-01-04
8+
### Changed
9+
- Switch to PHP 8.1
10+
711
## [3.2.0] - 2022-03-05
812
### Added
913
- Base Apache Cassandra support

composer.json

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@
1010
"plantuml"
1111
],
1212
"require": {
13-
"php": ">=8.0",
13+
"php": ">=8.1",
1414
"ext-json": "*",
15-
"symfony/console": "^3.0|^4.0|^5.0|^6.0",
16-
"twig/twig": "^2.0"
15+
"symfony/console": "^5.0||^6.0",
16+
"twig/twig": "^3.0"
1717
},
1818
"require-dev": {
19-
"roave/security-advisories": "dev-master",
20-
"phpunit/phpunit": "^9.0",
21-
"squizlabs/php_codesniffer": "^3.0",
22-
"slevomat/coding-standard": "^7.0",
23-
"phpstan/phpstan": "^1.4"
19+
"phpstan/phpstan": "^2.0",
20+
"phpunit/phpunit": "^10.0",
21+
"rector/rector": "^2.0",
22+
"roave/security-advisories": "dev-latest",
23+
"slevomat/coding-standard": "^8.0",
24+
"squizlabs/php_codesniffer": "^3.0"
2425
},
2526
"autoload": {
2627
"psr-4": {
@@ -36,9 +37,11 @@
3637
"database-schema-visualization"
3738
],
3839
"scripts": {
39-
"phpcs": "phpcs --standard=PSR12",
40-
"phpstan": "phpstan analyse",
41-
"test": "php ./vendor/bin/phpunit"
40+
"phpcs": "phpcs",
41+
"phpstan": "phpstan analyse --memory-limit=512M",
42+
"test": "php ./vendor/bin/phpunit",
43+
"rector": "php ./vendor/bin/rector process example src test",
44+
"rector-dry-run": "php ./vendor/bin/rector process example src test --dry-run"
4245
},
4346
"config": {
4447
"allow-plugins": {

example/code/image.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
use Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Connection\ConnectionCollection;
46
use Pongee\DatabaseSchemaVisualization\Export\Plantuml;

example/code/json.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
use Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Connection\ConnectionCollection;
46
use Pongee\DatabaseSchemaVisualization\Export\Json;

example/code/plantuml.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
use Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Connection\ConnectionCollection;
46
use Pongee\DatabaseSchemaVisualization\Export\Plantuml;

phpcs.xml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
<?xml version="1.0"?>
22
<ruleset>
3-
<config name="testVersion" value="7.1-"/>
43
<arg name="colors"/>
54

65
<file>src</file>
76
<file>test</file>
7+
<file>example</file>
88

9-
<rule ref="PSR2"/>
10-
<rule ref="Generic.Arrays.DisallowLongArraySyntax.Found"/>
11-
12-
<config name="installed_paths" value="../../slevomat/coding-standard"/>
13-
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
14-
<properties>
15-
<property name="newlinesCountBetweenOpenTagAndDeclare" value="0"/>
16-
<property name="spacesCountAroundEqualsSign" value="0"/>
17-
</properties>
18-
</rule>
19-
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/>
20-
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>
9+
<rule ref="PSR12"></rule>
2110
</ruleset>

phpstan.neon.dist renamed to phpstan.neon

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,3 @@ parameters:
1616

1717
fileExtensions:
1818
- php
19-
20-
excludes_analyse:
21-
- vendor
22-

rector.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
use Rector\Config\RectorConfig;
5+
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
6+
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
7+
use Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector;
8+
use Rector\DeadCode\Rector\Property\RemoveUselessReadOnlyTagRector;
9+
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
10+
11+
return RectorConfig::configure()
12+
->withRules([
13+
RemoveUselessParamTagRector::class,
14+
RemoveUselessReturnTagRector::class,
15+
RemoveUselessReadOnlyTagRector::class,
16+
RemoveNonExistingVarAnnotationRector::class,
17+
RemoveUselessVarTagRector::class,
18+
])
19+
->withPreparedSets(
20+
typeDeclarations: true,
21+
)
22+
->withPhpSets(
23+
php81: true,
24+
);

src/Command/Mysql/MysqlCommandAbstract.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\Command\Mysql;
46

@@ -16,15 +18,11 @@ abstract class MysqlCommandAbstract extends Command
1618
protected const ARGUMENT_FILE = 'file';
1719
protected const OPTION_CONNECTION = 'connection';
1820

19-
protected ParserInterface $parser;
20-
2121
protected string $rootDir;
2222

23-
public function __construct(ParserInterface $parser, string $rootDir)
23+
public function __construct(protected ParserInterface $parser, string $rootDir)
2424
{
2525
parent::__construct();
26-
27-
$this->parser = $parser;
2826
$this->rootDir = rtrim($rootDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
2927

3028
$this
@@ -103,9 +101,10 @@ protected function getForcedConnections(array $connections): ConnectionCollectio
103101
\.
104102
(?<parentTableColumns>[^.]+)
105103
$
106-
#x', $connection, $matches);
104+
#x', (string) $connection, $matches);
107105

108-
if (!empty($matches['childTableName'])
106+
if (
107+
!empty($matches['childTableName'])
109108
&& !empty($matches['childTableColumns'])
110109
&& !empty($matches['parentTableName'])
111110
&& !empty($matches['parentTableColumns'])

src/Command/Mysql/MysqlImageCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\Command\Mysql;
46

src/Command/Mysql/MysqlJsonCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\Command\Mysql;
46

src/Command/Mysql/MysqlPlantumlCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\Command\Mysql;
46

src/DataObject/Sql/Database/Connection/ConnectionAbstract.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Connection;
46

src/DataObject/Sql/Database/Connection/ConnectionCollection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Connection;
46

src/DataObject/Sql/Database/Connection/ConnectionCollectionInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Connection;
46

src/DataObject/Sql/Database/Connection/ConnectionInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Connection;
46

src/DataObject/Sql/Database/Connection/ConnectionIterator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Connection;
46

src/DataObject/Sql/Database/Connection/NotDefinedConnection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Connection;
46

src/DataObject/Sql/Database/Connection/OneToManyConnection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Connection;
46

src/DataObject/Sql/Database/Connection/OneToOneConnection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Connection;
46

src/DataObject/Sql/Database/Table.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database;
46

@@ -23,17 +25,17 @@ class Table implements TableInterface
2325
{
2426
private string $name = '';
2527

26-
private ColumnCollectionInterface|ColumnCollection $columns;
28+
private readonly ColumnCollectionInterface|ColumnCollection $columns;
2729

2830
private ?PrimaryKeyInterface $primaryKey = null;
2931

30-
private SimpleIndexCollection|SimpleIndexCollectionInterface $simpleIndexes;
32+
private readonly SimpleIndexCollection|SimpleIndexCollectionInterface $simpleIndexes;
3133

32-
private UniqueIndexCollectionInterface|UniqueIndexCollection $uniqueIndexes;
34+
private readonly UniqueIndexCollectionInterface|UniqueIndexCollection $uniqueIndexes;
3335

34-
private FulltextIndexCollectionInterface|FulltextIndexCollection $fulltextIndexes;
36+
private readonly FulltextIndexCollectionInterface|FulltextIndexCollection $fulltextIndexes;
3537

36-
private SpatialIndexCollection|SpatialIndexCollectionInterface $spatialIndexes;
38+
private readonly SpatialIndexCollection|SpatialIndexCollectionInterface $spatialIndexes;
3739

3840
public function __construct()
3941
{

src/DataObject/Sql/Database/Table/Column.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Table;
46

57
class Column implements ColumnInterface
68
{
79
public function __construct(
8-
private string $name,
9-
private string $type,
10-
private array $typeParameters,
11-
private string $otherParameters,
12-
private string $comment
10+
private readonly string $name,
11+
private readonly string $type,
12+
private readonly array $typeParameters,
13+
private readonly string $otherParameters,
14+
private readonly string $comment
1315
) {
1416
}
1517

src/DataObject/Sql/Database/Table/ColumnCollection.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Table;
46

@@ -7,7 +9,7 @@ class ColumnCollection implements ColumnCollectionInterface
79
/** @var ColumnInterface[] */
810
private array $columns = [];
911

10-
public function add(ColumnInterface $column)
12+
public function add(ColumnInterface $column): void
1113
{
1214
$this->columns[$column->getName()] = $column;
1315
}

src/DataObject/Sql/Database/Table/ColumnCollectionInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Table;
46

src/DataObject/Sql/Database/Table/ColumnInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Table;
46

src/DataObject/Sql/Database/Table/ColumnIterator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Table;
46

src/DataObject/Sql/Database/Table/Index/FulltextIndex.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Table\Index;
46

src/DataObject/Sql/Database/Table/Index/FulltextIndexCollection.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Table\Index;
46

0 commit comments

Comments
 (0)