Comments (5)
Thanks for reporting, @marcelloh .
False-positive is confirmed, I will ping you when it fixed.
from phpinspectionsea.
@kalessil I have false-positive for following code:
public function makeDir($path, $chmod = 0777)
{
return is_dir($path) || @mkdir($path, $chmod, true) || is_dir($path);
}
PS. And there is a conflict with "This condition is duplicated in other if/elseif branch" for similar code:
if (!is_dir($destDir) && !@mkdir($destDir, 0755, true) && !is_dir($destDir)) {
trigger_error("Cannot create directory $destDir");
}
from phpinspectionsea.
somehow when the order is the "adviced order"
if (!@mkdir($dir, 0777, true) and !is_dir($dir))
it still throws a warning or error or something: mkdir(): File exists
But when I change the order into:
if (!is_dir($dir) and !@mkdir($dir, 0777, true))
all is well, without any warning
from phpinspectionsea.
@dryabov Why you are using !is_dir
before mkdir
?
mkdir is always executed because you are using &&
operator . So there is no point to check is_dir
twice.
from phpinspectionsea.
Fixed in 2.3.10, which I releasing today evening.
from phpinspectionsea.
Related Issues (20)
- com.intellij.diagnostic.PluginException: Short name 'CompactCanBeUsedInspection' is not unique
- Incorrect recommendation for `compact` for array unpacking statements
- Inspection suggests using assertFileDoesNotExists instead of assertFileDoesNotExist
- Enum compression with the value tryFrom is always seems to be false
- Project maintenance (or lack thereof) HOT 2
- False positive to add "symfony/var-dumper" to "dev packages"
- Wrong categories names
- Exception in 2023.3 HOT 1
- Substring comparison flaws with hex characters
- Incorrectly suggests using str_ends_with() when language level is below 8 HOT 1
- False-positive : "[EA] Could provoke a PHP Fatal error ([] operator not supported for strings)" in test
- Null-safe operator after array access
- False positive message to delete the method, as the parent method is identical
- Invalid null coalescing operator suggestion for a class consent on a nullable object variable HOT 1
- Undefined function 'mime_content_type' HOT 1
- Maintenance: final checking on bug-fixing and development constraints HOT 3
- Pattern seems to be not valid. HOT 2
- 'Unknown inspection: .' when adding @noinspection PhpUnused in PHPStorm HOT 3
- Crashes every time phpstorm starts HOT 7
- False positive: This statement seems to be disconnected from its parent foreach. HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpinspectionsea.