Skip to content

Commit

Permalink
Require PHP 8
Browse files Browse the repository at this point in the history
  • Loading branch information
odan committed Nov 27, 2022
1 parent ecba216 commit 9c5de04
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 66 deletions.
7 changes: 5 additions & 2 deletions .cs.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

return (new PhpCsFixer\Config())
use PhpCsFixer\Config;

return (new Config())
->setUsingCache(false)
->setRiskyAllowed(true)
->setRules(
Expand All @@ -18,7 +20,6 @@
'cast_spaces' => ['space' => 'none'],
'concat_space' => ['spacing' => 'one'],
'compact_nullable_typehint' => true,
'declare_equal_normalize' => ['space' => 'single'],
'increment_style' => ['style' => 'post'],
'list_syntax' => ['syntax' => 'short'],
'echo_tag_syntax' => ['format' => 'long'],
Expand All @@ -35,6 +36,8 @@
'imports_order' => ['class', 'const', 'function']
],
'single_line_throw' => false,
'fully_qualified_strict_types' => true,
'global_namespace_import' => false,
]
)
->setFinder(
Expand Down
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[composer.json]
indent_style = space
indent_size = 4
18 changes: 5 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.3', '7.4', '8.0']
operating-system: [ ubuntu-latest ]
php-versions: [ '8.0', '8.1' ]
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

steps:
Expand All @@ -19,7 +19,6 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, zip
coverage: none

- name: Check PHP Version
Expand All @@ -34,15 +33,8 @@ jobs:
- name: Validate composer.json and composer.lock
run: composer validate

- name: Install dependencies for PHP 7
if: matrix.php-versions < '8.0'
run: composer update --prefer-dist --no-progress

- name: Install dependencies for PHP 8
if: matrix.php-versions >= '8.0'
run: composer update --prefer-dist --no-progress --ignore-platform-req=php
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

- name: Run test suite
run: composer check
env:
PHP_CS_FIXER_IGNORE_ENV: 1
run: composer test:all
20 changes: 11 additions & 9 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
filter:
paths: ["src/*"]
excluded_paths: ["vendor/*", "tests/*"]
paths: [ "src/*" ]
excluded_paths: [ "vendor/*", "tests/*" ]

checks:
php:
Expand All @@ -12,7 +12,10 @@ tools:

build:
environment:
php: 7.4
php:
version: 8.1.2
ini:
xdebug.mode: coverage
mysql: false
node: false
postgresql: false
Expand All @@ -30,11 +33,10 @@ build:
dependencies:
before:
- composer self-update
- composer update --no-interaction --prefer-dist --no-progress
- composer install --no-interaction --prefer-dist --no-progress
tests:
before:
-
command: composer test:coverage
coverage:
file: 'build/logs/clover.xml'
format: 'clover'
- command: composer test:coverage
coverage:
file: 'build/logs/clover.xml'
format: 'clover'
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2021 odan
Copyright (c) 2023 odan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A strictly typed array reader for PHP.

## Requirements

* PHP 7.3+ or 8.0+
* PHP 8.0+

## Installation

Expand Down
41 changes: 19 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "selective/array-reader",
"type": "library",
"description": "A strictly typed array reader",
"license": "MIT",
"type": "library",
"keywords": [
"array",
"reader",
Expand All @@ -11,20 +12,15 @@
"strong"
],
"homepage": "https://github.com/selective-php/array-reader",
"license": "MIT",
"require": {
"php": "^7.3 || ^8.0",
"cakephp/chronos": "^2"
"php": "^8.0",
"cakephp/chronos": "^2 || ^3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3",
"overtrue/phplint": "^2.3",
"phpstan/phpstan": "^1",
"phpunit/phpunit": "^9",
"squizlabs/php_codesniffer": "^3.5"
},
"config": {
"sort-packages": true
"phpunit/phpunit": "^9 || ^10",
"squizlabs/php_codesniffer": "^3"
},
"autoload": {
"psr-4": {
Expand All @@ -36,21 +32,22 @@
"Selective\\ArrayReader\\Test\\": "tests/"
}
},
"config": {
"sort-packages": true
},
"scripts": {
"check": [
"@lint",
"@cs:check",
"@sniffer:check",
"@phpstan",
"@test:coverage"
],
"cs:check": "php-cs-fixer fix --dry-run --format=txt --verbose --diff --config=.cs.php",
"cs:fix": "php-cs-fixer fix --config=.cs.php",
"lint": "phplint ./ --exclude=vendor --no-interaction --no-cache",
"phpstan": "phpstan analyse src --level=max -c phpstan.neon --no-progress --ansi",
"cs:check": "php-cs-fixer fix --dry-run --format=txt --verbose --diff --config=.cs.php --ansi",
"cs:fix": "php-cs-fixer fix --config=.cs.php --ansi",
"sniffer:check": "phpcs --standard=phpcs.xml",
"sniffer:fix": "phpcbf --standard=phpcs.xml",
"stan": "phpstan analyse -c phpstan.neon --no-progress --ansi --xdebug",
"test": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always",
"test:coverage": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always --coverage-clover build/logs/clover.xml --coverage-html build/coverage"
"test:all": [
"@cs:check",
"@sniffer:check",
"@stan",
"@test"
],
"test:coverage": "php -d xdebug.mode=coverage -r \"require 'vendor/bin/phpunit';\" -- --configuration phpunit.xml --do-not-cache-result --colors=always --coverage-clover build/logs/clover.xml --coverage-html build/coverage"
}
}
18 changes: 0 additions & 18 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,6 @@
<rule ref="PSR2"></rule>
<rule ref="PSR12"></rule>

<rule ref="Squiz.Commenting.ClassComment">
<exclude name="Squiz.Commenting.ClassComment.TagNotAllowed"/>
<type>warning</type>
<exclude-pattern>*/tests/</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.ClassComment.Missing">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.Missing">
<type>warning</type>
<exclude-pattern>*/config/</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.MissingParamTag">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.MissingParamComment">
<type>warning</type>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.ParamCommentNotCapital">
<type>warning</type>
</rule>
Expand Down

0 comments on commit 9c5de04

Please sign in to comment.