Skip to content

Commit

Permalink
Merge pull request #38 from Progi1984/improveProject
Browse files Browse the repository at this point in the history
- Removed Scrutinizer
- Removed Travis CI
- Migrated to Github Actions
- Added PHPStan
- Set minimal support to PHP 7.1
  • Loading branch information
Progi1984 committed Jul 20, 2021
2 parents 2caf520 + 26a63a1 commit a3f6152
Show file tree
Hide file tree
Showing 37 changed files with 854 additions and 622 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: monthly
time: "11:00"
open-pull-requests-limit: 10
assignees:
- Progi1984
98 changes: 98 additions & 0 deletions .github/workflows/php.yml
@@ -0,0 +1,98 @@
name: PHPPresentation
on: [push, pull_request]
jobs:
php-cs-fixer:
name: PHP CS Fixer
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
- uses: actions/checkout@v2

- name: Validate composer config
run: composer validate --strict

- name: Composer Install
run: composer global require friendsofphp/php-cs-fixer

- name: Add environment path
run: export PATH="$PATH:$HOME/.composer/vendor/bin"

- name: Run PHPCSFixer
run: php-cs-fixer fix --dry-run --diff

phpmd:
name: PHP Mess Detector
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: gd, xml, zip
- uses: actions/checkout@v2

- name: Composer Install
run: composer install --ansi --prefer-dist --no-interaction --no-progress

- name: Run phpmd
run: ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist

phpstan:
name: PHP Static Analysis
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0'] #, '8.1'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: gd, xml, zip
- uses: actions/checkout@v2

- name: Composer Install
run: composer install --ansi --prefer-dist --no-interaction --no-progress

- name: Run phpstan
run: ./vendor/bin/phpstan analyse -c phpstan.neon.dist

phpunit:
name: PHPUnit
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0'] #, '8.1'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: gd, xml, zip
coverage: xdebug

- name: Generate Locale (for tests)
run: sudo locale-gen de_DE.UTF-8 && sudo update-locale

- uses: actions/checkout@v2

- name: Composer Install
run: composer install --ansi --prefer-dist --no-interaction --no-progress

- name: Run phpunit
run: ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/clover.xml

- name: Upload coverage results to Coveralls
if: matrix.php == '7.3'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
chmod +x php-coveralls.phar
php php-coveralls.phar --coverage_clover=build/clover.xml --json_path=build/coveralls-upload.json -vvv
37 changes: 37 additions & 0 deletions .github/workflows/phpmd.xml.dist
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ruleset name="PHPPresentation PHP Mess Detector Rule Set"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<rule ref="rulesets/naming.xml">
<exclude name="LongVariable" />
<exclude name="ShortClassName" />
</rule>
<rule ref="rulesets/naming.xml/LongVariable">
<properties>
<property name="maximum" value="32" />
</properties>
</rule>
<rule ref="rulesets/naming.xml/ShortClassName">
<properties>
<property name="minimum" value="2" />
</properties>
</rule>
<rule ref="rulesets/design.xml/ExitExpression" />
<rule ref="rulesets/design.xml/EvalExpression" />
<rule ref="rulesets/design.xml/GotoStatement" />
<rule ref="rulesets/design.xml/DepthOfInheritance" />
<rule ref="rulesets/design.xml/CouplingBetweenObjects">
<properties>
<property name="maximum" value="13" />
</properties>
</rule>
<rule ref="rulesets/design.xml/NumberOfChildren">
<properties>
<property name="minimum" value="15" />
</properties>
</rule>
<rule ref="rulesets/unusedcode.xml" />
<rule ref="rulesets/controversial.xml" />
</ruleset>
30 changes: 6 additions & 24 deletions .gitignore
@@ -1,25 +1,7 @@
.DS_Store
._*
.Spotlight-V100
.Trashes
Thumbs.db
Desktop.ini
.idea
build/
phpunit.xml
composer.phar
vendor
*.settings
*.project
*.buildpath

/samples/results
/phpunit.bat
/todo.txt
/samples/Sample_00_Test.php
/samples/#47
/samples/#70
/samples/#71
/samples/Github_*.*
/samples/#83/*.lnk
## PHPCSFixer
/.php-cs-fixer.cache
## PHPUnit
/.phpunit.result.cache
## Dependencies
/composer.lock
/vendor/
44 changes: 44 additions & 0 deletions .php-cs-fixer.dist.php
@@ -0,0 +1,44 @@
<?php

$config = new PhpCsFixer\Config();

$config
->setUsingCache(true)
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'array_indentation' => true,
'cast_spaces' => [
'space' => 'single',
],
'combine_consecutive_issets' => true,
'concat_space' => [
'spacing' => 'one',
],
'error_suppression' => [
'mute_deprecation_error' => false,
'noise_remaining_usages' => false,
'noise_remaining_usages_exclude' => [],
],
'function_to_constant' => false,
'method_chaining_indentation' => true,
'no_alias_functions' => false,
'no_superfluous_phpdoc_tags' => false,
'non_printable_character' => [
'use_escape_sequences_in_strings' => true,
],
'phpdoc_align' => [
'align' => 'left',
],
'phpdoc_summary' => false,
'protected_to_private' => false,
'self_accessor' => false,
'yoda_style' => false,
'single_line_throw' => false,
'no_alias_language_construct_call' => false,
])
->getFinder()
->in(__DIR__)
->exclude('vendor');

return $config;
24 changes: 0 additions & 24 deletions .scrutinizer.yml

This file was deleted.

62 changes: 0 additions & 62 deletions .travis.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .travis_shell_after_success.sh

This file was deleted.

11 changes: 4 additions & 7 deletions composer.json
Expand Up @@ -4,7 +4,7 @@
"keywords": ["PHP","Office","Common","component"],
"homepage": "http://phpoffice.github.io",
"type": "library",
"license": "LGPL",
"license": "LGPL-3.0-only",
"authors": [
{
"name": "Mark Baker"
Expand All @@ -15,16 +15,13 @@
}
],
"require": {
"php": ">=5.3.0",
"php": ">=7.1",
"pclzip/pclzip": "^2.8"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36 || ^7.0",
"phpdocumentor/phpdocumentor":"2.*",
"phpunit/phpunit": ">=7",
"phpmd/phpmd": "2.*",
"sebastian/phpcpd": "2.*",
"phploc/phploc": "2.*",
"squizlabs/php_codesniffer": "2.*"
"phpstan/phpstan": "^0.12.88"
},
"autoload": {
"psr-4": {
Expand Down
12 changes: 12 additions & 0 deletions phpstan.neon.dist
@@ -0,0 +1,12 @@
parameters:
level: 6
bootstrapFiles:
- tests/bootstrap.php
paths:
- src
- tests
reportUnmatchedIgnoredErrors: false
ignoreErrors:

## Remove after remove ArrayObject
treatPhpDocTypesAsCertain: false

0 comments on commit a3f6152

Please sign in to comment.