Skip to content

Commit 4c0e44a

Browse files
committed
wip
1 parent 489daae commit 4c0e44a

File tree

6 files changed

+83
-0
lines changed

6 files changed

+83
-0
lines changed

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
"tempest/router": "self.version",
104104
"tempest/storage": "self.version",
105105
"tempest/support": "self.version",
106+
"tempest/upgrade": "self.version",
106107
"tempest/validation": "self.version",
107108
"tempest/view": "self.version",
108109
"tempest/vite": "self.version"
@@ -143,6 +144,7 @@
143144
"Tempest\\Router\\": "packages/router/src",
144145
"Tempest\\Storage\\": "packages/storage/src",
145146
"Tempest\\Support\\": "packages/support/src",
147+
"Tempest\\Upgrade\\": "packages/upgrade/src",
146148
"Tempest\\Validation\\": "packages/validation/src",
147149
"Tempest\\View\\": "packages/view/src",
148150
"Tempest\\Vite\\": "packages/vite/src"
@@ -208,6 +210,7 @@
208210
"Tempest\\Router\\Tests\\": "packages/router/tests",
209211
"Tempest\\Storage\\Tests\\": "packages/storage/tests",
210212
"Tempest\\Support\\Tests\\": "packages/support/tests",
213+
"Tempest\\Upgrade\\Tests\\": "packages/upgrade/tests",
211214
"Tempest\\Validation\\Tests\\": "packages/validation/tests",
212215
"Tempest\\View\\Tests\\": "packages/view/tests",
213216
"Tempest\\Vite\\Tests\\": "packages/vite/tests",

packages/upgrade/.gitattributes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Exclude build/test files from the release
2+
.github/ export-ignore
3+
tests/ export-ignore
4+
.gitattributes export-ignore
5+
.gitignore export-ignore
6+
phpunit.xml export-ignore
7+
README.md export-ignore
8+
9+
# Configure diff output
10+
*.view.php diff=html
11+
*.php diff=php
12+
*.css diff=css
13+
*.html diff=html
14+
*.md diff=markdown

packages/upgrade/LICENSE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2024 Brent Roose [email protected]
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

packages/upgrade/composer.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "tempest/upgrade",
3+
"description": "A collection of Rector rules for upgrading Tempest",
4+
"license": "MIT",
5+
"minimum-stability": "dev",
6+
"require": {
7+
"php": "^8.4",
8+
"rector/rector": "^2.1"
9+
},
10+
"autoload": {
11+
"psr-4": {
12+
"Tempest\\Upgrade\\": "src"
13+
}
14+
},
15+
"autoload-dev": {
16+
"psr-4": {
17+
"Tempest\\Upgrade\\Tests\\": "tests"
18+
}
19+
}
20+
}

packages/upgrade/phpunit.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.4/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
executionOrder="depends,defects"
7+
beStrictAboutOutputDuringTests="true"
8+
displayDetailsOnPhpunitDeprecations="true"
9+
failOnPhpunitDeprecation="false"
10+
failOnRisky="true"
11+
failOnWarning="true"
12+
>
13+
<testsuites>
14+
<testsuite name="Tempest Support">
15+
<directory>tests</directory>
16+
</testsuite>
17+
</testsuites>
18+
<source restrictNotices="true" restrictWarnings="true" ignoreIndirectDeprecations="true">
19+
<include>
20+
<directory>src</directory>
21+
</include>
22+
</source>
23+
</phpunit>

packages/upgrade/src/tempest2.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
use Rector\Config\RectorConfig;
4+
use Rector\Renaming\Rector\Name\RenameClassRector;
5+
6+
return static function (RectorConfig $config) : void {
7+
$config->removeUnusedImports();
8+
$config->importNames();
9+
$config->importShortClasses();
10+
$config->ruleWithConfiguration(RenameClassRector::class, [
11+
'Tempest\\Database\\Id' => 'Tempest\\Database\\PrimaryKey',
12+
'Tempest\\CommandBus\\AsyncCommand' => 'Tempest\\CommandBus\\Async',
13+
]);
14+
};

0 commit comments

Comments
 (0)