Skip to content

[5.4] Database Factory includes non-php files#18336

Merged
taylorotwell merged 2 commits intolaravel:5.4from
eyJhb:5.4
Mar 14, 2017
Merged

[5.4] Database Factory includes non-php files#18336
taylorotwell merged 2 commits intolaravel:5.4from
eyJhb:5.4

Conversation

@eyJhb
Copy link
Contributor

@eyJhb eyJhb commented Mar 14, 2017

When using a editor like emacs that creates eg. 'UserSeeder.php~' files, those files will get included as well as the correct 'UserSeeder.php' file.

This causes 'UserSeeder.php' to get overwritten with the 'UserSeeder.php~', which can cause a lot of confusion.

@eyJhb eyJhb changed the title Database Factory includes non-php files [5.4] Database Factory includes non-php files Mar 14, 2017

if (is_dir($path)) {
foreach (Finder::create()->files()->in($path) as $file) {
if(pathinfo($file->getRealPath(), PATHINFO_EXTENSION) !== 'php') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just Finder::create()->files()->name('*.php')->in($path) ?

@taylorotwell taylorotwell merged commit 40dbf32 into laravel:5.4 Mar 14, 2017
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.

3 participants