Skip to content

Commit

Permalink
兼容php8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwuxin committed Apr 23, 2021
1 parent d26f62c commit a3d4aa6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"require": {
"topthink/framework": "^6.0",
"phpdocumentor/reflection-docblock": "^5.0",
"symfony/class-loader": "~3.2.0"
"ergebnis/classy": "^1.1"
},
"autoload": {
"psr-4": {
Expand Down
18 changes: 10 additions & 8 deletions src/console/ModelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace think\ide\console;

use Ergebnis\Classy\Constructs;
use Exception;
use Symfony\Component\ClassLoader\ClassMapGenerator;
use think\console\Command;
use think\console\input\Argument;
use think\console\input\Option;
Expand All @@ -25,11 +25,11 @@ class ModelCommand extends Command
protected function configure()
{
$this->setName("ide-helper:model")
->addArgument('model', Argument::OPTIONAL | Argument::IS_ARRAY, 'Which models to include', [])
->addOption('dir', 'D', Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'The model dir', [])
->addOption('ignore', 'I', Option::VALUE_OPTIONAL, 'Which models to ignore', '')
->addOption('reset', 'R', Option::VALUE_NONE, 'Remove the original phpdocs instead of appending')
->addOption('overwrite', 'O', Option::VALUE_NONE, 'Overwrite the phpdocs');
->addArgument('model', Argument::OPTIONAL | Argument::IS_ARRAY, 'Which models to include', [])
->addOption('dir', 'D', Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'The model dir', [])
->addOption('ignore', 'I', Option::VALUE_OPTIONAL, 'Which models to ignore', '')
->addOption('reset', 'R', Option::VALUE_NONE, 'Remove the original phpdocs instead of appending')
->addOption('overwrite', 'O', Option::VALUE_NONE, 'Overwrite the phpdocs');
}

public function handle()
Expand Down Expand Up @@ -97,8 +97,10 @@ protected function loadModels()
foreach ($this->dirs as $dir) {
$dir = $this->app->getBasePath() . $dir;
if (file_exists($dir)) {
foreach (ClassMapGenerator::createMap($dir) as $model => $path) {
$models[] = $model;
$constructs = Constructs::fromDirectory($dir);

foreach ($constructs as $construct) {
$models[] = $construct->name();
}
}
}
Expand Down

0 comments on commit a3d4aa6

Please sign in to comment.