Skip to content

Commit

Permalink
Merge pull request #33 from tattersoftware/devkit
Browse files Browse the repository at this point in the history
Update DevKit
  • Loading branch information
MGatner authored Feb 3, 2024
2 parents 6de6e21 + d2d7412 commit cb1f2ce
Show file tree
Hide file tree
Showing 18 changed files with 181 additions and 159 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/deptrac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,23 @@ jobs:
extensions: intl, json, mbstring, xml
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Create Deptrac cache directory
run: mkdir -p build/

- name: Cache Deptrac results
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: build
key: ${{ runner.os }}-deptrac-${{ github.sha }}
Expand Down
24 changes: 6 additions & 18 deletions .github/workflows/infection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ on:
- 'composer.*'
- 'phpunit*'
- '.github/workflows/infection.yml'
push:
branches:
- develop
paths:
- '**.php'
- 'composer.*'
- 'phpunit*'
- '.github/workflows/infection.yml'

jobs:
main:
Expand All @@ -36,7 +28,7 @@ jobs:
extensions: intl, json, mbstring, gd, xml, sqlite3
coverage: xdebug
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
Expand All @@ -45,13 +37,12 @@ jobs:
uses: mheap/phpunit-matcher-action@v1

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

Expand All @@ -63,10 +54,7 @@ jobs:
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
fi
- name: Test with PHPUnit
run: vendor/bin/phpunit --teamcity

- name: Mutate with Infection
- name: Run Infection for added files only
run: |
git fetch --depth=1 origin $GITHUB_BASE_REF
infection --threads=2 --skip-initial-tests --coverage=build/phpunit --git-diff-base=origin/$GITHUB_BASE_REF --git-diff-filter=AM --logger-github --ignore-msi-with-no-mutations
infection --threads=max --git-diff-lines --git-diff-base=origin/$GITHUB_BASE_REF --ignore-msi-with-no-mutations --only-covered --logger-github
9 changes: 4 additions & 5 deletions .github/workflows/phpcsfixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@ jobs:
extensions: json, tokenizer
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0', '8.1']
php-versions: ['7.4', '8.0', '8.1', '8.2']

steps:
- name: Checkout
Expand All @@ -40,24 +40,23 @@ jobs:
extensions: intl, json, mbstring, xml
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Create PHPStan cache directory
run: mkdir -p build/phpstan

- name: Cache PHPStan results
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: build/phpstan
key: ${{ runner.os }}-phpstan-${{ github.sha }}
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1']
php-versions: ['7.4', '8.0', '8.1', '8.2']

steps:
- name: Checkout
Expand All @@ -39,16 +39,15 @@ jobs:
extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3
coverage: xdebug
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

Expand All @@ -66,7 +65,7 @@ jobs:
TERM: xterm-256color
TACHYCARDIA_MONITOR_GA: enabled

- if: matrix.php-versions == '8.0'
- if: matrix.php-versions == '8.1'
name: Run Coveralls
continue-on-error: true
run: |
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,23 @@ jobs:
extensions: intl, json, mbstring, xml
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Create Psalm cache directory
run: mkdir -p build/psalm

- name: Cache Psalm results
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: build/psalm
key: ${{ runner.os }}-psalm-${{ github.sha }}
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0', '8.1']
php-versions: ['7.4', '8.0', '8.1', '8.2']

steps:
- name: Checkout
Expand All @@ -40,16 +40,15 @@ jobs:
extensions: intl, json, mbstring, xml
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

Expand All @@ -62,6 +61,4 @@ jobs:
fi
- name: Analyze for refactoring
run: |
composer global require --dev rector/rector:^0.13.8
rector process --dry-run --no-progress-bar
run: vendor/bin/rector process --dry-run --no-progress-bar
9 changes: 4 additions & 5 deletions .github/workflows/unused.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,15 @@ jobs:
extensions: intl, json, mbstring, xml
coverage: none
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

Expand Down
15 changes: 12 additions & 3 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@
__DIR__ . '/src/',
__DIR__ . '/tests/',
])
->exclude('build')
->append([__FILE__]);
->exclude([
'build',
'Views',
])
->append([
__FILE__,
__DIR__ . '/rector.php',
]);

$overrides = [];
$overrides = [
// 'declare_strict_types' => true,
// 'void_return' => true,
];

$options = [
'finder' => $finder,
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"require-dev": {
"codeigniter4/framework": "^4.2",
"tatter/imposter": "^1.0",
"tatter/tools": "^2.0"
"tatter/tools": "^2.0",
"kint-php/kint": "^5.1"
},
"suggest": {
"codeigniter4/authentication-implementation": "Required to track authenticated users."
Expand Down
55 changes: 28 additions & 27 deletions examples/Visits.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,51 +20,52 @@
class Visits extends BaseConfig
{
/**
* Whether to enable tracking in all controllers using
* the post_controller_constructor event.
*/
public bool $trackAllPages = true;

/**
* Metric for tracking a unique visitor
* Database field for tracking a unique visitor
*
* @var 'ip_address'|'session_id'|'user_id'
*/
public $trackingMethod = 'ip_address';
public string $trackingMethod = 'ip_address';

/**
* Session variable to check for a logged-in user ID
*
* @deprecated Next version will rely on codeigniter4/authentication-implementation
*
* @var string
* Number of seconds before a visit counts as new
* instead of incrementing a previous view count.
* Set to zero to record each page view as unique (not recommended).
*/
public $userSource = 'logged_in';
public int $resetAfter = HOUR;

/**
* Number of minutes before a visit counts as new
* instead of incrementing a previous view count.
* Set to zero to record each page view as unique (not recommended).
* Transformers to apply (in order) before
* recording the visit data.
*
* @var int
* @see VisitModel::applyTransformations()
*
* @var class-string<Transformer>[]
*/
public $resetMinutes = 60;
public array $transformers = [];

/**
* Whether to ignore AJAX requests when recording.
* See framework User Guide for caveats.
*
* @see https://www.codeigniter.com/user_guide/general/ajax.html
*
* @var bool
*/
public $ignoreAjax = true;
public bool $ignoreAjax = true;

/**
* URIs to exclude from tracking.
* Accepts regex values.
*
* @var string[]
* Whether to ignore requests that result in a redirect response.
* Note: requires using the "after" filter method.
*/
public bool $ignoreRedirects = true;

/**
* Whether to ignore requests that result in an empty body.
* Note: requires using the "after" filter method.
*/
public bool $requireBody = false;

/**
* Whether to ignore requests with Content Types other than HTML.
* Note: requires using the "after" filter method.
*/
public array $excludeUris = [];
public bool $requireHtml = false;
}
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
autoloader="psalm_autoload.php"
cacheDirectory="build/psalm/"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src/" />
Expand Down
Loading

0 comments on commit cb1f2ce

Please sign in to comment.