Skip to content

Commit df1095e

Browse files
authored
Merge pull request #1096 from cakephp/cake-5.4
Cake 5.4
2 parents 680587e + 75383f9 commit df1095e

15 files changed

Lines changed: 29 additions & 83 deletions

‎composer.json‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222
"source": "https://github.com/cakephp/bake"
2323
},
2424
"require": {
25-
"php": ">=8.1",
26-
"brick/varexporter": "^0.6.0 || ^0.7.0",
27-
"cakephp/cakephp": "^5.1",
28-
"cakephp/twig-view": "^2.0.2",
25+
"php": ">=8.2",
26+
"brick/varexporter": "^0.7.0",
27+
"cakephp/cakephp": "^5.4",
28+
"cakephp/twig-view": "^2.1",
2929
"nikic/php-parser": "^5.0.0"
3030
},
3131
"require-dev": {
3232
"cakephp/cakephp-codesniffer": "^5.0.0",
3333
"cakephp/debug_kit": "^5.0.0",
34-
"phpunit/phpunit": "^10.5.40 || ^11.5.20 || ^12.2.4 || ^13.0"
34+
"phpunit/phpunit": "^11.5.20 || ^12.2.4 || ^13.0"
3535
},
3636
"autoload": {
3737
"psr-4": {

‎phpstan-baseline.neon‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
parameters:
22
ignoreErrors:
3-
-
4-
message: '#^Method Bake\\BakePlugin\:\:bootstrap\(\) has parameter \$app with generic interface Cake\\Core\\PluginApplicationInterface but does not specify its types\: TSubject$#'
5-
identifier: missingType.generics
6-
count: 1
7-
path: src/BakePlugin.php
8-
93
-
104
message: '#^Instanceof between mixed and Cake\\Chronos\\Chronos will always evaluate to false\.$#'
115
identifier: instanceof.alwaysFalse

‎src/BakePlugin.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ protected function discoverCommands(CommandCollection $commands): CommandCollect
109109
*
110110
* @param string $namespace The namespace classes are expected to be in.
111111
* @param string $path The path to look in.
112-
* @return array<string>
113-
* @phpstan-return array<string, class-string<\Bake\Command\BakeCommand>>
112+
* @return array<string, class-string<\Bake\Command\BakeCommand>>
114113
*/
115114
protected function findInPath(string $namespace, string $path): array
116115
{

‎src/Command/CellCommand.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ public function template(): string
5959
* Get template data.
6060
*
6161
* @param \Cake\Console\Arguments $arguments Arguments object.
62-
* @return array
63-
* @phpstan-return array<string, mixed>
62+
* @return array<string, mixed>
6463
*/
6564
public function templateData(Arguments $arguments): array
6665
{

‎src/Command/CommandCommand.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ public function template(): string
5757
* Get template data.
5858
*
5959
* @param \Cake\Console\Arguments $arguments Arguments object.
60-
* @return array
61-
* @phpstan-return array<string, mixed>
60+
* @return array<string, mixed>
6261
*/
6362
public function templateData(Arguments $arguments): array
6463
{

‎src/Command/EnumCommand.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ public function template(): string
6161
* Get template data.
6262
*
6363
* @param \Cake\Console\Arguments $arguments The arguments for the command
64-
* @return array
65-
* @phpstan-return array<string, mixed>
64+
* @return array<string, mixed>
6665
*/
6766
public function templateData(Arguments $arguments): array
6867
{

‎src/Command/SimpleBakeCommand.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ abstract public function template(): string;
5353
* Get template data.
5454
*
5555
* @param \Cake\Console\Arguments $arguments The arguments for the command
56-
* @return array
57-
* @phpstan-return array<string, mixed>
56+
* @return array<string, mixed>
5857
*/
5958
public function templateData(Arguments $arguments): array
6059
{

‎src/View/BakeView.php‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ public function dispatchEvent(string $name, array $data = [], ?object $subject =
116116
{
117117
$name = (string)preg_replace('/^View\./', 'Bake.', $name);
118118

119-
/** @phpstan-ignore-next-line missingType.generics */
120119
return parent::dispatchEvent($name, $data, $subject);
121120
}
122121

‎templates/bake/Model/enum.twig‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,16 @@
1717
namespace: "#{namespace}\\Model\\Enum",
1818
classImports: [
1919
'Cake\\Database\\Type\\EnumLabelInterface',
20-
'Cake\\Utility\\Inflector',
20+
'Cake\\Database\\Type\\EnumLabelTrait',
2121
],
2222
}) }}
2323

2424
{{ DocBlock.classDescription(name, 'Enum', [])|raw }}
2525
enum {{ name }}: {{ backingType }} implements EnumLabelInterface
2626
{
27+
use EnumLabelTrait;
2728
{% if cases %}
28-
{{ Bake.concat('\n ', cases) }}
2929

30+
{{ Bake.concat('\n ', cases) }}
3031
{% endif %}
31-
/**
32-
* @return string
33-
*/
34-
public function label(): string
35-
{
36-
return Inflector::humanize(Inflector::underscore($this->name));
37-
}
3832
}

‎tests/comparisons/Model/testBakeEnum.php‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@
44
namespace Bake\Test\App\Model\Enum;
55

66
use Cake\Database\Type\EnumLabelInterface;
7-
use Cake\Utility\Inflector;
7+
use Cake\Database\Type\EnumLabelTrait;
88

99
/**
1010
* FooBar Enum
1111
*/
1212
enum FooBar: string implements EnumLabelInterface
1313
{
14-
/**
15-
* @return string
16-
*/
17-
public function label(): string
18-
{
19-
return Inflector::humanize(Inflector::underscore($this->name));
20-
}
14+
use EnumLabelTrait;
2115
}

0 commit comments

Comments
 (0)