Mercurial > hg > isophonics-drupal-site
comparison vendor/psy/psysh/src/CodeCleaner/AbstractClassPass.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
| author | Chris Cannam |
|---|---|
| date | Thu, 28 Feb 2019 13:21:36 +0000 |
| parents | 5fb285c0d0e3 |
| children |
comparison
equal
deleted
inserted
replaced
| 16:c2387f117808 | 17:129ea1e6d783 |
|---|---|
| 34 if ($node instanceof Class_) { | 34 if ($node instanceof Class_) { |
| 35 $this->class = $node; | 35 $this->class = $node; |
| 36 $this->abstractMethods = []; | 36 $this->abstractMethods = []; |
| 37 } elseif ($node instanceof ClassMethod) { | 37 } elseif ($node instanceof ClassMethod) { |
| 38 if ($node->isAbstract()) { | 38 if ($node->isAbstract()) { |
| 39 $name = sprintf('%s::%s', $this->class->name, $node->name); | 39 $name = \sprintf('%s::%s', $this->class->name, $node->name); |
| 40 $this->abstractMethods[] = $name; | 40 $this->abstractMethods[] = $name; |
| 41 | 41 |
| 42 if ($node->stmts !== null) { | 42 if ($node->stmts !== null) { |
| 43 $msg = sprintf('Abstract function %s cannot contain body', $name); | 43 $msg = \sprintf('Abstract function %s cannot contain body', $name); |
| 44 throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine()); | 44 throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine()); |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 } | 48 } |
| 53 * @param Node $node | 53 * @param Node $node |
| 54 */ | 54 */ |
| 55 public function leaveNode(Node $node) | 55 public function leaveNode(Node $node) |
| 56 { | 56 { |
| 57 if ($node instanceof Class_) { | 57 if ($node instanceof Class_) { |
| 58 $count = count($this->abstractMethods); | 58 $count = \count($this->abstractMethods); |
| 59 if ($count > 0 && !$node->isAbstract()) { | 59 if ($count > 0 && !$node->isAbstract()) { |
| 60 $msg = sprintf( | 60 $msg = \sprintf( |
| 61 'Class %s contains %d abstract method%s must therefore be declared abstract or implement the remaining methods (%s)', | 61 'Class %s contains %d abstract method%s must therefore be declared abstract or implement the remaining methods (%s)', |
| 62 $node->name, | 62 $node->name, |
| 63 $count, | 63 $count, |
| 64 ($count === 1) ? '' : 's', | 64 ($count === 1) ? '' : 's', |
| 65 implode(', ', $this->abstractMethods) | 65 \implode(', ', $this->abstractMethods) |
| 66 ); | 66 ); |
| 67 throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine()); | 67 throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine()); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 } | 70 } |
