Skip to content

Commit

Permalink
New codestyle and PHP 8.1.+ (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmetDenis authored Mar 11, 2023
1 parent ee698a7 commit 7e6232d
Show file tree
Hide file tree
Showing 20 changed files with 238 additions and 476 deletions.
5 changes: 2 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#
# JBZoo Toolbox - Mermaid-PHP
# JBZoo Toolbox - Mermaid-PHP.
#
# This file is part of the JBZoo Toolbox project.
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @package Mermaid-PHP
# @license MIT
# @copyright Copyright (C) JBZoo.com, All rights reserved.
# @link https://github.com/JBZoo/Mermaid-PHP
# @see https://github.com/JBZoo/Mermaid-PHP
#

# EditorConfig is awesome: http://EditorConfig.org
Expand Down
5 changes: 2 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#
# JBZoo Toolbox - Mermaid-PHP
# JBZoo Toolbox - Mermaid-PHP.
#
# This file is part of the JBZoo Toolbox project.
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @package Mermaid-PHP
# @license MIT
# @copyright Copyright (C) JBZoo.com, All rights reserved.
# @link https://github.com/JBZoo/Mermaid-PHP
# @see https://github.com/JBZoo/Mermaid-PHP
#

/.github export-ignore
Expand Down
38 changes: 23 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#
# JBZoo Toolbox - Mermaid-PHP
# JBZoo Toolbox - Mermaid-PHP.
#
# This file is part of the JBZoo Toolbox project.
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @package Mermaid-PHP
# @license MIT
# @copyright Copyright (C) JBZoo.com, All rights reserved.
# @link https://github.com/JBZoo/Mermaid-PHP
# @see https://github.com/JBZoo/Mermaid-PHP
#

name: CI
Expand All @@ -21,7 +20,7 @@ on:
branches:
- 'master'
schedule:
- cron: '20 */8 * * *'
- cron: '22 */8 * * *'

env:
COLUMNS: 120
Expand All @@ -35,20 +34,22 @@ jobs:
JBZOO_COMPOSER_UPDATE_FLAGS: ${{ matrix.composer_flags }}
strategy:
matrix:
php-version: [ 7.4, 8.0, 8.1 ]
php-version: [ 8.1, 8.2 ]
coverage: [ xdebug , none]
composer_flags: [ "--prefer-lowest", "" ]
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
php-version: '${{ matrix.php-version }}'
coverage: '${{ matrix.coverage }}'
tools: composer
extensions: ast

- name: Build the Project
run: make update --no-print-directory
Expand All @@ -57,12 +58,15 @@ jobs:
run: make test --no-print-directory

- name: Uploading coverage to coveralls
if: "${{ matrix.coverage == 'xdebug' }}"
continue-on-error: true
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make report-coveralls --no-print-directory || true

- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
continue-on-error: true
with:
name: PHPUnit - ${{ matrix.php-version }} - ${{ matrix.coverage }}
path: build/
Expand All @@ -73,17 +77,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 7.4, 8.0, 8.1 ]
php-version: [ 8.1, 8.2 ]
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
tools: composer
extensions: ast

Expand All @@ -94,7 +99,8 @@ jobs:
run: make codestyle --no-print-directory

- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
continue-on-error: true
with:
name: Linters - ${{ matrix.php-version }}
path: build/
Expand All @@ -105,10 +111,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 7.4, 8.0, 8.1 ]
php-version: [ 8.1, 8.2 ]
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand All @@ -118,6 +124,7 @@ jobs:
php-version: ${{ matrix.php-version }}
coverage: xdebug
tools: composer
extensions: ast

- name: Build the Project
run: make update --no-print-directory
Expand All @@ -126,7 +133,8 @@ jobs:
run: make report-all --no-print-directory

- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
continue-on-error: true
with:
name: Reports - ${{ matrix.php-version }}
path: build/
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#
# JBZoo Toolbox - Mermaid-PHP
# JBZoo Toolbox - Mermaid-PHP.
#
# This file is part of the JBZoo Toolbox project.
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @package Mermaid-PHP
# @license MIT
# @copyright Copyright (C) JBZoo.com, All rights reserved.
# @link https://github.com/JBZoo/Mermaid-PHP
# @see https://github.com/JBZoo/Mermaid-PHP
#

.idea
Expand Down
13 changes: 6 additions & 7 deletions .phan.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
<?php

/**
* JBZoo Toolbox - Mermaid-PHP
* JBZoo Toolbox - Mermaid-PHP.
*
* This file is part of the JBZoo Toolbox project.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Mermaid-PHP
* @license MIT
* @copyright Copyright (C) JBZoo.com, All rights reserved.
* @link https://github.com/JBZoo/Mermaid-PHP
* @see https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

$default = include __DIR__ . '/vendor/jbzoo/codestyle/src/phan/default.php';
$default = include __DIR__ . '/vendor/jbzoo/codestyle/src/phan.php';

return array_merge($default, [
return \array_merge($default, [
'directory_list' => [
'src'
]
'src',
],
]);
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#
# JBZoo Toolbox - Mermaid-PHP
# JBZoo Toolbox - Mermaid-PHP.
#
# This file is part of the JBZoo Toolbox project.
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @package Mermaid-PHP
# @license MIT
# @copyright Copyright (C) JBZoo.com, All rights reserved.
# @link https://github.com/JBZoo/Mermaid-PHP
# @see https://github.com/JBZoo/Mermaid-PHP
#

ifneq (, $(wildcard ./vendor/jbzoo/codestyle/src/init.Makefile))
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# JBZoo / Mermaid-PHP

[![Coverage Status](https://coveralls.io/repos/JBZoo/Mermaid-PHP/badge.svg)](https://coveralls.io/github/JBZoo/Mermaid-PHP) [![Psalm Coverage](https://shepherd.dev/github/JBZoo/Mermaid-PHP/coverage.svg)](https://shepherd.dev/github/JBZoo/Mermaid-PHP) [![CodeFactor](https://www.codefactor.io/repository/github/jbzoo/mermaid-php/badge)](https://www.codefactor.io/repository/github/jbzoo/mermaid-php/issues) [![PHP Strict Types](https://img.shields.io/badge/strict__types-%3D1-brightgreen)](https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.strict)
[![Stable Version](https://poser.pugx.org/jbzoo/mermaid-php/version)](https://packagist.org/packages/jbzoo/mermaid-php) [![Latest Unstable Version](https://poser.pugx.org/jbzoo/mermaid-php/v/unstable)](https://packagist.org/packages/jbzoo/mermaid-php) [![Dependents](https://poser.pugx.org/jbzoo/mermaid-php/dependents)](https://packagist.org/packages/jbzoo/mermaid-php/dependents?order_by=downloads) [![GitHub Issues](https://img.shields.io/github/issues/jbzoo/mermaid-php)](https://github.com/JBZoo/Mermaid-PHP/issues) [![Total Downloads](https://poser.pugx.org/jbzoo/mermaid-php/downloads)](https://packagist.org/packages/jbzoo/mermaid-php/stats) [![GitHub License](https://img.shields.io/github/license/jbzoo/mermaid-php)](https://github.com/JBZoo/Mermaid-PHP/blob/master/LICENSE)
[![CI](https://github.com/JBZoo/Mermaid-PHP/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/JBZoo/Mermaid-PHP/actions/workflows/main.yml?query=branch%3Amaster) [![Coverage Status](https://coveralls.io/repos/github/JBZoo/Mermaid-PHP/badge.svg?branch=master)](https://coveralls.io/github/JBZoo/Mermaid-PHP?branch=master) [![Psalm Coverage](https://shepherd.dev/github/JBZoo/Mermaid-PHP/coverage.svg)](https://shepherd.dev/github/JBZoo/Mermaid-PHP) [![Psalm Level](https://shepherd.dev/github/JBZoo/Mermaid-PHP/level.svg)](https://shepherd.dev/github/JBZoo/Mermaid-PHP) [![CodeFactor](https://www.codefactor.io/repository/github/jbzoo/mermaid-php/badge)](https://www.codefactor.io/repository/github/jbzoo/mermaid-php/issues)
[![Stable Version](https://poser.pugx.org/jbzoo/mermaid-php/version)](https://packagist.org/packages/jbzoo/mermaid-php/) [![Total Downloads](https://poser.pugx.org/jbzoo/mermaid-php/downloads)](https://packagist.org/packages/jbzoo/mermaid-php/stats) [![Dependents](https://poser.pugx.org/jbzoo/mermaid-php/dependents)](https://packagist.org/packages/jbzoo/mermaid-php/dependents?order_by=downloads) [![Visitors](https://visitor-badge.glitch.me/badge?page_id=jbzoo.mermaid-php)]() [![GitHub License](https://img.shields.io/github/license/jbzoo/mermaid-php)](https://github.com/JBZoo/Mermaid-PHP/blob/master/LICENSE)



Generate diagrams and flowcharts as HTML which is based on [mermaid-js](https://mermaidjs.github.io/).
Generate diagrams and flowcharts as HTML which is based on [mermaid-js](https://mermaid.js.org/).


### Usage
Expand Down Expand Up @@ -41,11 +41,11 @@ $subGraph2

echo $graph; // Get result as string (or $graph->__toString(), or (string)$graph)
$htmlCode = $graph->renderHtml([
'debug' => true,
'version' => '8.6.0',
'theme' => Render::THEME_DARK,
'title' => 'Example',
'show-zoom' => true
'debug' => true,
'theme' => Render::THEME_DARK,
'title' => 'Example',
'show-zoom' => false,
'mermaid_url' => 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs',
]); // Get result as HTML code for debugging

echo $graph->getLiveEditorUrl(); // Get link to live editor
Expand Down Expand Up @@ -77,8 +77,8 @@ linkStyle default interpolate basis;


### See also
- [Mermaid on GitHub](https://github.com/knsv/mermaid)
- [Mermaid Documentation](https://mermaidjs.github.io/)
- [Mermaid on GitHub](https://github.com/mermaid-js/mermaid)
- [Mermaid Documentation](https://mermaid.js.org/)


## Unit tests and check code style
Expand Down
49 changes: 27 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,50 @@
{
"name" : "jbzoo/mermaid-php",
"type" : "library",
"description" : "Generate diagrams and flowcharts with the help of the mermaid script language",
"license" : "MIT",
"keywords" : ["mermaid", "mermaid-js", "diagrams", "flowcharts"],
"authors" : [
"name" : "jbzoo/mermaid-php",
"type" : "library",
"description" : "Generate diagrams and flowcharts with the help of the mermaid script language",
"license" : "MIT",
"keywords" : [
"mermaid",
"mermaid-js",
"diagrams",
"flowcharts"
],
"authors" : [
{
"name" : "Denis Smetannikov",
"email" : "[email protected]",
"role" : "lead"
}
],
"require" : {
"php" : ">=7.4",

"minimum-stability" : "dev",
"prefer-stable" : true,

"require" : {
"php" : "^8.1",
"ext-json" : "*"
},

"require-dev" : {
"jbzoo/toolbox-dev" : "^4.0.1"
"require-dev" : {
"jbzoo/toolbox-dev" : "7.x-dev"
},

"autoload" : {
"psr-4" : {
"JBZoo\\MermaidPHP\\" : "src"
}
"autoload" : {
"psr-4" : {"JBZoo\\MermaidPHP\\" : "src"}
},

"autoload-dev" : {
"classmap" : ["tests"]
"autoload-dev" : {
"psr-4" : {"JBZoo\\PHPUnit\\" : "tests"}
},

"config" : {
"config" : {
"optimize-autoloader" : true,
"allow-plugins" : {
"composer/package-versions-deprecated" : true
}
"allow-plugins" : {"composer/package-versions-deprecated" : true}
},

"extra" : {
"extra" : {
"branch-alias" : {
"dev-master" : "2.x-dev"
"dev-master" : "7.x-dev"
}
}
}
13 changes: 3 additions & 10 deletions src/Exception.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
<?php

/**
* JBZoo Toolbox - Mermaid-PHP
* JBZoo Toolbox - Mermaid-PHP.
*
* This file is part of the JBZoo Toolbox project.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @package Mermaid-PHP
* @license MIT
* @copyright Copyright (C) JBZoo.com, All rights reserved.
* @link https://github.com/JBZoo/Mermaid-PHP
* @see https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

namespace JBZoo\MermaidPHP;

use RuntimeException;

/**
* Class Exception
* @package JBZoo\MermaidPHP
*/
class Exception extends RuntimeException
class Exception extends \RuntimeException
{
}
Loading

0 comments on commit 7e6232d

Please sign in to comment.