Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Craft 4 Support #19

Merged
merged 3 commits into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
}
],
"require": {
"craftcms/cms": "^3.0.0-beta.20"
"php": "^8.0",
"craftcms/cms": "^3.0.0-beta.20 || ^4.0.0"
},
"autoload": {
"psr-4": {
Expand All @@ -34,5 +35,10 @@
"handle": "code-mirror",
"changelogUrl": "https://raw.githubusercontent.com/luwes/craft3-codemirror/master/CHANGELOG.md",
"class": "luwes\\codemirror\\CodeMirror"
},
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"craftcms/rector": "dev-main"
}
}
2 changes: 1 addition & 1 deletion src/CodeMirror.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function (PluginEvent $event) {
// Protected Methods
// =========================================================================

protected function createSettingsModel()
protected function createSettingsModel(): ?\craft\base\Model
{
return new Settings();
}
Expand Down
12 changes: 6 additions & 6 deletions src/fields/CodeMirrorField.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static function displayName(): string
/**
* @inheritdoc
*/
public function rules()
public function rules(): array
{
$rules = parent::rules();
$rules = array_merge($rules, [
Expand All @@ -63,31 +63,31 @@ public function rules()
/**
* @inheritdoc
*/
public function getContentColumnType(): string
public function getContentColumnType(): array|string
{
return Schema::TYPE_TEXT;
}

/**
* @inheritdoc
*/
public function normalizeValue($value, ElementInterface $element = null)
public function normalizeValue(mixed $value, ?\craft\base\ElementInterface $element = null): mixed
{
return $value;
}

/**
* @inheritdoc
*/
public function serializeValue($value, ElementInterface $element = null)
public function serializeValue(mixed $value, ?\craft\base\ElementInterface $element = null): mixed
{
return parent::serializeValue($value, $element);
}

/**
* @inheritdoc
*/
public function getSettingsHtml()
public function getSettingsHtml(): ?string
{
$settings = CodeMirror::getInstance()->getSettings();
$modes = [];
Expand All @@ -114,7 +114,7 @@ public function getSettingsHtml()
/**
* @inheritdoc
*/
public function getInputHtml($value, ElementInterface $element = null): string
public function getInputHtml(mixed $value, ?\craft\base\ElementInterface $element = null): string
{
$am = Craft::$app->getAssetManager();
$view = Craft::$app->getView();
Expand Down