PHPOffice / PHPPresentation

A pure PHP library for reading and writing presentations documents
https://phpoffice.github.io/PHPPresentation
Other
1.3k stars 519 forks source link

PhpOffice\PhpPresentation\Shape\RichText\Paragraph::setSpacingBefore() #729

Closed Bhadresh-Malankiya closed 1 day ago

Bhadresh-Malankiya commented 1 year ago

TypeError PhpOffice\PhpPresentation\Shape\RichText\Paragraph::setSpacingBefore(): Argument #1 ($spacingBefore) must be of type int, float given, called in /home/pc1/Expresstech/certificates_poc/vendor/phpoffice/phppresentation/src/PhpPresentation/Reader/PowerPoint2007.php on line 1129

image

using php 8.0 with laravel 8

I was struggling to solve this from last 1 day but at last I think this is some internal library files type error, please let me know solution or fix it asap.

samverhoeven commented 1 year ago

I can confirm this issue. On this line, the result of a division (will always be a float) is given to a function that expects an int.

vibhavankhade commented 5 months ago

I am facing same issue please help me out
TypeError: PhpOffice\PhpPresentation\Shape\RichText\Paragraph::setSpacingBefore(): Argument #1 ($spacingBefore) must be of type int, float given, called in D:\Projects\xampp8.2.4\htdocs\magento246p1\vendor\phpoffice\phppresentation\src\PhpPresentation\Reader\PowerPoint2007.php on line 1131 and defined in D:\Projects\xampp8.2.4\htdocs\magento246p1\vendor\phpoffice\phppresentation\src\PhpPresentation\Shape\RichText\Paragraph.php:367

Progi1984 commented 2 weeks ago

@samverhoeven @Bhadresh-Malankiya @vibhavankhade Have you got a sample file with the error, please ?

samverhoeven commented 2 weeks ago

@Progi1984, I'm not sure anymore which files in my repos caused this issue, so that would that me too much time. If the setSpacingBefore function really needs to receive an int, I would then cast the result of the division in PowerPoint2007 to an int. If the Paragraph can also work with the spacingBefore property being a float, I would just leave out the type hinting as long as php 7 is still supported. Or am I oversimplifying things here?

Progi1984 commented 1 day ago

@Bhadresh-Malankiya @samverhoeven @vibhavankhade This issue has been fixed by a maintainer. You can help him by sponsoring him through Github sponsors.