- Merge request !3098Issue #3326359: Fix PHPStan L2 error "Binary operation "[something]" between Foo and Bar results in an error." β (Open) created by spokje
- πΊπΈUnited States smustgrave
Applied the patch locally
Change phpstan to level 2 and ran./core/scripts/dev/commit-code-check.sh > phpstan.txt
And found no instances of "Binary operation"
so looks good.
- Status changed to Needs work
almost 2 years ago 2:29pm 23 February 2023 - π¬π§United Kingdom longwave UK
A few comments/questions:
-
+++ b/core/lib/Drupal/Component/Uuid/Php.php @@ -32,6 +32,7 @@ public function generate() { + /** @var int $clock_seq_hi_and_reserved */ $clock_seq_hi_and_reserved = base_convert(substr($hex, 16, 2), 16, 10);
Why do we use @var here but casting in some other places?
-
+++ b/core/lib/Drupal/Core/Datetime/Element/DateElementBase.php @@ -40,7 +40,7 @@ protected static function datetimeRangeYears($string, $date = NULL) { - $min_year = $this_year + $matches[0]; + $min_year = $this_year . $matches[0];
I don't think this is correct. The comment says "Valid patterns would be -5:+5, 0:+1, 2008:2010" so if someone specifies "-5:+5" then they would expect addition (2023 + -5 = 2018) not concatenation (20235). I assume there is no test coverage for this!
-
+++ b/core/modules/file/file.module @@ -200,7 +200,7 @@ function file_validate_size(FileInterface $file, $file_limit = 0, $user_limit = + if ($user_limit && (\Drupal::entityTypeManager()->getStorage('file')->spaceUsed($user->id()) + (int) $file->getSize()) > $user_limit) {
Should we consider fixing this on the interface instead? Why does getSize() return the size as a string?
-
+++ b/core/modules/jsonapi/tests/src/Functional/EntryPointTest.php @@ -57,7 +57,9 @@ public function testEntryPoint() { + /** @var string $user_pass_raw */ + $user_pass_raw = $user->passRaw; +++ b/core/modules/system/tests/src/Functional/Menu/LinksetControllerTestBase.php @@ -72,7 +72,9 @@ abstract class LinksetControllerTestBase extends BrowserTestBase { + /** @var string $account_pass_raw */ + $account_pass_raw = $account->passRaw;
passRaw is a hack that is only used in tests, wonder if we should refactor it to be consistently defined somehow?
-
- last update
over 1 year ago 29,436 pass - Assigned to spokje
- Issue was unassigned.
- First commit to issue fork.
- πΊπΈUnited States smustgrave
Correct me if I'm wrong but #7.1 and #7.4 are still open?
- π³πΏNew Zealand quietone
Yes, I did forget to review the comments after updating the MR.
#7.1 and 2: Fixed
7.4: I think if that is to be done it is better in a separate issue. - πΊπΈUnited States smustgrave
Opened π Refactor passRaw Active for 7.4
Rest looks good.
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
One question in the MR