Skip to content

Commit cc566fa

Browse files
authored
Merge pull request #15 from dotkernel/issue-12
Issue #12: Fixed `(Core)ConfigProvider` and `Middleware` related post `make module` messages
2 parents 592fe3a + 92f5597 commit cc566fa

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

.roave-backward-compatibility-check.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="vendor/roave/backward-compatibility-check/resources/schema.xsd">
55
<baseline>
6-
<ignored-regex>#\[BC\] SKIPPED: An enum expression Dot\Maker\\VisibilityEnum\:\:Public is not supported in class Dot\\Maker\\Component\\Method in file /src/Component/Method.php#</ignored-regex>
7-
<ignored-regex>#\[BC\] SKIPPED: An enum expression Dot\Maker\\VisibilityEnum\:\:Protected is not supported in class Dot\\Maker\\Component\\Property in file /src/Component/Property.php#</ignored-regex>
6+
<ignored-regex>#\[BC\] SKIPPED: An enum expression Dot\\Maker\\VisibilityEnum::Public is not supported in class Dot\\Maker\\Component\\Method in file \/src\/Component\/Method\.php \(line 20\)#</ignored-regex>
7+
<ignored-regex>#\[BC\] SKIPPED: An enum expression Dot\\Maker\\VisibilityEnum::Protected is not supported in class Dot\\Maker\\Component\\Property in file \/src\/Component\/Property\.php \(line 15\)#</ignored-regex>
88
</baseline>
99
</roave-bc-check>

src/Message.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static function addConfigProviderToConfig(string $fqcn): self
7777
)
7878
->append(':')
7979
->appendLine(
80-
ColorEnum::colorize(sprintf(' %s,', $fqcn), ColorEnum::ForegroundBrightYellow)
80+
ColorEnum::colorize(sprintf(' %s::class,', $fqcn), ColorEnum::ForegroundBrightYellow)
8181
);
8282
}
8383

@@ -146,7 +146,7 @@ public static function addMiddlewareToPipeline(string $fqcn): self
146146
)
147147
->append(':')
148148
->appendLine(
149-
ColorEnum::colorize(sprintf(' $app->pipe(%s);', $fqcn), ColorEnum::ForegroundBrightYellow)
149+
ColorEnum::colorize(sprintf(' $app->pipe(%s::class);', $fqcn), ColorEnum::ForegroundBrightYellow)
150150
);
151151
}
152152

test/MessageTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function testWillParseAddConfigProviderToConfigMessage(): void
6060

6161
$expected = <<<EXP
6262
add to \033[97mconfig/config.php\033[0m:
63-
\033[93m App\\Module\\ConfigProvider,\033[0m
63+
\033[93m App\\Module\\ConfigProvider::class,\033[0m
6464
EXP;
6565

6666
$this->assertSame($expected, (string) $message);
@@ -73,7 +73,7 @@ public function testWillParseAddCoreConfigProviderToConfigMessage(): void
7373

7474
$expected = <<<EXP
7575
add to \033[97mconfig/config.php\033[0m:
76-
\033[93m Core\\Module\\ConfigProvider,\033[0m
76+
\033[93m Core\\Module\\ConfigProvider::class,\033[0m
7777
EXP;
7878

7979
$this->assertSame($expected, (string) $message);
@@ -112,7 +112,7 @@ public function testWillParseAddMiddlewareToPipelineMessage(): void
112112

113113
$expected = <<<EXP
114114
add to \033[97mconfig/pipeline.php\033[0m:
115-
\033[93m \$app->pipe(App\\Module\\Middleware\\TestMiddleware);\033[0m
115+
\033[93m \$app->pipe(App\\Module\\Middleware\\TestMiddleware::class);\033[0m
116116
EXP;
117117

118118
$this->assertSame($expected, (string) $message);

test/Type/ModuleTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,13 +1060,13 @@ private function dataProviderWhenProjectTypeIsApiAndUsesCore(): string
10601060
\033[93mNext steps:\033[0m
10611061
\033[93m===========\033[0m
10621062
- add to \033[97mconfig/config.php\033[0m:
1063-
\033[93m Api\BookStore\ConfigProvider,\033[0m
1063+
\033[93m Api\BookStore\ConfigProvider::class,\033[0m
10641064
- add to \033[97mconfig/config.php\033[0m:
1065-
\033[93m Core\BookStore\ConfigProvider,\033[0m
1065+
\033[93m Core\BookStore\ConfigProvider::class,\033[0m
10661066
- add to \033[97mconfig/autoload/cli.global.php\033[0m under \033[97mdot_cli\033[0m.\033[97mcommands\033[0m:
10671067
\033[93m Api\BookStore\Command\BookStoreCommand::getDefaultName() => Api\BookStore\Command\BookStoreCommand::class,\033[0m
10681068
- add to \033[97mconfig/pipeline.php\033[0m:
1069-
\033[93m \$app->pipe(Api\BookStore\Middleware\BookStoreMiddleware);\033[0m
1069+
\033[93m \$app->pipe(Api\BookStore\Middleware\BookStoreMiddleware::class);\033[0m
10701070
- add to \033[97mconfig/autoload/authorization.global.php\033[0m
10711071
the routes registered in \033[97mvfs://root/src/BookStore/src/RoutesDelegator.php\033[0m
10721072
- add to \033[97mcomposer.json\033[0m under \033[97mautoload\033[0m.\033[97mpsr-4\033[0m:
@@ -1125,11 +1125,11 @@ private function dataProviderWhenProjectTypeIsApiAndDoesNotUseCore(): string
11251125
\033[93mNext steps:\033[0m
11261126
\033[93m===========\033[0m
11271127
- add to \033[97mconfig/config.php\033[0m:
1128-
\033[93m Api\BookStore\ConfigProvider,\033[0m
1128+
\033[93m Api\BookStore\ConfigProvider::class,\033[0m
11291129
- add to \033[97mconfig/autoload/cli.global.php\033[0m under \033[97mdot_cli\033[0m.\033[97mcommands\033[0m:
11301130
\033[93m Api\BookStore\Command\BookStoreCommand::getDefaultName() => Api\BookStore\Command\BookStoreCommand::class,\033[0m
11311131
- add to \033[97mconfig/pipeline.php\033[0m:
1132-
\033[93m \$app->pipe(Api\BookStore\Middleware\BookStoreMiddleware);\033[0m
1132+
\033[93m \$app->pipe(Api\BookStore\Middleware\BookStoreMiddleware::class);\033[0m
11331133
- add to \033[97mconfig/autoload/authorization.global.php\033[0m
11341134
the routes registered in \033[97mvfs://root/src/BookStore/src/RoutesDelegator.php\033[0m
11351135
- add to \033[97mcomposer.json\033[0m under \033[97mautoload\033[0m.\033[97mpsr-4\033[0m:
@@ -1195,13 +1195,13 @@ private function dataProviderWhenProjectTypeIsNotApiAndUsesCore(): string
11951195
\033[93mNext steps:\033[0m
11961196
\033[93m===========\033[0m
11971197
- add to \033[97mconfig/config.php\033[0m:
1198-
\033[93m Admin\BookStore\ConfigProvider,\033[0m
1198+
\033[93m Admin\BookStore\ConfigProvider::class,\033[0m
11991199
- add to \033[97mconfig/config.php\033[0m:
1200-
\033[93m Core\BookStore\ConfigProvider,\033[0m
1200+
\033[93m Core\BookStore\ConfigProvider::class,\033[0m
12011201
- add to \033[97mconfig/autoload/cli.global.php\033[0m under \033[97mdot_cli\033[0m.\033[97mcommands\033[0m:
12021202
\033[93m Admin\BookStore\Command\BookStoreCommand::getDefaultName() => Admin\BookStore\Command\BookStoreCommand::class,\033[0m
12031203
- add to \033[97mconfig/pipeline.php\033[0m:
1204-
\033[93m \$app->pipe(Admin\BookStore\Middleware\BookStoreMiddleware);\033[0m
1204+
\033[93m \$app->pipe(Admin\BookStore\Middleware\BookStoreMiddleware::class);\033[0m
12051205
- add to \033[97mconfig/autoload/authorization-guards.global.php\033[0m
12061206
the routes registered in \033[97mvfs://root/src/BookStore/src/RoutesDelegator.php\033[0m
12071207
- add to \033[97mcomposer.json\033[0m under \033[97mautoload\033[0m.\033[97mpsr-4\033[0m:
@@ -1268,11 +1268,11 @@ private function dataProviderWhenProjectTypeIsNotApiAndDoesNotUseCore(): string
12681268
\033[93mNext steps:\033[0m
12691269
\033[93m===========\033[0m
12701270
- add to \033[97mconfig/config.php\033[0m:
1271-
\033[93m Admin\BookStore\ConfigProvider,\033[0m
1271+
\033[93m Admin\BookStore\ConfigProvider::class,\033[0m
12721272
- add to \033[97mconfig/autoload/cli.global.php\033[0m under \033[97mdot_cli\033[0m.\033[97mcommands\033[0m:
12731273
\033[93m Admin\BookStore\Command\BookStoreCommand::getDefaultName() => Admin\BookStore\Command\BookStoreCommand::class,\033[0m
12741274
- add to \033[97mconfig/pipeline.php\033[0m:
1275-
\033[93m \$app->pipe(Admin\BookStore\Middleware\BookStoreMiddleware);\033[0m
1275+
\033[93m \$app->pipe(Admin\BookStore\Middleware\BookStoreMiddleware::class);\033[0m
12761276
- add to \033[97mconfig/autoload/authorization-guards.global.php\033[0m
12771277
the routes registered in \033[97mvfs://root/src/BookStore/src/RoutesDelegator.php\033[0m
12781278
- add to \033[97mcomposer.json\033[0m under \033[97mautoload\033[0m.\033[97mpsr-4\033[0m:

0 commit comments

Comments
 (0)