ekmungai / eloquent-ifrs

Eloquent Double Entry Accounting with a focus on IFRS Compliant Reporting
MIT License
334 stars 68 forks source link

Update composer.json to support php8.0 and doctrine/DBAL 3.1 #83

Closed inmanturbo closed 3 years ago

inmanturbo commented 3 years ago

These upgrades won't break anything, and will remain backwards compatible so long as we don't start using new php 8 language features.

ekmungai commented 3 years ago

Hi @inmanturbo,

First of all thanks a lot for your sponsorship, I greatly appreciate it. Regarding the composer.json changes, Unfortunately in my experience upgrading to DBAL 3.1 leads to problems with the PDOSqlite driver with the error Error: Class 'Doctrine\DBAL\Driver\PDOSqlite\Driver'. Additionally, wouldn't it be misleading to new users of the package to add php 8.0 in the composer file while the package simply does not run on that version of php? I've tried installing it but so many of its dependecies which support php 8 are still in dev phase that I put it off for the moment. What do you think?

Cheers, Edward

inmanturbo commented 3 years ago

DBAL was the only dependency I needed to update in order to get it working for me, currently using my fork in a project and haven't encountered any errors yet. It is still early though, maybe we can leave it open for a bit and see if we get any other feedback? If I get time tomorrow maybe I'll help set up a workflow for testing different versions of php.

Also could you please give a list of dependencies that aren't working with php 8 and any errors that you've encountered when attempting to install? I may reach out to them as well and see if I'm able to help them get up to speed.

Oh and you are most welcome! I like what you are doing here, and the dev community could definitely use more people coming over from professional backgrounds. It can be very helpful. This project is a perfect example as to how and why.

inmanturbo commented 3 years ago

I suppose I will try some more things with sqlite as well. It looks like that is what you are using by default in phpunit, which is what I usually do myself. I'll run through the tests with a few different version tags on DBAL 3, see if I can encounter the error, and check if it has been patched since.

inmanturbo commented 3 years ago

@ekmungai please review again when you get a chance, after updated a couple of the dev dependecies I can confirm that all test are successful with php 8:

➜ IFRS git:(master) ✗ ./vendor/bin/phpunit PHPUnit 9.4.3 by Sebastian Bergmann and contributors.

Runtime: PHP 8.0.8 Configuration: phpunit.xml

............................................................... 63 / 193 ( 32%) ............................................................... 126 / 193 ( 65%) ............................................................... 189 / 193 ( 97%) . White-Ratke Balance Sheet For the Period: Jan 01 2021 to Dec 31 2021

Assets Non Current Asset 100 Inventory 100 Bank 232

Total Assets 432

Liabilities Control 16 Current Liability 100 Payable 116

Total Liabilities 232

Reconciliation Reconciliation -70

Total Reconciliation -70

Net Assets 130

Equity Equity -70 Net Profit 200

Total Equity 130

. Gerlach, Corwin and Nolan Cash Flow Statement For the Period: Jul 04 2021 to Aug 05 2021

Operations Cash Flow Net Profit 700 Provisions 50 Receivables -530 Payables 298 Taxation 112 Current Assets -100 Current Liabilities 100

Total Operations Cash Flow 630

Investment Cash Flow Non Current Assets -150

Total Investment Cash Flow -150

Financing Cash Flow Non Current Liabilities 100 Equity 100

Total Financing Cash Flow 200

Net Cash Flow Beginning Cash balance 100 Net Cash Flow 680

Ending Cash balance 780

                    ---------------

Cashbook balance 780

. Nikolaus PLC Income Statement For the Period: Jan 01 2021 to Dec 31 2021

Operating Revenues Operating Revenue 245

Operating Expenses Operating Expense 100

Gross Profit 145

Non Operating Revenues Non Operating Revenue 205

Total Revenue 350

Non Operating Expenses Direct Expense 70 Overhead Expense 70 Other Expense 20

Total Non Operating Expenses 160

Net Profit 190

. 193 / 193 (100%)

Time: 00:36.796, Memory: 54.00 MB

OK (193 tests, 1062 assertions) ➜ IFRS git:(main) ✗ php --version
PHP 8.0.8 (cli) (built: Jul 1 2021 15:27:21) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.8, Copyright (c) Zend Technologies with Zend OPcache v8.0.8, Copyright (c), by Zend Technologies ➜ IFRS git:(main) ✗

inmanturbo commented 3 years ago

I am going to squash these commits to clean up the history a bit, then re-submit this with a new composer.lock file.