Skip to content

Commit b4c7879

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.6
2 parents aef9e37 + c23ff44 commit b4c7879

File tree

16 files changed

+125
-91
lines changed

16 files changed

+125
-91
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
'ThirdParty',
2929
'Validation/Views',
3030
])
31-
->notPath([
32-
])
3331
->notName('#Foobar.php$#')
3432
->append([
3533
__FILE__,
@@ -41,12 +39,7 @@
4139
__DIR__ . '/spark',
4240
]);
4341

44-
$overrides = [
45-
// for updating to coding-standard
46-
'modernize_strpos' => true,
47-
'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'],
48-
'php_unit_attributes' => true,
49-
];
42+
$overrides = [];
5043

5144
$options = [
5245
'cacheFile' => 'build/.php-cs-fixer.cache',

.php-cs-fixer.no-header.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
* the LICENSE file that was distributed with this source code.
1212
*/
1313

14-
use CodeIgniter\CodingStandard\CodeIgniter4;
15-
use Nexus\CsConfig\Factory;
16-
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
17-
use Nexus\CsConfig\FixerGenerator;
14+
use PhpCsFixer\ConfigInterface;
1815
use PhpCsFixer\Finder;
1916

17+
/** @var ConfigInterface $config */
18+
$config = require __DIR__ . '/.php-cs-fixer.dist.php';
19+
2020
$finder = Finder::create()
2121
->files()
2222
->in([
@@ -30,19 +30,10 @@
3030
]);
3131

3232
$overrides = [
33-
// for updating to coding-standard
34-
'modernize_strpos' => true,
35-
'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'],
36-
'php_unit_attributes' => true,
37-
];
38-
39-
$options = [
40-
'cacheFile' => 'build/.php-cs-fixer.no-header.cache',
41-
'finder' => $finder,
42-
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
43-
'customRules' => [
44-
NoCodeSeparatorCommentFixer::name() => true,
45-
],
33+
'header_comment' => false,
4634
];
4735

48-
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
36+
return $config
37+
->setFinder($finder)
38+
->setCacheFile('build/.php-cs-fixer.no-header.cache')
39+
->setRules(array_merge($config->getRules(), $overrides));

.php-cs-fixer.tests.php

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,29 @@
1111
* the LICENSE file that was distributed with this source code.
1212
*/
1313

14-
use CodeIgniter\CodingStandard\CodeIgniter4;
15-
use Nexus\CsConfig\Factory;
16-
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
17-
use Nexus\CsConfig\FixerGenerator;
14+
use PhpCsFixer\ConfigInterface;
1815
use PhpCsFixer\Finder;
1916

17+
/** @var ConfigInterface $config */
18+
$config = require __DIR__ . '/.php-cs-fixer.dist.php';
19+
2020
$finder = Finder::create()
2121
->files()
2222
->in([
2323
__DIR__ . '/tests',
2424
])
25-
->exclude([
26-
])
2725
->notPath([
2826
'_support/View/Cells/multiplier.php',
2927
'_support/View/Cells/colors.php',
3028
'_support/View/Cells/addition.php',
3129
])
32-
->notName('#Foobar.php$#')
33-
->append([
34-
]);
30+
->notName('#Foobar.php$#');
3531

3632
$overrides = [
3733
'void_return' => true,
38-
// for updating to coding-standard
39-
'modernize_strpos' => true,
40-
'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'],
41-
'php_unit_attributes' => true,
42-
];
43-
44-
$options = [
45-
'cacheFile' => 'build/.php-cs-fixer.tests.cache',
46-
'finder' => $finder,
47-
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
48-
'customRules' => [
49-
NoCodeSeparatorCommentFixer::name() => true,
50-
],
5134
];
5235

53-
return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary(
54-
'CodeIgniter 4 framework',
55-
'CodeIgniter Foundation',
56-
'admin@codeigniter.com'
57-
);
36+
return $config
37+
->setFinder($finder)
38+
->setCacheFile('build/.php-cs-fixer.tests.cache')
39+
->setRules(array_merge($config->getRules(), $overrides));

.php-cs-fixer.user-guide.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
* the LICENSE file that was distributed with this source code.
1212
*/
1313

14-
use CodeIgniter\CodingStandard\CodeIgniter4;
15-
use Nexus\CsConfig\Factory;
16-
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
17-
use Nexus\CsConfig\FixerGenerator;
14+
use PhpCsFixer\ConfigInterface;
1815
use PhpCsFixer\Finder;
1916

17+
/** @var ConfigInterface $config */
18+
$config = require __DIR__ . '/.php-cs-fixer.dist.php';
19+
2020
$finder = Finder::create()
2121
->files()
2222
->in([
@@ -32,26 +32,17 @@
3232

3333
$overrides = [
3434
'echo_tag_syntax' => false,
35+
'header_comment' => false,
3536
'php_unit_internal_class' => false,
3637
'no_unused_imports' => false,
3738
'class_attributes_separation' => false,
3839
'fully_qualified_strict_types' => [
3940
'import_symbols' => false,
4041
'leading_backslash_in_global_namespace' => true,
4142
],
42-
// for updating to coding-standard
43-
'modernize_strpos' => true,
44-
'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'],
45-
'php_unit_attributes' => true,
46-
];
47-
48-
$options = [
49-
'cacheFile' => 'build/.php-cs-fixer.user-guide.cache',
50-
'finder' => $finder,
51-
'customFixers' => FixerGenerator::create('vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer'),
52-
'customRules' => [
53-
NoCodeSeparatorCommentFixer::name() => true,
54-
],
5543
];
5644

57-
return Factory::create(new CodeIgniter4(), $overrides, $options)->forProjects();
45+
return $config
46+
->setFinder($finder)
47+
->setCacheFile('build/.php-cs-fixer.user-guide.cache')
48+
->setRules(array_merge($config->getRules(), $overrides));

admin/css/debug-toolbar/toolbar.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
}
9696

9797
h2 {
98+
font-weight: bold;
9899
font-size: $base-size;
99100
margin: 0;
100101
padding: 5px 0 10px 0;
@@ -292,6 +293,8 @@
292293

293294
// The tabs container
294295
.tab {
296+
height: fit-content;
297+
text-align: left;
295298
bottom: 35px;
296299
display: none;
297300
left: 0;
@@ -306,6 +309,8 @@
306309

307310
// The "Timeline" tab
308311
.timeline {
312+
position: static;
313+
display: table;
309314
margin-left: 0;
310315
width: 100%;
311316

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"phpunit/phpcov": "^9.0.2",
3333
"phpunit/phpunit": "^10.5.16",
3434
"predis/predis": "^1.1 || ^2.0",
35-
"rector/rector": "1.2.0",
35+
"rector/rector": "1.2.1",
3636
"vimeo/psalm": "^5.0"
3737
},
3838
"replace": {

phpstan-baseline.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7393,12 +7393,6 @@
73937393
'count' => 1,
73947394
'path' => __DIR__ . '/system/Helpers/test_helper.php',
73957395
];
7396-
$ignoreErrors[] = [
7397-
// identifier: empty.notAllowed
7398-
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
7399-
'count' => 1,
7400-
'path' => __DIR__ . '/system/Helpers/text_helper.php',
7401-
];
74027396
$ignoreErrors[] = [
74037397
// identifier: missingType.iterableValue
74047398
'message' => '#^Function strip_slashes\\(\\) has parameter \\$str with no value type specified in iterable type array\\.$#',

system/Config/BaseService.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
use Config\Optimize;
7777
use Config\Pager as ConfigPager;
7878
use Config\Services as AppServices;
79+
use Config\Session as ConfigSession;
7980
use Config\Toolbar as ConfigToolbar;
8081
use Config\Validation as ConfigValidation;
8182
use Config\View as ConfigView;
@@ -130,7 +131,7 @@
130131
* @method static Router router(RouteCollectionInterface $routes = null, Request $request = null, $getShared = true)
131132
* @method static RouteCollection routes($getShared = true)
132133
* @method static Security security(App $config = null, $getShared = true)
133-
* @method static Session session(App $config = null, $getShared = true)
134+
* @method static Session session(ConfigSession $config = null, $getShared = true)
134135
* @method static SiteURIFactory siteurifactory(App $config = null, Superglobals $superglobals = null, $getShared = true)
135136
* @method static Superglobals superglobals(array $server = null, array $get = null, bool $getShared = true)
136137
* @method static Throttler throttler($getShared = true)

system/Config/Services.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
use CodeIgniter\Router\RouteCollectionInterface;
5252
use CodeIgniter\Router\Router;
5353
use CodeIgniter\Security\Security;
54+
use CodeIgniter\Session\Handlers\BaseHandler as SessionBaseHandler;
5455
use CodeIgniter\Session\Handlers\Database\MySQLiHandler;
5556
use CodeIgniter\Session\Handlers\Database\PostgreHandler;
5657
use CodeIgniter\Session\Handlers\DatabaseHandler;
@@ -88,6 +89,7 @@
8889
use Config\Toolbar as ToolbarConfig;
8990
use Config\Validation as ValidationConfig;
9091
use Config\View as ViewConfig;
92+
use InvalidArgumentException;
9193
use Locale;
9294

9395
/**
@@ -674,17 +676,24 @@ public static function session(?SessionConfig $config = null, bool $getShared =
674676

675677
if ($driverName === DatabaseHandler::class) {
676678
$DBGroup = $config->DBGroup ?? config(Database::class)->defaultGroup;
677-
$db = Database::connect($DBGroup);
678679

679-
$driver = $db->getPlatform();
680+
$driverPlatform = Database::connect($DBGroup)->getPlatform();
680681

681-
if ($driver === 'MySQLi') {
682+
if ($driverPlatform === 'MySQLi') {
682683
$driverName = MySQLiHandler::class;
683-
} elseif ($driver === 'Postgre') {
684+
} elseif ($driverPlatform === 'Postgre') {
684685
$driverName = PostgreHandler::class;
685686
}
686687
}
687688

689+
if (! class_exists($driverName) || ! is_a($driverName, SessionBaseHandler::class, true)) {
690+
throw new InvalidArgumentException(sprintf(
691+
'Invalid session handler "%s" provided.',
692+
$driverName
693+
));
694+
}
695+
696+
/** @var SessionBaseHandler $driver */
688697
$driver = new $driverName($config, AppServices::get('request')->getIPAddress());
689698
$driver->setLogger($logger);
690699

system/Debug/Toolbar/Views/toolbar.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
margin-right: 5px;
6161
}
6262
#debug-bar h2 {
63+
font-weight: bold;
6364
font-size: 16px;
6465
margin: 0;
6566
padding: 5px 0 10px 0;
@@ -213,6 +214,8 @@
213214
white-space: nowrap;
214215
}
215216
#debug-bar .tab {
217+
height: fit-content;
218+
text-align: left;
216219
bottom: 35px;
217220
display: none;
218221
left: 0;
@@ -225,6 +228,8 @@
225228
z-index: 9999;
226229
}
227230
#debug-bar .timeline {
231+
position: static;
232+
display: table;
228233
margin-left: 0;
229234
width: 100%;
230235
}

0 commit comments

Comments
 (0)