- 🇩🇪Germany Grevil
I don't quite understand this issue. Do you mean "Analyse this module using PHPStan"? Since I don't think it needs to provide its own phpstan.neon.
- 🇨🇦Canada ambient.impact Toronto
Yup, that's what I meant. Feel free to rename it and amend the issue summary, as it's just a placeholder for now.
- Issue was unassigned.
- 🇩🇪Germany Anybody Porta Westfalica
No work has been done here by @Ambient.Impact so removing the assignment.
@Grevil: Would you like to do this and provide a MR?
- Assigned to Grevil
- 🇩🇪Germany Grevil
Here is the PHPStan output:
14/14 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100% ------ -------------------------------------------------------------------------------------- Line modules/pwa_extras/pwa_extras.module ------ -------------------------------------------------------------------------------------- 32 Access to an undefined property DOMNode::$tagName. 💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property 53 Function pwa_extras_apple_touch_icons invoked with 1 parameter, 0 required. ------ -------------------------------------------------------------------------------------- ------ -------------------------------------------------------------------------------------------------------------------------------------- Line modules/pwa_extras/src/Form/PwaExtrasSettingsForm.php ------ -------------------------------------------------------------------------------------------------------------------------------------- 37 Function pwa_extras_apple_touch_icons invoked with 1 parameter, 0 required. 114 Method Drupal\pwa_extras\Form\PwaExtrasSettingsForm::getEditableConfigNames() has invalid return type Drupal\pwa_extras\Form\config. ------ -------------------------------------------------------------------------------------------------------------------------------------- ------ ----------------------------------------------------------------------------------------------------------------- Line src/Controller/PWAController.php ------ ----------------------------------------------------------------------------------------------------------------- 200 Variable $data in empty() always exists and is not falsy. 222 Regex pattern is invalid: The /e modifier is no longer supported, use preg_replace_callback instead in pattern: #(/(\S*?\.\S*?))(\s|\;|\)|\]|\[|\{|\}|,|"|'|:|<|$|\.\s)#ie ------ ----------------------------------------------------------------------------------------------------------------- ------ ----------------------------------------------------------------------------------------- Line src/Form/ManifestConfigurationForm.php ------ ----------------------------------------------------------------------------------------- 405 Cannot call method basePath() on bool|Drupal\Core\StreamWrapper\StreamWrapperInterface. ------ ----------------------------------------------------------------------------------------- -- ---------------------------------------------------------------------------------------------------------------------------------- Error -- ---------------------------------------------------------------------------------------------------------------------------------- Ignored error pattern #^Plugin definitions cannot be altered.# was not matched in reported errors. Ignored error pattern #^Missing cache backend declaration for performance.# was not matched in reported errors. Ignored error pattern #cache tag might be unclear and does not contain the cache key in it.# was not matched in reported errors. Ignored error pattern #^Class .* extends @internal class# was not matched in reported errors. -- ---------------------------------------------------------------------------------------------------------------------------------- [ERROR] Found 11 errors Failed to run phpstan.sh /var/www/html/web/modules/custom/pwa-3268062: exit status 1
- Status changed to Needs work
over 1 year ago 10:43am 19 June 2023 - 🇩🇪Germany Grevil
Fixed a few PHPStan issues. These are the remaining problems:
------ -------------------------------------------------------------------------------------- Line modules/pwa_extras/pwa_extras.module ------ -------------------------------------------------------------------------------------- 32 Access to an undefined property DOMNode::$tagName. 💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property ------ -------------------------------------------------------------------------------------- ------ ----------------------------------------------------------------------------------------------------------------- Line src/Controller/PWAController.php ------ ----------------------------------------------------------------------------------------------------------------- 222 Regex pattern is invalid: The /e modifier is no longer supported, use preg_replace_callback instead in pattern: #(/(\S*?\.\S*?))(\s|\;|\)|\]|\[|\{|\}|,|"|'|:|<|$|\.\s)#ie ------ ----------------------------------------------------------------------------------------------------------------- ------ ----------------------------------------------------------------------------------------- Line src/Form/ManifestConfigurationForm.php ------ ----------------------------------------------------------------------------------------- 405 Cannot call method basePath() on bool|Drupal\Core\StreamWrapper\StreamWrapperInterface. ------ -----------------------------------------------------------------------------------------
But they are not so easy to fix.
Access to an undefined property DOMNode::$tagName
I think this one is ignorable, as we hopefully made sure, that tagName is 100% defined at this point of code.Regex pattern is invalid
This is quite unclear, as it recommends using "preg_replace_callback", but simply removing the "e" from "#ie" should already do the trick? If we used "preg_replace_callback", what would the callback function hold? Simply escaping the same characters "e" did before?When using the deprecated e modifier, this function escapes some characters (namely ', ", \ and NULL) in the strings that replace the backreferences
This is unclear.
Cannot call method basePath() on bool|Drupal\Core\StreamWrapper\StreamWrapperInterface.
This is also unclear.// Save new image. $wrapper = $this->streamWrapperManager->getViaScheme( $this->config('system.file')->get('default_scheme') );
$wrapper could be "FALSE" if no registered handler could be found. Should we throw an error, if it is false? Should we simply log the message and exit the submitForm there?
Also unclear. - last update
over 1 year ago 1 pass - @grevil opened merge request.
- Status changed to Needs review
over 1 year ago 2:12pm 26 July 2023 - 🇩🇪Germany Grevil
I created a follow-up issue concerning the regex, see 🐛 [META][pwa_service_worker] Refactor 'pwa_service_worker' implementations and flaws Needs work .
The other fixes can be reviewed now!
- Issue was unassigned.
- Status changed to Needs work
over 1 year ago 2:36pm 26 July 2023 - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass - Status changed to Needs review
over 1 year ago 10:35am 9 August 2023 - Status changed to RTBC
over 1 year ago 10:41am 9 August 2023 - last update
over 1 year ago 1 pass - last update
over 1 year ago 1 pass - Status changed to Fixed
over 1 year ago 10:42am 9 August 2023 Automatically closed - issue fixed for 2 weeks with no activity.