Skip to content
Merged
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
107 changes: 65 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,69 @@
name: CI

on: [push, pull_request]
on:
push:
branches: [master]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build-test:
runs-on: ubuntu-latest
strategy:
matrix:
php_version: [8.3, 8.4, 8.5]
composer_flags: ['', '--prefer-lowest']

steps:
- uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
extensions: xdebug

- name: Install dependencies
uses: php-actions/composer@v6
with:
php_version: ${{ matrix.php_version }}
args: ${{ matrix.composer_flags }}
command: update

- name: Run tests
run: ./vendor/bin/phpunit --coverage-clover ./tests/logs/clover.xml
env:
XDEBUG_MODE: coverage

- name: Run Codesniffer
run: vendor/bin/phpcs --standard=PSR2 ./src

# - name: Submit coverage to Coveralls
# # We use php-coveralls library for this, as the official Coveralls GitHub Action lacks support for clover reports:
# # https://github.com/coverallsapp/github-action/issues/15
# env:
# COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# COVERALLS_PARALLEL: true
# COVERALLS_FLAG_NAME: ${{ github.job }}-PHP-${{ matrix.php_version }} ${{ matrix.composer_flags }}
# run: |
# composer global require php-coveralls/php-coveralls
# ~/.composer/vendor/bin/php-coveralls -v
ci:
name: PHP ${{ matrix.php }} ${{ matrix.dependency_type }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ["8.3", "8.4", "8.5"]
dependency_type: ["stable", "lowest"]
include:
- dependency_type: "stable"
composer_flags: "--no-interaction --no-progress"
- dependency_type: "lowest"
composer_flags: "--no-interaction --no-progress --prefer-lowest"

steps:
- uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: xdebug, curl
tools: composer

- name: Install dependencies
run: composer update ${{ matrix.composer_flags }}

- name: Run lint
run: ./vendor/bin/phpcs

- name: Run tests
run: ./vendor/bin/phpunit --coverage-cobertura ./cobertura.xml
env:
XDEBUG_MODE: coverage

- name: Code Coverage Report
if: matrix.php == '8.3' && matrix.dependency_type == 'stable'
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: ./cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: "60 80"

- name: Write Coverage to Job Summary
if: matrix.php == '8.3' && matrix.dependency_type == 'stable'
run: |
echo "## Code Coverage" >> $GITHUB_STEP_SUMMARY
cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
"illuminate/pipeline": "^10.49",
"spatie/backtrace": "^1.8.1",
"illuminate/conditionable": "^10.49",
"guzzlehttp/guzzle": "^7.10",
"guzzlehttp/guzzle": "^7.9",
"spatie/flare-client-php": "^1.10.1"
},
"require-dev": {
"phpunit/phpunit": "^12.0",
"php-coveralls/php-coveralls": "^2.8",
"mockery/mockery": "^1.6.12",
"brain/monkey": "^2.6.2",
"squizlabs/php_codesniffer": "^3.13.4",
Expand All @@ -55,5 +54,10 @@
"allow-plugins": {
"composer/installers": true
}
},
"minimum-stability": "stable",
"scripts": {
"lint": "phpcs",
"lint-fix": "phpcbf"
}
}
31 changes: 31 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<ruleset name="Lumberjack">
<description>Lumberjack Coding Standard</description>

<arg name="extensions" value="php"/>
<arg name="colors"/>
<arg value="p"/>

<!-- Use PSR12 as a base -->
<rule ref="PSR12"/>

<!-- Allow snake_case in tests -->
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>tests/*</exclude-pattern>
</rule>

<!-- Allow multiple classes in a file for tests (stubs/mocks) -->
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<exclude-pattern>tests/*</exclude-pattern>
</rule>

<!-- Allow multiple namespaces/classes in a file for tests -->
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
<exclude-pattern>tests/*</exclude-pattern>
</rule>

<file>src</file>
<file>tests</file>

<exclude-pattern>vendor/*</exclude-pattern>
</ruleset>
4 changes: 2 additions & 2 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __construct(?string $path = null)
}
}

public function set(string $key, $value) : Config
public function set(string $key, $value): Config
{
Arr::set($this->data, $key, $value);

Expand All @@ -33,7 +33,7 @@ public function has(string $key)
return Arr::has($this->data, $key);
}

public function load(string $path) : Config
public function load(string $path): Config
{
$files = glob($path . '/*.php');

Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/Arrayable.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ interface Arrayable
*
* @return array
*/
public function toArray() : array;
public function toArray(): array;
}
2 changes: 1 addition & 1 deletion src/Contracts/MiddlewareAliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ interface MiddlewareAliases
{
public function set(string $name, $middleware);
public function get(string $name);
public function has(string $name) : bool;
public function has(string $name): bool;
}
4 changes: 2 additions & 2 deletions src/Dcrypt/AesCbc.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ class AesCbc extends OpensslBridge
*
* @var string
*/
const CIPHER = 'aes-256-cbc';
public const CIPHER = 'aes-256-cbc';

/**
* Specify sha256 for message authentication
*
* @var string
*/
const CHKSUM = 'sha256';
public const CHKSUM = 'sha256';
}
2 changes: 1 addition & 1 deletion src/Dcrypt/AesCtr.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ class AesCtr extends AesCbc
*
* @var string
*/
const CIPHER = 'aes-256-ctr';
public const CIPHER = 'aes-256-ctr';
}
2 changes: 1 addition & 1 deletion src/Dcrypt/Hash.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
class Hash
{
const ALGO = 'sha256';
public const ALGO = 'sha256';

/**
* Internal function used to build the actual hash.
Expand Down
2 changes: 1 addition & 1 deletion src/Dcrypt/OpensslBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class OpensslBridge
* dcrypt\mcrypt and dcrypt\aes. Since v7, this is only needed for backwards
* compatibility with older versions
*/
const RIJNDA = 'rijndael-128';
public const RIJNDA = 'rijndael-128';

/**
* Decrypt cyphertext
Expand Down
1 change: 0 additions & 1 deletion src/Dcrypt/OpensslWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

class OpensslWrapper
{

/**
* OpenSSL encrypt wrapper function
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

class CannotRedeclarePostClassOnQueryException extends \Exception
{

}
1 change: 0 additions & 1 deletion src/Exceptions/CannotRedeclarePostTypeOnQueryException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

class CannotRedeclarePostTypeOnQueryException extends \Exception
{

}
2 changes: 1 addition & 1 deletion src/Exceptions/HandlerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ interface HandlerInterface
{
public function report(Exception $e);

public function render(ServerRequestInterface $request, Exception $e) : ResponseInterface;
public function render(ServerRequestInterface $request, Exception $e): ResponseInterface;
}
1 change: 0 additions & 1 deletion src/Exceptions/InvalidMetaRelationshipException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

class InvalidMetaRelationshipException extends \Exception
{

}
1 change: 0 additions & 1 deletion src/Exceptions/PostTypeRegistrationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

class PostTypeRegistrationException extends \Exception
{

}
1 change: 0 additions & 1 deletion src/Exceptions/TwigTemplateNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

class TwigTemplateNotFoundException extends \Exception
{

}
1 change: 0 additions & 1 deletion src/Http/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

class Controller extends BaseController
{

}
4 changes: 2 additions & 2 deletions src/Http/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function map(array $verbs, string $uri, $callback): Route
* @param mixed $callback
* @return boolean
*/
private function isControllerString($callback) : bool
private function isControllerString($callback): bool
{
return is_string($callback) && str_contains($callback, '@');
}
Expand All @@ -44,7 +44,7 @@ private function isControllerString($callback) : bool
* @param string $callback
* @return string
*/
private function normaliseCallbackString(string $callback) : string
private function normaliseCallbackString(string $callback): string
{
@list($controller, $method) = explode('@', $callback);

Expand Down
3 changes: 2 additions & 1 deletion src/Http/ServerRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

class ServerRequest extends DiactorosServerRequest
{
use InteractsWithInput, InteractsWithUri;
use InteractsWithInput;
use InteractsWithUri;

public static function fromRequest(ServerRequestInterface $request)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Providers/RouterServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class RouterServiceProvider extends ServiceProvider
{
public function register()
{
$store = new MiddlewareAliasStore;
$store = new MiddlewareAliasStore();
$resolver = new MiddlewareResolver($this->app, $store);

$router = new Router($this->app, $resolver);
Expand Down
10 changes: 5 additions & 5 deletions src/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class QueryBuilder implements QueryBuilderContract
private $params = [];

// Order Directions
const DESC = 'DESC';
const ASC = 'ASC';
public const DESC = 'DESC';
public const ASC = 'ASC';

// Field Types
const NUMERIC = 'numeric';
public const NUMERIC = 'numeric';

// Logical Operators
const OR = 'OR';
const AND = 'AND';
public const OR = 'OR';
public const AND = 'AND';

public function getParameters(): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/ScopedQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ protected function hasQueryBuilderMethod(string $name): bool

public function wherePostType($postType)
{
throw new CannotRedeclarePostTypeOnQueryException;
throw new CannotRedeclarePostTypeOnQueryException();
}
}
Loading