Formatting and fixup

This commit is contained in:
Greyscale 2024-04-14 18:13:59 +02:00
parent bc7fd3bf4f
commit dbfc415166
13 changed files with 162 additions and 138 deletions

View file

@ -1,30 +0,0 @@
name: Lint PHP
on: [push, pull_request]
jobs:
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Composer Action
run: docker run -v $PWD/:/app gone/php:cli-7.4 /usr/local/bin/composer install
- name: PHP-CS-Fixer
run: |
docker-compose run web \
phpdbg -qrr -d memory_limit=-1 \
vendor/bin/php-cs-fixer fix --dry-run
phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Composer Action
run: docker run -v $PWD/:/app gone/php:cli-7.4 /usr/local/bin/composer install
- name: PHPStan
run: |
docker-compose run web \
phpdbg -qrr -d memory_limit=-1 \
vendor/bin/phpstan analyse src/ test/ bin

50
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,50 @@
name: Tests
on:
push:
workflow_dispatch:
pull_request:
concurrency:
group: tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
ACTION_TOKEN: ${{ github.token }}
jobs:
phpcsfixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- uses: php-actions/phpunit@v3
phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- uses: php-actions/phpstan@v3
with:
path: src/
trunk:
name: Trunk Check Runner
runs-on: ubuntu-latest
permissions:
checks: write # For trunk to post annotations
steps:
- uses: actions/checkout@v3
- uses: trunk-io/trunk-action@v1

View file

@ -1,61 +0,0 @@
name: Test
on: [push, pull_request]
jobs:
ingest:
name: PHPUnit/Ingest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Composer Install
run: docker run -v $PWD/:/app gone/php:cli-7.4 /usr/local/bin/composer install
- name: PHPUnit
run: |
docker-compose run web \
phpdbg -qrr -d memory_limit=-1 \
vendor/bin/paratest \
--testsuite=Ingest
human:
name: PHPUnit/Human
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Composer Install
run: docker run -v $PWD/:/app gone/php:cli-7.4 /usr/local/bin/composer install
- name: PHPUnit
run: |
docker-compose run test \
phpdbg -qrr -d memory_limit=-1 \
vendor/bin/phpunit \
--testsuite=Human
models:
name: PHPUnit/Models
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Composer Install
run: docker run -v $PWD/:/app gone/php:cli-7.4 /usr/local/bin/composer install
- name: PHPUnit
run: |
docker-compose run test \
phpdbg -qrr -d memory_limit=-1 \
vendor/bin/phpunit \
--testsuite=Models
services:
name: PHPUnit/Services
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Composer Install
run: docker run -v $PWD/:/app gone/php:cli-7.4 /usr/local/bin/composer install
- name: PHPUnit
run: |
docker-compose run test \
phpdbg -qrr -d memory_limit=-1 \
vendor/bin/phpunit \
--testsuite=Services

18
.gitignore vendored
View file

@ -1,8 +1,10 @@
build/
composer.lock
vendor/
.idea/
.phpunit.result.cache
.php_cs.cache
docs
phploc.xml
/composer.lock
/vendor/
/.idea/
/.phpunit.result.cache
/.php_cs.cache
/.php-cs-fixer.cache
/.coverage
/phpunit.xml
/.github/cache
/.github/act.secrets

9
.trunk/.gitignore vendored Normal file
View file

@ -0,0 +1,9 @@
*out
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml
tmp

View file

@ -0,0 +1,2 @@
# Prettier friendly markdownlint config (all formatting rules disabled)
extends: markdownlint/style/prettier

View file

@ -0,0 +1,7 @@
enable=all
source-path=SCRIPTDIR
disable=SC2154
# If you're having issues with shellcheck following source, disable the errors via:
# disable=SC1090
# disable=SC1091

View file

@ -0,0 +1,7 @@
rules:
quoted-strings:
required: only-when-needed
extra-allowed: ["{|}"]
key-duplicates: {}
octal-values:
forbid-implicit-octal: true

36
.trunk/trunk.yaml Normal file
View file

@ -0,0 +1,36 @@
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.21.0
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins:
sources:
- id: trunk
ref: v1.4.5
uri: https://github.com/trunk-io/plugins
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
runtimes:
enabled:
- go@1.21.0
- node@18.12.1
- python@3.10.8
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint:
enabled:
- actionlint@1.6.27
- checkov@3.2.60
- git-diff-check
- markdownlint@0.39.0
- prettier@3.2.5
- shellcheck@0.10.0
- shfmt@3.6.0
- trivy@0.50.1
- trufflehog@3.71.0
- yamllint@1.35.1
actions:
enabled:
- trunk-announce
- trunk-check-pre-push
- trunk-fmt-pre-commit
- trunk-upgrade-available

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
function detectAndLoadVendor($path = __DIR__): void
{
$path = realpath($path);
@ -11,12 +13,12 @@ function detectAndLoadVendor($path = __DIR__): void
if ($fileInfo->isDir() && 'vendor' == $fileInfo->getFilename()) {
define('VENDOR_PATH', $fileInfo->getRealPath());
require_once VENDOR_PATH.'/autoload.php';
require_once VENDOR_PATH . '/autoload.php';
return;
}
}
detectAndLoadVendor($path.'/../');
detectAndLoadVendor($path . '/../');
}
detectAndLoadVendor();

View file

@ -1,36 +1,36 @@
{
"name": "benzine/orm",
"description": "The Benzine Database Access Layer. Includes generation of models, controllers and so on from schema.",
"type": "library",
"license": "GPL-3.0-or-later",
"authors": [
{
"name": "Matthew Baggett",
"email": "matthew@baggett.me"
}
],
"require": {
"php": ">=8.0",
"ext-simplexml": "*",
"matthewbaggett/twig-extension-inflect": "^1.0",
"matthewbaggett/twig-extension-transform": "^1.0",
"matthewbaggett/uuid": "^2.3",
"laminas/laminas-db": "^2.11.1",
"mattketmo/camel": "^1.1",
"nesbot/carbon": "^2.0",
"robmorgan/phinx": "^0.12.1"
},
"require-dev": {
"benzine/core": "dev-master"
},
"autoload": {
"psr-4": {
"Benzine\\ORM\\": "src",
"Benzine\\ORM\\Tests\\": "test/app/src"
}
},
"bin": [
"bin/laminator",
"bin/wait-for-mysql"
]
"name": "benzine/orm",
"description": "The Benzine Database Access Layer. Includes generation of models, controllers and so on from schema.",
"type": "library",
"license": "GPL-3.0-or-later",
"authors": [
{
"name": "Matthew Baggett",
"email": "matthew@baggett.me"
}
],
"require": {
"php": ">=8.0",
"ext-simplexml": "*",
"matthewbaggett/twig-extension-inflect": "^1.0",
"matthewbaggett/twig-extension-transform": "^1.0",
"matthewbaggett/uuid": "^2.3",
"laminas/laminas-db": "^2.11.1",
"mattketmo/camel": "^1.1",
"nesbot/carbon": "^2.0",
"robmorgan/phinx": "^0.12.1"
},
"require-dev": {
"benzine/core": "dev-main"
},
"autoload": {
"psr-4": {
"Benzine\\ORM\\": "src",
"Benzine\\ORM\\Tests\\": "test/app/src"
}
},
"bin": [
"bin/laminator",
"bin/wait-for-mysql"
]
}

View file

@ -13,13 +13,13 @@ use Benzine\ORM\LaminatorSql;
use Laminas\Db\Adapter\AdapterInterface;
use Laminas\Db\Adapter\Exception\InvalidQueryException;
use Laminas\Db\ResultSet\ResultSet;
use Laminas\Db\ResultSet\ResultSetInterface;
use Laminas\Db\Sql\Expression;
use Laminas\Db\Sql\Predicate;
use Laminas\Db\Sql\Predicate\PredicateInterface;
use Laminas\Db\Sql\Select;
use Laminas\Db\Sql\Where;
use Laminas\Db\TableGateway\TableGateway;
use Laminas\Db\ResultSet\ResultSetInterface;
abstract class AbstractTableGateway extends TableGateway
{

View file

@ -20,14 +20,14 @@ use Camel\Format;
use Laminas\Db\Metadata\Object\TableObject;
use Laminas\Stdlib\ConsoleHelper;
use Symfony\Component\Filesystem\Filesystem;
use Twig\Environment;
use Twig\Environment as TwigEnvironment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Error\SyntaxError;
use Twig\Loader\FilesystemLoader as TwigFileSystemLoader;
use Twig\Environment;
use Twig\Extension\DebugExtension;
use Twig\Loader\FilesystemLoader;
use Twig\Loader\FilesystemLoader as TwigFileSystemLoader;
use Twig\TwigFunction;
class Laminator