-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
274 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
namespace TYPO3\CMS\Core\Messaging; | ||
|
||
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; | ||
|
||
if (class_exists('TYPO3\CMS\Core\Messaging\AbstractMessage')) { | ||
return; | ||
} | ||
|
||
abstract class AbstractMessage implements \JsonSerializable | ||
{ | ||
const NOTICE = -2; | ||
const INFO = -1; | ||
const OK = 0; | ||
const WARNING = 1; | ||
const ERROR = 2; | ||
|
||
public function setSeverity($severity = ContextualFeedbackSeverity::OK): void | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
namespace TYPO3\CMS\Core\Messaging; | ||
|
||
if (class_exists('TYPO3\CMS\Core\Messaging\FlashMessage')) { | ||
return; | ||
} | ||
|
||
class FlashMessage extends AbstractMessage | ||
{ | ||
public function jsonSerialize() | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
namespace TYPO3\CMS\Core\Type; | ||
|
||
if (class_exists('TYPO3\CMS\Core\Type\ContextualFeedbackSeverity')) { | ||
return; | ||
} | ||
|
||
class ContextualFeedbackSeverity | ||
{ | ||
const NOTICE = -2; | ||
const INFO = -1; | ||
const OK = 0; | ||
const WARNING = 1; | ||
const ERROR = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
namespace TYPO3\CMS\Reports; | ||
|
||
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; | ||
|
||
if (class_exists('TYPO3\CMS\Reports\Status')) { | ||
return; | ||
} | ||
|
||
class Status | ||
{ | ||
const NOTICE = -2; | ||
const INFO = -1; | ||
const OK = 0; | ||
const WARNING = 1; | ||
const ERROR = 2; | ||
|
||
private int $severity; | ||
|
||
public function __construct($severity = ContextualFeedbackSeverity::OK) | ||
{ | ||
$this->severity = $severity; | ||
} | ||
|
||
public function getSeverity(): int | ||
{ | ||
return $this->severity; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...Rector/v12/v0/typo3/ReplaceSeveritiesFlashMessageAndReportsRector/Fixture/fixture.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Ssch\TYPO3Rector\Tests\Rector\v12\v0\typo3\ReplaceSeveritiesFlashMessageAndReportsRector\Fixture; | ||
|
||
use TYPO3\CMS\Core\Messaging\FlashMessage; | ||
use TYPO3\CMS\Reports\Status; | ||
|
||
$flashMessage = new FlashMessage(); | ||
$flashMessage->setSeverity(FlashMessage::NOTICE); | ||
$flashMessage->setSeverity(FlashMessage::ERROR); | ||
$flashMessage->setSeverity(FlashMessage::INFO); | ||
$flashMessage->setSeverity(FlashMessage::OK); | ||
$flashMessage->setSeverity(FlashMessage::WARNING); | ||
|
||
$statusNotice = new Status(Status::NOTICE); | ||
$statusInfo = new Status(Status::INFO); | ||
$statusWarning = new Status(Status::WARNING); | ||
$statusOk = new Status(Status::OK); | ||
$statusError = new Status(Status::ERROR); | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Ssch\TYPO3Rector\Tests\Rector\v12\v0\typo3\ReplaceSeveritiesFlashMessageAndReportsRector\Fixture; | ||
|
||
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; | ||
use TYPO3\CMS\Core\Messaging\FlashMessage; | ||
use TYPO3\CMS\Reports\Status; | ||
|
||
$flashMessage = new FlashMessage(); | ||
$flashMessage->setSeverity(ContextualFeedbackSeverity::NOTICE); | ||
$flashMessage->setSeverity(ContextualFeedbackSeverity::ERROR); | ||
$flashMessage->setSeverity(ContextualFeedbackSeverity::INFO); | ||
$flashMessage->setSeverity(ContextualFeedbackSeverity::OK); | ||
$flashMessage->setSeverity(ContextualFeedbackSeverity::WARNING); | ||
|
||
$statusNotice = new Status(ContextualFeedbackSeverity::NOTICE); | ||
$statusInfo = new Status(ContextualFeedbackSeverity::INFO); | ||
$statusWarning = new Status(ContextualFeedbackSeverity::WARNING); | ||
$statusOk = new Status(ContextualFeedbackSeverity::OK); | ||
$statusError = new Status(ContextualFeedbackSeverity::ERROR); | ||
|
||
?> |
34 changes: 34 additions & 0 deletions
34
...eSeveritiesFlashMessageAndReportsRector/ReplaceSeveritiesFlashMessageAndReportsRector.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
|
||
namespace Ssch\TYPO3Rector\Tests\Rector\v12\v0\typo3\ReplaceSeveritiesFlashMessageAndReportsRector; | ||
|
||
|
||
use Iterator; | ||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | ||
use Symplify\SmartFileSystem\SmartFileInfo; | ||
|
||
final class ReplaceSeveritiesFlashMessageAndReportsRector extends AbstractRectorTestCase | ||
{ | ||
/** | ||
* @dataProvider provideData() | ||
*/ | ||
public function test(SmartFileInfo $fileInfo): void | ||
{ | ||
$this->doTestFileInfo($fileInfo); | ||
} | ||
|
||
/** | ||
* @return Iterator<SmartFileInfo> | ||
*/ | ||
public function provideData(): Iterator | ||
{ | ||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); | ||
} | ||
|
||
public function provideConfigFilePath(): string | ||
{ | ||
return __DIR__ . '/config/configured_rule.php'; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...tor/v12/v0/typo3/ReplaceSeveritiesFlashMessageAndReportsRector/config/configured_rule.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
|
||
use Ssch\TYPO3Rector\Rector\v12\v0\typo3\ReplaceExpressionBuilderMethodsRector; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->import(__DIR__ . '/../../../../../../../config/config_test.php'); | ||
$rectorConfig->import(__DIR__ . '/../../../../../../../config/v12/typo3-120.php'); | ||
}; |