Skip to content

Commit a3d4aa6

Browse files
committed
兼容php8.0
1 parent d26f62c commit a3d4aa6

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"require": {
1212
"topthink/framework": "^6.0",
1313
"phpdocumentor/reflection-docblock": "^5.0",
14-
"symfony/class-loader": "~3.2.0"
14+
"ergebnis/classy": "^1.1"
1515
},
1616
"autoload": {
1717
"psr-4": {

src/console/ModelCommand.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace think\ide\console;
44

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

3535
public function handle()
@@ -97,8 +97,10 @@ protected function loadModels()
9797
foreach ($this->dirs as $dir) {
9898
$dir = $this->app->getBasePath() . $dir;
9999
if (file_exists($dir)) {
100-
foreach (ClassMapGenerator::createMap($dir) as $model => $path) {
101-
$models[] = $model;
100+
$constructs = Constructs::fromDirectory($dir);
101+
102+
foreach ($constructs as $construct) {
103+
$models[] = $construct->name();
102104
}
103105
}
104106
}

0 commit comments

Comments
 (0)