Skip to content

Commit

Permalink
Merge ce87d9e into 27ee016
Browse files Browse the repository at this point in the history
  • Loading branch information
moufmouf committed Oct 30, 2018
2 parents 27ee016 + ce87d9e commit f526b9a
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 3 deletions.
20 changes: 20 additions & 0 deletions generated/filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,26 @@ function fileowner(string $filename): int
}


/**
* Gets the size for the given file.
*
* @param string $filename Path to the file.
* @return int Returns the size of the file in bytes, or FALSE (and generates an error
* of level E_WARNING) in case of an error.
* @throws FilesystemException
*
*/
function filesize(string $filename): int
{
error_clear_last();
$result = \filesize($filename);
if ($result === false) {
throw FilesystemException::createFromPhpError();
}
return $result;
}


/**
* flock allows you to perform a simple reader/writer
* model which can be used on virtually every platform (including most Unix
Expand Down
1 change: 1 addition & 0 deletions generated/functionsList.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
'fileinode',
'filemtime',
'fileowner',
'filesize',
'flock',
'fopen',
'fputcsv',
Expand Down
6 changes: 3 additions & 3 deletions generated/pcre.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ function preg_match_all(string $pattern, string $subject, array &$matches = null
*
*
* If this flag is passed, for every occurring match the appendant string
* offset will also be returned. Note that this changes the value of
* offset (in bytes) will also be returned. Note that this changes the value of
* matches into an array where every element is an
* array consisting of the matched string at offset 0
* and its string offset into subject at offset
Expand Down Expand Up @@ -461,7 +461,7 @@ function preg_match_all(string $pattern, string $subject, array &$matches = null
*
*
* If this flag is passed, for every occurring match the appendant string
* offset will also be returned. Note that this changes the value of
* offset (in bytes) will also be returned. Note that this changes the value of
* matches into an array where every element is an
* array consisting of the matched string at offset 0
* and its string offset into subject at offset
Expand Down Expand Up @@ -538,7 +538,7 @@ function preg_match_all(string $pattern, string $subject, array &$matches = null
*
* The above example will output:
* @param int $offset If this flag is passed, for every occurring match the appendant string
* offset will also be returned. Note that this changes the value of
* offset (in bytes) will also be returned. Note that this changes the value of
* matches into an array where every element is an
* array consisting of the matched string at offset 0
* and its string offset into subject at offset
Expand Down
3 changes: 3 additions & 0 deletions generator/src/DocPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public function detectFalsyFunction(): bool
if (preg_match('/&date.datetime.return.modifiedobjectorfalseforfailure;/m', $file)) {
return true;
}
if (preg_match('/ or &false; \\(and generates an error/m', $file)) {
return true;
}

return false;
}
Expand Down
2 changes: 2 additions & 0 deletions generator/tests/DocPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ public function testDetectFalsyFunction() {
$implode = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/strings/functions/implode.xml');
$getCwd = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/dir/functions/getcwd.xml');
$setTime = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/datetime/datetime/settime.xml');
$filesize = new DocPage(__DIR__ . '/../doc/doc-en/en/reference/filesystem/functions/filesize.xml');

$this->assertTrue($pregMatch->detectFalsyFunction());
$this->assertFalse($implode->detectFalsyFunction());
$this->assertTrue($getCwd->detectFalsyFunction());
$this->assertTrue($setTime->detectFalsyFunction());
$this->assertTrue($filesize->detectFalsyFunction());
}
}
1 change: 1 addition & 0 deletions rector-migrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ services:
fileinode: 'Safe\fileinode'
filemtime: 'Safe\filemtime'
fileowner: 'Safe\fileowner'
filesize: 'Safe\filesize'
flock: 'Safe\flock'
fopen: 'Safe\fopen'
fputcsv: 'Safe\fputcsv'
Expand Down

0 comments on commit f526b9a

Please sign in to comment.