Skip to content

Commit 3133a48

Browse files
committed
Fix php7 try catch
1 parent 663da76 commit 3133a48

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

src/Annotator/ControllerAnnotator.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Exception;
99
use IdeHelper\Annotation\AnnotationFactory;
1010
use IdeHelper\Annotator\Traits\ComponentTrait;
11+
use Throwable;
1112

1213
class ControllerAnnotator extends AbstractAnnotator {
1314

@@ -96,7 +97,12 @@ protected function _getComponentAnnotations($controllerName) {
9697
if ($this->getConfig(static::CONFIG_VERBOSE)) {
9798
$this->_io->warn(' Skipping component annotations: ' . $e->getMessage());
9899
}
100+
} catch (Throwable $e) {
101+
if ($this->getConfig(static::CONFIG_VERBOSE)) {
102+
$this->_io->warn(' Skipping component annotations: ' . $e->getMessage());
103+
}
99104
}
105+
100106
if (empty($map)) {
101107
return [];
102108
}

src/Annotator/HelperAnnotator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public function annotate($path) {
3535
$this->_io->warn(' Skipping helper annotations: ' . $e->getMessage());
3636
}
3737
return false;
38+
} catch (\Throwable $e) {
39+
if ($this->getConfig(static::CONFIG_VERBOSE)) {
40+
$this->_io->warn(' Skipping helper annotations: ' . $e->getMessage());
41+
}
42+
return false;
3843
}
3944

4045
$helperMap = $this->_invokeProperty($helper, '_helperMap');

src/Annotator/ModelAnnotator.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Exception;
99
use IdeHelper\Annotation\AnnotationFactory;
1010
use RuntimeException;
11+
use Throwable;
1112

1213
class ModelAnnotator extends AbstractAnnotator {
1314

@@ -32,18 +33,27 @@ public function annotate($path) {
3233
$this->_io->warn(' Skipping table and entity: ' . $e->getMessage());
3334
}
3435
return false;
36+
} catch (Throwable $e) {
37+
if ($this->getConfig(static::CONFIG_VERBOSE)) {
38+
$this->_io->warn(' Skipping table and entity: ' . $e->getMessage());
39+
}
40+
return false;
3541
}
3642

3743
$tableAssociations = [];
3844
try {
3945
$tableAssociations = $table->associations();
4046
$associations = $this->_getAssociations($tableAssociations);
41-
4247
} catch (Exception $e) {
4348
if ($this->getConfig(static::CONFIG_VERBOSE)) {
4449
$this->_io->warn(' Skipping associations: ' . $e->getMessage());
4550
}
4651
$associations = [];
52+
} catch (Throwable $e) {
53+
if ($this->getConfig(static::CONFIG_VERBOSE)) {
54+
$this->_io->warn(' Skipping associations: ' . $e->getMessage());
55+
}
56+
$associations = [];
4757
}
4858

4959
$entityClassName = $table->getEntityClass();

src/Annotator/ShellAnnotator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ protected function _getUsedTasks($name) {
9999
$this->_io->warn(' Skipping shell task annotations: ' . $e->getMessage());
100100
}
101101
return [];
102+
} catch (\Throwable $e) {
103+
if ($this->getConfig(static::CONFIG_VERBOSE)) {
104+
$this->_io->warn(' Skipping shell task annotations: ' . $e->getMessage());
105+
}
106+
return [];
102107
}
103108

104109
$map = $this->_invokeProperty($object, '_taskMap');

0 commit comments

Comments
 (0)