Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RE: Added \ReturnTypeWillChange Attribute - (#120) #141

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"ext-spl": "*",
"ext-xml": "*",
"ext-zlib": "*",
"zf1s/polyfill-php81": "^1.25",
"symfony/polyfill-php70": "^1.19"
},
"require-dev": {
Expand Down Expand Up @@ -210,5 +211,8 @@
"lint": "parallel-lint --exclude vendor --exclude tests/Zend/Loader/_files/ParseError.php .",
"lint.checkstyle": "@lint --checkstyle",
"test": "phpunit"
},
"config": {
"sort-packages": true
Comment on lines +214 to +216
Copy link
Member

@falkenhawk falkenhawk Oct 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need it here. BTW, I wonder, why it is not true by default, at least starting from composer v2 🤡

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed in #146

}
}
1 change: 1 addition & 0 deletions packages/zend-acl/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"homepage": "http://framework.zend.com/",
"license": "BSD-3-Clause",
"require": {
"zf1s/polyfill-php81": "^1.25",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but could you rearrange requires in individual package so that they are sorted alphabetically, please?
And please make sure polyfill-php81 is required only when it is really needed for a package, i.e. when any of the following are used inside the package.

But after a short research, it might be that we don't need the polyfill at all? First two features are not used anywhere, if I'm not mistaken, and ReturnTypeWillChange stub would be only needed for php 8.0, IF it would throw an error on it. But it does not throw an error, either for that or any attribute which is not implemented, e.g. #[Gibberish] would not throw any error even if class Gibberish is not implemented as an attribute.

Maybe it would be needed for code analysis, running on php 8.0. Even in that case, it would be probably enough, if added to the main composer.json only. But we do not have any code analyzers running here, and if one dev would like to run it locally, why would they run it on php 8.0?

Please check if those polyfills are really needed. thank you

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressing in #146

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appears dependency update not needed, all composer changes can be dropped.

so all left to do is to carry those attribute adding right?

i will remove the root namespace qualifier in the process:

"php": ">=5.3.3",
"zf1s/zend-exception": "^1.15.0"
},
Expand Down
1 change: 1 addition & 0 deletions packages/zend-amf/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"homepage": "http://framework.zend.com/",
"license": "BSD-3-Clause",
"require": {
"zf1s/polyfill-php81": "^1.25",
"php": ">=5.3.3",
"ext-dom": "*",
"zf1s/zend-exception": "^1.15.0",
Expand Down
1 change: 1 addition & 0 deletions packages/zend-application/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"homepage": "http://framework.zend.com/",
"license": "BSD-3-Clause",
"require": {
"zf1s/polyfill-php81": "^1.25",
"php": ">=5.3.3",
"zf1s/zend-exception": "^1.15.0",
"zf1s/zend-controller": "^1.15.0"
Expand Down
1 change: 1 addition & 0 deletions packages/zend-auth/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"homepage": "http://framework.zend.com/",
"license": "BSD-3-Clause",
"require": {
"zf1s/polyfill-php81": "^1.25",
"php": ">=5.3.3",
"ext-ctype": "*",
"zf1s/zend-exception": "^1.15.0"
Expand Down
1 change: 1 addition & 0 deletions packages/zend-barcode/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"homepage": "http://framework.zend.com/",
"license": "BSD-3-Clause",
"require": {
"zf1s/polyfill-php81": "^1.25",
"php": ">=5.3.3",
"zf1s/zend-exception": "^1.15.0",
"zf1s/zend-validate": "^1.15.0"
Expand Down
1 change: 1 addition & 0 deletions packages/zend-cache/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"homepage": "http://framework.zend.com/",
"license": "BSD-3-Clause",
"require": {
"zf1s/polyfill-php81": "^1.25",
"php": ">=5.3.3",
"zf1s/zend-exception": "^1.15.0"
},
Expand Down
1 change: 1 addition & 0 deletions packages/zend-captcha/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"homepage": "http://framework.zend.com/",
"license": "BSD-3-Clause",
"require": {
"zf1s/polyfill-php81": "^1.25",
"php": ">=5.3.3",
"ext-gd": "*",
"zf1s/zend-crypt": "^1.15.0",
Expand Down
1 change: 1 addition & 0 deletions packages/zend-cloud/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"homepage": "http://framework.zend.com/",
"license": "BSD-3-Clause",
"require": {
"zf1s/polyfill-php81": "^1.25",
"php": ">=5.3.3",
"zf1s/zend-exception": "^1.15.0",
"zf1s/zend-loader": "^1.15.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public function __set($name, $value)
* @param string $name
* @return bool
*/
#[\ReturnTypeWillChange]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As ZF1 doesn't use namespaces, the root namespace qualifier can be dropped

public function offsetExists($name)
{
return isset($this->_fields[$name]);
Expand All @@ -172,6 +173,7 @@ public function offsetExists($name)
* @param string $name
* @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($name)
{
return $this->getField($name);
Expand All @@ -184,6 +186,7 @@ public function offsetGet($name)
* @param mixed $value
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetSet($name, $value)
{
$this->setField($name, $value);
Expand All @@ -195,6 +198,7 @@ public function offsetSet($name, $value)
* @param string $name
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetUnset($name)
{
if ($this->offsetExists($name)) {
Expand Down Expand Up @@ -231,6 +235,7 @@ public function __call($name, $args)
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->_fields);
Expand All @@ -241,6 +246,7 @@ public function count()
*
* @return Iterator
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new ArrayIterator($this->_fields);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function __construct(array $documents)
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return $this->_documentCount;
Expand All @@ -61,6 +62,7 @@ public function count()
*
* @return Traversable
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return $this->_documents;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Zend_Cloud_Infrastructure_ImageList implements Countable, Iterator, ArrayA

/**
* The Image adapter (if exists)
*
*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary whitespace change

* @var object
*/
protected $adapter;
Expand Down Expand Up @@ -87,6 +87,7 @@ protected function addImage(Zend_Cloud_Infrastructure_Image $image)
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->images);
Expand All @@ -99,6 +100,7 @@ public function count()
*
* @return Image
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->images[$this->iteratorKey];
Expand All @@ -111,6 +113,7 @@ public function current()
*
* @return int
*/
#[\ReturnTypeWillChange]
public function key()
{
return $this->iteratorKey;
Expand All @@ -123,6 +126,7 @@ public function key()
*
* @return void
*/
#[\ReturnTypeWillChange]
public function next()
{
$this->iteratorKey++;
Expand All @@ -135,6 +139,7 @@ public function next()
*
* @return void
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->iteratorKey = 0;
Expand All @@ -147,6 +152,7 @@ public function rewind()
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function valid()
{
$numItems = $this->count();
Expand All @@ -164,6 +170,7 @@ public function valid()
* @param int $offset
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return ($offset < $this->count());
Expand All @@ -178,6 +185,7 @@ public function offsetExists($offset)
* @throws Zend_Cloud_Infrastructure_Exception
* @return Image
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
if (!$this->offsetExists($offset)) {
Expand All @@ -196,6 +204,7 @@ public function offsetGet($offset)
* @param string $value
* @throws Zend_Cloud_Infrastructure_Exception
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
// require_once 'Zend/Cloud/Infrastructure/Exception.php';
Expand All @@ -210,6 +219,7 @@ public function offsetSet($offset, $value)
* @param int $offset
* @throws Zend_Cloud_Infrastructure_Exception
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
// require_once 'Zend/Cloud/Infrastructure/Exception.php';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ protected function addInstance(Zend_Cloud_Infrastructure_Instance $instance)
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->instances);
Expand All @@ -100,6 +101,7 @@ public function count()
*
* @return Instance
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->instances[$this->iteratorKey];
Expand All @@ -112,6 +114,7 @@ public function current()
*
* @return int
*/
#[\ReturnTypeWillChange]
public function key()
{
return $this->iteratorKey;
Expand All @@ -124,6 +127,7 @@ public function key()
*
* @return void
*/
#[\ReturnTypeWillChange]
public function next()
{
$this->iteratorKey++;
Expand All @@ -136,6 +140,7 @@ public function next()
*
* @return void
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->iteratorKey = 0;
Expand All @@ -148,6 +153,7 @@ public function rewind()
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function valid()
{
$numItems = $this->count();
Expand All @@ -165,6 +171,7 @@ public function valid()
* @param int $offset
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return ($offset < $this->count());
Expand All @@ -179,6 +186,7 @@ public function offsetExists($offset)
* @return Instance
* @throws Zend_Cloud_Infrastructure_Exception
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
if (!$this->offsetExists($offset)) {
Expand All @@ -197,6 +205,7 @@ public function offsetGet($offset)
* @param string $value
* @throws Zend_Cloud_Infrastructure_Exception
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
// require_once 'Zend/Cloud/Infrastructure/Exception.php';
Expand All @@ -211,6 +220,7 @@ public function offsetSet($offset, $value)
* @param int $offset
* @throws Zend_Cloud_Infrastructure_Exception
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
// require_once 'Zend/Cloud/Infrastructure/Exception.php';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function __construct(array $messages)
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return $this->_messageCount;
Expand All @@ -61,6 +62,7 @@ public function count()
*
* @return Traversable
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return $this->_messages;
Expand Down
1 change: 1 addition & 0 deletions packages/zend-codegenerator/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"homepage": "http://framework.zend.com/",
"license": "BSD-3-Clause",
"require": {
"zf1s/polyfill-php81": "^1.25",
"php": ">=5.3.3",
"zf1s/zend-exception": "^1.15.0",
"zf1s/zend-reflection": "^1.15.0"
Expand Down
1 change: 1 addition & 0 deletions packages/zend-config/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"homepage": "http://framework.zend.com/",
"license": "BSD-3-Clause",
"require": {
"zf1s/polyfill-php81": "^1.25",
"php": ">=5.3.3",
"zf1s/zend-exception": "^1.15.0",
"zf1s/zend-xml": "^1.15.0"
Expand Down
6 changes: 6 additions & 0 deletions packages/zend-config/library/Zend/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ public function __unset($name)
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return $this->_count;
Expand All @@ -271,6 +272,7 @@ public function count()
*
* @return mixed
*/
#[\ReturnTypeWillChange]
public function current()
{
$this->_skipNextIteration = false;
Expand All @@ -282,6 +284,7 @@ public function current()
*
* @return mixed
*/
#[\ReturnTypeWillChange]
public function key()
{
return key($this->_data);
Expand All @@ -291,6 +294,7 @@ public function key()
* Defined by Iterator interface
*
*/
#[\ReturnTypeWillChange]
public function next()
{
if ($this->_skipNextIteration) {
Expand All @@ -305,6 +309,7 @@ public function next()
* Defined by Iterator interface
*
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->_skipNextIteration = false;
Expand All @@ -317,6 +322,7 @@ public function rewind()
*
* @return boolean
*/
#[\ReturnTypeWillChange]
public function valid()
{
return $this->_index < $this->_count;
Expand Down
Loading