-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix: phpstan error for string('column', 'MAX') #223
Conversation
WalkthroughThis update addresses a PHPStan error in Laravel's Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- phpstan.neon (1 hunks)
- src/Schema/Blueprint.php (1 hunks)
Additional context used
PHPStan
src/Schema/Blueprint.php
null-null: Ignored error pattern #^Parameter #2
$length of method Illuminate\Database\Schema\Blueprint::string() expects int|null, int|string|null given.$ # in path /cache/2fbe041f-7aa3-42f4-a367-b788a437ba76/home/jailuser/git/src/Schema/Blueprint.php was not matched in reported errors. (ignore.unmatched)
30-30: Class Colopl\Spanner\Schema\Blueprint extends unknown class Illuminate\Database\Schema\Blueprint. (class.notFound)
Learn more at https://phpstan.org/user-guide/discovering-symbols
38-38: Method Colopl\Spanner\Schema\Blueprint::bigInteger() has parameter $autoIncrement with no type specified. (missingType.parameter)
38-38: Method Colopl\Spanner\Schema\Blueprint::bigInteger() has parameter $column with no type specified. (missingType.parameter)
38-38: Method Colopl\Spanner\Schema\Blueprint::bigInteger() has parameter $unsigned with no type specified. (missingType.parameter)
41-41: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addColumnDefinition(). (method.notFound)
49-49: Method Colopl\Spanner\Schema\Blueprint::integer() has parameter $autoIncrement with no type specified. (missingType.parameter)
49-49: Method Colopl\Spanner\Schema\Blueprint::integer() has parameter $column with no type specified. (missingType.parameter)
49-49: Method Colopl\Spanner\Schema\Blueprint::integer() has parameter $unsigned with no type specified. (missingType.parameter)
67-67: Method Colopl\Spanner\Schema\Blueprint::dropPrimary() has parameter $index with no type specified. (missingType.parameter)
75-75: Method Colopl\Spanner\Schema\Blueprint::increments() has no return type specified. (missingType.return)
75-75: Method Colopl\Spanner\Schema\Blueprint::increments() has parameter $column with no type specified. (missingType.parameter)
77-77: Call to an undefined method Colopl\Spanner\Schema\UuidColumnDefinition::primary(). (method.notFound)
85-85: Method Colopl\Spanner\Schema\Blueprint::bigIncrements() has no return type specified. (missingType.return)
85-85: Method Colopl\Spanner\Schema\Blueprint::bigIncrements() has parameter $column with no type specified. (missingType.parameter)
93-93: Method Colopl\Spanner\Schema\Blueprint::mediumIncrements() has no return type specified. (missingType.return)
93-93: Method Colopl\Spanner\Schema\Blueprint::mediumIncrements() has parameter $column with no type specified. (missingType.parameter)
101-101: Method Colopl\Spanner\Schema\Blueprint::smallIncrements() has no return type specified. (missingType.return)
101-101: Method Colopl\Spanner\Schema\Blueprint::smallIncrements() has parameter $column with no type specified. (missingType.parameter)
109-109: Method Colopl\Spanner\Schema\Blueprint::tinyIncrements() has no return type specified. (missingType.return)
109-109: Method Colopl\Spanner\Schema\Blueprint::tinyIncrements() has parameter $column with no type specified. (missingType.parameter)
118-118: Method Colopl\Spanner\Schema\Blueprint::string() has no return type specified. (missingType.return)
118-118: Method Colopl\Spanner\Schema\Blueprint::string() has parameter $column with no type specified. (missingType.parameter)
120-120: Colopl\Spanner\Schema\Blueprint::string() calls parent::string() but Colopl\Spanner\Schema\Blueprint does not extend any class. (class.noParent)
127-127: Method Colopl\Spanner\Schema\Blueprint::uuid() has parameter $column with no type specified. (missingType.parameter)
129-129: Class Colopl\Spanner\Schema\UuidColumnDefinition does not have a constructor and must be instantiated without any parameters. (new.noConstructor)
130-130: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addColumnDefinition(). (method.notFound)
140-140: Method Colopl\Spanner\Schema\Blueprint::binary() has invalid return type Illuminate\Database\Schema\ColumnDefinition. (class.notFound)
144-144: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addColumn(). (method.notFound)
153-153: Method Colopl\Spanner\Schema\Blueprint::decimal() has invalid return type Illuminate\Database\Schema\ColumnDefinition. (class.notFound)
163-163: Colopl\Spanner\Schema\Blueprint::decimal() calls parent::decimal() but Colopl\Spanner\Schema\Blueprint does not extend any class. (class.noParent)
170-170: Method Colopl\Spanner\Schema\Blueprint::booleanArray() has invalid return type Illuminate\Database\Schema\ColumnDefinition. (class.notFound)
172-172: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addColumn(). (method.notFound)
181-181: Method Colopl\Spanner\Schema\Blueprint::integerArray() has invalid return type Illuminate\Database\Schema\ColumnDefinition. (class.notFound)
183-183: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addColumn(). (method.notFound)
192-192: Method Colopl\Spanner\Schema\Blueprint::floatArray() has invalid return type Illuminate\Database\Schema\ColumnDefinition. (class.notFound)
194-194: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addColumn(). (method.notFound)
203-203: Method Colopl\Spanner\Schema\Blueprint::decimalArray() has invalid return type Illuminate\Database\Schema\ColumnDefinition. (class.notFound)
205-205: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addColumn(). (method.notFound)
215-215: Method Colopl\Spanner\Schema\Blueprint::stringArray() has invalid return type Illuminate\Database\Schema\ColumnDefinition. (class.notFound)
217-217: Access to an undefined static property Colopl\Spanner\Schema\Builder::$defaultStringLength. (staticProperty.notFound)
219-219: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addColumn(). (method.notFound)
229-229: Method Colopl\Spanner\Schema\Blueprint::dateArray() has invalid return type Illuminate\Database\Schema\ColumnDefinition. (class.notFound)
231-231: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addColumn(). (method.notFound)
240-240: Method Colopl\Spanner\Schema\Blueprint::timestampArray() has invalid return type Illuminate\Database\Schema\ColumnDefinition. (class.notFound)
242-242: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addColumn(). (method.notFound)
263-263: Class Colopl\Spanner\Schema\InterleaveDefinition does not have a constructor and must be instantiated without any parameters. (new.noConstructor)
264-264: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addCommand(). (method.notFound)
267-267: Access to an undefined property Colopl\Spanner\Schema\Blueprint::$commands. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
267-267: Access to an undefined property Colopl\Spanner\Schema\Blueprint::$commands. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
278-278: Method Colopl\Spanner\Schema\Blueprint::deleteRowsOlderThan() has invalid return type Illuminate\Support\Fluent. (class.notFound)
280-280: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addCommand(). (method.notFound)
292-292: Method Colopl\Spanner\Schema\Blueprint::addRowDeletionPolicy() has invalid return type Illuminate\Support\Fluent. (class.notFound)
292-292: Method Colopl\Spanner\Schema\Blueprint::addRowDeletionPolicy() has invalid return type Illuminate\Support\Fluent. (class.notFound)
294-294: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addCommand(). (method.notFound)
306-306: Method Colopl\Spanner\Schema\Blueprint::replaceRowDeletionPolicy() has invalid return type Illuminate\Support\Fluent. (class.notFound)
306-306: Method Colopl\Spanner\Schema\Blueprint::replaceRowDeletionPolicy() has invalid return type Illuminate\Support\Fluent. (class.notFound)
308-308: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addCommand(). (method.notFound)
318-318: Method Colopl\Spanner\Schema\Blueprint::dropRowDeletionPolicy() has invalid return type Illuminate\Support\Fluent. (class.notFound)
318-318: Method Colopl\Spanner\Schema\Blueprint::dropRowDeletionPolicy() has invalid return type Illuminate\Support\Fluent. (class.notFound)
320-320: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addCommand(). (method.notFound)
329-329: Access to an undefined property Colopl\Spanner\Schema\Blueprint::$commands. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
339-339: Access to an undefined property Colopl\Spanner\Schema\Blueprint::$commands. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
349-349: Access to an undefined property Colopl\Spanner\Schema\Blueprint::$commands. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
357-357: Method Colopl\Spanner\Schema\Blueprint::dropSequence() has invalid return type Illuminate\Support\Fluent. (class.notFound)
357-357: Method Colopl\Spanner\Schema\Blueprint::dropSequence() has invalid return type Illuminate\Support\Fluent. (class.notFound)
359-359: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addCommand(). (method.notFound)
366-366: Method Colopl\Spanner\Schema\Blueprint::dropSequenceIfExists() has invalid return type Illuminate\Support\Fluent. (class.notFound)
366-366: Method Colopl\Spanner\Schema\Blueprint::dropSequenceIfExists() has invalid return type Illuminate\Support\Fluent. (class.notFound)
368-368: Call to an undefined method Colopl\Spanner\Schema\Blueprint::addCommand(). (method.notFound)
385-385: Call to an undefined method Colopl\Spanner\Schema\Blueprint::createIndexName(). (method.notFound)
387-387: Access to an undefined property Colopl\Spanner\Schema\Blueprint::$commands. (property.notFound)
Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
387-387: Class Colopl\Spanner\Schema\IndexDefinition does not have a constructor and must be instantiated without any parameters. (new.noConstructor)
Additional comments not posted (2)
phpstan.neon (1)
48-50
: Adjust PHPStan configuration to ignore a specific error.The added configuration line is meant to ignore a PHPStan error related to the type mismatch in the
Blueprint::string()
method, which now acceptsint|string|null
for the$length
parameter. This is a direct response to the changes made in theBlueprint
class to support a broader range of inputs.src/Schema/Blueprint.php (1)
114-121
: Updated method signature to support 'max' as a valid length.The
string()
method has been updated to acceptint
,'max'
, ornull
for the$length
parameter. This change aligns with the requirements of Cloud Spanner for supportingSTRING(MAX)
column definitions in migrations, addressing the PHPStan issue raised in the linked GitHub issue.Tools
PHPStan
118-118: Method Colopl\Spanner\Schema\Blueprint::string() has no return type specified. (missingType.return)
118-118: Method Colopl\Spanner\Schema\Blueprint::string() has parameter $column with no type specified. (missingType.parameter)
120-120: Colopl\Spanner\Schema\Blueprint::string() calls parent::string() but Colopl\Spanner\Schema\Blueprint does not extend any class. (class.noParent)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- CHANGELOG.md (1 hunks)
Additional context used
LanguageTool
CHANGELOG.md
[duplication] ~87-~87: Possible typo: you repeated a word (ENGLISH_WORD_REPEAT_RULE)
Context: ...an error (#169) # v6.1.2 (2024-01-16) Fixed - Fixed an error when rolling back a transactio...
[uncategorized] ~89-~89: Possible missing preposition found. (AI_HYDRA_LEO_MISSING_TO)
Context: ...back a transaction that did not execute begin (#166) # v6.1.1 (2023-12-11) Fixed - ...
[grammar] ~97-~97: You’ve repeated a verb. Did you mean to only write one of them? (REPEATED_VERBS)
Context: ...ondition (#152) # v6.1.0 (2023-11-29) Added - Add support for [NUMERIC](https://cloud.goo...
[grammar] ~105-~105: You’ve repeated a verb. Did you mean to only write one of them? (REPEATED_VERBS)
Context: ...10.34.0. (#150) # v6.0.0 (2023-11-22) Added - Add [Data Boost](https://cloud.google.com/s...
[uncategorized] ~109-~109: When ‘spanner-specific’ is used as a modifier, it is usually spelled with a hyphen. (SPECIFIC_HYPHEN)
Context: ...tionscursorWithOptions` which allows spanner specific options to be set for each query. (#122...
[style] ~121-~121: Style-wise, it’s not ideal to insert an adverb (‘correctly’) in the middle of an infinitive construction (‘to run’). Try moving the adverb to avoid split infinitives. (SPLIT_INFINITIVE)
Context: ...- Explicitly stage/clear transaction on commit to correctly run afterCommit jobs in Laravel >= [v10.32.0](https://github...
[duplication] ~124-~124: Possible typo: you repeated a word (ENGLISH_WORD_REPEAT_RULE)
Context: ...l/48859) (#144) # v5.2.2 (2023-08-22) Fixed - Fixed a case where queries were not being ret...
[duplication] ~134-~134: Possible typo: you repeated a word (ENGLISH_WORD_REPEAT_RULE)
Context: ...ry/Builder::toRawSql(#127) # v5.2.0 Added - Added deprecation warnings to
Connection::ru...
[duplication] ~153-~153: Possible typo: you repeated a word (ENGLISH_WORD_REPEAT_RULE)
Context: ... ROW DELETION POLICY(#125) # v5.1.0 Added - Added
Connection::runDdlBatch` which runs DD...
[duplication] ~158-~158: Possible typo: you repeated a word (ENGLISH_WORD_REPEAT_RULE)
Context: ...oublefor better compatibility. (#97) Fixed - Fixed bug where running
Connection::statemen...
[uncategorized] ~165-~165: Use a comma before ‘so’ if it connects two independent clauses (unless they are closely connected and short). (COMMA_COMPOUND_SENTENCE_2)
Context: ...n pool and authentication per connection so transaction works properly. (#89) - Ses...
[uncategorized] ~186-~186: Possible missing preposition found. (AI_HYDRA_LEO_MISSING_IT)
Context: ...rowBadMethodCallException
if called. Was ignored in previous versions. (#76) - [...
[uncategorized] ~191-~191: The preposition ‘for’ seems more likely in this position. (AI_HYDRA_LEO_REPLACE_TO_FOR)
Context: ...- Rollback handling has been refactored to better readability. (#79) # v4.7.0 Ad...
Markdownlint
CHANGELOG.md
6-6: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
11-11: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
16-16: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
26-26: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
41-41: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
46-46: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
56-56: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
86-86: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
91-91: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
96-96: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
104-104: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
118-118: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
123-123: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
128-128: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
133-133: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
152-152: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
168-168: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
193-193: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
204-204: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
210-210: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
218-218: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
232-232: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
250-250: null (MD025, single-title, single-h1)
Multiple top-level headings in the same document
4-4: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
9-9: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
14-14: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
19-19: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
24-24: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
29-29: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
44-44: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
49-49: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
54-54: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
59-59: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
72-72: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
83-83: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
89-89: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
94-94: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
99-99: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
102-102: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
107-107: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
114-114: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
121-121: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
126-126: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
131-131: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
136-136: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
143-143: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
149-149: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
155-155: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
160-160: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
164-164: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
173-173: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
178-178: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
191-191: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
196-196: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
199-199: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
202-202: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
207-207: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
213-213: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
216-216: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
221-221: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
227-227: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
230-230: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
235-235: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
245-245: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
248-248: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
253-253: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
256-256: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
Additional comments not posted (1)
CHANGELOG.md (1)
3-4
: Approve the documentation of the phpstan error fix.The entry correctly documents the resolution of the phpstan error related to the
string('column', 'MAX')
usage, aligning with the PR's objective.Tools
Markdownlint
4-4: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
Instead of using stub, it may be better to use ignore. However, since this is a trivial matter, I will submit a separate PR for this later. |
Fix: #218
Checklist
Reference
Summary by CodeRabbit
string()
method of theBlueprint
class.updateOrInsert
in version 8.1.2 for enhanced compatibility.