Skip to content

Commit 58aa308

Browse files
authored
Merge pull request #1017 from cakephp/5.next-upwards-merge
merge 5.x => 5.next
2 parents feedfb6 + 2781466 commit 58aa308

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+488
-130
lines changed

.phive/phars.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="phpstan" version="1.10.22" installed="1.10.22" location="./tools/phpstan" copy="false"/>
4-
<phar name="psalm" version="5.13.1" installed="5.13.1" location="./tools/psalm" copy="false"/>
3+
<phar name="phpstan" version="1.11.9" installed="1.11.9" location="./tools/phpstan" copy="false"/>
4+
<phar name="psalm" version="5.25.0" installed="5.25.0" location="./tools/psalm" copy="false"/>
55
</phive>

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ For details and older versions see [version map](https://github.com/cakephp/debu
2424

2525
* Install the plugin with [Composer](https://getcomposer.org/) from your CakePHP Project's ROOT directory (where the **composer.json** file is located)
2626
```sh
27-
php composer.phar require --dev cakephp/debug_kit:"^4.0"
27+
php composer.phar require --dev cakephp/debug_kit:"^5.0"
2828
```
2929

30-
* [Load the plugin](https://book.cakephp.org/4/en/plugins.html#loading-a-plugin)
30+
* [Load the plugin](https://book.cakephp.org/5/en/plugins.html#loading-a-plugin)
3131
```php
3232
// src/Application.php
3333
$this->addPlugin('DebugKit');
@@ -45,6 +45,8 @@ working correctly. Some common problems are:
4545
2. Your hostname needs to be added to the `DebugKit.safeTld`. If your local
4646
domain isn't a known development environment name, DebugKit will disable
4747
itself to protect a potentially non-development environment.
48+
3. If you are using the [Authorization Plugin](https://github.com/cakephp/authorization)
49+
you need to set `DebugKit.ignoreAuthorization` to `true` in your config.
4850

4951
## Reporting Issues
5052

@@ -63,3 +65,7 @@ requests](https://help.github.com/articles/using-pull-requests) or open
6365

6466
Documentation for DebugKit can be found in the
6567
[CakePHP documentation](https://book.cakephp.org/debugkit/5/en/index.html).
68+
69+
## Panels
70+
Panels by other plugins:
71+
- `L10n` by [Setup plugin](https://github.com/dereuromark/cakephp-setup) to show current localization for Date, DateTime, Time objects/values.

composer.json

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
{
22
"name": "cakephp/debug_kit",
33
"description": "CakePHP Debug Kit",
4-
"type": "cakephp-plugin",
5-
"keywords": ["cakephp", "debug", "kit", "dev"],
6-
"homepage": "https://github.com/cakephp/debug_kit",
74
"license": "MIT",
5+
"type": "cakephp-plugin",
6+
"keywords": [
7+
"cakephp",
8+
"debug",
9+
"kit",
10+
"dev"
11+
],
812
"authors": [
913
{
1014
"name": "Mark Story",
@@ -16,13 +20,15 @@
1620
"homepage": "https://github.com/cakephp/debug_kit/graphs/contributors"
1721
}
1822
],
23+
"homepage": "https://github.com/cakephp/debug_kit",
1924
"support": {
2025
"issues": "https://github.com/cakephp/debug_kit/issues",
2126
"forum": "https://stackoverflow.com/tags/cakephp",
2227
"irc": "irc://irc.freenode.org/cakephp",
2328
"source": "https://github.com/cakephp/debug_kit"
2429
},
2530
"require": {
31+
"php": ">=8.1",
2632
"cakephp/cakephp": "dev-5.next as 5.1.0",
2733
"composer/composer": "^2.0",
2834
"doctrine/sql-formatter": "^1.1.3"
@@ -32,6 +38,9 @@
3238
"cakephp/cakephp-codesniffer": "^5.0",
3339
"phpunit/phpunit": "^10.5.5 || ^11.1.3"
3440
},
41+
"suggest": {
42+
"ext-pdo_sqlite": "DebugKit needs to store panel data in a database. SQLite is simple and easy to use."
43+
},
3544
"autoload": {
3645
"psr-4": {
3746
"DebugKit\\": "src/"
@@ -40,33 +49,30 @@
4049
"autoload-dev": {
4150
"psr-4": {
4251
"Cake\\Test\\": "vendor/cakephp/cakephp/tests/",
43-
"DebugKit\\Test\\": "tests/",
4452
"DebugKit\\TestApp\\": "tests/test_app/",
53+
"DebugKit\\Test\\": "tests/",
4554
"DebugkitTestPlugin\\": "tests/test_app/Plugin/DebugkitTestPlugin/src/"
4655
}
4756
},
48-
"suggest": {
49-
"ext-pdo_sqlite": "DebugKit needs to store panel data in a database. SQLite is simple and easy to use."
57+
"config": {
58+
"allow-plugins": {
59+
"dealerdirect/phpcodesniffer-composer-installer": true
60+
}
5061
},
5162
"scripts": {
5263
"cs-check": "phpcs --colors --parallel=16 -p src/ tests/",
5364
"cs-fix": "phpcbf --colors --parallel=16 -p src/ tests/",
5465
"phpstan": "tools/phpstan analyse",
5566
"psalm": "tools/psalm --show-info=false",
67+
"psalm-baseline": "tools/psalm --set-baseline=psalm-baseline.xml",
5668
"stan": [
5769
"@phpstan",
5870
"@psalm"
5971
],
6072
"stan-baseline": "tools/phpstan --generate-baseline",
61-
"psalm-baseline": "tools/psalm --set-baseline=psalm-baseline.xml",
6273
"stan-setup": "phive install",
6374
"test": "phpunit"
6475
},
65-
"config": {
66-
"allow-plugins": {
67-
"dealerdirect/phpcodesniffer-composer-installer": true
68-
}
69-
},
7076
"minimum-stability": "dev",
7177
"prefer-stable": true
7278
}

docs/en/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ Configuration
6464

6565
* ``DebugKit.ignoreAuthorization`` - Set to true to ignore Cake Authorization plugin for DebugKit requests. Disabled by default.
6666

67+
* ``DebugKit.maxDepth`` - Defines how many levels of nested data should be shown in general for debug output. Default is 5.
68+
WARNING: Increasing the max depth level can lead to an out of memory error.::
69+
70+
// Show more levels
71+
Configure::write('DebugKit.maxDepth', 8);
72+
6773
* ``DebugKit.variablesPanelMaxDepth`` - Defines how many levels of nested data should be shown in the variables tab. Default is 5.
6874
WARNING: Increasing the max depth level can lead to an out of memory error.::
6975

phpstan-baseline.neon

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
11
parameters:
22
ignoreErrors:
3-
-
4-
message: "#^Call to function file_get_contents\\(\\) on a separate line has no effect\\.$#"
5-
count: 1
6-
path: src/Command/BenchmarkCommand.php
7-
8-
-
9-
message: "#^Comparison operation \"\\<\" between int\\<0, max\\> and 10\\|100\\|array\\<int, string\\>\\|bool\\|string\\|null results in an error\\.$#"
10-
count: 1
11-
path: src/Command/BenchmarkCommand.php
12-
13-
-
14-
message: "#^Comparison operation \"\\<\\=\" between 10\\|100\\|array\\<int, string\\>\\|string\\|true and 1 results in an error\\.$#"
15-
count: 1
16-
path: src/Command/BenchmarkCommand.php
17-
183
-
194
message: "#^Method DebugKit\\\\Mailer\\\\Transport\\\\DebugKitTransport\\:\\:send\\(\\) should return array\\{headers\\: string, message\\: string\\} but returns array\\{headers\\: non\\-empty\\-array\\<string, string\\>, message\\: array\\{text\\: string, html\\: string\\}\\}\\.$#"
205
count: 1

phpstan.neon

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ includes:
33

44
parameters:
55
level: 6
6-
checkMissingIterableValueType: false
7-
checkGenericClassInNonGenericObjectType: false
86
treatPhpDocTypesAsCertain: false
97
bootstrapFiles:
108
- tests/bootstrap.php
119
paths:
1210
- src/
11+
ignoreErrors:
12+
- identifier: missingType.generics
13+
- identifier: missingType.iterableValue
14+

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
processIsolation="false"
55
stopOnFailure="false"
66
cacheDirectory=".phpunit.cache"
7-
bootstrap="./tests/bootstrap.php"
7+
bootstrap="tests/bootstrap.php"
88
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
99
>
1010
<testsuites>

psalm-baseline.xml

Lines changed: 74 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,101 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="5.13.1@086b94371304750d1c673315321a55d15fc59015">
3-
<file src="src/Command/BenchmarkCommand.php">
4-
<PossiblyInvalidArgument>
5-
<code><![CDATA[$options['t'] - array_sum($times)]]></code>
6-
</PossiblyInvalidArgument>
7-
<PossiblyInvalidOperand>
8-
<code><![CDATA[$options['t']]]></code>
9-
<code>array_sum($times)</code>
10-
</PossiblyInvalidOperand>
2+
<files psalm-version="5.20.0@3f284e96c9d9be6fe6b15c79416e1d1903dcfef4">
3+
<file src="src/Cache/Engine/DebugEngine.php">
4+
<RiskyTruthyFalsyComparison>
5+
<code>$key</code>
6+
</RiskyTruthyFalsyComparison>
7+
</file>
8+
<file src="src/Controller/MailPreviewController.php">
9+
<RiskyTruthyFalsyComparison>
10+
<code><![CDATA[$this->findPart($email, $partType)]]></code>
11+
</RiskyTruthyFalsyComparison>
12+
</file>
13+
<file src="src/Database/Log/DebugLog.php">
14+
<InternalMethod>
15+
<code>jsonSerialize</code>
16+
</InternalMethod>
1117
</file>
1218
<file src="src/DebugInclude.php">
1319
<PossiblyNullArrayOffset>
1420
<code><![CDATA[$this->_composerPaths]]></code>
1521
<code><![CDATA[$this->_pluginPaths]]></code>
1622
</PossiblyNullArrayOffset>
1723
</file>
24+
<file src="src/DebugMemory.php">
25+
<RiskyTruthyFalsyComparison>
26+
<code>!$message</code>
27+
</RiskyTruthyFalsyComparison>
28+
</file>
1829
<file src="src/DebugSql.php">
1930
<InternalMethod>
2031
<code>bindings</code>
2132
</InternalMethod>
33+
<RiskyTruthyFalsyComparison>
34+
<code>$file</code>
35+
<code>$file</code>
36+
<code>$file</code>
37+
<code>$line</code>
38+
<code>$line</code>
39+
</RiskyTruthyFalsyComparison>
2240
</file>
2341
<file src="src/DebugTimer.php">
2442
<PossiblyNullArrayOffset>
2543
<code>self::$_timers</code>
2644
</PossiblyNullArrayOffset>
45+
<RiskyTruthyFalsyComparison>
46+
<code>!$message</code>
47+
<code>!$name</code>
48+
<code>!$name</code>
49+
</RiskyTruthyFalsyComparison>
2750
</file>
2851
<file src="src/Mailer/MailPreview.php">
2952
<PossiblyFalseOperand>
3053
<code>$pos</code>
3154
</PossiblyFalseOperand>
3255
</file>
56+
<file src="src/Mailer/PreviewResult.php">
57+
<RiskyTruthyFalsyComparison>
58+
<code><![CDATA[!$mailer->viewBuilder()->getTemplate()]]></code>
59+
</RiskyTruthyFalsyComparison>
60+
</file>
3361
<file src="src/Mailer/Transport/DebugKitTransport.php">
3462
<InvalidReturnStatement>
3563
<code>$result</code>
3664
</InvalidReturnStatement>
3765
<MoreSpecificReturnType>
3866
<code>array</code>
3967
</MoreSpecificReturnType>
40-
<PropertyTypeCoercion>
41-
<code>new $className($config)</code>
42-
</PropertyTypeCoercion>
68+
<NullArgument>
69+
<code><![CDATA[$this->emailLog]]></code>
70+
</NullArgument>
71+
</file>
72+
<file src="src/Model/Table/LazyTableTrait.php">
73+
<RiskyTruthyFalsyComparison>
74+
<code><![CDATA[strpos($e->getMessage(), 'unable to open')]]></code>
75+
</RiskyTruthyFalsyComparison>
76+
</file>
77+
<file src="src/Panel/DeprecationsPanel.php">
78+
<RiskyTruthyFalsyComparison>
79+
<code>$pluginName</code>
80+
<code>$vendorName</code>
81+
</RiskyTruthyFalsyComparison>
82+
</file>
83+
<file src="src/Panel/EnvironmentPanel.php">
84+
<RiskyTruthyFalsyComparison>
85+
<code>$pluginName</code>
86+
<code>$vendorName</code>
87+
</RiskyTruthyFalsyComparison>
88+
</file>
89+
<file src="src/Panel/IncludePanel.php">
90+
<RiskyTruthyFalsyComparison>
91+
<code>$pluginName</code>
92+
<code>$vendorName</code>
93+
</RiskyTruthyFalsyComparison>
94+
</file>
95+
<file src="src/Panel/LogPanel.php">
96+
<RiskyTruthyFalsyComparison>
97+
<code><![CDATA[Log::getConfig('debug_kit_log_panel')]]></code>
98+
</RiskyTruthyFalsyComparison>
4399
</file>
44100
<file src="src/Panel/PanelRegistry.php">
45101
<LessSpecificImplementedReturnType>
@@ -62,6 +118,12 @@
62118
<code>genericInstances</code>
63119
</UndefinedInterfaceMethod>
64120
</file>
121+
<file src="src/ToolbarService.php">
122+
<RiskyTruthyFalsyComparison>
123+
<code><![CDATA[!$GLOBALS['FORCE_DEBUGKIT_TOOLBAR']]]></code>
124+
<code>$enabled</code>
125+
</RiskyTruthyFalsyComparison>
126+
</file>
65127
<file src="src/View/Helper/ToolbarHelper.php">
66128
<InternalClass>
67129
<code>new HtmlFormatter()</code>

src/Command/BenchmarkCommand.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,21 @@ public function execute(Arguments $args, ConsoleIo $io): ?int
5050
$this->io = $io;
5151
/** @var string $url */
5252
$url = $args->getArgumentAt(0);
53-
$defaults = ['t' => 100, 'n' => 10];
54-
$options = array_merge($defaults, $args->getOptions());
5553
$times = [];
5654

5755
$io->out(Text::insert('-> Testing :url', compact('url')));
5856
$io->out('');
59-
for ($i = 0; $i < $options['n']; $i++) {
60-
if (floor($options['t'] - array_sum($times)) <= 0 || $options['n'] <= 1) {
57+
$count = 10;
58+
if ($args->hasOption('n')) {
59+
$count = (float)$args->getOption('n');
60+
}
61+
$timeout = 100;
62+
if ($args->hasOption('t')) {
63+
$timeout = (float)$args->getOption('t');
64+
}
65+
66+
for ($i = 0; $i < $count; $i++) {
67+
if (floor($timeout - array_sum($times)) <= 0 || $count <= 1) {
6168
break;
6269
}
6370

src/Controller/ComposerController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private function executeComposerCommand(ArrayInput $input): BufferedOutput
8585
putenv('COMPOSER_HOME=' . $bin);
8686
putenv('COMPOSER_CACHE_DIR=' . CACHE);
8787

88-
$dir = getcwd();
88+
$dir = (string)getcwd();
8989
chdir(ROOT);
9090
$timeLimit = ini_get('max_execution_time');
9191
set_time_limit(300);

0 commit comments

Comments
 (0)