Skip to content

Commit

Permalink
feature #6 Php8 support (sstok)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 2.0-dev branch.

Discussion
----------

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets | 
| License       | MIT

Drop support for PHP 7, and modernize the codebase.

Commits
-------

1d30586 Clean-up old files
6961f85 Drop support for PHP 7
c4ace14 Modernize readme
a6e7640 Add GitHub workflow
  • Loading branch information
sstok authored Nov 5, 2023
1 parent 3e7ff21 commit fda7e3d
Show file tree
Hide file tree
Showing 28 changed files with 488 additions and 323 deletions.
16 changes: 8 additions & 8 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
* text=auto

# Always use LF
core.autocrlf=lf

.editorconfig
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php_cs export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
.github export-ignore
phpspec.yml export-ignore
/spec export-ignore
.php-cs-fixer.dist.php export-ignore
CODE_OF_CONDUCT.md export-ignore
Makefile export-ignore
phpunit.xml.dist export-ignore
phpstan.neon export-ignore
phpstan-baseline.neon export-ignore
tests/ export-ignore
12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/1_Bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: "\U0001F41B Bug Report"
about: Report errors and problems
title: "[bug] "
labels: Potential Bug
assignees: ''

---

**Description**
<!-- A clear and concise description of the problem. -->

**How to reproduce**
<!-- Code and/or config needed to reproduce the problem. -->

**Possible Solution**
<!--- Optional: only if you have suggestions on a fix/reason for the bug -->

**Additional context**
<!-- Optional: any other context about the problem: log messages, screenshots, etc. -->
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/2_Feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: "\U0001F680 Feature Request"
about: "I have a suggestion (and may want to implement it \U0001F642)!"
title: "[Feature] "
labels: Feature
assignees: ''

---

**Description**
<!-- A clear and concise description of the new feature. -->

**Example**
<!-- A simple example of the new feature in action (include PHP code, YAML config, etc.)
If the new feature changes an existing feature, include a simple before/after comparison. -->
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/3_Support_question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: 👩‍🏫 Support Question
about: Questions about using this library
labels: Question / Support

---

**Description**
<!-- A clear and concise description of the problem. Also include what you tried, and any code
snippets if you have them.
Please be patient, it may take some to get a response. Thanks.
-->
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/4_Security_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: ⛔ Security Issue
about: Report security issues and problems (PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY)

---

⚠ PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY, SEE BELOW.

If you have found a security issue in this project, please send the details to
security [at] rollerscapes.net and don't disclose it publicly until we can provide a
fix for it.

**Note:** Please don't blindly send reports about automated tools, make sure the
reported issue is in fact exploitable. Thanks.
5 changes: 3 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
| New feature? | yes/no
| BC breaks? | yes/no
| Deprecations? | yes/no
| Tests pass? | yes/no
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| Fixed tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT

<!--
- Please fill in this template according to the PR you're about to submit.
Provide additional information in your description, not the questioner table.
- Replace this comment by a description of what your PR is solving.
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too.)
-->
157 changes: 157 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: 'CI'

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
cs-fixer:
name: 'PHP CS Fixer'

runs-on: 'ubuntu-latest'

strategy:
matrix:
php-version:
- '8.2'

steps:
-
name: 'Check out'
uses: 'actions/checkout@v4'

-
name: 'Set up PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php-version }}'
coverage: 'none'

-
name: 'Get Composer cache directory'
id: 'composer-cache'
run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'

-
name: 'Cache dependencies'
uses: 'actions/cache@v3'
with:
path: '${{ steps.composer-cache.outputs.cache_dir }}'
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: 'php-${{ matrix.php-version }}-composer-locked-'

-
name: 'Install dependencies'
run: 'composer install --no-progress'

-
name: 'Check the code style'
run: 'make cs'

phpstan:
name: 'PhpStan'

runs-on: 'ubuntu-latest'

strategy:
matrix:
php-version:
- '8.2'

steps:
-
name: 'Check out'
uses: 'actions/checkout@v4'

-
name: 'Set up PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php-version }}'
coverage: 'none'

-
name: 'Get Composer cache directory'
id: 'composer-cache'
run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'

-
name: 'Cache dependencies'
uses: 'actions/cache@v3'
with:
path: '${{ steps.composer-cache.outputs.cache_dir }}'
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: 'php-${{ matrix.php-version }}-composer-locked-'

-
name: 'Install dependencies'
run: 'composer install --no-progress'

-
name: 'Run PhpStan'
run: 'vendor/bin/phpstan analyze --no-progress'

tests:
name: 'PHPUnit'

runs-on: 'ubuntu-latest'

strategy:
matrix:
include:
-
php-version: '8.1'
composer-options: '--prefer-stable'
symfony-version: '6.3'
-
php-version: '8.2'
composer-options: '--prefer-stable'
symfony-version: '^6.4'

-
php-version: '8.2'
composer-options: '--prefer-stable'
symfony-version: '^7.0'

steps:
-
name: 'Check out'
uses: 'actions/checkout@v4'

-
name: 'Set up PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php-version }}'
coverage: 'none'

-
name: 'Get Composer cache directory'
id: 'composer-cache'
run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'

-
name: 'Cache dependencies'
uses: 'actions/cache@v3'
with:
path: '${{ steps.composer-cache.outputs.cache_dir }}'
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: 'php-${{ matrix.php-version }}-composer-locked-'

-
name: 'Install dependencies'
env:
COMPOSER_OPTIONS: '${{ matrix.composer-options }}'
SYMFONY_REQUIRE: '${{ matrix.symfony-version }}'
run: |
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins symfony/flex
composer update --no-progress $COMPOSER_OPTIONS
-
name: 'Run tests'
run: make phpunit
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/composer.lock
*.phar
composer.lock
/vendor/
.php_cs.cache

phpunit.xml
.phpunit.result.cache
.phpunit.cache/
.phpunit

.php-cs-fixer.cache
30 changes: 30 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

$header = <<<EOF
This file is part of the Rollerworks UriEncoder package.
(c) Sebastiaan Stok <[email protected]>
This source file is subject to the MIT license that is bundled
with this source code in the file LICENSE.
EOF;

/** @var \Symfony\Component\Finder\Finder $finder */
$finder = PhpCsFixer\Finder::create();
$finder
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
]);

$config = new PhpCsFixer\Config();
$config
->setRiskyAllowed(true)
->setRules(
array_merge(
require __DIR__ . '/vendor/rollerscapes/standards/php-cs-fixer-rules.php',
['header_comment' => ['header' => $header]])
)
->setFinder($finder);

return $config;
48 changes: 0 additions & 48 deletions .php_cs

This file was deleted.

26 changes: 0 additions & 26 deletions .scrutinizer.yml

This file was deleted.

Loading

0 comments on commit fda7e3d

Please sign in to comment.