Skip to content
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

Bleeding edge - More precise flock() operation flags #2477

Merged
merged 2 commits into from
Jun 22, 2023

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Jun 22, 2023

No description provided.

@staabm staabm changed the base branch from 1.11.x to 1.10.x June 22, 2023 12:06
@phpstan-bot
Copy link
Collaborator

You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x.


class flock {
/** @param resource $fp */
public function ok($fp):void {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -108,6 +108,7 @@
'max' => ['', '...arg1'=>'non-empty-array'],
'min' => ['', '...arg1'=>'non-empty-array'],
'file' => ['list<string>|false', 'filename'=>'string', 'flags='=>'0|FILE_USE_INCLUDE_PATH|FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES', 'context='=>'resource'],
'flock' => ['bool', 'fp'=>'resource', 'operation'=>'int-mask<1, 2, 4>', '&w_wouldblock='=>'int'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

semantically we can be more precise if we want. as not all combinations of the constants are allowed.
0 is not allowed.
combinations of e.g. LOCK_EX and LOCK_SH are not valid

not sure its worth it though

Copy link
Member

Choose a reason for hiding this comment

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

Can you use the constants instead of numbers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it seems we do not yet support constants in int-mask:

https://phpstan.org/r/1a8e768d-0fd3-4390-8041-4f10ff639c0b

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@clxmstaab clxmstaab force-pushed the flock branch 2 times, most recently from bc4eed5 to 2316434 Compare June 22, 2023 14:10
@ondrejmirtes ondrejmirtes merged commit 88e5898 into phpstan:1.10.x Jun 22, 2023
@ondrejmirtes
Copy link
Member

Thank you.

@staabm staabm deleted the flock branch June 22, 2023 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants