Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixed bugs found by psalm#40610

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:4.4fromNyholm:psalm-bugs
Apr 1, 2021
Merged

Conversation

@Nyholm
Copy link
Member

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
Tickets
LicenseMIT
Doc PR

When running psalm for branch 4.4, we get around 1500 errors. I browsed though them all and here is a small PR with the actual bugs I think should be fixed.

I'll make review comments about them below.

dmaicher reacted with thumbs up emoji
}

privatefunctionrenderException(OutputInterface$output,string$template,Error$exception,string$file =null)
privatefunctionrenderException(SymfonyStyle$output,string$template,Error$exception,string$file =null)
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is a minor. We pass aSymfonyStyle and we use the$object as aSymfonyStyle.

publicfunctionsetPriority(int$priority):self
{
$this->message->setPriority($priority);
$this->message->priority($priority);
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

There is no function calledsetPriority. However, theEmail::priority() exists.

Im not sure if I should renameWrappedTemplatedEmail::setPriority() topriority() too.

OskarStark reacted with thumbs up emoji

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

the class is internal, no need to care about renaming, it won't improve anything

publicfunctiongetETags()
{
returnpreg_split('/\s*,\s*/',$this->headers->get('if_none_match'),null, \PREG_SPLIT_NO_EMPTY);
returnpreg_split('/\s*,\s*/',$this->headers->get('if_none_match'),-1, \PREG_SPLIT_NO_EMPTY);
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

preg_split's third argument supportsnull in PHP 7. However, in PHP 8 it is required to be an int.

From PHPStorm's stubs:

If specified, then only substrings up tolimit are returned with the rest of the string being placed in the last substring. Alimit of -1, 0 orNULL means "no limit" and, as is standard across PHP, you can useNULL to skip to theflags parameter.

From the docs (PHP 8 ready):

If specified, then only substrings up to limit are returned with the rest of the string being placed in the last substring. A limit of -1 or 0 means "no limit".

$descriptor->describe($io,$data,$context,$clientId);
});

return0;
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Just a command that does not return an int.

OskarStark reacted with thumbs up emoji

if (!\is_array($properties =$value->__serialize())) {
thrownew \Typerror($class.'::__serialize() must return an array');
thrownew \TypeError($class.'::__serialize() must return an array');
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Typo

OskarStark reacted with thumbs up emoji

if (self::class ===$method->getDeclaringClass()->name && ($returnType =$method->getReturnType()) && !$returnType->isBuiltin()) {
$services[self::class.'::'.$method->name] ='?'.($returnTypeinstanceof \ReflectionNamedType ?$returnType->getName() :$type);
$services[self::class.'::'.$method->name] ='?'.($returnTypeinstanceof \ReflectionNamedType ?$returnType->getName() :$returnType);
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The variable$type is never defined in this class. I assume we mean$returnType.

* Sets a factory.
*
* @param string|array|Reference $factory A PHP function, reference or an array containing a class/Reference and a method to call
* @param string|array|Reference|null $factory A PHP function, reference or an array containing a class/Reference and a method to call
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is also a minor.

TheSessionPass is passing "null" as parameter to this method to reset the factory.


// Stream context created to allow files overwrite when using FTP stream wrapper - disabled by default
if (false ===$target = @fopen($targetFile,'w',null,stream_context_create(['ftp' => ['overwrite' =>true]]))) {
if (false ===$target = @fopen($targetFile,'w',false,stream_context_create(['ftp' => ['overwrite' =>true]]))) {
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Third parameter tofopen bust be a boolean. Default is `false´.

From the docs:

The optional third use_include_path parameter can be set to '1' or true if you want to search for the file in the include_path, too.

Please very this extra carefully.

@NyholmNyholm added the Ready labelMar 30, 2021
@nicolas-grekas
Copy link
Member

Thank you@Nyholm.

@nicolas-grekasnicolas-grekas merged commitf651ce6 intosymfony:4.4Apr 1, 2021
This was referencedMay 1, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@jderussejderussejderusse approved these changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

5 participants

@Nyholm@nicolas-grekas@jderusse@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp