Skip to content

Commit

Permalink
Merge pull request #9 from MontealegreLuis/union-types
Browse files Browse the repository at this point in the history
Constructot Property Promotion and Union types
  • Loading branch information
MontealegreLuis authored Jul 29, 2021
2 parents aade94d + dd58fa1 commit d46d5fb
Show file tree
Hide file tree
Showing 258 changed files with 3,281 additions and 2,948 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@v2"
with:
php-version: "7.4"
php-version: "8.0"
extensions: imagick
ini-values: memory_limit=-1
coverage: xdebug
Expand All @@ -26,11 +26,13 @@ jobs:
- name: "Code quality checks"
run: "make check"
env:
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}

- name: "Run tests with coverage"
run: "vendor/bin/phpunit --exclude-group=snapshot --coverage-text --coverage-clover=coverage.clover"

- name: "Send code coverage to Scrutinizer"
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
composer global require scrutinizer/ocular
~/.composer/vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@v2"
with:
php-version: "7.4"
php-version: "8.0"
extensions: imagick
ini-values: memory_limit=-1, phar.readonly=Off
tools: composer
Expand Down
4 changes: 2 additions & 2 deletions .php-cs-fixer-tests.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);
/**
* PHP version 7.2
* PHP version 8.0
*
* This source file is subject to the license that is bundled with this package in the file LICENSE.
*/
Expand Down Expand Up @@ -38,7 +38,7 @@
'blank_line_after_opening_tag' => false,
'declare_strict_types' => true,
'header_comment' => [
'header' => 'PHP version 7.4
'header' => 'PHP version 8.0
This source file is subject to the license that is bundled with this package in the file LICENSE.',
'comment_type' => 'PHPDoc',
Expand Down
4 changes: 2 additions & 2 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php declare(strict_types=1);
/**
* PHP version 7.2
* PHP version 8.0
*
* This source file is subject to the license that is bundled with this package in the file LICENSE.
*/
Expand Down Expand Up @@ -36,7 +36,7 @@
'blank_line_after_opening_tag' => false,
'declare_strict_types' => true,
'header_comment' => [
'header' => 'PHP version 7.4
'header' => 'PHP version 8.0
This source file is subject to the license that is bundled with this package in the file LICENSE.',
'comment_type' => 'PHPDoc',
Expand Down
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build:
command: 'echo "No need to install dependencies"'
environment:
php:
version: 7.1.30
version: 8.0.8
tests:
override: true
project_setup:
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ It is recommended to follow the [7 rules of a good commit message](https://chris

## Coding Guidelines

This project follows the coding standards proposed in [PSR-2][psr2]
This project follows the coding standards proposed in [PSR-12][https://www.php-fig.org/psr/psr-12/].

Run the following command if you modified either production code or tests.

Expand Down Expand Up @@ -122,7 +122,6 @@ $ couscous preview

Before opening a new ticket, please search through the [existing issues][issues].

[psr2]: http://www.php-fig.org/psr/psr-2/
[cs-fixer]: https://github.com/FriendsOfPHP/PHP-CS-Fixer
[issues]: https://github.com/MontealegreLuis/phuml/issues
[docker]: https://www.docker.com/
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
FROM composer:1.10 AS composer
FROM composer:2.1.3 AS composer

ADD composer.* ./
ADD src/ src

RUN composer global require hirak/prestissimo --no-plugins --no-scripts
RUN composer install --no-dev --optimize-autoloader --prefer-dist --no-progress --no-interaction --ignore-platform-reqs --no-plugins

FROM php:7.2.34-cli-alpine3.12 AS phuml
FROM php:8.0.8-cli-alpine3.13 AS phuml
MAINTAINER Luis Montealegre <[email protected]>

RUN apk add --update --no-cache autoconf g++ pkgconfig imagemagick imagemagick-dev make ttf-freefont graphviz \
Expand Down
51 changes: 33 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,50 @@
SHELL = /bin/bash

.PHONY: test coverage format check diagram dot stats

ARGS=""
INFECTION_BADGE_API_KEY=""

.PHONY: help
help: ## Show help
@echo Please specify a build target. The choices are:
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

test:
.PHONY: test
test: ## Run all the tests using a Docker container
@docker-compose run --rm tests php vendor/bin/phpunit --testdox

coverage:
.PHONY: coverage
coverage: ## Generate the code coverage report using a Docker container
@docker-compose run --rm -e XDEBUG_MODE=coverage tests php vendor/bin/phpunit --coverage-html build/coverage

infection:
.PHONY: infection
infection: ## Execute the mutation testing suite using a Docker container
@docker-compose run --rm -e XDEBUG_MODE=coverage tests php vendor/bin/infection --threads=4

diagram:
@docker-compose run --rm tests php bin/phuml phuml:diagram $(ARGS)

dot:
@docker-compose run --rm tests php bin/phuml phuml:dot $(ARGS)

stats:
@docker-compose run --rm tests php bin/phuml phuml:statistics $(ARGS)

format:
@vendor/bin/rector process
.PHONY: format
format: ## Fix Coding Standard violations in production and test code
@vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --using-cache no
@vendor/bin/php-cs-fixer fix --config=.php-cs-fixer-tests.php -v --using-cache no

check:
.PHONY: refactor
refactor: ## Apply automated refactorings using Rector
@vendor/bin/rector process

.PHONY: check
check: ## Execute all code quality checks
@vendor/bin/grumphp run --no-interaction
@vendor/bin/composer-require-checker check
@docker-compose run --rm tests vendor/bin/phpunit --testsuite 'Integration tests'
@vendor/bin/rector process --dry-run
@docker-compose run --rm -e XDEBUG_MODE=coverage tests php vendor/bin/infection --threads=4
@docker-compose run --rm -e XDEBUG_MODE=coverage -e INFECTION_BADGE_API_KEY=$(INFECTION_BADGE_API_KEY) tests php vendor/bin/infection --threads=4

.PHONY: diagram
diagram: ## Generate a class diagram with phUML using a Docker container
@docker-compose run --rm tests php bin/phuml phuml:diagram $(ARGS)

.PHONY: dot
dot: ## Generate a DOT file with phUML using a Docker container
@docker-compose run --rm tests php bin/phuml phuml:dot $(ARGS)

.PHONY: stats
stats: ## Generate a statistics file with phUML using a Docker container
@docker-compose run --rm tests php bin/phuml phuml:statistics $(ARGS)
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
[![CI workflow](https://github.com/montealegreluis/phuml/actions/workflows/ci.yml/badge.svg)](https://github.com/montealegreluis/phuml/actions/workflows/ci.yml)
[![Scrutinizer Code Quality][scrutinizer-badge]][scrutinizer]
[![Code Coverage][coverage-badge]][coverage]
[![Infection MSI](https://badge.stryker-mutator.io/github.com/montealegreluis/phuml/master)](https://infection.github.io)
[![Infection MSI](https://badge.stryker-mutator.io/github.com/montealegreluis/phuml/master)](https://dashboard.stryker-mutator.io/reports/github.com/montealegreluis/phuml/master)
[![Latest Stable Version][stable-badge]][packagist]
[![Minimum PHP Version][php-version-badge]][php]
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.0-8892BF.svg?style=flat-square)](https://php.net/)

phUML is a fully automatic [UML][uml] class diagram generator written in [PHP][php].
phUML is a fully automatic [UML][uml] class diagram generator written in [PHP](https://php.net/).
It creates a class diagram from an Object-Oriented codebase based on the UML specification.

## Installation
Expand All @@ -17,18 +17,22 @@ It creates a class diagram from an Object-Oriented codebase based on the UML spe
The official phUML Docker image can be found on [Docker Hub](https://hub.docker.com/r/montealegreluis/phuml/).

```bash
docker pull montealegreluis/phuml:4.0.0
docker pull montealegreluis/phuml:5.0.0
```

You can replace `4.0.0` with any of the available [tags](https://hub.docker.com/r/montealegreluis/phuml/tags?page=1&ordering=last_updated)
You can replace `5.0.0` with any of the available [tags](https://hub.docker.com/r/montealegreluis/phuml/tags?page=1&ordering=last_updated)

### Composer

Alternatively, you may use [Composer][composer] to download and install phUML as well as its dependencies.

```
```bash
composer require phuml/phuml
# or globally
```

It can also be installed globally.

```bash
composer global require phuml/phuml
```

Expand Down Expand Up @@ -69,8 +73,6 @@ Special thanks to all of these [awesome contributors][contributors].
[codebase]: https://github.com/jakobwesthoff/phuml/tree/master/src
[stable-badge]: https://img.shields.io/packagist/v/phuml/phuml.svg?style=flat-square
[packagist]: https://packagist.org/packages/phuml/phuml
[php-version-badge]: https://img.shields.io/badge/php-%3E%3D%207.4-8892BF.svg?style=flat-square
[php]: https://php.net/
[luis]: https://github.com/MontealegreLuis
[jakob]: https://github.com/jakobwesthoff
[contributors]: https://github.com/MontealegreLuis/phuml/contributors
Expand Down
8 changes: 2 additions & 6 deletions bin/phuml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ if (!$installed) {
}

use PhUml\Console\PhUmlApplication;
use PhUml\Console\ProgressDisplay;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;

$output = new ConsoleOutput();
$application = new PhUmlApplication(new ProgressDisplay($output));
$application->run(new ArgvInput(), $output);
$application = new PhUmlApplication();
$application->run();
18 changes: 10 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
}
],
"require": {
"php": "^7.4",
"php": "^8.0",
"ext-tokenizer": "*",
"league/pipeline": "^1.0.0",
"nikic/php-parser": "^4.11.0",
"symfony/console": "^5.3.2",
"symfony/filesystem": "^5.3.3",
"symfony/finder": "^5.3.0",
"symfony/process": "^5.3.2",
"symplify/smart-file-system": "^9.4.22",
"twig/twig": "^3.3.2",
"webmozart/assert": "^1.10.0"
},
Expand All @@ -32,25 +33,25 @@
"infection/infection": "^0.23.0",
"lupka/phpunit-compare-images": "^1.0.0",
"maglnet/composer-require-checker": "^3.3.0",
"phpro/grumphp": "^1.3.3",
"phpro/grumphp": "^1.4.0",
"phpspec/prophecy-phpunit": "^2.0.1",
"phpstan/extension-installer": "^1.1.0",
"phpstan/phpstan": "^0.12.90",
"phpstan/phpstan": "^0.12.91",
"phpstan/phpstan-strict-rules": "^0.12.10",
"phpunit/phpunit": "^9.5.6",
"pyrech/composer-changelogs": "^1.7.1",
"rector/rector": "0.11.32"
"rector/rector": "0.11.36"
},
"config": {
"optimize-autoloader": true,
"platform": {
"php": "7.4.20"
"php": "8.0.8"
},
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
"dev-master": "6.0-dev"
}
},
"autoload": {
Expand All @@ -72,6 +73,7 @@
"bin/phuml"
],
"support": {
"issues": "https://github.com/MontealegreLuis/phuml/issues"
"issues": "https://github.com/MontealegreLuis/phuml/issues",
"docs": "https://montealegreluis.com/phuml/"
}
}
2 changes: 1 addition & 1 deletion containers/tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.4.20-cli-alpine3.12
FROM php:8.0.8-cli-alpine3.13

RUN apk add --update --no-cache autoconf g++ pkgconfig imagemagick imagemagick-dev make ttf-freefont graphviz \
&& printf "\n" | pecl install imagick \
Expand Down
10 changes: 7 additions & 3 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@
The official phUML Docker image can be found on [Docker Hub](https://hub.docker.com/r/montealegreluis/phuml/).

```bash
docker pull montealegreluis/phuml:4.0.0
docker pull montealegreluis/phuml:5.0.0
```

You can replace `4.0.0` with any of th available [tags](https://hub.docker.com/r/montealegreluis/phuml/tags?page=1&ordering=last_updated)
You can replace `5.0.0` with any of th available [tags](https://hub.docker.com/r/montealegreluis/phuml/tags?page=1&ordering=last_updated)

## Composer

Alternatively, you may use [Composer](https://getcomposer.org/) to download and install phUML as well as its dependencies.

```bash
composer require phuml/phuml
# or globally
```

It can also be installed globally.

```bash
composer global require phuml/phuml
```
8 changes: 3 additions & 5 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
![CI workflow](https://github.com/montealegreluis/phuml/actions/workflows/ci.yml/badge.svg)
[![Scrutinizer Code Quality][scrutinizer-badge]][scrutinizer]
[![Code Coverage][coverage-badge]][coverage]
[![Infection MSI](https://badge.stryker-mutator.io/github.com/montealegreluis/phuml/master)](https://infection.github.io)
[![Infection MSI](https://badge.stryker-mutator.io/github.com/montealegreluis/phuml/master)](https://dashboard.stryker-mutator.io/reports/github.com/montealegreluis/phuml/master)
[![Latest Stable Version][stable-badge]][packagist]
[![Minimum PHP Version][php-badge]][php]
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.0-8892BF.svg?style=flat-square)](https://php.net/)

phUML is a fully automatic [UML][uml] class diagram generator written [PHP][php].
phUML is a fully automatic [UML][uml] class diagram generator written in [PHP](https://php.net/).
It creates a class diagram from an Object-Oriented codebase based on the UML specification.

To successfully create UML diagrams with phUML you will need to install the [graphviz][graphviz] toolkit.
Expand All @@ -33,5 +33,3 @@ You can take a look at the complete image by clicking [here][diagram].
[coverage]: https://scrutinizer-ci.com/g/MontealegreLuis/phuml/?branch=master
[stable-badge]: https://img.shields.io/packagist/v/phuml/phuml.svg?style=flat-square
[packagist]: https://packagist.org/packages/phuml/phuml
[php-badge]: https://img.shields.io/badge/php-%3E%3D%207.4-8892BF.svg?style=flat-square
[php]: https://php.net/
5 changes: 3 additions & 2 deletions infection.json.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"timeout": 25,
"source": {
"directories": [
"src"
Expand All @@ -16,6 +17,6 @@
"mutators": {
"@default": true
},
"minMsi": 85,
"minCoveredMsi": 85
"minMsi": 94,
"minCoveredMsi": 94
}
3 changes: 1 addition & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ parameters:
paths:
- src
inferPrivatePropertyTypeFromConstructor: true
ignoreErrors:
- "#Strict comparison using === between '@package_version@' and '@package_version@' will always evaluate to true#"

Loading

0 comments on commit d46d5fb

Please sign in to comment.