Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update development kit #587

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cf703ad
Update LoginFilter.php
mjamilasfihani Sep 25, 2021
9ff7d8f
Merge branch 'lonnieezell:develop' into develop
mjamilasfihani Sep 26, 2021
59da7a8
Update LoginFilter.php
mjamilasfihani Sep 26, 2021
cd2536f
Update LoginFilter.php
mjamilasfihani Sep 26, 2021
837ef6d
uri_string is a bad idea
mjamilasfihani Sep 26, 2021
9cfdcf9
Update LoginFilter.php
mjamilasfihani Sep 26, 2021
d653285
use url_is() function for better solution
mjamilasfihani Sep 27, 2021
6922b14
a little re work for another filters
mjamilasfihani Sep 27, 2021
1c4cf54
fix
mjamilasfihani Sep 30, 2021
25b4199
Update PermissionFilter.php
mjamilasfihani Sep 30, 2021
ff02bb8
Candidate for BaseFilter & the reserved routes
mjamilasfihani Nov 5, 2021
129bcab
Candidate for the new Filters
mjamilasfihani Nov 5, 2021
5b316c7
Update BaseFilter.php
mjamilasfihani Nov 11, 2021
9b1d771
extend the BaseFilter
mjamilasfihani Nov 11, 2021
9c2931b
rename $defaultLandingRoute to $landingRoute
mjamilasfihani Nov 11, 2021
2d8a6c6
just rename some strings
mjamilasfihani Nov 30, 2021
a1d07de
Merge branch 'develop' of https://github.com/lonnieezell/myth-auth in…
mjamilasfihani Jul 1, 2022
782ac1d
Merge pull request #2 from mjamilasfihani/lonnieezell-develop
mjamilasfihani Jul 1, 2022
8babd47
Run CodeIgniter4 Coding Standards
mjamilasfihani Jul 1, 2022
44bb889
Update Routes.php
mjamilasfihani Jul 8, 2022
ab68723
Merge remote-tracking branch 'origin/develop' into refactor-filters
MGatner Jul 12, 2022
1a4ddf5
Fix typo
MGatner Jul 12, 2022
0dd5766
Apply analysis fixes
MGatner Jul 12, 2022
bab1b86
Merge branch 'lonnieezell:develop' into develop
mjamilasfihani Jul 13, 2022
341fcc7
Merge branch 'lonnieezell:develop' into develop
mjamilasfihani Aug 18, 2022
4ddd63c
Merge branch 'lonnieezell:develop' into develop
mjamilasfihani Oct 26, 2022
4a3444d
Merge branch 'lonnieezell:develop' into develop
mjamilasfihani Oct 27, 2022
ce93bdf
break changes
mjamilasfihani Jan 9, 2023
a8c1923
Update composer.json
mjamilasfihani Jan 9, 2023
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
5 changes: 2 additions & 3 deletions .github/workflows/deptrac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ jobs:
COMPOSER_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
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
5 changes: 2 additions & 3 deletions .github/workflows/infection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,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
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
5 changes: 2 additions & 3 deletions .github/workflows/phpcsfixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ jobs:
COMPOSER_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
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
5 changes: 2 additions & 3 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ jobs:
COMPOSER_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
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
7 changes: 3 additions & 4 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,18 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
tools: composer, phive, phpunit
extensions: intl, json, mbstring, gd, mysqlnd, pgsql, xdebug, xml, sqlite3
extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3, mysqlnd, pgsql
coverage: xdebug
env:
COMPOSER_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
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
5 changes: 2 additions & 3 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ jobs:
COMPOSER_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
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
7 changes: 3 additions & 4 deletions .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ jobs:
COMPOSER_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
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,5 +62,5 @@ jobs:

- name: Analyze for refactoring
run: |
composer global require --dev rector/rector:^0.14
composer global require --dev rector/rector:^0.15.1
rector process --dry-run --no-progress-bar
5 changes: 2 additions & 3 deletions .github/workflows/unused.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ jobs:
COMPOSER_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
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
22 changes: 14 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
"codeigniter4/codeigniter4-standard": "^1.0",
"codeigniter4/devkit": "^1.0",
"codeigniter4/framework": "^4.1",
"mockery/mockery": "^1.0"
"ergebnis/composer-normalize": "*",
"mockery/mockery": "^1.0",
"rector/rector": "^0.15.1"
},
"provide": {
"codeigniter4/authentication-implementation": "1.0"
Expand All @@ -46,7 +48,8 @@
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
"phpstan/extension-installer": true,
"ergebnis/composer-normalize": true
}
},
"scripts": {
Expand All @@ -57,17 +60,20 @@
],
"ci": [
"Composer\\Config::disableProcessTimeout",
"@cs",
"@deduplicate",
"@inspect",
"@analyze",
"@composer normalize --dry-run",
"@test",
"@inspect",
"@style"
"@test"
],
"deduplicate": "phpcpd app/ src/",
"cs": "php-cs-fixer fix --ansi --verbose --dry-run --diff",
"cs-fix": "php-cs-fixer fix --ansi --verbose --diff --using-cache=yes",
"deduplicate": "phpcpd src/ tests/",
"inspect": "deptrac analyze --cache-file=build/deptrac.cache",
"mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit",
"style": "php-cs-fixer fix --verbose --ansi --using-cache=no",
"test": "phpunit"
"sa": "@analyze",
"style": "@cs-fix",
"test": "phpunit --testdox"
}
}
8 changes: 4 additions & 4 deletions deptrac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ parameters:
- Vendor View
skip_violations:
Myth\Auth\Config\Services:
- Myth\Auth\Authorization\GroupModel
- Myth\Auth\Authorization\PermissionModel
- Myth\Auth\Models\LoginModel
- Myth\Auth\Models\UserModel
- Myth\Auth\Authorization\GroupModel
- Myth\Auth\Authorization\PermissionModel
- Myth\Auth\Models\LoginModel
- Myth\Auth\Models\UserModel
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ parameters:
- '#Cannot access property [\$a-z_]+ on (array|object)#'
- '#Parameter \$user of method Myth\\Auth\\Authentication\\Passwords\\ValidatorInterface::check\(\) has typehint with deprecated class CodeIgniter\\Entity#'
universalObjectCratesClasses:
- CodeIgniter\Entity
- CodeIgniter\Entity\Entity
- Faker\Generator
scanDirectories:
Expand Down
6 changes: 6 additions & 0 deletions psalm_autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

foreach ($helperDirs as $dir) {
$dir = __DIR__ . '/' . $dir;
if (! is_dir($dir)) {
continue;
}

chdir($dir);

foreach (glob('*_helper.php') as $filename) {
Expand All @@ -19,3 +23,5 @@
require_once $filePath;
}
}

chdir(__DIR__);
31 changes: 25 additions & 6 deletions rector.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
use Rector\CodeQuality\Rector\For_\ForToForeachRector;
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
Expand Down Expand Up @@ -29,15 +30,23 @@
use Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector;
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
use Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([SetList::DEAD_CODE, LevelSetList::UP_TO_PHP_74, PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD, PHPUnitSetList::PHPUNIT_80]);
$rectorConfig->sets([
SetList::DEAD_CODE,
LevelSetList::UP_TO_PHP_74,
PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD,
PHPUnitSetList::PHPUNIT_100,
]);

$rectorConfig->parallel();

// The paths to refactor (can also be supplied with CLI arguments)
$rectorConfig->paths([
__DIR__ . '/src/',
Expand Down Expand Up @@ -79,7 +88,7 @@
__DIR__ . '/tests',
],

// Ignore files that should not be namespaced
// Ignore files that should not be namespaced to their folder
NormalizeNamespaceByPSR4ComposerAutoloadRector::class => [
__DIR__ . '/src/Helpers',
],
Expand All @@ -90,6 +99,10 @@
// May be uninitialized on purpose
AddDefaultValueForUndefinedVariableRector::class,
]);

// auto import fully qualified class names
$rectorConfig->importNames();

$rectorConfig->rule(SimplifyUselessVariableRector::class);
$rectorConfig->rule(RemoveAlwaysElseRector::class);
$rectorConfig->rule(CountArrayToEmptyArrayComparisonRector::class);
Expand All @@ -113,8 +126,14 @@
$rectorConfig->rule(SimplifyEmptyArrayCheckRector::class);
$rectorConfig->rule(NormalizeNamespaceByPSR4ComposerAutoloadRector::class);
$rectorConfig
->ruleWithConfiguration(TypedPropertyRector::class, [
// Set to false if you use in libraries, or it does create breaking changes.
TypedPropertyRector::INLINE_PUBLIC => false,
->ruleWithConfiguration(TypedPropertyFromAssignsRector::class, [
/**
* The INLINE_PUBLIC value is default to false to avoid BC break, if you use for libraries and want to preserve BC break, you don't need to configure it, as it included in LevelSetList::UP_TO_PHP_74
* Set to true for projects that allow BC break
*/
TypedPropertyFromAssignsRector::INLINE_PUBLIC => false,
]);
$rectorConfig->rule(StringClassNameToClassConstantRector::class);
$rectorConfig->rule(PrivatizeFinalClassPropertyRector::class);
$rectorConfig->rule(CompleteDynamicPropertiesRector::class);
};
2 changes: 1 addition & 1 deletion tests/authentication/AuthenticationBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class AuthenticationBaseTest extends AuthTestCase
/**
* @var LocalAuthenticator
*/
protected $auth;
private $auth;

protected $refresh = true;

Expand Down
2 changes: 1 addition & 1 deletion tests/authentication/LocalAuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class LocalAuthTest extends AuthTestCase
/**
* @var LocalAuthenticator
*/
protected $auth;
private $auth;

/**
* @var bool
Expand Down
2 changes: 1 addition & 1 deletion tests/authorization/FlatAuthorizationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class FlatAuthorizationTest extends AuthTestCase
*/
protected $permissions;

protected FlatAuthorization $auth;
private FlatAuthorization $auth;

protected function setUp(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/authorization/GroupModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
final class GroupModelTest extends AuthTestCase
{
protected GroupModel $model;
private GroupModel $model;
protected $refresh = true;

protected function setUp(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/authorization/PermissionModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
final class PermissionModelTest extends AuthTestCase
{
protected PermissionModel $model;
private PermissionModel $model;
protected $refresh = true;

protected function setUp(): void
Expand Down
7 changes: 1 addition & 6 deletions tests/controllers/LoginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ public function testLoginDisplaysForm()

$this->assertTrue($result->isOK());

/**
* @see https://github.com/codeigniter4/CodeIgniter4/pull/6756
*
* @phpstan-ignore-next-line
*/
$result->see('Login', 'h2');
}

Expand Down Expand Up @@ -108,7 +103,7 @@ public function testAttemptLoginSuccess(bool $remembering)
$this->assertSame($remembering, $result->response()->hasCookie('remember'));
}

public function rememberMeProvider()
public static function rememberMeProvider()
{
return [
[true],
Expand Down
Loading