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

run 'mkdir' only if the directory doesn't exist yet #481

Merged
merged 3 commits into from
Jun 17, 2022

Conversation

fgaroby
Copy link

@fgaroby fgaroby commented Jun 16, 2022

What is the reason for this PR?

  • A new feature
  • Fixed an issue (resolve #ID)

Author's checklist

Summary of changes

When we run the make cs command twice, this error occurs:

In .php-cs-fixer.dist.php line 16:
                        
  [ErrorException]      
  mkdir(): File exists  
                        

Exception trace:
  at /home/fgaroby/workspace/Faker/.php-cs-fixer.dist.php:16
 {closure}() at n/a:n/a
 mkdir() at /home/fgaroby/workspace/Faker/.php-cs-fixer.dist.php:16
 include() at /home/fgaroby/workspace/Faker/vendor-bin/php-cs-fixer/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:946
 PhpCsFixer\Console\ConfigurationResolver::separatedContextLessInclude() at /home/fgaroby/workspace/Faker/vendor-bin/php-cs-fixer/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:267
 PhpCsFixer\Console\ConfigurationResolver->getConfig() at /home/fgaroby/workspace/Faker/vendor-bin/php-cs-fixer/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:598
 PhpCsFixer\Console\ConfigurationResolver->getFormat() at /home/fgaroby/workspace/Faker/vendor-bin/php-cs-fixer/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:444
 PhpCsFixer\Console\ConfigurationResolver->getReporter() at /home/fgaroby/workspace/Faker/vendor-bin/php-cs-fixer/vendor/friendsofphp/php-cs-fixer/src/Console/Command/FixCommand.php:261
 PhpCsFixer\Console\Command\FixCommand->execute() at /home/fgaroby/workspace/Faker/vendor-bin/php-cs-fixer/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /home/fgaroby/workspace/Faker/vendor-bin/php-cs-fixer/vendor/symfony/console/Application.php:1009
 Symfony\Component\Console\Application->doRunCommand() at /home/fgaroby/workspace/Faker/vendor-bin/php-cs-fixer/vendor/symfony/console/Application.php:273
 Symfony\Component\Console\Application->doRun() at /home/fgaroby/workspace/Faker/vendor-bin/php-cs-fixer/vendor/friendsofphp/php-cs-fixer/src/Console/Application.php:97
 PhpCsFixer\Console\Application->doRun() at /home/fgaroby/workspace/Faker/vendor-bin/php-cs-fixer/vendor/symfony/console/Application.php:149
 Symfony\Component\Console\Application->run() at /home/fgaroby/workspace/Faker/vendor-bin/php-cs-fixer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer:115

fix [--path-mode PATH-MODE] [--allow-risky ALLOW-RISKY] [--config CONFIG] [--dry-run] [--rules RULES] [--using-cache USING-CACHE] [--cache-file CACHE-FILE] [--diff] [--format FORMAT] [--stop-on-violation] [--show-progress SHOW-PROGRESS] [--] [<path>...]

make: *** [Makefile:13 : cs] Error 1

This PR checks if the directory doesn't exit yet.

Review checklist

  • All checks have passed
  • Changes are approved by maintainer

@bram-pkg
Copy link
Member

Please put a space after the exclamation mark, and perhaps use is_dir() instead.

Also, if statements should always contain brackets.

@bram-pkg
Copy link
Member

Thanks!

@bram-pkg bram-pkg merged commit d389c7e into FakerPHP:main Jun 17, 2022
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