Giter Club home page Giter Club logo

Comments (13)

Sebb767 avatar Sebb767 commented on June 12, 2024 2

This is now finally fixed with v7.0.0 :) @Seppo-Konttinen-Solteq @NeilMasters @dbebawy-modus

from contentful.php.

Sebb767 avatar Sebb767 commented on June 12, 2024 1

Unfortunately, the mixed return type is only available starting with PHP 8: https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.mixed .

Using bool and void is possible, though.

from contentful.php.

Sebb767 avatar Sebb767 commented on June 12, 2024

Hey @dbebawy-modus ,

unfortunately, we can't add this attributes or the return type until we deprecate support of PHP7, which we can't do until at least extended support for it runs out. So there's no way to get rid of these warning for now.

from contentful.php.

dbebawy-modus avatar dbebawy-modus commented on June 12, 2024

The composer.json file only supports "php": "^7.2|^8.0",.
Support for PHP return types was added in PHP 7.0 and the void type was added in PHP 7.1.

For the first 3 items, we can resolve the notices by adding the appropriate return types (mixed, bool).

@@ -126,7 +126,7 @@ class Entry extends LocalizedResource implements EntryInterface, \ArrayAccess
     /**
      * {@inheritdoc}
      */
-    public function offsetGet($name)
+    public function offsetGet($name): mixed
     {
         return $this->get($name);
     }
@@ -134,7 +134,7 @@ class Entry extends LocalizedResource implements EntryInterface, \ArrayAccess
     /**
      * {@inheritdoc}
      */
-    public function offsetExists($name)
+    public function offsetExists($name): bool
     {
         return $this->has($name);
     }
@@ -50,7 +50,7 @@ abstract class BaseSystemProperties implements SystemPropertiesInterface
     /**
      * {@inheritdoc}
      */
-    public function jsonSerialize()
+    public function jsonSerialize(): mixed
     {
         return [
             'id' => $this->id,

The last 2 items can be resolved by adding the void return type. This is supported in PHP >= 7.1.

@@ -142,7 +142,7 @@ class Entry extends LocalizedResource implements EntryInterface, \ArrayAccess
     /**
      * {@inheritdoc}
      */
-    public function offsetSet($name, $value)
+    public function offsetSet($name, $value): void
     {
         throw new \LogicException('Entry class does not support setting fields.');
     }
@@ -150,7 +150,7 @@ class Entry extends LocalizedResource implements EntryInterface, \ArrayAccess
     /**
      * {@inheritdoc}
      */
-    public function offsetUnset($name)
+    public function offsetUnset($name): void
     {
         throw new \LogicException('Entry class does not support unsetting fields.');
     }

from contentful.php.

dbebawy-modus avatar dbebawy-modus commented on June 12, 2024

Created PR #317 for your review/approval.

from contentful.php.

Seppo-Konttinen-Solteq avatar Seppo-Konttinen-Solteq commented on June 12, 2024

Hi @Sebb767

Is there anything that can be done with this? We are currently doing upgrade and are blocked with this. Current Magento version EOL is 28th of Nov so se cannot wait much more longer to be able to do upgrade and testing in time.

Thanks.

from contentful.php.

NeilMasters avatar NeilMasters commented on June 12, 2024

The composer.json file only supports "php": "^7.2|^8.0",.

Is there expected full support for php 8.1 coming anytime soon?

from contentful.php.

svenluijten avatar svenluijten commented on June 12, 2024

unfortunately, we can't add this attributes or the return type until we deprecate support of PHP7, which we can't do until at least extended support for it runs out. So there's no way to get rid of these warning for now.

This isn't true. Attributes start with a # which also happens to be a comment. So any attributes you add to your code will simply be ignored pre-8.1. And even if it did, that's what versioning is for. Composer will just resolve the version you need based on your environment. Tagging the next release with PHP 8.1 will not cause any issues for people (STILL!) running PHP 7.x.

from contentful.php.

Seppo-Konttinen-Solteq avatar Seppo-Konttinen-Solteq commented on June 12, 2024

Can this be now released as the PHP7 support should be dropped?

from contentful.php.

Sebb767 avatar Sebb767 commented on June 12, 2024

@Seppo-Konttinen-Solteq There's unfortunately still a blocker in releasing the updated version for rich-text. As soon as this is resolved, I'll immediately publish a new version.

from contentful.php.

Seppo-Konttinen-Solteq avatar Seppo-Konttinen-Solteq commented on June 12, 2024

Thanks for the info @Sebb767 ! :)

from contentful.php.

frankmckechnie avatar frankmckechnie commented on June 12, 2024

Awesome work @Sebb767

from contentful.php.

NeilMasters avatar NeilMasters commented on June 12, 2024

Legend.

from contentful.php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.