Skip to content

Commit

Permalink
Merge pull request #8905 from nicolas-grekas/ret-types
Browse files Browse the repository at this point in the history
Add explicit `@return` type next to `#[ReturnTypeWillChange]`
  • Loading branch information
greg0ire authored Aug 10, 2021
2 parents 4fa2f6b + fca1f52 commit 3b9e04e
Show file tree
Hide file tree
Showing 21 changed files with 58 additions and 14 deletions.
4 changes: 4 additions & 0 deletions lib/Doctrine/ORM/Mapping/ReflectionEmbeddedProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public function __construct(ReflectionProperty $parentProperty, ReflectionProper

/**
* {@inheritDoc}
*
* @return mixed
*/
#[ReturnTypeWillChange]
public function getValue($object = null)
Expand All @@ -76,6 +78,8 @@ public function getValue($object = null)

/**
* {@inheritDoc}
*
* @return void
*/
#[ReturnTypeWillChange]
public function setValue($object, $value = null)
Expand Down
18 changes: 14 additions & 4 deletions lib/Doctrine/ORM/Query/TreeWalkerChainIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public function next()

/**
* {@inheritdoc}
*
* @return bool
*/
#[ReturnTypeWillChange]
public function valid()
Expand All @@ -104,12 +106,15 @@ public function valid()
}

/**
* {@inheritdoc}
* @param mixed $offset
* @psalm-param array-key|null $offset
*
* @return bool
*/
#[ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->walkers[$offset]);
return isset($this->walkers[$offset ?? '']);
}

/**
Expand Down Expand Up @@ -137,6 +142,8 @@ public function offsetGet($offset)
*
* @param string $value
* @psalm-param array-key|null $offset
*
* @return void
*/
#[ReturnTypeWillChange]
public function offsetSet($offset, $value)
Expand All @@ -149,13 +156,16 @@ public function offsetSet($offset, $value)
}

/**
* {@inheritdoc}
* @param mixed $offset
* @psalm-param array-key|null $offset
*
* @return void
*/
#[ReturnTypeWillChange]
public function offsetUnset($offset)
{
if ($this->offsetExists($offset)) {
unset($this->walkers[$offset]);
unset($this->walkers[$offset ?? '']);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ class is supposed to extend which. You have to adjust the entity

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/ORM/Tools/Console/Command/InfoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/ORM/Tools/Console/Command/RunDqlCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ abstract protected function executeSchemaCommand(InputInterface $input, OutputIn

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/ORM/Tools/Console/Helper/EntityManagerHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public function getEntityManager()

/**
* {@inheritdoc}
*
* @return string
*/
public function getName()
{
Expand Down
3 changes: 3 additions & 0 deletions lib/Doctrine/ORM/Tools/Pagination/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ public function setUseOutputWalkers($useOutputWalkers)

/**
* {@inheritdoc}
*
* @return int
*/
#[ReturnTypeWillChange]
public function count()
Expand All @@ -135,6 +137,7 @@ public function count()
/**
* {@inheritdoc}
*
* @return ArrayIterator
* @psalm-return ArrayIterator<array-key, T>
*/
#[ReturnTypeWillChange]
Expand Down
13 changes: 3 additions & 10 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2747,7 +2747,7 @@
<code>$this-&gt;ConditionalExpression()</code>
<code>$this-&gt;ConditionalExpression()</code>
</PossiblyInvalidPropertyAssignmentValue>
<PossiblyNullArgument occurrences="30">
<PossiblyNullArgument occurrences="29">
<code>$aliasIdentVariable</code>
<code>$dql</code>
<code>$dql</code>
Expand Down Expand Up @@ -3265,9 +3265,6 @@
<code>TreeWalker|null</code>
<code>class-string&lt;TreeWalker&gt;|false</code>
</ImplementedReturnTypeMismatch>
<PossiblyNullArgument occurrences="1">
<code>$offset</code>
</PossiblyNullArgument>
<PossiblyNullArrayOffset occurrences="1">
<code>$this-&gt;walkers</code>
</PossiblyNullArrayOffset>
Expand Down Expand Up @@ -3404,9 +3401,7 @@
<code>new ClassMetadataExporter()</code>
<code>new EntityGenerator()</code>
</DeprecatedClass>
<InvalidNullableReturnType occurrences="1">
<code>execute</code>
</InvalidNullableReturnType>
<InvalidNullableReturnType occurrences="1"/>
<MissingReturnType occurrences="1">
<code>configure</code>
</MissingReturnType>
Expand Down Expand Up @@ -3487,9 +3482,7 @@
</MissingReturnType>
</file>
<file src="lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/AbstractCommand.php">
<InvalidNullableReturnType occurrences="1">
<code>execute</code>
</InvalidNullableReturnType>
<InvalidNullableReturnType occurrences="1"/>
<NullableReturnStatement occurrences="1">
<code>$this-&gt;executeSchemaCommand($input, $output, new SchemaTool($em), $metadatas, $ui)</code>
</NullableReturnStatement>
Expand Down

0 comments on commit 3b9e04e

Please sign in to comment.