Giter VIP home page Giter VIP logo

Comments (4)

tufahu avatar tufahu commented on August 16, 2024

@rschierloh i guess it's php7 related. What is your php version?

from magento2-ordercomments.

rschierloh avatar rschierloh commented on August 16, 2024

7.0.22 on localhost, where the error seems to have been fixed by adding a white space before the colon, and 5.6.24 on staging/production where the error is still present. The extension seems to be working normally in both environments despite the error during compilation.

from magento2-ordercomments.

boldsidney avatar boldsidney commented on August 16, 2024

@rschierloh
I don't understand where the error comes from on your localhost. I've just tested it on php 7.0.23 and ran bin/magento setup:di:compile without issues. Could you tell me what Magento version you are using and what step triggers the error?

As for your staging/production environment, this extension's composer.json states php 7.0 as a requirement, so running it on 5.6 isn't really supported. An install through composer would normally have failed, but because you seemed to have placed the extension in app/code, this check was avoided.

The files Bold/OrderComment/Block/Order/Comment.php and Bold/OrderComment/Test/Unit/Model/OrderCommentManagementTest.php use php7 specific syntax.

You could try doing these changes and see if that works for you on 5.6

diff --git a/Block/Order/Comment.php b/Block/Order/Comment.php
index a5b5da3..120806b 100644
--- a/Block/Order/Comment.php
+++ b/Block/Order/Comment.php
@@ -27,22 +27,22 @@ class Comment extends \Magento\Framework\View\Element\Template
         parent::__construct($context, $data);
     }

-    public function getOrder() : Order
+    public function getOrder()
     {
         return $this->coreRegistry->registry('current_order');
     }

-    public function getOrderComment(): string
+    public function getOrderComment()
     {
         return trim($this->getOrder()->getData(OrderComment::COMMENT_FIELD_NAME));
     }

-    public function hasOrderComment() : bool
+    public function hasOrderComment()
     {
         return strlen($this->getOrderComment()) > 0;
     }

-    public function getOrderCommentHtml() : string
+    public function getOrderCommentHtml()
     {
         return nl2br($this->escapeHtml($this->getOrderComment()));
     }
diff --git a/Test/Unit/Model/OrderCommentManagementTest.php b/Test/Unit/Model/OrderCommentManagementTest.php
index 9f48f45..88e0ee6 100644
--- a/Test/Unit/Model/OrderCommentManagementTest.php
+++ b/Test/Unit/Model/OrderCommentManagementTest.php
@@ -140,7 +140,7 @@ class OrderCommentManagementTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals(strip_tags($comment), $this->quoteMock->getData(OrderComment::COMMENT_FIELD_NAME));
     }

-    private function setupQuoteRepositoryMockQueries(int $cartId, int $cartItemCount)
+    private function setupQuoteRepositoryMockQueries($cartId, $cartItemCount)
     {
         $this->quoteRepositoryMock->expects($this->once())
             ->method('getActive')->with($cartId)->will($this->returnValue($this->quoteMock));
@@ -150,7 +150,7 @@ class OrderCommentManagementTest extends \PHPUnit_Framework_TestCase
     /**
      * @return \PHPUnit_Framework_MockObject_MockObject|OrderCommentInterface
      */
-    private function mockOrderComment(string $comment = null): \PHPUnit_Framework_MockObject_MockObject
+    private function mockOrderComment($comment = null)
     {
         $orderCommentMock = $this->getMockBuilder(OrderComment::class)
             ->disableOriginalConstructor()

from magento2-ordercomments.

rschierloh avatar rschierloh commented on August 16, 2024

That works on PHP 5.6. Thanks for the the fix.

from magento2-ordercomments.

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.