The module needs a little cleanup to match the Drupal coding standards, in particular functions & methods that expect arguments to be either an object or array need to specify that.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

DamienMcKenna created an issue. See original summary.

viniciuscosta’s picture

Assigned: Unassigned » viniciuscosta

I'll work on it =)

viniciuscosta’s picture

Assigned: viniciuscosta » Unassigned
Status: Active » Needs review
StatusFileSize
new263.63 KB
new34.56 KB

I find the following error "Only string literals should be passed to t() where possible", I suggest changing the name of the function to don't conflict with the t() function that was introduced later.

ganeshsurya11 made their first commit to this issue’s fork.

jmizarela’s picture

Assigned: Unassigned » jmizarela

I'm review working on it.

avpaderno’s picture

Status: Needs review » Needs work
jmizarela’s picture

Assigned: jmizarela » Unassigned
Status: Needs work » Needs review
StatusFileSize
new301.46 KB

Hey, so this patch ended up quite big, with about 9k lines, so I did a breakdown of all the changes to make the review easier, and also a list of suggestions for maintainers at the end (I can open new issues if they are agreed upon):

_= What was done in this patch (to clean up D7 codebase):

On each schema, on schema_metatag/tests/* and schema_metatag/:
- Added function return type hinting
- Renamed test functions to follow convention
- from: SchemaMetatagSchemaNameTest to: SchemaSchemaNameMetatagTest
- on (schema_): filenames, class name and .info files list
- Replaced arrays with short array syntax (param and inside functions)
- Removed information that is added by packaging script to (schema_) .info
- Split long arrays into multi-line arrays
- Used variable $weight (in .inc _info) from the beginning instead of repeating its value

On each file of src/:
- Added function parameters and return type hinting where possible (non-union, non-mixed)

On SchemaActionTrait:
- Corrected docblock @param type of $flattened from string to bool

On SchemaMetatagTestTagInterface:
- Corrected docblock @param type of processTestExplodeValue() $delimiter from int to string
- Changed dockblocks @param type and @return type of several functions from mixed to array|string

On SchemaMetatagManagerInterface:
- Corrected dockblock @return type of explode() and unserialize() from array to array|string
- Corrected dockblock of recomputeSerializedLength() that was previously a copy-paste from is isSerialized()

-------

_= What was NOT done on this patch:

- naming of non-test classes / files (warnings for "Class name must be prefixed with the project name" still present)
- code changes/re-writes
- type hinting unsupported by PHP7 (such as mixed or union)
- new docblocks

------

_= Suggestions (to maybe open new issues after this patch is applied):

- Re-write/remove SchemaDurationBase output() method, as it uses an unexistent parent::output()
- Re-write/remove SchemaGovernmentServiceBase formKeys() method, as it uses an inexistent self::governmentServiceFormKeys()
- Re-write SchemaMetatagManager getRenderedJsonld() to stop trying to access $entity propriety as if it were an object
- OR re-write SchemaMetatagManagerInterface getRenderedJsonld() dockblock to reflect that $entity should be an object
- Re-write SchemaMetatagManager explode() and unserialize() to always return an array, add type hinting, and change back (to array) @return type hinting on the SchemaMetatagManagerInterface dockblock.
- Remove unused param $other from SchemaMetatagManager.php Random name() and string()
- update README.txt list of object types
- update required PHP version (as Drupal7 does not use PHP 5.5 anymore) to PHP 7.4

-----

Anyway, when reviewing, please make sure you have all the dependencies for schema_metatag and for metatag, and also that the 924 tests all pass.
Maintainers, please consider the suggestions =)

Cheers!

jmizarela’s picture

StatusFileSize
new296.33 KB

Seems like there were changes I didn't account for. New patch attempt.

jmizarela’s picture

StatusFileSize
new296.14 KB

Ok, my bad again, I had left some ?array/?string etc type hinting that I was sure this PHP version accepted. Well, it doesn't.
I'm very sorry about the comment and hidden/deleted patches trail here, I'm still getting the hang of it.

jmizarela’s picture

StatusFileSize
new295.49 KB
jmizarela’s picture

StatusFileSize
new295.47 KB
jmizarela’s picture

Assigned: Unassigned » jmizarela
Status: Needs review » Needs work

I'll try to fix my linting and do a decent and working patch. Sorry again

jmizarela’s picture

Assigned: jmizarela » Unassigned

Even after many attempts, I wasn't able to reproduce the test environment locally. I hope @viniciuscosta patch and mine may be useful stepping stones to get this fixed, but I don't think I get further here. GL.

thejimbirch’s picture

Status: Needs work » Closed (won't fix)

Closing this issue as Drupal 7 is no longer supported.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.