@@ -58,11 +58,25 @@ $app->replacement('author.email')
5858 ->validate (fn (string $ value ) => $ value === filter_var ($ value , FILTER_VALIDATE_EMAIL ));
5959
6060$ isUpdate = $ args ->command () === 'update ' ;
61- $ app ->template ('composer.json ' )->createWith (function (Contents $ contents ) use ($ isUpdate ) {
62- $ baseTemplate = new Template \BasicTemplate ($ contents ->template ());
61+ $ isSelf = $ rootDirectory === __DIR__ ;
62+
63+ $ app ->template ('composer.json ' )->createWith (function (Contents $ contents ) use ($ isSelf , $ isUpdate ) {
64+ $ placeholders = ['{$tpl.REQUIRE_DEV} ' , '{$tpl.PHP_EXEC} ' , '{$tpl.PHPCS} ' ];
65+ $ replacements = $ isSelf
66+ ? ['null ' , '@php ' , 'phpcs.xml.dist ' ]
67+ : ['{ "polymorphine/dev": null } ' , '' , 'vendor/polymorphine/dev/phpcs.xml ' ];
68+ $ baseTemplate = new Template \BasicTemplate (str_replace ($ placeholders , $ replacements , $ contents ->template ()));
6369 return new Template \MergedJsonTemplate ($ baseTemplate , $ contents ->package (), $ isUpdate );
6470});
6571
72+ $ app ->template ('.github/workflows/build.yml ' )->createWith (function (Contents $ contents ) use ($ isSelf ) {
73+ $ placeholders = ['${tpl.PHP_EXEC} ' , '${tpl.PHPCS} ' ];
74+ $ replacements = $ isSelf
75+ ? ['php ' , 'phpcs.xml.dist ' ]
76+ : ['vendor/bin/ ' , 'vendor/polymorphine/dev/phpcs.xml ' ];
77+ return new Template \BasicTemplate (str_replace ($ placeholders , $ replacements , $ contents ->template ()));
78+ });
79+
6680$ app ->template ('LICENSE ' )->createWith (function (Contents $ contents ) {
6781 return new Template \BasicTemplate (str_replace ('{$tpl.CURRENT_YEAR} ' , date ('Y ' ), $ contents ->template ()));
6882});
0 commit comments