Skip to content

Commit

Permalink
migrate to php 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Masiukevich Maksim committed Jan 3, 2021
1 parent 33a2f04 commit 9ab7177
Show file tree
Hide file tree
Showing 32 changed files with 253 additions and 241 deletions.
File renamed without changes.
134 changes: 134 additions & 0 deletions .github/workflows/continuous-integration.yml
@@ -0,0 +1,134 @@
name: "Continuous Integration"

on: [ push, pull_request ]

jobs:
code-style:
name: Code style
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none
tools: composer:v2

- name: Install dependencies with composer
run: composer install -ov

- name: Run php-cs-fixer
run: PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run --using-cache=no --verbose

psalm:
name: Psalm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none
tools: composer:v2

- name: Install dependencies with composer
run: composer install -ov

- name: Run vimeo/psalm
run: ./vendor/bin/psalm --config=psalm.xml --shepherd

phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none
tools: composer:v2

- name: Install dependencies with composer
run: composer install -ov

- name: Run phpstan/phpstan
run: ./vendor/bin/phpstan analyse src --level 7

phpunit:
name: PHPUnit
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: 123456789
POSTGRES_DB: test
ports:
- 5432:5432
options: --name=postgres --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3

env:
PHP_EXTENSIONS: dom, json, mbstring, curl, tokenizer, pdo_sqlite, pdo_pgsql, pdo
PHP_INI_VALUES: assert.exception=1, zend.assertions=1

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Override PHP ini values for JIT compiler
run: echo "PHP_INI_VALUES::assert.exception=1, zend.assertions=1, opcache.enable=1, opcache.enable_cli=1, opcache.optimization_level=-1, opcache.jit=1255, opcache.jit_buffer_size=32M" >> $GITHUB_ENV

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
tools: composer:v2

- name: Install dependencies
run: composer update --no-ansi --no-interaction --no-progress --prefer-lowest

- name: Run tests with phpunit
run: XDEBUG_MODE=coverage php ./vendor/bin/phpunit --configuration ./phpunit.xml --coverage-clover=coverage.clover

- name: Upload coverage file
uses: actions/upload-artifact@v2
with:
name: phpunit.coverage
path: coverage.clover

upload_coverage:
name: Upload coverage
runs-on: ubuntu-latest
needs: phpunit
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
coverage: none
tools: composer

- name: Download coverage files
uses: actions/download-artifact@v2
with:
path: reports

- name: Send code coverage report to Scrutinizer
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover ./reports/phpunit.coverage/coverage.clover
64 changes: 8 additions & 56 deletions .scrutinizer.yml
@@ -1,69 +1,21 @@
checks:
php: true

filter:
paths: [src/*]
excluded_paths: [tests/*]
paths:
- "src/*"

tools:
php_analyzer: true
php_sim: true
php_pdepend: true
sensiolabs_security_checker: true
php_changetracking: true
php_mess_detector:
enabled: true
config:
ruleset: ~
code_size_rules:
cyclomatic_complexity: true
npath_complexity: true
excessive_method_length: true
excessive_class_length: true
excessive_parameter_list: true
excessive_public_count: true
too_many_fields: true
too_many_methods: true
excessive_class_complexity: true
design_rules:
exit_expression: true
eval_expression: true
goto_statement: true
number_of_class_children: true
depth_of_inheritance: true
coupling_between_objects: true
unused_code_rules:
unused_private_field: true
unused_local_variable: true
unused_private_method: true
unused_formal_parameter: true
naming_rules:
short_variable:
minimum: 3
long_variable:
maximum: 20
short_method:
minimum: 3
constructor_conflict: true
constant_naming: true
boolean_method_name: true
controversial_rules:
superglobals: true
camel_case_class_name: true
camel_case_property_name: true
camel_case_method_name: true
camel_case_parameter_name: true
camel_case_variable_name: true
external_code_coverage:
timeout: 600
checks:
php:
code_rating: true

build:
nodes:
analysis:
environment:
php:
version: 7.4.5
php: 8.0.0
project_setup:
override: true
tests:
override:
- php-scrutinizer-run --enable-security-analysis
- php-scrutinizer-run --enable-security-analysis
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

9 changes: 5 additions & 4 deletions README.md
@@ -1,15 +1,16 @@
## What is it?
[![Build Status](https://travis-ci.org/php-service-bus/storage.svg?branch=v4.1)](https://travis-ci.org/php-service-bus/storage)
[![Code Coverage](https://scrutinizer-ci.com/g/php-service-bus/storage/badges/coverage.png?b=v4.1)](https://scrutinizer-ci.com/g/php-service-bus/storage/?branch=v4.1)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/php-service-bus/storage/badges/quality-score.png?b=v4.1)](https://scrutinizer-ci.com/g/php-service-bus/storage/?branch=v4.1)
![Continuous Integration](https://github.com/php-service-bus/storage/workflows/Continuous%20Integration/badge.svg)
[![Shepherd](https://shepherd.dev/github/php-service-bus/storage/coverage.svg)](https://shepherd.dev/github/php-service-bus/storage)
[![Code Coverage](https://scrutinizer-ci.com/g/php-service-bus/storage/badges/coverage.png?b=v4.2)](https://scrutinizer-ci.com/g/php-service-bus/storage/?branch=v4.2)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/php-service-bus/storage/badges/quality-score.png?b=v4.2)](https://scrutinizer-ci.com/g/php-service-bus/storage/?branch=v4.2)

This component is part of the [PHP Service Bus](https://github.com/php-service-bus/service-bus): contains database layer implementations

## Documentation
[**SQL adapters documentation**](https://github.com/php-service-bus/documentation/blob/master/pages/modules/storage_amp_sql.md)

## Contributing
Contributions are welcome! Please read [CONTRIBUTING](CONTRIBUTING.md) for details.
Contributions are welcome! Please read [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

## Communication Channels
You can find help and discussion in the following places:
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Expand Up @@ -37,21 +37,21 @@
]
},
"require": {
"php": ">=7.4",
"php": ">=8.0",
"ext-pgsql": "*",
"php-service-bus/common": "v4.1.*",
"php-service-bus/cache": "v4.1.*",
"php-service-bus/common": "v4.2.*",
"php-service-bus/cache": "v4.2.*",
"amphp/postgres": "v1.3.*",
"latitude/latitude": "v4.2.*",
"psr/log": "v1.1.*",
"doctrine/dbal": "v2.10.*",
"symfony/dependency-injection": "v5.1.*",
"doctrine/dbal": "v3.0.*",
"symfony/dependency-injection": "v5.2.*",
"amphp/file": "v1.0.*"
},
"require-dev": {
"php-service-bus/code-style-config": "v1.2.*",
"phpunit/phpunit": "v9.2.*",
"vimeo/psalm": "v3.13.*",
"phpunit/phpunit": "v9.5.*",
"vimeo/psalm": "v4.3.*",
"phpstan/phpstan": "v0.12.*",
"amphp/amp": "v2.5.*"
},
Expand All @@ -62,8 +62,8 @@
"phpstan": "./vendor/bin/phpstan analyse src --level 7",
"tests": "./vendor/bin/phpunit --configuration phpunit.xml --verbose",
"coverage": "./vendor/bin/phpunit --configuration phpunit.xml --coverage-html ./coverage --verbose",
"cs-check": "./vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run",
"cs-fix": "./vendor/bin/php-cs-fixer fix --allow-risky=yes",
"cs-check": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run",
"cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes",
"pre-commit": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes && ./vendor/bin/psalm --config=psalm.xml && ./vendor/bin/phpstan analyse src --level 7 && ./vendor/bin/phpunit --configuration phpunit.xml --verbose"
},
"config": {
Expand Down
43 changes: 16 additions & 27 deletions phpunit.xml
@@ -1,36 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
stopOnFailure="false">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false"
backupStaticAttributes="false" beStrictAboutTestsThatDoNotTestAnything="false" colors="true" verbose="true"
convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true"
failOnRisky="true" failOnWarning="true" stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>./</directory>
</include>
<exclude>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</coverage>
<php>
<ini name="error_reporting" value="-1"/>
<env name="TEST_POSTGRES_DSN" value="pgsql://postgres:123456789@localhost:5432/test"/>
<env name="TEST_POSTGRES_DSN" value="pgsql://test:123456789@localhost:5432/test"/>
</php>

<testsuites>

<testsuite name="Common storage parts">
<testsuite name="PHP Service Bus storage component">
<directory>./tests/</directory>
</testsuite>

</testsuites>

<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
4 changes: 2 additions & 2 deletions psalm.xml
Expand Up @@ -4,7 +4,8 @@
useDocblockTypes="true"
useDocblockPropertyTypes="true"
allowPhpStormGenerics="true"
requireVoidReturnType="true"
strictBinaryOperands="true"
findUnusedPsalmSuppress="true"
ignoreInternalFunctionFalseReturn="false"
ignoreInternalFunctionNullReturn="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -20,6 +21,5 @@

<issueHandlers>
<PropertyNotSetInConstructor errorLevel="suppress"/>
<TooManyTemplateParams errorLevel="suppress"/>
</issueHandlers>
</psalm>
2 changes: 1 addition & 1 deletion src/Common/BinaryDataDecoder.php
@@ -1,7 +1,7 @@
<?php

/**
* Common storage parts.
* SQL database adapter implementation.
*
* @author Maksim Masiukevich <dev@async-php.com>
* @license MIT
Expand Down
2 changes: 1 addition & 1 deletion src/Common/DatabaseAdapter.php
@@ -1,7 +1,7 @@
<?php

/**
* Common storage parts.
* SQL database adapter implementation.
*
* @author Maksim Masiukevich <dev@async-php.com>
* @license MIT
Expand Down

0 comments on commit 9ab7177

Please sign in to comment.