Skip to content

Commit

Permalink
Fixing strpos deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
philipsorst committed Jan 21, 2022
1 parent 96fe809 commit 6e0b6d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
errorLevel="3"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
Expand Down
14 changes: 8 additions & 6 deletions src/DirectoryPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ class DirectoryPath extends AbstractPath
*/
public function __construct(string $name = null)
{
if (strpos($name, '/') !== false) {
throw new Exception('Name must not contain /');
}
if (null !== $name) {
if (strpos($name, '/') !== false) {
throw new Exception('Name must not contain /');
}

if (!empty($name)) {
$this->name = $name;
$this->parentPath = new DirectoryPath();
if ('' !== $name) {
$this->name = $name;
$this->parentPath = new DirectoryPath();
}
}
}

Expand Down

0 comments on commit 6e0b6d8

Please sign in to comment.