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

Enable phan and phpstan #28

Merged
merged 4 commits into from Jun 16, 2023
Merged

Enable phan and phpstan #28

merged 4 commits into from Jun 16, 2023

Conversation

phil-davis
Copy link
Contributor

No description provided.

@phil-davis phil-davis self-assigned this Jun 16, 2023
Comment on lines +69 to +70
['a8', decoct((int) str_pad($this->uid, 7, '0', STR_PAD_LEFT))],
['a8', decoct((int) str_pad($this->gid, 7, '0', STR_PAD_LEFT))],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

phan correctly complains that an decoct must be passed an int

* @return string unsigned checksum
* @return float|int unsigned checksum
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function does actually return a number (usually an int, but if the number is big, then it could end up being a float.

@@ -149,7 +149,7 @@ public function finalize() {
* Initialize a file stream
*
* @param string $name file path or just name
* @param int $type type of the item
* @param int|string $type type of the item
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some code passes an int "magic number", other code passes a single char like "x"

* @link http://www.freebsd.org/cgi/man.cgi?query=tar&sektion=5&manpath=FreeBSD+8-current tar / PAX spec
*/
protected function paxGenerate($fields) {
$lines = '';
foreach ($fields as $name => $value) {
// build the line and the size
$line = ' ' . $name . '=' . $value . "\n";
$size = \strlen(\strlen($line)) + \strlen($line);
$size = \strlen((string) \strlen($line)) + \strlen($line);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

strlen needs to be passed a string - added an explicit cast otherwise phan complains.

@phil-davis
Copy link
Contributor Author

https://drone.owncloud.com/owncloud/TarStreamer/23/3/3
phan runs in CI and passes.

@phil-davis phil-davis changed the title Enable phan Enable phan and phpstan Jun 16, 2023
@DeepDiver1975 DeepDiver1975 merged commit 163052d into master Jun 16, 2023
1 check passed
@delete-merged-branch delete-merged-branch bot deleted the enable-phan branch June 16, 2023 08:01
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.

None yet

2 participants