Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PHP platform #430

Merged
merged 1 commit into from
Nov 20, 2023
Merged

Fix PHP platform #430

merged 1 commit into from
Nov 20, 2023

Conversation

lyrixx
Copy link
Collaborator

@lyrixx lyrixx commented Nov 17, 2023

No description provided.

@@ -7,7 +7,7 @@
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.0"
"phpunit/phpunit": "^10"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the Class and the filename does not match only PHPUnit 10 is able to work

*
* @return {Boolean} true is the specified email is valid, false otherwise
*/
namespace Fgribreau;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main error.
In composer, we said Fgribreau namespace is in platform/php. But this was wrong. It was Fgribreau\PHP. So the class was not autoloadable.

Two way to fix it

  1. fix the namespace here, to remove PHP. I prefer this one. PHP in a PHP namespace brings nothing
  2. fix in composer json, to append \\PHP

As you can see, I choose. This is a BC Break. BUT since it does not work anyway, this is a bugfix


BTW, the README was already OK

@@ -39,9 +30,6 @@ public static function blacklist(): array
return array_keys(self::$blacklist);
}

/**
* Check if an email is blacklisted or not.
*/
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed useless PHPDoc


require_once __DIR__ . '/../platform/php/MailChecker.php';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the autoloader now, to ensure the composer setup is correct

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sadly npm run test:php does not run with these changes, I'm bringing it back:

require_once __DIR__ . '/../platform/php/MailChecker.php';

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's because you didn't run composer install before running npm run test:php

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, we don't rely on composer currently (see package.json for the cross-language support)

@FGRibreau FGRibreau merged commit ac09796 into FGRibreau:master Nov 20, 2023
1 check passed
@lyrixx lyrixx deleted the fix-php-platform branch November 21, 2023 09:51
@lyrixx lyrixx restored the fix-php-platform branch November 21, 2023 09:54
@lyrixx lyrixx deleted the fix-php-platform branch November 21, 2023 10:04
@lyrixx lyrixx restored the fix-php-platform branch November 21, 2023 10:09
@lyrixx lyrixx deleted the fix-php-platform branch March 13, 2024 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants