Skip to content

Commit

Permalink
strict_types=1 everywhere (#4)
Browse files Browse the repository at this point in the history
* `declare(strict_types=1);`
* PHP 8+ in Travis-CI (experimental)
  • Loading branch information
SmetDenis authored Apr 15, 2021
1 parent 2dcaa47 commit 42fbb12
Show file tree
Hide file tree
Showing 16 changed files with 64 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @link https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

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

return array_merge($default, [
Expand Down
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ php:
- 7.2
- 7.3
- 7.4
- 8.0
- nightly

jobs:
fast_finish: true
allow_failures:
- php: 8.0
- php: nightly

env:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# JBZoo / Mermaid-PHP

[![Build Status](https://travis-ci.org/JBZoo/Mermaid-PHP.svg)](https://travis-ci.org/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)
[![Build Status](https://travis-ci.org/JBZoo/Mermaid-PHP.svg?branch=master)](https://travis-ci.org/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) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/jbzoo/mermaid-php/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/jbzoo/mermaid-php/?branch=master) [![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)


Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},

"require-dev" : {
"jbzoo/toolbox-dev" : "^2.6.2"
"jbzoo/toolbox-dev" : "^2.9.2"
},

"autoload" : {
Expand Down
2 changes: 2 additions & 0 deletions src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @link https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

namespace JBZoo\MermaidPHP;

use RuntimeException;
Expand Down
2 changes: 2 additions & 0 deletions src/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @link https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

namespace JBZoo\MermaidPHP;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @link https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

namespace JBZoo\MermaidPHP;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @link https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

namespace JBZoo\MermaidPHP;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @link https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

namespace JBZoo\MermaidPHP;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Render.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @link https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

namespace JBZoo\MermaidPHP;

/**
Expand Down
6 changes: 4 additions & 2 deletions tests/FlowchartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @link https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

namespace JBZoo\PHPUnit;

use JBZoo\MermaidPHP\Graph;
Expand Down Expand Up @@ -199,7 +201,7 @@ public function testComplexGraph()
]), (string)$graph);

$html = $graph->renderHtml();
isContain($graph, $html);
isContain((string)$graph, $html);
}

public function testComplexGraphSafeMode()
Expand Down Expand Up @@ -252,7 +254,7 @@ public function testComplexGraphSafeMode()
]), (string)$graph);

$html = $graph->renderHtml();
isContain($graph, $html);
isContain((string)$graph, $html);
}

public function testSimpleSubGraph()
Expand Down
2 changes: 2 additions & 0 deletions tests/MermaidCodeStyleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @link https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

namespace JBZoo\PHPUnit;

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/MermaidComposerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @link https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

namespace JBZoo\PHPUnit;

/**
Expand Down
5 changes: 4 additions & 1 deletion tests/MermaidCopyrightsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @link https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

namespace JBZoo\PHPUnit;

/**
Expand All @@ -21,5 +23,6 @@
*/
class MermaidCopyrightsTest extends AbstractCopyrightTest
{
protected $packageName = 'Mermaid-PHP';
protected $packageName = 'Mermaid-PHP';
protected $isPhpStrictType = true;
}
26 changes: 26 additions & 0 deletions tests/MermaidReadmeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @link https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

namespace JBZoo\PHPUnit;

/**
Expand All @@ -23,4 +25,28 @@
class MermaidPhpReadmeTest extends AbstractReadmeTest
{
protected $packageName = 'Mermaid-PHP';

/**
* @inheritDoc
*/
protected function setUp(): void
{
parent::setUp();

$this->params['scrutinizer'] = true;
$this->params['codefactor'] = true;
$this->params['strict_types'] = true;
}

/**
* @return string|null
*/
protected function checkBadgeTravis(): ?string
{
return $this->getPreparedBadge($this->getBadge(
'Build Status',
'https://travis-ci.org/__VENDOR_ORIG__/__PACKAGE_ORIG__.svg?branch=master',
'https://travis-ci.org/__VENDOR_ORIG__/__PACKAGE_ORIG__'
));
}
}
2 changes: 2 additions & 0 deletions tests/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @link https://github.com/JBZoo/Mermaid-PHP
*/

declare(strict_types=1);

// main autoload
if ($autoload = realpath('./vendor/autoload.php')) {
require_once $autoload;
Expand Down

0 comments on commit 42fbb12

Please sign in to comment.