Comments (4)
@rschierloh i guess it's php7 related. What is your php version?
from magento2-ordercomments.
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.
@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.
That works on PHP 5.6. Thanks for the the fix.
from magento2-ordercomments.
Related Issues (20)
- No output, not verbosing HOT 1
- Method Not Allowed HOT 4
- PHP Returns Problem on Magento 2.1.14
- Move comment field to first step HOT 2
- Adding comment in order POST call HOT 1
- composer.json is not compatible with php 7.3 (and so with Magento 2.3.3) HOT 5
- Compatability with Magento 2.3.3 HOT 2
- Cache Comments
- Change css of this extension
- Comment field not showing in checkout HOT 3
- Support Magento 2.4 HOT 1
- Can not add custom translation HOT 1
- Issue at production mode HOT 1
- Managing checkout comment REST API HOT 1
- Unable to save comment with Stripe Payment HOT 2
- Adobe issue with extension HOT 1
- Please add the greek translation
- Arabic Translation
- extension not working for billdesk payment method in magento 2.4.3 HOT 6
- Cannot install extension with PHP 8.2 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magento2-ordercomments.