Commit 0e52dc99 authored by catch's avatar catch
Browse files

task: #3579889 Replace @return void with native void return types

By: mstrelan
By: smustgrave
By: longwave
(cherry picked from commit 7480c58b)
parent 86a57b37
Loading
Loading
Loading
Loading
Loading
+8 −24
Changes for core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php: 8 added lines, 24 removed lines.
Original line number Diff line number Diff line
@@ -244,10 +244,8 @@ public function __construct()
     * fully qualified class names.
     *
     * @param array $names
     *
     * @return void
     */
    public function setIgnoredAnnotationNames(array $names)
    public function setIgnoredAnnotationNames(array $names): void
    {
        $this->ignoredAnnotationNames = $names;
    }
@@ -256,10 +254,8 @@ public function setIgnoredAnnotationNames(array $names)
     * Sets ignore on not-imported annotations.
     *
     * @param boolean $bool
     *
     * @return void
     */
    public function setIgnoreNotImportedAnnotations($bool)
    public function setIgnoreNotImportedAnnotations($bool): void
    {
        $this->ignoreNotImportedAnnotations = (bool) $bool;
    }
@@ -269,11 +265,9 @@ public function setIgnoreNotImportedAnnotations($bool)
     *
     * @param array $namespace
     *
     * @return void
     *
     * @throws \RuntimeException
     */
    public function addNamespace($namespace)
    public function addNamespace($namespace): void
    {
        if ($this->imports) {
            throw new \RuntimeException('You must either use addNamespace(), or setImports(), but not both.');
@@ -287,11 +281,9 @@ public function addNamespace($namespace)
     *
     * @param array $imports
     *
     * @return void
     *
     * @throws \RuntimeException
     */
    public function setImports(array $imports)
    public function setImports(array $imports): void
    {
        if ($this->namespaces) {
            throw new \RuntimeException('You must either use addNamespace(), or setImports(), but not both.');
@@ -304,10 +296,8 @@ public function setImports(array $imports)
     * Sets current target context as bitmask.
     *
     * @param integer $target
     *
     * @return void
     */
    public function setTarget($target)
    public function setTarget($target): void
    {
        $this->target = $target;
    }
@@ -401,11 +391,9 @@ private function matchAny(array $tokens)
     * @param string     $expected Expected string.
     * @param array|null $token    Optional token.
     *
     * @return void
     *
     * @throws AnnotationException
     */
    private function syntaxError($expected, $token = null)
    private function syntaxError($expected, $token = null): void
    {
        if ($token === null) {
            $token = $this->lexer->lookahead;
@@ -452,10 +440,8 @@ private function classExists($fqcn)
     * Collects parsing metadata for a given annotation class
     *
     * @param string $name The annotation name
     *
     * @return void
     */
    private function collectAnnotationMetadata($name)
    private function collectAnnotationMetadata($name): void
    {
        if (self::$metadataParser === null) {
            self::$metadataParser = new self();
@@ -556,10 +542,8 @@ private function collectAnnotationMetadata($name)
     *
     * @param array     $metadata
     * @param Attribute $attribute
     *
     * @return void
     */
    private function collectAttributeTypeMetadata(&$metadata, Attribute $attribute)
    private function collectAttributeTypeMetadata(&$metadata, Attribute $attribute): void
    {
        // handle internal type declaration
        $type = isset(self::$typeMap[$attribute->type])
+1 −3
Changes for core/lib/Drupal/Component/Annotation/Doctrine/SimpleAnnotationReader.php: 1 added line, 3 removed lines.
Original line number Diff line number Diff line
@@ -83,10 +83,8 @@ public function __construct()
     * Adds a namespace in which we will look for annotations.
     *
     * @param string $namespace
     *
     * @return void
     */
    public function addNamespace($namespace)
    public function addNamespace($namespace): void
    {
        $this->parser->addNamespace($namespace);
    }
+1 −4
Changes for core/lib/Drupal/Component/Annotation/Doctrine/StaticReflectionParser.php: 1 added line, 4 removed lines.
Original line number Diff line number Diff line
@@ -169,10 +169,7 @@ public function __construct($className, $finder, $classAnnotationOptimize = fals
        $this->classAnnotationOptimize = $classAnnotationOptimize;
    }

    /**
     * @return void
     */
    protected function parse()
    protected function parse(): void
    {
        $fileName = $this->finder->findFile($this->className);

+9 −36
Changes for core/lib/Drupal/Component/Diff/DiffFormatter.php: 9 added lines, 36 removed lines.
Original line number Diff line number Diff line
@@ -142,11 +142,8 @@ public function format(Diff $diff) {
   *   Length of the changed lines in the new block.
   * @param \Drupal\Component\Diff\Engine\DiffOp[] $edits
   *   An array of diff operations.
   *
   * @return void
   *   No return value.
   */
  protected function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) {
  protected function _block($xbeg, $xlen, $ybeg, $ylen, &$edits): void {
    $this->_start_block($this->_block_header($xbeg, $xlen, $ybeg, $ylen));
    foreach ($edits as $edit) {
      if ($edit->type == 'copy') {
@@ -170,11 +167,8 @@ protected function _block($xbeg, $xlen, $ybeg, $ylen, &$edits) {

  /**
   * Prepare the start of the diff output.
   *
   * @return void
   *   No return value.
   */
  protected function _start_diff() {
  protected function _start_diff(): void {
    ob_start();
  }

@@ -221,11 +215,8 @@ protected function _block_header($xbeg, $xlen, $ybeg, $ylen) {
   *
   * @param string $header
   *   The header to output.
   *
   * @return void
   *   No return value.
   */
  protected function _start_block($header) {
  protected function _start_block($header): void {
    if ($this->show_header) {
      echo $header . "\n";
    }
@@ -233,11 +224,8 @@ protected function _start_block($header) {

  /**
   * Format the end of the diff block.
   *
   * @return void
   *   No return value.
   */
  protected function _end_block() {
  protected function _end_block(): void {
  }

  /**
@@ -248,11 +236,8 @@ protected function _end_block() {
   * @param string $prefix
   *   The character to use when prefixing the lines (like '<' or '>');
   *   defaults to ' '.
   *
   * @return void
   *   No return value.
   */
  protected function _lines($lines, $prefix = ' ') {
  protected function _lines($lines, $prefix = ' '): void {
    foreach ($lines as $line) {
      echo "$prefix $line\n";
    }
@@ -263,11 +248,8 @@ protected function _lines($lines, $prefix = ' ') {
   *
   * @param string[] $lines
   *   An array of lines.
   *
   * @return void
   *   No return value.
   */
  protected function _context($lines) {
  protected function _context($lines): void {
    $this->_lines($lines);
  }

@@ -276,11 +258,8 @@ protected function _context($lines) {
   *
   * @param string[] $lines
   *   An array of lines.
   *
   * @return void
   *   No return value.
   */
  protected function _added($lines) {
  protected function _added($lines): void {
    $this->_lines($lines, '>');
  }

@@ -289,11 +268,8 @@ protected function _added($lines) {
   *
   * @param string[] $lines
   *   An array of lines.
   *
   * @return void
   *   No return value.
   */
  protected function _deleted($lines) {
  protected function _deleted($lines): void {
    $this->_lines($lines, '<');
  }

@@ -304,11 +280,8 @@ protected function _deleted($lines) {
   *   An array of the original lines.
   * @param string[] $closing
   *   An array of the new lines.
   *
   * @return void
   *   No return value.
   */
  protected function _changed($orig, $closing) {
  protected function _changed($orig, $closing): void {
    $this->_deleted($orig);
    echo "---\n";
    $this->_added($closing);
+7 −7
Changes for core/lib/Drupal/Core/Diff/DiffFormatter.php: 7 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ public function __construct(ConfigFactoryInterface $config_factory) {
  /**
   * {@inheritdoc}
   */
  protected function _start_diff() {
  protected function _start_diff(): void {
    $this->rows = [];
  }

@@ -66,7 +66,7 @@ protected function _block_header($xbeg, $xlen, $ybeg, $ylen) {
  /**
   * {@inheritdoc}
   */
  protected function _start_block($header) {
  protected function _start_block($header): void {
    if ($this->show_header) {
      $this->rows[] = $header;
    }
@@ -75,7 +75,7 @@ protected function _start_block($header) {
  /**
   * {@inheritdoc}
   */
  protected function _lines($lines, $prefix = ' ', $color = 'white') {
  protected function _lines($lines, $prefix = ' ', $color = 'white'): void {
  }

  /**
@@ -157,7 +157,7 @@ protected function emptyLine() {
  /**
   * {@inheritdoc}
   */
  protected function _added($lines) {
  protected function _added($lines): void {
    foreach ($lines as $line) {
      $this->rows[] = array_merge($this->emptyLine(), $this->addedLine(Html::escape($line)));
    }
@@ -166,7 +166,7 @@ protected function _added($lines) {
  /**
   * {@inheritdoc}
   */
  protected function _deleted($lines) {
  protected function _deleted($lines): void {
    foreach ($lines as $line) {
      $this->rows[] = array_merge($this->deletedLine(Html::escape($line)), $this->emptyLine());
    }
@@ -175,7 +175,7 @@ protected function _deleted($lines) {
  /**
   * {@inheritdoc}
   */
  protected function _context($lines) {
  protected function _context($lines): void {
    foreach ($lines as $line) {
      $this->rows[] = array_merge($this->contextLine(Html::escape($line)), $this->contextLine(Html::escape($line)));
    }
@@ -184,7 +184,7 @@ protected function _context($lines) {
  /**
   * {@inheritdoc}
   */
  protected function _changed($orig, $closing) {
  protected function _changed($orig, $closing): void {
    $orig = array_map('\Drupal\Component\Utility\Html::escape', $orig);
    $closing = array_map('\Drupal\Component\Utility\Html::escape', $closing);
    $diff = new WordLevelDiff($orig, $closing);
Loading