8000 Merge branch '4.4' into 5.3 · symfony/symfony@1b9e223 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1b9e223

Browse files
committed
Merge branch '4.4' into 5.3
* 4.4: Fix return types for PHP 8.1
2 parents a5fa6e5 + 5b1fc10 commit 1b9e223
  • Routing
  • Security/Core/Exception
  • Templating
  • Validator
  • VarDumper/Cloner
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    52 files changed

    +192
    -42
    lines changed

    src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php

    Lines changed: 22 additions & 4 deletions
    Original file line numberDiff line numberDiff line change
    @@ -865,6 +865,10 @@ public function resultWithEmptyIterator(): array
    865865

    866866
    return [
    867867
    [$entity, new class() implements \Iterator {
    868+
    /**
    869+
    * @return mixed
    870+
    */
    871+
    #[\ReturnTypeWillChange]
    868872
    public function current()
    869873
    {
    870874
    return null;
    @@ -875,19 +879,28 @@ public function valid(): bool
    875879
    return false;
    876880
    }
    877881

    878-
    public function next()
    882+
    public function next(): void
    879883
    {
    880884
    }
    881885

    886+
    /**
    887+
    * @return mixed
    888+
    */
    889+
    #[\ReturnTypeWillChange]
    882890
    public function key()
    883891
    {
    892+
    return false;
    884893
    }
    885894

    886-
    public function rewind()
    895+
    public function rewind(): void
    887896
    {
    888897
    }
    889898
    }],
    890899
    [$entity, new class() implements \Iterator {
    900+
    /**
    901+
    * @return mixed
    902+
    */
    903+
    #[\ReturnTypeWillChange]
    891904
    public function current()
    892905
    {
    893906
    return false;
    @@ -898,15 +911,20 @@ public function valid(): bool
    898911
    return false;
    899912
    }
    900913

    901-
    public function next()
    914+
    public function next(): void
    902915
    {
    903916
    }
    904917

    918+
    /**
    919+
    * @return mixed
    920+
    */
    921+
    #[\ReturnTypeWillChange]
    905922
    public function key()
    906923
    {
    924+
    return false;
    907925
    }
    908926

    909-
    public function rewind()
    927+
    public function rewind(): void
    910928
    {
    911929
    }
    912930
    }],

    src/Symfony/Component/Console/Helper/HelperSet.php

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -89,8 +89,9 @@ public function getCommand()
    8989
    }
    9090

    9191
    /**
    92-
    * @return Helper[]
    92+
    * @return \Traversable<Helper>
    9393
    */
    94+
    #[\ReturnTypeWillChange]
    9495
    public function getIterator()
    9596
    {
    9697
    return new \ArrayIterator($this->helpers);

    src/Symfony/Component/DomCrawler/Crawler.php

    Lines changed: 2 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1112,6 +1112,7 @@ public function getNode(int $position)
    11121112
    /**
    11131113
    * @return int
    11141114
    */
    1115+
    #[\ReturnTypeWillChange]
    11151116
    public function count()
    11161117
    {
    11171118
    return \count($this->nodes);
    @@ -1120,6 +1121,7 @@ public function count()
    11201121
    /**
    11211122
    * @return \ArrayIterator|\DOMNode[]
    11221123
    */
    1124+
    #[\ReturnTypeWillChange]
    11231125
    public function getIterator()
    11241126
    {
    11251127
    return new \ArrayIterator($this->nodes);

    src/Symfony/Component/DomCrawler/Form.php

    Lines changed: 4 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -315,6 +315,7 @@ public function all()
    315315
    *
    316316
    * @return bool true if the field exists, false otherwise
    317317
    */
    318+
    #[\ReturnTypeWillChange]
    318319
    public function offsetExists($name)
    319320
    {
    320321
    return $this->has($name);
    @@ -329,6 +330,7 @@ public function offsetExists($name)
    329330
    *
    330331
    * @throws \InvalidArgumentException if the field does not exist
    331332
    */
    333+
    #[\ReturnTypeWillChange]
    332334
    public function offsetGet($name)
    333335
    {
    334336
    return $this->fields->get($name);
    @@ -344,6 +346,7 @@ public function offsetGet($name)
    344346
    *
    345347
    * @throws \InvalidArgumentException if the field does not exist
    346348
    */
    349+
    #[\ReturnTypeWillChange]
    347350
    public function offsetSet($name, $value)
    348351
    {
    349352
    $this->fields->set($name, $value);
    @@ -356,6 +359,7 @@ public function offsetSet($name, $value)
    356359
    *
    357360
    * @return void
    358361
    */
    362+
    #[\ReturnTypeWillChange]
    359363
    public function offsetUnset($name)
    360364
    {
    361365
    $this->fields->remove($name);

    src/Symfony/Component/EventDispatcher/GenericEvent.php

    Lines changed: 5 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -118,6 +118,7 @@ public function hasArgument(string $key)
    118118
    *
    119119
    * @throws \InvalidArgumentException if key does not exist in $this->args
    120120
    */
    121+
    #[\ReturnTypeWillChange]
    121122
    public function offsetGet($key)
    122123
    {
    123124
    return $this->getArgument($key);
    @@ -131,6 +132,7 @@ public function offsetGet($key)
    131132
    *
    132133
    * @return void
    133134
    */
    135+
    #[\ReturnTypeWillChange]
    134136
    public function offsetSet($key, $value)
    135137
    {
    136138
    $this->setArgument($key, $value);
    @@ -143,6 +145,7 @@ public function offsetSet($key, $value)
    143145
    *
    144146
    * @return void
    145147
    */
    148+
    #[\ReturnTypeWillChange]
    146149
    public function offsetUnset($key)
    147150
    {
    148151
    if ($this->hasArgument($key)) {
    @@ -157,6 +160,7 @@ public function offsetUnset($key)
    157160
    *
    158161
    * @return bool
    159162
    */
    163+
    #[\ReturnTypeWillChange]
    160164
    public function offsetExists($key)
    161165
    {
    162166
    return $this->hasArgument($key);
    @@ -167,6 +171,7 @@ public function offsetExists($key)
    167171
    *
    168172
    * @return \ArrayIterator
    169173
    */
    174+
    #[\ReturnTypeWillChange]
    170175
    public function getIterator()
    171176
    {
    172177
    return new \ArrayIterator($this->arguments);

    src/Symfony/Component/Finder/Finder.php

    Lines changed: 2 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -605,6 +605,7 @@ public function in($dirs)
    605605
    *
    606606
    * @throws \LogicException if the in() method has not been called
    607607
    */
    608+
    #[\ReturnTypeWillChange]
    608609
    public function getIterator()
    609610
    {
    610611
    if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
    @@ -687,6 +688,7 @@ public function hasResults()
    687688
    *
    688689
    * @return int
    689690
    */
    691+
    #[\ReturnTypeWillChange]
    690692
    public function count()
    691693
    {
    692694
    return iterator_count($this->getIterator());

    src/Symfony/Component/Finder/Iterator/CustomFilterIterator.php

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -46,6 +46,7 @@ public function __construct(\Iterator $iterator, array $filters)
    4646
    *
    4747
    * @return bool true if the value should be kept, false otherwise
    4848
    */
    49+
    #[\ReturnTypeWillChange]
    4950
    public function accept()
    5051
    {
    5152
    $fileinfo = $this->current();

    src/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -38,6 +38,7 @@ public function __construct(\Iterator $iterator, array $comparators)
    3838
    *
    3939
    * @return bool true if the value should be kept, false otherwise
    4040
    */
    41+
    #[\ReturnTypeWillChange]
    4142
    public function accept()
    4243
    {
    4344
    $fileinfo = $this->current();

    src/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.php

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -38,6 +38,7 @@ public function __construct(\RecursiveIteratorIterator $iterator, int $minDepth
    3838
    *
    3939
    * @return bool true if the value should be kept, false otherwise
    4040
    */
    41+
    #[\ReturnTypeWillChange]
    4142
    public function accept()
    4243
    {
    4344
    return $this->getInnerIterator()->getDepth() >= $this->minDepth;

    src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php

    Lines changed: 3 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -52,6 +52,7 @@ public function __construct(\Iterator $iterator, array $directories)
    5252
    *
    5353
    * @return bool True if the value should be kept, false otherwise
    5454
    */
    55+
    #[\ReturnTypeWillChange]
    5556
    public function accept()
    5657
    {
    5758
    if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
    @@ -71,6 +72,7 @@ public function accept()
    7172
    /**
    7273
    * @return bool
    7374
    */
    75+
    #[\ReturnTypeWillChange]
    7476
    public function hasChildren()
    7577
    {
    7678
    return $this->isRecursive && $this->iterator->hasChildren();
    @@ -79,6 +81,7 @@ public function hasChildren()
    7981
    /**
    8082
    * @return self
    8183
    */
    84+
    #[\ReturnTypeWillChange]
    8285
    public function getChildren()
    8386
    {
    8487
    $children = new self($this->iterator->getChildren(), []);

    src/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -39,6 +39,7 @@ public function __construct(\Iterator $iterator, int $mode)
    3939
    *
    4040
    * @return bool true if the value should be kept, false otherwise
    4141
    */
    42+
    #[\ReturnTypeWillChange]
    4243
    public function accept()
    4344
    {
    4445
    $fileinfo = $this->current();

    src/Symfony/Component/Finder/Iterator/FilecontentFilterIterator.php

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -24,6 +24,7 @@ class FilecontentFilterIterator extends MultiplePcreFilterIterator
    2424
    *
    2525
    * @return bool true if the value should be kept, false otherwise
    2626
    */
    27+
    #[\ReturnTypeWillChange]
    2728
    public function accept()
    2829
    {
    2930
    if (!$this->matchRegexps && !$this->noMatchRegexps) {

    src/Symfony/Component/Finder/Iterator/FilenameFilterIterator.php

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -25,6 +25,7 @@ class FilenameFilterIterator extends MultiplePcreFilterIterator
    2525
    *
    2626
    * @return bool true if the value should be kept, false otherwise
    2727
    */
    28+
    #[\ReturnTypeWillChange]
    2829
    public function accept()
    2930
    {
    3031
    return $this->isAccepted($this->current()->getFilename());

    src/Symfony/Component/Finder/Iterator/PathFilterIterator.php

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -24,6 +24,7 @@ class PathFilterIterator extends MultiplePcreFilterIterator
    2424
    *
    2525
    * @return bool true if the value should be kept, false otherwise
    2626
    */
    27+
    #[\ReturnTypeWillChange]
    2728
    public function accept()
    2829
    {
    2930
    $filename = $this->current()->getRelativePathname();

    src/Symfony/Component/Finder/Iterator/SizeRangeFilterIterator.php

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -38,6 +38,7 @@ public function __construct(\Iterator $iterator, array $comparators)
    3838
    *
    3939
    * @return bool true if the value should be kept, false otherwise
    4040
    */
    41+
    #[\ReturnTypeWillChange]
    4142
    public function accept()
    4243
    {
    4344
    $fileinfo = $this->current();

    src/Symfony/Component/Finder/Iterator/SortableIterator.php

    Lines changed: 1 addition & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -81,6 +81,7 @@ public function __construct(\Traversable $iterator, $sort, bool $reverseOrder =
    8181
    /**
    8282
    * @return \Traversable
    8383
    */
    84+
    #[\ReturnTypeWillChange]
    8485
    public function getIterator()
    8586
    {
    8687
    if (1 === $this->sort) {

    src/Symfony/Component/Finder/Tests/Iterator/Iterator.php

    Lines changed: 11 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -23,12 +23,12 @@ public function __construct(array $values = [])
    2323
    $this->rewind();
    2424
    }
    2525

    26-
    public function attach(\SplFileInfo $fileinfo)
    26+
    public function attach(\SplFileInfo $fileinfo): void
    2727
    {
    2828
    $this->values[] = $fileinfo;
    2929
    }
    3030

    31-
    public function rewind()
    31+
    public function rewind(): void
    3232
    {
    3333
    reset($this->values);
    3434
    }
    @@ -38,16 +38,24 @@ public function valid(): bool
    3838
    return false !== $this->current();
    3939
    }
    4040

    41-
    public function next()
    41+
    public function next(): void
    4242
    {
    4343
    next($this->values);
    4444
    }
    4545

    46+
    /**
    47+
    * @return mixed
    48+
    */
    49+
    #[\ReturnTypeWillChange]
    4650
    public function current()
    4751
    {
    4852
    return current($this->values);
    4953
    }
    5054

    55+
    /**
    56+
    * @return mixed
    57+
    */
    58+
    #[\ReturnTypeWillChange]
    5159
    public function key()
    5260
    {
    5361
    return key($this->values);

    src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -54,7 +54,7 @@ public function __construct()
    5454
    {
    5555
    }
    5656

    57-
    public function accept()
    57+
    public function accept(): bool
    5858
    {
    5959
    throw new \BadFunctionCallException('Not implemented');
    6060
    }

    src/Symfony/Component/Form/Button.php

    Lines changed: 6 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -51,6 +51,7 @@ public function __construct(FormConfigInterface $config)
    5151
    *
    5252
    * @return bool Always returns false
    5353
    */
    54+
    #[\ReturnTypeWillChange]
    5455
    public function offsetExists($offset)
    5556
    {
    5657
    return false;
    @@ -67,6 +68,7 @@ public function offsetExists($offset)
    6768
    *
    6869
    * @throws BadMethodCallException
    6970
    */
    71+
    #[\ReturnTypeWillChange]
    7072
    public function offsetGet($offset)
    7173
    {
    7274
    throw new BadMethodCallException('Buttons cannot have children.');
    @@ -84,6 +86,7 @@ public function offsetGet($offset)
    8486
    *
    8587
    * @throws BadMethodCallException
    8688
    */
    89+
    #[\ReturnTypeWillChange]
    8790
    public function offsetSet($offset, $value)
    8891
    {
    8992
    throw new BadMethodCallException('Buttons cannot have children.');
    @@ -100,6 +103,7 @@ public function offsetSet($offset, $value)
    100103
    *
    101104
    * @throws BadMethodCallException
    102105
    */
    106+
    #[\ReturnTypeWillChange]
    103107
    public function offsetUnset($offset)
    104108
    {
    105109
    throw new BadMethodCallException('Buttons cannot have children.');
    @@ -430,6 +434,7 @@ public function createView(FormView $parent = null)
    430434
    *
    431435
    * @return int Always returns 0
    432436
    */
    437+
    #[\ReturnTypeWillChange]
    433438
    public function count()
    434439
    {
    435440
    return 0;
    @@ -440,6 +445,7 @@ public function count()
    440445
    *
    441446
    * @return \EmptyIterator Always returns an empty iterator
    442447
    */
    448+
    #[\ReturnTypeWillChange]
    443449
    public function getIterator()
    444450
    {
    445451
    return new \EmptyIterator();

    src/Symfony/Component/Form/ButtonBuilder.php

    Lines changed: 2 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -715,6 +715,7 @@ public function getIsEmptyCallback(): ?callable
    715715
    *
    716716
    * @return int Always returns 0
    717717
    */
    718+
    #[\ReturnTypeWillChange]
    718719
    public function count()
    719720
    {
    720721
    return 0;
    @@ -725,6 +726,7 @@ public function count()
    725726
    *
    726727
    * @return \EmptyIterator Always returns an empty iterator
    727728
    */
    729+
    #[\ReturnTypeWillChange]
    728730
    public function getIterator()
    729731
    {
    730732
    return new \EmptyIterator();

    0 commit comments

    Comments
     (0)
    0