Skip to content

Standard #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.idea export-ignore
/.vscode export-ignore
/tests export-ignore
/phpstan-baseline.neon export-ignore
/phpstan.neon export-ignore
/phpunit.xml export-ignore
/pint.json export-ignore
/UPGRADING.md export-ignore
/ray.php export-ignore
/.run export-ignore
/rector.php export-ignore
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
31 changes: 31 additions & 0 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Static Analysis (PHPStan)

on:
push:
branches:
- master
paths:
- '**.php'
- 'phpstan.neon'
pull_request:
# schedule:
# - cron: '0 0 * * 5'

jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: none

- name: Install composer dependencies
uses: ramsey/composer-install@v2

- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github
22 changes: 22 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Format Dry Run (Pint)

on:
push:
paths:
- '**.php'
branches:
- master
# - develop
# - '*.x'
pull_request:

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Run formatter"
uses: aglipanci/[email protected]
with:
testMode: true
useComposer: true
12 changes: 12 additions & 0 deletions .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: pull requests

on:
pull_request_target:
types: [opened]

permissions:
pull-requests: write

jobs:
uneditable:
uses: laravel/.github/.github/workflows/pull-requests.yml@main
50 changes: 50 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Tests

#on: [push]

on:
push:
branches:
- master
# - develop
# - '*.x'
pull_request:
# schedule:
# - cron: '0 0 * * 5'

#permissions:
# contents: read

jobs:
tests:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [8.2, 8.3, 8.4]

name: PHP ${{ matrix.php }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite
coverage: pcov

- name: Install Composer dependencies
run: composer i --prefer-dist --no-interaction --no-progress

- name: Copy environment file
run: cp .env.example .env

- name: Generate app key
run: php artisan key:generate

- name: Execute tests
run: vendor/bin/pest --ci --parallel --coverage
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
vendor/
build/
composer.lock
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

29 changes: 16 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,30 @@
}
],
"require": {
"php": ">=5.4"
"php": "^8.2"
},
"require-dev": {
"phpstan/phpstan": "^0.12.81",
"phpunit/phpunit": "~4.8|~5.0",
"satooshi/php-coveralls": "~1.0",
"symfony/yaml": "~2.0",
"symfony/config": "~2.0",
"symfony/console": "~2.0",
"symfony/stopwatch": "~2.0",
"symfony/filesystem": "~2.0",
"doctrine/instantiator": "1.0.4"
"composer-runtime-api": "^2.2",
"phpstan/phpstan": "^2.1.12",
"pestphp/pest": "^3.8.2",
"laravel/pint": "^1.22",
"rector/rector": "^2.0"
},
"autoload": {
"psr-4": {
"Khill\\Duration\\": "src/"
}
},
"scripts": {
"test": "phpunit -c phpunit.xml",
"phpstan": "vendor/bin/phpstan"
"test": "vendor/bin/pest --parallel",
"format": "vendor/bin/pint",
"analyse": "vendor/bin/phpstan",
"refactor": "vendor/bin/rector process"
},
"minimum-stability": "stable"
"minimum-stability": "stable",
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
}
}
2 changes: 1 addition & 1 deletion phpstan.neon.dist → phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
parameters:
level: 6
level: max
paths:
- src
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">test/</directory>
<directory suffix=".php">tests/</directory>
</testsuite>
</testsuites>

Expand Down
19 changes: 19 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"preset": "laravel",
"exclude": [
"config",
"build"
],
"notPath": [
"ray.php",
"composer-setup.php"
],
"cache-file": "build/pint",
"rules": {
"declare_strict_types": true,
"single_trait_insert_per_statement": true,
"strict_comparison": true,
"strict_param": true,
"yoda_style": true
}
}
14 changes: 14 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

return Rector\Config\RectorConfig::configure()
->withPhpSets()
->withPaths([
__DIR__.'/src',
__DIR__.'/tests',
])
->withCache(
cacheDirectory: 'build/rector',
cacheClass: Rector\Caching\ValueObject\Storage\FileCacheStorage::class,
);
Loading