Skip to content

Commit

Permalink
fix PHPStan extends unknown class ckeditor
Browse files Browse the repository at this point in the history
  • Loading branch information
WengerK committed May 17, 2024
1 parent e5f8f65 commit b5becae
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ variables:
# Opt in to testing previous & next minor (Drupal 10.0.x and 10.2.x).
OPT_IN_TEST_PREVIOUS_MINOR: '1'
OPT_IN_TEST_NEXT_MINOR: '1'
# The 4.x branch of the CDN module requires PHP >=8.1, rather than core's >=7.4.
# The 3.x branch of the NBSP module requires Drupal 10.x minimum.
CORE_PREVIOUS_PHP_MIN: '8.1'
# Opt in to testing $CORE_MAJOR_DEVELOPMENT (currently Drupal 11).
OPT_IN_TEST_NEXT_MAJOR: '1'
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- fix tests on Drupal 10.2+ using HTML5 filter
- fix issue #3432756: Splitting the links in two
- fix PHPStan extends unknown class ckeditor

### Removed
- removed translation-files - Issue #3365383
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "drupal/nbsp",
"description": "Minimal module to insert a non-breaking space ( ) into the content by pressing Ctrl+Space or using the provided button.",
"type": "drupal-module",
"homepage": "https://www.drupal.org/sandbox/wengerk/nbsp",
"homepage": "https://www.drupal.org/project/nbsp",
"authors": [
{
"name": "Antistatique",
Expand Down
9 changes: 9 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
includes:
- phar://phpstan.phar/conf/bleedingEdge.neon

parameters:
level: 1
reportUnmatchedIgnoredErrors: false
ignoreErrors:
# new static() is a best practice in Drupal, so we cannot fix that.
- "#^Unsafe usage of new static#"
12 changes: 4 additions & 8 deletions src/Plugin/Filter/NbspCleanerFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,12 @@ protected function swapNbspHtml($text) {
$xpath = new \DOMXPath($document);

foreach ($xpath->query('//span[@class="nbsp"]') as $node) {
if (!empty($node)) {
// PHP DOM replacing the nbsp-span with nbsp character.
$node->parentNode->replaceChild(new \DOMText(self::UTF_8_NBSP), $node);
}
// PHP DOM replacing the nbsp-span with nbsp character.
$node->parentNode->replaceChild(new \DOMText(self::UTF_8_NBSP), $node);
}
foreach ($xpath->query('//nbsp') as $node) {
if (!empty($node)) {
// PHP DOM replacing the nbsp-tag with nbsp character.
$node->parentNode->replaceChild(new \DOMText(self::UTF_8_NBSP), $node);
}
// PHP DOM replacing the nbsp-tag with nbsp character.
$node->parentNode->replaceChild(new \DOMText(self::UTF_8_NBSP), $node);
}
return Html::serialize($document);

Expand Down

0 comments on commit b5becae

Please sign in to comment.