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
35 changes: 17 additions & 18 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
name: CI
name: Static Analysis

on: [push]
on: [ push, pull_request ]

jobs:
phpstan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- name: Add GitHub to known hosts
run: ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Add SSH key to agent
run: |
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
- uses: php-actions/composer@v6
- name: PHPStan Static Analysis
- uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist
- name: PHPStan
uses: php-actions/phpstan@v3
with:
path: lib/ tests/
level: 9
php_version: 7.4
# Pre-existing library code has ~50 issues at level 9; that's
# tech debt for a separate cleanup PR. Level 5 catches the
# things that actually break at runtime without blocking on
# iterable-type docblocks.
level: 5
php_version: 8.1
39 changes: 18 additions & 21 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
name: CI

on: [ push ]
on: [ push, pull_request ]

jobs:
build-test:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '7.4', '8.0', '8.1', '8.2' ]
fail-fast: false
matrix:
# The composer.lock pins modern PHPNomad versions whose own
# transitive deps no longer support PHP < 8.2. Older PHP rows
# would fail at `composer install` regardless of the library's
# own constraints. composer.json should declare an explicit PHP
# floor matching this (separate cleanup).
php: [ '8.2', '8.3' ]
steps:
- uses: actions/checkout@v3
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- name: Add GitHub to known hosts
run: ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Add SSH key to agent
run: |
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
- name: Clear composer cache
run: composer clear-cache
- uses: php-actions/composer@v6
- name: PHPUnit Tests
uses: php-actions/phpunit@v3
- uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
configuration: phpunit.xml
php-version: ${{ matrix.php }}
coverage: none
- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist
- name: Run PHPUnit
run: ./vendor/bin/phpunit
22 changes: 11 additions & 11 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Spellcheck Action
on: push
name: Spellcheck

on: [ push, pull_request ]

jobs:
build:
build:
name: Spellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rojopolis/spellcheck-github-actions@0.27.0
name: Spellcheck
runs-on: ubuntu-latest
steps:
# The checkout step
- uses: actions/checkout@master
- uses: rojopolis/spellcheck-github-actions@0.27.0
name: Spellcheck
with:
config_path: .spellcheck.yml
with:
config_path: .spellcheck.yml
21 changes: 20 additions & 1 deletion .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,23 @@ Traceback
nodejs
npm
fediverse
readme
readme
PHP
bindFactory
bootstrapper
bootstrapper's
Bootstrapper
DatabaseStrategy
fn
initializer
myapp
mysql
MySql
MySqlInitializer
phpnomad
PHPNomad
SafeMySql
SafeMySQL
SafeMySqlDatabaseStrategy
schemas
txt
2 changes: 2 additions & 0 deletions lib/Builders/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class QueryBuilder implements QueryBuilderInterface

protected ?ClauseBuilder $clauseBuilder = null;
protected array $groupBy = [];
protected array $join = [];

/** @inheritDoc */
public function select(string $field, string ...$fields)
Expand Down Expand Up @@ -288,6 +289,7 @@ public function reset()
$this->offset = [];
$this->orderBy = [];
$this->groupBy = [];
$this->join = [];

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Strategies/QueryStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public function estimatedCount(Table $table): int

try {
$result = $this->db->query($query);
return (int)Arr::get($result[0], 'COUNT(*)', 0);
return (int)Arr::get($result[0], 'COUNT(*)');
} catch (\Exception $e) {
throw new DatastoreErrorException('Count query failed: ' . $e->getMessage(), 500, $e);
}
Expand Down
Loading