Skip to content

Switch to Php8.1 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2025
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
10 changes: 9 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ jobs:
fail-fast: true
matrix:
php:
- '8.0'
- '8.1'
- '8.2'
- '8.3'
- '8.4'

name: PHP ${{ matrix.php }}

Expand All @@ -38,3 +40,9 @@ jobs:

- name: Run static analysis
run: composer run-script phpstan

- name: Run rector
run: composer run-script rector-dry-run

- name: Run phpcs analysis
run: composer run-script phpcs
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.0.0] - 2024-01-04
### Changed
- Switch to PHP 8.1

## [3.2.0] - 2022-03-05
### Added
- Base Apache Cassandra support
Expand Down
25 changes: 14 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@
"plantuml"
],
"require": {
"php": ">=8.0",
"php": ">=8.1",
"ext-json": "*",
"symfony/console": "^3.0|^4.0|^5.0|^6.0",
"twig/twig": "^2.0"
"symfony/console": "^5.0||^6.0",
"twig/twig": "^3.0"
},
"require-dev": {
"roave/security-advisories": "dev-master",
"phpunit/phpunit": "^9.0",
"squizlabs/php_codesniffer": "^3.0",
"slevomat/coding-standard": "^7.0",
"phpstan/phpstan": "^1.4"
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^10.0",
"rector/rector": "^2.0",
"roave/security-advisories": "dev-latest",
"slevomat/coding-standard": "^8.0",
"squizlabs/php_codesniffer": "^3.0"
},
"autoload": {
"psr-4": {
Expand All @@ -36,9 +37,11 @@
"database-schema-visualization"
],
"scripts": {
"phpcs": "phpcs --standard=PSR12",
"phpstan": "phpstan analyse",
"test": "php ./vendor/bin/phpunit"
"phpcs": "phpcs",
"phpstan": "phpstan analyse --memory-limit=512M",
"test": "php ./vendor/bin/phpunit",
"rector": "php ./vendor/bin/rector process example src test",
"rector-dry-run": "php ./vendor/bin/rector process example src test --dry-run"
},
"config": {
"allow-plugins": {
Expand Down
4 changes: 3 additions & 1 deletion example/code/image.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

use Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Connection\ConnectionCollection;
use Pongee\DatabaseSchemaVisualization\Export\Plantuml;
Expand Down
4 changes: 3 additions & 1 deletion example/code/json.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

use Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Connection\ConnectionCollection;
use Pongee\DatabaseSchemaVisualization\Export\Json;
Expand Down
4 changes: 3 additions & 1 deletion example/code/plantuml.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

use Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database\Connection\ConnectionCollection;
use Pongee\DatabaseSchemaVisualization\Export\Plantuml;
Expand Down
15 changes: 2 additions & 13 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
<?xml version="1.0"?>
<ruleset>
<config name="testVersion" value="7.1-"/>
<arg name="colors"/>

<file>src</file>
<file>test</file>
<file>example</file>

<rule ref="PSR2"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax.Found"/>

<config name="installed_paths" value="../../slevomat/coding-standard"/>
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="newlinesCountBetweenOpenTagAndDeclare" value="0"/>
<property name="spacesCountAroundEqualsSign" value="0"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>
<rule ref="PSR12"></rule>
</ruleset>
4 changes: 0 additions & 4 deletions phpstan.neon.dist → phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,3 @@ parameters:

fileExtensions:
- php

excludes_analyse:
- vendor

24 changes: 24 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\DeadCode\Rector\Node\RemoveNonExistingVarAnnotationRector;
use Rector\DeadCode\Rector\Property\RemoveUselessReadOnlyTagRector;
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;

return RectorConfig::configure()
->withRules([
RemoveUselessParamTagRector::class,
RemoveUselessReturnTagRector::class,
RemoveUselessReadOnlyTagRector::class,
RemoveNonExistingVarAnnotationRector::class,
RemoveUselessVarTagRector::class,
])
->withPreparedSets(
typeDeclarations: true,
)
->withPhpSets(
php81: true,
);
15 changes: 7 additions & 8 deletions src/Command/Mysql/MysqlCommandAbstract.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Pongee\DatabaseSchemaVisualization\Command\Mysql;

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

protected ParserInterface $parser;

protected string $rootDir;

public function __construct(ParserInterface $parser, string $rootDir)
public function __construct(protected ParserInterface $parser, string $rootDir)
{
parent::__construct();

$this->parser = $parser;
$this->rootDir = rtrim($rootDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;

$this
Expand Down Expand Up @@ -103,9 +101,10 @@ protected function getForcedConnections(array $connections): ConnectionCollectio
\.
(?<parentTableColumns>[^.]+)
$
#x', $connection, $matches);
#x', (string) $connection, $matches);

if (!empty($matches['childTableName'])
if (
!empty($matches['childTableName'])
&& !empty($matches['childTableColumns'])
&& !empty($matches['parentTableName'])
&& !empty($matches['parentTableColumns'])
Expand Down
4 changes: 3 additions & 1 deletion src/Command/Mysql/MysqlImageCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Pongee\DatabaseSchemaVisualization\Command\Mysql;

Expand Down
4 changes: 3 additions & 1 deletion src/Command/Mysql/MysqlJsonCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Pongee\DatabaseSchemaVisualization\Command\Mysql;

Expand Down
4 changes: 3 additions & 1 deletion src/Command/Mysql/MysqlPlantumlCommand.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Pongee\DatabaseSchemaVisualization\Command\Mysql;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

Expand Down
14 changes: 8 additions & 6 deletions src/DataObject/Sql/Database/Table.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace Pongee\DatabaseSchemaVisualization\DataObject\Sql\Database;

Expand All @@ -23,17 +25,17 @@ class Table implements TableInterface
{
private string $name = '';

private ColumnCollectionInterface|ColumnCollection $columns;
private readonly ColumnCollectionInterface|ColumnCollection $columns;

private ?PrimaryKeyInterface $primaryKey = null;

private SimpleIndexCollection|SimpleIndexCollectionInterface $simpleIndexes;
private readonly SimpleIndexCollection|SimpleIndexCollectionInterface $simpleIndexes;

private UniqueIndexCollectionInterface|UniqueIndexCollection $uniqueIndexes;
private readonly UniqueIndexCollectionInterface|UniqueIndexCollection $uniqueIndexes;

private FulltextIndexCollectionInterface|FulltextIndexCollection $fulltextIndexes;
private readonly FulltextIndexCollectionInterface|FulltextIndexCollection $fulltextIndexes;

private SpatialIndexCollection|SpatialIndexCollectionInterface $spatialIndexes;
private readonly SpatialIndexCollection|SpatialIndexCollectionInterface $spatialIndexes;

public function __construct()
{
Expand Down
14 changes: 8 additions & 6 deletions src/DataObject/Sql/Database/Table/Column.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

class Column implements ColumnInterface
{
public function __construct(
private string $name,
private string $type,
private array $typeParameters,
private string $otherParameters,
private string $comment
private readonly string $name,
private readonly string $type,
private readonly array $typeParameters,
private readonly string $otherParameters,
private readonly string $comment
) {
}

Expand Down
6 changes: 4 additions & 2 deletions src/DataObject/Sql/Database/Table/ColumnCollection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

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

public function add(ColumnInterface $column)
public function add(ColumnInterface $column): void
{
$this->columns[$column->getName()] = $column;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

Expand Down
4 changes: 3 additions & 1 deletion src/DataObject/Sql/Database/Table/ColumnInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

Expand Down
4 changes: 3 additions & 1 deletion src/DataObject/Sql/Database/Table/ColumnIterator.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

Expand Down
4 changes: 3 additions & 1 deletion src/DataObject/Sql/Database/Table/Index/FulltextIndex.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

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

Expand Down
Loading